@Override public Handle lexerCommand(GrammarAST ID) { LexerAction lexerAction = createLexerAction(ID, null); if (lexerAction != null) { return action(ID, lexerAction); } // fall back to standard action generation for the command ST cmdST = codegenTemplates.getInstanceOf("Lexer" + CharSupport.capitalize(ID.getText()) + "Command"); if (cmdST == null) { g.tool.errMgr.grammarError(ErrorType.INVALID_LEXER_COMMAND, g.fileName, ID.token, ID.getText()); return epsilon(ID); } if (cmdST.impl.formalArguments != null && cmdST.impl.formalArguments.containsKey("arg")) { g.tool.errMgr.grammarError(ErrorType.MISSING_LEXER_COMMAND_ARGUMENT, g.fileName, ID.token, ID.getText()); return epsilon(ID); } return action(cmdST.render()); }
@Override public Handle lexerCommand(GrammarAST ID) { LexerAction lexerAction = createLexerAction(ID, null); if (lexerAction != null) { return action(ID, lexerAction); } // fall back to standard action generation for the command ST cmdST = codegenTemplates.getInstanceOf("Lexer" + CharSupport.capitalize(ID.getText()) + "Command"); if (cmdST == null) { g.tool.errMgr.grammarError(ErrorType.INVALID_LEXER_COMMAND, g.fileName, ID.token, ID.getText()); return epsilon(ID); } if (cmdST.impl.formalArguments != null && cmdST.impl.formalArguments.containsKey("arg")) { g.tool.errMgr.grammarError(ErrorType.MISSING_LEXER_COMMAND_ARGUMENT, g.fileName, ID.token, ID.getText()); return epsilon(ID); } return action(cmdST.render()); }
@Override public Handle lexerCommand(GrammarAST ID) { LexerAction lexerAction = createLexerAction(ID, null); if (lexerAction != null) { return action(ID, lexerAction); } // fall back to standard action generation for the command ST cmdST = codegenTemplates.getInstanceOf("Lexer" + CharSupport.capitalize(ID.getText()) + "Command"); if (cmdST == null) { g.tool.errMgr.grammarError(ErrorType.INVALID_LEXER_COMMAND, g.fileName, ID.token, ID.getText()); return epsilon(ID); } if (cmdST.impl.formalArguments != null && cmdST.impl.formalArguments.containsKey("arg")) { g.tool.errMgr.grammarError(ErrorType.MISSING_LEXER_COMMAND_ARGUMENT, g.fileName, ID.token, ID.getText()); return epsilon(ID); } return action(cmdST.render()); }
@Override public Handle lexerCommand(GrammarAST ID) { LexerAction lexerAction = createLexerAction(ID, null); if (lexerAction != null) { return action(ID, lexerAction); } // fall back to standard action generation for the command ST cmdST = codegenTemplates.getInstanceOf("Lexer" + CharSupport.capitalize(ID.getText())+ "Command"); if (cmdST == null) { g.tool.errMgr.grammarError(ErrorType.INVALID_LEXER_COMMAND, g.fileName, ID.token, ID.getText()); return epsilon(ID); } if (cmdST.impl.formalArguments != null && cmdST.impl.formalArguments.containsKey("arg")) { g.tool.errMgr.grammarError(ErrorType.MISSING_LEXER_COMMAND_ARGUMENT, g.fileName, ID.token, ID.getText()); return epsilon(ID); } return action(cmdST.render()); }
@Override public Handle lexerCommand(GrammarAST ID) { LexerAction lexerAction = createLexerAction(ID, null); if (lexerAction != null) { return action(ID, lexerAction); } if (codegenTemplates == null) { // suppress reporting a single missing template when the target couldn't be loaded return epsilon(ID); } // fall back to standard action generation for the command ST cmdST = codegenTemplates.getInstanceOf("Lexer" + CharSupport.capitalize(ID.getText()) + "Command"); if (cmdST == null) { g.tool.errMgr.grammarError(ErrorType.INVALID_LEXER_COMMAND, g.fileName, ID.token, ID.getText()); return epsilon(ID); } if (cmdST.impl.formalArguments != null && cmdST.impl.formalArguments.containsKey("arg")) { g.tool.errMgr.grammarError(ErrorType.MISSING_LEXER_COMMAND_ARGUMENT, g.fileName, ID.token, ID.getText()); return epsilon(ID); } return action(cmdST.render()); }
@Override public Handle lexerCallCommand(GrammarAST ID, GrammarAST arg) { LexerAction lexerAction = createLexerAction(ID, arg); if (lexerAction != null) { return action(ID, lexerAction); } // fall back to standard action generation for the command ST cmdST = codegenTemplates.getInstanceOf("Lexer" + CharSupport.capitalize(ID.getText())+ "Command"); if (cmdST == null) { g.tool.errMgr.grammarError(ErrorType.INVALID_LEXER_COMMAND, g.fileName, ID.token, ID.getText()); return epsilon(ID); } if (cmdST.impl.formalArguments == null || !cmdST.impl.formalArguments.containsKey("arg")) { g.tool.errMgr.grammarError(ErrorType.UNWANTED_LEXER_COMMAND_ARGUMENT, g.fileName, ID.token, ID.getText()); return epsilon(ID); } cmdST.add("arg", arg.getText()); return action(cmdST.render()); }
@Override public Handle lexerCallCommand(GrammarAST ID, GrammarAST arg) { LexerAction lexerAction = createLexerAction(ID, arg); if (lexerAction != null) { return action(ID, lexerAction); } // fall back to standard action generation for the command ST cmdST = codegenTemplates.getInstanceOf("Lexer" + CharSupport.capitalize(ID.getText())+ "Command"); if (cmdST == null) { g.tool.errMgr.grammarError(ErrorType.INVALID_LEXER_COMMAND, g.fileName, ID.token, ID.getText()); return epsilon(ID); } if (cmdST.impl.formalArguments == null || !cmdST.impl.formalArguments.containsKey("arg")) { g.tool.errMgr.grammarError(ErrorType.UNWANTED_LEXER_COMMAND_ARGUMENT, g.fileName, ID.token, ID.getText()); return epsilon(ID); } cmdST.add("arg", arg.getText()); return action(cmdST.render()); }
@Override public Handle lexerCallCommand(GrammarAST ID, GrammarAST arg) { LexerAction lexerAction = createLexerAction(ID, arg); if (lexerAction != null) { return action(ID, lexerAction); } // fall back to standard action generation for the command ST cmdST = codegenTemplates.getInstanceOf("Lexer" + CharSupport.capitalize(ID.getText())+ "Command"); if (cmdST == null) { g.tool.errMgr.grammarError(ErrorType.INVALID_LEXER_COMMAND, g.fileName, ID.token, ID.getText()); return epsilon(ID); } if (cmdST.impl.formalArguments == null || !cmdST.impl.formalArguments.containsKey("arg")) { g.tool.errMgr.grammarError(ErrorType.UNWANTED_LEXER_COMMAND_ARGUMENT, g.fileName, ID.token, ID.getText()); return epsilon(ID); } cmdST.add("arg", arg.getText()); cmdST.add("grammar", arg.g); return action(cmdST.render()); }
@Override public Handle lexerCallCommand(GrammarAST ID, GrammarAST arg) { LexerAction lexerAction = createLexerAction(ID, arg); if (lexerAction != null) { return action(ID, lexerAction); } // fall back to standard action generation for the command ST cmdST = codegenTemplates.getInstanceOf("Lexer" + CharSupport.capitalize(ID.getText())+ "Command"); if (cmdST == null) { g.tool.errMgr.grammarError(ErrorType.INVALID_LEXER_COMMAND, g.fileName, ID.token, ID.getText()); return epsilon(ID); } if (cmdST.impl.formalArguments == null || !cmdST.impl.formalArguments.containsKey("arg")) { g.tool.errMgr.grammarError(ErrorType.UNWANTED_LEXER_COMMAND_ARGUMENT, g.fileName, ID.token, ID.getText()); return epsilon(ID); } cmdST.add("arg", arg.getText()); cmdST.add("grammar", arg.g); return action(cmdST.render()); }
@Override public Handle lexerCallCommand(GrammarAST ID, GrammarAST arg) { LexerAction lexerAction = createLexerAction(ID, arg); if (lexerAction != null) { return action(ID, lexerAction); } if (codegenTemplates == null) { // suppress reporting a single missing template when the target couldn't be loaded return epsilon(ID); } // fall back to standard action generation for the command ST cmdST = codegenTemplates.getInstanceOf("Lexer" + CharSupport.capitalize(ID.getText())+ "Command"); if (cmdST == null) { g.tool.errMgr.grammarError(ErrorType.INVALID_LEXER_COMMAND, g.fileName, ID.token, ID.getText()); return epsilon(ID); } if (cmdST.impl.formalArguments == null || !cmdST.impl.formalArguments.containsKey("arg")) { g.tool.errMgr.grammarError(ErrorType.UNWANTED_LEXER_COMMAND_ARGUMENT, g.fileName, ID.token, ID.getText()); return epsilon(ID); } cmdST.add("arg", arg.getText()); cmdST.add("grammar", arg.g); return action(cmdST.render()); }