You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just want to document a sharp corner I ran into while using this. Not sure there's a fix. (It looks like sedparse is parsing correctly and IDK if there's a reliable way to normalize the input in all cases.)
I'm handling a script that has something like the below (I'm simplifying it to just the expression that triggers the error):
sed -E -e "s,.*(query\\[A|DHCP).*,${COL_NC}&${COL_NC},"
I'm using argparse to identify the expressions and just pass those to sedparse, and when it tries to parse the expression above it raises:
...
File "/nix/store/q0fjmh9bjn7shcbrmcnir34bxlbs7a81-resholve-0.9.1-dirty/bin/.resholve-wrapped", line 3726, in _find_sed_e_cmd
sedparse.compile_string(parsed, expr)
File "/nix/store/py54k9w06iqh5x2pssv87mwpmjh702g5-python2.7-sedparse-0.1.2/lib/python2.7/site-packages/sedparse.py", line 1408, in compile_string
compile_program(cur_program)
File "/nix/store/py54k9w06iqh5x2pssv87mwpmjh702g5-python2.7-sedparse-0.1.2/lib/python2.7/site-packages/sedparse.py", line 1321, in compile_program
bad_prog(UNTERM_S_CMD)
File "/nix/store/py54k9w06iqh5x2pssv87mwpmjh702g5-python2.7-sedparse-0.1.2/lib/python2.7/site-packages/sedparse.py", line 648, in bad_prog
exitcode=EXIT_BAD_USAGE,
sedparse.ParseError: sedparse: -e expression #3, char 35: unterminated `s' command
I'm blaming escaping because of the behavior I see when I spot-check this from the CLI.
The parse error doesn't happen if I feed a similar string in to the CLI:
Just want to document a sharp corner I ran into while using this. Not sure there's a fix. (It looks like sedparse is parsing correctly and IDK if there's a reliable way to normalize the input in all cases.)
I'm handling a script that has something like the below (I'm simplifying it to just the expression that triggers the error):
I'm using argparse to identify the expressions and just pass those to sedparse, and when it tries to parse the expression above it raises:
I'm blaming escaping because of the behavior I see when I spot-check this from the CLI.
The parse error doesn't happen if I feed a similar string in to the CLI:
But if I switch to single quotes, sed and sedparse both emit the same parse error:
The single-quoted form works in both cases (and the parse tree is the same) if I remove one backslash:
The text was updated successfully, but these errors were encountered: