Package org.allspice.parser.parsetable

Examples of org.allspice.parser.parsetable.Token


*/
private Token makeToken1188918692() throws SyntaxError {
  String s = currText.toString() ;
  String t = s.substring(0,s.length() - 1) ;
  try {
    return new Token("const",Double.valueOf(t)) ;
  } catch (NumberFormatException e) {
    throw new InvalidDoubleConstant(getPosition(),s) ;
  }
}
View Full Code Here


*/
private Token makeToken1833350875() throws SyntaxError {
  String s = currText.toString() ;
  String t = s.substring(0,s.length() - 1) ;
  try {
    return new Token("const",Long.valueOf(t)) ;
  } catch (NumberFormatException e) {
    throw new InvalidLongConstant(getPosition(),s) ;
  }
}
View Full Code Here

* @return The token
*/
private Token makeToken2137552888() throws SyntaxError {
    String s = currText.toString() ;
    if (JavaKeywords.keywords.contains(s)) {
      return new Token(s,s) ;
    }
    if (s.equals("true")) {
      return new Token("const",Boolean.TRUE) ;
    }
    if (s.equals("false")) {
      return new Token("const",Boolean.FALSE) ;
    }
    if (s.equals("null")) {
      return new Token("const",null) ;
    }

    return new Token("ID",s) ;
}
View Full Code Here

*/
private Token makeToken709424757() throws SyntaxError {
  String s = currText.toString() ;
  String t = s.substring(2,s.length() - 1) ;
  try {
    return new Token("const",Long.valueOf(t,16)) ;
  } catch (NumberFormatException e) {
    throw new InvalidHexLongConstant(getPosition(),s) ;
  }
}
View Full Code Here

/**
* @throws SyntaxError
* @return The token
*/
private Token makeToken891136526() throws SyntaxError {
  return new Token("const",JavaGrammarUtils.parseQuote(getPosition(),currText.toString())) ;
}
View Full Code Here

*/
private Token makeToken1891789590() throws SyntaxError {
  String s = currText.toString() ;
  String t = s.substring(1) ;
  try {
    return new Token("const",Integer.valueOf(t,8)) ;
  } catch (NumberFormatException e) {
    throw new InvalidOctIntConstant(getPosition(),s) ;
  }
}
View Full Code Here

   * @throws StrandedSymbol
   * @throws InvalidStartRule
   *
   */
  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

   * @throws StrandedSymbol
   * @throws InvalidStartRule
   *
   */
  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

   * @throws StrandedSymbol
   * @throws InvalidStartRule
   *
   */
  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

    return new JavaTokenizer(new StringReader(s)) ;
  }
  public void testfoo() throws SyntaxError {
    TokenStream tok = makeTokenizer("+") ;
    {
      Token t = tok.next() ;
      assertEquals(t.name,"+") ;
    }
  }
View Full Code Here

TOP

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

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.