-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #258 from DimitriPlotnikov/master
Improve stabilit of the symboltable infrastructure and use the latest MC version.
- Loading branch information
Showing
36 changed files
with
593 additions
and
489 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/main/java/org/nest/nestml/_cocos/AssignmentToAlias.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (c) 2015 RWTH Aachen. All rights reserved. | ||
* | ||
* http://www.se-rwth.de/ | ||
*/ | ||
package org.nest.nestml._cocos; | ||
|
||
import de.monticore.symboltable.Scope; | ||
import org.nest.nestml._ast.ASTAliasDecl; | ||
import org.nest.spl._ast.ASTAssignment; | ||
import org.nest.spl._cocos.SPLASTAssignmentCoCo; | ||
import org.nest.symboltable.symbols.VariableSymbol; | ||
|
||
import static com.google.common.base.Preconditions.checkArgument; | ||
import static de.se_rwth.commons.logging.Log.error; | ||
|
||
/** | ||
* Every alias declaration has exactly one variable | ||
* | ||
* @author (last commit) ippen, plotnikov | ||
*/ | ||
public class AssignmentToAlias implements SPLASTAssignmentCoCo { | ||
|
||
public static final String ERROR_CODE = "NESTML_Assignment"; | ||
|
||
@Override | ||
public void check(final ASTAssignment astAssignment) { | ||
checkArgument(astAssignment.getEnclosingScope().isPresent(), "Run symboltable creator."); | ||
|
||
final Scope scope = astAssignment.getEnclosingScope().get(); | ||
final String variableName = astAssignment.getLhsVarialbe().toString(); | ||
final VariableSymbol lhsVariable = VariableSymbol.resolve(variableName, scope); | ||
if (lhsVariable.isAlias()) { | ||
String msg = CocoErrorStrings.getInstance().getErrorMsg(this, variableName); | ||
|
||
error(msg, astAssignment.get_SourcePositionStart()); | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.