Merge pull request #55 from eclipse/cd_issue20

[LanguageServer] Fix HoverService
This commit is contained in:
Christian Dietrich 2016-07-26 10:57:19 +02:00 committed by GitHub
commit bf9021d822
30 changed files with 1552 additions and 634 deletions

View file

@ -8,6 +8,7 @@
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="TypeDeclaration">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="superType" eType="#//TypeDeclaration"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="properties" upperBound="-1"
eType="#//Property" containment="true"/>
</eClassifiers>

View file

@ -11,6 +11,7 @@
</genClasses>
<genClasses ecoreClass="TestLanguage.ecore#//TypeDeclaration">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute TestLanguage.ecore#//TypeDeclaration/name"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference TestLanguage.ecore#//TypeDeclaration/superType"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference TestLanguage.ecore#//TypeDeclaration/properties"/>
</genClasses>
<genClasses ecoreClass="TestLanguage.ecore#//Property">

View file

@ -9,7 +9,6 @@ package org.eclipse.xtext.ide.tests.server
import io.typefox.lsapi.builders.RangeBuilder
import org.eclipse.xtext.ide.server.formatting.FormattingService
import org.eclipse.xtext.testing.AbstractLanguageServerTest
import org.junit.Test
/**

View file

@ -67,4 +67,51 @@ class HoverTest extends AbstractTestLangLanguageServerTest {
]
}
@Test
def void testHover_04() {
testHover[
model = '''
/**
* Some documentation.
*/
type Foo {
}
type Bar extends Foo {
}
'''
line = 5
column = 'type Bar extends F'.length
expectedHover = '''
[[5, 17] .. [5, 20]]
Some documentation.
'''
]
}
@Test
def void testHover_05() {
testHover[
referencedModels = [
val referenceModel = '''
/**
* Some documentation.
*/
type Foo {
}
'''
val fileUri = 'MyModel2.' + fileExtension -> referenceModel
open(fileUri, referenceModel)
]
model = '''
type Bar extends Foo {
}
'''
column = 'type Bar extends F'.length
expectedHover = '''
[[0, 17] .. [0, 20]]
Some documentation.
'''
]
}
}

View file

@ -42,12 +42,14 @@ public class TestLanguageParser extends AbstractContentAssistParser {
put(grammarAccess.getTypeAccess().getAlternatives_0(), "rule__Type__Alternatives_0");
put(grammarAccess.getPrimitiveTypeAccess().getNameAlternatives_0(), "rule__PrimitiveType__NameAlternatives_0");
put(grammarAccess.getTypeDeclarationAccess().getGroup(), "rule__TypeDeclaration__Group__0");
put(grammarAccess.getTypeDeclarationAccess().getGroup_2(), "rule__TypeDeclaration__Group_2__0");
put(grammarAccess.getPropertyAccess().getGroup(), "rule__Property__Group__0");
put(grammarAccess.getTypeAccess().getGroup(), "rule__Type__Group__0");
put(grammarAccess.getTypeAccess().getGroup_1(), "rule__Type__Group_1__0");
put(grammarAccess.getModelAccess().getTypesAssignment(), "rule__Model__TypesAssignment");
put(grammarAccess.getTypeDeclarationAccess().getNameAssignment_1(), "rule__TypeDeclaration__NameAssignment_1");
put(grammarAccess.getTypeDeclarationAccess().getPropertiesAssignment_3(), "rule__TypeDeclaration__PropertiesAssignment_3");
put(grammarAccess.getTypeDeclarationAccess().getSuperTypeAssignment_2_1(), "rule__TypeDeclaration__SuperTypeAssignment_2_1");
put(grammarAccess.getTypeDeclarationAccess().getPropertiesAssignment_4(), "rule__TypeDeclaration__PropertiesAssignment_4");
put(grammarAccess.getPropertyAccess().getTypeAssignment_0(), "rule__Property__TypeAssignment_0");
put(grammarAccess.getPropertyAccess().getNameAssignment_1(), "rule__Property__NameAssignment_1");
put(grammarAccess.getTypeAccess().getArrayDiemensionsAssignment_1_0(), "rule__Type__ArrayDiemensionsAssignment_1_0");

View file

@ -323,9 +323,9 @@ rule__TypeDeclaration__Group__2__Impl
}
:
(
{ before(grammarAccess.getTypeDeclarationAccess().getLeftCurlyBracketKeyword_2()); }
'{'
{ after(grammarAccess.getTypeDeclarationAccess().getLeftCurlyBracketKeyword_2()); }
{ before(grammarAccess.getTypeDeclarationAccess().getGroup_2()); }
(rule__TypeDeclaration__Group_2__0)?
{ after(grammarAccess.getTypeDeclarationAccess().getGroup_2()); }
)
;
finally {
@ -350,9 +350,9 @@ rule__TypeDeclaration__Group__3__Impl
}
:
(
{ before(grammarAccess.getTypeDeclarationAccess().getPropertiesAssignment_3()); }
(rule__TypeDeclaration__PropertiesAssignment_3)*
{ after(grammarAccess.getTypeDeclarationAccess().getPropertiesAssignment_3()); }
{ before(grammarAccess.getTypeDeclarationAccess().getLeftCurlyBracketKeyword_3()); }
'{'
{ after(grammarAccess.getTypeDeclarationAccess().getLeftCurlyBracketKeyword_3()); }
)
;
finally {
@ -365,6 +365,7 @@ rule__TypeDeclaration__Group__4
}
:
rule__TypeDeclaration__Group__4__Impl
rule__TypeDeclaration__Group__5
;
finally {
restoreStackSize(stackSize);
@ -376,9 +377,89 @@ rule__TypeDeclaration__Group__4__Impl
}
:
(
{ before(grammarAccess.getTypeDeclarationAccess().getRightCurlyBracketKeyword_4()); }
{ before(grammarAccess.getTypeDeclarationAccess().getPropertiesAssignment_4()); }
(rule__TypeDeclaration__PropertiesAssignment_4)*
{ after(grammarAccess.getTypeDeclarationAccess().getPropertiesAssignment_4()); }
)
;
finally {
restoreStackSize(stackSize);
}
rule__TypeDeclaration__Group__5
@init {
int stackSize = keepStackSize();
}
:
rule__TypeDeclaration__Group__5__Impl
;
finally {
restoreStackSize(stackSize);
}
rule__TypeDeclaration__Group__5__Impl
@init {
int stackSize = keepStackSize();
}
:
(
{ before(grammarAccess.getTypeDeclarationAccess().getRightCurlyBracketKeyword_5()); }
'}'
{ after(grammarAccess.getTypeDeclarationAccess().getRightCurlyBracketKeyword_4()); }
{ after(grammarAccess.getTypeDeclarationAccess().getRightCurlyBracketKeyword_5()); }
)
;
finally {
restoreStackSize(stackSize);
}
rule__TypeDeclaration__Group_2__0
@init {
int stackSize = keepStackSize();
}
:
rule__TypeDeclaration__Group_2__0__Impl
rule__TypeDeclaration__Group_2__1
;
finally {
restoreStackSize(stackSize);
}
rule__TypeDeclaration__Group_2__0__Impl
@init {
int stackSize = keepStackSize();
}
:
(
{ before(grammarAccess.getTypeDeclarationAccess().getExtendsKeyword_2_0()); }
'extends'
{ after(grammarAccess.getTypeDeclarationAccess().getExtendsKeyword_2_0()); }
)
;
finally {
restoreStackSize(stackSize);
}
rule__TypeDeclaration__Group_2__1
@init {
int stackSize = keepStackSize();
}
:
rule__TypeDeclaration__Group_2__1__Impl
;
finally {
restoreStackSize(stackSize);
}
rule__TypeDeclaration__Group_2__1__Impl
@init {
int stackSize = keepStackSize();
}
:
(
{ before(grammarAccess.getTypeDeclarationAccess().getSuperTypeAssignment_2_1()); }
(rule__TypeDeclaration__SuperTypeAssignment_2_1)
{ after(grammarAccess.getTypeDeclarationAccess().getSuperTypeAssignment_2_1()); }
)
;
finally {
@ -578,15 +659,34 @@ finally {
restoreStackSize(stackSize);
}
rule__TypeDeclaration__PropertiesAssignment_3
rule__TypeDeclaration__SuperTypeAssignment_2_1
@init {
int stackSize = keepStackSize();
}
:
(
{ before(grammarAccess.getTypeDeclarationAccess().getPropertiesPropertyParserRuleCall_3_0()); }
{ before(grammarAccess.getTypeDeclarationAccess().getSuperTypeTypeDeclarationCrossReference_2_1_0()); }
(
{ before(grammarAccess.getTypeDeclarationAccess().getSuperTypeTypeDeclarationIDTerminalRuleCall_2_1_0_1()); }
RULE_ID
{ after(grammarAccess.getTypeDeclarationAccess().getSuperTypeTypeDeclarationIDTerminalRuleCall_2_1_0_1()); }
)
{ after(grammarAccess.getTypeDeclarationAccess().getSuperTypeTypeDeclarationCrossReference_2_1_0()); }
)
;
finally {
restoreStackSize(stackSize);
}
rule__TypeDeclaration__PropertiesAssignment_4
@init {
int stackSize = keepStackSize();
}
:
(
{ before(grammarAccess.getTypeDeclarationAccess().getPropertiesPropertyParserRuleCall_4_0()); }
ruleProperty
{ after(grammarAccess.getTypeDeclarationAccess().getPropertiesPropertyParserRuleCall_3_0()); }
{ after(grammarAccess.getTypeDeclarationAccess().getPropertiesPropertyParserRuleCall_4_0()); }
)
;
finally {

View file

@ -1,6 +1,7 @@
'['=18
']'=17
'['=19
']'=18
'boolean'=13
'extends'=17
'int'=12
'string'=11
'type'=14
@ -21,3 +22,4 @@ T__15=15
T__16=16
T__17=17
T__18=18
T__19=19

View file

@ -12,22 +12,23 @@ import java.util.ArrayList;
@SuppressWarnings("all")
public class InternalTestLanguageLexer extends Lexer {
public static final int RULE_ID=4;
public static final int RULE_WS=9;
public static final int RULE_STRING=6;
public static final int RULE_ANY_OTHER=10;
public static final int RULE_SL_COMMENT=8;
public static final int T__19=19;
public static final int T__15=15;
public static final int T__16=16;
public static final int T__17=17;
public static final int RULE_INT=5;
public static final int T__18=18;
public static final int T__11=11;
public static final int RULE_ML_COMMENT=7;
public static final int T__12=12;
public static final int T__13=13;
public static final int T__14=14;
public static final int EOF=-1;
public static final int RULE_ID=4;
public static final int RULE_WS=9;
public static final int RULE_ANY_OTHER=10;
public static final int RULE_INT=5;
public static final int RULE_ML_COMMENT=7;
// delegates
// delegators
@ -171,10 +172,11 @@ public class InternalTestLanguageLexer extends Lexer {
try {
int _type = T__17;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalTestLanguage.g:17:7: ( ']' )
// InternalTestLanguage.g:17:9: ']'
// InternalTestLanguage.g:17:7: ( 'extends' )
// InternalTestLanguage.g:17:9: 'extends'
{
match(']');
match("extends");
}
@ -191,10 +193,10 @@ public class InternalTestLanguageLexer extends Lexer {
try {
int _type = T__18;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalTestLanguage.g:18:7: ( '[' )
// InternalTestLanguage.g:18:9: '['
// InternalTestLanguage.g:18:7: ( ']' )
// InternalTestLanguage.g:18:9: ']'
{
match('[');
match(']');
}
@ -206,15 +208,35 @@ public class InternalTestLanguageLexer extends Lexer {
}
// $ANTLR end "T__18"
// $ANTLR start "T__19"
public final void mT__19() throws RecognitionException {
try {
int _type = T__19;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalTestLanguage.g:19:7: ( '[' )
// InternalTestLanguage.g:19:9: '['
{
match('[');
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__19"
// $ANTLR start "RULE_ID"
public final void mRULE_ID() throws RecognitionException {
try {
int _type = RULE_ID;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalTestLanguage.g:679:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* )
// InternalTestLanguage.g:679:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
// InternalTestLanguage.g:779:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* )
// InternalTestLanguage.g:779:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
{
// InternalTestLanguage.g:679:11: ( '^' )?
// InternalTestLanguage.g:779:11: ( '^' )?
int alt1=2;
int LA1_0 = input.LA(1);
@ -223,7 +245,7 @@ public class InternalTestLanguageLexer extends Lexer {
}
switch (alt1) {
case 1 :
// InternalTestLanguage.g:679:11: '^'
// InternalTestLanguage.g:779:11: '^'
{
match('^');
@ -241,7 +263,7 @@ public class InternalTestLanguageLexer extends Lexer {
recover(mse);
throw mse;}
// InternalTestLanguage.g:679:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
// InternalTestLanguage.g:779:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
loop2:
do {
int alt2=2;
@ -290,10 +312,10 @@ public class InternalTestLanguageLexer extends Lexer {
try {
int _type = RULE_INT;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalTestLanguage.g:681:10: ( ( '0' .. '9' )+ )
// InternalTestLanguage.g:681:12: ( '0' .. '9' )+
// InternalTestLanguage.g:781:10: ( ( '0' .. '9' )+ )
// InternalTestLanguage.g:781:12: ( '0' .. '9' )+
{
// InternalTestLanguage.g:681:12: ( '0' .. '9' )+
// InternalTestLanguage.g:781:12: ( '0' .. '9' )+
int cnt3=0;
loop3:
do {
@ -307,7 +329,7 @@ public class InternalTestLanguageLexer extends Lexer {
switch (alt3) {
case 1 :
// InternalTestLanguage.g:681:13: '0' .. '9'
// InternalTestLanguage.g:781:13: '0' .. '9'
{
matchRange('0','9');
@ -339,10 +361,10 @@ public class InternalTestLanguageLexer extends Lexer {
try {
int _type = RULE_STRING;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalTestLanguage.g:683:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) )
// InternalTestLanguage.g:683:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
// InternalTestLanguage.g:783:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) )
// InternalTestLanguage.g:783:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
{
// InternalTestLanguage.g:683:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
// InternalTestLanguage.g:783:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
int alt6=2;
int LA6_0 = input.LA(1);
@ -360,10 +382,10 @@ public class InternalTestLanguageLexer extends Lexer {
}
switch (alt6) {
case 1 :
// InternalTestLanguage.g:683:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"'
// InternalTestLanguage.g:783:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"'
{
match('\"');
// InternalTestLanguage.g:683:20: ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )*
// InternalTestLanguage.g:783:20: ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )*
loop4:
do {
int alt4=3;
@ -379,7 +401,7 @@ public class InternalTestLanguageLexer extends Lexer {
switch (alt4) {
case 1 :
// InternalTestLanguage.g:683:21: '\\\\' .
// InternalTestLanguage.g:783:21: '\\\\' .
{
match('\\');
matchAny();
@ -387,7 +409,7 @@ public class InternalTestLanguageLexer extends Lexer {
}
break;
case 2 :
// InternalTestLanguage.g:683:28: ~ ( ( '\\\\' | '\"' ) )
// InternalTestLanguage.g:783:28: ~ ( ( '\\\\' | '\"' ) )
{
if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) {
input.consume();
@ -412,10 +434,10 @@ public class InternalTestLanguageLexer extends Lexer {
}
break;
case 2 :
// InternalTestLanguage.g:683:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\''
// InternalTestLanguage.g:783:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\''
{
match('\'');
// InternalTestLanguage.g:683:53: ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )*
// InternalTestLanguage.g:783:53: ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )*
loop5:
do {
int alt5=3;
@ -431,7 +453,7 @@ public class InternalTestLanguageLexer extends Lexer {
switch (alt5) {
case 1 :
// InternalTestLanguage.g:683:54: '\\\\' .
// InternalTestLanguage.g:783:54: '\\\\' .
{
match('\\');
matchAny();
@ -439,7 +461,7 @@ public class InternalTestLanguageLexer extends Lexer {
}
break;
case 2 :
// InternalTestLanguage.g:683:61: ~ ( ( '\\\\' | '\\'' ) )
// InternalTestLanguage.g:783:61: ~ ( ( '\\\\' | '\\'' ) )
{
if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) {
input.consume();
@ -482,12 +504,12 @@ public class InternalTestLanguageLexer extends Lexer {
try {
int _type = RULE_ML_COMMENT;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalTestLanguage.g:685:17: ( '/*' ( options {greedy=false; } : . )* '*/' )
// InternalTestLanguage.g:685:19: '/*' ( options {greedy=false; } : . )* '*/'
// InternalTestLanguage.g:785:17: ( '/*' ( options {greedy=false; } : . )* '*/' )
// InternalTestLanguage.g:785:19: '/*' ( options {greedy=false; } : . )* '*/'
{
match("/*");
// InternalTestLanguage.g:685:24: ( options {greedy=false; } : . )*
// InternalTestLanguage.g:785:24: ( options {greedy=false; } : . )*
loop7:
do {
int alt7=2;
@ -512,7 +534,7 @@ public class InternalTestLanguageLexer extends Lexer {
switch (alt7) {
case 1 :
// InternalTestLanguage.g:685:52: .
// InternalTestLanguage.g:785:52: .
{
matchAny();
@ -542,12 +564,12 @@ public class InternalTestLanguageLexer extends Lexer {
try {
int _type = RULE_SL_COMMENT;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalTestLanguage.g:687:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? )
// InternalTestLanguage.g:687:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )?
// InternalTestLanguage.g:787:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? )
// InternalTestLanguage.g:787:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )?
{
match("//");
// InternalTestLanguage.g:687:24: (~ ( ( '\\n' | '\\r' ) ) )*
// InternalTestLanguage.g:787:24: (~ ( ( '\\n' | '\\r' ) ) )*
loop8:
do {
int alt8=2;
@ -560,7 +582,7 @@ public class InternalTestLanguageLexer extends Lexer {
switch (alt8) {
case 1 :
// InternalTestLanguage.g:687:24: ~ ( ( '\\n' | '\\r' ) )
// InternalTestLanguage.g:787:24: ~ ( ( '\\n' | '\\r' ) )
{
if ( (input.LA(1)>='\u0000' && input.LA(1)<='\t')||(input.LA(1)>='\u000B' && input.LA(1)<='\f')||(input.LA(1)>='\u000E' && input.LA(1)<='\uFFFF') ) {
input.consume();
@ -580,7 +602,7 @@ public class InternalTestLanguageLexer extends Lexer {
}
} while (true);
// InternalTestLanguage.g:687:40: ( ( '\\r' )? '\\n' )?
// InternalTestLanguage.g:787:40: ( ( '\\r' )? '\\n' )?
int alt10=2;
int LA10_0 = input.LA(1);
@ -589,9 +611,9 @@ public class InternalTestLanguageLexer extends Lexer {
}
switch (alt10) {
case 1 :
// InternalTestLanguage.g:687:41: ( '\\r' )? '\\n'
// InternalTestLanguage.g:787:41: ( '\\r' )? '\\n'
{
// InternalTestLanguage.g:687:41: ( '\\r' )?
// InternalTestLanguage.g:787:41: ( '\\r' )?
int alt9=2;
int LA9_0 = input.LA(1);
@ -600,7 +622,7 @@ public class InternalTestLanguageLexer extends Lexer {
}
switch (alt9) {
case 1 :
// InternalTestLanguage.g:687:41: '\\r'
// InternalTestLanguage.g:787:41: '\\r'
{
match('\r');
@ -632,10 +654,10 @@ public class InternalTestLanguageLexer extends Lexer {
try {
int _type = RULE_WS;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalTestLanguage.g:689:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ )
// InternalTestLanguage.g:689:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
// InternalTestLanguage.g:789:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ )
// InternalTestLanguage.g:789:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
{
// InternalTestLanguage.g:689:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
// InternalTestLanguage.g:789:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
int cnt11=0;
loop11:
do {
@ -689,8 +711,8 @@ public class InternalTestLanguageLexer extends Lexer {
try {
int _type = RULE_ANY_OTHER;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalTestLanguage.g:691:16: ( . )
// InternalTestLanguage.g:691:18: .
// InternalTestLanguage.g:791:16: ( . )
// InternalTestLanguage.g:791:18: .
{
matchAny();
@ -705,8 +727,8 @@ public class InternalTestLanguageLexer extends Lexer {
// $ANTLR end "RULE_ANY_OTHER"
public void mTokens() throws RecognitionException {
// InternalTestLanguage.g:1:8: ( T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER )
int alt12=15;
// InternalTestLanguage.g:1:8: ( T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | T__19 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER )
int alt12=16;
alt12 = dfa12.predict(input);
switch (alt12) {
case 1 :
@ -766,49 +788,56 @@ public class InternalTestLanguageLexer extends Lexer {
}
break;
case 9 :
// InternalTestLanguage.g:1:58: RULE_ID
// InternalTestLanguage.g:1:58: T__19
{
mT__19();
}
break;
case 10 :
// InternalTestLanguage.g:1:64: RULE_ID
{
mRULE_ID();
}
break;
case 10 :
// InternalTestLanguage.g:1:66: RULE_INT
case 11 :
// InternalTestLanguage.g:1:72: RULE_INT
{
mRULE_INT();
}
break;
case 11 :
// InternalTestLanguage.g:1:75: RULE_STRING
case 12 :
// InternalTestLanguage.g:1:81: RULE_STRING
{
mRULE_STRING();
}
break;
case 12 :
// InternalTestLanguage.g:1:87: RULE_ML_COMMENT
case 13 :
// InternalTestLanguage.g:1:93: RULE_ML_COMMENT
{
mRULE_ML_COMMENT();
}
break;
case 13 :
// InternalTestLanguage.g:1:103: RULE_SL_COMMENT
case 14 :
// InternalTestLanguage.g:1:109: RULE_SL_COMMENT
{
mRULE_SL_COMMENT();
}
break;
case 14 :
// InternalTestLanguage.g:1:119: RULE_WS
case 15 :
// InternalTestLanguage.g:1:125: RULE_WS
{
mRULE_WS();
}
break;
case 15 :
// InternalTestLanguage.g:1:127: RULE_ANY_OTHER
case 16 :
// InternalTestLanguage.g:1:133: RULE_ANY_OTHER
{
mRULE_ANY_OTHER();
@ -822,64 +851,72 @@ public class InternalTestLanguageLexer extends Lexer {
protected DFA12 dfa12 = new DFA12(this);
static final String DFA12_eotS =
"\1\uffff\4\22\4\uffff\1\20\2\uffff\3\20\2\uffff\1\22\1\uffff\3\22\11\uffff\1\22\1\44\3\22\1\uffff\1\22\1\51\2\22\1\uffff\1\54\1\22\1\uffff\1\56\1\uffff";
"\1\uffff\4\23\2\uffff\1\23\2\uffff\1\21\2\uffff\3\21\2\uffff\1\23\1\uffff\3\23\2\uffff\1\23\7\uffff\1\23\1\47\4\23\1\uffff\1\23\1\55\3\23\1\uffff\1\23\1\62\2\23\1\uffff\1\65\1\66\2\uffff";
static final String DFA12_eofS =
"\57\uffff";
"\67\uffff";
static final String DFA12_minS =
"\1\0\1\164\1\156\1\157\1\171\4\uffff\1\101\2\uffff\2\0\1\52\2\uffff\1\162\1\uffff\1\164\1\157\1\160\11\uffff\1\151\1\60\1\154\1\145\1\156\1\uffff\1\145\1\60\1\147\1\141\1\uffff\1\60\1\156\1\uffff\1\60\1\uffff";
"\1\0\1\164\1\156\1\157\1\171\2\uffff\1\170\2\uffff\1\101\2\uffff\2\0\1\52\2\uffff\1\162\1\uffff\1\164\1\157\1\160\2\uffff\1\164\7\uffff\1\151\1\60\1\154\2\145\1\156\1\uffff\1\145\1\60\1\156\1\147\1\141\1\uffff\1\144\1\60\1\156\1\163\1\uffff\2\60\2\uffff";
static final String DFA12_maxS =
"\1\uffff\1\164\1\156\1\157\1\171\4\uffff\1\172\2\uffff\2\uffff\1\57\2\uffff\1\162\1\uffff\1\164\1\157\1\160\11\uffff\1\151\1\172\1\154\1\145\1\156\1\uffff\1\145\1\172\1\147\1\141\1\uffff\1\172\1\156\1\uffff\1\172\1\uffff";
"\1\uffff\1\164\1\156\1\157\1\171\2\uffff\1\170\2\uffff\1\172\2\uffff\2\uffff\1\57\2\uffff\1\162\1\uffff\1\164\1\157\1\160\2\uffff\1\164\7\uffff\1\151\1\172\1\154\2\145\1\156\1\uffff\1\145\1\172\1\156\1\147\1\141\1\uffff\1\144\1\172\1\156\1\163\1\uffff\2\172\2\uffff";
static final String DFA12_acceptS =
"\5\uffff\1\5\1\6\1\7\1\10\1\uffff\1\11\1\12\3\uffff\1\16\1\17\1\uffff\1\11\3\uffff\1\5\1\6\1\7\1\10\1\12\1\13\1\14\1\15\1\16\5\uffff\1\2\4\uffff\1\4\2\uffff\1\1\1\uffff\1\3";
"\5\uffff\1\5\1\6\1\uffff\1\10\1\11\1\uffff\1\12\1\13\3\uffff\1\17\1\20\1\uffff\1\12\3\uffff\1\5\1\6\1\uffff\1\10\1\11\1\13\1\14\1\15\1\16\1\17\6\uffff\1\2\5\uffff\1\4\4\uffff\1\1\2\uffff\1\3\1\7";
static final String DFA12_specialS =
"\1\1\13\uffff\1\2\1\0\41\uffff}>";
"\1\1\14\uffff\1\0\1\2\50\uffff}>";
static final String[] DFA12_transitionS = {
"\11\20\2\17\2\20\1\17\22\20\1\17\1\20\1\14\4\20\1\15\7\20\1\16\12\13\7\20\32\12\1\10\1\20\1\7\1\11\1\12\1\20\1\12\1\3\6\12\1\2\11\12\1\1\1\4\6\12\1\5\1\20\1\6\uff82\20",
"\1\21",
"\1\23",
"\11\21\2\20\2\21\1\20\22\21\1\20\1\21\1\15\4\21\1\16\7\21\1\17\12\14\7\21\32\13\1\11\1\21\1\10\1\12\1\13\1\21\1\13\1\3\2\13\1\7\3\13\1\2\11\13\1\1\1\4\6\13\1\5\1\21\1\6\uff82\21",
"\1\22",
"\1\24",
"\1\25",
"\1\26",
"",
"",
"\1\31",
"",
"",
"\32\22\4\uffff\1\22\1\uffff\32\22",
"\32\23\4\uffff\1\23\1\uffff\32\23",
"",
"",
"\0\33",
"\0\33",
"\1\34\4\uffff\1\35",
"\0\35",
"\0\35",
"\1\36\4\uffff\1\37",
"",
"",
"\1\37",
"",
"\1\40",
"\1\41",
"",
"\1\42",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"\1\43",
"\12\22\7\uffff\32\22\4\uffff\1\22\1\uffff\32\22",
"\1\45",
"\1\46",
"\1\47",
"\1\44",
"",
"",
"\1\45",
"",
"",
"",
"",
"",
"",
"",
"\1\46",
"\12\23\7\uffff\32\23\4\uffff\1\23\1\uffff\32\23",
"\1\50",
"\12\22\7\uffff\32\22\4\uffff\1\22\1\uffff\32\22",
"\1\51",
"\1\52",
"\1\53",
"",
"\12\22\7\uffff\32\22\4\uffff\1\22\1\uffff\32\22",
"\1\55",
"\1\54",
"\12\23\7\uffff\32\23\4\uffff\1\23\1\uffff\32\23",
"\1\56",
"\1\57",
"\1\60",
"",
"\1\61",
"\12\23\7\uffff\32\23\4\uffff\1\23\1\uffff\32\23",
"\1\63",
"\1\64",
"",
"\12\23\7\uffff\32\23\4\uffff\1\23\1\uffff\32\23",
"\12\23\7\uffff\32\23\4\uffff\1\23\1\uffff\32\23",
"",
"\12\22\7\uffff\32\22\4\uffff\1\22\1\uffff\32\22",
""
};
@ -913,7 +950,7 @@ public class InternalTestLanguageLexer extends Lexer {
this.transition = DFA12_transition;
}
public String getDescription() {
return "1:1: Tokens : ( T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER );";
return "1:1: Tokens : ( T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | T__19 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER );";
}
public int specialStateTransition(int s, IntStream _input) throws NoViableAltException {
IntStream input = _input;
@ -923,9 +960,9 @@ public class InternalTestLanguageLexer extends Lexer {
int LA12_13 = input.LA(1);
s = -1;
if ( ((LA12_13>='\u0000' && LA12_13<='\uFFFF')) ) {s = 27;}
if ( ((LA12_13>='\u0000' && LA12_13<='\uFFFF')) ) {s = 29;}
else s = 16;
else s = 17;
if ( s>=0 ) return s;
break;
@ -945,35 +982,37 @@ public class InternalTestLanguageLexer extends Lexer {
else if ( (LA12_0=='}') ) {s = 6;}
else if ( (LA12_0==']') ) {s = 7;}
else if ( (LA12_0=='e') ) {s = 7;}
else if ( (LA12_0=='[') ) {s = 8;}
else if ( (LA12_0==']') ) {s = 8;}
else if ( (LA12_0=='^') ) {s = 9;}
else if ( (LA12_0=='[') ) {s = 9;}
else if ( ((LA12_0>='A' && LA12_0<='Z')||LA12_0=='_'||LA12_0=='a'||(LA12_0>='c' && LA12_0<='h')||(LA12_0>='j' && LA12_0<='r')||(LA12_0>='u' && LA12_0<='z')) ) {s = 10;}
else if ( (LA12_0=='^') ) {s = 10;}
else if ( ((LA12_0>='0' && LA12_0<='9')) ) {s = 11;}
else if ( ((LA12_0>='A' && LA12_0<='Z')||LA12_0=='_'||LA12_0=='a'||(LA12_0>='c' && LA12_0<='d')||(LA12_0>='f' && LA12_0<='h')||(LA12_0>='j' && LA12_0<='r')||(LA12_0>='u' && LA12_0<='z')) ) {s = 11;}
else if ( (LA12_0=='\"') ) {s = 12;}
else if ( ((LA12_0>='0' && LA12_0<='9')) ) {s = 12;}
else if ( (LA12_0=='\'') ) {s = 13;}
else if ( (LA12_0=='\"') ) {s = 13;}
else if ( (LA12_0=='/') ) {s = 14;}
else if ( (LA12_0=='\'') ) {s = 14;}
else if ( ((LA12_0>='\t' && LA12_0<='\n')||LA12_0=='\r'||LA12_0==' ') ) {s = 15;}
else if ( (LA12_0=='/') ) {s = 15;}
else if ( ((LA12_0>='\u0000' && LA12_0<='\b')||(LA12_0>='\u000B' && LA12_0<='\f')||(LA12_0>='\u000E' && LA12_0<='\u001F')||LA12_0=='!'||(LA12_0>='#' && LA12_0<='&')||(LA12_0>='(' && LA12_0<='.')||(LA12_0>=':' && LA12_0<='@')||LA12_0=='\\'||LA12_0=='`'||LA12_0=='|'||(LA12_0>='~' && LA12_0<='\uFFFF')) ) {s = 16;}
else if ( ((LA12_0>='\t' && LA12_0<='\n')||LA12_0=='\r'||LA12_0==' ') ) {s = 16;}
else if ( ((LA12_0>='\u0000' && LA12_0<='\b')||(LA12_0>='\u000B' && LA12_0<='\f')||(LA12_0>='\u000E' && LA12_0<='\u001F')||LA12_0=='!'||(LA12_0>='#' && LA12_0<='&')||(LA12_0>='(' && LA12_0<='.')||(LA12_0>=':' && LA12_0<='@')||LA12_0=='\\'||LA12_0=='`'||LA12_0=='|'||(LA12_0>='~' && LA12_0<='\uFFFF')) ) {s = 17;}
if ( s>=0 ) return s;
break;
case 2 :
int LA12_12 = input.LA(1);
int LA12_14 = input.LA(1);
s = -1;
if ( ((LA12_12>='\u0000' && LA12_12<='\uFFFF')) ) {s = 27;}
if ( ((LA12_14>='\u0000' && LA12_14<='\uFFFF')) ) {s = 29;}
else s = 16;
else s = 17;
if ( s>=0 ) return s;
break;

View file

@ -138,16 +138,35 @@ ruleTypeDeclaration returns [EObject current=null]
}
)
)
otherlv_2='{'
(
otherlv_2='extends'
{
newLeafNode(otherlv_2, grammarAccess.getTypeDeclarationAccess().getExtendsKeyword_2_0());
}
(
(
{
if ($current==null) {
$current = createModelElement(grammarAccess.getTypeDeclarationRule());
}
}
otherlv_3=RULE_ID
{
newLeafNode(otherlv_3, grammarAccess.getTypeDeclarationAccess().getSuperTypeTypeDeclarationCrossReference_2_1_0());
}
)
)
)?
otherlv_4='{'
{
newLeafNode(otherlv_2, grammarAccess.getTypeDeclarationAccess().getLeftCurlyBracketKeyword_2());
newLeafNode(otherlv_4, grammarAccess.getTypeDeclarationAccess().getLeftCurlyBracketKeyword_3());
}
(
(
{
newCompositeNode(grammarAccess.getTypeDeclarationAccess().getPropertiesPropertyParserRuleCall_3_0());
newCompositeNode(grammarAccess.getTypeDeclarationAccess().getPropertiesPropertyParserRuleCall_4_0());
}
lv_properties_3_0=ruleProperty
lv_properties_5_0=ruleProperty
{
if ($current==null) {
$current = createModelElementForParent(grammarAccess.getTypeDeclarationRule());
@ -155,15 +174,15 @@ ruleTypeDeclaration returns [EObject current=null]
add(
$current,
"properties",
lv_properties_3_0,
lv_properties_5_0,
"org.eclipse.xtext.ide.tests.testlanguage.TestLanguage.Property");
afterParserOrEnumRuleCall();
}
)
)*
otherlv_4='}'
otherlv_6='}'
{
newLeafNode(otherlv_4, grammarAccess.getTypeDeclarationAccess().getRightCurlyBracketKeyword_4());
newLeafNode(otherlv_6, grammarAccess.getTypeDeclarationAccess().getRightCurlyBracketKeyword_5());
}
)
;

View file

@ -1,11 +1,12 @@
'['=14
']'=15
'boolean'=18
'int'=17
'string'=16
'['=15
']'=16
'boolean'=19
'extends'=12
'int'=18
'string'=17
'type'=11
'{'=12
'}'=13
'{'=13
'}'=14
RULE_ANY_OTHER=10
RULE_ID=4
RULE_INT=5
@ -21,3 +22,4 @@ T__15=15
T__16=16
T__17=17
T__18=18
T__19=19

View file

@ -12,22 +12,23 @@ import java.util.ArrayList;
@SuppressWarnings("all")
public class InternalTestLanguageLexer extends Lexer {
public static final int RULE_ID=4;
public static final int RULE_WS=9;
public static final int RULE_STRING=6;
public static final int RULE_ANY_OTHER=10;
public static final int RULE_SL_COMMENT=8;
public static final int T__19=19;
public static final int T__15=15;
public static final int T__16=16;
public static final int T__17=17;
public static final int RULE_INT=5;
public static final int T__18=18;
public static final int T__11=11;
public static final int RULE_ML_COMMENT=7;
public static final int T__12=12;
public static final int T__13=13;
public static final int T__14=14;
public static final int EOF=-1;
public static final int RULE_ID=4;
public static final int RULE_WS=9;
public static final int RULE_ANY_OTHER=10;
public static final int RULE_INT=5;
public static final int RULE_ML_COMMENT=7;
// delegates
// delegators
@ -68,10 +69,11 @@ public class InternalTestLanguageLexer extends Lexer {
try {
int _type = T__12;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalTestLanguage.g:12:7: ( '{' )
// InternalTestLanguage.g:12:9: '{'
// InternalTestLanguage.g:12:7: ( 'extends' )
// InternalTestLanguage.g:12:9: 'extends'
{
match('{');
match("extends");
}
@ -88,10 +90,10 @@ public class InternalTestLanguageLexer extends Lexer {
try {
int _type = T__13;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalTestLanguage.g:13:7: ( '}' )
// InternalTestLanguage.g:13:9: '}'
// InternalTestLanguage.g:13:7: ( '{' )
// InternalTestLanguage.g:13:9: '{'
{
match('}');
match('{');
}
@ -108,10 +110,10 @@ public class InternalTestLanguageLexer extends Lexer {
try {
int _type = T__14;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalTestLanguage.g:14:7: ( '[' )
// InternalTestLanguage.g:14:9: '['
// InternalTestLanguage.g:14:7: ( '}' )
// InternalTestLanguage.g:14:9: '}'
{
match('[');
match('}');
}
@ -128,10 +130,10 @@ public class InternalTestLanguageLexer extends Lexer {
try {
int _type = T__15;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalTestLanguage.g:15:7: ( ']' )
// InternalTestLanguage.g:15:9: ']'
// InternalTestLanguage.g:15:7: ( '[' )
// InternalTestLanguage.g:15:9: '['
{
match(']');
match('[');
}
@ -148,11 +150,10 @@ public class InternalTestLanguageLexer extends Lexer {
try {
int _type = T__16;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalTestLanguage.g:16:7: ( 'string' )
// InternalTestLanguage.g:16:9: 'string'
// InternalTestLanguage.g:16:7: ( ']' )
// InternalTestLanguage.g:16:9: ']'
{
match("string");
match(']');
}
@ -169,10 +170,10 @@ public class InternalTestLanguageLexer extends Lexer {
try {
int _type = T__17;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalTestLanguage.g:17:7: ( 'int' )
// InternalTestLanguage.g:17:9: 'int'
// InternalTestLanguage.g:17:7: ( 'string' )
// InternalTestLanguage.g:17:9: 'string'
{
match("int");
match("string");
}
@ -190,10 +191,10 @@ public class InternalTestLanguageLexer extends Lexer {
try {
int _type = T__18;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalTestLanguage.g:18:7: ( 'boolean' )
// InternalTestLanguage.g:18:9: 'boolean'
// InternalTestLanguage.g:18:7: ( 'int' )
// InternalTestLanguage.g:18:9: 'int'
{
match("boolean");
match("int");
}
@ -206,15 +207,36 @@ public class InternalTestLanguageLexer extends Lexer {
}
// $ANTLR end "T__18"
// $ANTLR start "T__19"
public final void mT__19() throws RecognitionException {
try {
int _type = T__19;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalTestLanguage.g:19:7: ( 'boolean' )
// InternalTestLanguage.g:19:9: 'boolean'
{
match("boolean");
}
state.type = _type;
state.channel = _channel;
}
finally {
}
}
// $ANTLR end "T__19"
// $ANTLR start "RULE_ID"
public final void mRULE_ID() throws RecognitionException {
try {
int _type = RULE_ID;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalTestLanguage.g:370:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* )
// InternalTestLanguage.g:370:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
// InternalTestLanguage.g:389:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* )
// InternalTestLanguage.g:389:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
{
// InternalTestLanguage.g:370:11: ( '^' )?
// InternalTestLanguage.g:389:11: ( '^' )?
int alt1=2;
int LA1_0 = input.LA(1);
@ -223,7 +245,7 @@ public class InternalTestLanguageLexer extends Lexer {
}
switch (alt1) {
case 1 :
// InternalTestLanguage.g:370:11: '^'
// InternalTestLanguage.g:389:11: '^'
{
match('^');
@ -241,7 +263,7 @@ public class InternalTestLanguageLexer extends Lexer {
recover(mse);
throw mse;}
// InternalTestLanguage.g:370:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
// InternalTestLanguage.g:389:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
loop2:
do {
int alt2=2;
@ -290,10 +312,10 @@ public class InternalTestLanguageLexer extends Lexer {
try {
int _type = RULE_INT;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalTestLanguage.g:372:10: ( ( '0' .. '9' )+ )
// InternalTestLanguage.g:372:12: ( '0' .. '9' )+
// InternalTestLanguage.g:391:10: ( ( '0' .. '9' )+ )
// InternalTestLanguage.g:391:12: ( '0' .. '9' )+
{
// InternalTestLanguage.g:372:12: ( '0' .. '9' )+
// InternalTestLanguage.g:391:12: ( '0' .. '9' )+
int cnt3=0;
loop3:
do {
@ -307,7 +329,7 @@ public class InternalTestLanguageLexer extends Lexer {
switch (alt3) {
case 1 :
// InternalTestLanguage.g:372:13: '0' .. '9'
// InternalTestLanguage.g:391:13: '0' .. '9'
{
matchRange('0','9');
@ -339,10 +361,10 @@ public class InternalTestLanguageLexer extends Lexer {
try {
int _type = RULE_STRING;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalTestLanguage.g:374:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) )
// InternalTestLanguage.g:374:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
// InternalTestLanguage.g:393:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) )
// InternalTestLanguage.g:393:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
{
// InternalTestLanguage.g:374:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
// InternalTestLanguage.g:393:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
int alt6=2;
int LA6_0 = input.LA(1);
@ -360,10 +382,10 @@ public class InternalTestLanguageLexer extends Lexer {
}
switch (alt6) {
case 1 :
// InternalTestLanguage.g:374:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"'
// InternalTestLanguage.g:393:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"'
{
match('\"');
// InternalTestLanguage.g:374:20: ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )*
// InternalTestLanguage.g:393:20: ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )*
loop4:
do {
int alt4=3;
@ -379,7 +401,7 @@ public class InternalTestLanguageLexer extends Lexer {
switch (alt4) {
case 1 :
// InternalTestLanguage.g:374:21: '\\\\' .
// InternalTestLanguage.g:393:21: '\\\\' .
{
match('\\');
matchAny();
@ -387,7 +409,7 @@ public class InternalTestLanguageLexer extends Lexer {
}
break;
case 2 :
// InternalTestLanguage.g:374:28: ~ ( ( '\\\\' | '\"' ) )
// InternalTestLanguage.g:393:28: ~ ( ( '\\\\' | '\"' ) )
{
if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) {
input.consume();
@ -412,10 +434,10 @@ public class InternalTestLanguageLexer extends Lexer {
}
break;
case 2 :
// InternalTestLanguage.g:374:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\''
// InternalTestLanguage.g:393:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\''
{
match('\'');
// InternalTestLanguage.g:374:53: ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )*
// InternalTestLanguage.g:393:53: ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )*
loop5:
do {
int alt5=3;
@ -431,7 +453,7 @@ public class InternalTestLanguageLexer extends Lexer {
switch (alt5) {
case 1 :
// InternalTestLanguage.g:374:54: '\\\\' .
// InternalTestLanguage.g:393:54: '\\\\' .
{
match('\\');
matchAny();
@ -439,7 +461,7 @@ public class InternalTestLanguageLexer extends Lexer {
}
break;
case 2 :
// InternalTestLanguage.g:374:61: ~ ( ( '\\\\' | '\\'' ) )
// InternalTestLanguage.g:393:61: ~ ( ( '\\\\' | '\\'' ) )
{
if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) {
input.consume();
@ -482,12 +504,12 @@ public class InternalTestLanguageLexer extends Lexer {
try {
int _type = RULE_ML_COMMENT;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalTestLanguage.g:376:17: ( '/*' ( options {greedy=false; } : . )* '*/' )
// InternalTestLanguage.g:376:19: '/*' ( options {greedy=false; } : . )* '*/'
// InternalTestLanguage.g:395:17: ( '/*' ( options {greedy=false; } : . )* '*/' )
// InternalTestLanguage.g:395:19: '/*' ( options {greedy=false; } : . )* '*/'
{
match("/*");
// InternalTestLanguage.g:376:24: ( options {greedy=false; } : . )*
// InternalTestLanguage.g:395:24: ( options {greedy=false; } : . )*
loop7:
do {
int alt7=2;
@ -512,7 +534,7 @@ public class InternalTestLanguageLexer extends Lexer {
switch (alt7) {
case 1 :
// InternalTestLanguage.g:376:52: .
// InternalTestLanguage.g:395:52: .
{
matchAny();
@ -542,12 +564,12 @@ public class InternalTestLanguageLexer extends Lexer {
try {
int _type = RULE_SL_COMMENT;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalTestLanguage.g:378:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? )
// InternalTestLanguage.g:378:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )?
// InternalTestLanguage.g:397:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? )
// InternalTestLanguage.g:397:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )?
{
match("//");
// InternalTestLanguage.g:378:24: (~ ( ( '\\n' | '\\r' ) ) )*
// InternalTestLanguage.g:397:24: (~ ( ( '\\n' | '\\r' ) ) )*
loop8:
do {
int alt8=2;
@ -560,7 +582,7 @@ public class InternalTestLanguageLexer extends Lexer {
switch (alt8) {
case 1 :
// InternalTestLanguage.g:378:24: ~ ( ( '\\n' | '\\r' ) )
// InternalTestLanguage.g:397:24: ~ ( ( '\\n' | '\\r' ) )
{
if ( (input.LA(1)>='\u0000' && input.LA(1)<='\t')||(input.LA(1)>='\u000B' && input.LA(1)<='\f')||(input.LA(1)>='\u000E' && input.LA(1)<='\uFFFF') ) {
input.consume();
@ -580,7 +602,7 @@ public class InternalTestLanguageLexer extends Lexer {
}
} while (true);
// InternalTestLanguage.g:378:40: ( ( '\\r' )? '\\n' )?
// InternalTestLanguage.g:397:40: ( ( '\\r' )? '\\n' )?
int alt10=2;
int LA10_0 = input.LA(1);
@ -589,9 +611,9 @@ public class InternalTestLanguageLexer extends Lexer {
}
switch (alt10) {
case 1 :
// InternalTestLanguage.g:378:41: ( '\\r' )? '\\n'
// InternalTestLanguage.g:397:41: ( '\\r' )? '\\n'
{
// InternalTestLanguage.g:378:41: ( '\\r' )?
// InternalTestLanguage.g:397:41: ( '\\r' )?
int alt9=2;
int LA9_0 = input.LA(1);
@ -600,7 +622,7 @@ public class InternalTestLanguageLexer extends Lexer {
}
switch (alt9) {
case 1 :
// InternalTestLanguage.g:378:41: '\\r'
// InternalTestLanguage.g:397:41: '\\r'
{
match('\r');
@ -632,10 +654,10 @@ public class InternalTestLanguageLexer extends Lexer {
try {
int _type = RULE_WS;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalTestLanguage.g:380:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ )
// InternalTestLanguage.g:380:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
// InternalTestLanguage.g:399:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ )
// InternalTestLanguage.g:399:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
{
// InternalTestLanguage.g:380:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
// InternalTestLanguage.g:399:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
int cnt11=0;
loop11:
do {
@ -689,8 +711,8 @@ public class InternalTestLanguageLexer extends Lexer {
try {
int _type = RULE_ANY_OTHER;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalTestLanguage.g:382:16: ( . )
// InternalTestLanguage.g:382:18: .
// InternalTestLanguage.g:401:16: ( . )
// InternalTestLanguage.g:401:18: .
{
matchAny();
@ -705,8 +727,8 @@ public class InternalTestLanguageLexer extends Lexer {
// $ANTLR end "RULE_ANY_OTHER"
public void mTokens() throws RecognitionException {
// InternalTestLanguage.g:1:8: ( T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER )
int alt12=15;
// InternalTestLanguage.g:1:8: ( T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | T__19 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER )
int alt12=16;
alt12 = dfa12.predict(input);
switch (alt12) {
case 1 :
@ -766,49 +788,56 @@ public class InternalTestLanguageLexer extends Lexer {
}
break;
case 9 :
// InternalTestLanguage.g:1:58: RULE_ID
// InternalTestLanguage.g:1:58: T__19
{
mT__19();
}
break;
case 10 :
// InternalTestLanguage.g:1:64: RULE_ID
{
mRULE_ID();
}
break;
case 10 :
// InternalTestLanguage.g:1:66: RULE_INT
case 11 :
// InternalTestLanguage.g:1:72: RULE_INT
{
mRULE_INT();
}
break;
case 11 :
// InternalTestLanguage.g:1:75: RULE_STRING
case 12 :
// InternalTestLanguage.g:1:81: RULE_STRING
{
mRULE_STRING();
}
break;
case 12 :
// InternalTestLanguage.g:1:87: RULE_ML_COMMENT
case 13 :
// InternalTestLanguage.g:1:93: RULE_ML_COMMENT
{
mRULE_ML_COMMENT();
}
break;
case 13 :
// InternalTestLanguage.g:1:103: RULE_SL_COMMENT
case 14 :
// InternalTestLanguage.g:1:109: RULE_SL_COMMENT
{
mRULE_SL_COMMENT();
}
break;
case 14 :
// InternalTestLanguage.g:1:119: RULE_WS
case 15 :
// InternalTestLanguage.g:1:125: RULE_WS
{
mRULE_WS();
}
break;
case 15 :
// InternalTestLanguage.g:1:127: RULE_ANY_OTHER
case 16 :
// InternalTestLanguage.g:1:133: RULE_ANY_OTHER
{
mRULE_ANY_OTHER();
@ -822,64 +851,72 @@ public class InternalTestLanguageLexer extends Lexer {
protected DFA12 dfa12 = new DFA12(this);
static final String DFA12_eotS =
"\1\uffff\1\22\4\uffff\3\22\1\20\2\uffff\3\20\2\uffff\1\22\5\uffff\3\22\5\uffff\2\22\1\45\1\22\1\47\1\22\1\uffff\1\22\1\uffff\2\22\1\54\1\22\1\uffff\1\56\1\uffff";
"\1\uffff\2\23\4\uffff\3\23\1\21\2\uffff\3\21\2\uffff\1\23\1\uffff\1\23\4\uffff\3\23\5\uffff\3\23\1\51\1\23\1\53\2\23\1\uffff\1\23\1\uffff\4\23\1\63\1\23\1\65\1\uffff\1\66\2\uffff";
static final String DFA12_eofS =
"\57\uffff";
"\67\uffff";
static final String DFA12_minS =
"\1\0\1\171\4\uffff\1\164\1\156\1\157\1\101\2\uffff\2\0\1\52\2\uffff\1\160\5\uffff\1\162\1\164\1\157\5\uffff\1\145\1\151\1\60\1\154\1\60\1\156\1\uffff\1\145\1\uffff\1\147\1\141\1\60\1\156\1\uffff\1\60\1\uffff";
"\1\0\1\171\1\170\4\uffff\1\164\1\156\1\157\1\101\2\uffff\2\0\1\52\2\uffff\1\160\1\uffff\1\164\4\uffff\1\162\1\164\1\157\5\uffff\2\145\1\151\1\60\1\154\1\60\2\156\1\uffff\1\145\1\uffff\1\144\1\147\1\141\1\163\1\60\1\156\1\60\1\uffff\1\60\2\uffff";
static final String DFA12_maxS =
"\1\uffff\1\171\4\uffff\1\164\1\156\1\157\1\172\2\uffff\2\uffff\1\57\2\uffff\1\160\5\uffff\1\162\1\164\1\157\5\uffff\1\145\1\151\1\172\1\154\1\172\1\156\1\uffff\1\145\1\uffff\1\147\1\141\1\172\1\156\1\uffff\1\172\1\uffff";
"\1\uffff\1\171\1\170\4\uffff\1\164\1\156\1\157\1\172\2\uffff\2\uffff\1\57\2\uffff\1\160\1\uffff\1\164\4\uffff\1\162\1\164\1\157\5\uffff\2\145\1\151\1\172\1\154\1\172\2\156\1\uffff\1\145\1\uffff\1\144\1\147\1\141\1\163\1\172\1\156\1\172\1\uffff\1\172\2\uffff";
static final String DFA12_acceptS =
"\2\uffff\1\2\1\3\1\4\1\5\4\uffff\1\11\1\12\3\uffff\1\16\1\17\1\uffff\1\11\1\2\1\3\1\4\1\5\3\uffff\1\12\1\13\1\14\1\15\1\16\6\uffff\1\7\1\uffff\1\1\4\uffff\1\6\1\uffff\1\10";
"\3\uffff\1\3\1\4\1\5\1\6\4\uffff\1\12\1\13\3\uffff\1\17\1\20\1\uffff\1\12\1\uffff\1\3\1\4\1\5\1\6\3\uffff\1\13\1\14\1\15\1\16\1\17\10\uffff\1\10\1\uffff\1\1\7\uffff\1\7\1\uffff\1\2\1\11";
static final String DFA12_specialS =
"\1\1\13\uffff\1\2\1\0\41\uffff}>";
"\1\2\14\uffff\1\0\1\1\50\uffff}>";
static final String[] DFA12_transitionS = {
"\11\20\2\17\2\20\1\17\22\20\1\17\1\20\1\14\4\20\1\15\7\20\1\16\12\13\7\20\32\12\1\4\1\20\1\5\1\11\1\12\1\20\1\12\1\10\6\12\1\7\11\12\1\6\1\1\6\12\1\2\1\20\1\3\uff82\20",
"\1\21",
"\11\21\2\20\2\21\1\20\22\21\1\20\1\21\1\15\4\21\1\16\7\21\1\17\12\14\7\21\32\13\1\5\1\21\1\6\1\12\1\13\1\21\1\13\1\11\2\13\1\2\3\13\1\10\11\13\1\7\1\1\6\13\1\3\1\21\1\4\uff82\21",
"\1\22",
"\1\24",
"",
"",
"",
"",
"\1\27",
"\1\30",
"\1\31",
"\32\22\4\uffff\1\22\1\uffff\32\22",
"\1\32",
"\1\33",
"\32\23\4\uffff\1\23\1\uffff\32\23",
"",
"",
"\0\33",
"\0\33",
"\1\34\4\uffff\1\35",
"\0\35",
"\0\35",
"\1\36\4\uffff\1\37",
"",
"",
"\1\37",
"",
"",
"",
"",
"",
"\1\40",
"\1\41",
"\1\42",
"",
"\1\42",
"",
"",
"",
"",
"\1\43",
"\1\44",
"\12\22\7\uffff\32\22\4\uffff\1\22\1\uffff\32\22",
"\1\45",
"",
"",
"",
"",
"",
"\1\46",
"\12\22\7\uffff\32\22\4\uffff\1\22\1\uffff\32\22",
"\1\47",
"\1\50",
"",
"\1\51",
"",
"\12\23\7\uffff\32\23\4\uffff\1\23\1\uffff\32\23",
"\1\52",
"\1\53",
"\12\22\7\uffff\32\22\4\uffff\1\22\1\uffff\32\22",
"\12\23\7\uffff\32\23\4\uffff\1\23\1\uffff\32\23",
"\1\54",
"\1\55",
"",
"\12\22\7\uffff\32\22\4\uffff\1\22\1\uffff\32\22",
"\1\56",
"",
"\1\57",
"\1\60",
"\1\61",
"\1\62",
"\12\23\7\uffff\32\23\4\uffff\1\23\1\uffff\32\23",
"\1\64",
"\12\23\7\uffff\32\23\4\uffff\1\23\1\uffff\32\23",
"",
"\12\23\7\uffff\32\23\4\uffff\1\23\1\uffff\32\23",
"",
""
};
@ -913,7 +950,7 @@ public class InternalTestLanguageLexer extends Lexer {
this.transition = DFA12_transition;
}
public String getDescription() {
return "1:1: Tokens : ( T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER );";
return "1:1: Tokens : ( T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | T__19 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER );";
}
public int specialStateTransition(int s, IntStream _input) throws NoViableAltException {
IntStream input = _input;
@ -923,57 +960,59 @@ public class InternalTestLanguageLexer extends Lexer {
int LA12_13 = input.LA(1);
s = -1;
if ( ((LA12_13>='\u0000' && LA12_13<='\uFFFF')) ) {s = 27;}
if ( ((LA12_13>='\u0000' && LA12_13<='\uFFFF')) ) {s = 29;}
else s = 16;
else s = 17;
if ( s>=0 ) return s;
break;
case 1 :
int LA12_14 = input.LA(1);
s = -1;
if ( ((LA12_14>='\u0000' && LA12_14<='\uFFFF')) ) {s = 29;}
else s = 17;
if ( s>=0 ) return s;
break;
case 2 :
int LA12_0 = input.LA(1);
s = -1;
if ( (LA12_0=='t') ) {s = 1;}
else if ( (LA12_0=='{') ) {s = 2;}
else if ( (LA12_0=='e') ) {s = 2;}
else if ( (LA12_0=='}') ) {s = 3;}
else if ( (LA12_0=='{') ) {s = 3;}
else if ( (LA12_0=='[') ) {s = 4;}
else if ( (LA12_0=='}') ) {s = 4;}
else if ( (LA12_0==']') ) {s = 5;}
else if ( (LA12_0=='[') ) {s = 5;}
else if ( (LA12_0=='s') ) {s = 6;}
else if ( (LA12_0==']') ) {s = 6;}
else if ( (LA12_0=='i') ) {s = 7;}
else if ( (LA12_0=='s') ) {s = 7;}
else if ( (LA12_0=='b') ) {s = 8;}
else if ( (LA12_0=='i') ) {s = 8;}
else if ( (LA12_0=='^') ) {s = 9;}
else if ( (LA12_0=='b') ) {s = 9;}
else if ( ((LA12_0>='A' && LA12_0<='Z')||LA12_0=='_'||LA12_0=='a'||(LA12_0>='c' && LA12_0<='h')||(LA12_0>='j' && LA12_0<='r')||(LA12_0>='u' && LA12_0<='z')) ) {s = 10;}
else if ( (LA12_0=='^') ) {s = 10;}
else if ( ((LA12_0>='0' && LA12_0<='9')) ) {s = 11;}
else if ( ((LA12_0>='A' && LA12_0<='Z')||LA12_0=='_'||LA12_0=='a'||(LA12_0>='c' && LA12_0<='d')||(LA12_0>='f' && LA12_0<='h')||(LA12_0>='j' && LA12_0<='r')||(LA12_0>='u' && LA12_0<='z')) ) {s = 11;}
else if ( (LA12_0=='\"') ) {s = 12;}
else if ( ((LA12_0>='0' && LA12_0<='9')) ) {s = 12;}
else if ( (LA12_0=='\'') ) {s = 13;}
else if ( (LA12_0=='\"') ) {s = 13;}
else if ( (LA12_0=='/') ) {s = 14;}
else if ( (LA12_0=='\'') ) {s = 14;}
else if ( ((LA12_0>='\t' && LA12_0<='\n')||LA12_0=='\r'||LA12_0==' ') ) {s = 15;}
else if ( (LA12_0=='/') ) {s = 15;}
else if ( ((LA12_0>='\u0000' && LA12_0<='\b')||(LA12_0>='\u000B' && LA12_0<='\f')||(LA12_0>='\u000E' && LA12_0<='\u001F')||LA12_0=='!'||(LA12_0>='#' && LA12_0<='&')||(LA12_0>='(' && LA12_0<='.')||(LA12_0>=':' && LA12_0<='@')||LA12_0=='\\'||LA12_0=='`'||LA12_0=='|'||(LA12_0>='~' && LA12_0<='\uFFFF')) ) {s = 16;}
else if ( ((LA12_0>='\t' && LA12_0<='\n')||LA12_0=='\r'||LA12_0==' ') ) {s = 16;}
if ( s>=0 ) return s;
break;
case 2 :
int LA12_12 = input.LA(1);
s = -1;
if ( ((LA12_12>='\u0000' && LA12_12<='\uFFFF')) ) {s = 27;}
else s = 16;
else if ( ((LA12_0>='\u0000' && LA12_0<='\b')||(LA12_0>='\u000B' && LA12_0<='\f')||(LA12_0>='\u000E' && LA12_0<='\u001F')||LA12_0=='!'||(LA12_0>='#' && LA12_0<='&')||(LA12_0>='(' && LA12_0<='.')||(LA12_0>=':' && LA12_0<='@')||LA12_0=='\\'||LA12_0=='`'||LA12_0=='|'||(LA12_0>='~' && LA12_0<='\uFFFF')) ) {s = 17;}
if ( s>=0 ) return s;
break;

View file

@ -21,24 +21,25 @@ import java.util.ArrayList;
@SuppressWarnings("all")
public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
public static final String[] tokenNames = new String[] {
"<invalid>", "<EOR>", "<DOWN>", "<UP>", "RULE_ID", "RULE_INT", "RULE_STRING", "RULE_ML_COMMENT", "RULE_SL_COMMENT", "RULE_WS", "RULE_ANY_OTHER", "'type'", "'{'", "'}'", "'['", "']'", "'string'", "'int'", "'boolean'"
"<invalid>", "<EOR>", "<DOWN>", "<UP>", "RULE_ID", "RULE_INT", "RULE_STRING", "RULE_ML_COMMENT", "RULE_SL_COMMENT", "RULE_WS", "RULE_ANY_OTHER", "'type'", "'extends'", "'{'", "'}'", "'['", "']'", "'string'", "'int'", "'boolean'"
};
public static final int RULE_ID=4;
public static final int RULE_WS=9;
public static final int RULE_STRING=6;
public static final int RULE_ANY_OTHER=10;
public static final int RULE_SL_COMMENT=8;
public static final int T__19=19;
public static final int T__15=15;
public static final int T__16=16;
public static final int T__17=17;
public static final int RULE_INT=5;
public static final int T__18=18;
public static final int T__11=11;
public static final int RULE_ML_COMMENT=7;
public static final int T__12=12;
public static final int T__13=13;
public static final int T__14=14;
public static final int EOF=-1;
public static final int RULE_ID=4;
public static final int RULE_WS=9;
public static final int RULE_ANY_OTHER=10;
public static final int RULE_INT=5;
public static final int RULE_ML_COMMENT=7;
// delegates
// delegators
@ -235,26 +236,28 @@ public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
// $ANTLR start "ruleTypeDeclaration"
// InternalTestLanguage.g:111:1: ruleTypeDeclaration returns [EObject current=null] : (otherlv_0= 'type' ( (lv_name_1_0= RULE_ID ) ) otherlv_2= '{' ( (lv_properties_3_0= ruleProperty ) )* otherlv_4= '}' ) ;
// InternalTestLanguage.g:111:1: ruleTypeDeclaration returns [EObject current=null] : (otherlv_0= 'type' ( (lv_name_1_0= RULE_ID ) ) (otherlv_2= 'extends' ( (otherlv_3= RULE_ID ) ) )? otherlv_4= '{' ( (lv_properties_5_0= ruleProperty ) )* otherlv_6= '}' ) ;
public final EObject ruleTypeDeclaration() throws RecognitionException {
EObject current = null;
Token otherlv_0=null;
Token lv_name_1_0=null;
Token otherlv_2=null;
Token otherlv_3=null;
Token otherlv_4=null;
EObject lv_properties_3_0 = null;
Token otherlv_6=null;
EObject lv_properties_5_0 = null;
enterRule();
try {
// InternalTestLanguage.g:117:2: ( (otherlv_0= 'type' ( (lv_name_1_0= RULE_ID ) ) otherlv_2= '{' ( (lv_properties_3_0= ruleProperty ) )* otherlv_4= '}' ) )
// InternalTestLanguage.g:118:2: (otherlv_0= 'type' ( (lv_name_1_0= RULE_ID ) ) otherlv_2= '{' ( (lv_properties_3_0= ruleProperty ) )* otherlv_4= '}' )
// InternalTestLanguage.g:117:2: ( (otherlv_0= 'type' ( (lv_name_1_0= RULE_ID ) ) (otherlv_2= 'extends' ( (otherlv_3= RULE_ID ) ) )? otherlv_4= '{' ( (lv_properties_5_0= ruleProperty ) )* otherlv_6= '}' ) )
// InternalTestLanguage.g:118:2: (otherlv_0= 'type' ( (lv_name_1_0= RULE_ID ) ) (otherlv_2= 'extends' ( (otherlv_3= RULE_ID ) ) )? otherlv_4= '{' ( (lv_properties_5_0= ruleProperty ) )* otherlv_6= '}' )
{
// InternalTestLanguage.g:118:2: (otherlv_0= 'type' ( (lv_name_1_0= RULE_ID ) ) otherlv_2= '{' ( (lv_properties_3_0= ruleProperty ) )* otherlv_4= '}' )
// InternalTestLanguage.g:119:3: otherlv_0= 'type' ( (lv_name_1_0= RULE_ID ) ) otherlv_2= '{' ( (lv_properties_3_0= ruleProperty ) )* otherlv_4= '}'
// InternalTestLanguage.g:118:2: (otherlv_0= 'type' ( (lv_name_1_0= RULE_ID ) ) (otherlv_2= 'extends' ( (otherlv_3= RULE_ID ) ) )? otherlv_4= '{' ( (lv_properties_5_0= ruleProperty ) )* otherlv_6= '}' )
// InternalTestLanguage.g:119:3: otherlv_0= 'type' ( (lv_name_1_0= RULE_ID ) ) (otherlv_2= 'extends' ( (otherlv_3= RULE_ID ) ) )? otherlv_4= '{' ( (lv_properties_5_0= ruleProperty ) )* otherlv_6= '}'
{
otherlv_0=(Token)match(input,11,FOLLOW_4);
@ -286,33 +289,75 @@ public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
}
otherlv_2=(Token)match(input,12,FOLLOW_6);
// InternalTestLanguage.g:141:3: (otherlv_2= 'extends' ( (otherlv_3= RULE_ID ) ) )?
int alt2=2;
int LA2_0 = input.LA(1);
newLeafNode(otherlv_2, grammarAccess.getTypeDeclarationAccess().getLeftCurlyBracketKeyword_2());
if ( (LA2_0==12) ) {
alt2=1;
}
switch (alt2) {
case 1 :
// InternalTestLanguage.g:142:4: otherlv_2= 'extends' ( (otherlv_3= RULE_ID ) )
{
otherlv_2=(Token)match(input,12,FOLLOW_4);
newLeafNode(otherlv_2, grammarAccess.getTypeDeclarationAccess().getExtendsKeyword_2_0());
// InternalTestLanguage.g:146:4: ( (otherlv_3= RULE_ID ) )
// InternalTestLanguage.g:147:5: (otherlv_3= RULE_ID )
{
// InternalTestLanguage.g:147:5: (otherlv_3= RULE_ID )
// InternalTestLanguage.g:148:6: otherlv_3= RULE_ID
{
if (current==null) {
current = createModelElement(grammarAccess.getTypeDeclarationRule());
}
otherlv_3=(Token)match(input,RULE_ID,FOLLOW_6);
newLeafNode(otherlv_3, grammarAccess.getTypeDeclarationAccess().getSuperTypeTypeDeclarationCrossReference_2_1_0());
}
}
}
break;
}
otherlv_4=(Token)match(input,13,FOLLOW_7);
newLeafNode(otherlv_4, grammarAccess.getTypeDeclarationAccess().getLeftCurlyBracketKeyword_3());
// InternalTestLanguage.g:145:3: ( (lv_properties_3_0= ruleProperty ) )*
loop2:
// InternalTestLanguage.g:164:3: ( (lv_properties_5_0= ruleProperty ) )*
loop3:
do {
int alt2=2;
int LA2_0 = input.LA(1);
int alt3=2;
int LA3_0 = input.LA(1);
if ( (LA2_0==RULE_ID||(LA2_0>=16 && LA2_0<=18)) ) {
alt2=1;
if ( (LA3_0==RULE_ID||(LA3_0>=17 && LA3_0<=19)) ) {
alt3=1;
}
switch (alt2) {
switch (alt3) {
case 1 :
// InternalTestLanguage.g:146:4: (lv_properties_3_0= ruleProperty )
// InternalTestLanguage.g:165:4: (lv_properties_5_0= ruleProperty )
{
// InternalTestLanguage.g:146:4: (lv_properties_3_0= ruleProperty )
// InternalTestLanguage.g:147:5: lv_properties_3_0= ruleProperty
// InternalTestLanguage.g:165:4: (lv_properties_5_0= ruleProperty )
// InternalTestLanguage.g:166:5: lv_properties_5_0= ruleProperty
{
newCompositeNode(grammarAccess.getTypeDeclarationAccess().getPropertiesPropertyParserRuleCall_3_0());
newCompositeNode(grammarAccess.getTypeDeclarationAccess().getPropertiesPropertyParserRuleCall_4_0());
pushFollow(FOLLOW_6);
lv_properties_3_0=ruleProperty();
pushFollow(FOLLOW_7);
lv_properties_5_0=ruleProperty();
state._fsp--;
@ -323,7 +368,7 @@ public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
add(
current,
"properties",
lv_properties_3_0,
lv_properties_5_0,
"org.eclipse.xtext.ide.tests.testlanguage.TestLanguage.Property");
afterParserOrEnumRuleCall();
@ -335,13 +380,13 @@ public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
break;
default :
break loop2;
break loop3;
}
} while (true);
otherlv_4=(Token)match(input,13,FOLLOW_2);
otherlv_6=(Token)match(input,14,FOLLOW_2);
newLeafNode(otherlv_4, grammarAccess.getTypeDeclarationAccess().getRightCurlyBracketKeyword_4());
newLeafNode(otherlv_6, grammarAccess.getTypeDeclarationAccess().getRightCurlyBracketKeyword_5());
}
@ -366,7 +411,7 @@ public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
// $ANTLR start "entryRuleProperty"
// InternalTestLanguage.g:172:1: entryRuleProperty returns [EObject current=null] : iv_ruleProperty= ruleProperty EOF ;
// InternalTestLanguage.g:191:1: entryRuleProperty returns [EObject current=null] : iv_ruleProperty= ruleProperty EOF ;
public final EObject entryRuleProperty() throws RecognitionException {
EObject current = null;
@ -374,8 +419,8 @@ public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
try {
// InternalTestLanguage.g:172:49: (iv_ruleProperty= ruleProperty EOF )
// InternalTestLanguage.g:173:2: iv_ruleProperty= ruleProperty EOF
// InternalTestLanguage.g:191:49: (iv_ruleProperty= ruleProperty EOF )
// InternalTestLanguage.g:192:2: iv_ruleProperty= ruleProperty EOF
{
newCompositeNode(grammarAccess.getPropertyRule());
pushFollow(FOLLOW_1);
@ -402,7 +447,7 @@ public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
// $ANTLR start "ruleProperty"
// InternalTestLanguage.g:179:1: ruleProperty returns [EObject current=null] : ( ( (lv_type_0_0= ruleType ) ) ( (lv_name_1_0= RULE_ID ) ) ) ;
// InternalTestLanguage.g:198:1: ruleProperty returns [EObject current=null] : ( ( (lv_type_0_0= ruleType ) ) ( (lv_name_1_0= RULE_ID ) ) ) ;
public final EObject ruleProperty() throws RecognitionException {
EObject current = null;
@ -414,17 +459,17 @@ public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
enterRule();
try {
// InternalTestLanguage.g:185:2: ( ( ( (lv_type_0_0= ruleType ) ) ( (lv_name_1_0= RULE_ID ) ) ) )
// InternalTestLanguage.g:186:2: ( ( (lv_type_0_0= ruleType ) ) ( (lv_name_1_0= RULE_ID ) ) )
// InternalTestLanguage.g:204:2: ( ( ( (lv_type_0_0= ruleType ) ) ( (lv_name_1_0= RULE_ID ) ) ) )
// InternalTestLanguage.g:205:2: ( ( (lv_type_0_0= ruleType ) ) ( (lv_name_1_0= RULE_ID ) ) )
{
// InternalTestLanguage.g:186:2: ( ( (lv_type_0_0= ruleType ) ) ( (lv_name_1_0= RULE_ID ) ) )
// InternalTestLanguage.g:187:3: ( (lv_type_0_0= ruleType ) ) ( (lv_name_1_0= RULE_ID ) )
// InternalTestLanguage.g:205:2: ( ( (lv_type_0_0= ruleType ) ) ( (lv_name_1_0= RULE_ID ) ) )
// InternalTestLanguage.g:206:3: ( (lv_type_0_0= ruleType ) ) ( (lv_name_1_0= RULE_ID ) )
{
// InternalTestLanguage.g:187:3: ( (lv_type_0_0= ruleType ) )
// InternalTestLanguage.g:188:4: (lv_type_0_0= ruleType )
// InternalTestLanguage.g:206:3: ( (lv_type_0_0= ruleType ) )
// InternalTestLanguage.g:207:4: (lv_type_0_0= ruleType )
{
// InternalTestLanguage.g:188:4: (lv_type_0_0= ruleType )
// InternalTestLanguage.g:189:5: lv_type_0_0= ruleType
// InternalTestLanguage.g:207:4: (lv_type_0_0= ruleType )
// InternalTestLanguage.g:208:5: lv_type_0_0= ruleType
{
newCompositeNode(grammarAccess.getPropertyAccess().getTypeTypeParserRuleCall_0_0());
@ -451,11 +496,11 @@ public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
}
// InternalTestLanguage.g:206:3: ( (lv_name_1_0= RULE_ID ) )
// InternalTestLanguage.g:207:4: (lv_name_1_0= RULE_ID )
// InternalTestLanguage.g:225:3: ( (lv_name_1_0= RULE_ID ) )
// InternalTestLanguage.g:226:4: (lv_name_1_0= RULE_ID )
{
// InternalTestLanguage.g:207:4: (lv_name_1_0= RULE_ID )
// InternalTestLanguage.g:208:5: lv_name_1_0= RULE_ID
// InternalTestLanguage.g:226:4: (lv_name_1_0= RULE_ID )
// InternalTestLanguage.g:227:5: lv_name_1_0= RULE_ID
{
lv_name_1_0=(Token)match(input,RULE_ID,FOLLOW_2);
@ -500,7 +545,7 @@ public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
// $ANTLR start "entryRuleType"
// InternalTestLanguage.g:228:1: entryRuleType returns [EObject current=null] : iv_ruleType= ruleType EOF ;
// InternalTestLanguage.g:247:1: entryRuleType returns [EObject current=null] : iv_ruleType= ruleType EOF ;
public final EObject entryRuleType() throws RecognitionException {
EObject current = null;
@ -508,8 +553,8 @@ public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
try {
// InternalTestLanguage.g:228:45: (iv_ruleType= ruleType EOF )
// InternalTestLanguage.g:229:2: iv_ruleType= ruleType EOF
// InternalTestLanguage.g:247:45: (iv_ruleType= ruleType EOF )
// InternalTestLanguage.g:248:2: iv_ruleType= ruleType EOF
{
newCompositeNode(grammarAccess.getTypeRule());
pushFollow(FOLLOW_1);
@ -536,7 +581,7 @@ public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
// $ANTLR start "ruleType"
// InternalTestLanguage.g:235:1: ruleType returns [EObject current=null] : ( (this_TypeReference_0= ruleTypeReference | this_PrimitiveType_1= rulePrimitiveType ) ( ( (lv_arrayDiemensions_2_0= '[' ) ) otherlv_3= ']' )* ) ;
// InternalTestLanguage.g:254:1: ruleType returns [EObject current=null] : ( (this_TypeReference_0= ruleTypeReference | this_PrimitiveType_1= rulePrimitiveType ) ( ( (lv_arrayDiemensions_2_0= '[' ) ) otherlv_3= ']' )* ) ;
public final EObject ruleType() throws RecognitionException {
EObject current = null;
@ -551,36 +596,36 @@ public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
enterRule();
try {
// InternalTestLanguage.g:241:2: ( ( (this_TypeReference_0= ruleTypeReference | this_PrimitiveType_1= rulePrimitiveType ) ( ( (lv_arrayDiemensions_2_0= '[' ) ) otherlv_3= ']' )* ) )
// InternalTestLanguage.g:242:2: ( (this_TypeReference_0= ruleTypeReference | this_PrimitiveType_1= rulePrimitiveType ) ( ( (lv_arrayDiemensions_2_0= '[' ) ) otherlv_3= ']' )* )
// InternalTestLanguage.g:260:2: ( ( (this_TypeReference_0= ruleTypeReference | this_PrimitiveType_1= rulePrimitiveType ) ( ( (lv_arrayDiemensions_2_0= '[' ) ) otherlv_3= ']' )* ) )
// InternalTestLanguage.g:261:2: ( (this_TypeReference_0= ruleTypeReference | this_PrimitiveType_1= rulePrimitiveType ) ( ( (lv_arrayDiemensions_2_0= '[' ) ) otherlv_3= ']' )* )
{
// InternalTestLanguage.g:242:2: ( (this_TypeReference_0= ruleTypeReference | this_PrimitiveType_1= rulePrimitiveType ) ( ( (lv_arrayDiemensions_2_0= '[' ) ) otherlv_3= ']' )* )
// InternalTestLanguage.g:243:3: (this_TypeReference_0= ruleTypeReference | this_PrimitiveType_1= rulePrimitiveType ) ( ( (lv_arrayDiemensions_2_0= '[' ) ) otherlv_3= ']' )*
// InternalTestLanguage.g:261:2: ( (this_TypeReference_0= ruleTypeReference | this_PrimitiveType_1= rulePrimitiveType ) ( ( (lv_arrayDiemensions_2_0= '[' ) ) otherlv_3= ']' )* )
// InternalTestLanguage.g:262:3: (this_TypeReference_0= ruleTypeReference | this_PrimitiveType_1= rulePrimitiveType ) ( ( (lv_arrayDiemensions_2_0= '[' ) ) otherlv_3= ']' )*
{
// InternalTestLanguage.g:243:3: (this_TypeReference_0= ruleTypeReference | this_PrimitiveType_1= rulePrimitiveType )
int alt3=2;
int LA3_0 = input.LA(1);
// InternalTestLanguage.g:262:3: (this_TypeReference_0= ruleTypeReference | this_PrimitiveType_1= rulePrimitiveType )
int alt4=2;
int LA4_0 = input.LA(1);
if ( (LA3_0==RULE_ID) ) {
alt3=1;
if ( (LA4_0==RULE_ID) ) {
alt4=1;
}
else if ( ((LA3_0>=16 && LA3_0<=18)) ) {
alt3=2;
else if ( ((LA4_0>=17 && LA4_0<=19)) ) {
alt4=2;
}
else {
NoViableAltException nvae =
new NoViableAltException("", 3, 0, input);
new NoViableAltException("", 4, 0, input);
throw nvae;
}
switch (alt3) {
switch (alt4) {
case 1 :
// InternalTestLanguage.g:244:4: this_TypeReference_0= ruleTypeReference
// InternalTestLanguage.g:263:4: this_TypeReference_0= ruleTypeReference
{
newCompositeNode(grammarAccess.getTypeAccess().getTypeReferenceParserRuleCall_0_0());
pushFollow(FOLLOW_7);
pushFollow(FOLLOW_8);
this_TypeReference_0=ruleTypeReference();
state._fsp--;
@ -593,12 +638,12 @@ public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
}
break;
case 2 :
// InternalTestLanguage.g:253:4: this_PrimitiveType_1= rulePrimitiveType
// InternalTestLanguage.g:272:4: this_PrimitiveType_1= rulePrimitiveType
{
newCompositeNode(grammarAccess.getTypeAccess().getPrimitiveTypeParserRuleCall_0_1());
pushFollow(FOLLOW_7);
pushFollow(FOLLOW_8);
this_PrimitiveType_1=rulePrimitiveType();
state._fsp--;
@ -613,28 +658,28 @@ public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
}
// InternalTestLanguage.g:262:3: ( ( (lv_arrayDiemensions_2_0= '[' ) ) otherlv_3= ']' )*
loop4:
// InternalTestLanguage.g:281:3: ( ( (lv_arrayDiemensions_2_0= '[' ) ) otherlv_3= ']' )*
loop5:
do {
int alt4=2;
int LA4_0 = input.LA(1);
int alt5=2;
int LA5_0 = input.LA(1);
if ( (LA4_0==14) ) {
alt4=1;
if ( (LA5_0==15) ) {
alt5=1;
}
switch (alt4) {
switch (alt5) {
case 1 :
// InternalTestLanguage.g:263:4: ( (lv_arrayDiemensions_2_0= '[' ) ) otherlv_3= ']'
// InternalTestLanguage.g:282:4: ( (lv_arrayDiemensions_2_0= '[' ) ) otherlv_3= ']'
{
// InternalTestLanguage.g:263:4: ( (lv_arrayDiemensions_2_0= '[' ) )
// InternalTestLanguage.g:264:5: (lv_arrayDiemensions_2_0= '[' )
// InternalTestLanguage.g:282:4: ( (lv_arrayDiemensions_2_0= '[' ) )
// InternalTestLanguage.g:283:5: (lv_arrayDiemensions_2_0= '[' )
{
// InternalTestLanguage.g:264:5: (lv_arrayDiemensions_2_0= '[' )
// InternalTestLanguage.g:265:6: lv_arrayDiemensions_2_0= '['
// InternalTestLanguage.g:283:5: (lv_arrayDiemensions_2_0= '[' )
// InternalTestLanguage.g:284:6: lv_arrayDiemensions_2_0= '['
{
lv_arrayDiemensions_2_0=(Token)match(input,14,FOLLOW_8);
lv_arrayDiemensions_2_0=(Token)match(input,15,FOLLOW_9);
newLeafNode(lv_arrayDiemensions_2_0, grammarAccess.getTypeAccess().getArrayDiemensionsLeftSquareBracketKeyword_1_0_0());
@ -650,7 +695,7 @@ public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
}
otherlv_3=(Token)match(input,15,FOLLOW_7);
otherlv_3=(Token)match(input,16,FOLLOW_8);
newLeafNode(otherlv_3, grammarAccess.getTypeAccess().getRightSquareBracketKeyword_1_1());
@ -659,7 +704,7 @@ public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
break;
default :
break loop4;
break loop5;
}
} while (true);
@ -686,7 +731,7 @@ public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
// $ANTLR start "entryRuleTypeReference"
// InternalTestLanguage.g:286:1: entryRuleTypeReference returns [EObject current=null] : iv_ruleTypeReference= ruleTypeReference EOF ;
// InternalTestLanguage.g:305:1: entryRuleTypeReference returns [EObject current=null] : iv_ruleTypeReference= ruleTypeReference EOF ;
public final EObject entryRuleTypeReference() throws RecognitionException {
EObject current = null;
@ -694,8 +739,8 @@ public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
try {
// InternalTestLanguage.g:286:54: (iv_ruleTypeReference= ruleTypeReference EOF )
// InternalTestLanguage.g:287:2: iv_ruleTypeReference= ruleTypeReference EOF
// InternalTestLanguage.g:305:54: (iv_ruleTypeReference= ruleTypeReference EOF )
// InternalTestLanguage.g:306:2: iv_ruleTypeReference= ruleTypeReference EOF
{
newCompositeNode(grammarAccess.getTypeReferenceRule());
pushFollow(FOLLOW_1);
@ -722,7 +767,7 @@ public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
// $ANTLR start "ruleTypeReference"
// InternalTestLanguage.g:293:1: ruleTypeReference returns [EObject current=null] : ( (otherlv_0= RULE_ID ) ) ;
// InternalTestLanguage.g:312:1: ruleTypeReference returns [EObject current=null] : ( (otherlv_0= RULE_ID ) ) ;
public final EObject ruleTypeReference() throws RecognitionException {
EObject current = null;
@ -732,14 +777,14 @@ public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
enterRule();
try {
// InternalTestLanguage.g:299:2: ( ( (otherlv_0= RULE_ID ) ) )
// InternalTestLanguage.g:300:2: ( (otherlv_0= RULE_ID ) )
// InternalTestLanguage.g:318:2: ( ( (otherlv_0= RULE_ID ) ) )
// InternalTestLanguage.g:319:2: ( (otherlv_0= RULE_ID ) )
{
// InternalTestLanguage.g:300:2: ( (otherlv_0= RULE_ID ) )
// InternalTestLanguage.g:301:3: (otherlv_0= RULE_ID )
// InternalTestLanguage.g:319:2: ( (otherlv_0= RULE_ID ) )
// InternalTestLanguage.g:320:3: (otherlv_0= RULE_ID )
{
// InternalTestLanguage.g:301:3: (otherlv_0= RULE_ID )
// InternalTestLanguage.g:302:4: otherlv_0= RULE_ID
// InternalTestLanguage.g:320:3: (otherlv_0= RULE_ID )
// InternalTestLanguage.g:321:4: otherlv_0= RULE_ID
{
if (current==null) {
@ -776,7 +821,7 @@ public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
// $ANTLR start "entryRulePrimitiveType"
// InternalTestLanguage.g:316:1: entryRulePrimitiveType returns [EObject current=null] : iv_rulePrimitiveType= rulePrimitiveType EOF ;
// InternalTestLanguage.g:335:1: entryRulePrimitiveType returns [EObject current=null] : iv_rulePrimitiveType= rulePrimitiveType EOF ;
public final EObject entryRulePrimitiveType() throws RecognitionException {
EObject current = null;
@ -784,8 +829,8 @@ public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
try {
// InternalTestLanguage.g:316:54: (iv_rulePrimitiveType= rulePrimitiveType EOF )
// InternalTestLanguage.g:317:2: iv_rulePrimitiveType= rulePrimitiveType EOF
// InternalTestLanguage.g:335:54: (iv_rulePrimitiveType= rulePrimitiveType EOF )
// InternalTestLanguage.g:336:2: iv_rulePrimitiveType= rulePrimitiveType EOF
{
newCompositeNode(grammarAccess.getPrimitiveTypeRule());
pushFollow(FOLLOW_1);
@ -812,7 +857,7 @@ public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
// $ANTLR start "rulePrimitiveType"
// InternalTestLanguage.g:323:1: rulePrimitiveType returns [EObject current=null] : ( ( (lv_name_0_1= 'string' | lv_name_0_2= 'int' | lv_name_0_3= 'boolean' ) ) ) ;
// InternalTestLanguage.g:342:1: rulePrimitiveType returns [EObject current=null] : ( ( (lv_name_0_1= 'string' | lv_name_0_2= 'int' | lv_name_0_3= 'boolean' ) ) ) ;
public final EObject rulePrimitiveType() throws RecognitionException {
EObject current = null;
@ -824,45 +869,45 @@ public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
enterRule();
try {
// InternalTestLanguage.g:329:2: ( ( ( (lv_name_0_1= 'string' | lv_name_0_2= 'int' | lv_name_0_3= 'boolean' ) ) ) )
// InternalTestLanguage.g:330:2: ( ( (lv_name_0_1= 'string' | lv_name_0_2= 'int' | lv_name_0_3= 'boolean' ) ) )
// InternalTestLanguage.g:348:2: ( ( ( (lv_name_0_1= 'string' | lv_name_0_2= 'int' | lv_name_0_3= 'boolean' ) ) ) )
// InternalTestLanguage.g:349:2: ( ( (lv_name_0_1= 'string' | lv_name_0_2= 'int' | lv_name_0_3= 'boolean' ) ) )
{
// InternalTestLanguage.g:330:2: ( ( (lv_name_0_1= 'string' | lv_name_0_2= 'int' | lv_name_0_3= 'boolean' ) ) )
// InternalTestLanguage.g:331:3: ( (lv_name_0_1= 'string' | lv_name_0_2= 'int' | lv_name_0_3= 'boolean' ) )
// InternalTestLanguage.g:349:2: ( ( (lv_name_0_1= 'string' | lv_name_0_2= 'int' | lv_name_0_3= 'boolean' ) ) )
// InternalTestLanguage.g:350:3: ( (lv_name_0_1= 'string' | lv_name_0_2= 'int' | lv_name_0_3= 'boolean' ) )
{
// InternalTestLanguage.g:331:3: ( (lv_name_0_1= 'string' | lv_name_0_2= 'int' | lv_name_0_3= 'boolean' ) )
// InternalTestLanguage.g:332:4: (lv_name_0_1= 'string' | lv_name_0_2= 'int' | lv_name_0_3= 'boolean' )
// InternalTestLanguage.g:350:3: ( (lv_name_0_1= 'string' | lv_name_0_2= 'int' | lv_name_0_3= 'boolean' ) )
// InternalTestLanguage.g:351:4: (lv_name_0_1= 'string' | lv_name_0_2= 'int' | lv_name_0_3= 'boolean' )
{
// InternalTestLanguage.g:332:4: (lv_name_0_1= 'string' | lv_name_0_2= 'int' | lv_name_0_3= 'boolean' )
int alt5=3;
// InternalTestLanguage.g:351:4: (lv_name_0_1= 'string' | lv_name_0_2= 'int' | lv_name_0_3= 'boolean' )
int alt6=3;
switch ( input.LA(1) ) {
case 16:
{
alt5=1;
}
break;
case 17:
{
alt5=2;
alt6=1;
}
break;
case 18:
{
alt5=3;
alt6=2;
}
break;
case 19:
{
alt6=3;
}
break;
default:
NoViableAltException nvae =
new NoViableAltException("", 5, 0, input);
new NoViableAltException("", 6, 0, input);
throw nvae;
}
switch (alt5) {
switch (alt6) {
case 1 :
// InternalTestLanguage.g:333:5: lv_name_0_1= 'string'
// InternalTestLanguage.g:352:5: lv_name_0_1= 'string'
{
lv_name_0_1=(Token)match(input,16,FOLLOW_2);
lv_name_0_1=(Token)match(input,17,FOLLOW_2);
newLeafNode(lv_name_0_1, grammarAccess.getPrimitiveTypeAccess().getNameStringKeyword_0_0());
@ -876,9 +921,9 @@ public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
}
break;
case 2 :
// InternalTestLanguage.g:344:5: lv_name_0_2= 'int'
// InternalTestLanguage.g:363:5: lv_name_0_2= 'int'
{
lv_name_0_2=(Token)match(input,17,FOLLOW_2);
lv_name_0_2=(Token)match(input,18,FOLLOW_2);
newLeafNode(lv_name_0_2, grammarAccess.getPrimitiveTypeAccess().getNameIntKeyword_0_1());
@ -892,9 +937,9 @@ public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
}
break;
case 3 :
// InternalTestLanguage.g:355:5: lv_name_0_3= 'boolean'
// InternalTestLanguage.g:374:5: lv_name_0_3= 'boolean'
{
lv_name_0_3=(Token)match(input,18,FOLLOW_2);
lv_name_0_3=(Token)match(input,19,FOLLOW_2);
newLeafNode(lv_name_0_3, grammarAccess.getPrimitiveTypeAccess().getNameBooleanKeyword_0_2());
@ -943,9 +988,10 @@ public class InternalTestLanguageParser extends AbstractInternalAntlrParser {
public static final BitSet FOLLOW_2 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_3 = new BitSet(new long[]{0x0000000000000802L});
public static final BitSet FOLLOW_4 = new BitSet(new long[]{0x0000000000000010L});
public static final BitSet FOLLOW_5 = new BitSet(new long[]{0x0000000000001000L});
public static final BitSet FOLLOW_6 = new BitSet(new long[]{0x0000000000072010L});
public static final BitSet FOLLOW_7 = new BitSet(new long[]{0x0000000000004002L});
public static final BitSet FOLLOW_8 = new BitSet(new long[]{0x0000000000008000L});
public static final BitSet FOLLOW_5 = new BitSet(new long[]{0x0000000000003000L});
public static final BitSet FOLLOW_6 = new BitSet(new long[]{0x0000000000002000L});
public static final BitSet FOLLOW_7 = new BitSet(new long[]{0x00000000000E4010L});
public static final BitSet FOLLOW_8 = new BitSet(new long[]{0x0000000000008002L});
public static final BitSet FOLLOW_9 = new BitSet(new long[]{0x0000000000010000L});
}

View file

@ -136,7 +136,7 @@ public class TestLanguageSemanticSequencer extends AbstractDelegatingSemanticSeq
* TypeDeclaration returns TypeDeclaration
*
* Constraint:
* (name=ID properties+=Property*)
* (name=ID superType=[TypeDeclaration|ID]? properties+=Property*)
*/
protected void sequence_TypeDeclaration(ISerializationContext context, TypeDeclaration semanticObject) {
genericSequencer.createSequence(context, semanticObject);

View file

@ -48,18 +48,23 @@ public class TestLanguageGrammarAccess extends AbstractGrammarElementFinder {
private final Keyword cTypeKeyword_0 = (Keyword)cGroup.eContents().get(0);
private final Assignment cNameAssignment_1 = (Assignment)cGroup.eContents().get(1);
private final RuleCall cNameIDTerminalRuleCall_1_0 = (RuleCall)cNameAssignment_1.eContents().get(0);
private final Keyword cLeftCurlyBracketKeyword_2 = (Keyword)cGroup.eContents().get(2);
private final Assignment cPropertiesAssignment_3 = (Assignment)cGroup.eContents().get(3);
private final RuleCall cPropertiesPropertyParserRuleCall_3_0 = (RuleCall)cPropertiesAssignment_3.eContents().get(0);
private final Keyword cRightCurlyBracketKeyword_4 = (Keyword)cGroup.eContents().get(4);
private final Group cGroup_2 = (Group)cGroup.eContents().get(2);
private final Keyword cExtendsKeyword_2_0 = (Keyword)cGroup_2.eContents().get(0);
private final Assignment cSuperTypeAssignment_2_1 = (Assignment)cGroup_2.eContents().get(1);
private final CrossReference cSuperTypeTypeDeclarationCrossReference_2_1_0 = (CrossReference)cSuperTypeAssignment_2_1.eContents().get(0);
private final RuleCall cSuperTypeTypeDeclarationIDTerminalRuleCall_2_1_0_1 = (RuleCall)cSuperTypeTypeDeclarationCrossReference_2_1_0.eContents().get(1);
private final Keyword cLeftCurlyBracketKeyword_3 = (Keyword)cGroup.eContents().get(3);
private final Assignment cPropertiesAssignment_4 = (Assignment)cGroup.eContents().get(4);
private final RuleCall cPropertiesPropertyParserRuleCall_4_0 = (RuleCall)cPropertiesAssignment_4.eContents().get(0);
private final Keyword cRightCurlyBracketKeyword_5 = (Keyword)cGroup.eContents().get(5);
//TypeDeclaration:
// 'type' name=ID '{'
// 'type' name=ID ('extends' superType=[TypeDeclaration])? '{'
// properties+=Property*
// '}';
@Override public ParserRule getRule() { return rule; }
//'type' name=ID '{' properties+=Property* '}'
//'type' name=ID ('extends' superType=[TypeDeclaration])? '{' properties+=Property* '}'
public Group getGroup() { return cGroup; }
//'type'
@ -71,17 +76,32 @@ public class TestLanguageGrammarAccess extends AbstractGrammarElementFinder {
//ID
public RuleCall getNameIDTerminalRuleCall_1_0() { return cNameIDTerminalRuleCall_1_0; }
//('extends' superType=[TypeDeclaration])?
public Group getGroup_2() { return cGroup_2; }
//'extends'
public Keyword getExtendsKeyword_2_0() { return cExtendsKeyword_2_0; }
//superType=[TypeDeclaration]
public Assignment getSuperTypeAssignment_2_1() { return cSuperTypeAssignment_2_1; }
//[TypeDeclaration]
public CrossReference getSuperTypeTypeDeclarationCrossReference_2_1_0() { return cSuperTypeTypeDeclarationCrossReference_2_1_0; }
//ID
public RuleCall getSuperTypeTypeDeclarationIDTerminalRuleCall_2_1_0_1() { return cSuperTypeTypeDeclarationIDTerminalRuleCall_2_1_0_1; }
//'{'
public Keyword getLeftCurlyBracketKeyword_2() { return cLeftCurlyBracketKeyword_2; }
public Keyword getLeftCurlyBracketKeyword_3() { return cLeftCurlyBracketKeyword_3; }
//properties+=Property*
public Assignment getPropertiesAssignment_3() { return cPropertiesAssignment_3; }
public Assignment getPropertiesAssignment_4() { return cPropertiesAssignment_4; }
//Property
public RuleCall getPropertiesPropertyParserRuleCall_3_0() { return cPropertiesPropertyParserRuleCall_3_0; }
public RuleCall getPropertiesPropertyParserRuleCall_4_0() { return cPropertiesPropertyParserRuleCall_4_0; }
//'}'
public Keyword getRightCurlyBracketKeyword_4() { return cRightCurlyBracketKeyword_4; }
public Keyword getRightCurlyBracketKeyword_5() { return cRightCurlyBracketKeyword_5; }
}
public class PropertyElements extends AbstractParserRuleElementFinder {
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.ide.tests.testlanguage.TestLanguage.Property");
@ -259,7 +279,7 @@ public class TestLanguageGrammarAccess extends AbstractGrammarElementFinder {
}
//TypeDeclaration:
// 'type' name=ID '{'
// 'type' name=ID ('extends' superType=[TypeDeclaration])? '{'
// properties+=Property*
// '}';
public TypeDeclarationElements getTypeDeclarationAccess() {

View file

@ -108,6 +108,15 @@ public interface TestLanguagePackage extends EPackage
*/
int TYPE_DECLARATION__NAME = 0;
/**
* The feature id for the '<em><b>Super Type</b></em>' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int TYPE_DECLARATION__SUPER_TYPE = 1;
/**
* The feature id for the '<em><b>Properties</b></em>' containment reference list.
* <!-- begin-user-doc -->
@ -115,7 +124,7 @@ public interface TestLanguagePackage extends EPackage
* @generated
* @ordered
*/
int TYPE_DECLARATION__PROPERTIES = 1;
int TYPE_DECLARATION__PROPERTIES = 2;
/**
* The number of structural features of the '<em>Type Declaration</em>' class.
@ -124,7 +133,7 @@ public interface TestLanguagePackage extends EPackage
* @generated
* @ordered
*/
int TYPE_DECLARATION_FEATURE_COUNT = 2;
int TYPE_DECLARATION_FEATURE_COUNT = 3;
/**
* The meta object id for the '{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.PropertyImpl <em>Property</em>}' class.
@ -308,6 +317,17 @@ public interface TestLanguagePackage extends EPackage
*/
EAttribute getTypeDeclaration_Name();
/**
* Returns the meta object for the reference '{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeDeclaration#getSuperType <em>Super Type</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference '<em>Super Type</em>'.
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeDeclaration#getSuperType()
* @see #getTypeDeclaration()
* @generated
*/
EReference getTypeDeclaration_SuperType();
/**
* Returns the meta object for the containment reference list '{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeDeclaration#getProperties <em>Properties</em>}'.
* <!-- begin-user-doc -->
@ -473,6 +493,14 @@ public interface TestLanguagePackage extends EPackage
*/
EAttribute TYPE_DECLARATION__NAME = eINSTANCE.getTypeDeclaration_Name();
/**
* The meta object literal for the '<em><b>Super Type</b></em>' reference feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EReference TYPE_DECLARATION__SUPER_TYPE = eINSTANCE.getTypeDeclaration_SuperType();
/**
* The meta object literal for the '<em><b>Properties</b></em>' containment reference list feature.
* <!-- begin-user-doc -->

View file

@ -21,6 +21,7 @@ import org.eclipse.emf.ecore.EObject;
* </p>
* <ul>
* <li>{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeDeclaration#getName <em>Name</em>}</li>
* <li>{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeDeclaration#getSuperType <em>Super Type</em>}</li>
* <li>{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeDeclaration#getProperties <em>Properties</em>}</li>
* </ul>
*
@ -56,6 +57,32 @@ public interface TypeDeclaration extends EObject
*/
void setName(String value);
/**
* Returns the value of the '<em><b>Super Type</b></em>' reference.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Super Type</em>' reference isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Super Type</em>' reference.
* @see #setSuperType(TypeDeclaration)
* @see org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TestLanguagePackage#getTypeDeclaration_SuperType()
* @model
* @generated
*/
TypeDeclaration getSuperType();
/**
* Sets the value of the '{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeDeclaration#getSuperType <em>Super Type</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Super Type</em>' reference.
* @see #getSuperType()
* @generated
*/
void setSuperType(TypeDeclaration value);
/**
* Returns the value of the '<em><b>Properties</b></em>' containment reference list.
* The list contents are of type {@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Property}.

View file

@ -181,11 +181,21 @@ public class TestLanguagePackageImpl extends EPackageImpl implements TestLanguag
* <!-- end-user-doc -->
* @generated
*/
public EReference getTypeDeclaration_Properties()
public EReference getTypeDeclaration_SuperType()
{
return (EReference)typeDeclarationEClass.getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getTypeDeclaration_Properties()
{
return (EReference)typeDeclarationEClass.getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@ -311,6 +321,7 @@ public class TestLanguagePackageImpl extends EPackageImpl implements TestLanguag
typeDeclarationEClass = createEClass(TYPE_DECLARATION);
createEAttribute(typeDeclarationEClass, TYPE_DECLARATION__NAME);
createEReference(typeDeclarationEClass, TYPE_DECLARATION__SUPER_TYPE);
createEReference(typeDeclarationEClass, TYPE_DECLARATION__PROPERTIES);
propertyEClass = createEClass(PROPERTY);
@ -365,6 +376,7 @@ public class TestLanguagePackageImpl extends EPackageImpl implements TestLanguag
initEClass(typeDeclarationEClass, TypeDeclaration.class, "TypeDeclaration", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getTypeDeclaration_Name(), ecorePackage.getEString(), "name", null, 0, 1, TypeDeclaration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getTypeDeclaration_SuperType(), this.getTypeDeclaration(), null, "superType", null, 0, 1, TypeDeclaration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getTypeDeclaration_Properties(), this.getProperty(), null, "properties", null, 0, -1, TypeDeclaration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(propertyEClass, Property.class, "Property", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

View file

@ -36,6 +36,7 @@ import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TypeDeclaration;
* </p>
* <ul>
* <li>{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.TypeDeclarationImpl#getName <em>Name</em>}</li>
* <li>{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.TypeDeclarationImpl#getSuperType <em>Super Type</em>}</li>
* <li>{@link org.eclipse.xtext.ide.tests.testlanguage.testLanguage.impl.TypeDeclarationImpl#getProperties <em>Properties</em>}</li>
* </ul>
*
@ -63,6 +64,16 @@ public class TypeDeclarationImpl extends MinimalEObjectImpl.Container implements
*/
protected String name = NAME_EDEFAULT;
/**
* The cached value of the '{@link #getSuperType() <em>Super Type</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSuperType()
* @generated
* @ordered
*/
protected TypeDeclaration superType;
/**
* The cached value of the '{@link #getProperties() <em>Properties</em>}' containment reference list.
* <!-- begin-user-doc -->
@ -117,6 +128,49 @@ public class TypeDeclarationImpl extends MinimalEObjectImpl.Container implements
eNotify(new ENotificationImpl(this, Notification.SET, TestLanguagePackage.TYPE_DECLARATION__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public TypeDeclaration getSuperType()
{
if (superType != null && superType.eIsProxy())
{
InternalEObject oldSuperType = (InternalEObject)superType;
superType = (TypeDeclaration)eResolveProxy(oldSuperType);
if (superType != oldSuperType)
{
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, TestLanguagePackage.TYPE_DECLARATION__SUPER_TYPE, oldSuperType, superType));
}
}
return superType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public TypeDeclaration basicGetSuperType()
{
return superType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSuperType(TypeDeclaration newSuperType)
{
TypeDeclaration oldSuperType = superType;
superType = newSuperType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TestLanguagePackage.TYPE_DECLARATION__SUPER_TYPE, oldSuperType, superType));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@ -159,6 +213,9 @@ public class TypeDeclarationImpl extends MinimalEObjectImpl.Container implements
{
case TestLanguagePackage.TYPE_DECLARATION__NAME:
return getName();
case TestLanguagePackage.TYPE_DECLARATION__SUPER_TYPE:
if (resolve) return getSuperType();
return basicGetSuperType();
case TestLanguagePackage.TYPE_DECLARATION__PROPERTIES:
return getProperties();
}
@ -179,6 +236,9 @@ public class TypeDeclarationImpl extends MinimalEObjectImpl.Container implements
case TestLanguagePackage.TYPE_DECLARATION__NAME:
setName((String)newValue);
return;
case TestLanguagePackage.TYPE_DECLARATION__SUPER_TYPE:
setSuperType((TypeDeclaration)newValue);
return;
case TestLanguagePackage.TYPE_DECLARATION__PROPERTIES:
getProperties().clear();
getProperties().addAll((Collection<? extends Property>)newValue);
@ -200,6 +260,9 @@ public class TypeDeclarationImpl extends MinimalEObjectImpl.Container implements
case TestLanguagePackage.TYPE_DECLARATION__NAME:
setName(NAME_EDEFAULT);
return;
case TestLanguagePackage.TYPE_DECLARATION__SUPER_TYPE:
setSuperType((TypeDeclaration)null);
return;
case TestLanguagePackage.TYPE_DECLARATION__PROPERTIES:
getProperties().clear();
return;
@ -219,6 +282,8 @@ public class TypeDeclarationImpl extends MinimalEObjectImpl.Container implements
{
case TestLanguagePackage.TYPE_DECLARATION__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case TestLanguagePackage.TYPE_DECLARATION__SUPER_TYPE:
return superType != null;
case TestLanguagePackage.TYPE_DECLARATION__PROPERTIES:
return properties != null && !properties.isEmpty();
}

View file

@ -13,7 +13,7 @@ Model:
types+=TypeDeclaration*;
TypeDeclaration:
'type' name=ID '{'
'type' name=ID ('extends' superType=[TypeDeclaration])? '{'
properties+=Property*
'}';

View file

@ -30,11 +30,11 @@ class TestLanguageFormatter extends AbstractFormatter2 {
def dispatch void format(TypeDeclaration type, extension IFormattableDocument document) {
//type.regionFor.keyword(typeDeclarationAccess.leftCurlyBracketKeyword_2).prepend[oneSpace]
type.regionFor.keyword(typeDeclarationAccess.leftCurlyBracketKeyword_2).append[newLine]
type.regionFor.keyword(typeDeclarationAccess.rightCurlyBracketKeyword_4).prepend[newLine].append[newLine]
type.regionFor.keyword(typeDeclarationAccess.leftCurlyBracketKeyword_3).append[newLine]
type.regionFor.keyword(typeDeclarationAccess.rightCurlyBracketKeyword_5).prepend[newLine].append[newLine]
interior(
type.regionFor.keyword(typeDeclarationAccess.leftCurlyBracketKeyword_2),
type.regionFor.keyword(typeDeclarationAccess.rightCurlyBracketKeyword_4)
type.regionFor.keyword(typeDeclarationAccess.leftCurlyBracketKeyword_3),
type.regionFor.keyword(typeDeclarationAccess.rightCurlyBracketKeyword_5)
) [indent]
for (property : type.properties) {
property.format

View file

@ -10,6 +10,7 @@ package org.eclipse.xtext.ide.tests.server;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.ide.tests.server.AbstractTestLangLanguageServerTest;
import org.eclipse.xtext.testing.HoverTestConfiguration;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure0;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.junit.Test;
@ -102,4 +103,78 @@ public class HoverTest extends AbstractTestLangLanguageServerTest {
};
this.testHover(_function);
}
@Test
public void testHover_04() {
final Procedure1<HoverTestConfiguration> _function = (HoverTestConfiguration it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("/**");
_builder.newLine();
_builder.append(" ");
_builder.append("* Some documentation.");
_builder.newLine();
_builder.append(" ");
_builder.append("*/");
_builder.newLine();
_builder.append("type Foo {");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("type Bar extends Foo {");
_builder.newLine();
_builder.append("}");
_builder.newLine();
it.setModel(_builder.toString());
it.setLine(5);
int _length = "type Bar extends F".length();
it.setColumn(_length);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("[[5, 17] .. [5, 20]]");
_builder_1.newLine();
_builder_1.append("Some documentation.");
_builder_1.newLine();
it.setExpectedHover(_builder_1.toString());
};
this.testHover(_function);
}
@Test
public void testHover_05() {
final Procedure1<HoverTestConfiguration> _function = (HoverTestConfiguration it) -> {
final Procedure0 _function_1 = () -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("/**");
_builder.newLine();
_builder.append(" ");
_builder.append("* Some documentation.");
_builder.newLine();
_builder.append(" ");
_builder.append("*/");
_builder.newLine();
_builder.append("type Foo {");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final String referenceModel = _builder.toString();
final String fileUri = this.operator_mappedTo(("MyModel2." + this.fileExtension), referenceModel);
this.open(fileUri, referenceModel);
};
it.setReferencedModels(_function_1);
StringConcatenation _builder = new StringConcatenation();
_builder.append("type Bar extends Foo {");
_builder.newLine();
_builder.append("}");
_builder.newLine();
it.setModel(_builder.toString());
int _length = "type Bar extends F".length();
it.setColumn(_length);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("[[0, 17] .. [0, 20]]");
_builder_1.newLine();
_builder_1.append("Some documentation.");
_builder_1.newLine();
it.setExpectedHover(_builder_1.toString());
};
this.testHover(_function);
}
}

View file

@ -44,16 +44,16 @@ public class TestLanguageFormatter extends AbstractFormatter2 {
protected void _format(final TypeDeclaration type, @Extension final IFormattableDocument document) {
ISemanticRegionsFinder _regionFor = this.textRegionExtensions.regionFor(type);
TestLanguageGrammarAccess.TypeDeclarationElements _typeDeclarationAccess = this._testLanguageGrammarAccess.getTypeDeclarationAccess();
Keyword _leftCurlyBracketKeyword_2 = _typeDeclarationAccess.getLeftCurlyBracketKeyword_2();
ISemanticRegion _keyword = _regionFor.keyword(_leftCurlyBracketKeyword_2);
Keyword _leftCurlyBracketKeyword_3 = _typeDeclarationAccess.getLeftCurlyBracketKeyword_3();
ISemanticRegion _keyword = _regionFor.keyword(_leftCurlyBracketKeyword_3);
final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> {
it.newLine();
};
document.append(_keyword, _function);
ISemanticRegionsFinder _regionFor_1 = this.textRegionExtensions.regionFor(type);
TestLanguageGrammarAccess.TypeDeclarationElements _typeDeclarationAccess_1 = this._testLanguageGrammarAccess.getTypeDeclarationAccess();
Keyword _rightCurlyBracketKeyword_4 = _typeDeclarationAccess_1.getRightCurlyBracketKeyword_4();
ISemanticRegion _keyword_1 = _regionFor_1.keyword(_rightCurlyBracketKeyword_4);
Keyword _rightCurlyBracketKeyword_5 = _typeDeclarationAccess_1.getRightCurlyBracketKeyword_5();
ISemanticRegion _keyword_1 = _regionFor_1.keyword(_rightCurlyBracketKeyword_5);
final Procedure1<IHiddenRegionFormatter> _function_1 = (IHiddenRegionFormatter it) -> {
it.newLine();
};
@ -64,12 +64,12 @@ public class TestLanguageFormatter extends AbstractFormatter2 {
document.append(_prepend, _function_2);
ISemanticRegionsFinder _regionFor_2 = this.textRegionExtensions.regionFor(type);
TestLanguageGrammarAccess.TypeDeclarationElements _typeDeclarationAccess_2 = this._testLanguageGrammarAccess.getTypeDeclarationAccess();
Keyword _leftCurlyBracketKeyword_2_1 = _typeDeclarationAccess_2.getLeftCurlyBracketKeyword_2();
ISemanticRegion _keyword_2 = _regionFor_2.keyword(_leftCurlyBracketKeyword_2_1);
Keyword _leftCurlyBracketKeyword_3_1 = _typeDeclarationAccess_2.getLeftCurlyBracketKeyword_3();
ISemanticRegion _keyword_2 = _regionFor_2.keyword(_leftCurlyBracketKeyword_3_1);
ISemanticRegionsFinder _regionFor_3 = this.textRegionExtensions.regionFor(type);
TestLanguageGrammarAccess.TypeDeclarationElements _typeDeclarationAccess_3 = this._testLanguageGrammarAccess.getTypeDeclarationAccess();
Keyword _rightCurlyBracketKeyword_4_1 = _typeDeclarationAccess_3.getRightCurlyBracketKeyword_4();
ISemanticRegion _keyword_3 = _regionFor_3.keyword(_rightCurlyBracketKeyword_4_1);
Keyword _rightCurlyBracketKeyword_5_1 = _typeDeclarationAccess_3.getRightCurlyBracketKeyword_5();
ISemanticRegion _keyword_3 = _regionFor_3.keyword(_rightCurlyBracketKeyword_5_1);
final Procedure1<IHiddenRegionFormatter> _function_3 = (IHiddenRegionFormatter it) -> {
it.indent();
};

View file

@ -12,11 +12,18 @@ import com.google.inject.Singleton
import io.typefox.lsapi.Hover
import io.typefox.lsapi.impl.HoverImpl
import io.typefox.lsapi.impl.MarkedStringImpl
import org.eclipse.emf.ecore.EObject
import org.eclipse.xtext.documentation.IEObjectDocumentationProvider
import org.eclipse.xtext.ide.server.DocumentExtensions
import org.eclipse.xtext.nodemodel.ILeafNode
import org.eclipse.xtext.nodemodel.util.NodeModelUtils
import org.eclipse.xtext.parser.IParseResult
import org.eclipse.xtext.resource.EObjectAtOffsetHelper
import org.eclipse.xtext.resource.ILocationInFileProvider
import org.eclipse.xtext.resource.XtextResource
import org.eclipse.xtext.util.ITextRegion
import org.eclipse.xtext.util.Pair
import org.eclipse.xtext.util.Tuples
/**
* @author kosyakov - Initial contribution and API
@ -38,7 +45,11 @@ class HoverService {
extension IEObjectDocumentationProvider
def Hover hover(XtextResource resource, int offset) {
val element = resource.resolveElementAt(offset)
val pair = resource.getXtextElementAt(offset)
if (pair === null || pair.first === null || pair.second === null) {
return new HoverImpl(emptyList, null)
}
val element = pair.first
if (element === null)
return new HoverImpl(emptyList, null)
@ -48,10 +59,7 @@ class HoverService {
val contents = #[new MarkedStringImpl(null, documentation)]
val containedElement = resource.resolveContainedElementAt(offset)
val textRegion = containedElement.significantTextRegion
if (textRegion === null)
return new HoverImpl(contents, null)
val ITextRegion textRegion = pair.second
if (!textRegion.contains(offset))
return new HoverImpl(emptyList, null)
@ -60,4 +68,31 @@ class HoverService {
return new HoverImpl(contents, range)
}
protected def Pair<EObject, ITextRegion> getXtextElementAt(XtextResource resource, int offset) {
// check for cross reference
val EObject crossLinkedEObject = resolveCrossReferencedElementAt(resource, offset);
if (crossLinkedEObject != null) {
if (!crossLinkedEObject.eIsProxy()) {
val IParseResult parseResult = resource.getParseResult();
if (parseResult != null) {
var ILeafNode leafNode = NodeModelUtils.findLeafNodeAtOffset(parseResult.getRootNode(), offset);
if(leafNode != null && leafNode.isHidden() && leafNode.getOffset() == offset) {
leafNode = NodeModelUtils.findLeafNodeAtOffset(parseResult.getRootNode(), offset - 1);
}
if (leafNode != null) {
val ITextRegion leafRegion = leafNode.getTextRegion();
return Tuples.create(crossLinkedEObject, leafRegion);
}
}
}
} else {
val EObject o = resource.resolveElementAt(offset);
if (o != null) {
val ITextRegion region = o.getSignificantTextRegion();
return Tuples.create(o, region);
}
}
return null;
}
}

View file

@ -7,6 +7,7 @@
*/
package org.eclipse.xtext.ide.server.hover;
import com.google.common.base.Objects;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import io.typefox.lsapi.Hover;
@ -18,10 +19,16 @@ import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.documentation.IEObjectDocumentationProvider;
import org.eclipse.xtext.ide.server.DocumentExtensions;
import org.eclipse.xtext.nodemodel.ICompositeNode;
import org.eclipse.xtext.nodemodel.ILeafNode;
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
import org.eclipse.xtext.parser.IParseResult;
import org.eclipse.xtext.resource.EObjectAtOffsetHelper;
import org.eclipse.xtext.resource.ILocationInFileProvider;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.util.ITextRegion;
import org.eclipse.xtext.util.Pair;
import org.eclipse.xtext.util.Tuples;
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
import org.eclipse.xtext.xbase.lib.Extension;
@ -49,30 +56,66 @@ public class HoverService {
private IEObjectDocumentationProvider _iEObjectDocumentationProvider;
public Hover hover(final XtextResource resource, final int offset) {
final EObject element = this._eObjectAtOffsetHelper.resolveElementAt(resource, offset);
if ((element == null)) {
final Pair<EObject, ITextRegion> pair = this.getXtextElementAt(resource, offset);
if ((((pair == null) || (pair.getFirst() == null)) || (pair.getSecond() == null))) {
List<MarkedStringImpl> _emptyList = CollectionLiterals.<MarkedStringImpl>emptyList();
return new HoverImpl(_emptyList, null);
}
final String documentation = this._iEObjectDocumentationProvider.getDocumentation(element);
if ((documentation == null)) {
final EObject element = pair.getFirst();
if ((element == null)) {
List<MarkedStringImpl> _emptyList_1 = CollectionLiterals.<MarkedStringImpl>emptyList();
return new HoverImpl(_emptyList_1, null);
}
final String documentation = this._iEObjectDocumentationProvider.getDocumentation(element);
if ((documentation == null)) {
List<MarkedStringImpl> _emptyList_2 = CollectionLiterals.<MarkedStringImpl>emptyList();
return new HoverImpl(_emptyList_2, null);
}
MarkedStringImpl _markedStringImpl = new MarkedStringImpl(null, documentation);
final List<MarkedStringImpl> contents = Collections.<MarkedStringImpl>unmodifiableList(CollectionLiterals.<MarkedStringImpl>newArrayList(_markedStringImpl));
final EObject containedElement = this._eObjectAtOffsetHelper.resolveContainedElementAt(resource, offset);
final ITextRegion textRegion = this._iLocationInFileProvider.getSignificantTextRegion(containedElement);
if ((textRegion == null)) {
return new HoverImpl(contents, null);
}
final ITextRegion textRegion = pair.getSecond();
boolean _contains = textRegion.contains(offset);
boolean _not = (!_contains);
if (_not) {
List<MarkedStringImpl> _emptyList_2 = CollectionLiterals.<MarkedStringImpl>emptyList();
return new HoverImpl(_emptyList_2, null);
List<MarkedStringImpl> _emptyList_3 = CollectionLiterals.<MarkedStringImpl>emptyList();
return new HoverImpl(_emptyList_3, null);
}
final RangeImpl range = this._documentExtensions.newRange(resource, textRegion);
return new HoverImpl(contents, range);
}
protected Pair<EObject, ITextRegion> getXtextElementAt(final XtextResource resource, final int offset) {
final EObject crossLinkedEObject = this._eObjectAtOffsetHelper.resolveCrossReferencedElementAt(resource, offset);
boolean _notEquals = (!Objects.equal(crossLinkedEObject, null));
if (_notEquals) {
boolean _eIsProxy = crossLinkedEObject.eIsProxy();
boolean _not = (!_eIsProxy);
if (_not) {
final IParseResult parseResult = resource.getParseResult();
boolean _notEquals_1 = (!Objects.equal(parseResult, null));
if (_notEquals_1) {
ICompositeNode _rootNode = parseResult.getRootNode();
ILeafNode leafNode = NodeModelUtils.findLeafNodeAtOffset(_rootNode, offset);
if ((((!Objects.equal(leafNode, null)) && leafNode.isHidden()) && (leafNode.getOffset() == offset))) {
ICompositeNode _rootNode_1 = parseResult.getRootNode();
ILeafNode _findLeafNodeAtOffset = NodeModelUtils.findLeafNodeAtOffset(_rootNode_1, (offset - 1));
leafNode = _findLeafNodeAtOffset;
}
boolean _notEquals_2 = (!Objects.equal(leafNode, null));
if (_notEquals_2) {
final ITextRegion leafRegion = leafNode.getTextRegion();
return Tuples.<EObject, ITextRegion>create(crossLinkedEObject, leafRegion);
}
}
}
} else {
final EObject o = this._eObjectAtOffsetHelper.resolveElementAt(resource, offset);
boolean _notEquals_3 = (!Objects.equal(o, null));
if (_notEquals_3) {
final ITextRegion region = this._iLocationInFileProvider.getSignificantTextRegion(o);
return Tuples.<EObject, ITextRegion>create(o, region);
}
}
return null;
}
}

View file

@ -265,8 +265,8 @@ abstract class AbstractLanguageServerTest implements Consumer<PublishDiagnostics
val fileUri = filePath -> model
initialize
configuration.referencedModels?.apply
open(fileUri, model)
val hover = languageServer.hover(new TextDocumentPositionParamsBuilder[
textDocument(fileUri)
position(line, column)
@ -376,6 +376,7 @@ class DefinitionTestConfiguration extends TextDocumentPositionConfiguration {
@Accessors
class HoverTestConfiguration extends TextDocumentPositionConfiguration {
String expectedHover = ''
Procedures.Procedure0 referencedModels = []
}
@Accessors

View file

@ -85,6 +85,7 @@ import org.eclipse.xtext.xbase.lib.Exceptions;
import org.eclipse.xtext.xbase.lib.Extension;
import org.eclipse.xtext.xbase.lib.Functions.Function1;
import org.eclipse.xtext.xbase.lib.ListExtensions;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure0;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.eclipse.xtext.xbase.lib.Pure;
import org.eclipse.xtext.xbase.lib.StringExtensions;
@ -505,6 +506,10 @@ public abstract class AbstractLanguageServerTest implements Consumer<PublishDiag
String _model = configuration.getModel();
final String fileUri = this.operator_mappedTo(_filePath, _model);
this.initialize();
Procedure0 _referencedModels = configuration.getReferencedModels();
if (_referencedModels!=null) {
_referencedModels.apply();
}
String _model_1 = configuration.getModel();
this.open(fileUri, _model_1);
final Procedure1<TextDocumentPositionParamsBuilder> _function = (TextDocumentPositionParamsBuilder it) -> {

View file

@ -9,6 +9,7 @@ package org.eclipse.xtext.testing;
import org.eclipse.xtend.lib.annotations.Accessors;
import org.eclipse.xtext.testing.TextDocumentPositionConfiguration;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure0;
import org.eclipse.xtext.xbase.lib.Pure;
@Accessors
@ -16,6 +17,9 @@ import org.eclipse.xtext.xbase.lib.Pure;
public class HoverTestConfiguration extends TextDocumentPositionConfiguration {
private String expectedHover = "";
private Procedure0 referencedModels = ((Procedure0) () -> {
});
@Pure
public String getExpectedHover() {
return this.expectedHover;
@ -24,4 +28,13 @@ public class HoverTestConfiguration extends TextDocumentPositionConfiguration {
public void setExpectedHover(final String expectedHover) {
this.expectedHover = expectedHover;
}
@Pure
public Procedure0 getReferencedModels() {
return this.referencedModels;
}
public void setReferencedModels(final Procedure0 referencedModels) {
this.referencedModels = referencedModels;
}
}