Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise syntax error for unknown s/// flags #3

Closed
aureliojargas opened this issue Apr 22, 2014 · 1 comment
Closed

Raise syntax error for unknown s/// flags #3

aureliojargas opened this issue Apr 22, 2014 · 1 comment
Labels
Milestone

Comments

@aureliojargas
Copy link
Owner

If you inform an invalid flags at the end of the s/// command, they are silently removed.

$ sedsed -e 's/foo/bar/h5!' 
s/foo/bar/
$ sedsed -e 's/foo/bar/gX' 
s/foo/bar/g
$ sedsed -e 's/foo/bar/Xg' 
s/foo/bar/
$

Note in the last example that even valid flags (such as g) are removed if they appear after an invalid flag.

An invalid flag is a syntax error and the parser should act accordingly: raise a fatal error.

aureliojargas added a commit that referenced this issue Jun 22, 2019
I don't remember why I've left those unchecked in the first place.
Now the proper error checking is performed and the new test/errors
script will make sure they are working.

Fixes #3
Fixes #48
aureliojargas added a commit that referenced this issue Jun 23, 2019
I don't remember why I've left those unchecked in the first place.
Now the proper error checking is performed and the new test/errors
script will make sure they are working.

Fixes #3
Fixes #48
@aureliojargas
Copy link
Owner Author

Fixed by the new sedparse parser, see #52.

$ ./sedsed.py -e 's/foo/bar/h5!' 
ERROR: sedparse: -e expression #1, char 11: unknown option to `s'
$ ./sedsed.py -e 's/foo/bar/gX'
ERROR: sedparse: -e expression #1, char 12: unknown option to `s'
$ ./sedsed.py -e 's/foo/bar/Xg'
ERROR: sedparse: -e expression #1, char 11: unknown option to `s'
$

aureliojargas added a commit that referenced this issue Nov 17, 2019
To make sure an invalid command is detected as such, and an error
message is shown to the user.

Covers the problems found in issues #3 and #48.
@aureliojargas aureliojargas added this to the v2.0 milestone Nov 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant