/** From char 'c' build StateCluster o-intValue(c)->o */ public StateCluster build_CharLiteralAtom(GrammarAST charLiteralAST) { int c = Grammar.getCharValueFromGrammarCharLiteral(charLiteralAST.getText()); return build_Atom(c, charLiteralAST); }
public StateCluster build_Atom(GrammarAST atomAST) { int tokenType = nfa.grammar.getTokenType(atomAST.getText()); return build_Atom(tokenType, atomAST); }
/** From char 'c' build StateCluster o-intValue(c)->o */ public StateCluster build_CharLiteralAtom(GrammarAST charLiteralAST) { int c = Grammar.getCharValueFromGrammarCharLiteral(charLiteralAST.getText()); return build_Atom(c, charLiteralAST); }
/** From char 'c' build StateCluster o-intValue(c)->o */ public StateCluster build_CharLiteralAtom(GrammarAST charLiteralAST) { int c = Grammar.getCharValueFromGrammarCharLiteral(charLiteralAST.getText()); return build_Atom(c, charLiteralAST); }
/** From char 'c' build StateCluster o-intValue(c)->o */ public StateCluster build_CharLiteralAtom(GrammarAST charLiteralAST) { int c = Grammar.getCharValueFromGrammarCharLiteral(charLiteralAST.getText()); return build_Atom(c, charLiteralAST); }
public StateCluster build_Atom(GrammarAST atomAST) { int tokenType = nfa.grammar.getTokenType(atomAST.getText()); return build_Atom(tokenType, atomAST); }
public StateCluster build_Atom(GrammarAST atomAST) { int tokenType = nfa.grammar.getTokenType(atomAST.getText()); return build_Atom(tokenType, atomAST); }
public StateCluster build_Atom(GrammarAST atomAST) { int tokenType = nfa.grammar.getTokenType(atomAST.getText()); return build_Atom(tokenType, atomAST); }
/** Build a subrule matching ^(. .*) (any tree or node). Let's use * (^(. .+) | .) to be safe. */ public StateCluster build_WildcardTree(GrammarAST associatedAST) { StateCluster wildRoot = build_Wildcard(associatedAST); StateCluster down = build_Atom(Label.DOWN, associatedAST); wildRoot = build_AB(wildRoot,down); // hook in; . DOWN // make .+ StateCluster wildChildren = build_Wildcard(associatedAST); wildChildren = build_Aplus(wildChildren); wildRoot = build_AB(wildRoot,wildChildren); // hook in; . DOWN .+ StateCluster up = build_Atom(Label.UP, associatedAST); wildRoot = build_AB(wildRoot,up); // hook in; . DOWN .+ UP // make optional . alt StateCluster optionalNodeAlt = build_Wildcard(associatedAST); List<StateCluster> alts = new ArrayList<StateCluster>(); alts.add(wildRoot); alts.add(optionalNodeAlt); StateCluster blk = build_AlternativeBlock(alts); return blk; }
/** Build a subrule matching ^(. .*) (any tree or node). Let's use * (^(. .+) | .) to be safe. */ public StateCluster build_WildcardTree(GrammarAST associatedAST) { StateCluster wildRoot = build_Wildcard(associatedAST); StateCluster down = build_Atom(Label.DOWN, associatedAST); wildRoot = build_AB(wildRoot,down); // hook in; . DOWN // make .+ StateCluster wildChildren = build_Wildcard(associatedAST); wildChildren = build_Aplus(wildChildren); wildRoot = build_AB(wildRoot,wildChildren); // hook in; . DOWN .+ StateCluster up = build_Atom(Label.UP, associatedAST); wildRoot = build_AB(wildRoot,up); // hook in; . DOWN .+ UP // make optional . alt StateCluster optionalNodeAlt = build_Wildcard(associatedAST); List alts = new ArrayList(); alts.add(wildRoot); alts.add(optionalNodeAlt); StateCluster blk = build_AlternativeBlock(alts); return blk; }
/** Build a subrule matching ^(. .*) (any tree or node). Let's use * (^(. .+) | .) to be safe. */ public StateCluster build_WildcardTree(GrammarAST associatedAST) { StateCluster wildRoot = build_Wildcard(associatedAST); StateCluster down = build_Atom(Label.DOWN, associatedAST); wildRoot = build_AB(wildRoot,down); // hook in; . DOWN // make .+ StateCluster wildChildren = build_Wildcard(associatedAST); wildChildren = build_Aplus(wildChildren); wildRoot = build_AB(wildRoot,wildChildren); // hook in; . DOWN .+ StateCluster up = build_Atom(Label.UP, associatedAST); wildRoot = build_AB(wildRoot,up); // hook in; . DOWN .+ UP // make optional . alt StateCluster optionalNodeAlt = build_Wildcard(associatedAST); List<StateCluster> alts = new ArrayList<StateCluster>(); alts.add(wildRoot); alts.add(optionalNodeAlt); StateCluster blk = build_AlternativeBlock(alts); return blk; }
/** Build a subrule matching ^(. .*) (any tree or node). Let's use * (^(. .+) | .) to be safe. */ public StateCluster build_WildcardTree(GrammarAST associatedAST) { StateCluster wildRoot = build_Wildcard(associatedAST); StateCluster down = build_Atom(Label.DOWN, associatedAST); wildRoot = build_AB(wildRoot,down); // hook in; . DOWN // make .+ StateCluster wildChildren = build_Wildcard(associatedAST); wildChildren = build_Aplus(wildChildren); wildRoot = build_AB(wildRoot,wildChildren); // hook in; . DOWN .+ StateCluster up = build_Atom(Label.UP, associatedAST); wildRoot = build_AB(wildRoot,up); // hook in; . DOWN .+ UP // make optional . alt StateCluster optionalNodeAlt = build_Wildcard(associatedAST); List alts = new ArrayList(); alts.add(wildRoot); alts.add(optionalNodeAlt); StateCluster blk = build_AlternativeBlock(alts); return blk; }
/** For a non-lexer, just build a simple token reference atom. * For a lexer, a string is a sequence of char to match. That is, * "fog" is treated as 'f' 'o' 'g' not as a single transition in * the DFA. Machine== o-'f'->o-'o'->o-'g'->o and has n+1 states * for n characters. */ public StateCluster build_StringLiteralAtom(GrammarAST stringLiteralAST) { if ( nfa.grammar.type==Grammar.LEXER ) { StringBuffer chars = Grammar.getUnescapedStringFromGrammarStringLiteral(stringLiteralAST.getText()); NFAState first = newState(); NFAState last = null; NFAState prev = first; for (int i=0; i<chars.length(); i++) { int c = chars.charAt(i); NFAState next = newState(); transitionBetweenStates(prev, next, c); prev = last = next; } return new StateCluster(first, last); } // a simple token reference in non-Lexers int tokenType = nfa.grammar.getTokenType(stringLiteralAST.getText()); return build_Atom(tokenType, stringLiteralAST); }
/** For a non-lexer, just build a simple token reference atom. * For a lexer, a string is a sequence of char to match. That is, * "fog" is treated as 'f' 'o' 'g' not as a single transition in * the DFA. Machine== o-'f'->o-'o'->o-'g'->o and has n+1 states * for n characters. */ public StateCluster build_StringLiteralAtom(GrammarAST stringLiteralAST) { if ( nfa.grammar.type==Grammar.LEXER ) { StringBuffer chars = Grammar.getUnescapedStringFromGrammarStringLiteral(stringLiteralAST.getText()); NFAState first = newState(); NFAState last = null; NFAState prev = first; for (int i=0; i<chars.length(); i++) { int c = chars.charAt(i); NFAState next = newState(); transitionBetweenStates(prev, next, c); prev = last = next; } return new StateCluster(first, last); } // a simple token reference in non-Lexers int tokenType = nfa.grammar.getTokenType(stringLiteralAST.getText()); return build_Atom(tokenType, stringLiteralAST); }
/** For a non-lexer, just build a simple token reference atom. * For a lexer, a string is a sequence of char to match. That is, * "fog" is treated as 'f' 'o' 'g' not as a single transition in * the DFA. Machine== o-'f'->o-'o'->o-'g'->o and has n+1 states * for n characters. */ public StateCluster build_StringLiteralAtom(GrammarAST stringLiteralAST) { if ( nfa.grammar.type==Grammar.LEXER ) { StringBuffer chars = Grammar.getUnescapedStringFromGrammarStringLiteral(stringLiteralAST.getText()); NFAState first = newState(); NFAState last = null; NFAState prev = first; for (int i=0; i<chars.length(); i++) { int c = chars.charAt(i); NFAState next = newState(); transitionBetweenStates(prev, next, c); prev = last = next; } return new StateCluster(first, last); } // a simple token reference in non-Lexers int tokenType = nfa.grammar.getTokenType(stringLiteralAST.getText()); return build_Atom(tokenType, stringLiteralAST); }
/** For a non-lexer, just build a simple token reference atom. * For a lexer, a string is a sequence of char to match. That is, * "fog" is treated as 'f' 'o' 'g' not as a single transition in * the DFA. Machine== o-'f'->o-'o'->o-'g'->o and has n+1 states * for n characters. */ public StateCluster build_StringLiteralAtom(GrammarAST stringLiteralAST) { if ( nfa.grammar.type==Grammar.LEXER ) { StringBuffer chars = Grammar.getUnescapedStringFromGrammarStringLiteral(stringLiteralAST.getText()); NFAState first = newState(); NFAState last = null; NFAState prev = first; for (int i=0; i<chars.length(); i++) { int c = chars.charAt(i); NFAState next = newState(); transitionBetweenStates(prev, next, c); prev = last = next; } return new StateCluster(first, last); } // a simple token reference in non-Lexers int tokenType = nfa.grammar.getTokenType(stringLiteralAST.getText()); return build_Atom(tokenType, stringLiteralAST); }
_t = _retTree; down = factory.build_Atom(Label.DOWN, el); up = factory.build_Atom(Label.UP, el);
if ( state.backtracking==0 ) { retval.g = (e!=null?((TreeToNFAConverter.element_return)e).g:null); } if ( state.backtracking==0 ) { down = factory.build_Atom(Label.DOWN, (e!=null?((GrammarAST)e.start):null)); up = factory.build_Atom(Label.UP, (e!=null?((GrammarAST)e.start):null));
if ( state.backtracking==0 ) { retval.g = (e!=null?((TreeToNFAConverter.element_return)e).g:null); } if ( state.backtracking==0 ) { down = factory.build_Atom(Label.DOWN, (e!=null?((GrammarAST)e.start):null)); up = factory.build_Atom(Label.UP, (e!=null?((GrammarAST)e.start):null));
g = factory.build_Atom(t); t.followingNFAState = g.right; g = factory.build_Atom(c); c.followingNFAState = g.right; g = factory.build_Atom(s); s.followingNFAState = g.right;