/usr/share/gocode/src/github.com/twstrike/otr3/sexp/str.go is in golang-github-twstrike-otr3-dev 0.0~git20161015.0.744856d-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | package sexp
import "bufio"
// Sstring represents an S-Expression symbol.
type Sstring string
// First will fail if called on an Sstring
func (s Sstring) First() Value {
panic("not valid to call First on an SString")
}
// Second will fail if called on an Sstring
func (s Sstring) Second() Value {
panic("not valid to call Second on an SString")
}
// String returns the string quoted as a string in an S-Expression
func (s Sstring) String() string {
return "\"" + string(s) + "\""
}
// Value returns the string as a string
func (s Sstring) Value() interface{} {
return string(s)
}
// ReadStringStart will read the string start character and return false if it is not encountered
func ReadStringStart(r *bufio.Reader) bool {
return expect(r, '"')
}
// ReadStringEnd will read the string end character and return false if it is not encountered
func ReadStringEnd(r *bufio.Reader) bool {
return expect(r, '"')
}
// ReadString will read a string from the reader
func ReadString(r *bufio.Reader) Value {
ReadWhitespace(r)
if !ReadStringStart(r) {
return nil
}
result := ReadDataUntil(r, untilFixed('"'))
if !ReadStringEnd(r) {
return nil
}
return Sstring(result)
}
|