-
Notifications
You must be signed in to change notification settings - Fork 97
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
fix: thread the mode into the parser #3599
Conversation
cd3c655
to
273833f
Compare
@@ -1,4 +1,26 @@ | |||
(* Viper only tokens and productions *) | |||
%{ |
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.
moved here from parser.mly
I've tested that this PR enables the moc test/viper/invariant.mo
test/viper/invariant.mo:9.10-9.19: syntax error [M0001], unexpected token 'invariant', expected one of token or <phrase> sequence:
system <exp_nest>
return <exp_nest>
invariant <exp_nest>
func <exp_nest>
<nat> : async <exp_nest> whereas beforehand we had [nix-shell:~/workdir/motoko]$ moc test/viper/invariant.mo
test/viper/invariant.mo:9.3-9.71: syntax error [M0181], verification assertions not permitted in normal mode
test/viper/invariant.mo:10.3-10.29: syntax error [M0181], verification assertions not permitted in normal mode
test/viper/invariant.mo:11.3-11.50: syntax error [M0181], verification assertions not permitted in normal mode
test/viper/invariant.mo:14.7-14.29: syntax error [M0181], verification assertions not permitted in normal mode
test/viper/invariant.mo:16.7-16.31: syntax error [M0181], verification assertions not permitted in normal mode which was more verbose. This is just FYI; I don't consider the new behavior problematic. |
@@ -9,7 +9,10 @@ type import = string * string | |||
|
|||
let parse_with mode lexbuf parser = | |||
let tokenizer, _ = Lexer.tokenizer mode lexbuf in | |||
Ok (Parsing.parse 0 (parser lexbuf.Lexing.lex_curr_p) tokenizer lexbuf) | |||
Ok | |||
(Parsing.parse Lexer_lib.mode 0 |
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.
passing an additional argument
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.
LGTM
Turns out I was doing a bunch of things wrong. Now we make the relevant
Lexer_lib.mode
accessible from the parser productions (previously it just accessed a constant thing).This makes
--viper
to select theverification
mode in the parser too (lexer was already fine).