DynamicParseTreeCreator

Class for creating trees during parsing.

Members

Aliases

Location
alias Location = Location_
Undocumented in source.
LocationDiff
alias LocationDiff = typeof(Location.init - Location.init)
Undocumented in source.
NonterminalArray
alias NonterminalArray = DynamicParseTreeTmpArray!(Location, LocationRangeImpl)
Undocumented in source.
NonterminalUnion
alias NonterminalUnion = GenericNonterminalUnion!(DynamicParseTreeCreator).Union

Tagged union for different nonterminals, which is used internally by the parser. The union can allow more nonterminals than necessary, which can reduce template bloat.

NonterminalUnionAny
alias NonterminalUnionAny = GenericNonterminalUnion!(DynamicParseTreeCreator).Union!(SymbolID.max, size_t.max)

Tagged union of all possible nonterminals, which is used internally by the parser.

Type
alias Type = DynamicParseTree!(Location, LocationRangeImpl)
Undocumented in source.
allNonterminals
alias allNonterminals = GrammarModule.allNonterminals
Undocumented in source.
allProductions
alias allProductions = GrammarModule.allProductions
Undocumented in source.
allTokens
alias allTokens = GrammarModule.allTokens
Undocumented in source.

Functions

adjustStart
void adjustStart(T result, Location start)

Called for the outermost tree node after parsing. It adjusts the start location if it is stored as the offset from the parent node.

createParseTree
NonterminalType!(allProductions[productionID - startProductionID].nonterminalID.id) createParseTree(Location firstParamStart, Location lastParamEnd, T params)
NonterminalType!(allProductions[productionID - startProductionID].nonterminalID.id) createParseTree(Location firstParamStart, Location lastParamEnd)

Create a tree node for one production.

mergeParseTrees
NonterminalType!(nonterminalID) mergeParseTrees(Location firstParamStart, Location lastParamEnd, ParseStackElem!(Location, NonterminalType!nonterminalID)[] trees)

Creates a special tree node, which contains different ambiguous trees as childs. This is used by GLR parsers. It will only be called by the parser if canMerge!nonterminalID is true.

Manifest constants

endNonterminalID
enum endNonterminalID;
Undocumented in source.
endProductionID
enum endProductionID;
Undocumented in source.
startNonterminalID
enum startNonterminalID;
Undocumented in source.
startProductionID
enum startProductionID;
Undocumented in source.

Templates

NonterminalType
template NonterminalType(SymbolID nonterminalID)

Type used for nonterminal with ID nonterminalID.

canMerge
template canMerge(SymbolID nonterminalID)

Determines if nonterminals with ID nonterminalID can be merged into a single tree node for ambiguities with the GLR parser. Function mergeParseTrees may be called for them.

createParseTreeCombined
template createParseTreeCombined(SymbolID nonterminalID, productionIDs...)

Create a tree node for multiple productions, which are treated as the same. This is used with the generator option --combinedreduce.

Parameters

GrammarModule

Alias to the module with parser and information about the grammar.

Location_

Type of location in source file.

LocationRangeImpl

Template for determining how location ranges are stored (start + length, start + end, ...).

Meta