Exprest.java 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //Exprest:top//
  2. //Exprest:import//
  3. import java.util.*;
  4. // <exprest> **= <OP> <mult>
  5. public class Exprest /*Exprest:class*/ {
  6. public static final String $className = "Exprest";
  7. public static final String $ruleString =
  8. "<exprest> **= <OP> <mult>";
  9. public List<Token> opList;
  10. public List<Mult> multList;
  11. public Exprest(List<Token> opList, List<Mult> multList) {
  12. //Exprest:init//
  13. this.opList = opList;
  14. this.multList = multList;
  15. }
  16. public static Exprest parse(Scan scn$, Trace trace$) {
  17. if (trace$ != null)
  18. trace$ = trace$.nonterm("<exprest>", scn$.lno);
  19. List<Token> opList = new ArrayList<Token>();
  20. List<Mult> multList = new ArrayList<Mult>();
  21. while (true) {
  22. Token t$ = scn$.cur();
  23. Token.Match match$ = t$.match;
  24. switch(match$) {
  25. case OP:
  26. opList.add(scn$.match(Token.Match.OP, trace$));
  27. multList.add(Mult.parse(scn$, trace$));
  28. continue;
  29. default:
  30. return new Exprest(opList, multList);
  31. }
  32. }
  33. }
  34. //Exprest//
  35. }