travis-ci / travis-conditions

Boolean language for conditional builds, stages, jobs
MIT License
20 stars 4 forks source link

Fix regular expression parsing #12

Closed svenfuchs closed 6 years ago

svenfuchs commented 6 years ago

Should fix https://github.com/travis-ci/travis-conditions/issues/10

The previous logic would fail with multiple regexes as the parsing expression was too greedy. Simply making it ungreedy would then fail regular expressions that have a nested, escaped slash. Introducing a small Scanner class fixes this.

Also adds parse and eval subcommands to the binary travis-conditions (with eval being the only behaviour previously), so we can use it to inspect the resulting AST.