HTParserHetu class

Default parser implementation used by Hetu.

Inheritance

Constructors

HTParserHetu({ParserConfig? config, HTLexer? lexer, HTLexicon? lexicon})

Properties

column int
getter/setter pairinherited
config ParserConfig
getter/setter pairinherited
currentModuleImports List<ImportExportDecl>
getter/setter pairinherited
currentSource HTSource?
getter/setter pairinherited
currrentFileName String?
The file current under processing, used in error message.
getter/setter pairinherited
curTok Token
Get current token.
getter/setter pairinherited
endOfFile Token
getter/setter pairinherited
errors List<HTError>
getter/setter pairinherited
firstTok Token
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
lexer HTLexer
Lexer used by this parser.
getter/setter pairinherited
line int
getter/setter pairinherited
name String
the identity name of this parser.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

advance([int distance = 1]) Token
Advance till reach distance, return the token at original position.
inherited
expect(List<String> lexemes, {bool consume = false}) bool
Check current token and some tokens after it to see if the types match, return a boolean result. If consume is true, will advance.
inherited
handleTrailing(ASTNode expr, {String? separateToken}) bool
return true if separateToken is found
inherited
match(String lexeme) Token
If the token lexeme the lexeme provided, advance 1 and return the original token. If not, generate an error.
inherited
match2(Set<String> lexemes) Token
same with match, with plural types provided.
inherited
matchId() TokenIdentifier
If the current token is an identifier, advance 1 and return the original token. If not, generate an error.
inherited
matchString() TokenStringLiteral
If the current token is an identifier, advance 1 and return the original token. If not, generate an error. Note this only accept string literal but not string interpolation.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parseEndOfStmtMark({bool required = false}) bool
inherited
parseExpr() ASTNode
Recursive descent parsing
override
parseExprList<T extends ASTNode>({required String endToken, String? separateToken, required T? parseFunction()}) List<T>
A functional programming way to parse expression seperated by comma, such as parameter list, argumetn list, list, group... etc. the comma after the last expression is optional. Note that this method will not consume either the start or the end mark.
inherited
parseSource(HTSource source) ASTSource
Convert string content into ASTSource by a certain grammar rules set.
inherited
parseStmt({required ParseStyle style}) ASTNode?
override
parseTokens(Token token, {HTSource? source, ParseStyle? style}) List<ASTNode>
Convert tokens into a list of ASTNode by a certain grammar rules set.
inherited
peek(int distance) Token
Get a token at a relative distance from current position.
inherited
resetFlags() → void
override
savePrecedings() List<ASTAnnotation>
To handle the comments & empty lines before a expr;
inherited
seek(String type) Token
Search for a token type, return the token next to it.
inherited
seekGroupClosing(Map<String, String> groupClosings) Token
Search for parentheses end that can close the current one, return the token next to it.
inherited
setTokens({required Token token, int? line, int? column}) → void
Set current tokens.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited