Documentation ¶
Overview ¶
Package parser defines basic parser utilities. It defines a parser type which may be embedded to create specialized parsers.
Index ¶
- type Parser
- func (this *Parser) EOF() bool
- func (this *Parser) Expect(allowed ...lexer.TokenKind) error
- func (this *Parser) ExpectDesc(description string, allowed ...lexer.TokenKind) error
- func (this *Parser) ExpectNext(allowed ...lexer.TokenKind) error
- func (this *Parser) ExpectNextDesc(description string, allowed ...lexer.TokenKind) error
- func (this *Parser) ExpectValue(kind lexer.TokenKind, allowed ...string) error
- func (this *Parser) ExpectValueDesc(description string, kind lexer.TokenKind, allowed ...string) error
- func (this *Parser) Is(allowed ...lexer.TokenKind) bool
- func (this *Parser) Kind() lexer.TokenKind
- func (this *Parser) Next() error
- func (this *Parser) Pos() errors.Position
- func (this *Parser) Value() string
- func (this *Parser) ValueIs(allowed ...string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Parser ¶
Parser is an embeddable type that contains parsing utilities. It is used to build more specialized parsers.
func (*Parser) Expect ¶
Expect checks the current token to see if it matches a list of token kind(s), else it returns an error describing what it expected.
func (*Parser) ExpectDesc ¶
ExpectDesc is like Expect, but the expected entitie(s) are described manually. This can be helpful when a large syntactical entity is expected and the first token(s) of it would offer useless information to the user.
func (*Parser) ExpectNext ¶
ExpectNext is like Expect, but gets the next token first.
func (*Parser) ExpectNextDesc ¶
ExpectNextDesc is like ExpectDesc, but gets the next token first.
func (*Parser) ExpectValue ¶
ExpectValue returns an error if the current token's value does not match the allowed values.
func (*Parser) ExpectValueDesc ¶
func (this *Parser) ExpectValueDesc(description string, kind lexer.TokenKind, allowed ...string) error
ExpectValueDesc is like ExpectValue, but the expected value(s) are described manually.
Directories ¶
Path | Synopsis |
---|---|
Package fsplParser implements the parsing stage of the FSPL compiler.
|
Package fsplParser implements the parsing stage of the FSPL compiler. |
Package metaParser provides parsing for FSPL module metadata files.
|
Package metaParser provides parsing for FSPL module metadata files. |