rsense-core 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +1 -0
- data/README.md +35 -0
- data/Rakefile +84 -0
- data/TypeAnnotation.tokens +41 -0
- data/build.xml +84 -0
- data/build_lib/antlr-3.2.jar +0 -0
- data/lib/jars/ant-1.7.0.jar +0 -0
- data/lib/jars/ant-launcher-1.7.0.jar +0 -0
- data/lib/jars/antlr-runtime-3.2.jar +0 -0
- data/lib/jars/bsf-2.3.0.jar +0 -0
- data/lib/rsense-core.rb +28 -0
- data/lib/rsense.jar +0 -0
- data/lib/rsense/core.rb +5 -0
- data/lib/rsense/core/version.rb +5 -0
- data/lib/rsense/parser.rb +6 -0
- data/lib/rsense/ruby.rb +19 -0
- data/lib/rsense/typing.rb +13 -0
- data/lib/rsense/typing/annotation.rb +20 -0
- data/lib/rsense/typing/runtime.rb +23 -0
- data/lib/rsense/typing/vertex.rb +15 -0
- data/lib/rsense/util.rb +9 -0
- data/rsense-core.gemspec +30 -0
- data/src/org/cx4a/rsense/CodeAssist.java +744 -0
- data/src/org/cx4a/rsense/CodeAssistError.java +31 -0
- data/src/org/cx4a/rsense/CodeAssistResult.java +42 -0
- data/src/org/cx4a/rsense/CodeCompletionResult.java +65 -0
- data/src/org/cx4a/rsense/FindDefinitionResult.java +24 -0
- data/src/org/cx4a/rsense/LoadResult.java +19 -0
- data/src/org/cx4a/rsense/Main.java +916 -0
- data/src/org/cx4a/rsense/Options.java +353 -0
- data/src/org/cx4a/rsense/Project.java +103 -0
- data/src/org/cx4a/rsense/TypeInferenceResult.java +25 -0
- data/src/org/cx4a/rsense/WhereResult.java +19 -0
- data/src/org/cx4a/rsense/parser/TypeAnnotation.g +221 -0
- data/src/org/cx4a/rsense/parser/TypeAnnotationLexer.java +1759 -0
- data/src/org/cx4a/rsense/parser/TypeAnnotationParser.java +2025 -0
- data/src/org/cx4a/rsense/ruby/Block.java +10 -0
- data/src/org/cx4a/rsense/ruby/Context.java +75 -0
- data/src/org/cx4a/rsense/ruby/DynamicMethod.java +10 -0
- data/src/org/cx4a/rsense/ruby/DynamicScope.java +51 -0
- data/src/org/cx4a/rsense/ruby/Frame.java +95 -0
- data/src/org/cx4a/rsense/ruby/IRubyObject.java +17 -0
- data/src/org/cx4a/rsense/ruby/LocalScope.java +43 -0
- data/src/org/cx4a/rsense/ruby/MetaClass.java +50 -0
- data/src/org/cx4a/rsense/ruby/Ruby.java +242 -0
- data/src/org/cx4a/rsense/ruby/RubyClass.java +146 -0
- data/src/org/cx4a/rsense/ruby/RubyModule.java +255 -0
- data/src/org/cx4a/rsense/ruby/RubyObject.java +94 -0
- data/src/org/cx4a/rsense/ruby/Scope.java +7 -0
- data/src/org/cx4a/rsense/ruby/SpecialObject.java +15 -0
- data/src/org/cx4a/rsense/ruby/Visibility.java +17 -0
- data/src/org/cx4a/rsense/typing/Graph.java +1690 -0
- data/src/org/cx4a/rsense/typing/Propagation.java +73 -0
- data/src/org/cx4a/rsense/typing/Template.java +84 -0
- data/src/org/cx4a/rsense/typing/TemplateAttribute.java +158 -0
- data/src/org/cx4a/rsense/typing/TypeSet.java +48 -0
- data/src/org/cx4a/rsense/typing/annotation/ClassType.java +57 -0
- data/src/org/cx4a/rsense/typing/annotation/MethodType.java +79 -0
- data/src/org/cx4a/rsense/typing/annotation/TypeAnnotation.java +4 -0
- data/src/org/cx4a/rsense/typing/annotation/TypeAny.java +7 -0
- data/src/org/cx4a/rsense/typing/annotation/TypeApplication.java +37 -0
- data/src/org/cx4a/rsense/typing/annotation/TypeConstraint.java +29 -0
- data/src/org/cx4a/rsense/typing/annotation/TypeExpression.java +11 -0
- data/src/org/cx4a/rsense/typing/annotation/TypeIdentity.java +59 -0
- data/src/org/cx4a/rsense/typing/annotation/TypeOptional.java +22 -0
- data/src/org/cx4a/rsense/typing/annotation/TypePragma.java +22 -0
- data/src/org/cx4a/rsense/typing/annotation/TypeSplat.java +22 -0
- data/src/org/cx4a/rsense/typing/annotation/TypeTuple.java +35 -0
- data/src/org/cx4a/rsense/typing/annotation/TypeUnion.java +23 -0
- data/src/org/cx4a/rsense/typing/annotation/TypeVariable.java +44 -0
- data/src/org/cx4a/rsense/typing/runtime/AliasMethod.java +94 -0
- data/src/org/cx4a/rsense/typing/runtime/AnnotationHelper.java +69 -0
- data/src/org/cx4a/rsense/typing/runtime/AnnotationResolver.java +523 -0
- data/src/org/cx4a/rsense/typing/runtime/Array.java +84 -0
- data/src/org/cx4a/rsense/typing/runtime/ClassTag.java +27 -0
- data/src/org/cx4a/rsense/typing/runtime/DefaultMethod.java +115 -0
- data/src/org/cx4a/rsense/typing/runtime/Hash.java +131 -0
- data/src/org/cx4a/rsense/typing/runtime/LoopTag.java +21 -0
- data/src/org/cx4a/rsense/typing/runtime/Method.java +32 -0
- data/src/org/cx4a/rsense/typing/runtime/MonomorphicObject.java +77 -0
- data/src/org/cx4a/rsense/typing/runtime/ObjectAllocator.java +40 -0
- data/src/org/cx4a/rsense/typing/runtime/PolymorphicObject.java +90 -0
- data/src/org/cx4a/rsense/typing/runtime/Proc.java +100 -0
- data/src/org/cx4a/rsense/typing/runtime/RuntimeHelper.java +1339 -0
- data/src/org/cx4a/rsense/typing/runtime/SpecialMethod.java +119 -0
- data/src/org/cx4a/rsense/typing/runtime/TypeVarMap.java +112 -0
- data/src/org/cx4a/rsense/typing/runtime/VertexHolder.java +48 -0
- data/src/org/cx4a/rsense/typing/vertex/CallVertex.java +122 -0
- data/src/org/cx4a/rsense/typing/vertex/MultipleAsgnVertex.java +23 -0
- data/src/org/cx4a/rsense/typing/vertex/PassThroughVertex.java +20 -0
- data/src/org/cx4a/rsense/typing/vertex/SValueVertex.java +24 -0
- data/src/org/cx4a/rsense/typing/vertex/SplatVertex.java +24 -0
- data/src/org/cx4a/rsense/typing/vertex/ToAryVertex.java +24 -0
- data/src/org/cx4a/rsense/typing/vertex/TypeVarVertex.java +22 -0
- data/src/org/cx4a/rsense/typing/vertex/Vertex.java +221 -0
- data/src/org/cx4a/rsense/typing/vertex/YieldVertex.java +70 -0
- data/src/org/cx4a/rsense/util/HereDocReader.java +48 -0
- data/src/org/cx4a/rsense/util/Logger.java +111 -0
- data/src/org/cx4a/rsense/util/NodeUtil.java +198 -0
- data/src/org/cx4a/rsense/util/SourceLocation.java +70 -0
- data/src/org/cx4a/rsense/util/StringUtil.java +63 -0
- data/src/resources/org/cx4a/rsense/rsense.properties +1 -0
- data/stubs/1.8/_builtin.rb +3006 -0
- data/stubs/1.8/bigdecimal.rb +131 -0
- data/stubs/1.8/cgi.rb +257 -0
- data/stubs/1.8/date.rb +147 -0
- data/stubs/1.8/optparse.rb +113 -0
- data/stubs/1.8/rational.rb +47 -0
- data/stubs/1.8/set.rb +94 -0
- data/stubs/1.8/socket.rb +461 -0
- data/stubs/1.8/stringio.rb +129 -0
- data/test/data/a file.rb +1 -0
- data/test/data/benchmark.rb +12 -0
- data/test/data/crlf.rb +5 -0
- data/test/data/test.rb +19 -0
- data/test/script/all.rsense +2 -0
- data/test/script/array_dynamic.rsense +25 -0
- data/test/script/block_nested.rsense +7 -0
- data/test/script/builtin.rsense +785 -0
- data/test/script/class_method_partial_update.rsense +52 -0
- data/test/script/class_partial_update.rsense +17 -0
- data/test/script/find-definition.rsense +72 -0
- data/test/script/method_arg_onearg.rsense +6 -0
- data/test/script/method_arg_optional.rsense +7 -0
- data/test/script/method_partial_update.rsense +14 -0
- data/test/script/method_yield_arrayarg.rsense +8 -0
- data/test/script/method_yield_arrayarg_expand.rsense +8 -0
- data/test/script/method_yield_arrayarg_splat.rsense +17 -0
- data/test/script/misc.rsense +2 -0
- data/test/script/proc_higher_order.rsense +22 -0
- data/test/script/regression.rsense +95 -0
- data/test/script/stdlib.rsense +66 -0
- data/test/script/where.rsense +41 -0
- metadata +315 -0
@@ -0,0 +1,2025 @@
|
|
1
|
+
// $ANTLR 3.2 Sep 23, 2009 12:02:23 /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g 2014-05-11 02:00:51
|
2
|
+
|
3
|
+
package org.cx4a.rsense.parser;
|
4
|
+
|
5
|
+
import java.util.List;
|
6
|
+
import java.util.ArrayList;
|
7
|
+
import java.util.Collections;
|
8
|
+
|
9
|
+
import org.cx4a.rsense.typing.annotation.TypeAnnotation;
|
10
|
+
import org.cx4a.rsense.typing.annotation.MethodType;
|
11
|
+
import org.cx4a.rsense.typing.annotation.ClassType;
|
12
|
+
import org.cx4a.rsense.typing.annotation.TypeExpression;
|
13
|
+
import org.cx4a.rsense.typing.annotation.TypeVariable;
|
14
|
+
import org.cx4a.rsense.typing.annotation.TypeUnion;
|
15
|
+
import org.cx4a.rsense.typing.annotation.TypeIdentity;
|
16
|
+
import org.cx4a.rsense.typing.annotation.TypeAny;
|
17
|
+
import org.cx4a.rsense.typing.annotation.TypeOptional;
|
18
|
+
import org.cx4a.rsense.typing.annotation.TypeTuple;
|
19
|
+
import org.cx4a.rsense.typing.annotation.TypeSplat;
|
20
|
+
import org.cx4a.rsense.typing.annotation.TypeApplication;
|
21
|
+
import org.cx4a.rsense.typing.annotation.TypeConstraint;
|
22
|
+
import org.cx4a.rsense.typing.annotation.TypePragma;
|
23
|
+
|
24
|
+
|
25
|
+
import org.antlr.runtime.*;
|
26
|
+
import java.util.Stack;
|
27
|
+
import java.util.List;
|
28
|
+
import java.util.ArrayList;
|
29
|
+
import java.util.Map;
|
30
|
+
import java.util.HashMap;
|
31
|
+
public class TypeAnnotationParser extends Parser {
|
32
|
+
public static final String[] tokenNames = new String[] {
|
33
|
+
"<invalid>", "<EOR>", "<DOWN>", "<UP>", "ID", "CONST_ID", "METHOD_NAME", "METHOD_NAME_UNQUOTED", "WHITEESPACE", "'::'", "'.'", "'<'", "'|'", "'>'", "'('", "')'", "'->'", "'{'", "'}'", "'<='", "','", "'!nobody'", "'['", "']'", "'?'", "'*'", "'or'"
|
34
|
+
};
|
35
|
+
public static final int T__26=26;
|
36
|
+
public static final int T__25=25;
|
37
|
+
public static final int T__24=24;
|
38
|
+
public static final int T__23=23;
|
39
|
+
public static final int T__22=22;
|
40
|
+
public static final int T__21=21;
|
41
|
+
public static final int T__20=20;
|
42
|
+
public static final int WHITEESPACE=8;
|
43
|
+
public static final int ID=4;
|
44
|
+
public static final int EOF=-1;
|
45
|
+
public static final int T__9=9;
|
46
|
+
public static final int CONST_ID=5;
|
47
|
+
public static final int METHOD_NAME=6;
|
48
|
+
public static final int T__19=19;
|
49
|
+
public static final int T__16=16;
|
50
|
+
public static final int METHOD_NAME_UNQUOTED=7;
|
51
|
+
public static final int T__15=15;
|
52
|
+
public static final int T__18=18;
|
53
|
+
public static final int T__17=17;
|
54
|
+
public static final int T__12=12;
|
55
|
+
public static final int T__11=11;
|
56
|
+
public static final int T__14=14;
|
57
|
+
public static final int T__13=13;
|
58
|
+
public static final int T__10=10;
|
59
|
+
|
60
|
+
// delegates
|
61
|
+
// delegators
|
62
|
+
|
63
|
+
|
64
|
+
public TypeAnnotationParser(TokenStream input) {
|
65
|
+
this(input, new RecognizerSharedState());
|
66
|
+
}
|
67
|
+
public TypeAnnotationParser(TokenStream input, RecognizerSharedState state) {
|
68
|
+
super(input, state);
|
69
|
+
|
70
|
+
}
|
71
|
+
|
72
|
+
|
73
|
+
public String[] getTokenNames() { return TypeAnnotationParser.tokenNames; }
|
74
|
+
public String getGrammarFileName() { return "/Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g"; }
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
// $ANTLR start "type"
|
81
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:42:1: type returns [TypeAnnotation value] : ( method_type | class_type );
|
82
|
+
public final TypeAnnotation type() throws RecognitionException {
|
83
|
+
TypeAnnotation value = null;
|
84
|
+
|
85
|
+
MethodType method_type1 = null;
|
86
|
+
|
87
|
+
ClassType class_type2 = null;
|
88
|
+
|
89
|
+
|
90
|
+
try {
|
91
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:43:5: ( method_type | class_type )
|
92
|
+
int alt1=2;
|
93
|
+
switch ( input.LA(1) ) {
|
94
|
+
case 9:
|
95
|
+
{
|
96
|
+
int LA1_1 = input.LA(2);
|
97
|
+
|
98
|
+
if ( (synpred1_TypeAnnotation()) ) {
|
99
|
+
alt1=1;
|
100
|
+
}
|
101
|
+
else if ( (true) ) {
|
102
|
+
alt1=2;
|
103
|
+
}
|
104
|
+
else {
|
105
|
+
if (state.backtracking>0) {state.failed=true; return value;}
|
106
|
+
NoViableAltException nvae =
|
107
|
+
new NoViableAltException("", 1, 1, input);
|
108
|
+
|
109
|
+
throw nvae;
|
110
|
+
}
|
111
|
+
}
|
112
|
+
break;
|
113
|
+
case CONST_ID:
|
114
|
+
{
|
115
|
+
int LA1_2 = input.LA(2);
|
116
|
+
|
117
|
+
if ( (synpred1_TypeAnnotation()) ) {
|
118
|
+
alt1=1;
|
119
|
+
}
|
120
|
+
else if ( (true) ) {
|
121
|
+
alt1=2;
|
122
|
+
}
|
123
|
+
else {
|
124
|
+
if (state.backtracking>0) {state.failed=true; return value;}
|
125
|
+
NoViableAltException nvae =
|
126
|
+
new NoViableAltException("", 1, 2, input);
|
127
|
+
|
128
|
+
throw nvae;
|
129
|
+
}
|
130
|
+
}
|
131
|
+
break;
|
132
|
+
case ID:
|
133
|
+
case METHOD_NAME:
|
134
|
+
{
|
135
|
+
alt1=1;
|
136
|
+
}
|
137
|
+
break;
|
138
|
+
default:
|
139
|
+
if (state.backtracking>0) {state.failed=true; return value;}
|
140
|
+
NoViableAltException nvae =
|
141
|
+
new NoViableAltException("", 1, 0, input);
|
142
|
+
|
143
|
+
throw nvae;
|
144
|
+
}
|
145
|
+
|
146
|
+
switch (alt1) {
|
147
|
+
case 1 :
|
148
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:43:7: method_type
|
149
|
+
{
|
150
|
+
pushFollow(FOLLOW_method_type_in_type53);
|
151
|
+
method_type1=method_type();
|
152
|
+
|
153
|
+
state._fsp--;
|
154
|
+
if (state.failed) return value;
|
155
|
+
if ( state.backtracking==0 ) {
|
156
|
+
value = method_type1;
|
157
|
+
}
|
158
|
+
|
159
|
+
}
|
160
|
+
break;
|
161
|
+
case 2 :
|
162
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:44:7: class_type
|
163
|
+
{
|
164
|
+
pushFollow(FOLLOW_class_type_in_type63);
|
165
|
+
class_type2=class_type();
|
166
|
+
|
167
|
+
state._fsp--;
|
168
|
+
if (state.failed) return value;
|
169
|
+
if ( state.backtracking==0 ) {
|
170
|
+
value = class_type2;
|
171
|
+
}
|
172
|
+
|
173
|
+
}
|
174
|
+
break;
|
175
|
+
|
176
|
+
}
|
177
|
+
}
|
178
|
+
catch (RecognitionException re) {
|
179
|
+
reportError(re);
|
180
|
+
recover(input,re);
|
181
|
+
}
|
182
|
+
finally {
|
183
|
+
}
|
184
|
+
return value;
|
185
|
+
}
|
186
|
+
// $ANTLR end "type"
|
187
|
+
|
188
|
+
|
189
|
+
// $ANTLR start "method_type"
|
190
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:47:1: method_type returns [MethodType value] : name= ( ( '::' )? ( ( ID | CONST_ID ) ( '.' | '::' ) )* method_name ) ( '<' ( type_var_list )? ( '|' constraint_list )? '>' )? method_sig ;
|
191
|
+
public final MethodType method_type() throws RecognitionException {
|
192
|
+
MethodType value = null;
|
193
|
+
|
194
|
+
Token name=null;
|
195
|
+
List<TypeVariable> type_var_list3 = null;
|
196
|
+
|
197
|
+
List<TypeConstraint> constraint_list4 = null;
|
198
|
+
|
199
|
+
MethodType.Signature method_sig5 = null;
|
200
|
+
|
201
|
+
|
202
|
+
try {
|
203
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:48:5: (name= ( ( '::' )? ( ( ID | CONST_ID ) ( '.' | '::' ) )* method_name ) ( '<' ( type_var_list )? ( '|' constraint_list )? '>' )? method_sig )
|
204
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:48:7: name= ( ( '::' )? ( ( ID | CONST_ID ) ( '.' | '::' ) )* method_name ) ( '<' ( type_var_list )? ( '|' constraint_list )? '>' )? method_sig
|
205
|
+
{
|
206
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:48:12: ( ( '::' )? ( ( ID | CONST_ID ) ( '.' | '::' ) )* method_name )
|
207
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:48:13: ( '::' )? ( ( ID | CONST_ID ) ( '.' | '::' ) )* method_name
|
208
|
+
{
|
209
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:48:13: ( '::' )?
|
210
|
+
int alt2=2;
|
211
|
+
int LA2_0 = input.LA(1);
|
212
|
+
|
213
|
+
if ( (LA2_0==9) ) {
|
214
|
+
alt2=1;
|
215
|
+
}
|
216
|
+
switch (alt2) {
|
217
|
+
case 1 :
|
218
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:0:0: '::'
|
219
|
+
{
|
220
|
+
match(input,9,FOLLOW_9_in_method_type89); if (state.failed) return value;
|
221
|
+
|
222
|
+
}
|
223
|
+
break;
|
224
|
+
|
225
|
+
}
|
226
|
+
|
227
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:48:19: ( ( ID | CONST_ID ) ( '.' | '::' ) )*
|
228
|
+
loop3:
|
229
|
+
do {
|
230
|
+
int alt3=2;
|
231
|
+
int LA3_0 = input.LA(1);
|
232
|
+
|
233
|
+
if ( ((LA3_0>=ID && LA3_0<=CONST_ID)) ) {
|
234
|
+
int LA3_1 = input.LA(2);
|
235
|
+
|
236
|
+
if ( (synpred5_TypeAnnotation()) ) {
|
237
|
+
alt3=1;
|
238
|
+
}
|
239
|
+
|
240
|
+
|
241
|
+
}
|
242
|
+
|
243
|
+
|
244
|
+
switch (alt3) {
|
245
|
+
case 1 :
|
246
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:48:20: ( ID | CONST_ID ) ( '.' | '::' )
|
247
|
+
{
|
248
|
+
if ( (input.LA(1)>=ID && input.LA(1)<=CONST_ID) ) {
|
249
|
+
input.consume();
|
250
|
+
state.errorRecovery=false;state.failed=false;
|
251
|
+
}
|
252
|
+
else {
|
253
|
+
if (state.backtracking>0) {state.failed=true; return value;}
|
254
|
+
MismatchedSetException mse = new MismatchedSetException(null,input);
|
255
|
+
throw mse;
|
256
|
+
}
|
257
|
+
|
258
|
+
if ( (input.LA(1)>=9 && input.LA(1)<=10) ) {
|
259
|
+
input.consume();
|
260
|
+
state.errorRecovery=false;state.failed=false;
|
261
|
+
}
|
262
|
+
else {
|
263
|
+
if (state.backtracking>0) {state.failed=true; return value;}
|
264
|
+
MismatchedSetException mse = new MismatchedSetException(null,input);
|
265
|
+
throw mse;
|
266
|
+
}
|
267
|
+
|
268
|
+
|
269
|
+
}
|
270
|
+
break;
|
271
|
+
|
272
|
+
default :
|
273
|
+
break loop3;
|
274
|
+
}
|
275
|
+
} while (true);
|
276
|
+
|
277
|
+
pushFollow(FOLLOW_method_name_in_method_type107);
|
278
|
+
method_name();
|
279
|
+
|
280
|
+
state._fsp--;
|
281
|
+
if (state.failed) return value;
|
282
|
+
|
283
|
+
}
|
284
|
+
|
285
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:48:60: ( '<' ( type_var_list )? ( '|' constraint_list )? '>' )?
|
286
|
+
int alt6=2;
|
287
|
+
int LA6_0 = input.LA(1);
|
288
|
+
|
289
|
+
if ( (LA6_0==11) ) {
|
290
|
+
alt6=1;
|
291
|
+
}
|
292
|
+
switch (alt6) {
|
293
|
+
case 1 :
|
294
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:48:61: '<' ( type_var_list )? ( '|' constraint_list )? '>'
|
295
|
+
{
|
296
|
+
match(input,11,FOLLOW_11_in_method_type111); if (state.failed) return value;
|
297
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:48:65: ( type_var_list )?
|
298
|
+
int alt4=2;
|
299
|
+
int LA4_0 = input.LA(1);
|
300
|
+
|
301
|
+
if ( (LA4_0==ID) ) {
|
302
|
+
alt4=1;
|
303
|
+
}
|
304
|
+
switch (alt4) {
|
305
|
+
case 1 :
|
306
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:0:0: type_var_list
|
307
|
+
{
|
308
|
+
pushFollow(FOLLOW_type_var_list_in_method_type113);
|
309
|
+
type_var_list3=type_var_list();
|
310
|
+
|
311
|
+
state._fsp--;
|
312
|
+
if (state.failed) return value;
|
313
|
+
|
314
|
+
}
|
315
|
+
break;
|
316
|
+
|
317
|
+
}
|
318
|
+
|
319
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:48:80: ( '|' constraint_list )?
|
320
|
+
int alt5=2;
|
321
|
+
int LA5_0 = input.LA(1);
|
322
|
+
|
323
|
+
if ( (LA5_0==12) ) {
|
324
|
+
alt5=1;
|
325
|
+
}
|
326
|
+
switch (alt5) {
|
327
|
+
case 1 :
|
328
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:48:81: '|' constraint_list
|
329
|
+
{
|
330
|
+
match(input,12,FOLLOW_12_in_method_type117); if (state.failed) return value;
|
331
|
+
pushFollow(FOLLOW_constraint_list_in_method_type119);
|
332
|
+
constraint_list4=constraint_list();
|
333
|
+
|
334
|
+
state._fsp--;
|
335
|
+
if (state.failed) return value;
|
336
|
+
|
337
|
+
}
|
338
|
+
break;
|
339
|
+
|
340
|
+
}
|
341
|
+
|
342
|
+
match(input,13,FOLLOW_13_in_method_type123); if (state.failed) return value;
|
343
|
+
|
344
|
+
}
|
345
|
+
break;
|
346
|
+
|
347
|
+
}
|
348
|
+
|
349
|
+
pushFollow(FOLLOW_method_sig_in_method_type127);
|
350
|
+
method_sig5=method_sig();
|
351
|
+
|
352
|
+
state._fsp--;
|
353
|
+
if (state.failed) return value;
|
354
|
+
if ( state.backtracking==0 ) {
|
355
|
+
|
356
|
+
value = new MethodType((name!=null?name.getText():null), type_var_list3, constraint_list4, method_sig5);
|
357
|
+
|
358
|
+
}
|
359
|
+
|
360
|
+
}
|
361
|
+
|
362
|
+
}
|
363
|
+
catch (RecognitionException re) {
|
364
|
+
reportError(re);
|
365
|
+
recover(input,re);
|
366
|
+
}
|
367
|
+
finally {
|
368
|
+
}
|
369
|
+
return value;
|
370
|
+
}
|
371
|
+
// $ANTLR end "method_type"
|
372
|
+
|
373
|
+
|
374
|
+
// $ANTLR start "method_sig"
|
375
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:53:1: method_sig returns [MethodType.Signature value] : ( '(' ')' ( block )? '->' type_expr | t1= type_expr ( block )? '->' t2= type_expr );
|
376
|
+
public final MethodType.Signature method_sig() throws RecognitionException {
|
377
|
+
MethodType.Signature value = null;
|
378
|
+
|
379
|
+
TypeExpression t1 = null;
|
380
|
+
|
381
|
+
TypeExpression t2 = null;
|
382
|
+
|
383
|
+
MethodType.Block block6 = null;
|
384
|
+
|
385
|
+
TypeExpression type_expr7 = null;
|
386
|
+
|
387
|
+
MethodType.Block block8 = null;
|
388
|
+
|
389
|
+
|
390
|
+
try {
|
391
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:54:5: ( '(' ')' ( block )? '->' type_expr | t1= type_expr ( block )? '->' t2= type_expr )
|
392
|
+
int alt9=2;
|
393
|
+
int LA9_0 = input.LA(1);
|
394
|
+
|
395
|
+
if ( (LA9_0==14) ) {
|
396
|
+
int LA9_1 = input.LA(2);
|
397
|
+
|
398
|
+
if ( (LA9_1==15) ) {
|
399
|
+
alt9=1;
|
400
|
+
}
|
401
|
+
else if ( ((LA9_1>=ID && LA9_1<=CONST_ID)||LA9_1==9||LA9_1==14||LA9_1==22||(LA9_1>=24 && LA9_1<=25)) ) {
|
402
|
+
alt9=2;
|
403
|
+
}
|
404
|
+
else {
|
405
|
+
if (state.backtracking>0) {state.failed=true; return value;}
|
406
|
+
NoViableAltException nvae =
|
407
|
+
new NoViableAltException("", 9, 1, input);
|
408
|
+
|
409
|
+
throw nvae;
|
410
|
+
}
|
411
|
+
}
|
412
|
+
else if ( ((LA9_0>=ID && LA9_0<=CONST_ID)||LA9_0==9||LA9_0==22||(LA9_0>=24 && LA9_0<=25)) ) {
|
413
|
+
alt9=2;
|
414
|
+
}
|
415
|
+
else {
|
416
|
+
if (state.backtracking>0) {state.failed=true; return value;}
|
417
|
+
NoViableAltException nvae =
|
418
|
+
new NoViableAltException("", 9, 0, input);
|
419
|
+
|
420
|
+
throw nvae;
|
421
|
+
}
|
422
|
+
switch (alt9) {
|
423
|
+
case 1 :
|
424
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:54:7: '(' ')' ( block )? '->' type_expr
|
425
|
+
{
|
426
|
+
match(input,14,FOLLOW_14_in_method_sig150); if (state.failed) return value;
|
427
|
+
match(input,15,FOLLOW_15_in_method_sig152); if (state.failed) return value;
|
428
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:54:15: ( block )?
|
429
|
+
int alt7=2;
|
430
|
+
int LA7_0 = input.LA(1);
|
431
|
+
|
432
|
+
if ( (LA7_0==17) ) {
|
433
|
+
alt7=1;
|
434
|
+
}
|
435
|
+
switch (alt7) {
|
436
|
+
case 1 :
|
437
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:0:0: block
|
438
|
+
{
|
439
|
+
pushFollow(FOLLOW_block_in_method_sig154);
|
440
|
+
block6=block();
|
441
|
+
|
442
|
+
state._fsp--;
|
443
|
+
if (state.failed) return value;
|
444
|
+
|
445
|
+
}
|
446
|
+
break;
|
447
|
+
|
448
|
+
}
|
449
|
+
|
450
|
+
match(input,16,FOLLOW_16_in_method_sig157); if (state.failed) return value;
|
451
|
+
pushFollow(FOLLOW_type_expr_in_method_sig159);
|
452
|
+
type_expr7=type_expr();
|
453
|
+
|
454
|
+
state._fsp--;
|
455
|
+
if (state.failed) return value;
|
456
|
+
if ( state.backtracking==0 ) {
|
457
|
+
value = new MethodType.Signature(null, block6, type_expr7);
|
458
|
+
}
|
459
|
+
|
460
|
+
}
|
461
|
+
break;
|
462
|
+
case 2 :
|
463
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:55:7: t1= type_expr ( block )? '->' t2= type_expr
|
464
|
+
{
|
465
|
+
pushFollow(FOLLOW_type_expr_in_method_sig171);
|
466
|
+
t1=type_expr();
|
467
|
+
|
468
|
+
state._fsp--;
|
469
|
+
if (state.failed) return value;
|
470
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:55:20: ( block )?
|
471
|
+
int alt8=2;
|
472
|
+
int LA8_0 = input.LA(1);
|
473
|
+
|
474
|
+
if ( (LA8_0==17) ) {
|
475
|
+
alt8=1;
|
476
|
+
}
|
477
|
+
switch (alt8) {
|
478
|
+
case 1 :
|
479
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:0:0: block
|
480
|
+
{
|
481
|
+
pushFollow(FOLLOW_block_in_method_sig173);
|
482
|
+
block8=block();
|
483
|
+
|
484
|
+
state._fsp--;
|
485
|
+
if (state.failed) return value;
|
486
|
+
|
487
|
+
}
|
488
|
+
break;
|
489
|
+
|
490
|
+
}
|
491
|
+
|
492
|
+
match(input,16,FOLLOW_16_in_method_sig176); if (state.failed) return value;
|
493
|
+
pushFollow(FOLLOW_type_expr_in_method_sig180);
|
494
|
+
t2=type_expr();
|
495
|
+
|
496
|
+
state._fsp--;
|
497
|
+
if (state.failed) return value;
|
498
|
+
if ( state.backtracking==0 ) {
|
499
|
+
value = new MethodType.Signature(t1, block8, t2);
|
500
|
+
}
|
501
|
+
|
502
|
+
}
|
503
|
+
break;
|
504
|
+
|
505
|
+
}
|
506
|
+
}
|
507
|
+
catch (RecognitionException re) {
|
508
|
+
reportError(re);
|
509
|
+
recover(input,re);
|
510
|
+
}
|
511
|
+
finally {
|
512
|
+
}
|
513
|
+
return value;
|
514
|
+
}
|
515
|
+
// $ANTLR end "method_sig"
|
516
|
+
|
517
|
+
|
518
|
+
// $ANTLR start "block"
|
519
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:58:1: block returns [MethodType.Block value] : '{' method_sig '}' ;
|
520
|
+
public final MethodType.Block block() throws RecognitionException {
|
521
|
+
MethodType.Block value = null;
|
522
|
+
|
523
|
+
MethodType.Signature method_sig9 = null;
|
524
|
+
|
525
|
+
|
526
|
+
try {
|
527
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:59:5: ( '{' method_sig '}' )
|
528
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:59:7: '{' method_sig '}'
|
529
|
+
{
|
530
|
+
match(input,17,FOLLOW_17_in_block203); if (state.failed) return value;
|
531
|
+
pushFollow(FOLLOW_method_sig_in_block205);
|
532
|
+
method_sig9=method_sig();
|
533
|
+
|
534
|
+
state._fsp--;
|
535
|
+
if (state.failed) return value;
|
536
|
+
match(input,18,FOLLOW_18_in_block207); if (state.failed) return value;
|
537
|
+
if ( state.backtracking==0 ) {
|
538
|
+
value = new MethodType.Block(method_sig9);
|
539
|
+
}
|
540
|
+
|
541
|
+
}
|
542
|
+
|
543
|
+
}
|
544
|
+
catch (RecognitionException re) {
|
545
|
+
reportError(re);
|
546
|
+
recover(input,re);
|
547
|
+
}
|
548
|
+
finally {
|
549
|
+
}
|
550
|
+
return value;
|
551
|
+
}
|
552
|
+
// $ANTLR end "block"
|
553
|
+
|
554
|
+
|
555
|
+
// $ANTLR start "method_name"
|
556
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:62:1: method_name : ( METHOD_NAME | ID | CONST_ID );
|
557
|
+
public final void method_name() throws RecognitionException {
|
558
|
+
try {
|
559
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:63:5: ( METHOD_NAME | ID | CONST_ID )
|
560
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:
|
561
|
+
{
|
562
|
+
if ( (input.LA(1)>=ID && input.LA(1)<=METHOD_NAME) ) {
|
563
|
+
input.consume();
|
564
|
+
state.errorRecovery=false;state.failed=false;
|
565
|
+
}
|
566
|
+
else {
|
567
|
+
if (state.backtracking>0) {state.failed=true; return ;}
|
568
|
+
MismatchedSetException mse = new MismatchedSetException(null,input);
|
569
|
+
throw mse;
|
570
|
+
}
|
571
|
+
|
572
|
+
|
573
|
+
}
|
574
|
+
|
575
|
+
}
|
576
|
+
catch (RecognitionException re) {
|
577
|
+
reportError(re);
|
578
|
+
recover(input,re);
|
579
|
+
}
|
580
|
+
finally {
|
581
|
+
}
|
582
|
+
return ;
|
583
|
+
}
|
584
|
+
// $ANTLR end "method_name"
|
585
|
+
|
586
|
+
|
587
|
+
// $ANTLR start "class_type"
|
588
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:68:1: class_type returns [ClassType value] : name= ( ( '::' )? ( CONST_ID '::' )* CONST_ID ) ( '<' ( type_var_list )? ( '|' constraint_list )? '>' )? ( pragma_list )? ;
|
589
|
+
public final ClassType class_type() throws RecognitionException {
|
590
|
+
ClassType value = null;
|
591
|
+
|
592
|
+
Token name=null;
|
593
|
+
List<TypeVariable> type_var_list10 = null;
|
594
|
+
|
595
|
+
List<TypeConstraint> constraint_list11 = null;
|
596
|
+
|
597
|
+
List<TypePragma> pragma_list12 = null;
|
598
|
+
|
599
|
+
|
600
|
+
try {
|
601
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:69:5: (name= ( ( '::' )? ( CONST_ID '::' )* CONST_ID ) ( '<' ( type_var_list )? ( '|' constraint_list )? '>' )? ( pragma_list )? )
|
602
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:69:7: name= ( ( '::' )? ( CONST_ID '::' )* CONST_ID ) ( '<' ( type_var_list )? ( '|' constraint_list )? '>' )? ( pragma_list )?
|
603
|
+
{
|
604
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:69:12: ( ( '::' )? ( CONST_ID '::' )* CONST_ID )
|
605
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:69:13: ( '::' )? ( CONST_ID '::' )* CONST_ID
|
606
|
+
{
|
607
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:69:13: ( '::' )?
|
608
|
+
int alt10=2;
|
609
|
+
int LA10_0 = input.LA(1);
|
610
|
+
|
611
|
+
if ( (LA10_0==9) ) {
|
612
|
+
alt10=1;
|
613
|
+
}
|
614
|
+
switch (alt10) {
|
615
|
+
case 1 :
|
616
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:0:0: '::'
|
617
|
+
{
|
618
|
+
match(input,9,FOLLOW_9_in_class_type266); if (state.failed) return value;
|
619
|
+
|
620
|
+
}
|
621
|
+
break;
|
622
|
+
|
623
|
+
}
|
624
|
+
|
625
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:69:19: ( CONST_ID '::' )*
|
626
|
+
loop11:
|
627
|
+
do {
|
628
|
+
int alt11=2;
|
629
|
+
int LA11_0 = input.LA(1);
|
630
|
+
|
631
|
+
if ( (LA11_0==CONST_ID) ) {
|
632
|
+
int LA11_1 = input.LA(2);
|
633
|
+
|
634
|
+
if ( (LA11_1==9) ) {
|
635
|
+
alt11=1;
|
636
|
+
}
|
637
|
+
|
638
|
+
|
639
|
+
}
|
640
|
+
|
641
|
+
|
642
|
+
switch (alt11) {
|
643
|
+
case 1 :
|
644
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:69:20: CONST_ID '::'
|
645
|
+
{
|
646
|
+
match(input,CONST_ID,FOLLOW_CONST_ID_in_class_type270); if (state.failed) return value;
|
647
|
+
match(input,9,FOLLOW_9_in_class_type272); if (state.failed) return value;
|
648
|
+
|
649
|
+
}
|
650
|
+
break;
|
651
|
+
|
652
|
+
default :
|
653
|
+
break loop11;
|
654
|
+
}
|
655
|
+
} while (true);
|
656
|
+
|
657
|
+
match(input,CONST_ID,FOLLOW_CONST_ID_in_class_type276); if (state.failed) return value;
|
658
|
+
|
659
|
+
}
|
660
|
+
|
661
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:69:46: ( '<' ( type_var_list )? ( '|' constraint_list )? '>' )?
|
662
|
+
int alt14=2;
|
663
|
+
int LA14_0 = input.LA(1);
|
664
|
+
|
665
|
+
if ( (LA14_0==11) ) {
|
666
|
+
alt14=1;
|
667
|
+
}
|
668
|
+
switch (alt14) {
|
669
|
+
case 1 :
|
670
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:69:47: '<' ( type_var_list )? ( '|' constraint_list )? '>'
|
671
|
+
{
|
672
|
+
match(input,11,FOLLOW_11_in_class_type280); if (state.failed) return value;
|
673
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:69:51: ( type_var_list )?
|
674
|
+
int alt12=2;
|
675
|
+
int LA12_0 = input.LA(1);
|
676
|
+
|
677
|
+
if ( (LA12_0==ID) ) {
|
678
|
+
alt12=1;
|
679
|
+
}
|
680
|
+
switch (alt12) {
|
681
|
+
case 1 :
|
682
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:0:0: type_var_list
|
683
|
+
{
|
684
|
+
pushFollow(FOLLOW_type_var_list_in_class_type282);
|
685
|
+
type_var_list10=type_var_list();
|
686
|
+
|
687
|
+
state._fsp--;
|
688
|
+
if (state.failed) return value;
|
689
|
+
|
690
|
+
}
|
691
|
+
break;
|
692
|
+
|
693
|
+
}
|
694
|
+
|
695
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:69:66: ( '|' constraint_list )?
|
696
|
+
int alt13=2;
|
697
|
+
int LA13_0 = input.LA(1);
|
698
|
+
|
699
|
+
if ( (LA13_0==12) ) {
|
700
|
+
alt13=1;
|
701
|
+
}
|
702
|
+
switch (alt13) {
|
703
|
+
case 1 :
|
704
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:69:67: '|' constraint_list
|
705
|
+
{
|
706
|
+
match(input,12,FOLLOW_12_in_class_type286); if (state.failed) return value;
|
707
|
+
pushFollow(FOLLOW_constraint_list_in_class_type288);
|
708
|
+
constraint_list11=constraint_list();
|
709
|
+
|
710
|
+
state._fsp--;
|
711
|
+
if (state.failed) return value;
|
712
|
+
|
713
|
+
}
|
714
|
+
break;
|
715
|
+
|
716
|
+
}
|
717
|
+
|
718
|
+
match(input,13,FOLLOW_13_in_class_type292); if (state.failed) return value;
|
719
|
+
|
720
|
+
}
|
721
|
+
break;
|
722
|
+
|
723
|
+
}
|
724
|
+
|
725
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:69:95: ( pragma_list )?
|
726
|
+
int alt15=2;
|
727
|
+
int LA15_0 = input.LA(1);
|
728
|
+
|
729
|
+
if ( (LA15_0==21) ) {
|
730
|
+
alt15=1;
|
731
|
+
}
|
732
|
+
switch (alt15) {
|
733
|
+
case 1 :
|
734
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:0:0: pragma_list
|
735
|
+
{
|
736
|
+
pushFollow(FOLLOW_pragma_list_in_class_type296);
|
737
|
+
pragma_list12=pragma_list();
|
738
|
+
|
739
|
+
state._fsp--;
|
740
|
+
if (state.failed) return value;
|
741
|
+
|
742
|
+
}
|
743
|
+
break;
|
744
|
+
|
745
|
+
}
|
746
|
+
|
747
|
+
if ( state.backtracking==0 ) {
|
748
|
+
|
749
|
+
value = new ClassType((name!=null?name.getText():null), type_var_list10, constraint_list11, pragma_list12);
|
750
|
+
|
751
|
+
}
|
752
|
+
|
753
|
+
}
|
754
|
+
|
755
|
+
}
|
756
|
+
catch (RecognitionException re) {
|
757
|
+
reportError(re);
|
758
|
+
recover(input,re);
|
759
|
+
}
|
760
|
+
finally {
|
761
|
+
}
|
762
|
+
return value;
|
763
|
+
}
|
764
|
+
// $ANTLR end "class_type"
|
765
|
+
|
766
|
+
|
767
|
+
// $ANTLR start "constraint_list"
|
768
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:74:1: constraint_list returns [List<TypeConstraint> value] : e1= type_expr '<=' e2= type_expr ( ',' rest= constraint_list )? ;
|
769
|
+
public final List<TypeConstraint> constraint_list() throws RecognitionException {
|
770
|
+
List<TypeConstraint> value = null;
|
771
|
+
|
772
|
+
TypeExpression e1 = null;
|
773
|
+
|
774
|
+
TypeExpression e2 = null;
|
775
|
+
|
776
|
+
List<TypeConstraint> rest = null;
|
777
|
+
|
778
|
+
|
779
|
+
try {
|
780
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:75:5: (e1= type_expr '<=' e2= type_expr ( ',' rest= constraint_list )? )
|
781
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:75:7: e1= type_expr '<=' e2= type_expr ( ',' rest= constraint_list )?
|
782
|
+
{
|
783
|
+
pushFollow(FOLLOW_type_expr_in_constraint_list322);
|
784
|
+
e1=type_expr();
|
785
|
+
|
786
|
+
state._fsp--;
|
787
|
+
if (state.failed) return value;
|
788
|
+
match(input,19,FOLLOW_19_in_constraint_list324); if (state.failed) return value;
|
789
|
+
pushFollow(FOLLOW_type_expr_in_constraint_list328);
|
790
|
+
e2=type_expr();
|
791
|
+
|
792
|
+
state._fsp--;
|
793
|
+
if (state.failed) return value;
|
794
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:75:38: ( ',' rest= constraint_list )?
|
795
|
+
int alt16=2;
|
796
|
+
int LA16_0 = input.LA(1);
|
797
|
+
|
798
|
+
if ( (LA16_0==20) ) {
|
799
|
+
alt16=1;
|
800
|
+
}
|
801
|
+
switch (alt16) {
|
802
|
+
case 1 :
|
803
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:75:39: ',' rest= constraint_list
|
804
|
+
{
|
805
|
+
match(input,20,FOLLOW_20_in_constraint_list331); if (state.failed) return value;
|
806
|
+
pushFollow(FOLLOW_constraint_list_in_constraint_list335);
|
807
|
+
rest=constraint_list();
|
808
|
+
|
809
|
+
state._fsp--;
|
810
|
+
if (state.failed) return value;
|
811
|
+
|
812
|
+
}
|
813
|
+
break;
|
814
|
+
|
815
|
+
}
|
816
|
+
|
817
|
+
if ( state.backtracking==0 ) {
|
818
|
+
|
819
|
+
value = new ArrayList<TypeConstraint>();
|
820
|
+
value.add(new TypeConstraint(TypeExpression.Type.SUBTYPE_CONS, e1, e2));
|
821
|
+
if (rest != null) {
|
822
|
+
value.addAll(rest);
|
823
|
+
}
|
824
|
+
|
825
|
+
}
|
826
|
+
|
827
|
+
}
|
828
|
+
|
829
|
+
}
|
830
|
+
catch (RecognitionException re) {
|
831
|
+
reportError(re);
|
832
|
+
recover(input,re);
|
833
|
+
}
|
834
|
+
finally {
|
835
|
+
}
|
836
|
+
return value;
|
837
|
+
}
|
838
|
+
// $ANTLR end "constraint_list"
|
839
|
+
|
840
|
+
|
841
|
+
// $ANTLR start "pragma_list"
|
842
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:84:1: pragma_list returns [List<TypePragma> value] : pragma ( ',' rest= pragma_list )? ;
|
843
|
+
public final List<TypePragma> pragma_list() throws RecognitionException {
|
844
|
+
List<TypePragma> value = null;
|
845
|
+
|
846
|
+
List<TypePragma> rest = null;
|
847
|
+
|
848
|
+
TypePragma pragma13 = null;
|
849
|
+
|
850
|
+
|
851
|
+
try {
|
852
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:85:5: ( pragma ( ',' rest= pragma_list )? )
|
853
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:85:7: pragma ( ',' rest= pragma_list )?
|
854
|
+
{
|
855
|
+
pushFollow(FOLLOW_pragma_in_pragma_list360);
|
856
|
+
pragma13=pragma();
|
857
|
+
|
858
|
+
state._fsp--;
|
859
|
+
if (state.failed) return value;
|
860
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:85:14: ( ',' rest= pragma_list )?
|
861
|
+
int alt17=2;
|
862
|
+
int LA17_0 = input.LA(1);
|
863
|
+
|
864
|
+
if ( (LA17_0==20) ) {
|
865
|
+
alt17=1;
|
866
|
+
}
|
867
|
+
switch (alt17) {
|
868
|
+
case 1 :
|
869
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:85:15: ',' rest= pragma_list
|
870
|
+
{
|
871
|
+
match(input,20,FOLLOW_20_in_pragma_list363); if (state.failed) return value;
|
872
|
+
pushFollow(FOLLOW_pragma_list_in_pragma_list367);
|
873
|
+
rest=pragma_list();
|
874
|
+
|
875
|
+
state._fsp--;
|
876
|
+
if (state.failed) return value;
|
877
|
+
|
878
|
+
}
|
879
|
+
break;
|
880
|
+
|
881
|
+
}
|
882
|
+
|
883
|
+
if ( state.backtracking==0 ) {
|
884
|
+
|
885
|
+
value = new ArrayList<TypePragma>();
|
886
|
+
value.add(pragma13);
|
887
|
+
if (rest != null) {
|
888
|
+
value.addAll(rest);
|
889
|
+
}
|
890
|
+
|
891
|
+
}
|
892
|
+
|
893
|
+
}
|
894
|
+
|
895
|
+
}
|
896
|
+
catch (RecognitionException re) {
|
897
|
+
reportError(re);
|
898
|
+
recover(input,re);
|
899
|
+
}
|
900
|
+
finally {
|
901
|
+
}
|
902
|
+
return value;
|
903
|
+
}
|
904
|
+
// $ANTLR end "pragma_list"
|
905
|
+
|
906
|
+
|
907
|
+
// $ANTLR start "pragma"
|
908
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:94:1: pragma returns [TypePragma value] : '!nobody' ;
|
909
|
+
public final TypePragma pragma() throws RecognitionException {
|
910
|
+
TypePragma value = null;
|
911
|
+
|
912
|
+
try {
|
913
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:95:5: ( '!nobody' )
|
914
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:95:7: '!nobody'
|
915
|
+
{
|
916
|
+
match(input,21,FOLLOW_21_in_pragma392); if (state.failed) return value;
|
917
|
+
if ( state.backtracking==0 ) {
|
918
|
+
value = new TypePragma(TypeExpression.Type.NOBODY_PRAGMA);
|
919
|
+
}
|
920
|
+
|
921
|
+
}
|
922
|
+
|
923
|
+
}
|
924
|
+
catch (RecognitionException re) {
|
925
|
+
reportError(re);
|
926
|
+
recover(input,re);
|
927
|
+
}
|
928
|
+
finally {
|
929
|
+
}
|
930
|
+
return value;
|
931
|
+
}
|
932
|
+
// $ANTLR end "pragma"
|
933
|
+
|
934
|
+
|
935
|
+
// $ANTLR start "type_expr"
|
936
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:98:1: type_expr returns [TypeExpression value] : single_type_expr ( or_type_list )? ;
|
937
|
+
public final TypeExpression type_expr() throws RecognitionException {
|
938
|
+
TypeExpression value = null;
|
939
|
+
|
940
|
+
List<TypeExpression> or_type_list14 = null;
|
941
|
+
|
942
|
+
TypeExpression single_type_expr15 = null;
|
943
|
+
|
944
|
+
|
945
|
+
try {
|
946
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:99:5: ( single_type_expr ( or_type_list )? )
|
947
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:99:7: single_type_expr ( or_type_list )?
|
948
|
+
{
|
949
|
+
pushFollow(FOLLOW_single_type_expr_in_type_expr415);
|
950
|
+
single_type_expr15=single_type_expr();
|
951
|
+
|
952
|
+
state._fsp--;
|
953
|
+
if (state.failed) return value;
|
954
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:99:24: ( or_type_list )?
|
955
|
+
int alt18=2;
|
956
|
+
int LA18_0 = input.LA(1);
|
957
|
+
|
958
|
+
if ( (LA18_0==26) ) {
|
959
|
+
alt18=1;
|
960
|
+
}
|
961
|
+
switch (alt18) {
|
962
|
+
case 1 :
|
963
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:0:0: or_type_list
|
964
|
+
{
|
965
|
+
pushFollow(FOLLOW_or_type_list_in_type_expr417);
|
966
|
+
or_type_list14=or_type_list();
|
967
|
+
|
968
|
+
state._fsp--;
|
969
|
+
if (state.failed) return value;
|
970
|
+
|
971
|
+
}
|
972
|
+
break;
|
973
|
+
|
974
|
+
}
|
975
|
+
|
976
|
+
if ( state.backtracking==0 ) {
|
977
|
+
|
978
|
+
if (or_type_list14 != null) {
|
979
|
+
TypeUnion union = new TypeUnion();
|
980
|
+
union.add(single_type_expr15);
|
981
|
+
union.addAll(or_type_list14);
|
982
|
+
value = union;
|
983
|
+
} else {
|
984
|
+
value = single_type_expr15;
|
985
|
+
}
|
986
|
+
|
987
|
+
}
|
988
|
+
|
989
|
+
}
|
990
|
+
|
991
|
+
}
|
992
|
+
catch (RecognitionException re) {
|
993
|
+
reportError(re);
|
994
|
+
recover(input,re);
|
995
|
+
}
|
996
|
+
finally {
|
997
|
+
}
|
998
|
+
return value;
|
999
|
+
}
|
1000
|
+
// $ANTLR end "type_expr"
|
1001
|
+
|
1002
|
+
|
1003
|
+
// $ANTLR start "type_expr_comma_list"
|
1004
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:111:1: type_expr_comma_list returns [List<TypeExpression> value] : type_expr ( ',' rest= type_expr_comma_list )? ;
|
1005
|
+
public final List<TypeExpression> type_expr_comma_list() throws RecognitionException {
|
1006
|
+
List<TypeExpression> value = null;
|
1007
|
+
|
1008
|
+
List<TypeExpression> rest = null;
|
1009
|
+
|
1010
|
+
TypeExpression type_expr16 = null;
|
1011
|
+
|
1012
|
+
|
1013
|
+
try {
|
1014
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:112:5: ( type_expr ( ',' rest= type_expr_comma_list )? )
|
1015
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:112:7: type_expr ( ',' rest= type_expr_comma_list )?
|
1016
|
+
{
|
1017
|
+
pushFollow(FOLLOW_type_expr_in_type_expr_comma_list441);
|
1018
|
+
type_expr16=type_expr();
|
1019
|
+
|
1020
|
+
state._fsp--;
|
1021
|
+
if (state.failed) return value;
|
1022
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:112:17: ( ',' rest= type_expr_comma_list )?
|
1023
|
+
int alt19=2;
|
1024
|
+
int LA19_0 = input.LA(1);
|
1025
|
+
|
1026
|
+
if ( (LA19_0==20) ) {
|
1027
|
+
alt19=1;
|
1028
|
+
}
|
1029
|
+
switch (alt19) {
|
1030
|
+
case 1 :
|
1031
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:112:18: ',' rest= type_expr_comma_list
|
1032
|
+
{
|
1033
|
+
match(input,20,FOLLOW_20_in_type_expr_comma_list444); if (state.failed) return value;
|
1034
|
+
pushFollow(FOLLOW_type_expr_comma_list_in_type_expr_comma_list448);
|
1035
|
+
rest=type_expr_comma_list();
|
1036
|
+
|
1037
|
+
state._fsp--;
|
1038
|
+
if (state.failed) return value;
|
1039
|
+
|
1040
|
+
}
|
1041
|
+
break;
|
1042
|
+
|
1043
|
+
}
|
1044
|
+
|
1045
|
+
if ( state.backtracking==0 ) {
|
1046
|
+
|
1047
|
+
value = new ArrayList<TypeExpression>();
|
1048
|
+
value.add(type_expr16);
|
1049
|
+
if (rest != null) {
|
1050
|
+
value.addAll(rest);
|
1051
|
+
}
|
1052
|
+
|
1053
|
+
}
|
1054
|
+
|
1055
|
+
}
|
1056
|
+
|
1057
|
+
}
|
1058
|
+
catch (RecognitionException re) {
|
1059
|
+
reportError(re);
|
1060
|
+
recover(input,re);
|
1061
|
+
}
|
1062
|
+
finally {
|
1063
|
+
}
|
1064
|
+
return value;
|
1065
|
+
}
|
1066
|
+
// $ANTLR end "type_expr_comma_list"
|
1067
|
+
|
1068
|
+
|
1069
|
+
// $ANTLR start "tuple"
|
1070
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:121:1: tuple returns [TypeTuple value] : ( '(' type_expr_comma_list ')' | '[' type_expr_comma_list ']' );
|
1071
|
+
public final TypeTuple tuple() throws RecognitionException {
|
1072
|
+
TypeTuple value = null;
|
1073
|
+
|
1074
|
+
List<TypeExpression> type_expr_comma_list17 = null;
|
1075
|
+
|
1076
|
+
List<TypeExpression> type_expr_comma_list18 = null;
|
1077
|
+
|
1078
|
+
|
1079
|
+
try {
|
1080
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:122:5: ( '(' type_expr_comma_list ')' | '[' type_expr_comma_list ']' )
|
1081
|
+
int alt20=2;
|
1082
|
+
int LA20_0 = input.LA(1);
|
1083
|
+
|
1084
|
+
if ( (LA20_0==14) ) {
|
1085
|
+
alt20=1;
|
1086
|
+
}
|
1087
|
+
else if ( (LA20_0==22) ) {
|
1088
|
+
alt20=2;
|
1089
|
+
}
|
1090
|
+
else {
|
1091
|
+
if (state.backtracking>0) {state.failed=true; return value;}
|
1092
|
+
NoViableAltException nvae =
|
1093
|
+
new NoViableAltException("", 20, 0, input);
|
1094
|
+
|
1095
|
+
throw nvae;
|
1096
|
+
}
|
1097
|
+
switch (alt20) {
|
1098
|
+
case 1 :
|
1099
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:122:7: '(' type_expr_comma_list ')'
|
1100
|
+
{
|
1101
|
+
match(input,14,FOLLOW_14_in_tuple481); if (state.failed) return value;
|
1102
|
+
pushFollow(FOLLOW_type_expr_comma_list_in_tuple483);
|
1103
|
+
type_expr_comma_list17=type_expr_comma_list();
|
1104
|
+
|
1105
|
+
state._fsp--;
|
1106
|
+
if (state.failed) return value;
|
1107
|
+
match(input,15,FOLLOW_15_in_tuple485); if (state.failed) return value;
|
1108
|
+
if ( state.backtracking==0 ) {
|
1109
|
+
|
1110
|
+
value = new TypeTuple(type_expr_comma_list17);
|
1111
|
+
|
1112
|
+
}
|
1113
|
+
|
1114
|
+
}
|
1115
|
+
break;
|
1116
|
+
case 2 :
|
1117
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:125:7: '[' type_expr_comma_list ']'
|
1118
|
+
{
|
1119
|
+
match(input,22,FOLLOW_22_in_tuple495); if (state.failed) return value;
|
1120
|
+
pushFollow(FOLLOW_type_expr_comma_list_in_tuple497);
|
1121
|
+
type_expr_comma_list18=type_expr_comma_list();
|
1122
|
+
|
1123
|
+
state._fsp--;
|
1124
|
+
if (state.failed) return value;
|
1125
|
+
match(input,23,FOLLOW_23_in_tuple499); if (state.failed) return value;
|
1126
|
+
if ( state.backtracking==0 ) {
|
1127
|
+
// syntax sugar
|
1128
|
+
value = new TypeTuple(type_expr_comma_list18);
|
1129
|
+
|
1130
|
+
}
|
1131
|
+
|
1132
|
+
}
|
1133
|
+
break;
|
1134
|
+
|
1135
|
+
}
|
1136
|
+
}
|
1137
|
+
catch (RecognitionException re) {
|
1138
|
+
reportError(re);
|
1139
|
+
recover(input,re);
|
1140
|
+
}
|
1141
|
+
finally {
|
1142
|
+
}
|
1143
|
+
return value;
|
1144
|
+
}
|
1145
|
+
// $ANTLR end "tuple"
|
1146
|
+
|
1147
|
+
|
1148
|
+
// $ANTLR start "single_type_expr"
|
1149
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:130:1: single_type_expr returns [TypeExpression value] : ( type_var | type_ident ( '<' type_expr_comma_list '>' )? | tuple | '?' ( (expr= single_type_expr )? | '(' expr= type_expr ')' ) | '*' (expr= single_type_expr | '(' expr= type_expr ')' ) );
|
1150
|
+
public final TypeExpression single_type_expr() throws RecognitionException {
|
1151
|
+
TypeExpression value = null;
|
1152
|
+
|
1153
|
+
TypeExpression expr = null;
|
1154
|
+
|
1155
|
+
TypeVariable type_var19 = null;
|
1156
|
+
|
1157
|
+
List<TypeExpression> type_expr_comma_list20 = null;
|
1158
|
+
|
1159
|
+
TypeIdentity type_ident21 = null;
|
1160
|
+
|
1161
|
+
TypeTuple tuple22 = null;
|
1162
|
+
|
1163
|
+
|
1164
|
+
try {
|
1165
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:131:5: ( type_var | type_ident ( '<' type_expr_comma_list '>' )? | tuple | '?' ( (expr= single_type_expr )? | '(' expr= type_expr ')' ) | '*' (expr= single_type_expr | '(' expr= type_expr ')' ) )
|
1166
|
+
int alt25=5;
|
1167
|
+
switch ( input.LA(1) ) {
|
1168
|
+
case ID:
|
1169
|
+
{
|
1170
|
+
alt25=1;
|
1171
|
+
}
|
1172
|
+
break;
|
1173
|
+
case CONST_ID:
|
1174
|
+
case 9:
|
1175
|
+
{
|
1176
|
+
alt25=2;
|
1177
|
+
}
|
1178
|
+
break;
|
1179
|
+
case 14:
|
1180
|
+
case 22:
|
1181
|
+
{
|
1182
|
+
alt25=3;
|
1183
|
+
}
|
1184
|
+
break;
|
1185
|
+
case 24:
|
1186
|
+
{
|
1187
|
+
alt25=4;
|
1188
|
+
}
|
1189
|
+
break;
|
1190
|
+
case 25:
|
1191
|
+
{
|
1192
|
+
alt25=5;
|
1193
|
+
}
|
1194
|
+
break;
|
1195
|
+
default:
|
1196
|
+
if (state.backtracking>0) {state.failed=true; return value;}
|
1197
|
+
NoViableAltException nvae =
|
1198
|
+
new NoViableAltException("", 25, 0, input);
|
1199
|
+
|
1200
|
+
throw nvae;
|
1201
|
+
}
|
1202
|
+
|
1203
|
+
switch (alt25) {
|
1204
|
+
case 1 :
|
1205
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:131:7: type_var
|
1206
|
+
{
|
1207
|
+
pushFollow(FOLLOW_type_var_in_single_type_expr522);
|
1208
|
+
type_var19=type_var();
|
1209
|
+
|
1210
|
+
state._fsp--;
|
1211
|
+
if (state.failed) return value;
|
1212
|
+
if ( state.backtracking==0 ) {
|
1213
|
+
value = type_var19;
|
1214
|
+
}
|
1215
|
+
|
1216
|
+
}
|
1217
|
+
break;
|
1218
|
+
case 2 :
|
1219
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:132:7: type_ident ( '<' type_expr_comma_list '>' )?
|
1220
|
+
{
|
1221
|
+
pushFollow(FOLLOW_type_ident_in_single_type_expr532);
|
1222
|
+
type_ident21=type_ident();
|
1223
|
+
|
1224
|
+
state._fsp--;
|
1225
|
+
if (state.failed) return value;
|
1226
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:132:18: ( '<' type_expr_comma_list '>' )?
|
1227
|
+
int alt21=2;
|
1228
|
+
int LA21_0 = input.LA(1);
|
1229
|
+
|
1230
|
+
if ( (LA21_0==11) ) {
|
1231
|
+
alt21=1;
|
1232
|
+
}
|
1233
|
+
switch (alt21) {
|
1234
|
+
case 1 :
|
1235
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:132:19: '<' type_expr_comma_list '>'
|
1236
|
+
{
|
1237
|
+
match(input,11,FOLLOW_11_in_single_type_expr535); if (state.failed) return value;
|
1238
|
+
pushFollow(FOLLOW_type_expr_comma_list_in_single_type_expr537);
|
1239
|
+
type_expr_comma_list20=type_expr_comma_list();
|
1240
|
+
|
1241
|
+
state._fsp--;
|
1242
|
+
if (state.failed) return value;
|
1243
|
+
match(input,13,FOLLOW_13_in_single_type_expr539); if (state.failed) return value;
|
1244
|
+
|
1245
|
+
}
|
1246
|
+
break;
|
1247
|
+
|
1248
|
+
}
|
1249
|
+
|
1250
|
+
if ( state.backtracking==0 ) {
|
1251
|
+
|
1252
|
+
if (type_expr_comma_list20 != null) {
|
1253
|
+
value = new TypeApplication(type_ident21, type_expr_comma_list20);
|
1254
|
+
} else {
|
1255
|
+
value = type_ident21;
|
1256
|
+
}
|
1257
|
+
|
1258
|
+
}
|
1259
|
+
|
1260
|
+
}
|
1261
|
+
break;
|
1262
|
+
case 3 :
|
1263
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:139:7: tuple
|
1264
|
+
{
|
1265
|
+
pushFollow(FOLLOW_tuple_in_single_type_expr551);
|
1266
|
+
tuple22=tuple();
|
1267
|
+
|
1268
|
+
state._fsp--;
|
1269
|
+
if (state.failed) return value;
|
1270
|
+
if ( state.backtracking==0 ) {
|
1271
|
+
value = tuple22;
|
1272
|
+
}
|
1273
|
+
|
1274
|
+
}
|
1275
|
+
break;
|
1276
|
+
case 4 :
|
1277
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:140:7: '?' ( (expr= single_type_expr )? | '(' expr= type_expr ')' )
|
1278
|
+
{
|
1279
|
+
match(input,24,FOLLOW_24_in_single_type_expr561); if (state.failed) return value;
|
1280
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:140:11: ( (expr= single_type_expr )? | '(' expr= type_expr ')' )
|
1281
|
+
int alt23=2;
|
1282
|
+
alt23 = dfa23.predict(input);
|
1283
|
+
switch (alt23) {
|
1284
|
+
case 1 :
|
1285
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:140:12: (expr= single_type_expr )?
|
1286
|
+
{
|
1287
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:140:16: (expr= single_type_expr )?
|
1288
|
+
int alt22=2;
|
1289
|
+
int LA22_0 = input.LA(1);
|
1290
|
+
|
1291
|
+
if ( ((LA22_0>=ID && LA22_0<=CONST_ID)||LA22_0==9||LA22_0==14||LA22_0==22||(LA22_0>=24 && LA22_0<=25)) ) {
|
1292
|
+
alt22=1;
|
1293
|
+
}
|
1294
|
+
switch (alt22) {
|
1295
|
+
case 1 :
|
1296
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:0:0: expr= single_type_expr
|
1297
|
+
{
|
1298
|
+
pushFollow(FOLLOW_single_type_expr_in_single_type_expr566);
|
1299
|
+
expr=single_type_expr();
|
1300
|
+
|
1301
|
+
state._fsp--;
|
1302
|
+
if (state.failed) return value;
|
1303
|
+
|
1304
|
+
}
|
1305
|
+
break;
|
1306
|
+
|
1307
|
+
}
|
1308
|
+
|
1309
|
+
|
1310
|
+
}
|
1311
|
+
break;
|
1312
|
+
case 2 :
|
1313
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:140:37: '(' expr= type_expr ')'
|
1314
|
+
{
|
1315
|
+
match(input,14,FOLLOW_14_in_single_type_expr571); if (state.failed) return value;
|
1316
|
+
pushFollow(FOLLOW_type_expr_in_single_type_expr575);
|
1317
|
+
expr=type_expr();
|
1318
|
+
|
1319
|
+
state._fsp--;
|
1320
|
+
if (state.failed) return value;
|
1321
|
+
match(input,15,FOLLOW_15_in_single_type_expr577); if (state.failed) return value;
|
1322
|
+
|
1323
|
+
}
|
1324
|
+
break;
|
1325
|
+
|
1326
|
+
}
|
1327
|
+
|
1328
|
+
if ( state.backtracking==0 ) {
|
1329
|
+
|
1330
|
+
if (expr != null) {
|
1331
|
+
value = new TypeOptional(expr);
|
1332
|
+
} else {
|
1333
|
+
value = new TypeAny();
|
1334
|
+
}
|
1335
|
+
|
1336
|
+
}
|
1337
|
+
|
1338
|
+
}
|
1339
|
+
break;
|
1340
|
+
case 5 :
|
1341
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:147:7: '*' (expr= single_type_expr | '(' expr= type_expr ')' )
|
1342
|
+
{
|
1343
|
+
match(input,25,FOLLOW_25_in_single_type_expr588); if (state.failed) return value;
|
1344
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:147:11: (expr= single_type_expr | '(' expr= type_expr ')' )
|
1345
|
+
int alt24=2;
|
1346
|
+
int LA24_0 = input.LA(1);
|
1347
|
+
|
1348
|
+
if ( ((LA24_0>=ID && LA24_0<=CONST_ID)||LA24_0==9||LA24_0==22||(LA24_0>=24 && LA24_0<=25)) ) {
|
1349
|
+
alt24=1;
|
1350
|
+
}
|
1351
|
+
else if ( (LA24_0==14) ) {
|
1352
|
+
int LA24_4 = input.LA(2);
|
1353
|
+
|
1354
|
+
if ( (synpred32_TypeAnnotation()) ) {
|
1355
|
+
alt24=1;
|
1356
|
+
}
|
1357
|
+
else if ( (true) ) {
|
1358
|
+
alt24=2;
|
1359
|
+
}
|
1360
|
+
else {
|
1361
|
+
if (state.backtracking>0) {state.failed=true; return value;}
|
1362
|
+
NoViableAltException nvae =
|
1363
|
+
new NoViableAltException("", 24, 4, input);
|
1364
|
+
|
1365
|
+
throw nvae;
|
1366
|
+
}
|
1367
|
+
}
|
1368
|
+
else {
|
1369
|
+
if (state.backtracking>0) {state.failed=true; return value;}
|
1370
|
+
NoViableAltException nvae =
|
1371
|
+
new NoViableAltException("", 24, 0, input);
|
1372
|
+
|
1373
|
+
throw nvae;
|
1374
|
+
}
|
1375
|
+
switch (alt24) {
|
1376
|
+
case 1 :
|
1377
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:147:12: expr= single_type_expr
|
1378
|
+
{
|
1379
|
+
pushFollow(FOLLOW_single_type_expr_in_single_type_expr593);
|
1380
|
+
expr=single_type_expr();
|
1381
|
+
|
1382
|
+
state._fsp--;
|
1383
|
+
if (state.failed) return value;
|
1384
|
+
|
1385
|
+
}
|
1386
|
+
break;
|
1387
|
+
case 2 :
|
1388
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:147:36: '(' expr= type_expr ')'
|
1389
|
+
{
|
1390
|
+
match(input,14,FOLLOW_14_in_single_type_expr597); if (state.failed) return value;
|
1391
|
+
pushFollow(FOLLOW_type_expr_in_single_type_expr601);
|
1392
|
+
expr=type_expr();
|
1393
|
+
|
1394
|
+
state._fsp--;
|
1395
|
+
if (state.failed) return value;
|
1396
|
+
match(input,15,FOLLOW_15_in_single_type_expr603); if (state.failed) return value;
|
1397
|
+
|
1398
|
+
}
|
1399
|
+
break;
|
1400
|
+
|
1401
|
+
}
|
1402
|
+
|
1403
|
+
if ( state.backtracking==0 ) {
|
1404
|
+
value = new TypeSplat(expr);
|
1405
|
+
}
|
1406
|
+
|
1407
|
+
}
|
1408
|
+
break;
|
1409
|
+
|
1410
|
+
}
|
1411
|
+
}
|
1412
|
+
catch (RecognitionException re) {
|
1413
|
+
reportError(re);
|
1414
|
+
recover(input,re);
|
1415
|
+
}
|
1416
|
+
finally {
|
1417
|
+
}
|
1418
|
+
return value;
|
1419
|
+
}
|
1420
|
+
// $ANTLR end "single_type_expr"
|
1421
|
+
|
1422
|
+
|
1423
|
+
// $ANTLR start "or_type_list"
|
1424
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:150:1: or_type_list returns [List<TypeExpression> value] : 'or' single_type_expr (rest= or_type_list )? ;
|
1425
|
+
public final List<TypeExpression> or_type_list() throws RecognitionException {
|
1426
|
+
List<TypeExpression> value = null;
|
1427
|
+
|
1428
|
+
List<TypeExpression> rest = null;
|
1429
|
+
|
1430
|
+
TypeExpression single_type_expr23 = null;
|
1431
|
+
|
1432
|
+
|
1433
|
+
try {
|
1434
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:151:5: ( 'or' single_type_expr (rest= or_type_list )? )
|
1435
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:151:7: 'or' single_type_expr (rest= or_type_list )?
|
1436
|
+
{
|
1437
|
+
match(input,26,FOLLOW_26_in_or_type_list627); if (state.failed) return value;
|
1438
|
+
pushFollow(FOLLOW_single_type_expr_in_or_type_list629);
|
1439
|
+
single_type_expr23=single_type_expr();
|
1440
|
+
|
1441
|
+
state._fsp--;
|
1442
|
+
if (state.failed) return value;
|
1443
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:151:33: (rest= or_type_list )?
|
1444
|
+
int alt26=2;
|
1445
|
+
int LA26_0 = input.LA(1);
|
1446
|
+
|
1447
|
+
if ( (LA26_0==26) ) {
|
1448
|
+
alt26=1;
|
1449
|
+
}
|
1450
|
+
switch (alt26) {
|
1451
|
+
case 1 :
|
1452
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:0:0: rest= or_type_list
|
1453
|
+
{
|
1454
|
+
pushFollow(FOLLOW_or_type_list_in_or_type_list633);
|
1455
|
+
rest=or_type_list();
|
1456
|
+
|
1457
|
+
state._fsp--;
|
1458
|
+
if (state.failed) return value;
|
1459
|
+
|
1460
|
+
}
|
1461
|
+
break;
|
1462
|
+
|
1463
|
+
}
|
1464
|
+
|
1465
|
+
if ( state.backtracking==0 ) {
|
1466
|
+
|
1467
|
+
value = new ArrayList<TypeExpression>();
|
1468
|
+
value.add(single_type_expr23);
|
1469
|
+
if (rest != null) {
|
1470
|
+
value.addAll(rest);
|
1471
|
+
}
|
1472
|
+
|
1473
|
+
}
|
1474
|
+
|
1475
|
+
}
|
1476
|
+
|
1477
|
+
}
|
1478
|
+
catch (RecognitionException re) {
|
1479
|
+
reportError(re);
|
1480
|
+
recover(input,re);
|
1481
|
+
}
|
1482
|
+
finally {
|
1483
|
+
}
|
1484
|
+
return value;
|
1485
|
+
}
|
1486
|
+
// $ANTLR end "or_type_list"
|
1487
|
+
|
1488
|
+
|
1489
|
+
// $ANTLR start "type_ident"
|
1490
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:160:1: type_ident returns [TypeIdentity value] : ( CONST_ID ( '::' id= type_ident )? | '::' id= type_ident );
|
1491
|
+
public final TypeIdentity type_ident() throws RecognitionException {
|
1492
|
+
TypeIdentity value = null;
|
1493
|
+
|
1494
|
+
Token CONST_ID24=null;
|
1495
|
+
TypeIdentity id = null;
|
1496
|
+
|
1497
|
+
|
1498
|
+
try {
|
1499
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:161:5: ( CONST_ID ( '::' id= type_ident )? | '::' id= type_ident )
|
1500
|
+
int alt28=2;
|
1501
|
+
int LA28_0 = input.LA(1);
|
1502
|
+
|
1503
|
+
if ( (LA28_0==CONST_ID) ) {
|
1504
|
+
alt28=1;
|
1505
|
+
}
|
1506
|
+
else if ( (LA28_0==9) ) {
|
1507
|
+
alt28=2;
|
1508
|
+
}
|
1509
|
+
else {
|
1510
|
+
if (state.backtracking>0) {state.failed=true; return value;}
|
1511
|
+
NoViableAltException nvae =
|
1512
|
+
new NoViableAltException("", 28, 0, input);
|
1513
|
+
|
1514
|
+
throw nvae;
|
1515
|
+
}
|
1516
|
+
switch (alt28) {
|
1517
|
+
case 1 :
|
1518
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:161:7: CONST_ID ( '::' id= type_ident )?
|
1519
|
+
{
|
1520
|
+
CONST_ID24=(Token)match(input,CONST_ID,FOLLOW_CONST_ID_in_type_ident657); if (state.failed) return value;
|
1521
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:161:16: ( '::' id= type_ident )?
|
1522
|
+
int alt27=2;
|
1523
|
+
int LA27_0 = input.LA(1);
|
1524
|
+
|
1525
|
+
if ( (LA27_0==9) ) {
|
1526
|
+
alt27=1;
|
1527
|
+
}
|
1528
|
+
switch (alt27) {
|
1529
|
+
case 1 :
|
1530
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:161:17: '::' id= type_ident
|
1531
|
+
{
|
1532
|
+
match(input,9,FOLLOW_9_in_type_ident660); if (state.failed) return value;
|
1533
|
+
pushFollow(FOLLOW_type_ident_in_type_ident664);
|
1534
|
+
id=type_ident();
|
1535
|
+
|
1536
|
+
state._fsp--;
|
1537
|
+
if (state.failed) return value;
|
1538
|
+
|
1539
|
+
}
|
1540
|
+
break;
|
1541
|
+
|
1542
|
+
}
|
1543
|
+
|
1544
|
+
if ( state.backtracking==0 ) {
|
1545
|
+
|
1546
|
+
if (id != null) {
|
1547
|
+
value = TypeIdentity.newScopedIdentity((CONST_ID24!=null?CONST_ID24.getText():null), id);
|
1548
|
+
} else {
|
1549
|
+
value = TypeIdentity.newRelativeIdentity((CONST_ID24!=null?CONST_ID24.getText():null));
|
1550
|
+
}
|
1551
|
+
|
1552
|
+
}
|
1553
|
+
|
1554
|
+
}
|
1555
|
+
break;
|
1556
|
+
case 2 :
|
1557
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:168:7: '::' id= type_ident
|
1558
|
+
{
|
1559
|
+
match(input,9,FOLLOW_9_in_type_ident676); if (state.failed) return value;
|
1560
|
+
pushFollow(FOLLOW_type_ident_in_type_ident680);
|
1561
|
+
id=type_ident();
|
1562
|
+
|
1563
|
+
state._fsp--;
|
1564
|
+
if (state.failed) return value;
|
1565
|
+
if ( state.backtracking==0 ) {
|
1566
|
+
|
1567
|
+
value = TypeIdentity.newAbsoluteIdentity(id);
|
1568
|
+
|
1569
|
+
}
|
1570
|
+
|
1571
|
+
}
|
1572
|
+
break;
|
1573
|
+
|
1574
|
+
}
|
1575
|
+
}
|
1576
|
+
catch (RecognitionException re) {
|
1577
|
+
reportError(re);
|
1578
|
+
recover(input,re);
|
1579
|
+
}
|
1580
|
+
finally {
|
1581
|
+
}
|
1582
|
+
return value;
|
1583
|
+
}
|
1584
|
+
// $ANTLR end "type_ident"
|
1585
|
+
|
1586
|
+
|
1587
|
+
// $ANTLR start "type_var"
|
1588
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:173:1: type_var returns [TypeVariable value] : ID ;
|
1589
|
+
public final TypeVariable type_var() throws RecognitionException {
|
1590
|
+
TypeVariable value = null;
|
1591
|
+
|
1592
|
+
Token ID25=null;
|
1593
|
+
|
1594
|
+
try {
|
1595
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:174:5: ( ID )
|
1596
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:174:7: ID
|
1597
|
+
{
|
1598
|
+
ID25=(Token)match(input,ID,FOLLOW_ID_in_type_var703); if (state.failed) return value;
|
1599
|
+
if ( state.backtracking==0 ) {
|
1600
|
+
value = new TypeVariable((ID25!=null?ID25.getText():null));
|
1601
|
+
}
|
1602
|
+
|
1603
|
+
}
|
1604
|
+
|
1605
|
+
}
|
1606
|
+
catch (RecognitionException re) {
|
1607
|
+
reportError(re);
|
1608
|
+
recover(input,re);
|
1609
|
+
}
|
1610
|
+
finally {
|
1611
|
+
}
|
1612
|
+
return value;
|
1613
|
+
}
|
1614
|
+
// $ANTLR end "type_var"
|
1615
|
+
|
1616
|
+
|
1617
|
+
// $ANTLR start "type_var_list"
|
1618
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:177:1: type_var_list returns [List<TypeVariable> value] : type_var ( ',' rest= type_var_list )? ;
|
1619
|
+
public final List<TypeVariable> type_var_list() throws RecognitionException {
|
1620
|
+
List<TypeVariable> value = null;
|
1621
|
+
|
1622
|
+
List<TypeVariable> rest = null;
|
1623
|
+
|
1624
|
+
TypeVariable type_var26 = null;
|
1625
|
+
|
1626
|
+
|
1627
|
+
try {
|
1628
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:178:5: ( type_var ( ',' rest= type_var_list )? )
|
1629
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:178:7: type_var ( ',' rest= type_var_list )?
|
1630
|
+
{
|
1631
|
+
pushFollow(FOLLOW_type_var_in_type_var_list726);
|
1632
|
+
type_var26=type_var();
|
1633
|
+
|
1634
|
+
state._fsp--;
|
1635
|
+
if (state.failed) return value;
|
1636
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:178:16: ( ',' rest= type_var_list )?
|
1637
|
+
int alt29=2;
|
1638
|
+
int LA29_0 = input.LA(1);
|
1639
|
+
|
1640
|
+
if ( (LA29_0==20) ) {
|
1641
|
+
alt29=1;
|
1642
|
+
}
|
1643
|
+
switch (alt29) {
|
1644
|
+
case 1 :
|
1645
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:178:17: ',' rest= type_var_list
|
1646
|
+
{
|
1647
|
+
match(input,20,FOLLOW_20_in_type_var_list729); if (state.failed) return value;
|
1648
|
+
pushFollow(FOLLOW_type_var_list_in_type_var_list733);
|
1649
|
+
rest=type_var_list();
|
1650
|
+
|
1651
|
+
state._fsp--;
|
1652
|
+
if (state.failed) return value;
|
1653
|
+
|
1654
|
+
}
|
1655
|
+
break;
|
1656
|
+
|
1657
|
+
}
|
1658
|
+
|
1659
|
+
if ( state.backtracking==0 ) {
|
1660
|
+
|
1661
|
+
value = new ArrayList<TypeVariable>();
|
1662
|
+
value.add(type_var26);
|
1663
|
+
if (rest != null) {
|
1664
|
+
value.addAll(rest);
|
1665
|
+
}
|
1666
|
+
|
1667
|
+
}
|
1668
|
+
|
1669
|
+
}
|
1670
|
+
|
1671
|
+
}
|
1672
|
+
catch (RecognitionException re) {
|
1673
|
+
reportError(re);
|
1674
|
+
recover(input,re);
|
1675
|
+
}
|
1676
|
+
finally {
|
1677
|
+
}
|
1678
|
+
return value;
|
1679
|
+
}
|
1680
|
+
// $ANTLR end "type_var_list"
|
1681
|
+
|
1682
|
+
// $ANTLR start synpred1_TypeAnnotation
|
1683
|
+
public final void synpred1_TypeAnnotation_fragment() throws RecognitionException {
|
1684
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:43:7: ( method_type )
|
1685
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:43:7: method_type
|
1686
|
+
{
|
1687
|
+
pushFollow(FOLLOW_method_type_in_synpred1_TypeAnnotation53);
|
1688
|
+
method_type();
|
1689
|
+
|
1690
|
+
state._fsp--;
|
1691
|
+
if (state.failed) return ;
|
1692
|
+
|
1693
|
+
}
|
1694
|
+
}
|
1695
|
+
// $ANTLR end synpred1_TypeAnnotation
|
1696
|
+
|
1697
|
+
// $ANTLR start synpred5_TypeAnnotation
|
1698
|
+
public final void synpred5_TypeAnnotation_fragment() throws RecognitionException {
|
1699
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:48:20: ( ( ID | CONST_ID ) ( '.' | '::' ) )
|
1700
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:48:20: ( ID | CONST_ID ) ( '.' | '::' )
|
1701
|
+
{
|
1702
|
+
if ( (input.LA(1)>=ID && input.LA(1)<=CONST_ID) ) {
|
1703
|
+
input.consume();
|
1704
|
+
state.errorRecovery=false;state.failed=false;
|
1705
|
+
}
|
1706
|
+
else {
|
1707
|
+
if (state.backtracking>0) {state.failed=true; return ;}
|
1708
|
+
MismatchedSetException mse = new MismatchedSetException(null,input);
|
1709
|
+
throw mse;
|
1710
|
+
}
|
1711
|
+
|
1712
|
+
if ( (input.LA(1)>=9 && input.LA(1)<=10) ) {
|
1713
|
+
input.consume();
|
1714
|
+
state.errorRecovery=false;state.failed=false;
|
1715
|
+
}
|
1716
|
+
else {
|
1717
|
+
if (state.backtracking>0) {state.failed=true; return ;}
|
1718
|
+
MismatchedSetException mse = new MismatchedSetException(null,input);
|
1719
|
+
throw mse;
|
1720
|
+
}
|
1721
|
+
|
1722
|
+
|
1723
|
+
}
|
1724
|
+
}
|
1725
|
+
// $ANTLR end synpred5_TypeAnnotation
|
1726
|
+
|
1727
|
+
// $ANTLR start synpred30_TypeAnnotation
|
1728
|
+
public final void synpred30_TypeAnnotation_fragment() throws RecognitionException {
|
1729
|
+
TypeExpression expr = null;
|
1730
|
+
|
1731
|
+
|
1732
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:140:12: ( (expr= single_type_expr )? )
|
1733
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:140:12: (expr= single_type_expr )?
|
1734
|
+
{
|
1735
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:140:16: (expr= single_type_expr )?
|
1736
|
+
int alt36=2;
|
1737
|
+
int LA36_0 = input.LA(1);
|
1738
|
+
|
1739
|
+
if ( ((LA36_0>=ID && LA36_0<=CONST_ID)||LA36_0==9||LA36_0==14||LA36_0==22||(LA36_0>=24 && LA36_0<=25)) ) {
|
1740
|
+
alt36=1;
|
1741
|
+
}
|
1742
|
+
switch (alt36) {
|
1743
|
+
case 1 :
|
1744
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:0:0: expr= single_type_expr
|
1745
|
+
{
|
1746
|
+
pushFollow(FOLLOW_single_type_expr_in_synpred30_TypeAnnotation566);
|
1747
|
+
expr=single_type_expr();
|
1748
|
+
|
1749
|
+
state._fsp--;
|
1750
|
+
if (state.failed) return ;
|
1751
|
+
|
1752
|
+
}
|
1753
|
+
break;
|
1754
|
+
|
1755
|
+
}
|
1756
|
+
|
1757
|
+
|
1758
|
+
}
|
1759
|
+
}
|
1760
|
+
// $ANTLR end synpred30_TypeAnnotation
|
1761
|
+
|
1762
|
+
// $ANTLR start synpred32_TypeAnnotation
|
1763
|
+
public final void synpred32_TypeAnnotation_fragment() throws RecognitionException {
|
1764
|
+
TypeExpression expr = null;
|
1765
|
+
|
1766
|
+
|
1767
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:147:12: (expr= single_type_expr )
|
1768
|
+
// /Users/ericwest/code/rsense-core/src/org/cx4a/rsense/parser/TypeAnnotation.g:147:12: expr= single_type_expr
|
1769
|
+
{
|
1770
|
+
pushFollow(FOLLOW_single_type_expr_in_synpred32_TypeAnnotation593);
|
1771
|
+
expr=single_type_expr();
|
1772
|
+
|
1773
|
+
state._fsp--;
|
1774
|
+
if (state.failed) return ;
|
1775
|
+
|
1776
|
+
}
|
1777
|
+
}
|
1778
|
+
// $ANTLR end synpred32_TypeAnnotation
|
1779
|
+
|
1780
|
+
// Delegated rules
|
1781
|
+
|
1782
|
+
public final boolean synpred1_TypeAnnotation() {
|
1783
|
+
state.backtracking++;
|
1784
|
+
int start = input.mark();
|
1785
|
+
try {
|
1786
|
+
synpred1_TypeAnnotation_fragment(); // can never throw exception
|
1787
|
+
} catch (RecognitionException re) {
|
1788
|
+
System.err.println("impossible: "+re);
|
1789
|
+
}
|
1790
|
+
boolean success = !state.failed;
|
1791
|
+
input.rewind(start);
|
1792
|
+
state.backtracking--;
|
1793
|
+
state.failed=false;
|
1794
|
+
return success;
|
1795
|
+
}
|
1796
|
+
public final boolean synpred30_TypeAnnotation() {
|
1797
|
+
state.backtracking++;
|
1798
|
+
int start = input.mark();
|
1799
|
+
try {
|
1800
|
+
synpred30_TypeAnnotation_fragment(); // can never throw exception
|
1801
|
+
} catch (RecognitionException re) {
|
1802
|
+
System.err.println("impossible: "+re);
|
1803
|
+
}
|
1804
|
+
boolean success = !state.failed;
|
1805
|
+
input.rewind(start);
|
1806
|
+
state.backtracking--;
|
1807
|
+
state.failed=false;
|
1808
|
+
return success;
|
1809
|
+
}
|
1810
|
+
public final boolean synpred32_TypeAnnotation() {
|
1811
|
+
state.backtracking++;
|
1812
|
+
int start = input.mark();
|
1813
|
+
try {
|
1814
|
+
synpred32_TypeAnnotation_fragment(); // can never throw exception
|
1815
|
+
} catch (RecognitionException re) {
|
1816
|
+
System.err.println("impossible: "+re);
|
1817
|
+
}
|
1818
|
+
boolean success = !state.failed;
|
1819
|
+
input.rewind(start);
|
1820
|
+
state.backtracking--;
|
1821
|
+
state.failed=false;
|
1822
|
+
return success;
|
1823
|
+
}
|
1824
|
+
public final boolean synpred5_TypeAnnotation() {
|
1825
|
+
state.backtracking++;
|
1826
|
+
int start = input.mark();
|
1827
|
+
try {
|
1828
|
+
synpred5_TypeAnnotation_fragment(); // can never throw exception
|
1829
|
+
} catch (RecognitionException re) {
|
1830
|
+
System.err.println("impossible: "+re);
|
1831
|
+
}
|
1832
|
+
boolean success = !state.failed;
|
1833
|
+
input.rewind(start);
|
1834
|
+
state.backtracking--;
|
1835
|
+
state.failed=false;
|
1836
|
+
return success;
|
1837
|
+
}
|
1838
|
+
|
1839
|
+
|
1840
|
+
protected DFA23 dfa23 = new DFA23(this);
|
1841
|
+
static final String DFA23_eotS =
|
1842
|
+
"\23\uffff";
|
1843
|
+
static final String DFA23_eofS =
|
1844
|
+
"\1\1\22\uffff";
|
1845
|
+
static final String DFA23_minS =
|
1846
|
+
"\1\4\3\uffff\1\0\16\uffff";
|
1847
|
+
static final String DFA23_maxS =
|
1848
|
+
"\1\32\3\uffff\1\0\16\uffff";
|
1849
|
+
static final String DFA23_acceptS =
|
1850
|
+
"\1\uffff\1\1\20\uffff\1\2";
|
1851
|
+
static final String DFA23_specialS =
|
1852
|
+
"\4\uffff\1\0\16\uffff}>";
|
1853
|
+
static final String[] DFA23_transitionS = {
|
1854
|
+
"\2\1\3\uffff\1\1\3\uffff\1\1\1\4\6\1\1\uffff\5\1",
|
1855
|
+
"",
|
1856
|
+
"",
|
1857
|
+
"",
|
1858
|
+
"\1\uffff",
|
1859
|
+
"",
|
1860
|
+
"",
|
1861
|
+
"",
|
1862
|
+
"",
|
1863
|
+
"",
|
1864
|
+
"",
|
1865
|
+
"",
|
1866
|
+
"",
|
1867
|
+
"",
|
1868
|
+
"",
|
1869
|
+
"",
|
1870
|
+
"",
|
1871
|
+
"",
|
1872
|
+
""
|
1873
|
+
};
|
1874
|
+
|
1875
|
+
static final short[] DFA23_eot = DFA.unpackEncodedString(DFA23_eotS);
|
1876
|
+
static final short[] DFA23_eof = DFA.unpackEncodedString(DFA23_eofS);
|
1877
|
+
static final char[] DFA23_min = DFA.unpackEncodedStringToUnsignedChars(DFA23_minS);
|
1878
|
+
static final char[] DFA23_max = DFA.unpackEncodedStringToUnsignedChars(DFA23_maxS);
|
1879
|
+
static final short[] DFA23_accept = DFA.unpackEncodedString(DFA23_acceptS);
|
1880
|
+
static final short[] DFA23_special = DFA.unpackEncodedString(DFA23_specialS);
|
1881
|
+
static final short[][] DFA23_transition;
|
1882
|
+
|
1883
|
+
static {
|
1884
|
+
int numStates = DFA23_transitionS.length;
|
1885
|
+
DFA23_transition = new short[numStates][];
|
1886
|
+
for (int i=0; i<numStates; i++) {
|
1887
|
+
DFA23_transition[i] = DFA.unpackEncodedString(DFA23_transitionS[i]);
|
1888
|
+
}
|
1889
|
+
}
|
1890
|
+
|
1891
|
+
class DFA23 extends DFA {
|
1892
|
+
|
1893
|
+
public DFA23(BaseRecognizer recognizer) {
|
1894
|
+
this.recognizer = recognizer;
|
1895
|
+
this.decisionNumber = 23;
|
1896
|
+
this.eot = DFA23_eot;
|
1897
|
+
this.eof = DFA23_eof;
|
1898
|
+
this.min = DFA23_min;
|
1899
|
+
this.max = DFA23_max;
|
1900
|
+
this.accept = DFA23_accept;
|
1901
|
+
this.special = DFA23_special;
|
1902
|
+
this.transition = DFA23_transition;
|
1903
|
+
}
|
1904
|
+
public String getDescription() {
|
1905
|
+
return "140:11: ( (expr= single_type_expr )? | '(' expr= type_expr ')' )";
|
1906
|
+
}
|
1907
|
+
public int specialStateTransition(int s, IntStream _input) throws NoViableAltException {
|
1908
|
+
TokenStream input = (TokenStream)_input;
|
1909
|
+
int _s = s;
|
1910
|
+
switch ( s ) {
|
1911
|
+
case 0 :
|
1912
|
+
int LA23_4 = input.LA(1);
|
1913
|
+
|
1914
|
+
|
1915
|
+
int index23_4 = input.index();
|
1916
|
+
input.rewind();
|
1917
|
+
s = -1;
|
1918
|
+
if ( (synpred30_TypeAnnotation()) ) {s = 1;}
|
1919
|
+
|
1920
|
+
else if ( (true) ) {s = 18;}
|
1921
|
+
|
1922
|
+
|
1923
|
+
input.seek(index23_4);
|
1924
|
+
if ( s>=0 ) return s;
|
1925
|
+
break;
|
1926
|
+
}
|
1927
|
+
if (state.backtracking>0) {state.failed=true; return -1;}
|
1928
|
+
NoViableAltException nvae =
|
1929
|
+
new NoViableAltException(getDescription(), 23, _s, input);
|
1930
|
+
error(nvae);
|
1931
|
+
throw nvae;
|
1932
|
+
}
|
1933
|
+
}
|
1934
|
+
|
1935
|
+
|
1936
|
+
public static final BitSet FOLLOW_method_type_in_type53 = new BitSet(new long[]{0x0000000000000002L});
|
1937
|
+
public static final BitSet FOLLOW_class_type_in_type63 = new BitSet(new long[]{0x0000000000000002L});
|
1938
|
+
public static final BitSet FOLLOW_9_in_method_type89 = new BitSet(new long[]{0x0000000000000070L});
|
1939
|
+
public static final BitSet FOLLOW_set_in_method_type93 = new BitSet(new long[]{0x0000000000000600L});
|
1940
|
+
public static final BitSet FOLLOW_set_in_method_type99 = new BitSet(new long[]{0x0000000000000070L});
|
1941
|
+
public static final BitSet FOLLOW_method_name_in_method_type107 = new BitSet(new long[]{0x0000000003404A30L});
|
1942
|
+
public static final BitSet FOLLOW_11_in_method_type111 = new BitSet(new long[]{0x0000000000003010L});
|
1943
|
+
public static final BitSet FOLLOW_type_var_list_in_method_type113 = new BitSet(new long[]{0x0000000000003000L});
|
1944
|
+
public static final BitSet FOLLOW_12_in_method_type117 = new BitSet(new long[]{0x0000000003404A30L});
|
1945
|
+
public static final BitSet FOLLOW_constraint_list_in_method_type119 = new BitSet(new long[]{0x0000000000002000L});
|
1946
|
+
public static final BitSet FOLLOW_13_in_method_type123 = new BitSet(new long[]{0x0000000003404A30L});
|
1947
|
+
public static final BitSet FOLLOW_method_sig_in_method_type127 = new BitSet(new long[]{0x0000000000000002L});
|
1948
|
+
public static final BitSet FOLLOW_14_in_method_sig150 = new BitSet(new long[]{0x0000000000008000L});
|
1949
|
+
public static final BitSet FOLLOW_15_in_method_sig152 = new BitSet(new long[]{0x0000000000030000L});
|
1950
|
+
public static final BitSet FOLLOW_block_in_method_sig154 = new BitSet(new long[]{0x0000000000010000L});
|
1951
|
+
public static final BitSet FOLLOW_16_in_method_sig157 = new BitSet(new long[]{0x0000000003404A30L});
|
1952
|
+
public static final BitSet FOLLOW_type_expr_in_method_sig159 = new BitSet(new long[]{0x0000000000000002L});
|
1953
|
+
public static final BitSet FOLLOW_type_expr_in_method_sig171 = new BitSet(new long[]{0x0000000000030000L});
|
1954
|
+
public static final BitSet FOLLOW_block_in_method_sig173 = new BitSet(new long[]{0x0000000000010000L});
|
1955
|
+
public static final BitSet FOLLOW_16_in_method_sig176 = new BitSet(new long[]{0x0000000003404A30L});
|
1956
|
+
public static final BitSet FOLLOW_type_expr_in_method_sig180 = new BitSet(new long[]{0x0000000000000002L});
|
1957
|
+
public static final BitSet FOLLOW_17_in_block203 = new BitSet(new long[]{0x0000000003404A30L});
|
1958
|
+
public static final BitSet FOLLOW_method_sig_in_block205 = new BitSet(new long[]{0x0000000000040000L});
|
1959
|
+
public static final BitSet FOLLOW_18_in_block207 = new BitSet(new long[]{0x0000000000000002L});
|
1960
|
+
public static final BitSet FOLLOW_set_in_method_name0 = new BitSet(new long[]{0x0000000000000002L});
|
1961
|
+
public static final BitSet FOLLOW_9_in_class_type266 = new BitSet(new long[]{0x0000000000000020L});
|
1962
|
+
public static final BitSet FOLLOW_CONST_ID_in_class_type270 = new BitSet(new long[]{0x0000000000000200L});
|
1963
|
+
public static final BitSet FOLLOW_9_in_class_type272 = new BitSet(new long[]{0x0000000000000020L});
|
1964
|
+
public static final BitSet FOLLOW_CONST_ID_in_class_type276 = new BitSet(new long[]{0x0000000000200802L});
|
1965
|
+
public static final BitSet FOLLOW_11_in_class_type280 = new BitSet(new long[]{0x0000000000003010L});
|
1966
|
+
public static final BitSet FOLLOW_type_var_list_in_class_type282 = new BitSet(new long[]{0x0000000000003000L});
|
1967
|
+
public static final BitSet FOLLOW_12_in_class_type286 = new BitSet(new long[]{0x0000000003404A30L});
|
1968
|
+
public static final BitSet FOLLOW_constraint_list_in_class_type288 = new BitSet(new long[]{0x0000000000002000L});
|
1969
|
+
public static final BitSet FOLLOW_13_in_class_type292 = new BitSet(new long[]{0x0000000000200002L});
|
1970
|
+
public static final BitSet FOLLOW_pragma_list_in_class_type296 = new BitSet(new long[]{0x0000000000000002L});
|
1971
|
+
public static final BitSet FOLLOW_type_expr_in_constraint_list322 = new BitSet(new long[]{0x0000000000080000L});
|
1972
|
+
public static final BitSet FOLLOW_19_in_constraint_list324 = new BitSet(new long[]{0x0000000003404A30L});
|
1973
|
+
public static final BitSet FOLLOW_type_expr_in_constraint_list328 = new BitSet(new long[]{0x0000000000100002L});
|
1974
|
+
public static final BitSet FOLLOW_20_in_constraint_list331 = new BitSet(new long[]{0x0000000003404A30L});
|
1975
|
+
public static final BitSet FOLLOW_constraint_list_in_constraint_list335 = new BitSet(new long[]{0x0000000000000002L});
|
1976
|
+
public static final BitSet FOLLOW_pragma_in_pragma_list360 = new BitSet(new long[]{0x0000000000100002L});
|
1977
|
+
public static final BitSet FOLLOW_20_in_pragma_list363 = new BitSet(new long[]{0x0000000000200000L});
|
1978
|
+
public static final BitSet FOLLOW_pragma_list_in_pragma_list367 = new BitSet(new long[]{0x0000000000000002L});
|
1979
|
+
public static final BitSet FOLLOW_21_in_pragma392 = new BitSet(new long[]{0x0000000000000002L});
|
1980
|
+
public static final BitSet FOLLOW_single_type_expr_in_type_expr415 = new BitSet(new long[]{0x0000000004000002L});
|
1981
|
+
public static final BitSet FOLLOW_or_type_list_in_type_expr417 = new BitSet(new long[]{0x0000000000000002L});
|
1982
|
+
public static final BitSet FOLLOW_type_expr_in_type_expr_comma_list441 = new BitSet(new long[]{0x0000000000100002L});
|
1983
|
+
public static final BitSet FOLLOW_20_in_type_expr_comma_list444 = new BitSet(new long[]{0x0000000003404A30L});
|
1984
|
+
public static final BitSet FOLLOW_type_expr_comma_list_in_type_expr_comma_list448 = new BitSet(new long[]{0x0000000000000002L});
|
1985
|
+
public static final BitSet FOLLOW_14_in_tuple481 = new BitSet(new long[]{0x0000000003404A30L});
|
1986
|
+
public static final BitSet FOLLOW_type_expr_comma_list_in_tuple483 = new BitSet(new long[]{0x0000000000008000L});
|
1987
|
+
public static final BitSet FOLLOW_15_in_tuple485 = new BitSet(new long[]{0x0000000000000002L});
|
1988
|
+
public static final BitSet FOLLOW_22_in_tuple495 = new BitSet(new long[]{0x0000000003404A30L});
|
1989
|
+
public static final BitSet FOLLOW_type_expr_comma_list_in_tuple497 = new BitSet(new long[]{0x0000000000800000L});
|
1990
|
+
public static final BitSet FOLLOW_23_in_tuple499 = new BitSet(new long[]{0x0000000000000002L});
|
1991
|
+
public static final BitSet FOLLOW_type_var_in_single_type_expr522 = new BitSet(new long[]{0x0000000000000002L});
|
1992
|
+
public static final BitSet FOLLOW_type_ident_in_single_type_expr532 = new BitSet(new long[]{0x0000000000000802L});
|
1993
|
+
public static final BitSet FOLLOW_11_in_single_type_expr535 = new BitSet(new long[]{0x0000000003404A30L});
|
1994
|
+
public static final BitSet FOLLOW_type_expr_comma_list_in_single_type_expr537 = new BitSet(new long[]{0x0000000000002000L});
|
1995
|
+
public static final BitSet FOLLOW_13_in_single_type_expr539 = new BitSet(new long[]{0x0000000000000002L});
|
1996
|
+
public static final BitSet FOLLOW_tuple_in_single_type_expr551 = new BitSet(new long[]{0x0000000000000002L});
|
1997
|
+
public static final BitSet FOLLOW_24_in_single_type_expr561 = new BitSet(new long[]{0x0000000003404A32L});
|
1998
|
+
public static final BitSet FOLLOW_single_type_expr_in_single_type_expr566 = new BitSet(new long[]{0x0000000000000002L});
|
1999
|
+
public static final BitSet FOLLOW_14_in_single_type_expr571 = new BitSet(new long[]{0x0000000003404A30L});
|
2000
|
+
public static final BitSet FOLLOW_type_expr_in_single_type_expr575 = new BitSet(new long[]{0x0000000000008000L});
|
2001
|
+
public static final BitSet FOLLOW_15_in_single_type_expr577 = new BitSet(new long[]{0x0000000000000002L});
|
2002
|
+
public static final BitSet FOLLOW_25_in_single_type_expr588 = new BitSet(new long[]{0x0000000003404A30L});
|
2003
|
+
public static final BitSet FOLLOW_single_type_expr_in_single_type_expr593 = new BitSet(new long[]{0x0000000000000002L});
|
2004
|
+
public static final BitSet FOLLOW_14_in_single_type_expr597 = new BitSet(new long[]{0x0000000003404A30L});
|
2005
|
+
public static final BitSet FOLLOW_type_expr_in_single_type_expr601 = new BitSet(new long[]{0x0000000000008000L});
|
2006
|
+
public static final BitSet FOLLOW_15_in_single_type_expr603 = new BitSet(new long[]{0x0000000000000002L});
|
2007
|
+
public static final BitSet FOLLOW_26_in_or_type_list627 = new BitSet(new long[]{0x0000000003404A30L});
|
2008
|
+
public static final BitSet FOLLOW_single_type_expr_in_or_type_list629 = new BitSet(new long[]{0x0000000004000002L});
|
2009
|
+
public static final BitSet FOLLOW_or_type_list_in_or_type_list633 = new BitSet(new long[]{0x0000000000000002L});
|
2010
|
+
public static final BitSet FOLLOW_CONST_ID_in_type_ident657 = new BitSet(new long[]{0x0000000000000202L});
|
2011
|
+
public static final BitSet FOLLOW_9_in_type_ident660 = new BitSet(new long[]{0x0000000000000220L});
|
2012
|
+
public static final BitSet FOLLOW_type_ident_in_type_ident664 = new BitSet(new long[]{0x0000000000000002L});
|
2013
|
+
public static final BitSet FOLLOW_9_in_type_ident676 = new BitSet(new long[]{0x0000000000000220L});
|
2014
|
+
public static final BitSet FOLLOW_type_ident_in_type_ident680 = new BitSet(new long[]{0x0000000000000002L});
|
2015
|
+
public static final BitSet FOLLOW_ID_in_type_var703 = new BitSet(new long[]{0x0000000000000002L});
|
2016
|
+
public static final BitSet FOLLOW_type_var_in_type_var_list726 = new BitSet(new long[]{0x0000000000100002L});
|
2017
|
+
public static final BitSet FOLLOW_20_in_type_var_list729 = new BitSet(new long[]{0x0000000000000010L});
|
2018
|
+
public static final BitSet FOLLOW_type_var_list_in_type_var_list733 = new BitSet(new long[]{0x0000000000000002L});
|
2019
|
+
public static final BitSet FOLLOW_method_type_in_synpred1_TypeAnnotation53 = new BitSet(new long[]{0x0000000000000002L});
|
2020
|
+
public static final BitSet FOLLOW_set_in_synpred5_TypeAnnotation93 = new BitSet(new long[]{0x0000000000000600L});
|
2021
|
+
public static final BitSet FOLLOW_set_in_synpred5_TypeAnnotation99 = new BitSet(new long[]{0x0000000000000002L});
|
2022
|
+
public static final BitSet FOLLOW_single_type_expr_in_synpred30_TypeAnnotation566 = new BitSet(new long[]{0x0000000000000002L});
|
2023
|
+
public static final BitSet FOLLOW_single_type_expr_in_synpred32_TypeAnnotation593 = new BitSet(new long[]{0x0000000000000002L});
|
2024
|
+
|
2025
|
+
}
|