org.antlr.runtime.RecognitionException Java Examples

The following examples show how to use org.antlr.runtime.RecognitionException. 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: TestQueryParser.java    From spork with Apache License 2.0 6 votes vote down vote up
@Test
public void test() throws IOException, RecognitionException  {
    CharStream input = new QueryParserFileStream( "test/org/apache/pig/parser/TestParser.pig" );
    QueryLexer lexer = new QueryLexer(input);
    CommonTokenStream tokens = new  CommonTokenStream(lexer);

    QueryParser parser = new QueryParser(tokens);
    QueryParser.query_return result = parser.query();

    Tree ast = (Tree)result.getTree();

    System.out.println( ast.toStringTree() );
    TreePrinter.printTree( (CommonTree)ast, 0 );
    Assert.assertEquals( 0, lexer.getNumberOfSyntaxErrors() );
    Assert.assertEquals( 0, parser.getNumberOfSyntaxErrors() );
}
 
Example #2
Source File: ParserATNFactory.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
protected void _createATN(Collection<Rule> rules) {
	createRuleStartAndStopATNStates();

	GrammarASTAdaptor adaptor = new GrammarASTAdaptor();
	for (Rule r : rules) {
		// find rule's block
		GrammarAST blk = (GrammarAST)r.ast.getFirstChildWithType(ANTLRParser.BLOCK);
		CommonTreeNodeStream nodes = new CommonTreeNodeStream(adaptor,blk);
		ATNBuilder b = new ATNBuilder(nodes,this);
		try {
			setCurrentRuleName(r.name);
			Handle h = b.ruleBlock(null);
			rule(r.ast, r.name, h);
		}
		catch (RecognitionException re) {
			ErrorManager.fatalInternalError("bad grammar AST structure", re);
		}
	}
}
 
Example #3
Source File: CFMLLexer.java    From openbd-core with GNU General Public License v3.0 6 votes vote down vote up
public final void mFUNCTION() throws RecognitionException {
    try {
        int _type = FUNCTION;
        int _channel = DEFAULT_TOKEN_CHANNEL;
        // E:\\BlueDragon\\OpenBD_ANTLR\\src\\com\\naryx\\tagfusion\\cfm\\parser\\CFML.g:258:9: ( 'FUNCTION' )
        // E:\\BlueDragon\\OpenBD_ANTLR\\src\\com\\naryx\\tagfusion\\cfm\\parser\\CFML.g:258:11: 'FUNCTION'
        {
        match("FUNCTION"); 


        }

        state.type = _type;
        state.channel = _channel;
    }
    finally {
    }
}
 
Example #4
Source File: MemoryExpressionLexer.java    From binnavi with Apache License 2.0 6 votes vote down vote up
public final void mOPERAND_MINUS() throws RecognitionException {
  try {
    final int _type = OPERAND_MINUS;
    final int _channel = DEFAULT_TOKEN_CHANNEL;
    // C:\\Dokumente und
    // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\gotomem\\MemoryExpression.g:29:15:
    // ( '-' )
    // C:\\Dokumente und
    // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\gotomem\\MemoryExpression.g:29:17:
    // '-'
    {
      match('-');

    }

    state.type = _type;
    state.channel = _channel;
  } finally {
  }
}
 
Example #5
Source File: CFMLLexer.java    From openbd-core with GNU General Public License v3.0 6 votes vote down vote up
public final void mDIGIT() throws RecognitionException {
    try {
        // E:\\BlueDragon\\OpenBD_ANTLR\\src\\com\\naryx\\tagfusion\\cfm\\parser\\CFML.g:202:2: ( '\\u0030' .. '\\u0039' | '\\u0660' .. '\\u0669' | '\\u06f0' .. '\\u06f9' | '\\u0966' .. '\\u096f' | '\\u09e6' .. '\\u09ef' | '\\u0a66' .. '\\u0a6f' | '\\u0ae6' .. '\\u0aef' | '\\u0b66' .. '\\u0b6f' | '\\u0be7' .. '\\u0bef' | '\\u0c66' .. '\\u0c6f' | '\\u0ce6' .. '\\u0cef' | '\\u0d66' .. '\\u0d6f' | '\\u0e50' .. '\\u0e59' | '\\u0ed0' .. '\\u0ed9' | '\\u1040' .. '\\u1049' )
        // E:\\BlueDragon\\OpenBD_ANTLR\\src\\com\\naryx\\tagfusion\\cfm\\parser\\CFML.g:
        {
        if ( (input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='\u0660' && input.LA(1)<='\u0669')||(input.LA(1)>='\u06F0' && input.LA(1)<='\u06F9')||(input.LA(1)>='\u0966' && input.LA(1)<='\u096F')||(input.LA(1)>='\u09E6' && input.LA(1)<='\u09EF')||(input.LA(1)>='\u0A66' && input.LA(1)<='\u0A6F')||(input.LA(1)>='\u0AE6' && input.LA(1)<='\u0AEF')||(input.LA(1)>='\u0B66' && input.LA(1)<='\u0B6F')||(input.LA(1)>='\u0BE7' && input.LA(1)<='\u0BEF')||(input.LA(1)>='\u0C66' && input.LA(1)<='\u0C6F')||(input.LA(1)>='\u0CE6' && input.LA(1)<='\u0CEF')||(input.LA(1)>='\u0D66' && input.LA(1)<='\u0D6F')||(input.LA(1)>='\u0E50' && input.LA(1)<='\u0E59')||(input.LA(1)>='\u0ED0' && input.LA(1)<='\u0ED9')||(input.LA(1)>='\u1040' && input.LA(1)<='\u1049') ) {
            input.consume();

        }
        else {
            MismatchedSetException mse = new MismatchedSetException(null,input);
            recover(mse);
            throw mse;}


        }

    }
    finally {
    }
}
 
Example #6
Source File: CFMLLexer.java    From openbd-core with GNU General Public License v3.0 6 votes vote down vote up
public final void mTHREAD() throws RecognitionException {
    try {
        int _type = THREAD;
        int _channel = DEFAULT_TOKEN_CHANNEL;
        // E:\\BlueDragon\\OpenBD_ANTLR\\src\\com\\naryx\\tagfusion\\cfm\\parser\\CFML.g:315:7: ( 'THREAD' )
        // E:\\BlueDragon\\OpenBD_ANTLR\\src\\com\\naryx\\tagfusion\\cfm\\parser\\CFML.g:315:9: 'THREAD'
        {
        match("THREAD"); 


        }

        state.type = _type;
        state.channel = _channel;
    }
    finally {
    }
}
 
Example #7
Source File: ConditionLexer.java    From binnavi with Apache License 2.0 6 votes vote down vote up
public final void mB_AND() throws RecognitionException {
  try {
    final int _type = B_AND;
    final int _channel = DEFAULT_TOKEN_CHANNEL;
    // C:\\Dokumente und
    // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:45:8:
    // ( '&' )
    // C:\\Dokumente und
    // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:45:10:
    // '&'
    {
      match('&');

    }

    state.type = _type;
    state.channel = _channel;
  } finally {
  }
}
 
Example #8
Source File: CFMLLexer.java    From openbd-core with GNU General Public License v3.0 6 votes vote down vote up
public final void mEQUALSOP() throws RecognitionException {
    try {
        int _type = EQUALSOP;
        int _channel = DEFAULT_TOKEN_CHANNEL;
        // E:\\BlueDragon\\OpenBD_ANTLR\\src\\com\\naryx\\tagfusion\\cfm\\parser\\CFML.g:286:9: ( '=' )
        // E:\\BlueDragon\\OpenBD_ANTLR\\src\\com\\naryx\\tagfusion\\cfm\\parser\\CFML.g:286:11: '='
        {
        match('='); 

        }

        state.type = _type;
        state.channel = _channel;
    }
    finally {
    }
}
 
Example #9
Source File: FastSimpleGenericEdifactDirectXMLParser.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public final FastSimpleGenericEdifactDirectXMLParser.tag_name_return tag_name() throws RecognitionException {
  FastSimpleGenericEdifactDirectXMLParser.tag_name_return retval =
    new FastSimpleGenericEdifactDirectXMLParser.tag_name_return();
  retval.start = input.LT( 1 );

  try {
    // C:\\workspace-sts\\Kettle trunk -
    // restruct\\engine\\src\\org\\pentaho\\di\\trans\\steps\\edi2xml\\grammar\\
    // FastSimpleGenericEdifactDirectXML.g:112:11:
    // ( txt )
    // C:\\workspace-sts\\Kettle trunk -
    // restruct\\engine\\src\\org\\pentaho\\di\\trans\\steps\\edi2xml\\grammar\\
    // FastSimpleGenericEdifactDirectXML.g:112:13:
    // txt

    pushFollow( FOLLOW_txt_in_tag_name239 );
    txt();
    state._fsp--;
    retval.stop = input.LT( -1 );

  } catch ( RecognitionException e ) {
    // do not try to recover from parse errors, propagate the error instead
    throw e;
  }
  return retval;
}
 
Example #10
Source File: JavaLexer.java    From kogito-runtimes with Apache License 2.0 6 votes vote down vote up
public final void mT__123() throws RecognitionException {
	try {
		int _type = T__123;
		int _channel = DEFAULT_TOKEN_CHANNEL;
		// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:104:8: ( '|=' )
		// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:104:10: '|='
		{
		match("|="); 

		}

		state.type = _type;
		state.channel = _channel;
	}
	finally {
		// do for sure before leaving
	}
}
 
Example #11
Source File: JavaLexer.java    From kogito-runtimes with Apache License 2.0 6 votes vote down vote up
public final void mT__119() throws RecognitionException {
	try {
		int _type = T__119;
		int _channel = DEFAULT_TOKEN_CHANNEL;
		// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:100:8: ( 'volatile' )
		// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:100:10: 'volatile'
		{
		match("volatile"); 

		}

		state.type = _type;
		state.channel = _channel;
	}
	finally {
		// do for sure before leaving
	}
}
 
Example #12
Source File: STGroup.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/** Load template stream into this group. {@code unqualifiedFileName} is
 *  {@code "a.st"}. The {@code prefix} is path from group root to
 *  {@code unqualifiedFileName} like {@code "/subdir"} if file is in
 *  {@code /subdir/a.st}.
 */

public CompiledST loadTemplateFile(String prefix, String unqualifiedFileName, CharStream templateStream) {
    GroupLexer lexer = new GroupLexer(templateStream);
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    GroupParser parser = new GroupParser(tokens);
    parser.group = this;
    lexer.group = this;
    try {
        parser.templateDef(prefix);
    }
    catch (RecognitionException re) {
        errMgr.groupSyntaxError(ErrorType.SYNTAX_ERROR, unqualifiedFileName, re, re.getMessage());
    }

    String templateName = Misc.getFileNameNoSuffix(unqualifiedFileName);
    if ( prefix!=null && prefix.length()>0 ) templateName = prefix+templateName;
    CompiledST impl = rawGetTemplate(templateName);
    impl.prefix = prefix;
    return impl;
}
 
Example #13
Source File: ParserTestingUtils.java    From spork with Apache License 2.0 6 votes vote down vote up
public static LogicalPlan generateLogicalPlan(String query)
throws RecognitionException, ParsingFailureException, IOException {
    Tree ast = validateAst( query );
    
    CommonTreeNodeStream input = new CommonTreeNodeStream( ast );
    LogicalPlanBuilder builder = new LogicalPlanBuilder( input );
    LogicalPlanGenerator walker = new LogicalPlanGenerator( input, builder );
    walker.query();
    
    if( 0 < walker.getNumberOfSyntaxErrors() ) 
        throw new ParsingFailureException( LogicalPlanGenerator.class );
    
    LogicalPlan plan = walker.getLogicalPlan();
    System.out.println( "Generated logical plan: " + plan.toString() );
    
    return plan;
}
 
Example #14
Source File: GrammarTreeTest.java    From usergrid with Apache License 2.0 6 votes vote down vote up
@Test
public void selectDistance() throws RecognitionException {
    String queryString = "select * where a contains 'foo'";

    ANTLRStringStream in = new ANTLRStringStream( queryString );
    CpQueryFilterLexer lexer = new CpQueryFilterLexer( in );
    TokenRewriteStream tokens = new TokenRewriteStream( lexer );
    CpQueryFilterParser parser = new CpQueryFilterParser( tokens );

    ParsedQuery query = parser.ql().parsedQuery;

    ContainsOperand operand = ( ContainsOperand ) query.getRootOperand();

    assertEquals( "a", operand.getProperty().getValue() );
    assertEquals( "foo", operand.getString().getValue() );
}
 
Example #15
Source File: ConditionLexer.java    From binnavi with Apache License 2.0 6 votes vote down vote up
public final void mEQ_SIGN() throws RecognitionException {
  try {
    final int _type = EQ_SIGN;
    final int _channel = DEFAULT_TOKEN_CHANNEL;
    // C:\\Dokumente und
    // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:35:10:
    // ( '==' )
    // C:\\Dokumente und
    // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:35:13:
    // '=='
    {
      match("==");


    }

    state.type = _type;
    state.channel = _channel;
  } finally {
  }
}
 
Example #16
Source File: CFMLLexer.java    From openbd-core with GNU General Public License v3.0 6 votes vote down vote up
public final void mTHAN() throws RecognitionException {
    try {
        int _type = THAN;
        int _channel = DEFAULT_TOKEN_CHANNEL;
        // E:\\BlueDragon\\OpenBD_ANTLR\\src\\com\\naryx\\tagfusion\\cfm\\parser\\CFML.g:238:5: ( 'THAN' )
        // E:\\BlueDragon\\OpenBD_ANTLR\\src\\com\\naryx\\tagfusion\\cfm\\parser\\CFML.g:238:7: 'THAN'
        {
        match("THAN"); 


        }

        state.type = _type;
        state.channel = _channel;
    }
    finally {
    }
}
 
Example #17
Source File: JavaLexer.java    From kogito-runtimes with Apache License 2.0 6 votes vote down vote up
public final void mT__32() throws RecognitionException {
	try {
		int _type = T__32;
		int _channel = DEFAULT_TOKEN_CHANNEL;
		// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:13:7: ( '%=' )
		// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:13:9: '%='
		{
		match("%="); 

		}

		state.type = _type;
		state.channel = _channel;
	}
	finally {
		// do for sure before leaving
	}
}
 
Example #18
Source File: HotDexPatchDexTool.java    From atlas with Apache License 2.0 6 votes vote down vote up
@Override
public DexDiffInfo createPatchDex(File outDexFolder) throws IOException, RecognitionException, PatchException {
    DexDiffInfo dexDiffInfo = super.createPatchDex(outDexFolder);
    File hotDex = new File(outDexFolder,"hot.dex");
    if (hotClassDefs!= null && hotClassDefs.size() > 0){
        File hotDexFolder = new File(outDexFolder,"hot");
        hotDexFolder.mkdirs();
        writeDex(hotDexFolder,hotClassDefs);
        if (new File(hotDexFolder,TPatchTool.DEX_NAME).exists()){
            new File(hotDexFolder,TPatchTool.DEX_NAME).renameTo(hotDex);
            org.apache.commons.io.FileUtils.deleteDirectory(hotDexFolder);
        }

    }
    return dexDiffInfo;

}
 
Example #19
Source File: STLexerMessage.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public String toString() {
    RecognitionException re = (RecognitionException)cause;
    int line = re.line;
    int charPos = re.charPositionInLine;
    if ( templateToken!=null ) {
        int templateDelimiterSize = 1;
        if ( templateToken.getType()==GroupParser.BIGSTRING ) {
            templateDelimiterSize = 2;
        }
        line += templateToken.getLine()-1;
        charPos += templateToken.getCharPositionInLine()+templateDelimiterSize;
    }

    String filepos = line+":"+charPos;
    if ( srcName!=null ) {
        return srcName+" "+filepos+": "+String.format(error.message, msg);
    }
    return filepos+": "+String.format(error.message, msg);
}
 
Example #20
Source File: JavaLexer.java    From kogito-runtimes with Apache License 2.0 6 votes vote down vote up
public final void mT__35() throws RecognitionException {
	try {
		int _type = T__35;
		int _channel = DEFAULT_TOKEN_CHANNEL;
		// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:16:7: ( '&=' )
		// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:16:9: '&='
		{
		match("&="); 

		}

		state.type = _type;
		state.channel = _channel;
	}
	finally {
		// do for sure before leaving
	}
}
 
Example #21
Source File: QueryFilterParser.java    From usergrid with Apache License 2.0 6 votes vote down vote up
public final QueryFilterParser.property_return property() throws RecognitionException {
    QueryFilterParser.property_return retval = new QueryFilterParser.property_return();
    retval.start = input.LT( 1 );

    try {
        // org/usergrid/persistence/query/QueryFilter.g:102:2: ( ( ID ) )
        // org/usergrid/persistence/query/QueryFilter.g:102:5: ( ID )
        {
            // org/usergrid/persistence/query/QueryFilter.g:102:5: ( ID )
            // org/usergrid/persistence/query/QueryFilter.g:102:6: ID
            {
                match( input, ID, FOLLOW_ID_in_property597 );
            }
        }

        retval.stop = input.LT( -1 );
    }
    catch ( RecognitionException re ) {
        reportError( re );
        recover( input, re );
    }
    finally {
    }
    return retval;
}
 
Example #22
Source File: JavaLexer.java    From kogito-runtimes with Apache License 2.0 6 votes vote down vote up
public final void mT__104() throws RecognitionException {
	try {
		int _type = T__104;
		int _channel = DEFAULT_TOKEN_CHANNEL;
		// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:85:8: ( 'return' )
		// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:85:10: 'return'
		{
		match("return"); 

		}

		state.type = _type;
		state.channel = _channel;
	}
	finally {
		// do for sure before leaving
	}
}
 
Example #23
Source File: InternalTaxonomyLexer.java    From slr-toolkit with Eclipse Public License 1.0 6 votes vote down vote up
public final void mT__10() throws RecognitionException {
    try {
        int _type = T__10;
        int _channel = DEFAULT_TOKEN_CHANNEL;
        // InternalTaxonomy.g:12:7: ( '{' )
        // InternalTaxonomy.g:12:9: '{'
        {
        match('{'); 

        }

        state.type = _type;
        state.channel = _channel;
    }
    finally {
    }
}
 
Example #24
Source File: CFMLLexer.java    From openbd-core with GNU General Public License v3.0 6 votes vote down vote up
public final void mTO() throws RecognitionException {
    try {
        int _type = TO;
        int _channel = DEFAULT_TOKEN_CHANNEL;
        // E:\\BlueDragon\\OpenBD_ANTLR\\src\\com\\naryx\\tagfusion\\cfm\\parser\\CFML.g:241:3: ( 'TO' )
        // E:\\BlueDragon\\OpenBD_ANTLR\\src\\com\\naryx\\tagfusion\\cfm\\parser\\CFML.g:241:5: 'TO'
        {
        match("TO"); 


        }

        state.type = _type;
        state.channel = _channel;
    }
    finally {
    }
}
 
Example #25
Source File: STGroup.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/** Load template stream into this group. {@code unqualifiedFileName} is
 *  {@code "a.st"}. The {@code prefix} is path from group root to
 *  {@code unqualifiedFileName} like {@code "/subdir"} if file is in
 *  {@code /subdir/a.st}.
 */

public CompiledST loadTemplateFile(String prefix, String unqualifiedFileName, CharStream templateStream) {
    GroupLexer lexer = new GroupLexer(templateStream);
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    GroupParser parser = new GroupParser(tokens);
    parser.group = this;
    lexer.group = this;
    try {
        parser.templateDef(prefix);
    }
    catch (RecognitionException re) {
        errMgr.groupSyntaxError(ErrorType.SYNTAX_ERROR, unqualifiedFileName, re, re.getMessage());
    }

    String templateName = Misc.getFileNameNoSuffix(unqualifiedFileName);
    if ( prefix !=null && prefix.length()>0 ) templateName = prefix+templateName;
    CompiledST impl = rawGetTemplate(templateName);
    impl.prefix = prefix;
    return impl;
}
 
Example #26
Source File: STLexer.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
void LINEBREAK() {
    match('\\'); // only kill 2nd \ as ESCAPE() kills first one
    match(delimiterStopChar);
    while ( c==' ' || c=='\t' ) consume(); // scarf WS after <\\>
    if ( c==EOF ) {
        RecognitionException re = new RecognitionException(input);
        re.line = input.getLine();
        re.charPositionInLine = input.getCharPositionInLine();
        errMgr.lexerError(input.getSourceName(), "Missing newline after newline escape <\\\\>", templateToken, re);
        return;
    }

    if ( c=='\r' ) consume();
    match('\n');
    while ( c==' ' || c=='\t' ) consume(); // scarf any indent
}
 
Example #27
Source File: JavaLexer.java    From kogito-runtimes with Apache License 2.0 6 votes vote down vote up
public final void mT__52() throws RecognitionException {
	try {
		int _type = T__52;
		int _channel = DEFAULT_TOKEN_CHANNEL;
		// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:33:7: ( ';' )
		// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:33:9: ';'
		{
		match(';'); 
		}

		state.type = _type;
		state.channel = _channel;
	}
	finally {
		// do for sure before leaving
	}
}
 
Example #28
Source File: CFMLLexer.java    From openbd-core with GNU General Public License v3.0 6 votes vote down vote up
public final void mLOCK() throws RecognitionException {
    try {
        int _type = LOCK;
        int _channel = DEFAULT_TOKEN_CHANNEL;
        // E:\\BlueDragon\\OpenBD_ANTLR\\src\\com\\naryx\\tagfusion\\cfm\\parser\\CFML.g:314:5: ( 'LOCK' )
        // E:\\BlueDragon\\OpenBD_ANTLR\\src\\com\\naryx\\tagfusion\\cfm\\parser\\CFML.g:314:7: 'LOCK'
        {
        match("LOCK"); 


        }

        state.type = _type;
        state.channel = _channel;
    }
    finally {
    }
}
 
Example #29
Source File: STGroupCompiletimeMessage.java    From codebuff with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public String toString() {
    RecognitionException re = (RecognitionException)cause;
    int line = 0;
    int charPos = -1;
    if ( token!=null ) {
        line = token.getLine();
        charPos = token.getCharPositionInLine();
    }
    else if ( re!=null ) {
             line = re.line;
             charPos = re.charPositionInLine;
    }
    String filepos = line+":"+charPos;
    if ( srcName!=null ) {
        return srcName+" "+filepos+": "+String.format(error.message, arg, arg2);
    }
    return filepos+": "+String.format(error.message, arg, arg2);
}
 
Example #30
Source File: FilterLexer.java    From binnavi with Apache License 2.0 6 votes vote down vote up
public final void mT__9() throws RecognitionException {
  try {
    final int _type = T__9;
    final int _channel = DEFAULT_TOKEN_CHANNEL;
    // C:\\Dokumente und
    // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\filter\\Filter.g:3:6: (
    // '(' )
    // C:\\Dokumente und
    // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\filter\\Filter.g:3:8:
    // '('
    {
      match('(');

    }

    state.type = _type;
    state.channel = _channel;
  } finally {
  }
}