Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes redundant spaces in single tokens with multiline separators #268

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -953,8 +953,13 @@ private List<DslLine> preProcessLines(List<String> lines) {

for (String line : lines) {
if (line.endsWith(MULTI_LINE_SEPARATOR)) {
buf.append(line, 0, line.length()-1);
lineComplete = false;
if (lineComplete) {
buf.append(line, 0, line.length()-1);
lineComplete = false;
} else {
String strippedLine = line.stripLeading();
buf.append(strippedLine, 0, strippedLine.length() - 1);
}
} else {
if (lineComplete) {
buf.append(line);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,14 @@ void test_MultiLineSupport() throws Exception {
assertNotNull(parser.getWorkspace().getModel().getSoftwareSystemWithName("Software System"));
}

@Test
void test_MultiLineInTheMiddleOfTheStringSupport() throws Exception {
StructurizrDslParser parser = new StructurizrDslParser();
parser.parse(new File("src/test/resources/dsl/multi-line-break-string.dsl"));

assertNotNull(parser.getWorkspace().getModel().getSoftwareSystemWithName("Software System"));
}

@Test
void test_MultiLineWithError() {
File dslFile = new File("src/test/resources/dsl/multi-line-with-error.dsl");
Expand Down
20 changes: 20 additions & 0 deletions structurizr-dsl/src/test/resources/dsl/multi-line-break-string.dsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
work\
sp\
ace {

mo\
d\
el {
soft\
wareSys\
tem = \
soft\
wareSys\
tem \
"Sof\
tware \
Sys\
tem"
}

}
Loading