Java Code Examples for org.antlr.runtime.ANTLRStringStream#setCharPositionInLine()
The following examples show how to use
org.antlr.runtime.ANTLRStringStream#setCharPositionInLine() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActionTranslator.java From codebuff with BSD 2-Clause "Simplified" License | 6 votes |
public static List<ActionChunk> translateActionChunk(OutputModelFactory factory, RuleFunction rf, String action, ActionAST node) { Token tokenWithinAction = node.token; ActionTranslator translator = new ActionTranslator(factory, node); translator.rf = rf; factory.getGrammar().tool.log("action-translator", "translate " + action); String altLabel = node.getAltLabel(); if ( rf!=null ) { translator.nodeContext = rf.ruleCtx; if ( altLabel!=null ) translator.nodeContext = rf.altLabelCtxs.get(altLabel); } ANTLRStringStream in = new ANTLRStringStream(action); in.setLine(tokenWithinAction.getLine()); in.setCharPositionInLine(tokenWithinAction.getCharPositionInLine()); ActionSplitter trigger = new ActionSplitter(in, translator); // forces eval, triggers listener methods trigger.getActionTokens(); return translator.chunks; }
Example 2
Source File: ActionSniffer.java From codebuff with BSD 2-Clause "Simplified" License | 5 votes |
public void examineAction() { //System.out.println("examine "+actionToken); ANTLRStringStream in = new ANTLRStringStream(actionToken.getText()); in.setLine(actionToken.getLine()); in.setCharPositionInLine(actionToken.getCharPositionInLine()); ActionSplitter splitter = new ActionSplitter(in, this); // forces eval, triggers listener methods node.chunks = splitter.getActionTokens(); }
Example 3
Source File: ActionSniffer.java From codebuff with BSD 2-Clause "Simplified" License | 5 votes |
public void processNested(Token actionToken) { ANTLRStringStream in = new ANTLRStringStream(actionToken.getText()); in.setLine(actionToken.getLine()); in.setCharPositionInLine(actionToken.getCharPositionInLine()); ActionSplitter splitter = new ActionSplitter(in, this); // forces eval, triggers listener methods splitter.getActionTokens(); }
Example 4
Source File: AttributeChecks.java From codebuff with BSD 2-Clause "Simplified" License | 5 votes |
public void examineAction() { //System.out.println("examine "+actionToken); ANTLRStringStream in = new ANTLRStringStream(actionToken.getText()); in.setLine(actionToken.getLine()); in.setCharPositionInLine(actionToken.getCharPositionInLine()); ActionSplitter splitter = new ActionSplitter(in, this); // forces eval, triggers listener methods node.chunks = splitter.getActionTokens(); }