ExpressionParser class base
The parser: a cursor over tokens, the expression grammar, and two hooks a host language overrides.
A base class: the material language extends it with its declarations
and blocks and reads every expression through parseExpression.
Constructors
-
ExpressionParser(List<
ExpressionToken> tokens, {ExpressionScope scope = const ExpressionScope(), ExpressionSyntax syntax = ExpressionSyntax.standard})
Properties
- current → ExpressionToken
-
The token being read.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- position ↔ int
-
The index of current in tokens.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scope → ExpressionScope
-
What the names mean.
final
- syntax → ExpressionSyntax
-
Which tokens the grammar takes: the comparisons and
? :only with ExpressionSyntax.logic, a unit only with ExpressionSyntax.units.final -
tokens
→ List<
ExpressionToken> -
What is read, ending with a token of kind
end.final
Methods
-
arguments(
) → List< Expression> - The arguments of a call, between parentheses.
-
binary(
ExpressionToken op, Expression left, Expression right) → Expression -
+ - * /, with GLSL's broadcasting; a sum or a difference of one dimension, a product or a quotient of any two. -
builtinNamed(
String name) → ExpressionBuiltin? -
The builtin called
name, from the scope's. -
call(
ExpressionBuiltin builtin, ExpressionToken token) → Expression -
A call of
builtin, its arguments checked by count, width and unit. -
comparison(
ExpressionToken op, Expression left, Expression right) → Expression -
A comparison of two numbers of one dimension, or
==and!=of two bools. -
construct(
ExpressionType type, ExpressionToken token) → Expression -
A constructor of
type, folded when its parts are constant. -
expectToken(
String kind, String what) → ExpressionToken -
current, which must be of
kind, and moves past it;whatis how the refusal names what was expected. -
fail(
String message, {ExpressionToken? where}) → Never -
Throws an ExpressionSyntaxException at
where, current by default. -
logical(
ExpressionToken op, Expression left, Expression right) → Expression -
&&and||of two bools. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
parseAnd(
) → Expression -
parseComparison(
) → Expression -
parseConditional(
) → Expression -
c ? a : b, right to left. -
parseExpression(
) → Expression - One expression, from current on.
-
parseOr(
) → Expression -
parsePostfix(
) → Expression - A primary and its swizzles.
-
parsePrimary(
) → Expression - A number, a parenthesis, a constructor, a call or a name.
-
parseProduct(
) → Expression -
*and/, left to right. -
parseSpecialCall(
ExpressionToken name) → Expression? -
A form the host reads itself, given the name it starts with (already
taken; its
(, if it has one, is current), or null to read the name as a builtin or a variable. Asked after the constructors and before the builtins; the material language readssample(slot, uv)here. -
parseSum(
) → Expression -
+and-, left to right. -
parseUnary(
) → Expression -
-and!. A negated constant is folded. -
quantity(
ExpressionToken number, ExpressionToken unitToken) → Expression -
9.81 [m/s²]: the number in the coherent unit of its dimension. -
resolveName(
ExpressionToken name) → Expression -
What
namemeans where it is read as a value: by default one of the scope's variables, and a refusal for anything else. -
skipIf(
String kind) → bool -
Moves past current if it is of
kind. -
skipWordIf(
String word) → bool -
Moves past current if it is the name
word. -
swizzle(
Expression target, ExpressionToken field) → Expression -
.xyzand.rgb, folded on a constant. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited