Skip to content

Commit

Permalink
Changes keyword to declare final variables from const to val.
Browse files Browse the repository at this point in the history
Changes keyword to declare final variables from const to val (closes #7)

Also:
* Updates grammar related code.
* Updates documentation accordingly.
  • Loading branch information
srodriguez committed Feb 13, 2014
1 parent eb48d99 commit d661970
Show file tree
Hide file tree
Showing 14 changed files with 506 additions and 515 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe "Event Reference"{
val Model model = '''
package myapp.demo
event MyEvent {
const Integer number
val Integer number
}
'''.parsesSuccessfully
val evt = model.elements.filter(Event).head
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2707,11 +2707,11 @@ rule__Attribute__Alternatives_0
)

|(
{ before(grammarAccess.getAttributeAccess().getConstKeyword_0_1()); }
{ before(grammarAccess.getAttributeAccess().getValKeyword_0_1()); }

'const'
'val'

{ after(grammarAccess.getAttributeAccess().getConstKeyword_0_1()); }
{ after(grammarAccess.getAttributeAccess().getValKeyword_0_1()); }
)

;
Expand Down Expand Up @@ -2771,11 +2771,11 @@ rule__XVariableDeclaration__Alternatives_1
)

|(
{ before(grammarAccess.getXVariableDeclarationAccess().getConstKeyword_1_1()); }
{ before(grammarAccess.getXVariableDeclarationAccess().getValKeyword_1_1()); }

'const'
'val'

{ after(grammarAccess.getXVariableDeclarationAccess().getConstKeyword_1_1()); }
{ after(grammarAccess.getXVariableDeclarationAccess().getValKeyword_1_1()); }
)

;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ RULE_WS=11
'finally'=86
'..<'=28
'new'=69
'val'=16
'null'=81
'const'=16
'typeof'=82
'requires'=66
'<=>'=33
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
@SuppressWarnings("all")
public class InternalSARLParser extends AbstractInternalContentAssistParser {
public static final String[] tokenNames = new String[] {
"<invalid>", "<EOR>", "<DOWN>", "<UP>", "RULE_ID", "RULE_HEX", "RULE_INT", "RULE_DECIMAL", "RULE_STRING", "RULE_ML_COMMENT", "RULE_SL_COMMENT", "RULE_WS", "RULE_ANY_OTHER", "'='", "'||'", "'&&'", "'const'", "'+='", "'-='", "'=='", "'!='", "'==='", "'!=='", "'>='", "'<='", "'>'", "'<'", "'->'", "'..<'", "'..'", "'=>'", "'<>'", "'?:'", "'<=>'", "'+'", "'-'", "'*'", "'**'", "'/'", "'%'", "'!'", "'.'", "'extends'", "'static'", "'import'", "'extension'", "'super'", "'false'", "'package'", "';'", "'event'", "'{'", "'}'", "'capacity'", "'agent'", "'behavior'", "'uses'", "','", "'on'", "'['", "']'", "'def'", "'('", "')'", "':'", "'fires'", "'requires'", "'skill'", "'implements'", "'new'", "'instanceof'", "'as'", "'#'", "'if'", "'else'", "'switch'", "'default'", "'case'", "'for'", "'while'", "'do'", "'null'", "'typeof'", "'throw'", "'return'", "'try'", "'finally'", "'catch'", "'?'", "'&'", "'var'", "'::'", "'?.'", "'|'", "'true'"
"<invalid>", "<EOR>", "<DOWN>", "<UP>", "RULE_ID", "RULE_HEX", "RULE_INT", "RULE_DECIMAL", "RULE_STRING", "RULE_ML_COMMENT", "RULE_SL_COMMENT", "RULE_WS", "RULE_ANY_OTHER", "'='", "'||'", "'&&'", "'val'", "'+='", "'-='", "'=='", "'!='", "'==='", "'!=='", "'>='", "'<='", "'>'", "'<'", "'->'", "'..<'", "'..'", "'=>'", "'<>'", "'?:'", "'<=>'", "'+'", "'-'", "'*'", "'**'", "'/'", "'%'", "'!'", "'.'", "'extends'", "'static'", "'import'", "'extension'", "'super'", "'false'", "'package'", "';'", "'event'", "'{'", "'}'", "'capacity'", "'agent'", "'behavior'", "'uses'", "','", "'on'", "'['", "']'", "'def'", "'('", "')'", "':'", "'fires'", "'requires'", "'skill'", "'implements'", "'new'", "'instanceof'", "'as'", "'#'", "'if'", "'else'", "'switch'", "'default'", "'case'", "'for'", "'while'", "'do'", "'null'", "'typeof'", "'throw'", "'return'", "'try'", "'finally'", "'catch'", "'?'", "'&'", "'var'", "'::'", "'?.'", "'|'", "'true'"
};
public static final int RULE_ID=4;
public static final int T__29=29;
Expand Down Expand Up @@ -8291,13 +8291,13 @@ public final void rule__BehaviorFeature__Alternatives() throws RecognitionExcept


// $ANTLR start "rule__Attribute__Alternatives_0"
// ../io.sarl.lang.ui/src-gen/io/sarl/lang/ui/contentassist/antlr/internal/InternalSARL.g:2698:1: rule__Attribute__Alternatives_0 : ( ( ( rule__Attribute__WriteableAssignment_0_0 ) ) | ( 'const' ) );
// ../io.sarl.lang.ui/src-gen/io/sarl/lang/ui/contentassist/antlr/internal/InternalSARL.g:2698:1: rule__Attribute__Alternatives_0 : ( ( ( rule__Attribute__WriteableAssignment_0_0 ) ) | ( 'val' ) );
public final void rule__Attribute__Alternatives_0() throws RecognitionException {

int stackSize = keepStackSize();

try {
// ../io.sarl.lang.ui/src-gen/io/sarl/lang/ui/contentassist/antlr/internal/InternalSARL.g:2702:1: ( ( ( rule__Attribute__WriteableAssignment_0_0 ) ) | ( 'const' ) )
// ../io.sarl.lang.ui/src-gen/io/sarl/lang/ui/contentassist/antlr/internal/InternalSARL.g:2702:1: ( ( ( rule__Attribute__WriteableAssignment_0_0 ) ) | ( 'val' ) )
int alt6=2;
int LA6_0 = input.LA(1);

Expand Down Expand Up @@ -8345,17 +8345,17 @@ else if ( (LA6_0==16) ) {
}
break;
case 2 :
// ../io.sarl.lang.ui/src-gen/io/sarl/lang/ui/contentassist/antlr/internal/InternalSARL.g:2709:6: ( 'const' )
// ../io.sarl.lang.ui/src-gen/io/sarl/lang/ui/contentassist/antlr/internal/InternalSARL.g:2709:6: ( 'val' )
{
// ../io.sarl.lang.ui/src-gen/io/sarl/lang/ui/contentassist/antlr/internal/InternalSARL.g:2709:6: ( 'const' )
// ../io.sarl.lang.ui/src-gen/io/sarl/lang/ui/contentassist/antlr/internal/InternalSARL.g:2710:1: 'const'
// ../io.sarl.lang.ui/src-gen/io/sarl/lang/ui/contentassist/antlr/internal/InternalSARL.g:2709:6: ( 'val' )
// ../io.sarl.lang.ui/src-gen/io/sarl/lang/ui/contentassist/antlr/internal/InternalSARL.g:2710:1: 'val'
{
if ( state.backtracking==0 ) {
before(grammarAccess.getAttributeAccess().getConstKeyword_0_1());
before(grammarAccess.getAttributeAccess().getValKeyword_0_1());
}
match(input,16,FOLLOW_16_in_rule__Attribute__Alternatives_05775); if (state.failed) return ;
if ( state.backtracking==0 ) {
after(grammarAccess.getAttributeAccess().getConstKeyword_0_1());
after(grammarAccess.getAttributeAccess().getValKeyword_0_1());
}

}
Expand Down Expand Up @@ -8558,13 +8558,13 @@ public final void rule__SkillFeature__Alternatives() throws RecognitionException


// $ANTLR start "rule__XVariableDeclaration__Alternatives_1"
// ../io.sarl.lang.ui/src-gen/io/sarl/lang/ui/contentassist/antlr/internal/InternalSARL.g:2762:1: rule__XVariableDeclaration__Alternatives_1 : ( ( ( rule__XVariableDeclaration__WriteableAssignment_1_0 ) ) | ( 'const' ) );
// ../io.sarl.lang.ui/src-gen/io/sarl/lang/ui/contentassist/antlr/internal/InternalSARL.g:2762:1: rule__XVariableDeclaration__Alternatives_1 : ( ( ( rule__XVariableDeclaration__WriteableAssignment_1_0 ) ) | ( 'val' ) );
public final void rule__XVariableDeclaration__Alternatives_1() throws RecognitionException {

int stackSize = keepStackSize();

try {
// ../io.sarl.lang.ui/src-gen/io/sarl/lang/ui/contentassist/antlr/internal/InternalSARL.g:2766:1: ( ( ( rule__XVariableDeclaration__WriteableAssignment_1_0 ) ) | ( 'const' ) )
// ../io.sarl.lang.ui/src-gen/io/sarl/lang/ui/contentassist/antlr/internal/InternalSARL.g:2766:1: ( ( ( rule__XVariableDeclaration__WriteableAssignment_1_0 ) ) | ( 'val' ) )
int alt8=2;
int LA8_0 = input.LA(1);

Expand Down Expand Up @@ -8612,17 +8612,17 @@ else if ( (LA8_0==16) ) {
}
break;
case 2 :
// ../io.sarl.lang.ui/src-gen/io/sarl/lang/ui/contentassist/antlr/internal/InternalSARL.g:2773:6: ( 'const' )
// ../io.sarl.lang.ui/src-gen/io/sarl/lang/ui/contentassist/antlr/internal/InternalSARL.g:2773:6: ( 'val' )
{
// ../io.sarl.lang.ui/src-gen/io/sarl/lang/ui/contentassist/antlr/internal/InternalSARL.g:2773:6: ( 'const' )
// ../io.sarl.lang.ui/src-gen/io/sarl/lang/ui/contentassist/antlr/internal/InternalSARL.g:2774:1: 'const'
// ../io.sarl.lang.ui/src-gen/io/sarl/lang/ui/contentassist/antlr/internal/InternalSARL.g:2773:6: ( 'val' )
// ../io.sarl.lang.ui/src-gen/io/sarl/lang/ui/contentassist/antlr/internal/InternalSARL.g:2774:1: 'val'
{
if ( state.backtracking==0 ) {
before(grammarAccess.getXVariableDeclarationAccess().getConstKeyword_1_1());
before(grammarAccess.getXVariableDeclarationAccess().getValKeyword_1_1());
}
match(input,16,FOLLOW_16_in_rule__XVariableDeclaration__Alternatives_15928); if (state.failed) return ;
if ( state.backtracking==0 ) {
after(grammarAccess.getXVariableDeclarationAccess().getConstKeyword_1_1());
after(grammarAccess.getXVariableDeclarationAccess().getValKeyword_1_1());
}

}
Expand Down
Binary file modified lang/plugins/io.sarl.lang/src-gen/io/sarl/lang/SARL.xtextbin
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -780,9 +780,9 @@ ruleAttribute returns [EObject current=null]

)
)
| otherlv_1='const'
| otherlv_1='val'
{
newLeafNode(otherlv_1, grammarAccess.getAttributeAccess().getConstKeyword_0_1());
newLeafNode(otherlv_1, grammarAccess.getAttributeAccess().getValKeyword_0_1());
}
)(
(
Expand Down Expand Up @@ -1549,9 +1549,9 @@ ruleXVariableDeclaration returns [EObject current=null]

)
)
| otherlv_2='const'
| otherlv_2='val'
{
newLeafNode(otherlv_2, grammarAccess.getXVariableDeclarationAccess().getConstKeyword_1_1());
newLeafNode(otherlv_2, grammarAccess.getXVariableDeclarationAccess().getValKeyword_1_1());
}
)(((((
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ RULE_WS=11
'|'=71
'..<'=53
'new'=38
'val'=23
'null'=86
'const'=23
'typeof'=87
'requires'=35
'='=24
Expand Down
Loading

0 comments on commit d661970

Please sign in to comment.