Package antlr

Examples of antlr.RecognitionException


                    this.getClass()));
        }
        catch (final TokenStreamRecognitionException tre) {
            Utils.getExceptionLogger()
                .debug("TokenStreamRecognitionException occured.", tre);
            final RecognitionException re = tre.recog;
            if (re != null) {
                getMessageCollector().add(
                    new LocalizedMessage(
                        re.getLine(),
                        re.getColumn(),
                        Defn.CHECKSTYLE_BUNDLE,
                        "general.exception",
                        new String[] {re.getMessage()},
                        getId(),
                        this.getClass()));
            }
            else {
                getMessageCollector().add(
View Full Code Here


        // start parsing at the compilationUnit rule
        try {
            parser.compilationUnit();
        }
        catch (TokenStreamRecognitionException tsre) {
            RecognitionException e = tsre.recog;
            SyntaxException se = new SyntaxException(e.getMessage(),e,e.getLine(),e.getColumn());
            se.setFatal(true);
            sourceUnit.addError(se);
        }
        catch (RecognitionException e) {
            SyntaxException se = new SyntaxException(e.getMessage(),e,e.getLine(),e.getColumn());
            se.setFatal(true);
            sourceUnit.addError(se);
        }
        catch (TokenStreamException e) {
            sourceUnit.addException(e);
View Full Code Here

        _t = _t.getNextSibling();
       
            if ( grammar.type==Grammar.LEXER ) {
                  Rule rule = grammar.getRule(t.getText());
                  if ( rule==null ) {
                    throw new RecognitionException("invalid rule");
                  }
              // recursively will invoke this rule to match elements in target rule ref
                  testSetRule(rule.tree);
            }
       
View Full Code Here

  public void testExceptions() throws Exception {
    DetailedSemanticException dse = new DetailedSemanticException( "test" );
    dse.printStackTrace();
    dse.printStackTrace( new PrintWriter( new StringWriter() ) );
    QuerySyntaxException qse = QuerySyntaxException.convert( new RecognitionException( "test" ), "from bozo b where b.clown = true" );
    assertNotNull( qse.getMessage() );
  }
View Full Code Here

                    this.getClass(), null));
        }
        catch (final TokenStreamRecognitionException tre) {
            Utils.getExceptionLogger()
                .debug("TokenStreamRecognitionException occured.", tre);
            final RecognitionException re = tre.recog;
            if (re != null) {
                getMessageCollector().add(
                    new LocalizedMessage(
                        re.getLine(),
                        re.getColumn(),
                        Defn.CHECKSTYLE_BUNDLE,
                        "general.exception",
                        new String[] {re.getMessage()},
                        getId(),
                        this.getClass(), null));
            }
            else {
                getMessageCollector().add(
View Full Code Here

            } finally {
                if (r != null) { try { r.close(); } catch (Throwable ignore) {} }
            }
        }
        if (result.size() > 1) {
            throw new RecognitionException("The Java source file contained multiple classes.");
        }
        if (result.size() > 1) {
          throw new RecognitionException("The Java source file contained multiple classes.");
        }
        return (JavaSource) result.get(0);
  }
View Full Code Here

  public void testExceptions() throws Exception {
    DetailedSemanticException dse = new DetailedSemanticException( "test" );
    dse.printStackTrace();
    dse.printStackTrace( new PrintWriter( new StringWriter() ) );
    QuerySyntaxException qse = QuerySyntaxException.convert( new RecognitionException( "test" ), "from bozo b where b.clown = true" );
    assertNotNull( qse.getMessage() );
  }
View Full Code Here

        // start parsing at the compilationUnit rule
        try {
            parser.compilationUnit();
        }
        catch (TokenStreamRecognitionException tsre) {
            RecognitionException e = tsre.recog;
            SyntaxException se = new SyntaxException(e.getMessage(), e, e.getLine(), e.getColumn());
            se.setFatal(true);
            sourceUnit.addError(se);
        }
        catch (RecognitionException e) {
            SyntaxException se = new SyntaxException(e.getMessage(), e, e.getLine(), e.getColumn());
            se.setFatal(true);
            sourceUnit.addError(se);
        }
        catch (TokenStreamException e) {
            sourceUnit.addException(e);
View Full Code Here

        // start parsing at the compilationUnit rule
        try {
            parser.compilationUnit();
        }
        catch (TokenStreamRecognitionException tsre) {
            RecognitionException e = tsre.recog;
            SyntaxException se = new SyntaxException(e.getMessage(), e, e.getLine(), e.getColumn());
            se.setFatal(true);
            sourceUnit.addError(se);
        }
        catch (RecognitionException e) {
            SyntaxException se = new SyntaxException(e.getMessage(), e, e.getLine(), e.getColumn());
            se.setFatal(true);
            sourceUnit.addError(se);
        }
        catch (TokenStreamException e) {
            sourceUnit.addException(e);
View Full Code Here

  public void testExceptions() throws Exception {
    DetailedSemanticException dse = new DetailedSemanticException( "test" );
    dse.printStackTrace();
    dse.printStackTrace( new PrintWriter( new StringWriter() ) );
    QuerySyntaxException qse = QuerySyntaxException.convert( new RecognitionException( "test" ), "from bozo b where b.clown = true" );
    assertNotNull( qse.getMessage() );
  }
View Full Code Here

TOP

Related Classes of antlr.RecognitionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.