moved symbol scope from non-terminal architecture to non-terminal compilation unit

parent bad4715c
......@@ -44,6 +44,8 @@
<Common-MontiCar.version>0.0.3-SNAPSHOT</Common-MontiCar.version>
<Embedded-MontiArc.version>0.0.3-SNAPSHOT</Embedded-MontiArc.version>
<Embedded-MontiArc-Behaviour.version>0.0.3-SNAPSHOT</Embedded-MontiArc-Behaviour.version>
<Math.version>0.0.3-SNAPSHOT-REWORK</Math.version>
<!-- .. Libraries .................................................. -->
<guava.version>18.0</guava.version>
<junit.version>4.12</junit.version>
......@@ -167,6 +169,21 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>de.monticore.lang</groupId>
<artifactId>math</artifactId>
<version>${Math.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang</groupId>
<artifactId>math</artifactId>
<version>${Math.version}</version>
<classifier>${grammars.classifier}</classifier>
<scope>provided</scope>
</dependency>
<!-- .. Test Libraries ............................................... -->
<dependency>
......
package de.monticore.lang.monticar;
grammar CNNTrain extends de.monticore.common.Common {
grammar CNNTrain extends de.monticore.lang.math.Math {
CNNTrainCompilationUnit = TrainingConfiguration;
symbol scope CNNTrainCompilationUnit = "training" name:Name& "{" TrainingConfiguration "}";
symbol scope TrainingConfiguration = "training" name:Name& "{"
(assignments:ParameterAssignment)+ "}";
TrainingConfiguration = (assignments:ParameterAssignment)+;
ParameterAssignment = lhs:TrainingParameter "=" rhs:ParameterRhs;
enum TrainingParameter = DATA:"data"
......@@ -18,8 +17,7 @@ grammar CNNTrain extends de.monticore.common.Common {
ParameterRhs = stringVal:String
| intVal:Num_Int
| doubleVal:Num_Double
| refOrBool:Name;
| number:Number
| refOrBool:Name;
}
\ No newline at end of file
......@@ -20,6 +20,8 @@
*/
package de.monticore.lang.monticar.cnntrain._ast;
import siunit.monticoresiunit.si._ast.ASTNumber;
import java.util.Optional;
public class ASTParameterRhs extends ASTParameterRhsTOP {
......@@ -29,8 +31,8 @@ public class ASTParameterRhs extends ASTParameterRhsTOP {
public ASTParameterRhs() {
}
public ASTParameterRhs(String stringVal, String intVal, String doubleVal, String refOrBool) {
super(stringVal, intVal, doubleVal, refOrBool);
public ASTParameterRhs(String stringVal, ASTNumber number, String refOrBool) {
super(stringVal, number, refOrBool);
}
@Override
......
......@@ -27,8 +27,8 @@ public class ASTTrainingConfiguration extends ASTTrainingConfigurationTOP {
public ASTTrainingConfiguration() {
}
public ASTTrainingConfiguration(String name, List<ASTParameterAssignment> assignments) {
super(name, assignments);
public ASTTrainingConfiguration(List<ASTParameterAssignment> assignments) {
super(assignments);
}
public ASTParameterRhs get(String lhsName) {
......
......@@ -18,15 +18,12 @@
* License along with this project. If not, see <http://www.gnu.org/licenses/>.
* *******************************************************************************
*/
package de.monticore.lang.monticar.cnntrain._symboltable;
package de.monticore.lang.monticar.cnntrain._cocos;
public class TrainingConfigurationSymbol extends de.monticore.symboltable.CommonScopeSpanningSymbol {
public class CNNTrainCocos {
public static final TrainingConfigurationKind KIND = new TrainingConfigurationKind();
public TrainingConfigurationSymbol(String name) {
super(name, KIND);
public static CNNTrainCoCoChecker createChecker() {
return new CNNTrainCoCoChecker();
}
}
......@@ -51,7 +51,7 @@ public class CNNTrainSymbolTableCreator extends CNNTrainSymbolTableCreatorTOP {
@Override
public void visit(final ASTCNNTrainCompilationUnit compilationUnit) {
Log.debug("Building Symboltable for Script: " + compilationUnit.getTrainingConfiguration().getName(),
Log.debug("Building Symboltable for Script: " + compilationUnit.getName(),
CNNTrainSymbolTableCreator.class.getSimpleName());
List<ImportStatement> imports = new ArrayList<>();
......@@ -62,14 +62,12 @@ public class CNNTrainSymbolTableCreator extends CNNTrainSymbolTableCreatorTOP {
imports);
putOnStack(artifactScope);
}
public void visit(final ASTTrainingConfiguration trainingConfiguration) {
TrainingConfigurationSymbol configSymbol = new TrainingConfigurationSymbol(
trainingConfiguration.getName()
CNNTrainCompilationUnitSymbol compilationUnitSymbol = new CNNTrainCompilationUnitSymbol(
compilationUnit.getName()
);
addToScopeAndLinkWithNode(configSymbol, trainingConfiguration);
addToScopeAndLinkWithNode(compilationUnitSymbol, compilationUnit);
}
public void endVisit(final ASTTrainingConfiguration trainingConfiguration) {
......
<configuration>
<timestamp key="bySecond" datePattern="yyyy-MM-dd-HHmmss"/>
<!-- this is a console appender -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>
%date{yyyy-MM-dd HH:mm:ss} %-7([%level]) %logger{26} %message%n
</pattern>
</encoder>
</appender>
<root level="TRACE">
<appender-ref ref="CONSOLE" />
</root>
</configuration>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment