Java Code Examples for org.antlr.runtime.RecognitionException

The following examples show how to use org.antlr.runtime.RecognitionException. These examples are extracted from open source projects. 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 Project: codebuff   Author: antlr   File: ParserATNFactory.java    License: 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 #2
Source Project: openbd-core   Author: OpenBD   File: CFMLLexer.java    License: 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 #3
Source Project: binnavi   Author: google   File: MemoryExpressionLexer.java    License: 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 #4
Source Project: codebuff   Author: antlr   File: STLexerMessage.java    License: 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 #5
Source Project: kogito-runtimes   Author: kiegroup   File: JavaLexer.java    License: 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 #6
Source Project: openbd-core   Author: OpenBD   File: CFMLLexer.java    License: 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 #7
Source Project: openbd-core   Author: OpenBD   File: CFMLLexer.java    License: 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 #8
Source Project: openbd-core   Author: OpenBD   File: CFMLLexer.java    License: 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 Project: pentaho-kettle   Author: pentaho   File: FastSimpleGenericEdifactDirectXMLParser.java    License: 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 Project: usergrid   Author: apache   File: QueryFilterLexer.java    License: Apache License 2.0 6 votes vote down vote up
public final void mT__30() throws RecognitionException {
    try {
        int _type = T__30;
        int _channel = DEFAULT_TOKEN_CHANNEL;
        // org/usergrid/persistence/query/QueryFilter.g:35:7: ( 'of' )
        // org/usergrid/persistence/query/QueryFilter.g:35:9: 'of'
        {
            match( "of" );
        }

        state.type = _type;
        state.channel = _channel;
    }
    finally {
    }
}
 
Example #11
Source Project: tracecompass   Author: tracecompass   File: CTFLexer.java    License: Eclipse Public License 2.0 6 votes vote down vote up
public final void mBOOLTOK() throws RecognitionException {
	try {
		int _type = BOOLTOK;
		int _channel = DEFAULT_TOKEN_CHANNEL;
		// org/eclipse/tracecompass/ctf/parser/CTFLexer.g:54:18: ( '_Bool' )
		// org/eclipse/tracecompass/ctf/parser/CTFLexer.g:54:20: '_Bool'
		{
		match("_Bool"); 

		}

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

		}

		state.type = _type;
		state.channel = _channel;
	}
	finally {
		// do for sure before leaving
	}
}
 
Example #13
Source Project: kogito-runtimes   Author: kiegroup   File: JavaLexer.java    License: 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 #14
Source Project: codebuff   Author: antlr   File: STGroup.java    License: 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 #15
Source Project: openbd-core   Author: OpenBD   File: CFMLLexer.java    License: 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 #16
Source Project: binnavi   Author: google   File: ConditionLexer.java    License: 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 #17
Source Project: spork   Author: sigmoidanalytics   File: TestQueryParser.java    License: 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 #18
Source Project: kogito-runtimes   Author: kiegroup   File: JavaLexer.java    License: 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 #19
Source Project: kogito-runtimes   Author: kiegroup   File: JavaLexer.java    License: 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 #20
Source Project: usergrid   Author: apache   File: QueryFilterParser.java    License: 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 #21
Source Project: openbd-core   Author: OpenBD   File: CFMLLexer.java    License: 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 #22
Source Project: codebuff   Author: antlr   File: STGroup.java    License: 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 #23
Source Project: codebuff   Author: antlr   File: STLexer.java    License: 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 #24
Source Project: codebuff   Author: antlr   File: STGroupCompiletimeMessage.java    License: 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 #25
Source Project: binnavi   Author: google   File: FilterLexer.java    License: 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 {
  }
}
 
Example #26
Source Project: openbd-core   Author: OpenBD   File: CFMLLexer.java    License: 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 #27
Source Project: kogito-runtimes   Author: kiegroup   File: JavaLexer.java    License: 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 Project: slr-toolkit   Author: sebastiangoetz   File: InternalTaxonomyLexer.java    License: 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 #29
Source Project: kogito-runtimes   Author: kiegroup   File: JavaLexer.java    License: 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 #30
Source Project: codebuff   Author: antlr   File: STLexerMessage.java    License: 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);
}