Documentation ¶
Index ¶
- func IsWhitespace(char byte) bool
- func MaybeTokenizeSymbol(reader *LocationReader, sortedSymbols Symbols) (*Symbol, Location, error)
- func StripLeadingWhitespaces(reader *LocationReader) error
- func StripLeadingWhitespacesAndComments(reader *LocationReader) error
- type Location
- type LocationReader
- type Symbol
- type Symbols
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsWhitespace ¶
func MaybeTokenizeSymbol ¶
func MaybeTokenizeSymbol( reader *LocationReader, sortedSymbols Symbols) ( *Symbol, Location, error)
func StripLeadingWhitespaces ¶
func StripLeadingWhitespaces(reader *LocationReader) error
Strip all leading whitespaces
func StripLeadingWhitespacesAndComments ¶
func StripLeadingWhitespacesAndComments(reader *LocationReader) error
Strip all leading whitespaces as well as golang style comments (i.e., /* */ and //)
Types ¶
type Location ¶
maybe track end line / end column?
func MaybeTokenizeCharacter ¶
func MaybeTokenizeCharacter(reader *LocationReader) (string, Location, error)
If the reader's leading bytes are ascii character of the form 'x' (or '\t' for escaped characters), pop those bytes off the reader and return the value. Otherwise, return a nil slice.
func MaybeTokenizeIdentifier ¶
func MaybeTokenizeIdentifier(reader *LocationReader) (string, Location, error)
If the reader's leading bytes are identifer of the form [a-zA-Z_]\w* , pop those bytes off the reader and return the value. Otherwise, return a nil slice.
func (Location) ShortString ¶
type LocationReader ¶
type LocationReader struct { Location // contains filtered or unexported fields }
Not efficient, but probably good enough
func NewLocationReader ¶
func NewLocationReader(fileName string, reader io.Reader) *LocationReader
func (*LocationReader) ReadByte ¶
func (r *LocationReader) ReadByte() (byte, error)
func (*LocationReader) ReadString ¶
func (r *LocationReader) ReadString(delim byte) (string, error)
Click to show internal directories.
Click to hide internal directories.