Not parser for keywords and a deprecation question #105
Replies: 3 comments
-
Hello,
This sounds like you want to try parsing declarations before assignments rather than trying to specifically exclude declarations from the assignment parser. Something like this: let decl = text::keyword("var")
.then(text::ident())
.then_ignore(just('=').padded());
let assign = ident()
.then(just('=').padded())
.then_ignore(exp);
decl.or(assign) That aside, it seems like you're parsing at the same time as lexing. Although this is viable, it does mean that you're likely to end up with
Any of these should work with Happy to clarify if you still have issues! |
Beta Was this translation helpful? Give feedback.
-
Oh wow, I've somehow managed to miss the keyword function this whole time lol, just also seems to work now though I'm not don't know what I'm doing different then before lol. |
Beta Was this translation helpful? Give feedback.
-
I think I worked out what I was doing wrong with 'just()'
gives a temporary value is dropped error, but removing the borrow makes it work fine. |
Beta Was this translation helpful? Give feedback.
-
Would it be possible to add a not parser so we could do something like:
So we could implement key words for our languages?.
I quickly looked at the filter parser but couldn't see how to make it really work for this.
Also as an aside I've been getting deprecation warnings about 'seq()', but couldn't replace it with 'just()' for strings, how do I do this properly?
Best regards Isaac
Beta Was this translation helpful? Give feedback.
All reactions