Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 9d201e3026169e55645a64efe76344467ea912a2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
/*
* generated by Xtext
*/
package org.eclipse.etrice.core.common.services;

import com.google.inject.Singleton;
import com.google.inject.Inject;

import java.util.List;

import org.eclipse.xtext.*;
import org.eclipse.xtext.service.GrammarProvider;
import org.eclipse.xtext.service.AbstractElementFinder.*;

import org.eclipse.etrice.core.common.services.BaseGrammarAccess;

@Singleton
public class BaseTestGrammarAccess extends AbstractGrammarElementFinder {
	
	
	public class BaseModelElements extends AbstractParserRuleElementFinder {
		private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "BaseModel");
		private final Assignment cElementsAssignment = (Assignment)rule.eContents().get(1);
		private final Alternatives cElementsAlternatives_0 = (Alternatives)cElementsAssignment.eContents().get(0);
		private final RuleCall cElementsAnnotationParserRuleCall_0_0 = (RuleCall)cElementsAlternatives_0.eContents().get(0);
		private final RuleCall cElementsAnnotationTypeParserRuleCall_0_1 = (RuleCall)cElementsAlternatives_0.eContents().get(1);
		
		//// **************************************************************
		//// A simple model for testing Base grammar rules
		////
		//BaseModel:
		//	elements+=(Annotation | AnnotationType)*;
		public ParserRule getRule() { return rule; }

		//elements+=(Annotation | AnnotationType)*
		public Assignment getElementsAssignment() { return cElementsAssignment; }

		//Annotation | AnnotationType
		public Alternatives getElementsAlternatives_0() { return cElementsAlternatives_0; }

		//Annotation
		public RuleCall getElementsAnnotationParserRuleCall_0_0() { return cElementsAnnotationParserRuleCall_0_0; }

		//AnnotationType
		public RuleCall getElementsAnnotationTypeParserRuleCall_0_1() { return cElementsAnnotationTypeParserRuleCall_0_1; }
	}
	
	
	private BaseModelElements pBaseModel;
	
	private final Grammar grammar;

	private BaseGrammarAccess gaBase;

	@Inject
	public BaseTestGrammarAccess(GrammarProvider grammarProvider,
		BaseGrammarAccess gaBase) {
		this.grammar = internalFindGrammar(grammarProvider);
		this.gaBase = gaBase;
	}
	
	protected Grammar internalFindGrammar(GrammarProvider grammarProvider) {
		Grammar grammar = grammarProvider.getGrammar(this);
		while (grammar != null) {
			if ("org.eclipse.etrice.core.common.BaseTest".equals(grammar.getName())) {
				return grammar;
			}
			List<Grammar> grammars = grammar.getUsedGrammars();
			if (!grammars.isEmpty()) {
				grammar = grammars.iterator().next();
			} else {
				return null;
			}
		}
		return grammar;
	}
	
	
	public Grammar getGrammar() {
		return grammar;
	}
	

	public BaseGrammarAccess getBaseGrammarAccess() {
		return gaBase;
	}

	
	//// **************************************************************
	//// A simple model for testing Base grammar rules
	////
	//BaseModel:
	//	elements+=(Annotation | AnnotationType)*;
	public BaseModelElements getBaseModelAccess() {
		return (pBaseModel != null) ? pBaseModel : (pBaseModel = new BaseModelElements());
	}
	
	public ParserRule getBaseModelRule() {
		return getBaseModelAccess().getRule();
	}

	//// **************************************************************
	//// AnnotationType and Annotation Rules
	//Annotation:
	//	"@" type=[AnnotationType|FQN] ("(" attributes+=KeyValue ("," attributes+=KeyValue)* ")")?;
	public BaseGrammarAccess.AnnotationElements getAnnotationAccess() {
		return gaBase.getAnnotationAccess();
	}
	
	public ParserRule getAnnotationRule() {
		return getAnnotationAccess().getRule();
	}

	//KeyValue:
	//	key=ID "=" value=Literal;
	public BaseGrammarAccess.KeyValueElements getKeyValueAccess() {
		return gaBase.getKeyValueAccess();
	}
	
	public ParserRule getKeyValueRule() {
		return getKeyValueAccess().getRule();
	}

	//AnnotationType:
	//	"AnnotationType" name=ID docu=Documentation? "{" "target" "=" (targets+=AnnotationTargetType | "{"
	//	targets+=AnnotationTargetType ("," targets+=AnnotationTargetType)* "}") attributes+=AnnotationAttribute* "}";
	public BaseGrammarAccess.AnnotationTypeElements getAnnotationTypeAccess() {
		return gaBase.getAnnotationTypeAccess();
	}
	
	public ParserRule getAnnotationTypeRule() {
		return getAnnotationTypeAccess().getRule();
	}

	////
	//// Sub-grammars should use AnnotationTargetType to refer to 
	//// specific sub-grammar targets. For example, valid values for 
	//// AnnotationTargetType in the Room.xtext sub-grammar include "ActorClass", 
	//// "ActorBehavior", "ProtocolClass", etc. The sub-grammar is responsible for 
	//// implementing validation, quick-fixes, and code completion proposals via the 
	//// usual Xtext mechanisms.
	////
	//AnnotationTargetType:
	//	ID;
	public BaseGrammarAccess.AnnotationTargetTypeElements getAnnotationTargetTypeAccess() {
		return gaBase.getAnnotationTargetTypeAccess();
	}
	
	public ParserRule getAnnotationTargetTypeRule() {
		return getAnnotationTargetTypeAccess().getRule();
	}

	//AnnotationAttribute:
	//	SimpleAnnotationAttribute | EnumAnnotationAttribute;
	public BaseGrammarAccess.AnnotationAttributeElements getAnnotationAttributeAccess() {
		return gaBase.getAnnotationAttributeAccess();
	}
	
	public ParserRule getAnnotationAttributeRule() {
		return getAnnotationAttributeAccess().getRule();
	}

	//SimpleAnnotationAttribute:
	//	(optional?="optional" | "mandatory") "attribute" name=ID ":" type=LiteralType;
	public BaseGrammarAccess.SimpleAnnotationAttributeElements getSimpleAnnotationAttributeAccess() {
		return gaBase.getSimpleAnnotationAttributeAccess();
	}
	
	public ParserRule getSimpleAnnotationAttributeRule() {
		return getSimpleAnnotationAttributeAccess().getRule();
	}

	//EnumAnnotationAttribute:
	//	(optional?="optional" | "mandatory") "attribute" name=ID ":" "{" values+=STRING ("," values+=STRING)* "}";
	public BaseGrammarAccess.EnumAnnotationAttributeElements getEnumAnnotationAttributeAccess() {
		return gaBase.getEnumAnnotationAttributeAccess();
	}
	
	public ParserRule getEnumAnnotationAttributeRule() {
		return getEnumAnnotationAttributeAccess().getRule();
	}

	//// **************************************************************
	//// Import rules
	//// HOWTO: use a combination of URI global scopes and namespace aware local scope provider
	//// this is configured in the work flow by
	////			fragment = scoping.ImportURIScopingFragment {}
	//// and by overriding configureIScopeProviderDelegate in the runtime module with 
	////			ImportedNamespaceAwareLocalScopeProvider
	//// also configure in the RuntimeModule
	////	public Class<? extends ImportUriResolver> bindImportUriResolver() {
	////		return PlatformRelativeUriResolver.class;
	////	}
	//// and in the UiRuntimeModule
	////	public Class<? extends org.eclipse.xtext.ui.editor.IURIEditorOpener> bindIURIEditorOpener() {
	////		return GlobalNonPlatformURIEditorOpener.class;
	////	}
	////	public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() {
	////		return ImportAwareHyperlinkHelper.class;
	////	}
	//// the attribute 'importedNamespace' is picked up by the ImportedNamespaceAwareLocalScopeProvider
	//// the attribute 'importURI' is picked up by the ImportUriGlobalScopeProvider
	//Import:
	//	"import" (importedNamespace=ImportedFQN "from" | "model") importURI=STRING;
	public BaseGrammarAccess.ImportElements getImportAccess() {
		return gaBase.getImportAccess();
	}
	
	public ParserRule getImportRule() {
		return getImportAccess().getRule();
	}

	//ImportedFQN:
	//	FQN ".*"?;
	public BaseGrammarAccess.ImportedFQNElements getImportedFQNAccess() {
		return gaBase.getImportedFQNAccess();
	}
	
	public ParserRule getImportedFQNRule() {
		return getImportedFQNAccess().getRule();
	}

	//// **************************************************************
	//// Documentation Rule
	//Documentation:
	//	{Documentation} "[" lines+=STRING* "]";
	public BaseGrammarAccess.DocumentationElements getDocumentationAccess() {
		return gaBase.getDocumentationAccess();
	}
	
	public ParserRule getDocumentationRule() {
		return getDocumentationAccess().getRule();
	}

	//// **************************************************************
	//// Time Rule
	//TIME returns ecore::ELong:
	//	INT "s" | INT "ms" | INT "us" | INT "ns";
	public BaseGrammarAccess.TIMEElements getTIMEAccess() {
		return gaBase.getTIMEAccess();
	}
	
	public ParserRule getTIMERule() {
		return getTIMEAccess().getRule();
	}

	//// **************************************************************
	//// Literal Rules
	//enum LiteralType:
	//	BOOL="ptBoolean" | INT="ptInteger" | REAL="ptReal" | CHAR="ptCharacter";
	public BaseGrammarAccess.LiteralTypeElements getLiteralTypeAccess() {
		return gaBase.getLiteralTypeAccess();
	}
	
	public EnumRule getLiteralTypeRule() {
		return getLiteralTypeAccess().getRule();
	}

	//LiteralArray:
	//	literals+=Literal ("," literals+=Literal)*;
	public BaseGrammarAccess.LiteralArrayElements getLiteralArrayAccess() {
		return gaBase.getLiteralArrayAccess();
	}
	
	public ParserRule getLiteralArrayRule() {
		return getLiteralArrayAccess().getRule();
	}

	//// Value Types for Attributes
	//Literal:
	//	BooleanLiteral | NumberLiteral | StringLiteral;
	public BaseGrammarAccess.LiteralElements getLiteralAccess() {
		return gaBase.getLiteralAccess();
	}
	
	public ParserRule getLiteralRule() {
		return getLiteralAccess().getRule();
	}

	//BooleanLiteral:
	//	{BooleanLiteral} ("false" | isTrue?="true");
	public BaseGrammarAccess.BooleanLiteralElements getBooleanLiteralAccess() {
		return gaBase.getBooleanLiteralAccess();
	}
	
	public ParserRule getBooleanLiteralRule() {
		return getBooleanLiteralAccess().getRule();
	}

	//NumberLiteral:
	//	IntLiteral | RealLiteral;
	public BaseGrammarAccess.NumberLiteralElements getNumberLiteralAccess() {
		return gaBase.getNumberLiteralAccess();
	}
	
	public ParserRule getNumberLiteralRule() {
		return getNumberLiteralAccess().getRule();
	}

	//RealLiteral:
	//	{RealLiteral} value=Real;
	public BaseGrammarAccess.RealLiteralElements getRealLiteralAccess() {
		return gaBase.getRealLiteralAccess();
	}
	
	public ParserRule getRealLiteralRule() {
		return getRealLiteralAccess().getRule();
	}

	//IntLiteral:
	//	{IntLiteral} value=Integer;
	public BaseGrammarAccess.IntLiteralElements getIntLiteralAccess() {
		return gaBase.getIntLiteralAccess();
	}
	
	public ParserRule getIntLiteralRule() {
		return getIntLiteralAccess().getRule();
	}

	//StringLiteral:
	//	{StringLiteral} value=STRING;
	public BaseGrammarAccess.StringLiteralElements getStringLiteralAccess() {
		return gaBase.getStringLiteralAccess();
	}
	
	public ParserRule getStringLiteralRule() {
		return getStringLiteralAccess().getRule();
	}

	//Integer returns ecore::ELong:
	//	SignedInteger | Hexadecimal;
	public BaseGrammarAccess.IntegerElements getIntegerAccess() {
		return gaBase.getIntegerAccess();
	}
	
	public ParserRule getIntegerRule() {
		return getIntegerAccess().getRule();
	}

	//SignedInteger hidden():
	//	("+" | "-")? INT;
	public BaseGrammarAccess.SignedIntegerElements getSignedIntegerAccess() {
		return gaBase.getSignedIntegerAccess();
	}
	
	public ParserRule getSignedIntegerRule() {
		return getSignedIntegerAccess().getRule();
	}

	//Hexadecimal hidden():
	//	HEX;
	public BaseGrammarAccess.HexadecimalElements getHexadecimalAccess() {
		return gaBase.getHexadecimalAccess();
	}
	
	public ParserRule getHexadecimalRule() {
		return getHexadecimalAccess().getRule();
	}

	//Real returns ecore::EDouble:
	//	Decimal | DotDecimal | DecimalDot | DecimalExp;
	public BaseGrammarAccess.RealElements getRealAccess() {
		return gaBase.getRealAccess();
	}
	
	public ParserRule getRealRule() {
		return getRealAccess().getRule();
	}

	//Decimal hidden():
	//	("+" | "-")? INT "." INT;
	public BaseGrammarAccess.DecimalElements getDecimalAccess() {
		return gaBase.getDecimalAccess();
	}
	
	public ParserRule getDecimalRule() {
		return getDecimalAccess().getRule();
	}

	//DotDecimal hidden():
	//	("+" | "-")? "." INT;
	public BaseGrammarAccess.DotDecimalElements getDotDecimalAccess() {
		return gaBase.getDotDecimalAccess();
	}
	
	public ParserRule getDotDecimalRule() {
		return getDotDecimalAccess().getRule();
	}

	//DecimalDot hidden():
	//	("+" | "-")? INT ".";
	public BaseGrammarAccess.DecimalDotElements getDecimalDotAccess() {
		return gaBase.getDecimalDotAccess();
	}
	
	public ParserRule getDecimalDotRule() {
		return getDecimalDotAccess().getRule();
	}

	//DecimalExp hidden():
	//	("+" | "-")? INT "." INT EXP;
	public BaseGrammarAccess.DecimalExpElements getDecimalExpAccess() {
		return gaBase.getDecimalExpAccess();
	}
	
	public ParserRule getDecimalExpRule() {
		return getDecimalExpAccess().getRule();
	}

	//terminal EXP:
	//	("e" | "E") ("+" | "-")? "0".."9"+;
	public TerminalRule getEXPRule() {
		return gaBase.getEXPRule();
	} 

	//terminal HEX:
	//	("0x" | "0X") ("0".."9" | "a".."f" | "A".."F")+;
	public TerminalRule getHEXRule() {
		return gaBase.getHEXRule();
	} 

	//FQN:
	//	ID ("." ID)*;
	public BaseGrammarAccess.FQNElements getFQNAccess() {
		return gaBase.getFQNAccess();
	}
	
	public ParserRule getFQNRule() {
		return getFQNAccess().getRule();
	}

	//terminal ID:
	//	"^"? ("a".."z" | "A".."Z" | "_") ("a".."z" | "A".."Z" | "_" | "0".."9")*;
	public TerminalRule getIDRule() {
		return gaBase.getIDRule();
	} 

	//terminal INT returns ecore::EInt:
	//	"0".."9"+;
	public TerminalRule getINTRule() {
		return gaBase.getINTRule();
	} 

	//terminal STRING:
	//	"\"" ("\\" ("b" | "t" | "n" | "f" | "r" | "u" | "\"" | "\'" | "\\") | !("\\" | "\""))* "\"" | "\'" ("\\" ("b" | "t" |
	//	"n" | "f" | "r" | "u" | "\"" | "\'" | "\\") | !("\\" | "\'"))* "\'";
	public TerminalRule getSTRINGRule() {
		return gaBase.getSTRINGRule();
	} 

	//terminal ML_COMMENT:
	//	"/ *"->"* /";
	public TerminalRule getML_COMMENTRule() {
		return gaBase.getML_COMMENTRule();
	} 

	//terminal SL_COMMENT:
	//	"//" !("\n" | "\r")* ("\r"? "\n")?;
	public TerminalRule getSL_COMMENTRule() {
		return gaBase.getSL_COMMENTRule();
	} 

	//terminal WS:
	//	(" " | "\t" | "\r" | "\n")+;
	public TerminalRule getWSRule() {
		return gaBase.getWSRule();
	} 

	//terminal ANY_OTHER:
	//	.;
	public TerminalRule getANY_OTHERRule() {
		return gaBase.getANY_OTHERRule();
	} 
}

Back to the top