public interface ATNFactory
| Modifier and Type | Interface and Description |
|---|---|
static class |
ATNFactory.Handle
A pair of states pointing to the left/right (start and end) states of a
state submachine.
|
| Modifier and Type | Method and Description |
|---|---|
ATNFactory.Handle |
action(ActionAST action)
Build what amounts to an epsilon transition with an action.
|
ATNFactory.Handle |
action(String action) |
ATNFactory.Handle |
alt(List<ATNFactory.Handle> els) |
ATNFactory.Handle |
block(BlockAST blockAST,
GrammarAST ebnfRoot,
List<ATNFactory.Handle> alternativeGrips)
From A|B|..|Z alternative block build
o->o-A->o->o (last ATNState is blockEndATNState pointed to by all alts)
| ^
o->o-B->o--|
| |
...
|
ATNFactory.Handle |
charSetLiteral(GrammarAST charSetAST) |
ATN |
createATN() |
ATNFactory.Handle |
epsilon(GrammarAST node)
From an empty alternative build Grip o-e->o
|
ATNFactory.Handle |
label(ATNFactory.Handle t) |
ATNFactory.Handle |
lexerAltCommands(ATNFactory.Handle alt,
ATNFactory.Handle cmds) |
ATNFactory.Handle |
lexerCallCommand(GrammarAST ID,
GrammarAST arg) |
ATNFactory.Handle |
lexerCommand(GrammarAST ID) |
ATNFactory.Handle |
listLabel(ATNFactory.Handle t) |
ATNState |
newState() |
ATNFactory.Handle |
optional(GrammarAST optAST,
ATNFactory.Handle blk)
From (A)? build either:
o--A->o
| ^
o---->|
or, if A is a block, just add an empty alt to the end of the block
|
ATNFactory.Handle |
plus(GrammarAST plusAST,
ATNFactory.Handle blk)
From (A)+ build
|---| (Transition 2 from A.right points at alt 1)
v | (follow of loop is Transition 1)
o->o-A-o->o
Meaning that the last ATNState in A points back to A's left Transition ATNState
and we add a new begin/end ATNState.
|
ATNFactory.Handle |
range(GrammarAST a,
GrammarAST b) |
ATNFactory.Handle |
rule(GrammarAST ruleAST,
String name,
ATNFactory.Handle blk) |
ATNFactory.Handle |
ruleRef(GrammarAST node)
For reference to rule r, build
o-e->(r) o
where (r) is the start of rule r and the trailing o is not linked
to from rule ref state directly (it's done thru the transition(0)
RuleClosureTransition.
|
ATNFactory.Handle |
sempred(PredAST pred)
Build what amounts to an epsilon transition with a semantic
predicate action.
|
ATNFactory.Handle |
set(GrammarAST associatedAST,
List<GrammarAST> alts,
boolean invert) |
void |
setCurrentOuterAlt(int alt) |
void |
setCurrentRuleName(String name) |
ATNFactory.Handle |
star(GrammarAST starAST,
ATNFactory.Handle blk)
From (A)* build
|---|
v |
o->o-A-o--o (Transition 2 from block end points at alt 1; follow is Transition 1)
| ^
o---------| (optional branch is 2nd alt of optional block containing A+)
Meaning that the last (end) ATNState in A points back to A's
left side ATNState and we add 3 new ATNStates (the
optional branch is built just like an optional subrule).
|
ATNFactory.Handle |
stringLiteral(TerminalAST stringLiteralAST)
For a non-lexer, just build a simple token reference atom.
|
ATNFactory.Handle |
tokenRef(TerminalAST node) |
ATNFactory.Handle |
wildcard(GrammarAST associatedAST)
Build an atom with all possible values in its label
|
void setCurrentOuterAlt(int alt)
@NotNull ATNFactory.Handle rule(@NotNull GrammarAST ruleAST, @NotNull String name, @NotNull ATNFactory.Handle blk)
@NotNull ATNFactory.Handle label(@NotNull ATNFactory.Handle t)
@NotNull ATNFactory.Handle listLabel(@NotNull ATNFactory.Handle t)
@NotNull ATNFactory.Handle tokenRef(@NotNull TerminalAST node)
@NotNull ATNFactory.Handle set(@NotNull GrammarAST associatedAST, @NotNull List<GrammarAST> alts, boolean invert)
@NotNull ATNFactory.Handle charSetLiteral(@NotNull GrammarAST charSetAST)
@NotNull ATNFactory.Handle range(@NotNull GrammarAST a, @NotNull GrammarAST b)
@NotNull ATNFactory.Handle stringLiteral(@NotNull TerminalAST stringLiteralAST)
@NotNull ATNFactory.Handle ruleRef(@NotNull GrammarAST node)
node - @NotNull ATNFactory.Handle epsilon(@NotNull GrammarAST node)
@NotNull ATNFactory.Handle sempred(@NotNull PredAST pred)
@NotNull ATNFactory.Handle action(@NotNull ActionAST action)
@NotNull ATNFactory.Handle action(@NotNull String action)
@NotNull ATNFactory.Handle alt(@NotNull List<ATNFactory.Handle> els)
@NotNull ATNFactory.Handle block(@NotNull BlockAST blockAST, @NotNull GrammarAST ebnfRoot, @NotNull List<ATNFactory.Handle> alternativeGrips)
@NotNull ATNFactory.Handle optional(@NotNull GrammarAST optAST, @NotNull ATNFactory.Handle blk)
@NotNull ATNFactory.Handle plus(@NotNull GrammarAST plusAST, @NotNull ATNFactory.Handle blk)
@NotNull ATNFactory.Handle star(@NotNull GrammarAST starAST, @NotNull ATNFactory.Handle blk)
@NotNull ATNFactory.Handle wildcard(@NotNull GrammarAST associatedAST)
@NotNull ATNFactory.Handle lexerAltCommands(@NotNull ATNFactory.Handle alt, @NotNull ATNFactory.Handle cmds)
@NotNull ATNFactory.Handle lexerCallCommand(@NotNull GrammarAST ID, @NotNull GrammarAST arg)
@NotNull ATNFactory.Handle lexerCommand(@NotNull GrammarAST ID)
Copyright © 1992–2020 Tunnel Vision Laboratories, LLC. All rights reserved.