@@ -1048,17 +1048,17 @@ public CNode (Symbol l, Symbol r) {
10481048 }
10491049 }
10501050
1051- void GetSingles (Node p , ArrayList singles , Node rule ) {
1051+ void GetSingles (Node p , ArrayList singles ) {
10521052 if (p == null ) return ; // end of graph
10531053 if (p .typ == Node .nt ) {
1054- if ( p . up || DelGraph ( p . next ) || p . sym . graph == rule ) singles .add (p .sym );
1054+ singles .add (p .sym );
10551055 } else if (p .typ == Node .alt || p .typ == Node .iter || p .typ == Node .opt ) {
10561056 if (p .up || DelGraph (p .next )) {
1057- GetSingles (p .sub , singles , rule );
1058- if (p .typ == Node .alt ) GetSingles (p .down , singles , rule );
1057+ GetSingles (p .sub , singles );
1058+ if (p .typ == Node .alt ) GetSingles (p .down , singles );
10591059 }
10601060 }
1061- if (!p .up && DelNode (p )) GetSingles (p .next , singles , rule );
1061+ if (!p .up && DelNode (p )) GetSingles (p .next , singles );
10621062 }
10631063
10641064 public boolean NoCircularProductions () {
@@ -1067,7 +1067,7 @@ public boolean NoCircularProductions() {
10671067 for (int i = 0 ; i < nonterminals .size (); i ++) {
10681068 Symbol sym = (Symbol )nonterminals .get (i );
10691069 ArrayList singles = new ArrayList ();
1070- GetSingles (sym .graph , singles , sym . graph ); // get nonterminals s such that sym-->s
1070+ GetSingles (sym .graph , singles ); // get nonterminals s such that sym-->s
10711071 for (int j = 0 ; j < singles .size (); j ++) {
10721072 Symbol s = (Symbol )singles .get (j );
10731073 list .add (new CNode (sym , s ));
@@ -1092,7 +1092,7 @@ public boolean NoCircularProductions() {
10921092 for (int i = 0 ; i < list .size (); i ++) {
10931093 CNode n = (CNode )list .get (i );
10941094 ok = false ;
1095- errors .SemErr (" " + n .left .name + " --> " + n .right .name );
1095+ errors .SemErr (" " + n .left .name + ":" + n . left . line + " --> " + n .right .name + ":" + n . right . line );
10961096 }
10971097 return ok ;
10981098 }
0 commit comments