Restricted version of imported ANTLR packages, compile with 3.5.2
[simantics/platform.git] / bundles / org.simantics.graph.compiler / src / org / simantics / graph / compiler / internal / parsing / GraphParser.java
1 // $ANTLR 3.5.2 src/org/simantics/graph/compiler/internal/parsing/Graph.g 2018-06-15 14:02:54
2  package org.simantics.graph.compiler.internal.parsing; 
3
4 import org.antlr.runtime.*;
5 import java.util.Stack;
6 import java.util.List;
7 import java.util.ArrayList;
8 import java.util.Map;
9 import java.util.HashMap;
10
11 import org.antlr.runtime.tree.*;
12
13
14 @SuppressWarnings("all")
15 public class GraphParser extends Parser {
16         public static final String[] tokenNames = new String[] {
17                 "<invalid>", "<EOR>", "<DOWN>", "<UP>", "ARRAY", "ARRAY_TYPE", "ASSIGNMENT", 
18                 "BLANK", "COMMENT", "DEDENT", "DOMAIN_OF", "EMBEDDED_TYPE", "EMBEDDED_VALUE", 
19                 "EQUALS", "ESC_SEQ", "EXPONENT", "FALSE", "FILE", "FLOAT", "HAS_DOMAIN", 
20                 "HAS_RANGE", "HEX_DIGIT", "ID", "INDENT", "INHERITS", "INSTANCE_OF", "INT", 
21                 "INT_RANGE", "LBRACKET", "LCURLY", "LPAREN", "MAP", "NEWLINE", "NO_VALUE", 
22                 "PROPERTY", "RANGE", "RBRACKET", "RCURLY", "RECORD", "RECORD_TYPE", "REF", 
23                 "REQUIRES_VALUE_TYPE", "RESOURCE", "RPAREN", "STRING", "SUBRELATION_OF", 
24                 "TAGGED_VALUE", "TEMPLATE_DEFINITION", "TEMPLATE_INSTANCE", "TRUE", "TUPLE", 
25                 "TUPLE_TYPE", "TYPE_ANNOTATION", "TYPE_COMPONENT", "TYPE_DEFINITION", 
26                 "TYPE_DEFINITIONS", "TYPE_REFERENCE", "UNICODE_ESC", "UNION_TYPE", "URI", 
27                 "VALUE_DEFINITION", "VALUE_DEFINITIONS", "VARIABLE", "VARIANT", "WS", 
28                 "'$'", "'%'", "','", "'-->'", "'.'", "':'", "'<--'", "'<R'", "'<T'", "'='", 
29                 "'==>'", "'>--'", "'@'", "'false'", "'true'", "'|'"
30         };
31         public static final int EOF=-1;
32         public static final int T__65=65;
33         public static final int T__66=66;
34         public static final int T__67=67;
35         public static final int T__68=68;
36         public static final int T__69=69;
37         public static final int T__70=70;
38         public static final int T__71=71;
39         public static final int T__72=72;
40         public static final int T__73=73;
41         public static final int T__74=74;
42         public static final int T__75=75;
43         public static final int T__76=76;
44         public static final int T__77=77;
45         public static final int T__78=78;
46         public static final int T__79=79;
47         public static final int T__80=80;
48         public static final int ARRAY=4;
49         public static final int ARRAY_TYPE=5;
50         public static final int ASSIGNMENT=6;
51         public static final int BLANK=7;
52         public static final int COMMENT=8;
53         public static final int DEDENT=9;
54         public static final int DOMAIN_OF=10;
55         public static final int EMBEDDED_TYPE=11;
56         public static final int EMBEDDED_VALUE=12;
57         public static final int EQUALS=13;
58         public static final int ESC_SEQ=14;
59         public static final int EXPONENT=15;
60         public static final int FALSE=16;
61         public static final int FILE=17;
62         public static final int FLOAT=18;
63         public static final int HAS_DOMAIN=19;
64         public static final int HAS_RANGE=20;
65         public static final int HEX_DIGIT=21;
66         public static final int ID=22;
67         public static final int INDENT=23;
68         public static final int INHERITS=24;
69         public static final int INSTANCE_OF=25;
70         public static final int INT=26;
71         public static final int INT_RANGE=27;
72         public static final int LBRACKET=28;
73         public static final int LCURLY=29;
74         public static final int LPAREN=30;
75         public static final int MAP=31;
76         public static final int NEWLINE=32;
77         public static final int NO_VALUE=33;
78         public static final int PROPERTY=34;
79         public static final int RANGE=35;
80         public static final int RBRACKET=36;
81         public static final int RCURLY=37;
82         public static final int RECORD=38;
83         public static final int RECORD_TYPE=39;
84         public static final int REF=40;
85         public static final int REQUIRES_VALUE_TYPE=41;
86         public static final int RESOURCE=42;
87         public static final int RPAREN=43;
88         public static final int STRING=44;
89         public static final int SUBRELATION_OF=45;
90         public static final int TAGGED_VALUE=46;
91         public static final int TEMPLATE_DEFINITION=47;
92         public static final int TEMPLATE_INSTANCE=48;
93         public static final int TRUE=49;
94         public static final int TUPLE=50;
95         public static final int TUPLE_TYPE=51;
96         public static final int TYPE_ANNOTATION=52;
97         public static final int TYPE_COMPONENT=53;
98         public static final int TYPE_DEFINITION=54;
99         public static final int TYPE_DEFINITIONS=55;
100         public static final int TYPE_REFERENCE=56;
101         public static final int UNICODE_ESC=57;
102         public static final int UNION_TYPE=58;
103         public static final int URI=59;
104         public static final int VALUE_DEFINITION=60;
105         public static final int VALUE_DEFINITIONS=61;
106         public static final int VARIABLE=62;
107         public static final int VARIANT=63;
108         public static final int WS=64;
109
110         // delegates
111         public Parser[] getDelegates() {
112                 return new Parser[] {};
113         }
114
115         // delegators
116
117
118         public GraphParser(TokenStream input) {
119                 this(input, new RecognizerSharedState());
120         }
121         public GraphParser(TokenStream input, RecognizerSharedState state) {
122                 super(input, state);
123         }
124
125         protected TreeAdaptor adaptor = new CommonTreeAdaptor();
126
127         public void setTreeAdaptor(TreeAdaptor adaptor) {
128                 this.adaptor = adaptor;
129         }
130         public TreeAdaptor getTreeAdaptor() {
131                 return adaptor;
132         }
133         @Override public String[] getTokenNames() { return GraphParser.tokenNames; }
134         @Override public String getGrammarFileName() { return "src/org/simantics/graph/compiler/internal/parsing/Graph.g"; }
135
136
137         public static class file_return extends ParserRuleReturnScope {
138                 CommonTree tree;
139                 @Override
140                 public CommonTree getTree() { return tree; }
141         };
142
143
144         // $ANTLR start "file"
145         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:224:1: file : ( NEWLINE )? ( resourceDefinitions )? EOF -> ^( FILE ( resourceDefinitions )? ) ;
146         public final GraphParser.file_return file() throws RecognitionException {
147                 GraphParser.file_return retval = new GraphParser.file_return();
148                 retval.start = input.LT(1);
149
150                 CommonTree root_0 = null;
151
152                 Token NEWLINE1=null;
153                 Token EOF3=null;
154                 ParserRuleReturnScope resourceDefinitions2 =null;
155
156                 CommonTree NEWLINE1_tree=null;
157                 CommonTree EOF3_tree=null;
158                 RewriteRuleTokenStream stream_NEWLINE=new RewriteRuleTokenStream(adaptor,"token NEWLINE");
159                 RewriteRuleTokenStream stream_EOF=new RewriteRuleTokenStream(adaptor,"token EOF");
160                 RewriteRuleSubtreeStream stream_resourceDefinitions=new RewriteRuleSubtreeStream(adaptor,"rule resourceDefinitions");
161
162                 try {
163                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:224:6: ( ( NEWLINE )? ( resourceDefinitions )? EOF -> ^( FILE ( resourceDefinitions )? ) )
164                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:224:8: ( NEWLINE )? ( resourceDefinitions )? EOF
165                         {
166                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:224:8: ( NEWLINE )?
167                         int alt1=2;
168                         int LA1_0 = input.LA(1);
169                         if ( (LA1_0==NEWLINE) ) {
170                                 alt1=1;
171                         }
172                         switch (alt1) {
173                                 case 1 :
174                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:224:8: NEWLINE
175                                         {
176                                         NEWLINE1=(Token)match(input,NEWLINE,FOLLOW_NEWLINE_in_file1230); if (state.failed) return retval; 
177                                         if ( state.backtracking==0 ) stream_NEWLINE.add(NEWLINE1);
178
179                                         }
180                                         break;
181
182                         }
183
184                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:224:17: ( resourceDefinitions )?
185                         int alt2=2;
186                         int LA2_0 = input.LA(1);
187                         if ( (LA2_0==FLOAT||LA2_0==ID||LA2_0==INT||(LA2_0 >= LBRACKET && LA2_0 <= LPAREN)||LA2_0==STRING||LA2_0==URI||(LA2_0 >= 65 && LA2_0 <= 66)||(LA2_0 >= 77 && LA2_0 <= 79)) ) {
188                                 alt2=1;
189                         }
190                         switch (alt2) {
191                                 case 1 :
192                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:224:17: resourceDefinitions
193                                         {
194                                         pushFollow(FOLLOW_resourceDefinitions_in_file1233);
195                                         resourceDefinitions2=resourceDefinitions();
196                                         state._fsp--;
197                                         if (state.failed) return retval;
198                                         if ( state.backtracking==0 ) stream_resourceDefinitions.add(resourceDefinitions2.getTree());
199                                         }
200                                         break;
201
202                         }
203
204                         EOF3=(Token)match(input,EOF,FOLLOW_EOF_in_file1236); if (state.failed) return retval; 
205                         if ( state.backtracking==0 ) stream_EOF.add(EOF3);
206
207                         // AST REWRITE
208                         // elements: resourceDefinitions
209                         // token labels: 
210                         // rule labels: retval
211                         // token list labels: 
212                         // rule list labels: 
213                         // wildcard labels: 
214                         if ( state.backtracking==0 ) {
215                         retval.tree = root_0;
216                         RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
217
218                         root_0 = (CommonTree)adaptor.nil();
219                         // 224:42: -> ^( FILE ( resourceDefinitions )? )
220                         {
221                                 // src/org/simantics/graph/compiler/internal/parsing/Graph.g:224:45: ^( FILE ( resourceDefinitions )? )
222                                 {
223                                 CommonTree root_1 = (CommonTree)adaptor.nil();
224                                 root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(FILE, "FILE"), root_1);
225                                 // src/org/simantics/graph/compiler/internal/parsing/Graph.g:224:52: ( resourceDefinitions )?
226                                 if ( stream_resourceDefinitions.hasNext() ) {
227                                         adaptor.addChild(root_1, stream_resourceDefinitions.nextTree());
228                                 }
229                                 stream_resourceDefinitions.reset();
230
231                                 adaptor.addChild(root_0, root_1);
232                                 }
233
234                         }
235
236
237                         retval.tree = root_0;
238                         }
239
240                         }
241
242                         retval.stop = input.LT(-1);
243
244                         if ( state.backtracking==0 ) {
245                         retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
246                         adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
247                         }
248                 }
249                 catch (RecognitionException re) {
250                         reportError(re);
251                         recover(input,re);
252                         retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
253                 }
254                 finally {
255                         // do for sure before leaving
256                 }
257                 return retval;
258         }
259         // $ANTLR end "file"
260
261
262         public static class resourceDefinitions_return extends ParserRuleReturnScope {
263                 CommonTree tree;
264                 @Override
265                 public CommonTree getTree() { return tree; }
266         };
267
268
269         // $ANTLR start "resourceDefinitions"
270         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:226:1: resourceDefinitions : resourceDefinition ( NEWLINE ! resourceDefinition )* ;
271         public final GraphParser.resourceDefinitions_return resourceDefinitions() throws RecognitionException {
272                 GraphParser.resourceDefinitions_return retval = new GraphParser.resourceDefinitions_return();
273                 retval.start = input.LT(1);
274
275                 CommonTree root_0 = null;
276
277                 Token NEWLINE5=null;
278                 ParserRuleReturnScope resourceDefinition4 =null;
279                 ParserRuleReturnScope resourceDefinition6 =null;
280
281                 CommonTree NEWLINE5_tree=null;
282
283                 try {
284                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:227:6: ( resourceDefinition ( NEWLINE ! resourceDefinition )* )
285                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:227:8: resourceDefinition ( NEWLINE ! resourceDefinition )*
286                         {
287                         root_0 = (CommonTree)adaptor.nil();
288
289
290                         pushFollow(FOLLOW_resourceDefinition_in_resourceDefinitions1260);
291                         resourceDefinition4=resourceDefinition();
292                         state._fsp--;
293                         if (state.failed) return retval;
294                         if ( state.backtracking==0 ) adaptor.addChild(root_0, resourceDefinition4.getTree());
295
296                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:227:27: ( NEWLINE ! resourceDefinition )*
297                         loop3:
298                         while (true) {
299                                 int alt3=2;
300                                 int LA3_0 = input.LA(1);
301                                 if ( (LA3_0==NEWLINE) ) {
302                                         alt3=1;
303                                 }
304
305                                 switch (alt3) {
306                                 case 1 :
307                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:227:28: NEWLINE ! resourceDefinition
308                                         {
309                                         NEWLINE5=(Token)match(input,NEWLINE,FOLLOW_NEWLINE_in_resourceDefinitions1263); if (state.failed) return retval;
310                                         pushFollow(FOLLOW_resourceDefinition_in_resourceDefinitions1266);
311                                         resourceDefinition6=resourceDefinition();
312                                         state._fsp--;
313                                         if (state.failed) return retval;
314                                         if ( state.backtracking==0 ) adaptor.addChild(root_0, resourceDefinition6.getTree());
315
316                                         }
317                                         break;
318
319                                 default :
320                                         break loop3;
321                                 }
322                         }
323
324                         }
325
326                         retval.stop = input.LT(-1);
327
328                         if ( state.backtracking==0 ) {
329                         retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
330                         adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
331                         }
332                 }
333                 catch (RecognitionException re) {
334                         reportError(re);
335                         recover(input,re);
336                         retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
337                 }
338                 finally {
339                         // do for sure before leaving
340                 }
341                 return retval;
342         }
343         // $ANTLR end "resourceDefinitions"
344
345
346         public static class resourceDefinition_return extends ParserRuleReturnScope {
347                 CommonTree tree;
348                 @Override
349                 public CommonTree getTree() { return tree; }
350         };
351
352
353         // $ANTLR start "resourceDefinition"
354         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:230:1: resourceDefinition : ( resource ( localProperty )* ( INDENT property ( NEWLINE property )* DEDENT )? -> ^( RESOURCE resource ( localProperty )* ( property )* ) | template -> ^( RESOURCE ^( BLANK template ) template ) );
355         public final GraphParser.resourceDefinition_return resourceDefinition() throws RecognitionException {
356                 GraphParser.resourceDefinition_return retval = new GraphParser.resourceDefinition_return();
357                 retval.start = input.LT(1);
358
359                 CommonTree root_0 = null;
360
361                 Token INDENT9=null;
362                 Token NEWLINE11=null;
363                 Token DEDENT13=null;
364                 ParserRuleReturnScope resource7 =null;
365                 ParserRuleReturnScope localProperty8 =null;
366                 ParserRuleReturnScope property10 =null;
367                 ParserRuleReturnScope property12 =null;
368                 ParserRuleReturnScope template14 =null;
369
370                 CommonTree INDENT9_tree=null;
371                 CommonTree NEWLINE11_tree=null;
372                 CommonTree DEDENT13_tree=null;
373                 RewriteRuleTokenStream stream_INDENT=new RewriteRuleTokenStream(adaptor,"token INDENT");
374                 RewriteRuleTokenStream stream_NEWLINE=new RewriteRuleTokenStream(adaptor,"token NEWLINE");
375                 RewriteRuleTokenStream stream_DEDENT=new RewriteRuleTokenStream(adaptor,"token DEDENT");
376                 RewriteRuleSubtreeStream stream_template=new RewriteRuleSubtreeStream(adaptor,"rule template");
377                 RewriteRuleSubtreeStream stream_resource=new RewriteRuleSubtreeStream(adaptor,"rule resource");
378                 RewriteRuleSubtreeStream stream_property=new RewriteRuleSubtreeStream(adaptor,"rule property");
379                 RewriteRuleSubtreeStream stream_localProperty=new RewriteRuleSubtreeStream(adaptor,"rule localProperty");
380
381                 try {
382                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:231:5: ( resource ( localProperty )* ( INDENT property ( NEWLINE property )* DEDENT )? -> ^( RESOURCE resource ( localProperty )* ( property )* ) | template -> ^( RESOURCE ^( BLANK template ) template ) )
383                         int alt7=2;
384                         int LA7_0 = input.LA(1);
385                         if ( (LA7_0==FLOAT||LA7_0==ID||LA7_0==INT||(LA7_0 >= LBRACKET && LA7_0 <= LPAREN)||LA7_0==STRING||LA7_0==URI||(LA7_0 >= 65 && LA7_0 <= 66)||(LA7_0 >= 78 && LA7_0 <= 79)) ) {
386                                 alt7=1;
387                         }
388                         else if ( (LA7_0==77) ) {
389                                 alt7=2;
390                         }
391
392                         else {
393                                 if (state.backtracking>0) {state.failed=true; return retval;}
394                                 NoViableAltException nvae =
395                                         new NoViableAltException("", 7, 0, input);
396                                 throw nvae;
397                         }
398
399                         switch (alt7) {
400                                 case 1 :
401                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:231:7: resource ( localProperty )* ( INDENT property ( NEWLINE property )* DEDENT )?
402                                         {
403                                         pushFollow(FOLLOW_resource_in_resourceDefinition1300);
404                                         resource7=resource();
405                                         state._fsp--;
406                                         if (state.failed) return retval;
407                                         if ( state.backtracking==0 ) stream_resource.add(resource7.getTree());
408                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:232:7: ( localProperty )*
409                                         loop4:
410                                         while (true) {
411                                                 int alt4=2;
412                                                 int LA4_0 = input.LA(1);
413                                                 if ( (LA4_0==ID||LA4_0==URI||LA4_0==66||LA4_0==68||(LA4_0 >= 70 && LA4_0 <= 76)) ) {
414                                                         alt4=1;
415                                                 }
416
417                                                 switch (alt4) {
418                                                 case 1 :
419                                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:232:7: localProperty
420                                                         {
421                                                         pushFollow(FOLLOW_localProperty_in_resourceDefinition1308);
422                                                         localProperty8=localProperty();
423                                                         state._fsp--;
424                                                         if (state.failed) return retval;
425                                                         if ( state.backtracking==0 ) stream_localProperty.add(localProperty8.getTree());
426                                                         }
427                                                         break;
428
429                                                 default :
430                                                         break loop4;
431                                                 }
432                                         }
433
434                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:233:7: ( INDENT property ( NEWLINE property )* DEDENT )?
435                                         int alt6=2;
436                                         int LA6_0 = input.LA(1);
437                                         if ( (LA6_0==INDENT) ) {
438                                                 alt6=1;
439                                         }
440                                         switch (alt6) {
441                                                 case 1 :
442                                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:233:8: INDENT property ( NEWLINE property )* DEDENT
443                                                         {
444                                                         INDENT9=(Token)match(input,INDENT,FOLLOW_INDENT_in_resourceDefinition1318); if (state.failed) return retval; 
445                                                         if ( state.backtracking==0 ) stream_INDENT.add(INDENT9);
446
447                                                         pushFollow(FOLLOW_property_in_resourceDefinition1320);
448                                                         property10=property();
449                                                         state._fsp--;
450                                                         if (state.failed) return retval;
451                                                         if ( state.backtracking==0 ) stream_property.add(property10.getTree());
452                                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:233:24: ( NEWLINE property )*
453                                                         loop5:
454                                                         while (true) {
455                                                                 int alt5=2;
456                                                                 int LA5_0 = input.LA(1);
457                                                                 if ( (LA5_0==NEWLINE) ) {
458                                                                         alt5=1;
459                                                                 }
460
461                                                                 switch (alt5) {
462                                                                 case 1 :
463                                                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:233:25: NEWLINE property
464                                                                         {
465                                                                         NEWLINE11=(Token)match(input,NEWLINE,FOLLOW_NEWLINE_in_resourceDefinition1323); if (state.failed) return retval; 
466                                                                         if ( state.backtracking==0 ) stream_NEWLINE.add(NEWLINE11);
467
468                                                                         pushFollow(FOLLOW_property_in_resourceDefinition1325);
469                                                                         property12=property();
470                                                                         state._fsp--;
471                                                                         if (state.failed) return retval;
472                                                                         if ( state.backtracking==0 ) stream_property.add(property12.getTree());
473                                                                         }
474                                                                         break;
475
476                                                                 default :
477                                                                         break loop5;
478                                                                 }
479                                                         }
480
481                                                         DEDENT13=(Token)match(input,DEDENT,FOLLOW_DEDENT_in_resourceDefinition1329); if (state.failed) return retval; 
482                                                         if ( state.backtracking==0 ) stream_DEDENT.add(DEDENT13);
483
484                                                         }
485                                                         break;
486
487                                         }
488
489                                         // AST REWRITE
490                                         // elements: localProperty, resource, property
491                                         // token labels: 
492                                         // rule labels: retval
493                                         // token list labels: 
494                                         // rule list labels: 
495                                         // wildcard labels: 
496                                         if ( state.backtracking==0 ) {
497                                         retval.tree = root_0;
498                                         RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
499
500                                         root_0 = (CommonTree)adaptor.nil();
501                                         // 234:5: -> ^( RESOURCE resource ( localProperty )* ( property )* )
502                                         {
503                                                 // src/org/simantics/graph/compiler/internal/parsing/Graph.g:234:8: ^( RESOURCE resource ( localProperty )* ( property )* )
504                                                 {
505                                                 CommonTree root_1 = (CommonTree)adaptor.nil();
506                                                 root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(RESOURCE, "RESOURCE"), root_1);
507                                                 adaptor.addChild(root_1, stream_resource.nextTree());
508                                                 // src/org/simantics/graph/compiler/internal/parsing/Graph.g:234:28: ( localProperty )*
509                                                 while ( stream_localProperty.hasNext() ) {
510                                                         adaptor.addChild(root_1, stream_localProperty.nextTree());
511                                                 }
512                                                 stream_localProperty.reset();
513
514                                                 // src/org/simantics/graph/compiler/internal/parsing/Graph.g:234:43: ( property )*
515                                                 while ( stream_property.hasNext() ) {
516                                                         adaptor.addChild(root_1, stream_property.nextTree());
517                                                 }
518                                                 stream_property.reset();
519
520                                                 adaptor.addChild(root_0, root_1);
521                                                 }
522
523                                         }
524
525
526                                         retval.tree = root_0;
527                                         }
528
529                                         }
530                                         break;
531                                 case 2 :
532                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:235:7: template
533                                         {
534                                         pushFollow(FOLLOW_template_in_resourceDefinition1358);
535                                         template14=template();
536                                         state._fsp--;
537                                         if (state.failed) return retval;
538                                         if ( state.backtracking==0 ) stream_template.add(template14.getTree());
539                                         // AST REWRITE
540                                         // elements: template, template
541                                         // token labels: 
542                                         // rule labels: retval
543                                         // token list labels: 
544                                         // rule list labels: 
545                                         // wildcard labels: 
546                                         if ( state.backtracking==0 ) {
547                                         retval.tree = root_0;
548                                         RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
549
550                                         root_0 = (CommonTree)adaptor.nil();
551                                         // 235:16: -> ^( RESOURCE ^( BLANK template ) template )
552                                         {
553                                                 // src/org/simantics/graph/compiler/internal/parsing/Graph.g:235:19: ^( RESOURCE ^( BLANK template ) template )
554                                                 {
555                                                 CommonTree root_1 = (CommonTree)adaptor.nil();
556                                                 root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(RESOURCE, "RESOURCE"), root_1);
557                                                 // src/org/simantics/graph/compiler/internal/parsing/Graph.g:235:30: ^( BLANK template )
558                                                 {
559                                                 CommonTree root_2 = (CommonTree)adaptor.nil();
560                                                 root_2 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(BLANK, "BLANK"), root_2);
561                                                 adaptor.addChild(root_2, stream_template.nextTree());
562                                                 adaptor.addChild(root_1, root_2);
563                                                 }
564
565                                                 adaptor.addChild(root_1, stream_template.nextTree());
566                                                 adaptor.addChild(root_0, root_1);
567                                                 }
568
569                                         }
570
571
572                                         retval.tree = root_0;
573                                         }
574
575                                         }
576                                         break;
577
578                         }
579                         retval.stop = input.LT(-1);
580
581                         if ( state.backtracking==0 ) {
582                         retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
583                         adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
584                         }
585                 }
586                 catch (RecognitionException re) {
587                         reportError(re);
588                         recover(input,re);
589                         retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
590                 }
591                 finally {
592                         // do for sure before leaving
593                 }
594                 return retval;
595         }
596         // $ANTLR end "resourceDefinition"
597
598
599         public static class localProperty_return extends ParserRuleReturnScope {
600                 CommonTree tree;
601                 @Override
602                 public CommonTree getTree() { return tree; }
603         };
604
605
606         // $ANTLR start "localProperty"
607         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:238:1: localProperty : relation resource -> ^( PROPERTY relation ^( RESOURCE resource ) ) ;
608         public final GraphParser.localProperty_return localProperty() throws RecognitionException {
609                 GraphParser.localProperty_return retval = new GraphParser.localProperty_return();
610                 retval.start = input.LT(1);
611
612                 CommonTree root_0 = null;
613
614                 ParserRuleReturnScope relation15 =null;
615                 ParserRuleReturnScope resource16 =null;
616
617                 RewriteRuleSubtreeStream stream_resource=new RewriteRuleSubtreeStream(adaptor,"rule resource");
618                 RewriteRuleSubtreeStream stream_relation=new RewriteRuleSubtreeStream(adaptor,"rule relation");
619
620                 try {
621                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:239:5: ( relation resource -> ^( PROPERTY relation ^( RESOURCE resource ) ) )
622                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:239:7: relation resource
623                         {
624                         pushFollow(FOLLOW_relation_in_localProperty1393);
625                         relation15=relation();
626                         state._fsp--;
627                         if (state.failed) return retval;
628                         if ( state.backtracking==0 ) stream_relation.add(relation15.getTree());
629                         pushFollow(FOLLOW_resource_in_localProperty1395);
630                         resource16=resource();
631                         state._fsp--;
632                         if (state.failed) return retval;
633                         if ( state.backtracking==0 ) stream_resource.add(resource16.getTree());
634                         // AST REWRITE
635                         // elements: relation, resource
636                         // token labels: 
637                         // rule labels: retval
638                         // token list labels: 
639                         // rule list labels: 
640                         // wildcard labels: 
641                         if ( state.backtracking==0 ) {
642                         retval.tree = root_0;
643                         RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
644
645                         root_0 = (CommonTree)adaptor.nil();
646                         // 240:5: -> ^( PROPERTY relation ^( RESOURCE resource ) )
647                         {
648                                 // src/org/simantics/graph/compiler/internal/parsing/Graph.g:240:8: ^( PROPERTY relation ^( RESOURCE resource ) )
649                                 {
650                                 CommonTree root_1 = (CommonTree)adaptor.nil();
651                                 root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(PROPERTY, "PROPERTY"), root_1);
652                                 adaptor.addChild(root_1, stream_relation.nextTree());
653                                 // src/org/simantics/graph/compiler/internal/parsing/Graph.g:240:28: ^( RESOURCE resource )
654                                 {
655                                 CommonTree root_2 = (CommonTree)adaptor.nil();
656                                 root_2 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(RESOURCE, "RESOURCE"), root_2);
657                                 adaptor.addChild(root_2, stream_resource.nextTree());
658                                 adaptor.addChild(root_1, root_2);
659                                 }
660
661                                 adaptor.addChild(root_0, root_1);
662                                 }
663
664                         }
665
666
667                         retval.tree = root_0;
668                         }
669
670                         }
671
672                         retval.stop = input.LT(-1);
673
674                         if ( state.backtracking==0 ) {
675                         retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
676                         adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
677                         }
678                 }
679                 catch (RecognitionException re) {
680                         reportError(re);
681                         recover(input,re);
682                         retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
683                 }
684                 finally {
685                         // do for sure before leaving
686                 }
687                 return retval;
688         }
689         // $ANTLR end "localProperty"
690
691
692         public static class property_return extends ParserRuleReturnScope {
693                 CommonTree tree;
694                 @Override
695                 public CommonTree getTree() { return tree; }
696         };
697
698
699         // $ANTLR start "property"
700         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:243:1: property : ( relation ( resourceDefinition -> ^( PROPERTY relation resourceDefinition ) | INDENT resourceDefinitions DEDENT -> ^( PROPERTY relation resourceDefinitions ) ) | template );
701         public final GraphParser.property_return property() throws RecognitionException {
702                 GraphParser.property_return retval = new GraphParser.property_return();
703                 retval.start = input.LT(1);
704
705                 CommonTree root_0 = null;
706
707                 Token INDENT19=null;
708                 Token DEDENT21=null;
709                 ParserRuleReturnScope relation17 =null;
710                 ParserRuleReturnScope resourceDefinition18 =null;
711                 ParserRuleReturnScope resourceDefinitions20 =null;
712                 ParserRuleReturnScope template22 =null;
713
714                 CommonTree INDENT19_tree=null;
715                 CommonTree DEDENT21_tree=null;
716                 RewriteRuleTokenStream stream_INDENT=new RewriteRuleTokenStream(adaptor,"token INDENT");
717                 RewriteRuleTokenStream stream_DEDENT=new RewriteRuleTokenStream(adaptor,"token DEDENT");
718                 RewriteRuleSubtreeStream stream_resourceDefinition=new RewriteRuleSubtreeStream(adaptor,"rule resourceDefinition");
719                 RewriteRuleSubtreeStream stream_resourceDefinitions=new RewriteRuleSubtreeStream(adaptor,"rule resourceDefinitions");
720                 RewriteRuleSubtreeStream stream_relation=new RewriteRuleSubtreeStream(adaptor,"rule relation");
721
722                 try {
723                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:244:5: ( relation ( resourceDefinition -> ^( PROPERTY relation resourceDefinition ) | INDENT resourceDefinitions DEDENT -> ^( PROPERTY relation resourceDefinitions ) ) | template )
724                         int alt9=2;
725                         int LA9_0 = input.LA(1);
726                         if ( (LA9_0==ID||LA9_0==URI||LA9_0==66||LA9_0==68||(LA9_0 >= 70 && LA9_0 <= 76)) ) {
727                                 alt9=1;
728                         }
729                         else if ( (LA9_0==77) ) {
730                                 alt9=2;
731                         }
732
733                         else {
734                                 if (state.backtracking>0) {state.failed=true; return retval;}
735                                 NoViableAltException nvae =
736                                         new NoViableAltException("", 9, 0, input);
737                                 throw nvae;
738                         }
739
740                         switch (alt9) {
741                                 case 1 :
742                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:244:7: relation ( resourceDefinition -> ^( PROPERTY relation resourceDefinition ) | INDENT resourceDefinitions DEDENT -> ^( PROPERTY relation resourceDefinitions ) )
743                                         {
744                                         pushFollow(FOLLOW_relation_in_property1434);
745                                         relation17=relation();
746                                         state._fsp--;
747                                         if (state.failed) return retval;
748                                         if ( state.backtracking==0 ) stream_relation.add(relation17.getTree());
749                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:245:7: ( resourceDefinition -> ^( PROPERTY relation resourceDefinition ) | INDENT resourceDefinitions DEDENT -> ^( PROPERTY relation resourceDefinitions ) )
750                                         int alt8=2;
751                                         int LA8_0 = input.LA(1);
752                                         if ( (LA8_0==FLOAT||LA8_0==ID||LA8_0==INT||(LA8_0 >= LBRACKET && LA8_0 <= LPAREN)||LA8_0==STRING||LA8_0==URI||(LA8_0 >= 65 && LA8_0 <= 66)||(LA8_0 >= 77 && LA8_0 <= 79)) ) {
753                                                 alt8=1;
754                                         }
755                                         else if ( (LA8_0==INDENT) ) {
756                                                 alt8=2;
757                                         }
758
759                                         else {
760                                                 if (state.backtracking>0) {state.failed=true; return retval;}
761                                                 NoViableAltException nvae =
762                                                         new NoViableAltException("", 8, 0, input);
763                                                 throw nvae;
764                                         }
765
766                                         switch (alt8) {
767                                                 case 1 :
768                                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:245:9: resourceDefinition
769                                                         {
770                                                         pushFollow(FOLLOW_resourceDefinition_in_property1444);
771                                                         resourceDefinition18=resourceDefinition();
772                                                         state._fsp--;
773                                                         if (state.failed) return retval;
774                                                         if ( state.backtracking==0 ) stream_resourceDefinition.add(resourceDefinition18.getTree());
775                                                         // AST REWRITE
776                                                         // elements: relation, resourceDefinition
777                                                         // token labels: 
778                                                         // rule labels: retval
779                                                         // token list labels: 
780                                                         // rule list labels: 
781                                                         // wildcard labels: 
782                                                         if ( state.backtracking==0 ) {
783                                                         retval.tree = root_0;
784                                                         RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
785
786                                                         root_0 = (CommonTree)adaptor.nil();
787                                                         // 245:28: -> ^( PROPERTY relation resourceDefinition )
788                                                         {
789                                                                 // src/org/simantics/graph/compiler/internal/parsing/Graph.g:245:31: ^( PROPERTY relation resourceDefinition )
790                                                                 {
791                                                                 CommonTree root_1 = (CommonTree)adaptor.nil();
792                                                                 root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(PROPERTY, "PROPERTY"), root_1);
793                                                                 adaptor.addChild(root_1, stream_relation.nextTree());
794                                                                 adaptor.addChild(root_1, stream_resourceDefinition.nextTree());
795                                                                 adaptor.addChild(root_0, root_1);
796                                                                 }
797
798                                                         }
799
800
801                                                         retval.tree = root_0;
802                                                         }
803
804                                                         }
805                                                         break;
806                                                 case 2 :
807                                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:246:9: INDENT resourceDefinitions DEDENT
808                                                         {
809                                                         INDENT19=(Token)match(input,INDENT,FOLLOW_INDENT_in_property1464); if (state.failed) return retval; 
810                                                         if ( state.backtracking==0 ) stream_INDENT.add(INDENT19);
811
812                                                         pushFollow(FOLLOW_resourceDefinitions_in_property1466);
813                                                         resourceDefinitions20=resourceDefinitions();
814                                                         state._fsp--;
815                                                         if (state.failed) return retval;
816                                                         if ( state.backtracking==0 ) stream_resourceDefinitions.add(resourceDefinitions20.getTree());
817                                                         DEDENT21=(Token)match(input,DEDENT,FOLLOW_DEDENT_in_property1468); if (state.failed) return retval; 
818                                                         if ( state.backtracking==0 ) stream_DEDENT.add(DEDENT21);
819
820                                                         // AST REWRITE
821                                                         // elements: relation, resourceDefinitions
822                                                         // token labels: 
823                                                         // rule labels: retval
824                                                         // token list labels: 
825                                                         // rule list labels: 
826                                                         // wildcard labels: 
827                                                         if ( state.backtracking==0 ) {
828                                                         retval.tree = root_0;
829                                                         RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
830
831                                                         root_0 = (CommonTree)adaptor.nil();
832                                                         // 246:43: -> ^( PROPERTY relation resourceDefinitions )
833                                                         {
834                                                                 // src/org/simantics/graph/compiler/internal/parsing/Graph.g:246:46: ^( PROPERTY relation resourceDefinitions )
835                                                                 {
836                                                                 CommonTree root_1 = (CommonTree)adaptor.nil();
837                                                                 root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(PROPERTY, "PROPERTY"), root_1);
838                                                                 adaptor.addChild(root_1, stream_relation.nextTree());
839                                                                 adaptor.addChild(root_1, stream_resourceDefinitions.nextTree());
840                                                                 adaptor.addChild(root_0, root_1);
841                                                                 }
842
843                                                         }
844
845
846                                                         retval.tree = root_0;
847                                                         }
848
849                                                         }
850                                                         break;
851
852                                         }
853
854                                         }
855                                         break;
856                                 case 2 :
857                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:248:7: template
858                                         {
859                                         root_0 = (CommonTree)adaptor.nil();
860
861
862                                         pushFollow(FOLLOW_template_in_property1494);
863                                         template22=template();
864                                         state._fsp--;
865                                         if (state.failed) return retval;
866                                         if ( state.backtracking==0 ) adaptor.addChild(root_0, template22.getTree());
867
868                                         }
869                                         break;
870
871                         }
872                         retval.stop = input.LT(-1);
873
874                         if ( state.backtracking==0 ) {
875                         retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
876                         adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
877                         }
878                 }
879                 catch (RecognitionException re) {
880                         reportError(re);
881                         recover(input,re);
882                         retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
883                 }
884                 finally {
885                         // do for sure before leaving
886                 }
887                 return retval;
888         }
889         // $ANTLR end "property"
890
891
892         public static class template_return extends ParserRuleReturnScope {
893                 CommonTree tree;
894                 @Override
895                 public CommonTree getTree() { return tree; }
896         };
897
898
899         // $ANTLR start "template"
900         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:251:1: template : '@' ({...}? => ID ( resource )+ INDENT resourceDefinitions DEDENT -> ^( TEMPLATE_DEFINITION ( resource )+ resourceDefinitions ) | ( resource )+ ( INDENT resourceDefinitions DEDENT )? -> ^( TEMPLATE_INSTANCE ( resource )+ ( resourceDefinitions )? ) ) ;
901         public final GraphParser.template_return template() throws RecognitionException {
902                 GraphParser.template_return retval = new GraphParser.template_return();
903                 retval.start = input.LT(1);
904
905                 CommonTree root_0 = null;
906
907                 Token char_literal23=null;
908                 Token ID24=null;
909                 Token INDENT26=null;
910                 Token DEDENT28=null;
911                 Token INDENT30=null;
912                 Token DEDENT32=null;
913                 ParserRuleReturnScope resource25 =null;
914                 ParserRuleReturnScope resourceDefinitions27 =null;
915                 ParserRuleReturnScope resource29 =null;
916                 ParserRuleReturnScope resourceDefinitions31 =null;
917
918                 CommonTree char_literal23_tree=null;
919                 CommonTree ID24_tree=null;
920                 CommonTree INDENT26_tree=null;
921                 CommonTree DEDENT28_tree=null;
922                 CommonTree INDENT30_tree=null;
923                 CommonTree DEDENT32_tree=null;
924                 RewriteRuleTokenStream stream_INDENT=new RewriteRuleTokenStream(adaptor,"token INDENT");
925                 RewriteRuleTokenStream stream_77=new RewriteRuleTokenStream(adaptor,"token 77");
926                 RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID");
927                 RewriteRuleTokenStream stream_DEDENT=new RewriteRuleTokenStream(adaptor,"token DEDENT");
928                 RewriteRuleSubtreeStream stream_resource=new RewriteRuleSubtreeStream(adaptor,"rule resource");
929                 RewriteRuleSubtreeStream stream_resourceDefinitions=new RewriteRuleSubtreeStream(adaptor,"rule resourceDefinitions");
930
931                 try {
932                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:252:5: ( '@' ({...}? => ID ( resource )+ INDENT resourceDefinitions DEDENT -> ^( TEMPLATE_DEFINITION ( resource )+ resourceDefinitions ) | ( resource )+ ( INDENT resourceDefinitions DEDENT )? -> ^( TEMPLATE_INSTANCE ( resource )+ ( resourceDefinitions )? ) ) )
933                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:252:7: '@' ({...}? => ID ( resource )+ INDENT resourceDefinitions DEDENT -> ^( TEMPLATE_DEFINITION ( resource )+ resourceDefinitions ) | ( resource )+ ( INDENT resourceDefinitions DEDENT )? -> ^( TEMPLATE_INSTANCE ( resource )+ ( resourceDefinitions )? ) )
934                         {
935                         char_literal23=(Token)match(input,77,FOLLOW_77_in_template1515); if (state.failed) return retval; 
936                         if ( state.backtracking==0 ) stream_77.add(char_literal23);
937
938                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:253:5: ({...}? => ID ( resource )+ INDENT resourceDefinitions DEDENT -> ^( TEMPLATE_DEFINITION ( resource )+ resourceDefinitions ) | ( resource )+ ( INDENT resourceDefinitions DEDENT )? -> ^( TEMPLATE_INSTANCE ( resource )+ ( resourceDefinitions )? ) )
939                         int alt13=2;
940                         int LA13_0 = input.LA(1);
941                         if ( (LA13_0==ID) ) {
942                                 int LA13_1 = input.LA(2);
943                                 if ( ((input.LT(1).getText().equals("template"))) ) {
944                                         alt13=1;
945                                 }
946                                 else if ( (true) ) {
947                                         alt13=2;
948                                 }
949
950                         }
951                         else if ( (LA13_0==FLOAT||LA13_0==INT||(LA13_0 >= LBRACKET && LA13_0 <= LPAREN)||LA13_0==STRING||LA13_0==URI||(LA13_0 >= 65 && LA13_0 <= 66)||(LA13_0 >= 78 && LA13_0 <= 79)) ) {
952                                 alt13=2;
953                         }
954
955                         else {
956                                 if (state.backtracking>0) {state.failed=true; return retval;}
957                                 NoViableAltException nvae =
958                                         new NoViableAltException("", 13, 0, input);
959                                 throw nvae;
960                         }
961
962                         switch (alt13) {
963                                 case 1 :
964                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:253:7: {...}? => ID ( resource )+ INDENT resourceDefinitions DEDENT
965                                         {
966                                         if ( !((input.LT(1).getText().equals("template"))) ) {
967                                                 if (state.backtracking>0) {state.failed=true; return retval;}
968                                                 throw new FailedPredicateException(input, "template", "input.LT(1).getText().equals(\"template\")");
969                                         }
970                                         ID24=(Token)match(input,ID,FOLLOW_ID_in_template1533); if (state.failed) return retval; 
971                                         if ( state.backtracking==0 ) stream_ID.add(ID24);
972
973                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:254:10: ( resource )+
974                                         int cnt10=0;
975                                         loop10:
976                                         while (true) {
977                                                 int alt10=2;
978                                                 int LA10_0 = input.LA(1);
979                                                 if ( (LA10_0==FLOAT||LA10_0==ID||LA10_0==INT||(LA10_0 >= LBRACKET && LA10_0 <= LPAREN)||LA10_0==STRING||LA10_0==URI||(LA10_0 >= 65 && LA10_0 <= 66)||(LA10_0 >= 78 && LA10_0 <= 79)) ) {
980                                                         alt10=1;
981                                                 }
982
983                                                 switch (alt10) {
984                                                 case 1 :
985                                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:254:10: resource
986                                                         {
987                                                         pushFollow(FOLLOW_resource_in_template1535);
988                                                         resource25=resource();
989                                                         state._fsp--;
990                                                         if (state.failed) return retval;
991                                                         if ( state.backtracking==0 ) stream_resource.add(resource25.getTree());
992                                                         }
993                                                         break;
994
995                                                 default :
996                                                         if ( cnt10 >= 1 ) break loop10;
997                                                         if (state.backtracking>0) {state.failed=true; return retval;}
998                                                         EarlyExitException eee = new EarlyExitException(10, input);
999                                                         throw eee;
1000                                                 }
1001                                                 cnt10++;
1002                                         }
1003
1004                                         INDENT26=(Token)match(input,INDENT,FOLLOW_INDENT_in_template1545); if (state.failed) return retval; 
1005                                         if ( state.backtracking==0 ) stream_INDENT.add(INDENT26);
1006
1007                                         pushFollow(FOLLOW_resourceDefinitions_in_template1547);
1008                                         resourceDefinitions27=resourceDefinitions();
1009                                         state._fsp--;
1010                                         if (state.failed) return retval;
1011                                         if ( state.backtracking==0 ) stream_resourceDefinitions.add(resourceDefinitions27.getTree());
1012                                         DEDENT28=(Token)match(input,DEDENT,FOLLOW_DEDENT_in_template1549); if (state.failed) return retval; 
1013                                         if ( state.backtracking==0 ) stream_DEDENT.add(DEDENT28);
1014
1015                                         // AST REWRITE
1016                                         // elements: resourceDefinitions, resource
1017                                         // token labels: 
1018                                         // rule labels: retval
1019                                         // token list labels: 
1020                                         // rule list labels: 
1021                                         // wildcard labels: 
1022                                         if ( state.backtracking==0 ) {
1023                                         retval.tree = root_0;
1024                                         RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
1025
1026                                         root_0 = (CommonTree)adaptor.nil();
1027                                         // 256:7: -> ^( TEMPLATE_DEFINITION ( resource )+ resourceDefinitions )
1028                                         {
1029                                                 // src/org/simantics/graph/compiler/internal/parsing/Graph.g:256:10: ^( TEMPLATE_DEFINITION ( resource )+ resourceDefinitions )
1030                                                 {
1031                                                 CommonTree root_1 = (CommonTree)adaptor.nil();
1032                                                 root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TEMPLATE_DEFINITION, "TEMPLATE_DEFINITION"), root_1);
1033                                                 if ( !(stream_resource.hasNext()) ) {
1034                                                         throw new RewriteEarlyExitException();
1035                                                 }
1036                                                 while ( stream_resource.hasNext() ) {
1037                                                         adaptor.addChild(root_1, stream_resource.nextTree());
1038                                                 }
1039                                                 stream_resource.reset();
1040
1041                                                 adaptor.addChild(root_1, stream_resourceDefinitions.nextTree());
1042                                                 adaptor.addChild(root_0, root_1);
1043                                                 }
1044
1045                                         }
1046
1047
1048                                         retval.tree = root_0;
1049                                         }
1050
1051                                         }
1052                                         break;
1053                                 case 2 :
1054                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:257:7: ( resource )+ ( INDENT resourceDefinitions DEDENT )?
1055                                         {
1056                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:257:7: ( resource )+
1057                                         int cnt11=0;
1058                                         loop11:
1059                                         while (true) {
1060                                                 int alt11=2;
1061                                                 int LA11_0 = input.LA(1);
1062                                                 if ( (LA11_0==FLOAT||LA11_0==ID||LA11_0==INT||(LA11_0 >= LBRACKET && LA11_0 <= LPAREN)||LA11_0==STRING||LA11_0==URI||(LA11_0 >= 65 && LA11_0 <= 66)||(LA11_0 >= 78 && LA11_0 <= 79)) ) {
1063                                                         alt11=1;
1064                                                 }
1065
1066                                                 switch (alt11) {
1067                                                 case 1 :
1068                                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:257:7: resource
1069                                                         {
1070                                                         pushFollow(FOLLOW_resource_in_template1574);
1071                                                         resource29=resource();
1072                                                         state._fsp--;
1073                                                         if (state.failed) return retval;
1074                                                         if ( state.backtracking==0 ) stream_resource.add(resource29.getTree());
1075                                                         }
1076                                                         break;
1077
1078                                                 default :
1079                                                         if ( cnt11 >= 1 ) break loop11;
1080                                                         if (state.backtracking>0) {state.failed=true; return retval;}
1081                                                         EarlyExitException eee = new EarlyExitException(11, input);
1082                                                         throw eee;
1083                                                 }
1084                                                 cnt11++;
1085                                         }
1086
1087                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:258:7: ( INDENT resourceDefinitions DEDENT )?
1088                                         int alt12=2;
1089                                         int LA12_0 = input.LA(1);
1090                                         if ( (LA12_0==INDENT) ) {
1091                                                 alt12=1;
1092                                         }
1093                                         switch (alt12) {
1094                                                 case 1 :
1095                                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:258:8: INDENT resourceDefinitions DEDENT
1096                                                         {
1097                                                         INDENT30=(Token)match(input,INDENT,FOLLOW_INDENT_in_template1585); if (state.failed) return retval; 
1098                                                         if ( state.backtracking==0 ) stream_INDENT.add(INDENT30);
1099
1100                                                         pushFollow(FOLLOW_resourceDefinitions_in_template1587);
1101                                                         resourceDefinitions31=resourceDefinitions();
1102                                                         state._fsp--;
1103                                                         if (state.failed) return retval;
1104                                                         if ( state.backtracking==0 ) stream_resourceDefinitions.add(resourceDefinitions31.getTree());
1105                                                         DEDENT32=(Token)match(input,DEDENT,FOLLOW_DEDENT_in_template1589); if (state.failed) return retval; 
1106                                                         if ( state.backtracking==0 ) stream_DEDENT.add(DEDENT32);
1107
1108                                                         }
1109                                                         break;
1110
1111                                         }
1112
1113                                         // AST REWRITE
1114                                         // elements: resource, resourceDefinitions
1115                                         // token labels: 
1116                                         // rule labels: retval
1117                                         // token list labels: 
1118                                         // rule list labels: 
1119                                         // wildcard labels: 
1120                                         if ( state.backtracking==0 ) {
1121                                         retval.tree = root_0;
1122                                         RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
1123
1124                                         root_0 = (CommonTree)adaptor.nil();
1125                                         // 259:7: -> ^( TEMPLATE_INSTANCE ( resource )+ ( resourceDefinitions )? )
1126                                         {
1127                                                 // src/org/simantics/graph/compiler/internal/parsing/Graph.g:259:10: ^( TEMPLATE_INSTANCE ( resource )+ ( resourceDefinitions )? )
1128                                                 {
1129                                                 CommonTree root_1 = (CommonTree)adaptor.nil();
1130                                                 root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TEMPLATE_INSTANCE, "TEMPLATE_INSTANCE"), root_1);
1131                                                 if ( !(stream_resource.hasNext()) ) {
1132                                                         throw new RewriteEarlyExitException();
1133                                                 }
1134                                                 while ( stream_resource.hasNext() ) {
1135                                                         adaptor.addChild(root_1, stream_resource.nextTree());
1136                                                 }
1137                                                 stream_resource.reset();
1138
1139                                                 // src/org/simantics/graph/compiler/internal/parsing/Graph.g:259:40: ( resourceDefinitions )?
1140                                                 if ( stream_resourceDefinitions.hasNext() ) {
1141                                                         adaptor.addChild(root_1, stream_resourceDefinitions.nextTree());
1142                                                 }
1143                                                 stream_resourceDefinitions.reset();
1144
1145                                                 adaptor.addChild(root_0, root_1);
1146                                                 }
1147
1148                                         }
1149
1150
1151                                         retval.tree = root_0;
1152                                         }
1153
1154                                         }
1155                                         break;
1156
1157                         }
1158
1159                         }
1160
1161                         retval.stop = input.LT(-1);
1162
1163                         if ( state.backtracking==0 ) {
1164                         retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
1165                         adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
1166                         }
1167                 }
1168                 catch (RecognitionException re) {
1169                         reportError(re);
1170                         recover(input,re);
1171                         retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
1172                 }
1173                 finally {
1174                         // do for sure before leaving
1175                 }
1176                 return retval;
1177         }
1178         // $ANTLR end "template"
1179
1180
1181         public static class relation_return extends ParserRuleReturnScope {
1182                 CommonTree tree;
1183                 @Override
1184                 public CommonTree getTree() { return tree; }
1185         };
1186
1187
1188         // $ANTLR start "relation"
1189         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:267:1: relation : ( ( ID -> ID ) ( '.' ID -> ^( REF $relation ID ) )* | URI | '<T' -> INHERITS | '<R' -> SUBRELATION_OF | '<--' -> HAS_DOMAIN | '-->' -> HAS_RANGE | '==>' -> REQUIRES_VALUE_TYPE | '>--' -> DOMAIN_OF | ':' -> INSTANCE_OF | '=' -> EQUALS | '%' ID -> ^( VARIABLE ID ) );
1190         public final GraphParser.relation_return relation() throws RecognitionException {
1191                 GraphParser.relation_return retval = new GraphParser.relation_return();
1192                 retval.start = input.LT(1);
1193
1194                 CommonTree root_0 = null;
1195
1196                 Token ID33=null;
1197                 Token char_literal34=null;
1198                 Token ID35=null;
1199                 Token URI36=null;
1200                 Token string_literal37=null;
1201                 Token string_literal38=null;
1202                 Token string_literal39=null;
1203                 Token string_literal40=null;
1204                 Token string_literal41=null;
1205                 Token string_literal42=null;
1206                 Token char_literal43=null;
1207                 Token char_literal44=null;
1208                 Token char_literal45=null;
1209                 Token ID46=null;
1210
1211                 CommonTree ID33_tree=null;
1212                 CommonTree char_literal34_tree=null;
1213                 CommonTree ID35_tree=null;
1214                 CommonTree URI36_tree=null;
1215                 CommonTree string_literal37_tree=null;
1216                 CommonTree string_literal38_tree=null;
1217                 CommonTree string_literal39_tree=null;
1218                 CommonTree string_literal40_tree=null;
1219                 CommonTree string_literal41_tree=null;
1220                 CommonTree string_literal42_tree=null;
1221                 CommonTree char_literal43_tree=null;
1222                 CommonTree char_literal44_tree=null;
1223                 CommonTree char_literal45_tree=null;
1224                 CommonTree ID46_tree=null;
1225                 RewriteRuleTokenStream stream_66=new RewriteRuleTokenStream(adaptor,"token 66");
1226                 RewriteRuleTokenStream stream_68=new RewriteRuleTokenStream(adaptor,"token 68");
1227                 RewriteRuleTokenStream stream_69=new RewriteRuleTokenStream(adaptor,"token 69");
1228                 RewriteRuleTokenStream stream_70=new RewriteRuleTokenStream(adaptor,"token 70");
1229                 RewriteRuleTokenStream stream_71=new RewriteRuleTokenStream(adaptor,"token 71");
1230                 RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID");
1231                 RewriteRuleTokenStream stream_72=new RewriteRuleTokenStream(adaptor,"token 72");
1232                 RewriteRuleTokenStream stream_73=new RewriteRuleTokenStream(adaptor,"token 73");
1233                 RewriteRuleTokenStream stream_74=new RewriteRuleTokenStream(adaptor,"token 74");
1234                 RewriteRuleTokenStream stream_75=new RewriteRuleTokenStream(adaptor,"token 75");
1235                 RewriteRuleTokenStream stream_76=new RewriteRuleTokenStream(adaptor,"token 76");
1236
1237                 try {
1238                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:268:5: ( ( ID -> ID ) ( '.' ID -> ^( REF $relation ID ) )* | URI | '<T' -> INHERITS | '<R' -> SUBRELATION_OF | '<--' -> HAS_DOMAIN | '-->' -> HAS_RANGE | '==>' -> REQUIRES_VALUE_TYPE | '>--' -> DOMAIN_OF | ':' -> INSTANCE_OF | '=' -> EQUALS | '%' ID -> ^( VARIABLE ID ) )
1239                         int alt15=11;
1240                         switch ( input.LA(1) ) {
1241                         case ID:
1242                                 {
1243                                 alt15=1;
1244                                 }
1245                                 break;
1246                         case URI:
1247                                 {
1248                                 alt15=2;
1249                                 }
1250                                 break;
1251                         case 73:
1252                                 {
1253                                 alt15=3;
1254                                 }
1255                                 break;
1256                         case 72:
1257                                 {
1258                                 alt15=4;
1259                                 }
1260                                 break;
1261                         case 71:
1262                                 {
1263                                 alt15=5;
1264                                 }
1265                                 break;
1266                         case 68:
1267                                 {
1268                                 alt15=6;
1269                                 }
1270                                 break;
1271                         case 75:
1272                                 {
1273                                 alt15=7;
1274                                 }
1275                                 break;
1276                         case 76:
1277                                 {
1278                                 alt15=8;
1279                                 }
1280                                 break;
1281                         case 70:
1282                                 {
1283                                 alt15=9;
1284                                 }
1285                                 break;
1286                         case 74:
1287                                 {
1288                                 alt15=10;
1289                                 }
1290                                 break;
1291                         case 66:
1292                                 {
1293                                 alt15=11;
1294                                 }
1295                                 break;
1296                         default:
1297                                 if (state.backtracking>0) {state.failed=true; return retval;}
1298                                 NoViableAltException nvae =
1299                                         new NoViableAltException("", 15, 0, input);
1300                                 throw nvae;
1301                         }
1302                         switch (alt15) {
1303                                 case 1 :
1304                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:268:7: ( ID -> ID ) ( '.' ID -> ^( REF $relation ID ) )*
1305                                         {
1306                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:268:7: ( ID -> ID )
1307                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:268:9: ID
1308                                         {
1309                                         ID33=(Token)match(input,ID,FOLLOW_ID_in_relation1643); if (state.failed) return retval; 
1310                                         if ( state.backtracking==0 ) stream_ID.add(ID33);
1311
1312                                         // AST REWRITE
1313                                         // elements: ID
1314                                         // token labels: 
1315                                         // rule labels: retval
1316                                         // token list labels: 
1317                                         // rule list labels: 
1318                                         // wildcard labels: 
1319                                         if ( state.backtracking==0 ) {
1320                                         retval.tree = root_0;
1321                                         RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
1322
1323                                         root_0 = (CommonTree)adaptor.nil();
1324                                         // 268:12: -> ID
1325                                         {
1326                                                 adaptor.addChild(root_0, stream_ID.nextNode());
1327                                         }
1328
1329
1330                                         retval.tree = root_0;
1331                                         }
1332
1333                                         }
1334
1335                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:269:7: ( '.' ID -> ^( REF $relation ID ) )*
1336                                         loop14:
1337                                         while (true) {
1338                                                 int alt14=2;
1339                                                 int LA14_0 = input.LA(1);
1340                                                 if ( (LA14_0==69) ) {
1341                                                         alt14=1;
1342                                                 }
1343
1344                                                 switch (alt14) {
1345                                                 case 1 :
1346                                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:269:8: '.' ID
1347                                                         {
1348                                                         char_literal34=(Token)match(input,69,FOLLOW_69_in_relation1658); if (state.failed) return retval; 
1349                                                         if ( state.backtracking==0 ) stream_69.add(char_literal34);
1350
1351                                                         ID35=(Token)match(input,ID,FOLLOW_ID_in_relation1660); if (state.failed) return retval; 
1352                                                         if ( state.backtracking==0 ) stream_ID.add(ID35);
1353
1354                                                         // AST REWRITE
1355                                                         // elements: relation, ID
1356                                                         // token labels: 
1357                                                         // rule labels: retval
1358                                                         // token list labels: 
1359                                                         // rule list labels: 
1360                                                         // wildcard labels: 
1361                                                         if ( state.backtracking==0 ) {
1362                                                         retval.tree = root_0;
1363                                                         RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
1364
1365                                                         root_0 = (CommonTree)adaptor.nil();
1366                                                         // 269:15: -> ^( REF $relation ID )
1367                                                         {
1368                                                                 // src/org/simantics/graph/compiler/internal/parsing/Graph.g:269:18: ^( REF $relation ID )
1369                                                                 {
1370                                                                 CommonTree root_1 = (CommonTree)adaptor.nil();
1371                                                                 root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(REF, "REF"), root_1);
1372                                                                 adaptor.addChild(root_1, stream_retval.nextTree());
1373                                                                 adaptor.addChild(root_1, stream_ID.nextNode());
1374                                                                 adaptor.addChild(root_0, root_1);
1375                                                                 }
1376
1377                                                         }
1378
1379
1380                                                         retval.tree = root_0;
1381                                                         }
1382
1383                                                         }
1384                                                         break;
1385
1386                                                 default :
1387                                                         break loop14;
1388                                                 }
1389                                         }
1390
1391                                         }
1392                                         break;
1393                                 case 2 :
1394                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:270:7: URI
1395                                         {
1396                                         root_0 = (CommonTree)adaptor.nil();
1397
1398
1399                                         URI36=(Token)match(input,URI,FOLLOW_URI_in_relation1681); if (state.failed) return retval;
1400                                         if ( state.backtracking==0 ) {
1401                                         URI36_tree = (CommonTree)adaptor.create(URI36);
1402                                         adaptor.addChild(root_0, URI36_tree);
1403                                         }
1404
1405                                         }
1406                                         break;
1407                                 case 3 :
1408                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:271:7: '<T'
1409                                         {
1410                                         string_literal37=(Token)match(input,73,FOLLOW_73_in_relation1689); if (state.failed) return retval; 
1411                                         if ( state.backtracking==0 ) stream_73.add(string_literal37);
1412
1413                                         // AST REWRITE
1414                                         // elements: 
1415                                         // token labels: 
1416                                         // rule labels: retval
1417                                         // token list labels: 
1418                                         // rule list labels: 
1419                                         // wildcard labels: 
1420                                         if ( state.backtracking==0 ) {
1421                                         retval.tree = root_0;
1422                                         RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
1423
1424                                         root_0 = (CommonTree)adaptor.nil();
1425                                         // 271:12: -> INHERITS
1426                                         {
1427                                                 adaptor.addChild(root_0, (CommonTree)adaptor.create(INHERITS, "INHERITS"));
1428                                         }
1429
1430
1431                                         retval.tree = root_0;
1432                                         }
1433
1434                                         }
1435                                         break;
1436                                 case 4 :
1437                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:272:7: '<R'
1438                                         {
1439                                         string_literal38=(Token)match(input,72,FOLLOW_72_in_relation1701); if (state.failed) return retval; 
1440                                         if ( state.backtracking==0 ) stream_72.add(string_literal38);
1441
1442                                         // AST REWRITE
1443                                         // elements: 
1444                                         // token labels: 
1445                                         // rule labels: retval
1446                                         // token list labels: 
1447                                         // rule list labels: 
1448                                         // wildcard labels: 
1449                                         if ( state.backtracking==0 ) {
1450                                         retval.tree = root_0;
1451                                         RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
1452
1453                                         root_0 = (CommonTree)adaptor.nil();
1454                                         // 272:12: -> SUBRELATION_OF
1455                                         {
1456                                                 adaptor.addChild(root_0, (CommonTree)adaptor.create(SUBRELATION_OF, "SUBRELATION_OF"));
1457                                         }
1458
1459
1460                                         retval.tree = root_0;
1461                                         }
1462
1463                                         }
1464                                         break;
1465                                 case 5 :
1466                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:273:7: '<--'
1467                                         {
1468                                         string_literal39=(Token)match(input,71,FOLLOW_71_in_relation1713); if (state.failed) return retval; 
1469                                         if ( state.backtracking==0 ) stream_71.add(string_literal39);
1470
1471                                         // AST REWRITE
1472                                         // elements: 
1473                                         // token labels: 
1474                                         // rule labels: retval
1475                                         // token list labels: 
1476                                         // rule list labels: 
1477                                         // wildcard labels: 
1478                                         if ( state.backtracking==0 ) {
1479                                         retval.tree = root_0;
1480                                         RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
1481
1482                                         root_0 = (CommonTree)adaptor.nil();
1483                                         // 273:13: -> HAS_DOMAIN
1484                                         {
1485                                                 adaptor.addChild(root_0, (CommonTree)adaptor.create(HAS_DOMAIN, "HAS_DOMAIN"));
1486                                         }
1487
1488
1489                                         retval.tree = root_0;
1490                                         }
1491
1492                                         }
1493                                         break;
1494                                 case 6 :
1495                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:274:7: '-->'
1496                                         {
1497                                         string_literal40=(Token)match(input,68,FOLLOW_68_in_relation1725); if (state.failed) return retval; 
1498                                         if ( state.backtracking==0 ) stream_68.add(string_literal40);
1499
1500                                         // AST REWRITE
1501                                         // elements: 
1502                                         // token labels: 
1503                                         // rule labels: retval
1504                                         // token list labels: 
1505                                         // rule list labels: 
1506                                         // wildcard labels: 
1507                                         if ( state.backtracking==0 ) {
1508                                         retval.tree = root_0;
1509                                         RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
1510
1511                                         root_0 = (CommonTree)adaptor.nil();
1512                                         // 274:13: -> HAS_RANGE
1513                                         {
1514                                                 adaptor.addChild(root_0, (CommonTree)adaptor.create(HAS_RANGE, "HAS_RANGE"));
1515                                         }
1516
1517
1518                                         retval.tree = root_0;
1519                                         }
1520
1521                                         }
1522                                         break;
1523                                 case 7 :
1524                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:275:7: '==>'
1525                                         {
1526                                         string_literal41=(Token)match(input,75,FOLLOW_75_in_relation1737); if (state.failed) return retval; 
1527                                         if ( state.backtracking==0 ) stream_75.add(string_literal41);
1528
1529                                         // AST REWRITE
1530                                         // elements: 
1531                                         // token labels: 
1532                                         // rule labels: retval
1533                                         // token list labels: 
1534                                         // rule list labels: 
1535                                         // wildcard labels: 
1536                                         if ( state.backtracking==0 ) {
1537                                         retval.tree = root_0;
1538                                         RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
1539
1540                                         root_0 = (CommonTree)adaptor.nil();
1541                                         // 275:13: -> REQUIRES_VALUE_TYPE
1542                                         {
1543                                                 adaptor.addChild(root_0, (CommonTree)adaptor.create(REQUIRES_VALUE_TYPE, "REQUIRES_VALUE_TYPE"));
1544                                         }
1545
1546
1547                                         retval.tree = root_0;
1548                                         }
1549
1550                                         }
1551                                         break;
1552                                 case 8 :
1553                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:276:7: '>--'
1554                                         {
1555                                         string_literal42=(Token)match(input,76,FOLLOW_76_in_relation1749); if (state.failed) return retval; 
1556                                         if ( state.backtracking==0 ) stream_76.add(string_literal42);
1557
1558                                         // AST REWRITE
1559                                         // elements: 
1560                                         // token labels: 
1561                                         // rule labels: retval
1562                                         // token list labels: 
1563                                         // rule list labels: 
1564                                         // wildcard labels: 
1565                                         if ( state.backtracking==0 ) {
1566                                         retval.tree = root_0;
1567                                         RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
1568
1569                                         root_0 = (CommonTree)adaptor.nil();
1570                                         // 276:13: -> DOMAIN_OF
1571                                         {
1572                                                 adaptor.addChild(root_0, (CommonTree)adaptor.create(DOMAIN_OF, "DOMAIN_OF"));
1573                                         }
1574
1575
1576                                         retval.tree = root_0;
1577                                         }
1578
1579                                         }
1580                                         break;
1581                                 case 9 :
1582                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:277:7: ':'
1583                                         {
1584                                         char_literal43=(Token)match(input,70,FOLLOW_70_in_relation1765); if (state.failed) return retval; 
1585                                         if ( state.backtracking==0 ) stream_70.add(char_literal43);
1586
1587                                         // AST REWRITE
1588                                         // elements: 
1589                                         // token labels: 
1590                                         // rule labels: retval
1591                                         // token list labels: 
1592                                         // rule list labels: 
1593                                         // wildcard labels: 
1594                                         if ( state.backtracking==0 ) {
1595                                         retval.tree = root_0;
1596                                         RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
1597
1598                                         root_0 = (CommonTree)adaptor.nil();
1599                                         // 277:11: -> INSTANCE_OF
1600                                         {
1601                                                 adaptor.addChild(root_0, (CommonTree)adaptor.create(INSTANCE_OF, "INSTANCE_OF"));
1602                                         }
1603
1604
1605                                         retval.tree = root_0;
1606                                         }
1607
1608                                         }
1609                                         break;
1610                                 case 10 :
1611                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:278:7: '='
1612                                         {
1613                                         char_literal44=(Token)match(input,74,FOLLOW_74_in_relation1777); if (state.failed) return retval; 
1614                                         if ( state.backtracking==0 ) stream_74.add(char_literal44);
1615
1616                                         // AST REWRITE
1617                                         // elements: 
1618                                         // token labels: 
1619                                         // rule labels: retval
1620                                         // token list labels: 
1621                                         // rule list labels: 
1622                                         // wildcard labels: 
1623                                         if ( state.backtracking==0 ) {
1624                                         retval.tree = root_0;
1625                                         RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
1626
1627                                         root_0 = (CommonTree)adaptor.nil();
1628                                         // 278:11: -> EQUALS
1629                                         {
1630                                                 adaptor.addChild(root_0, (CommonTree)adaptor.create(EQUALS, "EQUALS"));
1631                                         }
1632
1633
1634                                         retval.tree = root_0;
1635                                         }
1636
1637                                         }
1638                                         break;
1639                                 case 11 :
1640                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:279:7: '%' ID
1641                                         {
1642                                         char_literal45=(Token)match(input,66,FOLLOW_66_in_relation1789); if (state.failed) return retval; 
1643                                         if ( state.backtracking==0 ) stream_66.add(char_literal45);
1644
1645                                         ID46=(Token)match(input,ID,FOLLOW_ID_in_relation1791); if (state.failed) return retval; 
1646                                         if ( state.backtracking==0 ) stream_ID.add(ID46);
1647
1648                                         // AST REWRITE
1649                                         // elements: ID
1650                                         // token labels: 
1651                                         // rule labels: retval
1652                                         // token list labels: 
1653                                         // rule list labels: 
1654                                         // wildcard labels: 
1655                                         if ( state.backtracking==0 ) {
1656                                         retval.tree = root_0;
1657                                         RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
1658
1659                                         root_0 = (CommonTree)adaptor.nil();
1660                                         // 279:14: -> ^( VARIABLE ID )
1661                                         {
1662                                                 // src/org/simantics/graph/compiler/internal/parsing/Graph.g:279:17: ^( VARIABLE ID )
1663                                                 {
1664                                                 CommonTree root_1 = (CommonTree)adaptor.nil();
1665                                                 root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(VARIABLE, "VARIABLE"), root_1);
1666                                                 adaptor.addChild(root_1, stream_ID.nextNode());
1667                                                 adaptor.addChild(root_0, root_1);
1668                                                 }
1669
1670                                         }
1671
1672
1673                                         retval.tree = root_0;
1674                                         }
1675
1676                                         }
1677                                         break;
1678
1679                         }
1680                         retval.stop = input.LT(-1);
1681
1682                         if ( state.backtracking==0 ) {
1683                         retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
1684                         adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
1685                         }
1686                 }
1687                 catch (RecognitionException re) {
1688                         reportError(re);
1689                         recover(input,re);
1690                         retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
1691                 }
1692                 finally {
1693                         // do for sure before leaving
1694                 }
1695                 return retval;
1696         }
1697         // $ANTLR end "relation"
1698
1699
1700         public static class resource_return extends ParserRuleReturnScope {
1701                 CommonTree tree;
1702                 @Override
1703                 public CommonTree getTree() { return tree; }
1704         };
1705
1706
1707         // $ANTLR start "resource"
1708         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:282:1: resource : ( ({...}? => ID -> ^( BLANK ID ) | ID -> ID ) ( '.' ( ID -> ^( REF $resource ID ) | STRING -> ^( REF $resource STRING ) ) )* | URI | simpleValue -> ^( EMBEDDED_VALUE simpleValue ) | '$' basicType -> ^( EMBEDDED_TYPE basicType ) | '%' ID -> ^( VARIABLE ID ) );
1709         public final GraphParser.resource_return resource() throws RecognitionException {
1710                 GraphParser.resource_return retval = new GraphParser.resource_return();
1711                 retval.start = input.LT(1);
1712
1713                 CommonTree root_0 = null;
1714
1715                 Token ID47=null;
1716                 Token ID48=null;
1717                 Token char_literal49=null;
1718                 Token ID50=null;
1719                 Token STRING51=null;
1720                 Token URI52=null;
1721                 Token char_literal54=null;
1722                 Token char_literal56=null;
1723                 Token ID57=null;
1724                 ParserRuleReturnScope simpleValue53 =null;
1725                 ParserRuleReturnScope basicType55 =null;
1726
1727                 CommonTree ID47_tree=null;
1728                 CommonTree ID48_tree=null;
1729                 CommonTree char_literal49_tree=null;
1730                 CommonTree ID50_tree=null;
1731                 CommonTree STRING51_tree=null;
1732                 CommonTree URI52_tree=null;
1733                 CommonTree char_literal54_tree=null;
1734                 CommonTree char_literal56_tree=null;
1735                 CommonTree ID57_tree=null;
1736                 RewriteRuleTokenStream stream_66=new RewriteRuleTokenStream(adaptor,"token 66");
1737                 RewriteRuleTokenStream stream_69=new RewriteRuleTokenStream(adaptor,"token 69");
1738                 RewriteRuleTokenStream stream_STRING=new RewriteRuleTokenStream(adaptor,"token STRING");
1739                 RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID");
1740                 RewriteRuleTokenStream stream_65=new RewriteRuleTokenStream(adaptor,"token 65");
1741                 RewriteRuleSubtreeStream stream_basicType=new RewriteRuleSubtreeStream(adaptor,"rule basicType");
1742                 RewriteRuleSubtreeStream stream_simpleValue=new RewriteRuleSubtreeStream(adaptor,"rule simpleValue");
1743
1744                 try {
1745                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:283:5: ( ({...}? => ID -> ^( BLANK ID ) | ID -> ID ) ( '.' ( ID -> ^( REF $resource ID ) | STRING -> ^( REF $resource STRING ) ) )* | URI | simpleValue -> ^( EMBEDDED_VALUE simpleValue ) | '$' basicType -> ^( EMBEDDED_TYPE basicType ) | '%' ID -> ^( VARIABLE ID ) )
1746                         int alt19=5;
1747                         switch ( input.LA(1) ) {
1748                         case ID:
1749                                 {
1750                                 alt19=1;
1751                                 }
1752                                 break;
1753                         case URI:
1754                                 {
1755                                 alt19=2;
1756                                 }
1757                                 break;
1758                         case FLOAT:
1759                         case INT:
1760                         case LBRACKET:
1761                         case LCURLY:
1762                         case LPAREN:
1763                         case STRING:
1764                         case 78:
1765                         case 79:
1766                                 {
1767                                 alt19=3;
1768                                 }
1769                                 break;
1770                         case 65:
1771                                 {
1772                                 alt19=4;
1773                                 }
1774                                 break;
1775                         case 66:
1776                                 {
1777                                 alt19=5;
1778                                 }
1779                                 break;
1780                         default:
1781                                 if (state.backtracking>0) {state.failed=true; return retval;}
1782                                 NoViableAltException nvae =
1783                                         new NoViableAltException("", 19, 0, input);
1784                                 throw nvae;
1785                         }
1786                         switch (alt19) {
1787                                 case 1 :
1788                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:283:7: ({...}? => ID -> ^( BLANK ID ) | ID -> ID ) ( '.' ( ID -> ^( REF $resource ID ) | STRING -> ^( REF $resource STRING ) ) )*
1789                                         {
1790                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:283:7: ({...}? => ID -> ^( BLANK ID ) | ID -> ID )
1791                                         int alt16=2;
1792                                         int LA16_0 = input.LA(1);
1793                                         if ( (LA16_0==ID) ) {
1794                                                 int LA16_1 = input.LA(2);
1795                                                 if ( ((input.LT(1).getText().equals("_"))) ) {
1796                                                         alt16=1;
1797                                                 }
1798                                                 else if ( (true) ) {
1799                                                         alt16=2;
1800                                                 }
1801
1802                                         }
1803
1804                                         else {
1805                                                 if (state.backtracking>0) {state.failed=true; return retval;}
1806                                                 NoViableAltException nvae =
1807                                                         new NoViableAltException("", 16, 0, input);
1808                                                 throw nvae;
1809                                         }
1810
1811                                         switch (alt16) {
1812                                                 case 1 :
1813                                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:283:9: {...}? => ID
1814                                                         {
1815                                                         if ( !((input.LT(1).getText().equals("_"))) ) {
1816                                                                 if (state.backtracking>0) {state.failed=true; return retval;}
1817                                                                 throw new FailedPredicateException(input, "resource", "input.LT(1).getText().equals(\"_\")");
1818                                                         }
1819                                                         ID47=(Token)match(input,ID,FOLLOW_ID_in_resource1821); if (state.failed) return retval; 
1820                                                         if ( state.backtracking==0 ) stream_ID.add(ID47);
1821
1822                                                         // AST REWRITE
1823                                                         // elements: ID
1824                                                         // token labels: 
1825                                                         // rule labels: retval
1826                                                         // token list labels: 
1827                                                         // rule list labels: 
1828                                                         // wildcard labels: 
1829                                                         if ( state.backtracking==0 ) {
1830                                                         retval.tree = root_0;
1831                                                         RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
1832
1833                                                         root_0 = (CommonTree)adaptor.nil();
1834                                                         // 283:51: -> ^( BLANK ID )
1835                                                         {
1836                                                                 // src/org/simantics/graph/compiler/internal/parsing/Graph.g:283:54: ^( BLANK ID )
1837                                                                 {
1838                                                                 CommonTree root_1 = (CommonTree)adaptor.nil();
1839                                                                 root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(BLANK, "BLANK"), root_1);
1840                                                                 adaptor.addChild(root_1, stream_ID.nextNode());
1841                                                                 adaptor.addChild(root_0, root_1);
1842                                                                 }
1843
1844                                                         }
1845
1846
1847                                                         retval.tree = root_0;
1848                                                         }
1849
1850                                                         }
1851                                                         break;
1852                                                 case 2 :
1853                                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:284:9: ID
1854                                                         {
1855                                                         ID48=(Token)match(input,ID,FOLLOW_ID_in_resource1840); if (state.failed) return retval; 
1856                                                         if ( state.backtracking==0 ) stream_ID.add(ID48);
1857
1858                                                         // AST REWRITE
1859                                                         // elements: ID
1860                                                         // token labels: 
1861                                                         // rule labels: retval
1862                                                         // token list labels: 
1863                                                         // rule list labels: 
1864                                                         // wildcard labels: 
1865                                                         if ( state.backtracking==0 ) {
1866                                                         retval.tree = root_0;
1867                                                         RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
1868
1869                                                         root_0 = (CommonTree)adaptor.nil();
1870                                                         // 284:12: -> ID
1871                                                         {
1872                                                                 adaptor.addChild(root_0, stream_ID.nextNode());
1873                                                         }
1874
1875
1876                                                         retval.tree = root_0;
1877                                                         }
1878
1879                                                         }
1880                                                         break;
1881
1882                                         }
1883
1884                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:285:7: ( '.' ( ID -> ^( REF $resource ID ) | STRING -> ^( REF $resource STRING ) ) )*
1885                                         loop18:
1886                                         while (true) {
1887                                                 int alt18=2;
1888                                                 int LA18_0 = input.LA(1);
1889                                                 if ( (LA18_0==69) ) {
1890                                                         alt18=1;
1891                                                 }
1892
1893                                                 switch (alt18) {
1894                                                 case 1 :
1895                                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:285:8: '.' ( ID -> ^( REF $resource ID ) | STRING -> ^( REF $resource STRING ) )
1896                                                         {
1897                                                         char_literal49=(Token)match(input,69,FOLLOW_69_in_resource1855); if (state.failed) return retval; 
1898                                                         if ( state.backtracking==0 ) stream_69.add(char_literal49);
1899
1900                                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:285:12: ( ID -> ^( REF $resource ID ) | STRING -> ^( REF $resource STRING ) )
1901                                                         int alt17=2;
1902                                                         int LA17_0 = input.LA(1);
1903                                                         if ( (LA17_0==ID) ) {
1904                                                                 alt17=1;
1905                                                         }
1906                                                         else if ( (LA17_0==STRING) ) {
1907                                                                 alt17=2;
1908                                                         }
1909
1910                                                         else {
1911                                                                 if (state.backtracking>0) {state.failed=true; return retval;}
1912                                                                 NoViableAltException nvae =
1913                                                                         new NoViableAltException("", 17, 0, input);
1914                                                                 throw nvae;
1915                                                         }
1916
1917                                                         switch (alt17) {
1918                                                                 case 1 :
1919                                                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:285:13: ID
1920                                                                         {
1921                                                                         ID50=(Token)match(input,ID,FOLLOW_ID_in_resource1858); if (state.failed) return retval; 
1922                                                                         if ( state.backtracking==0 ) stream_ID.add(ID50);
1923
1924                                                                         // AST REWRITE
1925                                                                         // elements: ID, resource
1926                                                                         // token labels: 
1927                                                                         // rule labels: retval
1928                                                                         // token list labels: 
1929                                                                         // rule list labels: 
1930                                                                         // wildcard labels: 
1931                                                                         if ( state.backtracking==0 ) {
1932                                                                         retval.tree = root_0;
1933                                                                         RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
1934
1935                                                                         root_0 = (CommonTree)adaptor.nil();
1936                                                                         // 285:16: -> ^( REF $resource ID )
1937                                                                         {
1938                                                                                 // src/org/simantics/graph/compiler/internal/parsing/Graph.g:285:19: ^( REF $resource ID )
1939                                                                                 {
1940                                                                                 CommonTree root_1 = (CommonTree)adaptor.nil();
1941                                                                                 root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(REF, "REF"), root_1);
1942                                                                                 adaptor.addChild(root_1, stream_retval.nextTree());
1943                                                                                 adaptor.addChild(root_1, stream_ID.nextNode());
1944                                                                                 adaptor.addChild(root_0, root_1);
1945                                                                                 }
1946
1947                                                                         }
1948
1949
1950                                                                         retval.tree = root_0;
1951                                                                         }
1952
1953                                                                         }
1954                                                                         break;
1955                                                                 case 2 :
1956                                                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:286:13: STRING
1957                                                                         {
1958                                                                         STRING51=(Token)match(input,STRING,FOLLOW_STRING_in_resource1883); if (state.failed) return retval; 
1959                                                                         if ( state.backtracking==0 ) stream_STRING.add(STRING51);
1960
1961                                                                         // AST REWRITE
1962                                                                         // elements: STRING, resource
1963                                                                         // token labels: 
1964                                                                         // rule labels: retval
1965                                                                         // token list labels: 
1966                                                                         // rule list labels: 
1967                                                                         // wildcard labels: 
1968                                                                         if ( state.backtracking==0 ) {
1969                                                                         retval.tree = root_0;
1970                                                                         RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
1971
1972                                                                         root_0 = (CommonTree)adaptor.nil();
1973                                                                         // 286:20: -> ^( REF $resource STRING )
1974                                                                         {
1975                                                                                 // src/org/simantics/graph/compiler/internal/parsing/Graph.g:286:23: ^( REF $resource STRING )
1976                                                                                 {
1977                                                                                 CommonTree root_1 = (CommonTree)adaptor.nil();
1978                                                                                 root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(REF, "REF"), root_1);
1979                                                                                 adaptor.addChild(root_1, stream_retval.nextTree());
1980                                                                                 adaptor.addChild(root_1, stream_STRING.nextNode());
1981                                                                                 adaptor.addChild(root_0, root_1);
1982                                                                                 }
1983
1984                                                                         }
1985
1986
1987                                                                         retval.tree = root_0;
1988                                                                         }
1989
1990                                                                         }
1991                                                                         break;
1992
1993                                                         }
1994
1995                                                         }
1996                                                         break;
1997
1998                                                 default :
1999                                                         break loop18;
2000                                                 }
2001                                         }
2002
2003                                         }
2004                                         break;
2005                                 case 2 :
2006                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:289:7: URI
2007                                         {
2008                                         root_0 = (CommonTree)adaptor.nil();
2009
2010
2011                                         URI52=(Token)match(input,URI,FOLLOW_URI_in_resource1924); if (state.failed) return retval;
2012                                         if ( state.backtracking==0 ) {
2013                                         URI52_tree = (CommonTree)adaptor.create(URI52);
2014                                         adaptor.addChild(root_0, URI52_tree);
2015                                         }
2016
2017                                         }
2018                                         break;
2019                                 case 3 :
2020                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:290:7: simpleValue
2021                                         {
2022                                         pushFollow(FOLLOW_simpleValue_in_resource1932);
2023                                         simpleValue53=simpleValue();
2024                                         state._fsp--;
2025                                         if (state.failed) return retval;
2026                                         if ( state.backtracking==0 ) stream_simpleValue.add(simpleValue53.getTree());
2027                                         // AST REWRITE
2028                                         // elements: simpleValue
2029                                         // token labels: 
2030                                         // rule labels: retval
2031                                         // token list labels: 
2032                                         // rule list labels: 
2033                                         // wildcard labels: 
2034                                         if ( state.backtracking==0 ) {
2035                                         retval.tree = root_0;
2036                                         RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
2037
2038                                         root_0 = (CommonTree)adaptor.nil();
2039                                         // 290:19: -> ^( EMBEDDED_VALUE simpleValue )
2040                                         {
2041                                                 // src/org/simantics/graph/compiler/internal/parsing/Graph.g:290:22: ^( EMBEDDED_VALUE simpleValue )
2042                                                 {
2043                                                 CommonTree root_1 = (CommonTree)adaptor.nil();
2044                                                 root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(EMBEDDED_VALUE, "EMBEDDED_VALUE"), root_1);
2045                                                 adaptor.addChild(root_1, stream_simpleValue.nextTree());
2046                                                 adaptor.addChild(root_0, root_1);
2047                                                 }
2048
2049                                         }
2050
2051
2052                                         retval.tree = root_0;
2053                                         }
2054
2055                                         }
2056                                         break;
2057                                 case 4 :
2058                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:291:7: '$' basicType
2059                                         {
2060                                         char_literal54=(Token)match(input,65,FOLLOW_65_in_resource1948); if (state.failed) return retval; 
2061                                         if ( state.backtracking==0 ) stream_65.add(char_literal54);
2062
2063                                         pushFollow(FOLLOW_basicType_in_resource1950);
2064                                         basicType55=basicType();
2065                                         state._fsp--;
2066                                         if (state.failed) return retval;
2067                                         if ( state.backtracking==0 ) stream_basicType.add(basicType55.getTree());
2068                                         // AST REWRITE
2069                                         // elements: basicType
2070                                         // token labels: 
2071                                         // rule labels: retval
2072                                         // token list labels: 
2073                                         // rule list labels: 
2074                                         // wildcard labels: 
2075                                         if ( state.backtracking==0 ) {
2076                                         retval.tree = root_0;
2077                                         RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
2078
2079                                         root_0 = (CommonTree)adaptor.nil();
2080                                         // 291:21: -> ^( EMBEDDED_TYPE basicType )
2081                                         {
2082                                                 // src/org/simantics/graph/compiler/internal/parsing/Graph.g:291:24: ^( EMBEDDED_TYPE basicType )
2083                                                 {
2084                                                 CommonTree root_1 = (CommonTree)adaptor.nil();
2085                                                 root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(EMBEDDED_TYPE, "EMBEDDED_TYPE"), root_1);
2086                                                 adaptor.addChild(root_1, stream_basicType.nextTree());
2087                                                 adaptor.addChild(root_0, root_1);
2088                                                 }
2089
2090                                         }
2091
2092
2093                                         retval.tree = root_0;
2094                                         }
2095
2096                                         }
2097                                         break;
2098                                 case 5 :
2099                                         // src/org/simantics/graph/compiler/internal/parsing/Graph.g:292:7: '%' ID
2100                                         {
2101                                         char_literal56=(Token)match(input,66,FOLLOW_66_in_resource1966); if (state.failed) return retval; 
2102                                         if ( state.backtracking==0 ) stream_66.add(char_literal56);
2103
2104                                         ID57=(Token)match(input,ID,FOLLOW_ID_in_resource1968); if (state.failed) return retval; 
2105                                         if ( state.backtracking==0 ) stream_ID.add(ID57);
2106
2107                                         // AST REWRITE
2108                                         // elements: ID
2109                                         // token labels: 
2110                                         // rule labels: retval
2111                                         // token list labels: 
2112                                         // rule list labels: 
2113                                         // wildcard labels: 
2114                                         if ( state.backtracking==0 ) {
2115                                         retval.tree = root_0;
2116                                         RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
2117