public static IList <ActionChunk> TranslateActionChunk(OutputModelFactory factory, RuleFunction rf, string action, ActionAST node) { IToken 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) { AltLabelStructDecl decl; rf.altLabelCtxs.TryGetValue(altLabel, out decl); translator.nodeContext = decl; } } ANTLRStringStream @in = new ANTLRStringStream(action); @in.Line = tokenWithinAction.Line; @in.CharPositionInLine = tokenWithinAction.CharPositionInLine; ActionSplitter trigger = new ActionSplitter(@in, translator); // forces eval, triggers listener methods trigger.GetActionTokens(); return(translator.chunks); }
public virtual void ProcessNested(IToken actionToken) { ANTLRStringStream @in = new ANTLRStringStream(actionToken.Text); @in.Line = actionToken.Line; @in.CharPositionInLine = actionToken.CharPositionInLine; ActionSplitter splitter = new ActionSplitter(@in, this); // forces eval, triggers listener methods splitter.GetActionTokens(); }
public virtual void ExamineAction() { //System.out.println("examine "+actionToken); ANTLRStringStream @in = new ANTLRStringStream(actionToken.Text); @in.Line = actionToken.Line; @in.CharPositionInLine = actionToken.CharPositionInLine; ActionSplitter splitter = new ActionSplitter(@in, this); // forces eval, triggers listener methods node.chunks = splitter.GetActionTokens(); }
public static bool ActionIsContextDependent(ActionAST actionAST) { ANTLRStringStream @in = new ANTLRStringStream(actionAST.Token.Text); @in.Line = actionAST.Token.Line; @in.CharPositionInLine = actionAST.Token.CharPositionInLine; var listener = new ContextDependentListener(); ActionSplitter splitter = new ActionSplitter(@in, listener); // forces eval, triggers listener methods splitter.GetActionTokens(); return listener.dependent; }
public static bool ActionIsContextDependent(ActionAST actionAST) { ANTLRStringStream @in = new ANTLRStringStream(actionAST.Token.Text); @in.Line = actionAST.Token.Line; @in.CharPositionInLine = actionAST.Token.CharPositionInLine; var listener = new ContextDependentListener(); ActionSplitter splitter = new ActionSplitter(@in, listener); // forces eval, triggers listener methods splitter.GetActionTokens(); return(listener.dependent); }
public static IList<ActionChunk> TranslateActionChunk(OutputModelFactory factory, RuleFunction rf, string action, ActionAST node) { IToken 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) { AltLabelStructDecl decl; rf.altLabelCtxs.TryGetValue(altLabel, out decl); translator.nodeContext = decl; } } ANTLRStringStream @in = new ANTLRStringStream(action); @in.Line = tokenWithinAction.Line; @in.CharPositionInLine = tokenWithinAction.CharPositionInLine; ActionSplitter trigger = new ActionSplitter(@in, translator); // forces eval, triggers listener methods trigger.GetActionTokens(); return translator.chunks; }