Skip to content

Commit

Permalink
Improve parsing algorithm to handle spaces and comments #63
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Oct 14, 2021
1 parent 95b59aa commit 9a00814
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions makesure.awk
Original file line number Diff line number Diff line change
Expand Up @@ -432,9 +432,9 @@ body,goalBody,goalBodies,resolvedGoals,exitCode, t0,t1,t2, goalTimed, list) {
resolveGoalsToRun(resolvedGoals)

if ("-d" in Args || "--resolved" in Args) {
printf("Resolved goals to reach for '%s':\n", join(ArgGoals, 0, arrLen(ArgGoals), " "))
printf("Resolved goals to reach for '%s':\n", join(ArgGoals, 0, arrLen(ArgGoals), " ")) # TODO
for (i = 0; i in resolvedGoals; i++) {
print " " resolvedGoals[i]
print " " quote2(resolvedGoals[i])
}
} else {
for (i = 0; i in resolvedGoals; i++) {
Expand Down
1 change: 1 addition & 0 deletions tests/21_parsing '.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
single quote
11 changes: 10 additions & 1 deletion tests/21_parsing.tush
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@

$ cd "$MYDIR"; ./$MAKESURE -f tests/21_parsing_spaces.sh -la
| Available goals:
| $'21_parsing \'.txt'
| '21_parsing 1.txt'
| '21_parsing 2.txt'
| 21_parsing*.txt
| '21_parsing*.txt'
| $'g1@21_parsing \'.txt'
| 'g1@21_parsing 1.txt'
| 'g1@21_parsing 2.txt'
| g1
Expand Down Expand Up @@ -39,6 +41,13 @@ $ cd "$MYDIR"; ./$MAKESURE -f tests/21_parsing_quoting.sh -l
| $'name with \' quote' : name with ' quote
| default

$ cd "$MYDIR"; ./$MAKESURE -f tests/21_parsing_quoting.sh -d
| Resolved goals to reach for 'default':
| no_space
| 'name with spaces'
| $'name with \' quote'
| default

$ cd "$MYDIR"; ./$MAKESURE -f tests/21_parsing_quoting.sh
| goal 'no_space' ...
| no_space
Expand Down

0 comments on commit 9a00814

Please sign in to comment.