private static ParseException GetMessage( bool module, bool uses, string resourceName, int type) { var message = "Keyword '"; if (module) { message += "module"; } else if (uses) { message += "uses"; } else { message += "import"; } message += "' must be followed by a name or package name (set of names separated by dots) for resource '" + resourceName + "'"; if (type != -1) { string tokenName = EsperEPL2GrammarParser.GetLexerTokenParaphrases().Get(type); if (tokenName == null) { tokenName = EsperEPL2GrammarParser.GetParserTokenParaphrases().Get(type); } if (tokenName != null) { message += ", unexpected reserved keyword " + tokenName + " was encountered as part of the name"; } } return new ParseException(message); }
private static string GetTokenText( EsperEPL2GrammarParser parser, int tokenIndex) { var expected = END_OF_INPUT_TEXT; var vocabulary = parser.Vocabulary; var vocabularyTokenText = vocabulary.GetLiteralName(tokenIndex) ?? vocabulary.GetSymbolicName(tokenIndex); if (vocabularyTokenText != null) { expected = vocabularyTokenText; } var lexerTokenParaphrases = EsperEPL2GrammarParser.GetLexerTokenParaphrases(); if (lexerTokenParaphrases.Get(tokenIndex) != null) { expected = lexerTokenParaphrases.Get(tokenIndex); } var parserTokenParaphrases = EsperEPL2GrammarParser.GetParserTokenParaphrases(); if (parserTokenParaphrases.Get(tokenIndex) != null) { expected = parserTokenParaphrases.Get(tokenIndex); } return expected; }