Skip to content

Commit

Permalink
Fixes a bug that occurs when using arrays inside of an embedded expre…
Browse files Browse the repository at this point in the history
…ssion inside a string. Closes #1
  • Loading branch information
monster860 committed Aug 8, 2016
1 parent a754848 commit 2a340ac
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/monster860/fastdmm/objtree/ObjectTreeParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public class ObjectTreeParser {
int parenthesisDepth = 0;
int stringDepth = 0;
int stringExpDepth = 0;
int parenthesesDepth = 0;
int parenthesesDepth = 0;
int[] arrayDepth = new int[50];

public ObjectTree tree;

Expand Down Expand Up @@ -396,7 +397,8 @@ public void run() {
parenthesisDepth = 0;
stringDepth = 0;
stringExpDepth = 0;
parenthesesDepth = 0;
parenthesesDepth = 0;
arrayDepth = new int[50];
}

public String stripComments(String s)
Expand Down Expand Up @@ -431,9 +433,14 @@ public String stripComments(String s)
multilineStringDepth = stringDepth;
}
}
if(c == '[' && (pC != '\\' || ppC == '\\') && stringDepth != stringExpDepth)
if(c == '[' && stringDepth == stringExpDepth)
arrayDepth[stringExpDepth]++;
else if(c == '[' && (pC != '\\' || ppC == '\\') && stringDepth != stringExpDepth)
stringExpDepth++;
if(c == ']' && stringDepth > 0 && stringDepth == stringExpDepth)

if(c == ']' && arrayDepth[stringExpDepth] != 0)
arrayDepth[stringExpDepth]--;
else if(c == ']' && stringDepth > 0 && stringDepth == stringExpDepth)
stringExpDepth--;
if(c == '(' && stringDepth == stringExpDepth)
parenthesisDepth++;
Expand Down

0 comments on commit 2a340ac

Please sign in to comment.