addLexeme method
Add a lexeme to the grammar. This will bind the lexeme to the grammar, so it can be referenced.
Implementation
void addLexeme(Lexeme lexeme) {
if (lexeme.name == null) return;
lexeme.bind(this);
for (final child in lexeme.allChildren.whereType<Lexeme>()) {
child.bind(this);
if (child is ReferenceLexeme && child.lexemeName == '(self)') {
child.lexeme = lexeme;
}
}
rules.add(lexeme);
}