Package org.allspice.parser.parsetable

Examples of org.allspice.parser.parsetable.Parser


   * @throws InvalidStartRule
   *
   */
  public void test0() throws StateConflict, SyntaxError, InvalidStartRule, StrandedSymbol {
    final IteratorTokenStream iterator = new IteratorTokenStream(new Token("{")) ;
    Parser parser = new Parser(createParseTable(),iterator);
    parser.parse();
  }
View Full Code Here


   * @throws InvalidStartRule
   *
   */
  public void test1() throws StateConflict, SyntaxError, InvalidStartRule, StrandedSymbol {
    final IteratorTokenStream iterator = new IteratorTokenStream(new Token("id"),new Token("{")) ;
    Parser parser = new Parser(createParseTable(),iterator);
    parser.parse();
  }
View Full Code Here

   * @throws InvalidStartRule
   *
   */
  public void test2() throws StateConflict, SyntaxError, InvalidStartRule, StrandedSymbol {
    final IteratorTokenStream iterator = new IteratorTokenStream(new Token("id"),new Token("id"),new Token("{")) ;
    Parser parser = new Parser(createParseTable(),iterator);
    parser.parse();
  }
View Full Code Here

    } catch (StateConflict e) {
      throw new RuntimeException(e) ;
    }
    PGENTokenStream tokenizer = new PGENTokenStream(r) ;
    AugmentedParseTable apt = new AugmentedParseTableImpl(mapper,pt) ;
    Parser parser = new Parser(apt,tokenizer) ;
    parsedg = (Pgen)parser.parse() ;
    return parsedg;
  }
View Full Code Here

   * @param tokenizer The stream of tokens
   * @return "The file unit"
   * @throws SyntaxError
   */
  public FileUnit parse(TokenStream tokenizer) throws SyntaxError {
    Parser p = new Parser(table,tokenizer) ;
    return (FileUnit)p.parse() ;
  }
View Full Code Here

      pt = ParserGenerator.createParseTable(g);
    } catch (StateConflict e) {
      throw new RuntimeException(e) ;
    }
    TOKTokenStream tokenizer = new TOKTokenStream(r) ;
    Parser p = new Parser(new AugmentedParseTableImpl(mapper,pt),tokenizer) ;
    parsedg = (Tok)p.parse() ;
    return parsedg ;
  }
View Full Code Here

   *
   */
  public void test0() throws StateConflict, SyntaxError, InvalidStartRule, StrandedSymbol {
    final Token id = new Token("id");
    final IteratorTokenStream iterator = new IteratorTokenStream(id) ;
    Parser parser = new Parser(createParseTable(),iterator);
    Object result = parser.parse();
    assertEquals(iterator.next(),Parser.EOF) ;
    assertEquals(result,id) ;
  }
View Full Code Here

   *
   */
  public void test1() throws StateConflict, SyntaxError, InvalidStartRule, StrandedSymbol {
    final Token id = new Token("id");
    final IteratorTokenStream iterator = new IteratorTokenStream(id,new Token("+"),id) ;
    Parser parser = new Parser(createParseTable(),iterator);
    Object result = parser.parse();
    assertEquals(iterator.next(),Parser.EOF) ;
    assertEquals(result,new Plus(id,id)) ;
  }
View Full Code Here

   *
   */
  public void test2() throws StateConflict, SyntaxError, InvalidStartRule, StrandedSymbol {
    final Token id = new Token("id");
    final IteratorTokenStream iterator = new IteratorTokenStream(id,new Token("*"),id,new Token("+"),id,new Token("*"),id) ;
    Parser parser = new Parser(createParseTable(),iterator);
    Object result = parser.parse();
    assertEquals(iterator.next(),Parser.EOF) ;
    assertEquals(result,new Plus(new Times(id,id),new Times(id,id))) ;
  }
View Full Code Here

TOP

Related Classes of org.allspice.parser.parsetable.Parser

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.