View Javadoc

1   /* Generated By:JJTree&JavaCC: Do not edit this line. DOTParser.java */
2   package org.glassbox.dotparser;
3   import java.io.*;
4   
5   /***
6      The parser for graphviz' .dot language. 
7      Call method graph() to retrieve the AST of your graph description.
8    */
9   public class DOTParser/*@bgen(jjtree)*/implements DOTParserTreeConstants, DOTParserConstants {/*@bgen(jjtree)*/
10    protected JJTDOTParserState jjtree = new JJTDOTParserState();
11    public static void dumpAST(Reader r) throws IOException, ParseException {
12      new DOTParser(r).graph().dump(" ");
13    }
14  
15    public static void main(String[] args) throws Exception
16    {
17      dumpAST(new FileReader(args[0]));
18    }
19  
20    /***
21       Strip leading and trailing quotes from the identifier if they exist.
22       Additionally kill the "//n" separators from the identifier.
23     */
24    protected static String stripQuotes(String identifier) {
25      identifier = identifier.replaceAll("////\n", "");
26      if (identifier.indexOf("\"")==0) return identifier.substring(1, identifier.length()-1);
27      else return identifier;
28    }
29  
30  /*===========================================================================================
31    DOT Grammar starts here
32    ===========================================================================================*/
33    final public ASTgraph graph() throws ParseException {
34   /*@bgen(jjtree) graph */
35    ASTgraph jjtn000 = new ASTgraph(JJTGRAPH);
36    boolean jjtc000 = true;
37    jjtree.openNodeScope(jjtn000);Token id = null;
38    Token type = null;
39      try {
40        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
41        case STRICT:
42          jj_consume_token(STRICT);
43          break;
44        default:
45          jj_la1[0] = jj_gen;
46          ;
47        }
48        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
49        case GRAPH:
50          type = jj_consume_token(GRAPH);
51          break;
52        case DIGRAPH:
53          type = jj_consume_token(DIGRAPH);
54          break;
55        default:
56          jj_la1[1] = jj_gen;
57          jj_consume_token(-1);
58          throw new ParseException();
59        }
60        id = jj_consume_token(ID);
61        jj_consume_token(LBRACE);
62        stmt_list();
63        jj_consume_token(RBRACE);
64        jj_consume_token(0);
65        jjtree.closeNodeScope(jjtn000, true);
66        jjtc000 = false;
67          jjtn000.setDirected("digraph".equalsIgnoreCase(type.image));
68          jjtn000.setID(DOTParser.stripQuotes(id.image));
69          {if (true) return jjtn000;}
70      } catch (Throwable jjte000) {
71        if (jjtc000) {
72          jjtree.clearNodeScope(jjtn000);
73          jjtc000 = false;
74        } else {
75          jjtree.popNode();
76        }
77        if (jjte000 instanceof RuntimeException) {
78          {if (true) throw (RuntimeException)jjte000;}
79        }
80        if (jjte000 instanceof ParseException) {
81          {if (true) throw (ParseException)jjte000;}
82        }
83        {if (true) throw (Error)jjte000;}
84      } finally {
85        if (jjtc000) {
86          jjtree.closeNodeScope(jjtn000, true);
87        }
88      }
89      throw new Error("Missing return statement in function");
90    }
91  
92    final public void stmt_list() throws ParseException {
93   /*@bgen(jjtree) stmt_list */
94    ASTstmt_list jjtn000 = new ASTstmt_list(JJTSTMT_LIST);
95    boolean jjtc000 = true;
96    jjtree.openNodeScope(jjtn000);
97      try {
98        stmt();
99        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
100       case SEMICOLON:
101         jj_consume_token(SEMICOLON);
102         break;
103       default:
104         jj_la1[2] = jj_gen;
105         ;
106       }
107       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
108       case EDGE:
109       case GRAPH:
110       case NODE:
111       case SUBGRAPH:
112       case LBRACE:
113       case ID:
114         stmt_list();
115         break;
116       default:
117         jj_la1[3] = jj_gen;
118         ;
119       }
120     } catch (Throwable jjte000) {
121       if (jjtc000) {
122         jjtree.clearNodeScope(jjtn000);
123         jjtc000 = false;
124       } else {
125         jjtree.popNode();
126       }
127       if (jjte000 instanceof RuntimeException) {
128         {if (true) throw (RuntimeException)jjte000;}
129       }
130       if (jjte000 instanceof ParseException) {
131         {if (true) throw (ParseException)jjte000;}
132       }
133       {if (true) throw (Error)jjte000;}
134     } finally {
135       if (jjtc000) {
136         jjtree.closeNodeScope(jjtn000, true);
137       }
138     }
139   }
140 
141   final public void stmt() throws ParseException {
142  /*@bgen(jjtree) stmt */
143   ASTstmt jjtn000 = new ASTstmt(JJTSTMT);
144   boolean jjtc000 = true;
145   jjtree.openNodeScope(jjtn000);
146     try {
147       if (jj_2_1(2147483647)) {
148         edge_stmt();
149       } else if (jj_2_2(3)) {
150         subgraph();
151       } else if (jj_2_3(2)) {
152         ideq_stmt();
153       } else if (jj_2_4(2)) {
154         attr_stmt();
155       } else if (jj_2_5(2)) {
156         node_stmt();
157       } else {
158         jj_consume_token(-1);
159         throw new ParseException();
160       }
161     } catch (Throwable jjte000) {
162     if (jjtc000) {
163       jjtree.clearNodeScope(jjtn000);
164       jjtc000 = false;
165     } else {
166       jjtree.popNode();
167     }
168     if (jjte000 instanceof RuntimeException) {
169       {if (true) throw (RuntimeException)jjte000;}
170     }
171     if (jjte000 instanceof ParseException) {
172       {if (true) throw (ParseException)jjte000;}
173     }
174     {if (true) throw (Error)jjte000;}
175     } finally {
176     if (jjtc000) {
177       jjtree.closeNodeScope(jjtn000, true);
178     }
179     }
180   }
181 
182   final public void ideq_stmt() throws ParseException {
183  /*@bgen(jjtree) ideq_stmt */
184   ASTideq_stmt jjtn000 = new ASTideq_stmt(JJTIDEQ_STMT);
185   boolean jjtc000 = true;
186   jjtree.openNodeScope(jjtn000);Token key = null;
187   Token value = null;
188     try {
189       key = jj_consume_token(ID);
190       jj_consume_token(EQ);
191       value = jj_consume_token(ID);
192       jjtree.closeNodeScope(jjtn000, true);
193       jjtc000 = false;
194         jjtn000.setKey(DOTParser.stripQuotes(key.image));
195         jjtn000.setValue(DOTParser.stripQuotes(value.image));
196     } finally {
197       if (jjtc000) {
198         jjtree.closeNodeScope(jjtn000, true);
199       }
200     }
201   }
202 
203   final public void attr_stmt() throws ParseException {
204  /*@bgen(jjtree) attr_stmt */
205   ASTattr_stmt jjtn000 = new ASTattr_stmt(JJTATTR_STMT);
206   boolean jjtc000 = true;
207   jjtree.openNodeScope(jjtn000);Token type = null;
208     try {
209       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
210       case GRAPH:
211         type = jj_consume_token(GRAPH);
212         break;
213       case NODE:
214         type = jj_consume_token(NODE);
215         break;
216       case EDGE:
217         type = jj_consume_token(EDGE);
218         break;
219       default:
220         jj_la1[4] = jj_gen;
221         jj_consume_token(-1);
222         throw new ParseException();
223       }
224       attr_list();
225       jjtree.closeNodeScope(jjtn000, true);
226       jjtc000 = false;
227         jjtn000.setType(type.image);
228     } catch (Throwable jjte000) {
229       if (jjtc000) {
230         jjtree.clearNodeScope(jjtn000);
231         jjtc000 = false;
232       } else {
233         jjtree.popNode();
234       }
235       if (jjte000 instanceof RuntimeException) {
236         {if (true) throw (RuntimeException)jjte000;}
237       }
238       if (jjte000 instanceof ParseException) {
239         {if (true) throw (ParseException)jjte000;}
240       }
241       {if (true) throw (Error)jjte000;}
242     } finally {
243       if (jjtc000) {
244         jjtree.closeNodeScope(jjtn000, true);
245       }
246     }
247   }
248 
249   final public void node_stmt() throws ParseException {
250  /*@bgen(jjtree) node_stmt */
251   ASTnode_stmt jjtn000 = new ASTnode_stmt(JJTNODE_STMT);
252   boolean jjtc000 = true;
253   jjtree.openNodeScope(jjtn000);
254     try {
255       node_id();
256       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
257       case LBRACKET:
258         attr_list();
259         break;
260       default:
261         jj_la1[5] = jj_gen;
262         ;
263       }
264     } catch (Throwable jjte000) {
265       if (jjtc000) {
266         jjtree.clearNodeScope(jjtn000);
267         jjtc000 = false;
268       } else {
269         jjtree.popNode();
270       }
271       if (jjte000 instanceof RuntimeException) {
272         {if (true) throw (RuntimeException)jjte000;}
273       }
274       if (jjte000 instanceof ParseException) {
275         {if (true) throw (ParseException)jjte000;}
276       }
277       {if (true) throw (Error)jjte000;}
278     } finally {
279       if (jjtc000) {
280         jjtree.closeNodeScope(jjtn000, true);
281       }
282     }
283   }
284 
285   final public void node_id() throws ParseException {
286  /*@bgen(jjtree) node_id */
287   ASTnode_id jjtn000 = new ASTnode_id(JJTNODE_ID);
288   boolean jjtc000 = true;
289   jjtree.openNodeScope(jjtn000);Token id = null;
290     try {
291       id = jj_consume_token(ID);
292       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
293       case COLON:
294         port();
295         break;
296       default:
297         jj_la1[6] = jj_gen;
298         ;
299       }
300       jjtree.closeNodeScope(jjtn000, true);
301       jjtc000 = false;
302         jjtn000.setID(DOTParser.stripQuotes(id.image));
303     } catch (Throwable jjte000) {
304       if (jjtc000) {
305         jjtree.clearNodeScope(jjtn000);
306         jjtc000 = false;
307       } else {
308         jjtree.popNode();
309       }
310       if (jjte000 instanceof RuntimeException) {
311         {if (true) throw (RuntimeException)jjte000;}
312       }
313       if (jjte000 instanceof ParseException) {
314         {if (true) throw (ParseException)jjte000;}
315       }
316       {if (true) throw (Error)jjte000;}
317     } finally {
318       if (jjtc000) {
319         jjtree.closeNodeScope(jjtn000, true);
320       }
321     }
322   }
323 
324   final public void port() throws ParseException {
325  /*@bgen(jjtree) port */
326   ASTport jjtn000 = new ASTport(JJTPORT);
327   boolean jjtc000 = true;
328   jjtree.openNodeScope(jjtn000);Token id = null;
329     try {
330       if (jj_2_6(2)) {
331         jj_consume_token(COLON);
332         compass_pt();
333       } else if (jj_2_7(2)) {
334         jj_consume_token(COLON);
335         id = jj_consume_token(ID);
336       } else {
337         jj_consume_token(-1);
338         throw new ParseException();
339       }
340       jjtree.closeNodeScope(jjtn000, true);
341       jjtc000 = false;
342         jjtn000.setID(id!=null?DOTParser.stripQuotes(id.image):null);
343     } catch (Throwable jjte000) {
344       if (jjtc000) {
345         jjtree.clearNodeScope(jjtn000);
346         jjtc000 = false;
347       } else {
348         jjtree.popNode();
349       }
350       if (jjte000 instanceof RuntimeException) {
351         {if (true) throw (RuntimeException)jjte000;}
352       }
353       if (jjte000 instanceof ParseException) {
354         {if (true) throw (ParseException)jjte000;}
355       }
356       {if (true) throw (Error)jjte000;}
357     } finally {
358       if (jjtc000) {
359         jjtree.closeNodeScope(jjtn000, true);
360       }
361     }
362   }
363 
364   final public void compass_pt() throws ParseException {
365  /*@bgen(jjtree) compass_pt */
366   ASTcompass_pt jjtn000 = new ASTcompass_pt(JJTCOMPASS_PT);
367   boolean jjtc000 = true;
368   jjtree.openNodeScope(jjtn000);Token orientation = null;
369     try {
370       orientation = jj_consume_token(ORIENTATION);
371       jjtree.closeNodeScope(jjtn000, true);
372       jjtc000 = false;
373         jjtn000.setOrientation(DOTParser.stripQuotes(orientation.image));
374     } finally {
375       if (jjtc000) {
376         jjtree.closeNodeScope(jjtn000, true);
377       }
378     }
379   }
380 
381   final public void edge_stmt() throws ParseException {
382  /*@bgen(jjtree) edge_stmt */
383   ASTedge_stmt jjtn000 = new ASTedge_stmt(JJTEDGE_STMT);
384   boolean jjtc000 = true;
385   jjtree.openNodeScope(jjtn000);
386     try {
387       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
388       case ID:
389         node_id();
390         break;
391       case SUBGRAPH:
392       case LBRACE:
393         subgraph();
394         break;
395       default:
396         jj_la1[7] = jj_gen;
397         jj_consume_token(-1);
398         throw new ParseException();
399       }
400       edgeRHS();
401       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
402       case LBRACKET:
403         attr_list();
404         break;
405       default:
406         jj_la1[8] = jj_gen;
407         ;
408       }
409     } catch (Throwable jjte000) {
410       if (jjtc000) {
411         jjtree.clearNodeScope(jjtn000);
412         jjtc000 = false;
413       } else {
414         jjtree.popNode();
415       }
416       if (jjte000 instanceof RuntimeException) {
417         {if (true) throw (RuntimeException)jjte000;}
418       }
419       if (jjte000 instanceof ParseException) {
420         {if (true) throw (ParseException)jjte000;}
421       }
422       {if (true) throw (Error)jjte000;}
423     } finally {
424       if (jjtc000) {
425         jjtree.closeNodeScope(jjtn000, true);
426       }
427     }
428   }
429 
430   final public void subgraph() throws ParseException {
431  /*@bgen(jjtree) subgraph */
432   ASTsubgraph jjtn000 = new ASTsubgraph(JJTSUBGRAPH);
433   boolean jjtc000 = true;
434   jjtree.openNodeScope(jjtn000);Token id = null;
435     try {
436       if (jj_2_8(3)) {
437         switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
438         case SUBGRAPH:
439           jj_consume_token(SUBGRAPH);
440           switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
441           case ID:
442             id = jj_consume_token(ID);
443             break;
444           default:
445             jj_la1[9] = jj_gen;
446             ;
447           }
448           break;
449         default:
450           jj_la1[10] = jj_gen;
451           ;
452         }
453         jj_consume_token(LBRACE);
454         stmt_list();
455         jj_consume_token(RBRACE);
456       } else {
457         switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
458         case SUBGRAPH:
459           jj_consume_token(SUBGRAPH);
460           id = jj_consume_token(ID);
461           break;
462         default:
463           jj_la1[11] = jj_gen;
464           jj_consume_token(-1);
465           throw new ParseException();
466         }
467       }
468       jjtree.closeNodeScope(jjtn000, true);
469       jjtc000 = false;
470         jjtn000.setID(id==null?null:DOTParser.stripQuotes(id.image));
471     } catch (Throwable jjte000) {
472       if (jjtc000) {
473         jjtree.clearNodeScope(jjtn000);
474         jjtc000 = false;
475       } else {
476         jjtree.popNode();
477       }
478       if (jjte000 instanceof RuntimeException) {
479         {if (true) throw (RuntimeException)jjte000;}
480       }
481       if (jjte000 instanceof ParseException) {
482         {if (true) throw (ParseException)jjte000;}
483       }
484       {if (true) throw (Error)jjte000;}
485     } finally {
486       if (jjtc000) {
487         jjtree.closeNodeScope(jjtn000, true);
488       }
489     }
490   }
491 
492   final public void edgeRHS() throws ParseException {
493  /*@bgen(jjtree) edgeRHS */
494   ASTedgeRHS jjtn000 = new ASTedgeRHS(JJTEDGERHS);
495   boolean jjtc000 = true;
496   jjtree.openNodeScope(jjtn000);
497     try {
498       edgeop();
499       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
500       case ID:
501         node_id();
502         break;
503       case SUBGRAPH:
504       case LBRACE:
505         subgraph();
506         break;
507       default:
508         jj_la1[12] = jj_gen;
509         jj_consume_token(-1);
510         throw new ParseException();
511       }
512       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
513       case EDGE_UNDIRECTED:
514       case EDGE_DIRECTED:
515         edgeRHS();
516         break;
517       default:
518         jj_la1[13] = jj_gen;
519         ;
520       }
521     } catch (Throwable jjte000) {
522       if (jjtc000) {
523         jjtree.clearNodeScope(jjtn000);
524         jjtc000 = false;
525       } else {
526         jjtree.popNode();
527       }
528       if (jjte000 instanceof RuntimeException) {
529         {if (true) throw (RuntimeException)jjte000;}
530       }
531       if (jjte000 instanceof ParseException) {
532         {if (true) throw (ParseException)jjte000;}
533       }
534       {if (true) throw (Error)jjte000;}
535     } finally {
536       if (jjtc000) {
537         jjtree.closeNodeScope(jjtn000, true);
538       }
539     }
540   }
541 
542   final public void edgeop() throws ParseException {
543  /*@bgen(jjtree) edgeop */
544   ASTedgeop jjtn000 = new ASTedgeop(JJTEDGEOP);
545   boolean jjtc000 = true;
546   jjtree.openNodeScope(jjtn000);Token type = null;
547     try {
548       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
549       case EDGE_UNDIRECTED:
550         type = jj_consume_token(EDGE_UNDIRECTED);
551         break;
552       case EDGE_DIRECTED:
553         type = jj_consume_token(EDGE_DIRECTED);
554         break;
555       default:
556         jj_la1[14] = jj_gen;
557         jj_consume_token(-1);
558         throw new ParseException();
559       }
560       jjtree.closeNodeScope(jjtn000, true);
561       jjtc000 = false;
562         jjtn000.setDirected("->".equals(type.image));
563     } finally {
564       if (jjtc000) {
565         jjtree.closeNodeScope(jjtn000, true);
566       }
567     }
568   }
569 
570   final public void attr_list() throws ParseException {
571  /*@bgen(jjtree) attr_list */
572   ASTattr_list jjtn000 = new ASTattr_list(JJTATTR_LIST);
573   boolean jjtc000 = true;
574   jjtree.openNodeScope(jjtn000);
575     try {
576       jj_consume_token(LBRACKET);
577       a_list();
578       jj_consume_token(RBRACKET);
579     } catch (Throwable jjte000) {
580       if (jjtc000) {
581         jjtree.clearNodeScope(jjtn000);
582         jjtc000 = false;
583       } else {
584         jjtree.popNode();
585       }
586       if (jjte000 instanceof RuntimeException) {
587         {if (true) throw (RuntimeException)jjte000;}
588       }
589       if (jjte000 instanceof ParseException) {
590         {if (true) throw (ParseException)jjte000;}
591       }
592       {if (true) throw (Error)jjte000;}
593     } finally {
594       if (jjtc000) {
595         jjtree.closeNodeScope(jjtn000, true);
596       }
597     }
598   }
599 
600   final public void a_list() throws ParseException {
601  /*@bgen(jjtree) a_list */
602   ASTa_list jjtn000 = new ASTa_list(JJTA_LIST);
603   boolean jjtc000 = true;
604   jjtree.openNodeScope(jjtn000);Token key = null;
605   Token value = null;
606     try {
607       key = jj_consume_token(ID);
608       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
609       case EQ:
610         jj_consume_token(EQ);
611         value = jj_consume_token(ID);
612         break;
613       default:
614         jj_la1[15] = jj_gen;
615         ;
616       }
617       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
618       case COMMA:
619         jj_consume_token(COMMA);
620         break;
621       default:
622         jj_la1[16] = jj_gen;
623         ;
624       }
625       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
626       case ID:
627         a_list();
628         break;
629       default:
630         jj_la1[17] = jj_gen;
631         ;
632       }
633       jjtree.closeNodeScope(jjtn000, true);
634       jjtc000 = false;
635         jjtn000.setKey(DOTParser.stripQuotes(key.image));
636         jjtn000.setValue(value==null?null:DOTParser.stripQuotes(value.image));
637     } catch (Throwable jjte000) {
638       if (jjtc000) {
639         jjtree.clearNodeScope(jjtn000);
640         jjtc000 = false;
641       } else {
642         jjtree.popNode();
643       }
644       if (jjte000 instanceof RuntimeException) {
645         {if (true) throw (RuntimeException)jjte000;}
646       }
647       if (jjte000 instanceof ParseException) {
648         {if (true) throw (ParseException)jjte000;}
649       }
650       {if (true) throw (Error)jjte000;}
651     } finally {
652       if (jjtc000) {
653         jjtree.closeNodeScope(jjtn000, true);
654       }
655     }
656   }
657 
658   final private boolean jj_2_1(int xla) {
659     jj_la = xla; jj_lastpos = jj_scanpos = token;
660     try { return !jj_3_1(); }
661     catch(LookaheadSuccess ls) { return true; }
662     finally { jj_save(0, xla); }
663   }
664 
665   final private boolean jj_2_2(int xla) {
666     jj_la = xla; jj_lastpos = jj_scanpos = token;
667     try { return !jj_3_2(); }
668     catch(LookaheadSuccess ls) { return true; }
669     finally { jj_save(1, xla); }
670   }
671 
672   final private boolean jj_2_3(int xla) {
673     jj_la = xla; jj_lastpos = jj_scanpos = token;
674     try { return !jj_3_3(); }
675     catch(LookaheadSuccess ls) { return true; }
676     finally { jj_save(2, xla); }
677   }
678 
679   final private boolean jj_2_4(int xla) {
680     jj_la = xla; jj_lastpos = jj_scanpos = token;
681     try { return !jj_3_4(); }
682     catch(LookaheadSuccess ls) { return true; }
683     finally { jj_save(3, xla); }
684   }
685 
686   final private boolean jj_2_5(int xla) {
687     jj_la = xla; jj_lastpos = jj_scanpos = token;
688     try { return !jj_3_5(); }
689     catch(LookaheadSuccess ls) { return true; }
690     finally { jj_save(4, xla); }
691   }
692 
693   final private boolean jj_2_6(int xla) {
694     jj_la = xla; jj_lastpos = jj_scanpos = token;
695     try { return !jj_3_6(); }
696     catch(LookaheadSuccess ls) { return true; }
697     finally { jj_save(5, xla); }
698   }
699 
700   final private boolean jj_2_7(int xla) {
701     jj_la = xla; jj_lastpos = jj_scanpos = token;
702     try { return !jj_3_7(); }
703     catch(LookaheadSuccess ls) { return true; }
704     finally { jj_save(6, xla); }
705   }
706 
707   final private boolean jj_2_8(int xla) {
708     jj_la = xla; jj_lastpos = jj_scanpos = token;
709     try { return !jj_3_8(); }
710     catch(LookaheadSuccess ls) { return true; }
711     finally { jj_save(7, xla); }
712   }
713 
714   final private boolean jj_3_6() {
715     if (jj_scan_token(COLON)) return true;
716     if (jj_3R_6()) return true;
717     return false;
718   }
719 
720   final private boolean jj_3R_26() {
721     Token xsp;
722     xsp = jj_scanpos;
723     if (jj_3_6()) {
724     jj_scanpos = xsp;
725     if (jj_3_7()) return true;
726     }
727     return false;
728   }
729 
730   final private boolean jj_3R_23() {
731     if (jj_3R_26()) return true;
732     return false;
733   }
734 
735   final private boolean jj_3R_16() {
736     if (jj_3R_14()) return true;
737     return false;
738   }
739 
740   final private boolean jj_3R_15() {
741     if (jj_scan_token(ID)) return true;
742     Token xsp;
743     xsp = jj_scanpos;
744     if (jj_3R_23()) jj_scanpos = xsp;
745     return false;
746   }
747 
748   final private boolean jj_3_2() {
749     if (jj_3R_2()) return true;
750     return false;
751   }
752 
753   final private boolean jj_3R_5() {
754     if (jj_3R_15()) return true;
755     Token xsp;
756     xsp = jj_scanpos;
757     if (jj_3R_16()) jj_scanpos = xsp;
758     return false;
759   }
760 
761   final private boolean jj_3R_27() {
762     if (jj_scan_token(EQ)) return true;
763     if (jj_scan_token(ID)) return true;
764     return false;
765   }
766 
767   final private boolean jj_3R_22() {
768     if (jj_3R_11()) return true;
769     return false;
770   }
771 
772   final private boolean jj_3_5() {
773     if (jj_3R_5()) return true;
774     return false;
775   }
776 
777   final private boolean jj_3R_4() {
778     Token xsp;
779     xsp = jj_scanpos;
780     if (jj_scan_token(13)) {
781     jj_scanpos = xsp;
782     if (jj_scan_token(14)) {
783     jj_scanpos = xsp;
784     if (jj_scan_token(12)) return true;
785     }
786     }
787     if (jj_3R_14()) return true;
788     return false;
789   }
790 
791   final private boolean jj_3R_25() {
792     if (jj_scan_token(ID)) return true;
793     Token xsp;
794     xsp = jj_scanpos;
795     if (jj_3R_27()) jj_scanpos = xsp;
796     xsp = jj_scanpos;
797     if (jj_scan_token(24)) jj_scanpos = xsp;
798     xsp = jj_scanpos;
799     if (jj_3R_28()) jj_scanpos = xsp;
800     return false;
801   }
802 
803   final private boolean jj_3R_18() {
804     if (jj_3R_8()) return true;
805     return false;
806   }
807 
808   final private boolean jj_3R_21() {
809     if (jj_3R_2()) return true;
810     return false;
811   }
812 
813   final private boolean jj_3_1() {
814     if (jj_3R_1()) return true;
815     return false;
816   }
817 
818   final private boolean jj_3R_3() {
819     if (jj_scan_token(ID)) return true;
820     if (jj_scan_token(EQ)) return true;
821     if (jj_scan_token(ID)) return true;
822     return false;
823   }
824 
825   final private boolean jj_3R_12() {
826     if (jj_3R_14()) return true;
827     return false;
828   }
829 
830   final private boolean jj_3R_14() {
831     if (jj_scan_token(LBRACKET)) return true;
832     if (jj_3R_25()) return true;
833     if (jj_scan_token(RBRACKET)) return true;
834     return false;
835   }
836 
837   final private boolean jj_3R_20() {
838     if (jj_3R_15()) return true;
839     return false;
840   }
841 
842   final private boolean jj_3R_24() {
843     if (jj_3R_1()) return true;
844     return false;
845   }
846 
847   final private boolean jj_3R_7() {
848     if (jj_scan_token(SUBGRAPH)) return true;
849     Token xsp;
850     xsp = jj_scanpos;
851     if (jj_scan_token(28)) jj_scanpos = xsp;
852     return false;
853   }
854 
855   final private boolean jj_3R_19() {
856     Token xsp;
857     xsp = jj_scanpos;
858     if (jj_scan_token(20)) {
859     jj_scanpos = xsp;
860     if (jj_scan_token(21)) return true;
861     }
862     return false;
863   }
864 
865   final private boolean jj_3R_17() {
866     Token xsp;
867     xsp = jj_scanpos;
868     if (jj_3R_24()) {
869     jj_scanpos = xsp;
870     if (jj_3_2()) {
871     jj_scanpos = xsp;
872     if (jj_3_3()) {
873     jj_scanpos = xsp;
874     if (jj_3_4()) {
875     jj_scanpos = xsp;
876     if (jj_3_5()) return true;
877     }
878     }
879     }
880     }
881     return false;
882   }
883 
884   final private boolean jj_3_4() {
885     if (jj_3R_4()) return true;
886     return false;
887   }
888 
889   final private boolean jj_3R_8() {
890     if (jj_3R_17()) return true;
891     Token xsp;
892     xsp = jj_scanpos;
893     if (jj_scan_token(25)) jj_scanpos = xsp;
894     xsp = jj_scanpos;
895     if (jj_3R_18()) jj_scanpos = xsp;
896     return false;
897   }
898 
899   final private boolean jj_3_7() {
900     if (jj_scan_token(COLON)) return true;
901     if (jj_scan_token(ID)) return true;
902     return false;
903   }
904 
905   final private boolean jj_3R_11() {
906     if (jj_3R_19()) return true;
907     Token xsp;
908     xsp = jj_scanpos;
909     if (jj_3R_20()) {
910     jj_scanpos = xsp;
911     if (jj_3R_21()) return true;
912     }
913     xsp = jj_scanpos;
914     if (jj_3R_22()) jj_scanpos = xsp;
915     return false;
916   }
917 
918   final private boolean jj_3R_10() {
919     if (jj_3R_2()) return true;
920     return false;
921   }
922 
923   final private boolean jj_3_8() {
924     Token xsp;
925     xsp = jj_scanpos;
926     if (jj_3R_7()) jj_scanpos = xsp;
927     if (jj_scan_token(LBRACE)) return true;
928     if (jj_3R_8()) return true;
929     if (jj_scan_token(RBRACE)) return true;
930     return false;
931   }
932 
933   final private boolean jj_3R_2() {
934     Token xsp;
935     xsp = jj_scanpos;
936     if (jj_3_8()) {
937     jj_scanpos = xsp;
938     if (jj_3R_13()) return true;
939     }
940     return false;
941   }
942 
943   final private boolean jj_3R_9() {
944     if (jj_3R_15()) return true;
945     return false;
946   }
947 
948   final private boolean jj_3R_1() {
949     Token xsp;
950     xsp = jj_scanpos;
951     if (jj_3R_9()) {
952     jj_scanpos = xsp;
953     if (jj_3R_10()) return true;
954     }
955     if (jj_3R_11()) return true;
956     xsp = jj_scanpos;
957     if (jj_3R_12()) jj_scanpos = xsp;
958     return false;
959   }
960 
961   final private boolean jj_3_3() {
962     if (jj_3R_3()) return true;
963     return false;
964   }
965 
966   final private boolean jj_3R_6() {
967     if (jj_scan_token(ORIENTATION)) return true;
968     return false;
969   }
970 
971   final private boolean jj_3R_28() {
972     if (jj_3R_25()) return true;
973     return false;
974   }
975 
976   final private boolean jj_3R_13() {
977     if (jj_scan_token(SUBGRAPH)) return true;
978     if (jj_scan_token(ID)) return true;
979     return false;
980   }
981 
982   public DOTParserTokenManager token_source;
983   SimpleCharStream jj_input_stream;
984   public Token token, jj_nt;
985   private int jj_ntk;
986   private Token jj_scanpos, jj_lastpos;
987   private int jj_la;
988   public boolean lookingAhead = false;
989   private boolean jj_semLA;
990   private int jj_gen;
991   final private int[] jj_la1 = new int[18];
992   static private int[] jj_la1_0;
993   static private int[] jj_la1_1;
994   static {
995       jj_la1_0();
996       jj_la1_1();
997    }
998    private static void jj_la1_0() {
999       jj_la1_0 = new int[] {0x8000,0x2800,0x2000000,0x10057000,0x7000,0x400000,0x4000000,0x10050000,0x400000,0x10000000,0x10000,0x10000,0x10050000,0x300000,0x300000,0x20000,0x1000000,0x10000000,};
1000    }
1001    private static void jj_la1_1() {
1002       jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
1003    }
1004   final private JJCalls[] jj_2_rtns = new JJCalls[8];
1005   private boolean jj_rescan = false;
1006   private int jj_gc = 0;
1007 
1008   public DOTParser(java.io.InputStream stream) {
1009     jj_input_stream = new SimpleCharStream(stream, 1, 1);
1010     token_source = new DOTParserTokenManager(jj_input_stream);
1011     token = new Token();
1012     jj_ntk = -1;
1013     jj_gen = 0;
1014     for (int i = 0; i < 18; i++) jj_la1[i] = -1;
1015     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
1016   }
1017 
1018   public void ReInit(java.io.InputStream stream) {
1019     jj_input_stream.ReInit(stream, 1, 1);
1020     token_source.ReInit(jj_input_stream);
1021     token = new Token();
1022     jj_ntk = -1;
1023     jjtree.reset();
1024     jj_gen = 0;
1025     for (int i = 0; i < 18; i++) jj_la1[i] = -1;
1026     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
1027   }
1028 
1029   public DOTParser(java.io.Reader stream) {
1030     jj_input_stream = new SimpleCharStream(stream, 1, 1);
1031     token_source = new DOTParserTokenManager(jj_input_stream);
1032     token = new Token();
1033     jj_ntk = -1;
1034     jj_gen = 0;
1035     for (int i = 0; i < 18; i++) jj_la1[i] = -1;
1036     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
1037   }
1038 
1039   public void ReInit(java.io.Reader stream) {
1040     jj_input_stream.ReInit(stream, 1, 1);
1041     token_source.ReInit(jj_input_stream);
1042     token = new Token();
1043     jj_ntk = -1;
1044     jjtree.reset();
1045     jj_gen = 0;
1046     for (int i = 0; i < 18; i++) jj_la1[i] = -1;
1047     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
1048   }
1049 
1050   public DOTParser(DOTParserTokenManager tm) {
1051     token_source = tm;
1052     token = new Token();
1053     jj_ntk = -1;
1054     jj_gen = 0;
1055     for (int i = 0; i < 18; i++) jj_la1[i] = -1;
1056     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
1057   }
1058 
1059   public void ReInit(DOTParserTokenManager tm) {
1060     token_source = tm;
1061     token = new Token();
1062     jj_ntk = -1;
1063     jjtree.reset();
1064     jj_gen = 0;
1065     for (int i = 0; i < 18; i++) jj_la1[i] = -1;
1066     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
1067   }
1068 
1069   final private Token jj_consume_token(int kind) throws ParseException {
1070     Token oldToken;
1071     if ((oldToken = token).next != null) token = token.next;
1072     else token = token.next = token_source.getNextToken();
1073     jj_ntk = -1;
1074     if (token.kind == kind) {
1075       jj_gen++;
1076       if (++jj_gc > 100) {
1077         jj_gc = 0;
1078         for (int i = 0; i < jj_2_rtns.length; i++) {
1079           JJCalls c = jj_2_rtns[i];
1080           while (c != null) {
1081             if (c.gen < jj_gen) c.first = null;
1082             c = c.next;
1083           }
1084         }
1085       }
1086       return token;
1087     }
1088     token = oldToken;
1089     jj_kind = kind;
1090     throw generateParseException();
1091   }
1092 
1093   static private final class LookaheadSuccess extends java.lang.Error { }
1094   final private LookaheadSuccess jj_ls = new LookaheadSuccess();
1095   final private boolean jj_scan_token(int kind) {
1096     if (jj_scanpos == jj_lastpos) {
1097       jj_la--;
1098       if (jj_scanpos.next == null) {
1099         jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
1100       } else {
1101         jj_lastpos = jj_scanpos = jj_scanpos.next;
1102       }
1103     } else {
1104       jj_scanpos = jj_scanpos.next;
1105     }
1106     if (jj_rescan) {
1107       int i = 0; Token tok = token;
1108       while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
1109       if (tok != null) jj_add_error_token(kind, i);
1110     }
1111     if (jj_scanpos.kind != kind) return true;
1112     if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls;
1113     return false;
1114   }
1115 
1116   final public Token getNextToken() {
1117     if (token.next != null) token = token.next;
1118     else token = token.next = token_source.getNextToken();
1119     jj_ntk = -1;
1120     jj_gen++;
1121     return token;
1122   }
1123 
1124   final public Token getToken(int index) {
1125     Token t = lookingAhead ? jj_scanpos : token;
1126     for (int i = 0; i < index; i++) {
1127       if (t.next != null) t = t.next;
1128       else t = t.next = token_source.getNextToken();
1129     }
1130     return t;
1131   }
1132 
1133   final private int jj_ntk() {
1134     if ((jj_nt=token.next) == null)
1135       return (jj_ntk = (token.next=token_source.getNextToken()).kind);
1136     else
1137       return (jj_ntk = jj_nt.kind);
1138   }
1139 
1140   private java.util.Vector jj_expentries = new java.util.Vector();
1141   private int[] jj_expentry;
1142   private int jj_kind = -1;
1143   private int[] jj_lasttokens = new int[100];
1144   private int jj_endpos;
1145 
1146   private void jj_add_error_token(int kind, int pos) {
1147     if (pos >= 100) return;
1148     if (pos == jj_endpos + 1) {
1149       jj_lasttokens[jj_endpos++] = kind;
1150     } else if (jj_endpos != 0) {
1151       jj_expentry = new int[jj_endpos];
1152       for (int i = 0; i < jj_endpos; i++) {
1153         jj_expentry[i] = jj_lasttokens[i];
1154       }
1155       boolean exists = false;
1156       for (java.util.Enumeration e = jj_expentries.elements(); e.hasMoreElements();) {
1157         int[] oldentry = (int[])(e.nextElement());
1158         if (oldentry.length == jj_expentry.length) {
1159           exists = true;
1160           for (int i = 0; i < jj_expentry.length; i++) {
1161             if (oldentry[i] != jj_expentry[i]) {
1162               exists = false;
1163               break;
1164             }
1165           }
1166           if (exists) break;
1167         }
1168       }
1169       if (!exists) jj_expentries.addElement(jj_expentry);
1170       if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
1171     }
1172   }
1173 
1174   public ParseException generateParseException() {
1175     jj_expentries.removeAllElements();
1176     boolean[] la1tokens = new boolean[42];
1177     for (int i = 0; i < 42; i++) {
1178       la1tokens[i] = false;
1179     }
1180     if (jj_kind >= 0) {
1181       la1tokens[jj_kind] = true;
1182       jj_kind = -1;
1183     }
1184     for (int i = 0; i < 18; i++) {
1185       if (jj_la1[i] == jj_gen) {
1186         for (int j = 0; j < 32; j++) {
1187           if ((jj_la1_0[i] & (1<<j)) != 0) {
1188             la1tokens[j] = true;
1189           }
1190           if ((jj_la1_1[i] & (1<<j)) != 0) {
1191             la1tokens[32+j] = true;
1192           }
1193         }
1194       }
1195     }
1196     for (int i = 0; i < 42; i++) {
1197       if (la1tokens[i]) {
1198         jj_expentry = new int[1];
1199         jj_expentry[0] = i;
1200         jj_expentries.addElement(jj_expentry);
1201       }
1202     }
1203     jj_endpos = 0;
1204     jj_rescan_token();
1205     jj_add_error_token(0, 0);
1206     int[][] exptokseq = new int[jj_expentries.size()][];
1207     for (int i = 0; i < jj_expentries.size(); i++) {
1208       exptokseq[i] = (int[])jj_expentries.elementAt(i);
1209     }
1210     return new ParseException(token, exptokseq, tokenImage);
1211   }
1212 
1213   final public void enable_tracing() {
1214   }
1215 
1216   final public void disable_tracing() {
1217   }
1218 
1219   final private void jj_rescan_token() {
1220     jj_rescan = true;
1221     for (int i = 0; i < 8; i++) {
1222       JJCalls p = jj_2_rtns[i];
1223       do {
1224         if (p.gen > jj_gen) {
1225           jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
1226           switch (i) {
1227             case 0: jj_3_1(); break;
1228             case 1: jj_3_2(); break;
1229             case 2: jj_3_3(); break;
1230             case 3: jj_3_4(); break;
1231             case 4: jj_3_5(); break;
1232             case 5: jj_3_6(); break;
1233             case 6: jj_3_7(); break;
1234             case 7: jj_3_8(); break;
1235           }
1236         }
1237         p = p.next;
1238       } while (p != null);
1239     }
1240     jj_rescan = false;
1241   }
1242 
1243   final private void jj_save(int index, int xla) {
1244     JJCalls p = jj_2_rtns[index];
1245     while (p.gen > jj_gen) {
1246       if (p.next == null) { p = p.next = new JJCalls(); break; }
1247       p = p.next;
1248     }
1249     p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
1250   }
1251 
1252   static final class JJCalls {
1253     int gen;
1254     Token first;
1255     int arg;
1256     JJCalls next;
1257   }
1258 
1259 }