weka.core.mathematicalexpression.Parser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of weka-dev Show documentation
Show all versions of weka-dev Show documentation
The Waikato Environment for Knowledge Analysis (WEKA), a machine
learning workbench. This version represents the developer version, the
"bleeding edge" of development, you could say. New functionality gets added
to this version.
//----------------------------------------------------
// The following code was generated by CUP v0.11a beta 20060608
// Mon Apr 26 10:55:03 NZST 2010
//----------------------------------------------------
package weka.core.mathematicalexpression;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Iterator;
import java_cup.runtime.DefaultSymbolFactory;
import java_cup.runtime.SymbolFactory;
/**
* CUP v0.11a beta 20060608 generated parser.
*
* @version Mon Apr 26 10:55:03 NZST 2010
*/
public class Parser extends java_cup.runtime.lr_parser {
/** Default constructor. */
public Parser() {
super();
}
/** Constructor which sets the default scanner. */
public Parser(java_cup.runtime.Scanner s) {
super(s);
}
/** Constructor which sets the default scanner. */
public Parser(java_cup.runtime.Scanner s, java_cup.runtime.SymbolFactory sf) {
super(s, sf);
}
/** Production table. */
protected static final short _production_table[][] = unpackFromStrings(new String[] { "\000\046\000\002\002\004\000\002\002\004\000\002\002"
+ "\003\000\002\003\003\000\002\004\003\000\002\004\005"
+ "\000\002\004\003\000\002\004\003\000\002\004\003\000"
+ "\002\005\005\000\002\005\005\000\002\005\005\000\002"
+ "\005\005\000\002\006\003\000\002\007\006\000\002\007"
+ "\006\000\002\007\006\000\002\007\006\000\002\007\006"
+ "\000\002\007\006\000\002\007\006\000\002\007\006\000"
+ "\002\007\006\000\002\007\010\000\002\007\006\000\002"
+ "\007\012\000\002\010\003\000\002\010\003\000\002\010"
+ "\003\000\002\010\005\000\002\010\005\000\002\010\005"
+ "\000\002\010\005\000\002\010\005\000\002\010\005\000"
+ "\002\010\004\000\002\010\005\000\002\010\005" });
/** Access to production table. */
@Override
public short[][] production_table() {
return _production_table;
}
/** Parse-action table. */
protected static final short[][] _action_table = unpackFromStrings(new String[] { "\000\144\000\040\005\016\013\025\014\011\015\021\016"
+ "\020\017\005\020\010\021\030\022\015\023\014\024\012"
+ "\025\017\026\004\041\023\043\013\001\002\000\004\005"
+ "\110\001\002\000\004\005\105\001\002\000\052\002\ufffe"
+ "\005\ufffe\007\036\010\034\011\037\012\035\013\ufffe\014"
+ "\ufffe\015\ufffe\016\ufffe\017\ufffe\020\ufffe\021\ufffe\022\ufffe"
+ "\023\ufffe\024\ufffe\025\ufffe\026\ufffe\041\ufffe\043\ufffe\001"
+ "\002\000\074\002\ufffa\004\ufffa\005\ufffa\006\ufffa\007\ufffa"
+ "\010\ufffa\011\ufffa\012\ufffa\013\ufffa\014\ufffa\015\ufffa\016"
+ "\ufffa\017\ufffa\020\ufffa\021\ufffa\022\ufffa\023\ufffa\024\ufffa"
+ "\025\ufffa\026\ufffa\031\ufffa\032\ufffa\033\ufffa\034\ufffa\035"
+ "\ufffa\037\ufffa\040\ufffa\041\ufffa\043\ufffa\001\002\000\004"
+ "\005\102\001\002\000\004\005\077\001\002\000\004\005"
+ "\072\001\002\000\074\002\ufff4\004\ufff4\005\ufff4\006\ufff4"
+ "\007\ufff4\010\ufff4\011\ufff4\012\ufff4\013\ufff4\014\ufff4\015"
+ "\ufff4\016\ufff4\017\ufff4\020\ufff4\021\ufff4\022\ufff4\023\ufff4"
+ "\024\ufff4\025\ufff4\026\ufff4\031\ufff4\032\ufff4\033\ufff4\034"
+ "\ufff4\035\ufff4\037\ufff4\040\ufff4\041\ufff4\043\ufff4\001\002"
+ "\000\004\005\067\001\002\000\004\005\064\001\002\000"
+ "\040\005\016\013\025\014\011\015\021\016\020\017\005"
+ "\020\010\021\030\022\015\023\014\024\012\025\017\026"
+ "\004\041\023\043\013\001\002\000\004\005\057\001\002"
+ "\000\004\005\054\001\002\000\004\005\051\001\002\000"
+ "\042\002\uffff\005\uffff\013\uffff\014\uffff\015\uffff\016\uffff"
+ "\017\uffff\020\uffff\021\uffff\022\uffff\023\uffff\024\uffff\025"
+ "\uffff\026\uffff\041\uffff\043\uffff\001\002\000\074\002\ufffd"
+ "\004\ufffd\005\ufffd\006\ufffd\007\ufffd\010\ufffd\011\ufffd\012"
+ "\ufffd\013\ufffd\014\ufffd\015\ufffd\016\ufffd\017\ufffd\020\ufffd"
+ "\021\ufffd\022\ufffd\023\ufffd\024\ufffd\025\ufffd\026\ufffd\031"
+ "\ufffd\032\ufffd\033\ufffd\034\ufffd\035\ufffd\037\ufffd\040\ufffd"
+ "\041\ufffd\043\ufffd\001\002\000\074\002\ufff9\004\ufff9\005"
+ "\ufff9\006\ufff9\007\ufff9\010\ufff9\011\ufff9\012\ufff9\013\ufff9"
+ "\014\ufff9\015\ufff9\016\ufff9\017\ufff9\020\ufff9\021\ufff9\022"
+ "\ufff9\023\ufff9\024\ufff9\025\ufff9\026\ufff9\031\ufff9\032\ufff9"
+ "\033\ufff9\034\ufff9\035\ufff9\037\ufff9\040\ufff9\041\ufff9\043"
+ "\ufff9\001\002\000\004\005\046\001\002\000\042\002\045"
+ "\005\016\013\025\014\011\015\021\016\020\017\005\020"
+ "\010\021\030\022\015\023\014\024\012\025\017\026\004"
+ "\041\023\043\013\001\002\000\074\002\ufffb\004\ufffb\005"
+ "\ufffb\006\ufffb\007\ufffb\010\ufffb\011\ufffb\012\ufffb\013\ufffb"
+ "\014\ufffb\015\ufffb\016\ufffb\017\ufffb\020\ufffb\021\ufffb\022"
+ "\ufffb\023\ufffb\024\ufffb\025\ufffb\026\ufffb\031\ufffb\032\ufffb"
+ "\033\ufffb\034\ufffb\035\ufffb\037\ufffb\040\ufffb\041\ufffb\043"
+ "\ufffb\001\002\000\004\005\031\001\002\000\040\005\016"
+ "\013\025\014\011\015\021\016\020\017\005\020\010\021"
+ "\030\022\015\023\014\024\012\025\017\026\004\041\023"
+ "\043\013\001\002\000\014\006\033\007\036\010\034\011"
+ "\037\012\035\001\002\000\074\002\uffed\004\uffed\005\uffed"
+ "\006\uffed\007\uffed\010\uffed\011\uffed\012\uffed\013\uffed\014"
+ "\uffed\015\uffed\016\uffed\017\uffed\020\uffed\021\uffed\022\uffed"
+ "\023\uffed\024\uffed\025\uffed\026\uffed\031\uffed\032\uffed\033"
+ "\uffed\034\uffed\035\uffed\037\uffed\040\uffed\041\uffed\043\uffed"
+ "\001\002\000\040\005\016\013\025\014\011\015\021\016"
+ "\020\017\005\020\010\021\030\022\015\023\014\024\012"
+ "\025\017\026\004\041\023\043\013\001\002\000\040\005"
+ "\016\013\025\014\011\015\021\016\020\017\005\020\010"
+ "\021\030\022\015\023\014\024\012\025\017\026\004\041"
+ "\023\043\013\001\002\000\040\005\016\013\025\014\011"
+ "\015\021\016\020\017\005\020\010\021\030\022\015\023"
+ "\014\024\012\025\017\026\004\041\023\043\013\001\002"
+ "\000\040\005\016\013\025\014\011\015\021\016\020\017"
+ "\005\020\010\021\030\022\015\023\014\024\012\025\017"
+ "\026\004\041\023\043\013\001\002\000\074\002\ufff6\004"
+ "\ufff6\005\ufff6\006\ufff6\007\ufff6\010\ufff6\011\ufff6\012\ufff6"
+ "\013\ufff6\014\ufff6\015\ufff6\016\ufff6\017\ufff6\020\ufff6\021"
+ "\ufff6\022\ufff6\023\ufff6\024\ufff6\025\ufff6\026\ufff6\031\ufff6"
+ "\032\ufff6\033\ufff6\034\ufff6\035\ufff6\037\ufff6\040\ufff6\041"
+ "\ufff6\043\ufff6\001\002\000\074\002\ufff7\004\ufff7\005\ufff7"
+ "\006\ufff7\007\ufff7\010\ufff7\011\037\012\035\013\ufff7\014"
+ "\ufff7\015\ufff7\016\ufff7\017\ufff7\020\ufff7\021\ufff7\022\ufff7"
+ "\023\ufff7\024\ufff7\025\ufff7\026\ufff7\031\ufff7\032\ufff7\033"
+ "\ufff7\034\ufff7\035\ufff7\037\ufff7\040\ufff7\041\ufff7\043\ufff7"
+ "\001\002\000\074\002\ufff5\004\ufff5\005\ufff5\006\ufff5\007"
+ "\ufff5\010\ufff5\011\ufff5\012\ufff5\013\ufff5\014\ufff5\015\ufff5"
+ "\016\ufff5\017\ufff5\020\ufff5\021\ufff5\022\ufff5\023\ufff5\024"
+ "\ufff5\025\ufff5\026\ufff5\031\ufff5\032\ufff5\033\ufff5\034\ufff5"
+ "\035\ufff5\037\ufff5\040\ufff5\041\ufff5\043\ufff5\001\002\000"
+ "\074\002\ufff8\004\ufff8\005\ufff8\006\ufff8\007\ufff8\010\ufff8"
+ "\011\037\012\035\013\ufff8\014\ufff8\015\ufff8\016\ufff8\017"
+ "\ufff8\020\ufff8\021\ufff8\022\ufff8\023\ufff8\024\ufff8\025\ufff8"
+ "\026\ufff8\031\ufff8\032\ufff8\033\ufff8\034\ufff8\035\ufff8\037"
+ "\ufff8\040\ufff8\041\ufff8\043\ufff8\001\002\000\042\002\001"
+ "\005\001\013\001\014\001\015\001\016\001\017\001\020"
+ "\001\021\001\022\001\023\001\024\001\025\001\026\001"
+ "\041\001\043\001\001\002\000\004\002\000\001\002\000"
+ "\040\005\016\013\025\014\011\015\021\016\020\017\005"
+ "\020\010\021\030\022\015\023\014\024\012\025\017\026"
+ "\004\041\023\043\013\001\002\000\014\006\050\007\036"
+ "\010\034\011\037\012\035\001\002\000\074\002\ufff3\004"
+ "\ufff3\005\ufff3\006\ufff3\007\ufff3\010\ufff3\011\ufff3\012\ufff3"
+ "\013\ufff3\014\ufff3\015\ufff3\016\ufff3\017\ufff3\020\ufff3\021"
+ "\ufff3\022\ufff3\023\ufff3\024\ufff3\025\ufff3\026\ufff3\031\ufff3"
+ "\032\ufff3\033\ufff3\034\ufff3\035\ufff3\037\ufff3\040\ufff3\041"
+ "\ufff3\043\ufff3\001\002\000\040\005\016\013\025\014\011"
+ "\015\021\016\020\017\005\020\010\021\030\022\015\023"
+ "\014\024\012\025\017\026\004\041\023\043\013\001\002"
+ "\000\014\006\053\007\036\010\034\011\037\012\035\001"
+ "\002\000\074\002\ufff1\004\ufff1\005\ufff1\006\ufff1\007\ufff1"
+ "\010\ufff1\011\ufff1\012\ufff1\013\ufff1\014\ufff1\015\ufff1\016"
+ "\ufff1\017\ufff1\020\ufff1\021\ufff1\022\ufff1\023\ufff1\024\ufff1"
+ "\025\ufff1\026\ufff1\031\ufff1\032\ufff1\033\ufff1\034\ufff1\035"
+ "\ufff1\037\ufff1\040\ufff1\041\ufff1\043\ufff1\001\002\000\040"
+ "\005\016\013\025\014\011\015\021\016\020\017\005\020"
+ "\010\021\030\022\015\023\014\024\012\025\017\026\004"
+ "\041\023\043\013\001\002\000\014\006\056\007\036\010"
+ "\034\011\037\012\035\001\002\000\074\002\ufff0\004\ufff0"
+ "\005\ufff0\006\ufff0\007\ufff0\010\ufff0\011\ufff0\012\ufff0\013"
+ "\ufff0\014\ufff0\015\ufff0\016\ufff0\017\ufff0\020\ufff0\021\ufff0"
+ "\022\ufff0\023\ufff0\024\ufff0\025\ufff0\026\ufff0\031\ufff0\032"
+ "\ufff0\033\ufff0\034\ufff0\035\ufff0\037\ufff0\040\ufff0\041\ufff0"
+ "\043\ufff0\001\002\000\040\005\016\013\025\014\011\015"
+ "\021\016\020\017\005\020\010\021\030\022\015\023\014"
+ "\024\012\025\017\026\004\041\023\043\013\001\002\000"
+ "\014\006\061\007\036\010\034\011\037\012\035\001\002"
+ "\000\074\002\uffe9\004\uffe9\005\uffe9\006\uffe9\007\uffe9\010"
+ "\uffe9\011\uffe9\012\uffe9\013\uffe9\014\uffe9\015\uffe9\016\uffe9"
+ "\017\uffe9\020\uffe9\021\uffe9\022\uffe9\023\uffe9\024\uffe9\025"
+ "\uffe9\026\uffe9\031\uffe9\032\uffe9\033\uffe9\034\uffe9\035\uffe9"
+ "\037\uffe9\040\uffe9\041\uffe9\043\uffe9\001\002\000\014\006"
+ "\063\007\036\010\034\011\037\012\035\001\002\000\074"
+ "\002\ufffc\004\ufffc\005\ufffc\006\ufffc\007\ufffc\010\ufffc\011"
+ "\ufffc\012\ufffc\013\ufffc\014\ufffc\015\ufffc\016\ufffc\017\ufffc"
+ "\020\ufffc\021\ufffc\022\ufffc\023\ufffc\024\ufffc\025\ufffc\026"
+ "\ufffc\031\ufffc\032\ufffc\033\ufffc\034\ufffc\035\ufffc\037\ufffc"
+ "\040\ufffc\041\ufffc\043\ufffc\001\002\000\040\005\016\013"
+ "\025\014\011\015\021\016\020\017\005\020\010\021\030"
+ "\022\015\023\014\024\012\025\017\026\004\041\023\043"
+ "\013\001\002\000\014\006\066\007\036\010\034\011\037"
+ "\012\035\001\002\000\074\002\uffec\004\uffec\005\uffec\006"
+ "\uffec\007\uffec\010\uffec\011\uffec\012\uffec\013\uffec\014\uffec"
+ "\015\uffec\016\uffec\017\uffec\020\uffec\021\uffec\022\uffec\023"
+ "\uffec\024\uffec\025\uffec\026\uffec\031\uffec\032\uffec\033\uffec"
+ "\034\uffec\035\uffec\037\uffec\040\uffec\041\uffec\043\uffec\001"
+ "\002\000\040\005\016\013\025\014\011\015\021\016\020"
+ "\017\005\020\010\021\030\022\015\023\014\024\012\025"
+ "\017\026\004\041\023\043\013\001\002\000\014\006\071"
+ "\007\036\010\034\011\037\012\035\001\002\000\074\002"
+ "\uffeb\004\uffeb\005\uffeb\006\uffeb\007\uffeb\010\uffeb\011\uffeb"
+ "\012\uffeb\013\uffeb\014\uffeb\015\uffeb\016\uffeb\017\uffeb\020"
+ "\uffeb\021\uffeb\022\uffeb\023\uffeb\024\uffeb\025\uffeb\026\uffeb"
+ "\031\uffeb\032\uffeb\033\uffeb\034\uffeb\035\uffeb\037\uffeb\040"
+ "\uffeb\041\uffeb\043\uffeb\001\002\000\040\005\016\013\025"
+ "\014\011\015\021\016\020\017\005\020\010\021\030\022"
+ "\015\023\014\024\012\025\017\026\004\041\023\043\013"
+ "\001\002\000\014\004\074\007\036\010\034\011\037\012"
+ "\035\001\002\000\040\005\016\013\025\014\011\015\021"
+ "\016\020\017\005\020\010\021\030\022\015\023\014\024"
+ "\012\025\017\026\004\041\023\043\013\001\002\000\014"
+ "\006\076\007\036\010\034\011\037\012\035\001\002\000"
+ "\074\002\uffea\004\uffea\005\uffea\006\uffea\007\uffea\010\uffea"
+ "\011\uffea\012\uffea\013\uffea\014\uffea\015\uffea\016\uffea\017"
+ "\uffea\020\uffea\021\uffea\022\uffea\023\uffea\024\uffea\025\uffea"
+ "\026\uffea\031\uffea\032\uffea\033\uffea\034\uffea\035\uffea\037"
+ "\uffea\040\uffea\041\uffea\043\uffea\001\002\000\040\005\016"
+ "\013\025\014\011\015\021\016\020\017\005\020\010\021"
+ "\030\022\015\023\014\024\012\025\017\026\004\041\023"
+ "\043\013\001\002\000\014\006\101\007\036\010\034\011"
+ "\037\012\035\001\002\000\074\002\ufff2\004\ufff2\005\ufff2"
+ "\006\ufff2\007\ufff2\010\ufff2\011\ufff2\012\ufff2\013\ufff2\014"
+ "\ufff2\015\ufff2\016\ufff2\017\ufff2\020\ufff2\021\ufff2\022\ufff2"
+ "\023\ufff2\024\ufff2\025\ufff2\026\ufff2\031\ufff2\032\ufff2\033"
+ "\ufff2\034\ufff2\035\ufff2\037\ufff2\040\ufff2\041\ufff2\043\ufff2"
+ "\001\002\000\040\005\016\013\025\014\011\015\021\016"
+ "\020\017\005\020\010\021\030\022\015\023\014\024\012"
+ "\025\017\026\004\041\023\043\013\001\002\000\014\006"
+ "\104\007\036\010\034\011\037\012\035\001\002\000\074"
+ "\002\uffee\004\uffee\005\uffee\006\uffee\007\uffee\010\uffee\011"
+ "\uffee\012\uffee\013\uffee\014\uffee\015\uffee\016\uffee\017\uffee"
+ "\020\uffee\021\uffee\022\uffee\023\uffee\024\uffee\025\uffee\026"
+ "\uffee\031\uffee\032\uffee\033\uffee\034\uffee\035\uffee\037\uffee"
+ "\040\uffee\041\uffee\043\uffee\001\002\000\040\005\016\013"
+ "\025\014\011\015\021\016\020\017\005\020\010\021\030"
+ "\022\015\023\014\024\012\025\017\026\004\041\023\043"
+ "\013\001\002\000\014\006\107\007\036\010\034\011\037"
+ "\012\035\001\002\000\074\002\uffef\004\uffef\005\uffef\006"
+ "\uffef\007\uffef\010\uffef\011\uffef\012\uffef\013\uffef\014\uffef"
+ "\015\uffef\016\uffef\017\uffef\020\uffef\021\uffef\022\uffef\023"
+ "\uffef\024\uffef\025\uffef\026\uffef\031\uffef\032\uffef\033\uffef"
+ "\034\uffef\035\uffef\037\uffef\040\uffef\041\uffef\043\uffef\001"
+ "\002\000\050\005\114\013\025\014\011\015\021\016\020"
+ "\017\005\020\010\021\030\022\015\023\014\024\012\025"
+ "\017\026\004\027\113\030\117\036\112\041\023\042\115"
+ "\043\013\001\002\000\024\007\036\010\034\011\037\012"
+ "\035\031\140\032\136\033\137\034\134\035\135\001\002"
+ "\000\050\005\114\013\025\014\011\015\021\016\020\017"
+ "\005\020\010\021\030\022\015\023\014\024\012\025\017"
+ "\026\004\027\113\030\117\036\112\041\023\042\115\043"
+ "\013\001\002\000\012\004\uffe6\006\uffe6\037\uffe6\040\uffe6"
+ "\001\002\000\050\005\114\013\025\014\011\015\021\016"
+ "\020\017\005\020\010\021\030\022\015\023\014\024\012"
+ "\025\017\026\004\027\113\030\117\036\112\041\023\042"
+ "\115\043\013\001\002\000\012\004\uffe7\006\uffe7\037\uffe7"
+ "\040\uffe7\001\002\000\010\004\120\037\121\040\122\001"
+ "\002\000\012\004\uffe5\006\uffe5\037\uffe5\040\uffe5\001\002"
+ "\000\040\005\016\013\025\014\011\015\021\016\020\017"
+ "\005\020\010\021\030\022\015\023\014\024\012\025\017"
+ "\026\004\041\023\043\013\001\002\000\050\005\114\013"
+ "\025\014\011\015\021\016\020\017\005\020\010\021\030"
+ "\022\015\023\014\024\012\025\017\026\004\027\113\030"
+ "\117\036\112\041\023\042\115\043\013\001\002\000\050"
+ "\005\114\013\025\014\011\015\021\016\020\017\005\020"
+ "\010\021\030\022\015\023\014\024\012\025\017\026\004"
+ "\027\113\030\117\036\112\041\023\042\115\043\013\001"
+ "\002\000\012\004\uffdc\006\uffdc\037\uffdc\040\uffdc\001\002"
+ "\000\012\004\uffdd\006\uffdd\037\uffdd\040\uffdd\001\002\000"
+ "\014\004\126\007\036\010\034\011\037\012\035\001\002"
+ "\000\040\005\016\013\025\014\011\015\021\016\020\017"
+ "\005\020\010\021\030\022\015\023\014\024\012\025\017"
+ "\026\004\041\023\043\013\001\002\000\014\006\130\007"
+ "\036\010\034\011\037\012\035\001\002\000\074\002\uffe8"
+ "\004\uffe8\005\uffe8\006\uffe8\007\uffe8\010\uffe8\011\uffe8\012"
+ "\uffe8\013\uffe8\014\uffe8\015\uffe8\016\uffe8\017\uffe8\020\uffe8"
+ "\021\uffe8\022\uffe8\023\uffe8\024\uffe8\025\uffe8\026\uffe8\031"
+ "\uffe8\032\uffe8\033\uffe8\034\uffe8\035\uffe8\037\uffe8\040\uffe8"
+ "\041\uffe8\043\uffe8\001\002\000\026\006\063\007\036\010"
+ "\034\011\037\012\035\031\140\032\136\033\137\034\134"
+ "\035\135\001\002\000\010\006\133\037\121\040\122\001"
+ "\002\000\012\004\uffdf\006\uffdf\037\uffdf\040\uffdf\001\002"
+ "\000\040\005\016\013\025\014\011\015\021\016\020\017"
+ "\005\020\010\021\030\022\015\023\014\024\012\025\017"
+ "\026\004\041\023\043\013\001\002\000\040\005\016\013"
+ "\025\014\011\015\021\016\020\017\005\020\010\021\030"
+ "\022\015\023\014\024\012\025\017\026\004\041\023\043"
+ "\013\001\002\000\040\005\016\013\025\014\011\015\021"
+ "\016\020\017\005\020\010\021\030\022\015\023\014\024"
+ "\012\025\017\026\004\041\023\043\013\001\002\000\040"
+ "\005\016\013\025\014\011\015\021\016\020\017\005\020"
+ "\010\021\030\022\015\023\014\024\012\025\017\026\004"
+ "\041\023\043\013\001\002\000\040\005\016\013\025\014"
+ "\011\015\021\016\020\017\005\020\010\021\030\022\015"
+ "\023\014\024\012\025\017\026\004\041\023\043\013\001"
+ "\002\000\022\004\uffe4\006\uffe4\007\036\010\034\011\037"
+ "\012\035\037\uffe4\040\uffe4\001\002\000\022\004\uffe2\006"
+ "\uffe2\007\036\010\034\011\037\012\035\037\uffe2\040\uffe2"
+ "\001\002\000\022\004\uffe3\006\uffe3\007\036\010\034\011"
+ "\037\012\035\037\uffe3\040\uffe3\001\002\000\022\004\uffe0"
+ "\006\uffe0\007\036\010\034\011\037\012\035\037\uffe0\040"
+ "\uffe0\001\002\000\022\004\uffe1\006\uffe1\007\036\010\034"
+ "\011\037\012\035\037\uffe1\040\uffe1\001\002\000\012\004"
+ "\uffde\006\uffde\037\uffde\040\uffde\001\002" });
/** Access to parse-action table. */
@Override
public short[][] action_table() {
return _action_table;
}
/** reduce_goto
table. */
protected static final short[][] _reduce_table = unpackFromStrings(new String[] { "\000\144\000\016\002\025\003\021\004\005\005\026\006"
+ "\006\007\023\001\001\000\002\001\001\000\002\001\001"
+ "\000\002\001\001\000\002\001\001\000\002\001\001\000"
+ "\002\001\001\000\002\001\001\000\002\001\001\000\002"
+ "\001\001\000\002\001\001\000\012\004\061\005\026\006"
+ "\006\007\023\001\001\000\002\001\001\000\002\001\001"
+ "\000\002\001\001\000\002\001\001\000\002\001\001\000"
+ "\002\001\001\000\002\001\001\000\014\003\043\004\005"
+ "\005\026\006\006\007\023\001\001\000\002\001\001\000"
+ "\002\001\001\000\012\004\031\005\026\006\006\007\023"
+ "\001\001\000\002\001\001\000\002\001\001\000\012\004"
+ "\042\005\026\006\006\007\023\001\001\000\012\004\041"
+ "\005\026\006\006\007\023\001\001\000\012\004\040\005"
+ "\026\006\006\007\023\001\001\000\012\004\037\005\026"
+ "\006\006\007\023\001\001\000\002\001\001\000\002\001"
+ "\001\000\002\001\001\000\002\001\001\000\002\001\001"
+ "\000\002\001\001\000\012\004\046\005\026\006\006\007"
+ "\023\001\001\000\002\001\001\000\002\001\001\000\012"
+ "\004\051\005\026\006\006\007\023\001\001\000\002\001"
+ "\001\000\002\001\001\000\012\004\054\005\026\006\006"
+ "\007\023\001\001\000\002\001\001\000\002\001\001\000"
+ "\012\004\057\005\026\006\006\007\023\001\001\000\002"
+ "\001\001\000\002\001\001\000\002\001\001\000\002\001"
+ "\001\000\012\004\064\005\026\006\006\007\023\001\001"
+ "\000\002\001\001\000\002\001\001\000\012\004\067\005"
+ "\026\006\006\007\023\001\001\000\002\001\001\000\002"
+ "\001\001\000\012\004\072\005\026\006\006\007\023\001"
+ "\001\000\002\001\001\000\012\004\074\005\026\006\006"
+ "\007\023\001\001\000\002\001\001\000\002\001\001\000"
+ "\012\004\077\005\026\006\006\007\023\001\001\000\002"
+ "\001\001\000\002\001\001\000\012\004\102\005\026\006"
+ "\006\007\023\001\001\000\002\001\001\000\002\001\001"
+ "\000\012\004\105\005\026\006\006\007\023\001\001\000"
+ "\002\001\001\000\002\001\001\000\014\004\110\005\026"
+ "\006\006\007\023\010\115\001\001\000\002\001\001\000"
+ "\014\004\110\005\026\006\006\007\023\010\145\001\001"
+ "\000\002\001\001\000\014\004\130\005\026\006\006\007"
+ "\023\010\131\001\001\000\002\001\001\000\002\001\001"
+ "\000\002\001\001\000\012\004\124\005\026\006\006\007"
+ "\023\001\001\000\014\004\110\005\026\006\006\007\023"
+ "\010\123\001\001\000\014\004\110\005\026\006\006\007"
+ "\023\010\122\001\001\000\002\001\001\000\002\001\001"
+ "\000\002\001\001\000\012\004\126\005\026\006\006\007"
+ "\023\001\001\000\002\001\001\000\002\001\001\000\002"
+ "\001\001\000\002\001\001\000\002\001\001\000\012\004"
+ "\144\005\026\006\006\007\023\001\001\000\012\004\143"
+ "\005\026\006\006\007\023\001\001\000\012\004\142\005"
+ "\026\006\006\007\023\001\001\000\012\004\141\005\026"
+ "\006\006\007\023\001\001\000\012\004\140\005\026\006"
+ "\006\007\023\001\001\000\002\001\001\000\002\001\001"
+ "\000\002\001\001\000\002\001\001\000\002\001\001\000" + "\002\001\001" });
/** Access to reduce_goto
table. */
@Override
public short[][] reduce_table() {
return _reduce_table;
}
/** Instance of action encapsulation class. */
protected CUP$Parser$actions action_obj;
/** Action encapsulation object initializer. */
@Override
protected void init_actions() {
action_obj = new CUP$Parser$actions(this);
}
/** Invoke a user supplied parse action. */
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public java_cup.runtime.Symbol do_action(int act_num,
java_cup.runtime.lr_parser parser, java.util.Stack stack, int top)
throws java.lang.Exception {
/* call code in generated class */
return action_obj.CUP$Parser$do_action(act_num, parser, stack, top);
}
/** Indicates start state. */
@Override
public int start_state() {
return 0;
}
/** Indicates start production. */
@Override
public int start_production() {
return 1;
}
/** EOF
Symbol index. */
@Override
public int EOF_sym() {
return 0;
}
/** error
Symbol index. */
@Override
public int error_sym() {
return 1;
}
/** variable - value relation. */
protected HashMap m_Symbols = new HashMap();
/** for storing the result of the expresion. */
protected Double m_Result = null;
/**
* Sets the variable - value relation to use.
*
* @param value the variable-value relation
*/
public void setSymbols(HashMap value) {
m_Symbols = value;
}
/**
* Returns the current variable - value relation in use.
*
* @return the variable-value relation
*/
public HashMap getSymbols() {
return m_Symbols;
}
/**
* Sets the result of the evaluation.
*
* @param value the result
*/
public void setResult(Double value) {
m_Result = value;
}
/**
* Returns the result of the evaluation.
*
* @return the result
*/
public Double getResult() {
return m_Result;
}
/**
* Runs the parser from commandline. Either reads lines from System.in or from
* a provided file (line by line). With
* -symbols
* as first parameter one can provide predefined variable values. E.g.:
* -symbols "Y=10;X=3" "X+Y"
*
* @param args the commandline arguments
* @throws Exception if something goes wrong
*/
public static void main(String args[]) throws Exception {
// read symbols, if present
HashMap symbols = new HashMap();
if (args.length > 0) {
if (args[0].equals("-symbols")) {
// parse symbols
String[] pairs = args[1].replaceAll(" ", "").split(";");
for (String pair : pairs) {
String[] parts = pair.split("=");
symbols.put(parts[0], new Double(parts[1]));
}
// print symbols
System.out.println("\nSymbols provided:");
Iterator iter = symbols.keySet().iterator();
while (iter.hasNext()) {
String key = iter.next();
System.out.println(key + "=" + symbols.get(key));
}
// remove symbols from commandline
String[] argsNew = new String[args.length - 2];
System.arraycopy(args, 2, argsNew, 0, argsNew.length);
args = argsNew;
}
}
// setup input stream
int index = -1;
if (args.length == 1) {
index = 0;
}
BufferedReader input = null;
if (index == -1) {
System.out
.println("\nPlease type in expressions (and press ), exit with :");
input = new BufferedReader(new InputStreamReader(System.in));
} else {
System.out.println("\nReading expressions from file '" + args[index]
+ "':");
input = new BufferedReader(new FileReader(args[index]));
}
// process stream
@SuppressWarnings("deprecation")
SymbolFactory sf = new DefaultSymbolFactory();
String line;
while ((line = input.readLine()) != null) {
ByteArrayInputStream parserInput = new ByteArrayInputStream(
line.getBytes());
Parser parser = new Parser(new Scanner(parserInput, sf), sf);
parser.setSymbols(symbols);
parser.parse();
System.out.println(line + " = " + parser.getResult());
}
}
}
/** Cup generated class to encapsulate user supplied action code. */
class CUP$Parser$actions {
private final Parser parser;
/** Constructor */
CUP$Parser$actions(Parser parser) {
this.parser = parser;
}
/** Method with the actual generated action code. */
public final java_cup.runtime.Symbol CUP$Parser$do_action(
int CUP$Parser$act_num, java_cup.runtime.lr_parser CUP$Parser$parser,
java.util.Stack CUP$Parser$stack,
int CUP$Parser$top) throws java.lang.Exception {
/* Symbol object for return from actions */
java_cup.runtime.Symbol CUP$Parser$result;
/* select the action based on the action number */
switch (CUP$Parser$act_num) {
/* . . . . . . . . . . . . . . . . . . . . */
case 37: // boolexpr ::= boolexpr OR boolexpr
{
Boolean RESULT = null;
Boolean l = (Boolean) CUP$Parser$stack.elementAt(CUP$Parser$top - 2).value;
Boolean r = (Boolean) CUP$Parser$stack.peek().value;
RESULT = l || r;
CUP$Parser$result = parser.getSymbolFactory().newSymbol("boolexpr", 6,
(CUP$Parser$stack.elementAt(CUP$Parser$top - 2)),
(CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 36: // boolexpr ::= boolexpr AND boolexpr
{
Boolean RESULT = null;
Boolean l = (Boolean) CUP$Parser$stack.elementAt(CUP$Parser$top - 2).value;
Boolean r = (Boolean) CUP$Parser$stack.peek().value;
RESULT = l && r;
CUP$Parser$result = parser.getSymbolFactory().newSymbol("boolexpr", 6,
(CUP$Parser$stack.elementAt(CUP$Parser$top - 2)),
(CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 35: // boolexpr ::= NOT boolexpr
{
Boolean RESULT = null;
Boolean b = (Boolean) CUP$Parser$stack.peek().value;
RESULT = !b;
CUP$Parser$result = parser.getSymbolFactory().newSymbol("boolexpr", 6,
(CUP$Parser$stack.elementAt(CUP$Parser$top - 1)),
(CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 34: // boolexpr ::= LPAREN boolexpr RPAREN
{
Boolean RESULT = null;
Boolean b = (Boolean) CUP$Parser$stack.elementAt(CUP$Parser$top - 1).value;
RESULT = b;
CUP$Parser$result = parser.getSymbolFactory().newSymbol("boolexpr", 6,
(CUP$Parser$stack.elementAt(CUP$Parser$top - 2)),
(CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 33: // boolexpr ::= expr EQ expr
{
Boolean RESULT = null;
Double l = (Double) CUP$Parser$stack.elementAt(CUP$Parser$top - 2).value;
Double r = (Double) CUP$Parser$stack.peek().value;
RESULT = new Boolean(l.doubleValue() == r.doubleValue());
CUP$Parser$result = parser.getSymbolFactory().newSymbol("boolexpr", 6,
(CUP$Parser$stack.elementAt(CUP$Parser$top - 2)),
(CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 32: // boolexpr ::= expr GE expr
{
Boolean RESULT = null;
Double l = (Double) CUP$Parser$stack.elementAt(CUP$Parser$top - 2).value;
Double r = (Double) CUP$Parser$stack.peek().value;
RESULT = new Boolean(l.doubleValue() >= r.doubleValue());
CUP$Parser$result = parser.getSymbolFactory().newSymbol("boolexpr", 6,
(CUP$Parser$stack.elementAt(CUP$Parser$top - 2)),
(CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 31: // boolexpr ::= expr GT expr
{
Boolean RESULT = null;
Double l = (Double) CUP$Parser$stack.elementAt(CUP$Parser$top - 2).value;
Double r = (Double) CUP$Parser$stack.peek().value;
RESULT = new Boolean(l.doubleValue() > r.doubleValue());
CUP$Parser$result = parser.getSymbolFactory().newSymbol("boolexpr", 6,
(CUP$Parser$stack.elementAt(CUP$Parser$top - 2)),
(CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 30: // boolexpr ::= expr LE expr
{
Boolean RESULT = null;
Double l = (Double) CUP$Parser$stack.elementAt(CUP$Parser$top - 2).value;
Double r = (Double) CUP$Parser$stack.peek().value;
RESULT = new Boolean(l.doubleValue() <= r.doubleValue());
CUP$Parser$result = parser.getSymbolFactory().newSymbol("boolexpr", 6,
(CUP$Parser$stack.elementAt(CUP$Parser$top - 2)),
(CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 29: // boolexpr ::= expr LT expr
{
Boolean RESULT = null;
Double l = (Double) CUP$Parser$stack.elementAt(CUP$Parser$top - 2).value;
Double r = (Double) CUP$Parser$stack.peek().value;
RESULT = new Boolean(l.doubleValue() < r.doubleValue());
CUP$Parser$result = parser.getSymbolFactory().newSymbol("boolexpr", 6,
(CUP$Parser$stack.elementAt(CUP$Parser$top - 2)),
(CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 28: // boolexpr ::= FALSE
{
Boolean RESULT = null;
RESULT = new Boolean(false);
CUP$Parser$result = parser.getSymbolFactory().newSymbol("boolexpr", 6,
(CUP$Parser$stack.peek()), (CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 27: // boolexpr ::= TRUE
{
Boolean RESULT = null;
RESULT = new Boolean(true);
CUP$Parser$result = parser.getSymbolFactory().newSymbol("boolexpr", 6,
(CUP$Parser$stack.peek()), (CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 26: // boolexpr ::= BOOLEAN
{
Boolean RESULT = null;
Boolean b = (Boolean) CUP$Parser$stack.peek().value;
RESULT = b;
CUP$Parser$result = parser.getSymbolFactory().newSymbol("boolexpr", 6,
(CUP$Parser$stack.peek()), (CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 25: // funcexpr ::= IFELSE LPAREN boolexpr COMMA expr COMMA expr RPAREN
{
Double RESULT = null;
Boolean b = (Boolean) CUP$Parser$stack.elementAt(CUP$Parser$top - 5).value;
Double e_true = (Double) CUP$Parser$stack.elementAt(CUP$Parser$top - 3).value;
Double e_false = (Double) CUP$Parser$stack.elementAt(CUP$Parser$top - 1).value;
if (b) {
RESULT = e_true;
} else {
RESULT = e_false;
}
CUP$Parser$result = parser.getSymbolFactory().newSymbol("funcexpr", 5,
(CUP$Parser$stack.elementAt(CUP$Parser$top - 7)),
(CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 24: // funcexpr ::= CEIL LPAREN expr RPAREN
{
Double RESULT = null;
Double e = (Double) CUP$Parser$stack.elementAt(CUP$Parser$top - 1).value;
RESULT = new Double(Math.ceil(e));
CUP$Parser$result = parser.getSymbolFactory().newSymbol("funcexpr", 5,
(CUP$Parser$stack.elementAt(CUP$Parser$top - 3)),
(CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 23: // funcexpr ::= POW LPAREN expr COMMA expr RPAREN
{
Double RESULT = null;
Double base = (Double) CUP$Parser$stack.elementAt(CUP$Parser$top - 3).value;
Double exponent = (Double) CUP$Parser$stack.elementAt(CUP$Parser$top - 1).value;
RESULT = new Double(Math.pow(base, exponent));
CUP$Parser$result = parser.getSymbolFactory().newSymbol("funcexpr", 5,
(CUP$Parser$stack.elementAt(CUP$Parser$top - 5)),
(CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 22: // funcexpr ::= FLOOR LPAREN expr RPAREN
{
Double RESULT = null;
Double e = (Double) CUP$Parser$stack.elementAt(CUP$Parser$top - 1).value;
RESULT = new Double(Math.floor(e));
CUP$Parser$result = parser.getSymbolFactory().newSymbol("funcexpr", 5,
(CUP$Parser$stack.elementAt(CUP$Parser$top - 3)),
(CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 21: // funcexpr ::= RINT LPAREN expr RPAREN
{
Double RESULT = null;
Double e = (Double) CUP$Parser$stack.elementAt(CUP$Parser$top - 1).value;
RESULT = new Double(Math.rint(e));
CUP$Parser$result = parser.getSymbolFactory().newSymbol("funcexpr", 5,
(CUP$Parser$stack.elementAt(CUP$Parser$top - 3)),
(CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 20: // funcexpr ::= TAN LPAREN expr RPAREN
{
Double RESULT = null;
Double e = (Double) CUP$Parser$stack.elementAt(CUP$Parser$top - 1).value;
RESULT = new Double(Math.tan(e));
CUP$Parser$result = parser.getSymbolFactory().newSymbol("funcexpr", 5,
(CUP$Parser$stack.elementAt(CUP$Parser$top - 3)),
(CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 19: // funcexpr ::= COS LPAREN expr RPAREN
{
Double RESULT = null;
Double e = (Double) CUP$Parser$stack.elementAt(CUP$Parser$top - 1).value;
RESULT = new Double(Math.cos(e));
CUP$Parser$result = parser.getSymbolFactory().newSymbol("funcexpr", 5,
(CUP$Parser$stack.elementAt(CUP$Parser$top - 3)),
(CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 18: // funcexpr ::= SIN LPAREN expr RPAREN
{
Double RESULT = null;
Double e = (Double) CUP$Parser$stack.elementAt(CUP$Parser$top - 1).value;
RESULT = new Double(Math.sin(e));
CUP$Parser$result = parser.getSymbolFactory().newSymbol("funcexpr", 5,
(CUP$Parser$stack.elementAt(CUP$Parser$top - 3)),
(CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 17: // funcexpr ::= EXP LPAREN expr RPAREN
{
Double RESULT = null;
Double e = (Double) CUP$Parser$stack.elementAt(CUP$Parser$top - 1).value;
RESULT = new Double(Math.exp(e));
CUP$Parser$result = parser.getSymbolFactory().newSymbol("funcexpr", 5,
(CUP$Parser$stack.elementAt(CUP$Parser$top - 3)),
(CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 16: // funcexpr ::= LOG LPAREN expr RPAREN
{
Double RESULT = null;
Double e = (Double) CUP$Parser$stack.elementAt(CUP$Parser$top - 1).value;
RESULT = new Double(Math.log(e));
CUP$Parser$result = parser.getSymbolFactory().newSymbol("funcexpr", 5,
(CUP$Parser$stack.elementAt(CUP$Parser$top - 3)),
(CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 15: // funcexpr ::= SQRT LPAREN expr RPAREN
{
Double RESULT = null;
Double e = (Double) CUP$Parser$stack.elementAt(CUP$Parser$top - 1).value;
RESULT = new Double(Math.sqrt(e));
CUP$Parser$result = parser.getSymbolFactory().newSymbol("funcexpr", 5,
(CUP$Parser$stack.elementAt(CUP$Parser$top - 3)),
(CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 14: // funcexpr ::= ABS LPAREN expr RPAREN
{
Double RESULT = null;
Double e = (Double) CUP$Parser$stack.elementAt(CUP$Parser$top - 1).value;
RESULT = new Double(Math.abs(e));
CUP$Parser$result = parser.getSymbolFactory().newSymbol("funcexpr", 5,
(CUP$Parser$stack.elementAt(CUP$Parser$top - 3)),
(CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 13: // varexpr ::= VARIABLE
{
Double RESULT = null;
String v = (String) CUP$Parser$stack.peek().value;
if (parser.getSymbols().containsKey(v)) {
RESULT = parser.getSymbols().get(v);
} else {
throw new IllegalStateException("Unknown symbol '" + v + "'!");
}
CUP$Parser$result = parser.getSymbolFactory().newSymbol("varexpr", 4,
(CUP$Parser$stack.peek()), (CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 12: // opexpr ::= expr DIVISION expr
{
Double RESULT = null;
Double l = (Double) CUP$Parser$stack.elementAt(CUP$Parser$top - 2).value;
Double r = (Double) CUP$Parser$stack.peek().value;
RESULT = new Double(l.doubleValue() / r.doubleValue());
CUP$Parser$result = parser.getSymbolFactory().newSymbol("opexpr", 3,
(CUP$Parser$stack.elementAt(CUP$Parser$top - 2)),
(CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 11: // opexpr ::= expr TIMES expr
{
Double RESULT = null;
Double l = (Double) CUP$Parser$stack.elementAt(CUP$Parser$top - 2).value;
Double r = (Double) CUP$Parser$stack.peek().value;
RESULT = new Double(l.doubleValue() * r.doubleValue());
CUP$Parser$result = parser.getSymbolFactory().newSymbol("opexpr", 3,
(CUP$Parser$stack.elementAt(CUP$Parser$top - 2)),
(CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 10: // opexpr ::= expr MINUS expr
{
Double RESULT = null;
Double l = (Double) CUP$Parser$stack.elementAt(CUP$Parser$top - 2).value;
Double r = (Double) CUP$Parser$stack.peek().value;
RESULT = new Double(l.doubleValue() - r.doubleValue());
CUP$Parser$result = parser.getSymbolFactory().newSymbol("opexpr", 3,
(CUP$Parser$stack.elementAt(CUP$Parser$top - 2)),
(CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 9: // opexpr ::= expr PLUS expr
{
Double RESULT = null;
Double l = (Double) CUP$Parser$stack.elementAt(CUP$Parser$top - 2).value;
Double r = (Double) CUP$Parser$stack.peek().value;
RESULT = new Double(l.doubleValue() + r.doubleValue());
CUP$Parser$result = parser.getSymbolFactory().newSymbol("opexpr", 3,
(CUP$Parser$stack.elementAt(CUP$Parser$top - 2)),
(CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 8: // expr ::= funcexpr
{
Double RESULT = null;
Double f = (Double) CUP$Parser$stack.peek().value;
RESULT = f;
CUP$Parser$result = parser.getSymbolFactory().newSymbol("expr", 2,
(CUP$Parser$stack.peek()), (CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 7: // expr ::= varexpr
{
Double RESULT = null;
Double v = (Double) CUP$Parser$stack.peek().value;
RESULT = v;
CUP$Parser$result = parser.getSymbolFactory().newSymbol("expr", 2,
(CUP$Parser$stack.peek()), (CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 6: // expr ::= opexpr
{
Double RESULT = null;
Double o = (Double) CUP$Parser$stack.peek().value;
RESULT = o;
CUP$Parser$result = parser.getSymbolFactory().newSymbol("expr", 2,
(CUP$Parser$stack.peek()), (CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 5: // expr ::= LPAREN expr RPAREN
{
Double RESULT = null;
Double e = (Double) CUP$Parser$stack.elementAt(CUP$Parser$top - 1).value;
RESULT = e;
CUP$Parser$result = parser.getSymbolFactory().newSymbol("expr", 2,
(CUP$Parser$stack.elementAt(CUP$Parser$top - 2)),
(CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 4: // expr ::= NUMBER
{
Double RESULT = null;
Double n = (Double) CUP$Parser$stack.peek().value;
RESULT = n;
CUP$Parser$result = parser.getSymbolFactory().newSymbol("expr", 2,
(CUP$Parser$stack.peek()), (CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 3: // expr_part ::= expr
{
Object RESULT = null;
Double e = (Double) CUP$Parser$stack.peek().value;
parser.setResult(e);
CUP$Parser$result = parser.getSymbolFactory().newSymbol("expr_part", 1,
(CUP$Parser$stack.peek()), (CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 2: // expr_list ::= expr_part
{
Object RESULT = null;
CUP$Parser$result = parser.getSymbolFactory().newSymbol("expr_list", 0,
(CUP$Parser$stack.peek()), (CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 1: // $START ::= expr_list EOF
{
Object RESULT = null;
Object start_val = CUP$Parser$stack.elementAt(CUP$Parser$top - 1).value;
RESULT = start_val;
CUP$Parser$result = parser.getSymbolFactory().newSymbol("$START", 0,
(CUP$Parser$stack.elementAt(CUP$Parser$top - 1)),
(CUP$Parser$stack.peek()), RESULT);
}
/* ACCEPT */
CUP$Parser$parser.done_parsing();
return CUP$Parser$result;
/* . . . . . . . . . . . . . . . . . . . . */
case 0: // expr_list ::= expr_list expr_part
{
Object RESULT = null;
CUP$Parser$result = parser.getSymbolFactory().newSymbol("expr_list", 0,
(CUP$Parser$stack.elementAt(CUP$Parser$top - 1)),
(CUP$Parser$stack.peek()), RESULT);
}
return CUP$Parser$result;
/* . . . . . . */
default:
throw new Exception("Invalid action number found in internal parse table");
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy