Package antlr

Examples of antlr.RecognitionException


              getId(),
              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(
            new LocalizedMessage(
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

        // 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

        // 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

          oos.close();
          }
          catch (IOException e) {
          System.err.println("IOexception: "+e); }
          _t = null;
          throw new RecognitionException();
          }
         
          break;
        }
        default:
View Full Code Here

    match(ALPHANUMERICWORD);
    match(GT);
     
       Token token = htmlElementStack.pop();
       if(!token.getText().equals(name.getText())) {
         throw new RecognitionException("Can not convert to the Seam Text:  </" +token.getText() + ">" + " expected");
       }
       String value = "";
       if(valueCollector != null) {
         value = valueCollector.toString();
       }
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

        _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

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.