Skip to content

Commit

Permalink
added new bracket handling to bml
Browse files Browse the repository at this point in the history
  • Loading branch information
wanhoff committed Apr 2, 2024
1 parent a8574d0 commit 3b9dd50
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
21 changes: 5 additions & 16 deletions src/main/java/org/sep3tools/BmlVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ public String visitAttr(PetroGrammarParser.AttrContext ctx) {
@Override
public String visitUebergang_bes(PetroGrammarParser.Uebergang_besContext ctx) {
String teile = "";
String attrib;
String attrib = "";

if (ctx.getText().startsWith(" (")) {
if (ctx.getText().trim().startsWith("(")) {
teile = visit(ctx.uebergang_bes());
}
else {
Expand All @@ -155,20 +155,9 @@ public String visitUebergang_bes(PetroGrammarParser.Uebergang_besContext ctx) {
}
}
}
if (isNull(ctx.attribute())) {
attrib = "";
}
else {
String attr = visit(ctx.attribute());
if (isNull(attr)) {
attrib = "";
}
else if (attr.startsWith(" (")) {
attrib = attr.substring(2, attr.length() - 1);
}
else {
attrib = attr;
}

for (PetroGrammarParser.AttributeContext teil : ctx.attribute()) {
attrib = attrib + ", " + visit(teil);
}
return teile + attrib;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/bmltest.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
^hzk,\ fS(ms2,\ "gl"2)=fS,mS
G(fg-gg,ms-gs,mats,mata,grs(tw)),fX-mX(mata),mS(fs,grs,fg-mg2,mx(voe))=G,fG,gG,mS,gS,eG,X,fS,mG
U(hz(res),H(res),zg1)=U,Pfl,H
(fS-mS)(u,(fg-mg2)(lok))=U,fG,mG
(fS-mS)(u,(fg-mg2)(fs))=U,fG,mG,fS
(fS-mS)(u,(fg-mg2)(lok))=fS,mS,U,fG,mG
(fS-mS)(u,(fg-mg2)(fs))=fS,mS,U,fG,mG

0 comments on commit 3b9dd50

Please sign in to comment.