//----------------------------------------------------
// The following code was generated by CUP v0.10k
// Mon Dec 13 21:59:41 CET 2004
//----------------------------------------------------
package se.chalmers.cs.gf.dot;
/** CUP v0.10k generated parser.
* @version Mon Dec 13 21:59:41 CET 2004
*/
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);}
/** Production table. */
protected static final short _production_table[][] =
unpackFromStrings(new String[] {
"\000\021\000\002\002\004\000\002\003\006\000\002\004" +
"\003\000\002\005\002\000\002\005\005\000\002\006\004" +
"\000\002\006\006\000\002\007\002\000\002\007\005\000" +
"\002\010\002\000\002\010\003\000\002\010\005\000\002" +
"\011\005\000\002\012\003\000\002\012\003\000\002\012" +
"\003\000\002\012\003" });
/** Access to production table. */
public short[][] production_table() {return _production_table;}
/** Parse-action table. */
protected static final short[][] _action_table =
unpackFromStrings(new String[] {
"\000\034\000\004\014\006\001\002\000\004\002\036\001" +
"\002\000\004\004\007\001\002\000\004\004\uffff\001\002" +
"\000\014\005\ufffe\015\ufffe\016\ufffe\017\ufffe\020\ufffe\001" +
"\002\000\014\005\013\015\012\016\016\017\017\020\015" +
"\001\002\000\010\006\ufffa\007\022\010\021\001\002\000" +
"\016\006\ufff3\007\ufff3\010\ufff3\011\ufff3\012\ufff3\013\ufff3" +
"\001\002\000\004\002\000\001\002\000\004\006\020\001" +
"\002\000\016\006\ufff4\007\ufff4\010\ufff4\011\ufff4\012\ufff4" +
"\013\ufff4\001\002\000\016\006\ufff2\007\ufff2\010\ufff2\011" +
"\ufff2\012\ufff2\013\ufff2\001\002\000\016\006\ufff1\007\ufff1" +
"\010\ufff1\011\ufff1\012\ufff1\013\ufff1\001\002\000\014\005" +
"\ufffd\015\ufffd\016\ufffd\017\ufffd\020\ufffd\001\002\000\014" +
"\011\ufff8\015\012\016\016\017\017\020\015\001\002\000" +
"\012\015\012\016\016\017\017\020\015\001\002\000\004" +
"\006\ufffc\001\002\000\006\006\ufffa\010\021\001\002\000" +
"\004\006\ufffb\001\002\000\004\013\034\001\002\000\004" +
"\011\033\001\002\000\006\011\ufff7\012\031\001\002\000" +
"\014\011\ufff8\015\012\016\016\017\017\020\015\001\002" +
"\000\004\011\ufff6\001\002\000\004\006\ufff9\001\002\000" +
"\012\015\012\016\016\017\017\020\015\001\002\000\006" +
"\011\ufff5\012\ufff5\001\002\000\004\002\001\001\002" });
/** Access to parse-action table. */
public short[][] action_table() {return _action_table;}
/** reduce_goto
table. */
protected static final short[][] _reduce_table =
unpackFromStrings(new String[] {
"\000\034\000\006\003\003\004\004\001\001\000\002\001" +
"\001\000\002\001\001\000\002\001\001\000\004\005\007" +
"\001\001\000\006\006\013\012\010\001\001\000\004\007" +
"\022\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\010\010\026\011\027\012\025" +
"\001\001\000\004\012\023\001\001\000\002\001\001\000" +
"\004\007\024\001\001\000\002\001\001\000\002\001\001" +
"\000\002\001\001\000\002\001\001\000\010\010\031\011" +
"\027\012\025\001\001\000\002\001\001\000\002\001\001" +
"\000\004\012\034\001\001\000\002\001\001\000\002\001" +
"\001" });
/** Access to reduce_goto
table. */
public short[][] reduce_table() {return _reduce_table;}
/** Instance of action encapsulation class. */
protected CUP$parser$actions action_obj;
/** Action encapsulation object initializer. */
protected void init_actions()
{
action_obj = new CUP$parser$actions(this);
}
/** Invoke a user supplied parse action. */
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. */
public int start_state() {return 0;}
/** Indicates start production. */
public int start_production() {return 0;}
/** EOF
Symbol index. */
public int EOF_sym() {return 0;}
/** error
Symbol index. */
public int error_sym() {return 1;}
public se.chalmers.cs.gf.dot.Absyn.Graph pGraph() throws Exception
{
java_cup.runtime.Symbol res = parse();
return (se.chalmers.cs.gf.dot.Absyn.Graph) res.value;
}
public void syntax_error(java_cup.runtime.Symbol cur_token)
{
report_error("Syntax Error, trying to recover and continue parse...", cur_token);
}
public void unrecovered_syntax_error(java_cup.runtime.Symbol cur_token) throws java.lang.Exception
{
throw new Exception("Unrecoverable Syntax Error");
}
}
/** 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 16: // ID ::= _DOUBLE_
{
se.chalmers.cs.gf.dot.Absyn.ID RESULT = null;
Double p_1 = (Double)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new se.chalmers.cs.gf.dot.Absyn.DoubleID(p_1);
CUP$parser$result = new java_cup.runtime.Symbol(8/*ID*/, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 15: // ID ::= _INTEGER_
{
se.chalmers.cs.gf.dot.Absyn.ID RESULT = null;
Integer p_1 = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new se.chalmers.cs.gf.dot.Absyn.IntID(p_1);
CUP$parser$result = new java_cup.runtime.Symbol(8/*ID*/, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 14: // ID ::= _STRING_
{
se.chalmers.cs.gf.dot.Absyn.ID RESULT = null;
String p_1 = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new se.chalmers.cs.gf.dot.Absyn.StringID(p_1);
CUP$parser$result = new java_cup.runtime.Symbol(8/*ID*/, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 13: // ID ::= _IDENT_
{
se.chalmers.cs.gf.dot.Absyn.ID RESULT = null;
String p_1 = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new se.chalmers.cs.gf.dot.Absyn.IdentID(p_1);
CUP$parser$result = new java_cup.runtime.Symbol(8/*ID*/, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 12: // Attr ::= ID _SYMB_7 ID
{
se.chalmers.cs.gf.dot.Absyn.Attr RESULT = null;
se.chalmers.cs.gf.dot.Absyn.ID p_1 = (se.chalmers.cs.gf.dot.Absyn.ID)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
se.chalmers.cs.gf.dot.Absyn.ID p_3 = (se.chalmers.cs.gf.dot.Absyn.ID)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new se.chalmers.cs.gf.dot.Absyn.Attr(p_1,p_3);
CUP$parser$result = new java_cup.runtime.Symbol(7/*Attr*/, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 11: // ListAttr ::= Attr _SYMB_6 ListAttr
{
se.chalmers.cs.gf.dot.Absyn.ListAttr RESULT = null;
se.chalmers.cs.gf.dot.Absyn.Attr p_1 = (se.chalmers.cs.gf.dot.Absyn.Attr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
se.chalmers.cs.gf.dot.Absyn.ListAttr p_3 = (se.chalmers.cs.gf.dot.Absyn.ListAttr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = p_3; p_3.addFirst(p_1);
CUP$parser$result = new java_cup.runtime.Symbol(6/*ListAttr*/, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 10: // ListAttr ::= Attr
{
se.chalmers.cs.gf.dot.Absyn.ListAttr RESULT = null;
se.chalmers.cs.gf.dot.Absyn.Attr p_1 = (se.chalmers.cs.gf.dot.Absyn.Attr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new se.chalmers.cs.gf.dot.Absyn.ListAttr(); RESULT.addLast(p_1);
CUP$parser$result = new java_cup.runtime.Symbol(6/*ListAttr*/, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 9: // ListAttr ::=
{
se.chalmers.cs.gf.dot.Absyn.ListAttr RESULT = null;
RESULT = new se.chalmers.cs.gf.dot.Absyn.ListAttr();
CUP$parser$result = new java_cup.runtime.Symbol(6/*ListAttr*/, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 8: // MaybeAttrList ::= _SYMB_4 ListAttr _SYMB_5
{
se.chalmers.cs.gf.dot.Absyn.MaybeAttrList RESULT = null;
se.chalmers.cs.gf.dot.Absyn.ListAttr p_2 = (se.chalmers.cs.gf.dot.Absyn.ListAttr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
RESULT = new se.chalmers.cs.gf.dot.Absyn.AnAttrList(p_2);
CUP$parser$result = new java_cup.runtime.Symbol(5/*MaybeAttrList*/, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 7: // MaybeAttrList ::=
{
se.chalmers.cs.gf.dot.Absyn.MaybeAttrList RESULT = null;
RESULT = new se.chalmers.cs.gf.dot.Absyn.NoAttrList();
CUP$parser$result = new java_cup.runtime.Symbol(5/*MaybeAttrList*/, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 6: // Stmt ::= ID _SYMB_3 ID MaybeAttrList
{
se.chalmers.cs.gf.dot.Absyn.Stmt RESULT = null;
se.chalmers.cs.gf.dot.Absyn.ID p_1 = (se.chalmers.cs.gf.dot.Absyn.ID)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-3)).value;
se.chalmers.cs.gf.dot.Absyn.ID p_3 = (se.chalmers.cs.gf.dot.Absyn.ID)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
se.chalmers.cs.gf.dot.Absyn.MaybeAttrList p_4 = (se.chalmers.cs.gf.dot.Absyn.MaybeAttrList)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new se.chalmers.cs.gf.dot.Absyn.EdgeStmt(p_1,p_3,p_4);
CUP$parser$result = new java_cup.runtime.Symbol(4/*Stmt*/, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 5: // Stmt ::= ID MaybeAttrList
{
se.chalmers.cs.gf.dot.Absyn.Stmt RESULT = null;
se.chalmers.cs.gf.dot.Absyn.ID p_1 = (se.chalmers.cs.gf.dot.Absyn.ID)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
se.chalmers.cs.gf.dot.Absyn.MaybeAttrList p_2 = (se.chalmers.cs.gf.dot.Absyn.MaybeAttrList)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new se.chalmers.cs.gf.dot.Absyn.NodeStmt(p_1,p_2);
CUP$parser$result = new java_cup.runtime.Symbol(4/*Stmt*/, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 4: // ListStmt ::= ListStmt Stmt _SYMB_2
{
se.chalmers.cs.gf.dot.Absyn.ListStmt RESULT = null;
se.chalmers.cs.gf.dot.Absyn.ListStmt p_1 = (se.chalmers.cs.gf.dot.Absyn.ListStmt)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
se.chalmers.cs.gf.dot.Absyn.Stmt p_2 = (se.chalmers.cs.gf.dot.Absyn.Stmt)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
RESULT = p_1; p_1.addLast(p_2);
CUP$parser$result = new java_cup.runtime.Symbol(3/*ListStmt*/, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 3: // ListStmt ::=
{
se.chalmers.cs.gf.dot.Absyn.ListStmt RESULT = null;
RESULT = new se.chalmers.cs.gf.dot.Absyn.ListStmt();
CUP$parser$result = new java_cup.runtime.Symbol(3/*ListStmt*/, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 2: // GraphType ::= _SYMB_8
{
se.chalmers.cs.gf.dot.Absyn.GraphType RESULT = null;
RESULT = new se.chalmers.cs.gf.dot.Absyn.Digraph();
CUP$parser$result = new java_cup.runtime.Symbol(2/*GraphType*/, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 1: // Graph ::= GraphType _SYMB_0 ListStmt _SYMB_1
{
se.chalmers.cs.gf.dot.Absyn.Graph RESULT = null;
se.chalmers.cs.gf.dot.Absyn.GraphType p_1 = (se.chalmers.cs.gf.dot.Absyn.GraphType)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-3)).value;
se.chalmers.cs.gf.dot.Absyn.ListStmt p_3 = (se.chalmers.cs.gf.dot.Absyn.ListStmt)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
RESULT = new se.chalmers.cs.gf.dot.Absyn.Graph(p_1,p_3);
CUP$parser$result = new java_cup.runtime.Symbol(1/*Graph*/, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 0: // $START ::= Graph EOF
{
Object RESULT = null;
se.chalmers.cs.gf.dot.Absyn.Graph start_val = (se.chalmers.cs.gf.dot.Absyn.Graph)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
RESULT = start_val;
CUP$parser$result = new java_cup.runtime.Symbol(0/*$START*/, RESULT);
}
/* ACCEPT */
CUP$parser$parser.done_parsing();
return CUP$parser$result;
/* . . . . . .*/
default:
throw new Exception(
"Invalid action number found in internal parse table");
}
}
}