Things to take into account
- Support comments in
@directive lines and spaces in goal names
- We need to rely on quoting
'str' or "str"
- It's desirable that whatever quoting approach we chose it plays nice with shell's quoting:
- The shell highligting applied to
Makesurefile in IDE keeps working.
- You can take the goal name as rendered by
./makesure -l and use it to call ./makesure 'goal name'
- However to implement the whole shell-compliant parsing for
'all' "types" of $'strings' will be too complex.
- Need to handle
'\'' properly and consistently.
- Complications with
@doc and @define
Comments
@goal goal_with_comment # comment
echo goal_with_comment
@goal test1
@depends_on goal_with_comment
This one won't parse as expected. # comment will be treated as part of goal name
Spaces
@goal @glob 22_parsing*.txt # glob can produce files with whitespaces in the name
echo "$ITEM"
cat "$ITEM"
@goal test2
@depends_on '22_parsing 2.txt' # but currently this is impossible
Right now we rely on default AWK algorithm at parsing a line (NF + $i). This is totally fine for current version since covers most of cases, but we need something more flexible.
Possible approach
@goal no_space
@goal 'name with spaces' # no single quote allowed between single quotes
@goal $'name with \' quote' # $'strings' allow quote escaping
./makesure -l
Available goals:
no_space
'name with spaces'
$'name with \' quote'
Rationale
- Why support both
'str' and $'str'
- most of the time
'str' can be used, rarely $'str\'str'
- Why not
"str\"\'str"
- this implies unneded variables substitution. I.e.
./makesure "aaa$bbb" will not work as expected.
Things to take into account
@directivelines and spaces in goal names'str' or "str"Makesurefilein IDE keeps working../makesure -land use it to call./makesure 'goal name''all' "types" of $'strings'will be too complex.'\''properly and consistently.@docand@defineComments
This one won't parse as expected.
# commentwill be treated as part of goal nameSpaces
Right now we rely on default AWK algorithm at parsing a line (
NF+$i). This is totally fine for current version since covers most of cases, but we need something more flexible.Possible approach
./makesure -lRationale
'str'and$'str''str'can be used, rarely$'str\'str'"str\"\'str"./makesure "aaa$bbb"will not work as expected.