Grammar class final
A compiled TextMate grammar.
Rules and scanners are compiled lazily on first use.
Constructors
-
Grammar(Map<
String, Object?> rawGrammar, {required RegexEngine engine, GrammarLookup? lookup, InjectionLookup? injections, int maxLineLength = 20000}) -
Compiles
rawGrammarforengine.lookupfinds grammars it includes by scope name andinjectionsthe grammars injected into it.Highlighter.grammarsets these up; create a Grammar directly only to manage grammars yourself.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxLineLength → int
-
Lines longer than this many UTF-16 code units are not tokenized. They
become one token in the current scope. 0 means no limit. See
Highlighter.maxLineLength.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scopeName → String
-
The grammar's root scope, for example
source.dart.final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
tokenize(
String code) → List< List< Token> > - Tokenizes a whole document, split with splitLines.
-
tokenizeLine(
String line, [StateStack? state]) → LineTokens -
Tokenizes one
line, which must not contain a line break. Pass the previous line's LineTokens.endState asstate, ornullfor the first line of a document. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited