Package antlr

Examples of antlr.RecognitionException


    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


  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()));
        }
        catch (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()},
                        this.getClass()));
            }
            else {
                getMessageCollector().add(
                    new LocalizedMessage(
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

        _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

      match(_t,NAME);
      _t = _t.getNextSibling();
     
      if (tables.containsKey(tname.getText()))
        table = tables.get(tname.getText());
            else throw new RecognitionException("Undefined table: "+ tname.getText());
         
      {
      if (_t==null) _t=ASTNULL;
      switch ( _t.getType()) {
      case NAME:
      {
        vname = (AST)_t;
        AST vname_AST_in = null;
        vname_AST = astFactory.create(vname);
        match(_t,NAME);
        _t = _t.getNextSibling();
       
                int i = 0;
                for (AST tableEntry : table) {
                  Map<String,AST>  curVars = new HashMap<String,AST> ();
                  curVars.put(vname.getText(), (AST)astFactory.make( (new ASTArray(1)).add(astFactory.create(NUM,Integer.toString(i)))));
                  res.add(new SSLInstructionName(tableEntry.getText(), curVars));
                  i++;
                }
             
        break;
      }
      case NUM:
      {
        tidx = (AST)_t;
        AST tidx_AST_in = null;
        tidx_AST = astFactory.create(tidx);
        match(_t,NUM);
        _t = _t.getNextSibling();
       
                int index = Integer.parseInt(tidx.getText());
          if (index < table.size()) {
            res.add(new SSLInstructionName(table.get(index).getText()));
          } else throw new RecognitionException("Index " + index + " out of bounds for table " + tname.getText() + "!");
             
        break;
      }
      default:
      {
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.