syntrax icon indicating copy to clipboard operation
syntrax copied to clipboard

Fix default matcher for box: match / for box only when it's a prefix for something

Open inponomarev opened this issue 5 years ago • 1 comments

Hi, first of all -- thanks for the great tool! Currently I'm migrating from parcon.railroad to syntrax for my project's documentation (which involves a custom SQL dialect description).

There is an issue #2 -- it's not only me who came across the difficulty to get '/' node to be shown correctly as a simple token.

Let me offer the better solution than it was discussed in the issue. Since '/'-as-a-prefix should work only if something follows it, it seems that 'box' matcher should be fixed to ^/., that is 'beginning of a string, '/', and at least one character more'. Then we save the same behaviour for the '/' prefix, except only for a case when it stands alone -- for which token rule will work.

inponomarev avatar Dec 14 '19 08:12 inponomarev

NB: The syntrax project was reimplemented in Java, jsyntrax is free from the problem I was trying to solve with this PR

inponomarev avatar Apr 10 '21 17:04 inponomarev