-
-
Notifications
You must be signed in to change notification settings - Fork 370
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
better error message for program block names which contain typos #2367
Comments
I have the same problem, have you fix it now ? |
The only fix is going to be to the error message. There wasn't a bug in the language for well-formed code.
|
Stanc3 currently says
|
This is one of these errors that's bugged me in the current setup.
Is it possible to say something like
unknown block 'parameter', expected `functions' or 'data' or ...
?
… On Dec 13, 2018, at 8:06 AM, Matthijs Vákár ***@***.***> wrote:
Stanc3 currently says
Syntax error at file "test.stan", line 1, characters 0-9, parsing error:
-------------------------------------------------
1: parameter {
^
2: real x;
3: }
-------------------------------------------------
Expected "functions {" or "data {" or "transformed data {" or "parameters {" or "transformed parameters {" or "model {" or "generated quantities {".
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
It might be possible, but it would take me a while to figure out how to capture part of the input program in Menhir's custom errors. Changes to the parsing error messages which do not requires quoting the user program are easy to implement, however, and might amount to a better investment of our time. Quoting the user program in semantic errors is easy, on the other hand. |
I'm not sure if it counts as the same issue, but I'm also seeing this message when I put the |
Stanc3 outputs the following
Will close, please reopen in the stanc3 repo if this needs to be improved further. |
Summary:
When a Stan program has a model block name which is wrong, e.g.
parameter
instead ofparameters
, the parser error message is misleading:Description:
At the point where the parser encounters a bad model block name, the parse fails. Because all model blocks are optional, an empty file is a legal parse, hence the error message.
Reproducible Steps:
This program will result in the bad error message:
Current Output:
Current error message:
Expected Output:
better error message would list allowed model block names, given model blocks already encountered.
Additional Information:
Current Version:
v2.16.0
The text was updated successfully, but these errors were encountered: