From 3b9dd50e49a4bd566472cb6258834ee034b9ee08 Mon Sep 17 00:00:00 2001 From: Jeronimo Wanhoff Date: Tue, 2 Apr 2024 14:41:07 +0200 Subject: [PATCH] added new bracket handling to bml --- src/main/java/org/sep3tools/BmlVisitor.java | 21 +++++---------------- src/main/resources/bmltest.properties | 4 ++-- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/sep3tools/BmlVisitor.java b/src/main/java/org/sep3tools/BmlVisitor.java index a053764..88e3f9d 100644 --- a/src/main/java/org/sep3tools/BmlVisitor.java +++ b/src/main/java/org/sep3tools/BmlVisitor.java @@ -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 { @@ -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; } diff --git a/src/main/resources/bmltest.properties b/src/main/resources/bmltest.properties index da1e81d..e338960 100644 --- a/src/main/resources/bmltest.properties +++ b/src/main/resources/bmltest.properties @@ -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