-
Notifications
You must be signed in to change notification settings - Fork 317
/
InternalRefactoringTestLanguage1.g
248 lines (220 loc) · 5.8 KB
/
InternalRefactoringTestLanguage1.g
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
/*******************************************************************************
* Copyright (c) 2010, 2024 itemis AG (http://www.itemis.eu) and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
grammar InternalRefactoringTestLanguage1;
options {
superClass=AbstractInternalAntlrParser;
}
@lexer::header {
package org.eclipse.xtext.common.types.xtext.ui.parser.antlr.internal;
// Hack: Use our own Lexer superclass by means of import.
// Currently there is no other way to specify the superclass for the lexer.
import org.eclipse.xtext.parser.antlr.Lexer;
}
@parser::header {
package org.eclipse.xtext.common.types.xtext.ui.parser.antlr.internal;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.*;
import org.eclipse.xtext.parser.impl.*;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.parser.antlr.AbstractInternalAntlrParser;
import org.eclipse.xtext.parser.antlr.XtextTokenStream;
import org.eclipse.xtext.parser.antlr.XtextTokenStream.HiddenTokens;
import org.eclipse.xtext.parser.antlr.AntlrDatatypeRuleToken;
import org.eclipse.xtext.common.types.xtext.ui.services.RefactoringTestLanguage1GrammarAccess;
}
@parser::members {
private RefactoringTestLanguage1GrammarAccess grammarAccess;
public InternalRefactoringTestLanguage1Parser(TokenStream input, RefactoringTestLanguage1GrammarAccess grammarAccess) {
this(input);
this.grammarAccess = grammarAccess;
registerRules(grammarAccess.getGrammar());
}
@Override
protected String getFirstRuleName() {
return "Entry";
}
@Override
protected RefactoringTestLanguage1GrammarAccess getGrammarAccess() {
return grammarAccess;
}
}
@rulecatch {
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
}
// Entry rule entryRuleEntry
entryRuleEntry returns [EObject current=null]:
{ newCompositeNode(grammarAccess.getEntryRule()); }
iv_ruleEntry=ruleEntry
{ $current=$iv_ruleEntry.current; }
EOF;
// Rule Entry
ruleEntry returns [EObject current=null]
@init {
enterRule();
}
@after {
leaveRule();
}:
{
newCompositeNode(grammarAccess.getEntryAccess().getModelParserRuleCall());
}
this_Model_0=ruleModel
{
$current = $this_Model_0.current;
afterParserOrEnumRuleCall();
}
;
// Entry rule entryRuleModel
entryRuleModel returns [EObject current=null]:
{ newCompositeNode(grammarAccess.getModelRule()); }
iv_ruleModel=ruleModel
{ $current=$iv_ruleModel.current; }
EOF;
// Rule Model
ruleModel returns [EObject current=null]
@init {
enterRule();
}
@after {
leaveRule();
}:
(
(
{
newCompositeNode(grammarAccess.getModelAccess().getReferenceHolderReferenceHolderParserRuleCall_0());
}
lv_referenceHolder_0_0=ruleReferenceHolder
{
if ($current==null) {
$current = createModelElementForParent(grammarAccess.getModelRule());
}
add(
$current,
"referenceHolder",
lv_referenceHolder_0_0,
"org.eclipse.xtext.common.types.xtext.ui.RefactoringTestLanguage.ReferenceHolder");
afterParserOrEnumRuleCall();
}
)
)*
;
// Entry rule entryRuleReferenceHolder
entryRuleReferenceHolder returns [EObject current=null]:
{ newCompositeNode(grammarAccess.getReferenceHolderRule()); }
iv_ruleReferenceHolder=ruleReferenceHolder
{ $current=$iv_ruleReferenceHolder.current; }
EOF;
// Rule ReferenceHolder
ruleReferenceHolder returns [EObject current=null]
@init {
enterRule();
}
@after {
leaveRule();
}:
(
(
(
lv_name_0_0=RULE_ID
{
newLeafNode(lv_name_0_0, grammarAccess.getReferenceHolderAccess().getNameIDTerminalRuleCall_0_0());
}
{
if ($current==null) {
$current = createModelElement(grammarAccess.getReferenceHolderRule());
}
setWithLastConsumed(
$current,
"name",
lv_name_0_0,
"org.eclipse.xtext.common.Terminals.ID");
}
)
)
(
(
{
if ($current==null) {
$current = createModelElement(grammarAccess.getReferenceHolderRule());
}
}
{
newCompositeNode(grammarAccess.getReferenceHolderAccess().getDefaultReferenceJvmTypeCrossReference_1_0());
}
ruleFQN
{
afterParserOrEnumRuleCall();
}
)
)
)
;
// Entry rule entryRuleFQN
entryRuleFQN returns [String current=null]:
{ newCompositeNode(grammarAccess.getFQNRule()); }
iv_ruleFQN=ruleFQN
{ $current=$iv_ruleFQN.current.getText(); }
EOF;
// Rule FQN
ruleFQN returns [AntlrDatatypeRuleToken current=new AntlrDatatypeRuleToken()]
@init {
enterRule();
}
@after {
leaveRule();
}:
(
this_ID_0=RULE_ID
{
$current.merge(this_ID_0);
}
{
newLeafNode(this_ID_0, grammarAccess.getFQNAccess().getIDTerminalRuleCall_0());
}
(
kw='.'
{
$current.merge(kw);
newLeafNode(kw, grammarAccess.getFQNAccess().getFullStopKeyword_1_0());
}
this_ID_2=RULE_ID
{
$current.merge(this_ID_2);
}
{
newLeafNode(this_ID_2, grammarAccess.getFQNAccess().getIDTerminalRuleCall_1_1());
}
)*
(
kw='$'
{
$current.merge(kw);
newLeafNode(kw, grammarAccess.getFQNAccess().getDollarSignKeyword_2_0());
}
this_ID_4=RULE_ID
{
$current.merge(this_ID_4);
}
{
newLeafNode(this_ID_4, grammarAccess.getFQNAccess().getIDTerminalRuleCall_2_1());
}
)*
)
;
RULE_ID : '^'? ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*;
RULE_INT : ('0'..'9')+;
RULE_STRING : ('"' ('\\' .|~(('\\'|'"')))* '"'|'\'' ('\\' .|~(('\\'|'\'')))* '\'');
RULE_ML_COMMENT : '/*' ( options {greedy=false;} : . )*'*/';
RULE_SL_COMMENT : '//' ~(('\n'|'\r'))* ('\r'? '\n')?;
RULE_WS : (' '|'\t'|'\r'|'\n')+;
RULE_ANY_OTHER : .;