Skip to content

Commit

Permalink
Update parser.js
Browse files Browse the repository at this point in the history
sometimes nested objects in the config file are not indented and this causes the parser to break because the while loop doesn't exit and we reach the end of the object with no closing bracket detected.

the behavior can be observed in issue 99:
f5devcentral#99
  • Loading branch information
zdrouse committed Feb 7, 2024
1 parent e6f9fce commit 4800405
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/engines/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function orchestrate(arr) {
// quoted bracket "{" won't trigger recursion
if (arr[i].endsWith('{') && arr.length !== 1) {
let c = 0;
while (arr[i + c] !== ' }') {
while (arr[i + c] !== ' }' && arr[i + c] !== '}') {
c += 1;
if ((i + c) >= arr.length) {
throw new Error(`Missing or mis-indented '}' for line: '${arr[i]}'`);
Expand Down

0 comments on commit 4800405

Please sign in to comment.