Commit 94953dec authored by Christoph Richter's avatar Christoph Richter
Browse files

Added symboltable creator

parent 127880e7
Pipeline #55655 failed with stage
in 14 seconds
/**
* ******************************************************************************
* MontiCAR Modeling Family, www.se-rwth.de
* Copyright (c) 2018, Software Engineering Group at RWTH Aachen,
* All rights reserved.
* <p>
* This project is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* <p>
* You should have received a copy of the GNU Lesser General Public
* License along with this project. If not, see <http://www.gnu.org/licenses/>.
* *******************************************************************************
*/
package de.monticore.lang.mathopt._symboltable;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarcmath._symboltable.EmbeddedMontiArcMathSymbolTableCreator;
import de.monticore.lang.embeddedmontiarcmathopt._visitor.EmbeddedMontiArcMathOptDelegatorVisitor;
import de.monticore.lang.embeddedmontiarcmathopt._visitor.EmbeddedMontiArcMathOptVisitor;
import de.monticore.symboltable.MutableScope;
import de.monticore.symboltable.ResolvingConfiguration;
import java.util.Deque;
/**
* Creates a hand written symbol table for EmbeddedMontiArcMathOpt
*
* @author Christoph Richter
*/
public class EmbeddedMontiArcMathOptSymbolTableCreator extends EmbeddedMontiArcMathSymbolTableCreator implements EmbeddedMontiArcMathOptVisitor {
// fields
private EmbeddedMontiArcMathOptDelegatorVisitor visitorOpt = new EmbeddedMontiArcMathOptDelegatorVisitor();
private MathOptSymbolTableCreator mathOptSTC;
// constructors from inherited
public EmbeddedMontiArcMathOptSymbolTableCreator(ResolvingConfiguration resolvingConfig, MutableScope enclosingScope) {
super(resolvingConfig, enclosingScope);
}
public EmbeddedMontiArcMathOptSymbolTableCreator(ResolvingConfiguration resolvingConfig, Deque<MutableScope> scopeStack) {
super(resolvingConfig, scopeStack);
}
@Override
protected void initSuperSTC(ResolvingConfiguration resolvingConfig) {
super.initSuperSTC(resolvingConfig);
// init math opt symbol table creator
mathOptSTC = new MathOptSymbolTableCreator(resolvingConfig, scopeStack);
// init visitor delegator for optimization languages
visitorOpt.setExpressionsBasisVisitor(mathOptSTC);
visitorOpt.setCommonExpressionsVisitor(mathOptSTC);
visitorOpt.setAssignmentExpressionsVisitor(mathOptSTC);
visitorOpt.setTypes2Visitor(mathOptSTC);
visitorOpt.setMatrixExpressionsVisitor(mathOptSTC);
visitorOpt.setMatrixVisitor(mathOptSTC);
visitorOpt.setMathVisitor(mathOptSTC);
// set existing stc's
visitorOpt.setCommon2Visitor(getEmamSTC());
visitorOpt.setEmbeddedMontiArcMathVisitor(getEmamSTC());
visitorOpt.setEmbeddedMontiArcVisitor(getEmaSTC());
visitorOpt.setEmbeddedMontiArcBehaviorVisitor(getEmaBehaviorSTC());
}
@Override
public EmbeddedMontiArcMathOptVisitor getRealThis() {
return this;
}
@Override
public void setRealThis(EmbeddedMontiArcMathOptVisitor realThis) {
if (getRealThis() != realThis) {
setRealThis(realThis);
visitorOpt.setRealThis(realThis);
}
}
protected MathOptSymbolTableCreator getMathOptSTC() {
return mathOptSTC;
}
}
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