Package org.allspice.parser.parsetable

Examples of org.allspice.parser.parsetable.DefaultTranslationMapper


    }
  }

  public static Tok parseTok(Reader r) throws SyntaxError {
    Tok parsedg;
    DefaultTranslationMapper mapper = new DefaultTranslationMapper() ;
    Grammar g ;
    mapper.addTranslation(new Rule("explist"),new explist_base()) ;
    mapper.addTranslation(new Rule("type","ID"),new simpleType()) ;
    mapper.addTranslation(new Rule("type","type",".","ID"),new dotType()) ;
    mapper.addTranslation(new Rule("explist","explist","REGEXP","CODE",";"),new explist_add()) ;
    mapper.addTranslation(new Rule("explist","explist","ID","REGEXP"),new explist_addsymlib()) ;
    mapper.addTranslation(new Rule("explist","explist","EXTENDS","type"),new explist_extends()) ;
    mapper.addTranslation(new Rule("explist","explist","IMPORT","type"),new import_add()) ;
    mapper.addTranslation(new Rule("explist","explist","IMPORT","type",".","*"),new import_addstar()) ;
    try {
      g = new Grammar("S",new ConcatCollection<Rule>(mapper.rules.keySet(),new Rule("S","explist")),new Tree23Map<String,AssocType>(),
          new Tree23Map<String,Integer>(),
          new Tree23Map<Rule,Integer>()) ;
    } catch (InvalidStartRule e) {
View Full Code Here


   * @throws StateConflict
   * @throws StrandedSymbol
   * @throws InvalidStartRule
   */
  private AugmentedParseTable createParseTable() throws StateConflict, InvalidStartRule, StrandedSymbol {
    DefaultTranslationMapper mapper = createMapper() ;
    final Rule times = new Rule("E","E","*","E");
    final Rule plus = new Rule("E","E","+","E");
    ImmutableMap<String,AssocType> assoc = new Tree23Map<String,AssocType>() ;
    assoc = assoc.insert("+", AssocType.left) ;
    assoc = assoc.insert("*", AssocType.left) ;
View Full Code Here

   * @throws StateConflict
   * @throws StrandedSymbol
   * @throws InvalidStartRule
   */
  private DefaultTranslationMapper createMapper() throws StateConflict, InvalidStartRule, StrandedSymbol {
    DefaultTranslationMapper table = new DefaultTranslationMapper() ;
    table.addTranslation(new Rule("E'","E"),new TopTrans()) ;
    final Rule plus = new Rule("E","E","+","E");
    table.addTranslation(plus,new PlusTrans()) ;
    final Rule times = new Rule("E","E","*","E");
    table.addTranslation(times,new TimeTrans()) ;
    table.addTranslation(new Rule("E","id"),new IdTrans()) ;
    table.addTranslation(new Rule("E","(","E",")"),new ParenTrans()) ;
    return table;
  }
View Full Code Here

TOP

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

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.