Grammar class final
A syntax grammar: an ordered list of GrammarToken rules applied to source text to produce styled spans.
Grammars are tree-shakeable: each language lives in its own library (e.g.
highlight/dart.dart) exposing a single grammar, so importing one never
references the others and unused languages are dropped by the compiler.
Constructors
-
Grammar(List<
GrammarToken> tokens, {Grammar rest()?}) - A syntax grammar: an ordered list of GrammarToken rules applied to source text to produce styled spans.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- rest → Grammar?
-
An additional grammar whose rules are applied after tokens (used by
templating languages to fall back to a host grammar). Stored as a thunk so
it can reference other languages without cycles.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
tokens
→ List<
GrammarToken> -
The token rules, applied in order. Earlier rules claim their text first
(this ordering is what lets strings and comments swallow characters that
later rules would otherwise match).
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited