Skip to content

Commit

Permalink
Fixing the automatic generation of hidden functions related to the is…
Browse files Browse the repository at this point in the history
…sue #2.

The hidden functions are whose corresponding to the different possibilities of function implementation according to parameters with default values.
  • Loading branch information
gallandarakhneorg committed May 27, 2014
1 parent fa9b4e4 commit c5ee8a1
Show file tree
Hide file tree
Showing 37 changed files with 4,416 additions and 1,115 deletions.
4 changes: 3 additions & 1 deletion lang/plugins/io.sarl.lang.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ Bundle-SymbolicName: io.sarl.lang.core
Bundle-Version: 0.1.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: javax.inject;version="1.0.0"
Export-Package: io.sarl.lang.core
Export-Package: io.sarl.lang.annotation,
io.sarl.lang.core,
io.sarl.lang.util
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* $Id$
*
* Janus platform is an open-source multiagent platform.
* More details on http://www.janusproject.io
*
* Copyright (C) 2014 Sebastian RODRIGUEZ, Nicolas GAUD, Stéphane GALLAND.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.sarl.lang.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/** Annotation for marking a parameter with a default value.
*
* @author $Author: sgalland$
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
* @see Generated
* @see DefaultValueSource
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface DefaultValue {
/** Replies the id of the field that contains the default value.
*
* @return the id of the fied that contains the default value,
* or nothing if the id is unknown
*/
String valueId() default "";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* $Id$
*
* Janus platform is an open-source multiagent platform.
* More details on http://www.janusproject.io
*
* Copyright (C) 2014 Sebastian RODRIGUEZ, Nicolas GAUD, Stéphane GALLAND.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.sarl.lang.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/** Annotation for marking a function that has parameters
* with default values.
*
* @author $Author: sgalland$
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
* @see Generated
* @see DefaultValue
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface DefaultValueSource {
//
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* $Id$
*
* Janus platform is an open-source multiagent platform.
* More details on http://www.janusproject.io
*
* Copyright (C) 2014 Sebastian RODRIGUEZ, Nicolas GAUD, Stéphane GALLAND.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.sarl.lang.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/** Annotation for marking a function that is using default parameter values.
*
* @author $Author: sgalland$
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
* @see Generated
* @see DefaultValue
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface DefaultValueUse {
/** Replies the original signature of the function with default value parameters.
* @return the original signature.
*/
public String signature();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* $Id$
*
* Janus platform is an open-source multiagent platform.
* More details on http://www.janusproject.io
*
* Copyright (C) 2014 Sebastian RODRIGUEZ, Nicolas GAUD, Stéphane GALLAND.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.sarl.lang.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/** Annotation for marking a function or a field that is automatically
* generated by the Sarl compiler.
*
* @author $Author: sgalland$
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
* @see DefaultValueSource
* @see DefaultValue
*/
@Target({ElementType.METHOD,ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Generated {
//
}
Original file line number Diff line number Diff line change
Expand Up @@ -58227,25 +58227,7 @@ public final void rule__JvmTypeReference__Group_0__1__Impl() throws RecognitionE
loop144:
do {
int alt144=2;
int LA144_0 = input.LA(1);

if ( (LA144_0==65) ) {
int LA144_2 = input.LA(2);

if ( (LA144_2==66) ) {
int LA144_3 = input.LA(3);

if ( (synpred200_InternalSARL()) ) {
alt144=1;
}


}


}


alt144 = dfa144.predict(input);
switch (alt144) {
case 1 :
// ../io.sarl.lang.ui/src-gen/io/sarl/lang/ui/contentassist/antlr/internal/InternalSARL.g:20351:2: rule__JvmTypeReference__Group_0_1__0
Expand Down Expand Up @@ -72147,6 +72129,7 @@ public final boolean synpred190_InternalSARL() {
protected DFA133 dfa133 = new DFA133(this);
protected DFA134 dfa134 = new DFA134(this);
protected DFA139 dfa139 = new DFA139(this);
protected DFA144 dfa144 = new DFA144(this);
protected DFA148 dfa148 = new DFA148(this);
static final String DFA17_eotS =
"\13\uffff";
Expand Down Expand Up @@ -74710,6 +74693,166 @@ public int specialStateTransition(int s, IntStream _input) throws NoViableAltExc
throw nvae;
}
}
static final String DFA144_eotS =
"\125\uffff";
static final String DFA144_eofS =
"\1\1\124\uffff";
static final String DFA144_minS =
"\1\4\37\uffff\1\0\64\uffff";
static final String DFA144_maxS =
"\1\142\37\uffff\1\0\64\uffff";
static final String DFA144_acceptS =
"\1\uffff\1\2\122\uffff\1\1";
static final String DFA144_specialS =
"\40\uffff\1\0\64\uffff}>";
static final String[] DFA144_transitionS = {
"\5\1\4\uffff\47\1\1\uffff\1\1\1\uffff\2\1\5\uffff\3\1\1\40\32"+
"\1\2\uffff\5\1",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"\1\uffff",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
};

static final short[] DFA144_eot = DFA.unpackEncodedString(DFA144_eotS);
static final short[] DFA144_eof = DFA.unpackEncodedString(DFA144_eofS);
static final char[] DFA144_min = DFA.unpackEncodedStringToUnsignedChars(DFA144_minS);
static final char[] DFA144_max = DFA.unpackEncodedStringToUnsignedChars(DFA144_maxS);
static final short[] DFA144_accept = DFA.unpackEncodedString(DFA144_acceptS);
static final short[] DFA144_special = DFA.unpackEncodedString(DFA144_specialS);
static final short[][] DFA144_transition;

static {
int numStates = DFA144_transitionS.length;
DFA144_transition = new short[numStates][];
for (int i=0; i<numStates; i++) {
DFA144_transition[i] = DFA.unpackEncodedString(DFA144_transitionS[i]);
}
}

class DFA144 extends DFA {

public DFA144(BaseRecognizer recognizer) {
this.recognizer = recognizer;
this.decisionNumber = 144;
this.eot = DFA144_eot;
this.eof = DFA144_eof;
this.min = DFA144_min;
this.max = DFA144_max;
this.accept = DFA144_accept;
this.special = DFA144_special;
this.transition = DFA144_transition;
}
public String getDescription() {
return "()* loopback of 20351:1: ( rule__JvmTypeReference__Group_0_1__0 )*";
}
public int specialStateTransition(int s, IntStream _input) throws NoViableAltException {
TokenStream input = (TokenStream)_input;
int _s = s;
switch ( s ) {
case 0 :
int LA144_32 = input.LA(1);


int index144_32 = input.index();
input.rewind();
s = -1;
if ( (synpred200_InternalSARL()) ) {s = 84;}

else if ( (true) ) {s = 1;}


input.seek(index144_32);
if ( s>=0 ) return s;
break;
}
if (state.backtracking>0) {state.failed=true; return -1;}
NoViableAltException nvae =
new NoViableAltException(getDescription(), 144, _s, input);
error(nvae);
throw nvae;
}
}
static final String DFA148_eotS =
"\125\uffff";
static final String DFA148_eofS =
Expand Down
Loading

0 comments on commit c5ee8a1

Please sign in to comment.