Package org.allspice.parser.parsetable

Examples of org.allspice.parser.parsetable.Parser


   * @throws StateConflict
   * @throws SyntaxError
   */
  public static void main(String[] args) throws StateConflict, InvalidStartRule, StrandedSymbol, SyntaxError {
    final IteratorTokenStream iterator = new IteratorTokenStream(new Token("id",3.0),new Token("*"),new Token("id",5.0)) ;
    Parser parser = new Parser(createParseTable(),iterator) ;
    Object res = parser.parse() ;
    System.out.println("res="+res) ;
  }
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 res = parser.parse();
    assertEquals(iterator.next(),Parser.EOF) ;
    assertEquals(res,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 res = parser.parse();
    assertEquals(iterator.next(),Parser.EOF) ;
    assertEquals(res,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(id,new Plus(id,new Plus(id,id)))) ;
  }
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(id,new Plus(id,new Plus(id,id)))) ;
  }
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 res = parser.parse();
    assertEquals(iterator.next(),Parser.EOF) ;
    assertEquals(res,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 res = parser.parse();
    assertEquals(iterator.next(),Parser.EOF) ;
    assertEquals(res,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 res = parser.parse();
    assertEquals(iterator.next(),Parser.EOF) ;
    assertEquals(res,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.