Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
generators
EMAM2Cpp
Commits
6d2406fa
Commit
6d2406fa
authored
Jul 12, 2018
by
Christoph Richter
Browse files
Fixed command name detection
parent
5378fd7d
Pipeline
#62384
passed with stage
in 2 minutes and 35 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/monticore/lang/monticar/generator/MathCommand.java
View file @
6d2406fa
...
...
@@ -6,6 +6,8 @@ import de.monticore.lang.math._symboltable.matrix.MathMatrixNameExpressionSymbol
import
java.util.HashSet
;
import
static
de
.
monticore
.
lang
.
monticar
.
generator
.
cpp
.
MathCommandRegisterCPP
.
removeBrackets
;
/**
* @author Sascha Schneiders.
*/
...
...
@@ -36,7 +38,9 @@ public abstract class MathCommand {
convert
(
mathExpressionSymbol
,
bluePrint
);
if
(
mathExpressionSymbol
instanceof
MathMatrixNameExpressionSymbol
)
{
MathMatrixNameExpressionSymbol
mathMatrixNameExpressionSymbol
=
(
MathMatrixNameExpressionSymbol
)
mathExpressionSymbol
;
targetLanguageCommandNames
.
add
(
mathMatrixNameExpressionSymbol
.
getTextualRepresentation
());
String
s
=
mathMatrixNameExpressionSymbol
.
getTextualRepresentation
();
s
=
removeBrackets
(
s
);
targetLanguageCommandNames
.
add
(
s
);
}
}
...
...
@@ -53,10 +57,9 @@ public abstract class MathCommand {
public
boolean
isTargetLanguageCommand
(
String
command
)
{
if
(!
command
.
isEmpty
())
for
(
String
s
:
getTargetLanguageCommandNames
())
if
(
s
.
cont
ain
s
(
command
))
if
(
s
.
cont
entEqual
s
(
command
))
return
true
;
return
false
;
}
}
src/main/java/de/monticore/lang/monticar/generator/cpp/MathCommandRegisterCPP.java
View file @
6d2406fa
...
...
@@ -97,6 +97,14 @@ public class MathCommandRegisterCPP extends MathCommandRegister {
return
fullString
;
}
public
static
String
removeBrackets
(
String
fullString
)
{
String
result
=
removeTrailingStrings
(
fullString
,
"("
);
int
idx
=
result
.
indexOf
(
"("
);
if
(
idx
>
0
)
result
=
result
.
substring
(
0
,
idx
);
return
result
;
}
public
static
String
calculateName
(
String
fullName
)
{
int
index
=
fullName
.
indexOf
(
"("
);
String
name
=
""
;
...
...
src/main/java/de/monticore/lang/monticar/generator/cpp/converter/ExecuteMethodGeneratorMatrixExpressionHandler.java
View file @
6d2406fa
...
...
@@ -271,7 +271,7 @@ public class ExecuteMethodGeneratorMatrixExpressionHandler {
return
MathConverter
.
curBackend
.
usesZeroBasedIndexing
()
&&
symbol
.
isMathMatrixAccessOperatorSymbolPresent
()
&&
(!
symbol
.
getNameToAccess
().
isEmpty
())
&&
(!
MathCommandRegisterCPP
.
containsCommandExpression
(
symbol
,
input
))
&&
(!
MathCommandRegisterCPP
.
containsCommandExpression
(
symbol
,
symbol
.
getNameToAccess
()
+
input
))
&&
(!
MathFunctionFixer
.
fixForLoopAccess
(
symbol
.
getMathMatrixAccessOperatorSymbol
().
getMathMatrixNameExpressionSymbol
(),
ComponentConverter
.
currentBluePrint
))
&&
(!
StringValueListExtractorUtil
.
containsPortName
(
symbol
.
getNameToAccess
()));
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment