-
Notifications
You must be signed in to change notification settings - Fork 14
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
parser: handle parser directives #62
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're a hero, thanks for doing this!
bf67f6e
to
dd0fd0b
Compare
One thing I forgot to mention is that this PR does not add functionality to # syntax = `
RUN cmd a \
&& cmd b In order to solve that, I'd need a way to have parameters with defaults in functions I think. What would be the preferred way to do that? |
dd0fd0b
to
f59c275
Compare
- Add handling for parser directives (pragmas) to the parser: `escape`, `index` - Split off tests into separate modules - Version bump to 9.4.0 See also: https://docs.docker.com/engine/reference/builder/#parser-directives fixes: hadolint/hadolint#371 fixes: hadolint#48
f59c275
to
6b92272
Compare
I've changed the pretty printer to be able to determine which escape character to use on the fly from the AST. This may be a breaking change though in the API. I've kept it in a separate commit so I can easily revert it, if breaking the API in this way is not an option. |
@m-ildefons I'm ok with breaking the API, but we need to bump the version to |
9766f45
to
596f22a
Compare
- Add escape character detection logic to the pretty printer - Replace the escape character on demand for printing - Add tests ensuring correct default behaviour - Version bump to 10.0.0 due to API change When pretty printing, look ahead into the AST to be printed to determine which escape character to choose. Then use that character during printing. This is possibly a major breaking change in the API, because `Arguments Text` is no longer an instance of `Pretty`. Instead the pretty printer expects all instructions to be of type `Instruction Text` and not `Instruction args`. This allows the arguments to the instructions to be printed with the correct escape character.
596f22a
to
e872906
Compare
great job! |
escape
,index
See also:
https://docs.docker.com/engine/reference/builder/#parser-directives
fixes: hadolint/hadolint#371
fixes: #48