📄 state.java
字号:
return result;
}
case 39: // results ::=
{ result=new Symbol(17);
return result;
}
case 38: // results ::= results resdefn
{ result=new Symbol(17);
return result;
}
case 37: // proc ::= STAR
{ result=new Symbol(3);
return result;
}
case 36: // proc ::= STRN
{
String s=(String)((Symbol)symstack.elementAt(top)).value;
Process p=Process.Var(s);
Debug.println(5, "Found process name:\t\t\t"+p);
result=new Symbol(3,p);
return result;
}
case 35: // proc ::= LPAREN proc RPAREN
{
Process p=(Process)((Symbol)symstack.elementAt(top-1)).value;
Debug.println(5, "Found brackets:\t\t\t\t("+p+")");
result=new Symbol(3,p);
return result;
}
case 34: // proc ::= proc DIVIDE actionset
{
Process p=(Process)((Symbol)symstack.elementAt(top-2)).value;
ActionSet l = (ActionSet)((Symbol)symstack.elementAt(top)).value;
Process P=Process.Hide(p,l);
Debug.println(5, "Found hide:\t\t\t\t"+p+"/"+l);
result=new Symbol(3,P);
return result;
}
case 33:// proc ::= proc coopset proc
{
Process p1=(Process)((Symbol)symstack.elementAt(top-2)).value;
ActionSet l = (ActionSet)((Symbol)symstack.elementAt(top-1)).value;
Process p2=(Process)((Symbol)symstack.elementAt(top)).value;
Process P=Process.Coop(p1,l,p2);
Debug.println(5, "Found coop:\t\t\t\t"+p1+"<"+l+">"+p2);
result=new Symbol(3,P);
return result;
}
case 32:// proc ::= proc SUM proc
{
Process p1=(Process)((Symbol)symstack.elementAt(top-2)).value;
Process p2=(Process)((Symbol)symstack.elementAt(top)).value;
Process P=Process.Sum(p1,p2);
Debug.println(5, "Found sum:\t\t\t\t"+p1+"+"+p2);
result=new Symbol(3,P);
return result;
}
case 31: // proc ::= activity DOT proc
{
Activity a=(Activity)((Symbol)symstack.elementAt(top-2)).value;
Process p=(Process)((Symbol)symstack.elementAt(top)).value;
Process P=Process.Prefix(a,p);
Debug.println(5, "Found prefix:\t\t\t\t("+a+"."+p+")");
result=new Symbol(3,P);
return result;
}
case 30: // actionlist ::= anaction
{
Action a=(Action)((Symbol)symstack.elementAt(top)).value;
ActionSet set=new ActionSet(a);
if(a.isTao())
{
throw new ParserException("该动作已被隐藏,行:"+Lexer.getLine()+" 列:"+Lexer.getColumn());
}
set=set.put(a);
result=new Symbol(13,set);
return result;
}
case 29:// actionlist ::= actionlist COMMA anaction
{
ActionSet set=(ActionSet)((Symbol)symstack.elementAt(top-2)).value;
Action a=(Action)((Symbol)symstack.elementAt(top)).value;
if(a.isTao())
{
throw new ParserException("该动作已被隐藏,行:"+Lexer.getLine()+" 列:"+Lexer.getColumn());
}
set=set.put(a);
result=new Symbol(13,set);
return result;
}
case 28: // actionset ::= LSET actionlist RSET
{
ActionSet set=(ActionSet)((Symbol)symstack.elementAt(top-1)).value;
Debug.println(5, "found action set:\t\t\t"+set);
result=new Symbol(12,set);
return result;
}
case 27: // actions ::= actionlist
{
ActionSet set=(ActionSet)((Symbol)symstack.elementAt(top)).value;
Debug.println(5, "found action set:\t\t\t"+set);
result=new Symbol(11,set);
return result;
}
case 26: // actions ::= actionset
{
ActionSet set=(ActionSet)((Symbol)symstack.elementAt(top)).value;
Debug.println(5, "found action set:\t\t\t"+set);
result=new Symbol(11,set);
return result;
}
case 25: // coopset ::= PAR
{
ActionSet set=new ActionSet();
Debug.println(5, "Found empty coopset in ||:\t\t\t");
result=new Symbol(14,set);
return result;
}
case 24: // coopset ::= LCOOP RCOOP
{
ActionSet set=new ActionSet();
Debug.println(5, "Found empty coopset in <>:\t\t\t");
result=new Symbol(14,set);
return result;
}
case 23: // coopset ::= LCOOP actions RCOOP
{
ActionSet set=(ActionSet)((Symbol)symstack.elementAt(top-1)).value;
result=new Symbol(14,set);
return result;
}
case 22: // rate ::= TOP
{
Rate r = Rate.Unspec(new Double(1.0));
Debug.println(5, "Found top rate:\t\t\t");
result=new Symbol(16,r);
return result;
}
case 21: // rate ::= STRN
{
String s=(String)((Symbol)symstack.elementAt(top)).value;
Double d=Rate.def(s);
Rate r=null;
Debug.println(5, "Found rate string:\t\t\t"+s);
if(d==null)
{
throw new RateException("该对象未定义:"+s+" 行:"+Lexer.getLine()+" 列:"+Lexer.getColumn());
}else if(d.equals(new Double(0.0)))
{
r=Rate.Strung(s);
}else
{
r=Rate.Spec(s);
}
result=new Symbol(16,r);
return result;
}
case 20: // rate ::= real
{
Double d=(Double)((Symbol)symstack.elementAt(top)).value;
Rate r=Rate.Number(d);
Debug.println(5, "Found rate number:\t\t\t"+d);
result=new Symbol(16,r);
return result;
}
case 19: // rate ::= LPAREN rate RPAREN
{
Rate r=(Rate)((Symbol)symstack.elementAt(top-1)).value;
Debug.println(5, "Found bracket rates:\t\t\t"+r);
result=new Symbol(16,r);
return result;
}
case 18: // rate ::= rate DIVIDE rate
{
Rate r1=(Rate)((Symbol)symstack.elementAt(top-2)).value;
Rate r2=(Rate)((Symbol)symstack.elementAt(top)).value;
Rate r=r1.div(r2);
Debug.println(5, "Found div of rates:\t\t\t"+r1+"/"+r2);
result=new Symbol(16,r);
return result;
}
case 17:// rate ::= rate MULT rate
{
Rate r1=(Rate)((Symbol)symstack.elementAt(top-2)).value;
Rate r2=(Rate)((Symbol)symstack.elementAt(top)).value;
Rate r=r1.mult(r2);
Debug.println(5, "Found mult of rates:\t\t\t"+r1+"*"+r2);
result=new Symbol(16,r);
return result;
}
case 16: // rate ::= rate MINUS rate
{
Rate r1=(Rate)((Symbol)symstack.elementAt(top-2)).value;
Rate r2=(Rate)((Symbol)symstack.elementAt(top)).value;
Rate r=r1.minus(r2);
Debug.println(5, "Found minus of rates:\t\t\t"+r1+"-"+r2);
result=new Symbol(16,r);
return result;
}
case 15: // rate ::= rate SUM rate
{
Rate r1=(Rate)((Symbol)symstack.elementAt(top-2)).value;
Rate r2=(Rate)((Symbol)symstack.elementAt(top)).value;
Rate r=r1.plus(r2);
Debug.println(5, "Found sum of rates:\t\t\t"+r1+"+"+r2);
result=new Symbol(16,r);
return result;
}
case 14: // activity ::= LPAREN anaction COMMA rate RPAREN
{
Action a=(Action)((Symbol)symstack.elementAt(top-3)).value;
Rate r = (Rate)((Symbol)symstack.elementAt(top-1)).value;
String s=a.toString();
Activity actv=new Activity(s,r);
Debug.println(5,"Found activity:\t\t\t\t"+actv );
result=new Symbol(9,actv);
return result;
}
case 13: // anaction ::= STRN
{
String s = (String)((Symbol)symstack.elementAt(top)).value;
Action a=new Action(s);
Debug.println(5,"Found action:\t\t\t\t"+a );
result=new Symbol(10,a);
return result;
}
case 12: // procdefn ::= STRN EQUALS proc
{
String s = (String)((Symbol)symstack.elementAt(top-2)).value;
Process p= (Process)((Symbol)symstack.elementAt(top)).value;
Process.addDef(s,p);
Debug.println(5, "Found Process Definition:\t\t"+s+"="+p);
result=new Symbol(5);
return result;
}
case 11: // real ::= NUMB
{
Double d = (Double)((Symbol)symstack.elementAt(top)).value;
Debug.println(5, "Found real number:\t\t\t"+d);
result=new Symbol(15,d);
return result;
}
case 10: // vardefn ::= STRN EQUALS real
{
String s = (String)((Symbol)symstack.elementAt(top-2)).value;
Double r = (Double)((Symbol)symstack.elementAt(top)).value;
Rate.adddef(s,r);
Debug.println(5, "Found Rate Definition:\t\t\t"+s+"="+r);
result=new Symbol(7);
return result;
}
case 9: // procdefn_opt ::= HASH procdefn
{
result=new Symbol(6);
return result;
}
case 8: // procdefn_opt ::= procdefn
{
result=new Symbol(6);
return result;
}
case 7: // vardefn_opt ::= PERC vardefn
{
result=new Symbol(8);
return result;
}
case 6: // vardefn_opt ::= vardefn
{
result=new Symbol(8);
return result;
}
case 5: // defn ::= vardefn_opt SEMI
{
result=new Symbol(2);
return result;
}
case 4: // defn ::= procdefn_opt SEMI
{
result=new Symbol(2);
return result;
}
case 3: // defns ::=
{
result=new Symbol(1);
return result;
}
case 2: // defns ::= defns defn
{
result=new Symbol(1);
return result;
}
case 1: // process ::= defns proc results
{
Process p = (Process)((Symbol)symstack.elementAt(top-1)).value;
result=new Symbol(4,p);
return result;
}
case 0:// $START ::= process EOF
{
Process p = (Process)((Symbol)symstack.elementAt(top-1)).value;
result=new Symbol(0,p);
Parsing.setEnd(true);
return result;
}
default:
{
throw new ParserException("语法分析失败!行:"+Lexer.getLine()+" 列:"+Lexer.getColumn());
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -