HTDefaultParser class
Default parser implementation used by Hetu.
Constructors
- HTDefaultParser({ParserConfig? config})
Properties
- column ↔ int
-
getter/setter pairinherited
- config ↔ ParserConfig
-
getter/setter pairinherited
-
currentModuleImports
↔ List<
ImportExportDecl> -
getter/setter pairinherited
-
currentPrecedings
↔ List<
ASTAnnotation> -
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, created from lexicon.
latefinalinherited
- lexicon ↔ HTLexicon
-
Lexicon definition used by this parser.
latefinalinherited
- 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> types, {bool consume = false}) → bool -
Check current token and some tokens after it to see if the
types
match, return a boolean result. Ifconsume
is true, will advance.inherited -
handlePrecedings(
) → bool -
To handle the comments & empty lines before a expr;
inherited
-
handleTrailing(
ASTNode expr, {bool handleComma = true, String? endMarkForCommaExpressions}) → void -
inherited
-
match(
String type) → Token -
If the token match the
type
provided, advance 1 and return the original token. If not, generate an error.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
parseExpr(
) → ASTNode -
Recursive descent parsing
override
-
parseExprList<
T extends ASTNode> ({required String endToken, bool handleComma = true, 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, {bool printPerformanceStatistics = false}) → 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> -
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
-
setPrecedings(
ASTNode expr) → bool -
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