Property | Type | Description | |
---|---|---|---|
F | |||
_Check | Symbol | ||
_Error | Symbol | ||
_LA | Symbol | ||
_LA0 | Symbol | ||
_Match | Symbol | ||
_MatchAny | Symbol | ||
_MatchExcept | Symbol | ||
_MatchExceptRange | Symbol | ||
_MatchRange | Symbol | ||
_Skip | Symbol | ||
_T | Symbol | ||
_TryMatch | Symbol | ||
_TryMatchExcept | Symbol | ||
_TryMatchExceptRange | Symbol | ||
_TryMatchRange | Symbol | ||
_alias | Symbol | ||
_classBody | WList |
||
_currentRule | |||
_definedAliases | LNode>.Dictionary | ||
_setNameCounter | int | ||
_underscore | Symbol |
Method | Description | |
---|---|---|
Begin ( WList |
||
BeginRule ( |
||
CallRule ( RuleRef rref, bool recognizerMode ) : LNode | ||
CallTryRecognizer ( RuleRef rref, int lookahead ) : LNode | ||
CodeGenHelperBase ( ) : System | ||
CodeToTerminalPred ( LNode expr, string &errorMsg ) : Pred | ||
CreateRuleMethod ( |
||
CreateTryWrapperForRecognizer ( |
See IPGCodeGenHelper.CreateTryWrapperForRecognizer for more information.
|
|
Done ( ) : void | ||
ErrorBranch ( IPGTerminalSet covered, int laIndex ) : LNode |
Generates code for the default error branch of prediction (called when there is no explicit error branch).
|
|
Example ( IPGTerminalSet set ) : string | ||
ExampleChar ( IPGTerminalSet set ) : char? | ||
GenerateAndPredCheck ( AndPred andPred, LNode code, int li ) : LNode |
Generate code to check an and-predicate during or after prediction, e.g. &!{foo} becomes !(foo) during prediction and Check(!(foo)); afterward. LLLPG substitutes $LI and $LA before it calls this method. This method can return null to suppress the Check statement. |
|
GenerateMatch ( IPGTerminalSet set, bool savingResult, bool recognizerMode ) : LNode | ||
GenerateMatchExpr ( IPGTerminalSet set, bool savingResult, bool recognizerMode ) : LNode |
Generate code to match a set, e.g.
|
|
GenerateSkip ( bool savingResult ) : LNode |
Returns
|
|
GenerateSwitch ( IPGTerminalSet branchSets, MSet |
||
GenerateTest ( IPGTerminalSet set, LNode laVar ) : LNode | ||
GetListType ( LNode type ) : LNode | ||
LA ( int k ) : LNode |
Generates code to read LA(k).
|
|
LAType ( ) : LNode |
Returns the data type of LA(k)
|
|
MakeInitializedVarDecl ( LNode type, bool wantList, Symbol varName ) : LNode | ||
Optimize ( IPGTerminalSet set, IPGTerminalSet dontcare ) : IPGTerminalSet | ||
ResolveAlias ( LNode expr ) : LNode | ||
SetListInitializer ( LNode varDecl ) : void |
Sets ListType and/or ListInitializer based on an expression. A statement like
|
|
ShouldGenerateSwitch ( IPGTerminalSet sets, MSet |
Decides whether to use a switch() and for which cases, using BaseCostForSwitch and GetRelativeCostForSwitch.
|
|
VisitInput ( LNode stmt, IMessageSink sink ) : LNode |
Method | Description | |
---|---|---|
ApiCall ( Symbol apiName ) : LNode |
Returns an LNode representing a call to the specified LLLPG API. For example, if the user used a "inputSource=input" option, then
|
|
ApiCall ( Symbol apiName, IEnumerable |
Returns an LNode representing a call to the specified LLLPG API. For example, if the user used a "inputSource=input" option, then
|
|
ApiType ( LNode typeName ) : LNode | ||
DefaultOf ( LNode type, bool wantList ) : LNode | ||
EndMayBeReachable ( LNode stmt ) : bool | ||
GenerateSetDecl ( IPGTerminalSet set, Symbol setName ) : LNode |
Generates a declaration for a variable that holds the set. For example, if setName is foo, a set such as [aeiouy] might use an external declaration such as |
|
GenerateSetDecl ( IPGTerminalSet set ) : Symbol | ||
GenerateSetName ( |
||
GenerateTest ( IPGTerminalSet set, LNode subject, Symbol setName ) : LNode |
Generates code to test whether a terminal is in the set. At first, LLParserGenerator calls this method with |
|
GetCases ( IPGTerminalSet set ) : IEnumerable |
Gets the literals or symbols to use for switch cases of a set (just the values, not including the case labels.)
|
|
GetRelativeCostForSwitch ( IPGTerminalSet set ) : int |
Used to help decide whether a "switch" or an if statement will be used to handle a prediction tree, and if so which branches. This method should calculate the "cost of switch" (which generally represents a code size penalty, as there is a separate case for every element of the set) and the "cost of if" (which generally represents a speed penalty) and return the difference (so that positive numbers favor "switch" and negative numbers favor "if".) If the set is inverted, return a something like -1000000 to ensure 'switch' is not used for that set. |
Method | Description | |
---|---|---|
AddSwitchHandler ( LNode branch, WList |
||
ForwardedArgList ( LNode args ) : VList |
||
ReplaceT ( LNode expr, LNode replacement ) : LNode | ||
VarName ( LNode varStmt ) : LNode |
protected ApiCall ( Symbol apiName, IEnumerable |
||
apiName | Symbol | |
args | IEnumerable |
Parameters to the API call, or null to access a /// property or field. |
isStatic | bool | |
return | LNode |
public Begin ( WList |
||
classBody | WList |
|
sourceFile | ISourceFile | |
return | void |
public CallRule ( RuleRef rref, bool recognizerMode ) : LNode | ||
rref | RuleRef | |
recognizerMode | bool | |
return | LNode |
public CallTryRecognizer ( RuleRef rref, int lookahead ) : LNode | ||
rref | RuleRef | |
lookahead | int | |
return | LNode |
public abstract CodeToTerminalPred ( LNode expr, string &errorMsg ) : Pred | ||
expr | LNode | |
errorMsg | string | |
return | Pred |
public CreateRuleMethod ( |
||
rule | ||
methodBody | VList |
|
return | LNode |
public CreateTryWrapperForRecognizer ( |
||
rule | ||
return | LNode |
protected DefaultOf ( LNode type, bool wantList ) : LNode | ||
type | LNode | |
wantList | bool | |
return | LNode |
protected static EndMayBeReachable ( LNode stmt ) : bool | ||
stmt | LNode | |
return | bool |
public ErrorBranch ( IPGTerminalSet covered, int laIndex ) : LNode | ||
covered | IPGTerminalSet | The permitted token set, which the input did not match.
/// NOTE: if the input matched but there were and-predicates that did not match,
/// this parameter will be null (e.g. the input is 'b' in |
laIndex | int | Location of unexpected input, relative to current position. |
return | LNode |
public abstract Example ( IPGTerminalSet set ) : string | ||
set | IPGTerminalSet | |
return | string |
public ExampleChar ( IPGTerminalSet set ) : char? | ||
set | IPGTerminalSet | |
return | char? |
public GenerateAndPredCheck ( AndPred andPred, LNode code, int li ) : LNode | ||
andPred | AndPred | Predicate for which an expression has already been generated |
code | LNode | The expression to be checked |
li | int | Current lookahead amount. -1 means "prediction is /// complete, generate a Check() statement". |
return | LNode |
public GenerateMatch ( IPGTerminalSet set, bool savingResult, bool recognizerMode ) : LNode | ||
set | IPGTerminalSet | |
savingResult | bool | |
recognizerMode | bool | |
return | LNode |
public abstract GenerateMatchExpr ( IPGTerminalSet set, bool savingResult, bool recognizerMode ) : LNode | ||
set | IPGTerminalSet | |
savingResult | bool | |
recognizerMode | bool | |
return | LNode |
protected abstract GenerateSetDecl ( IPGTerminalSet set, Symbol setName ) : LNode | ||
set | IPGTerminalSet | |
setName | Symbol | |
return | LNode |
protected GenerateSetDecl ( IPGTerminalSet set ) : Symbol | ||
set | IPGTerminalSet | |
return | Symbol |
protected GenerateSetName ( |
||
currentRule | ||
return | Symbol |
public GenerateSkip ( bool savingResult ) : LNode | ||
savingResult | bool | |
return | LNode |
public GenerateSwitch ( IPGTerminalSet branchSets, MSet |
||
branchSets | IPGTerminalSet | |
casesToInclude | MSet |
|
branchCode | LNode | |
defaultBranch | LNode | |
laVar | LNode | |
return | LNode |
public GenerateTest ( IPGTerminalSet set, LNode laVar ) : LNode | ||
set | IPGTerminalSet | |
laVar | LNode | |
return | LNode |
protected abstract GenerateTest ( IPGTerminalSet set, LNode subject, Symbol setName ) : LNode | ||
set | IPGTerminalSet | |
subject | LNode | Represents the variable to be tested. |
setName | Symbol | Names an external set variable to use for the test. |
return | LNode |
protected GetCases ( IPGTerminalSet set ) : IEnumerable |
||
set | IPGTerminalSet | |
return | IEnumerable |
protected GetRelativeCostForSwitch ( IPGTerminalSet set ) : int | ||
set | IPGTerminalSet | |
return | int |
public MakeInitializedVarDecl ( LNode type, bool wantList, Symbol varName ) : LNode | ||
type | LNode | |
wantList | bool | |
varName | Symbol | |
return | LNode |
public Optimize ( IPGTerminalSet set, IPGTerminalSet dontcare ) : IPGTerminalSet | ||
set | IPGTerminalSet | |
dontcare | IPGTerminalSet | |
return | IPGTerminalSet |
public SetListInitializer ( LNode varDecl ) : void | ||
varDecl | LNode | |
return | void |
public ShouldGenerateSwitch ( IPGTerminalSet sets, MSet |
||
sets | IPGTerminalSet | |
casesToInclude | MSet |
|
hasErrorBranch | bool | |
return | bool |
public VisitInput ( LNode stmt, IMessageSink sink ) : LNode | ||
stmt | LNode | |
sink | IMessageSink | |
return | LNode |
protected static Symbol _TryMatchExceptRange | ||
return | Symbol |