Documentation ¶
Index ¶
- type Lexer
- func (lex *Lexer) IsEOF() bool
- func (lex *Lexer) LatestErr() error
- func (lex *Lexer) Next()
- func (lex *Lexer) NextComment()
- func (lex *Lexer) NextKeyword()
- func (lex *Lexer) NextKeywordOrStrLit()
- func (lex *Lexer) NextLit()
- func (lex *Lexer) NextNumberLit()
- func (lex *Lexer) NextStrLit()
- func (lex *Lexer) Peek() scanner.Token
- func (lex *Lexer) ReadConstant() (string, scanner.Position, error)
- func (lex *Lexer) ReadEmptyStatement() error
- func (lex *Lexer) ReadEnumType() (string, scanner.Position, error)
- func (lex *Lexer) ReadFullIdent() (string, scanner.Position, error)
- func (lex *Lexer) ReadMessageType() (string, scanner.Position, error)
- func (lex *Lexer) UnNext()
- func (lex *Lexer) UnNextTo(lastScan []rune)
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Lexer ¶
type Lexer struct { // Token is the lexical token. Token scanner.Token // Text is the lexical value. Text string // RawText is the scanned raw text. RawText []rune // Pos is the source position. Pos scanner.Position // Error is called for each error encountered. If no Error // function is set, the error is reported to os.Stderr. Error func(lexer *Lexer, err error) // contains filtered or unexported fields }
Lexer is a lexer.
func (*Lexer) LatestErr ¶
LatestErr returns the latest non-EOF error that was encountered by the Lexer.Next().
func (*Lexer) NextComment ¶
func (lex *Lexer) NextComment()
NextComment scans the read buffer with ScanComment mode.
func (*Lexer) NextKeyword ¶
func (lex *Lexer) NextKeyword()
NextKeyword scans the read buffer with ScanKeyword mode.
func (*Lexer) NextKeywordOrStrLit ¶
func (lex *Lexer) NextKeywordOrStrLit()
NextKeywordOrStrLit scans the read buffer with ScanKeyword or ScanStrLit modes.
func (*Lexer) NextLit ¶
func (lex *Lexer) NextLit()
NextLit scans the read buffer with ScanLit mode.
func (*Lexer) NextNumberLit ¶
func (lex *Lexer) NextNumberLit()
NextNumberLit scans the read buffer with ScanNumberLit mode.
func (*Lexer) NextStrLit ¶
func (lex *Lexer) NextStrLit()
NextStrLit scans the read buffer with ScanStrLit mode.
func (*Lexer) Peek ¶ added in v1.3.0
Peek returns the next token with keeping the read buffer unchanged.
func (*Lexer) ReadConstant ¶
ReadConstant reads a constant. constant = fullIdent | ( [ "-" | "+" ] intLit ) | ( [ "-" | "+" ] floatLit ) | strLit | boolLit
func (*Lexer) ReadEmptyStatement ¶
ReadEmptyStatement reads an emptyStatement.
emptyStatement = ";"
See https://developers.google.com/protocol-buffers/docs/reference/proto3-spec#emptystatement
func (*Lexer) ReadEnumType ¶
ReadEnumType reads a messageType. enumType = [ "." ] { ident "." } enumName See https://developers.google.com/protocol-buffers/docs/reference/proto3-spec#identifiers
func (*Lexer) ReadFullIdent ¶
ReadFullIdent reads a fullIdent. fullIdent = ident { "." ident }
func (*Lexer) ReadMessageType ¶
ReadMessageType reads a messageType. messageType = [ "." ] { ident "." } messageName See https://developers.google.com/protocol-buffers/docs/reference/proto3-spec#identifiers