"Non-exhaustive patterns in case" error while parsing the BNFC file - bnf

I am getting
bnfc: src/LexBNF.x:(80,13)-(86,20): Non-exhaustive patterns in case
error. What does it mean?
It doesn't really say what's wrong my BNF grammar, and I have no idea how to find the error. I tried looking for it for past few days, unsuccessfully.
I checked if every symbol is defined somewhere in the file, I fixed some rules, nothing helped.

I used to have 2.6, and had this same problem. However, on the tool's webpage, it says that some improvements about error messages have been made since earlier versions, so I installed the latest version (2.8), and that gave me a more informative error message. I'd recommend that you do the same.

Could be because you forgot the backslash on the grammar definition.
The link show a similar case: https://groups.google.com/forum/#!topic/proglang-course-2013/guL-rKm4Q_8

Related

Line magic function `%%pycodestyle` not found

I am using pycodestyle_magic as a linter in Jupyter. I am following the instructions at
https://github.com/mattijn/pycodestyle_magic
But I get error with 1-cell checking be it '%%pycodestyle' or '%%flake8'.
1st ERROR
# 1st CELL
%load_ext pycodestyle_magic
# 2nd CELL
%%pycodestyle
a=1
print(a)
2nd ERROR
# 1st CELL
%load_ext pycodestyle_magic
# 2nd CELL
%%flake8
a=1
print(a)
1st ERROR
I'm basing this on your image you posted for '1st error' and not the inaccurate code you posted:
Note that the error in your first error was saying line magic and not cell magic because it was not looking for cell magic anymore. You can see it will look for cell magic on the first line of a cell by putting in %%fake_magic as a first line and then 2 + 2 as a second line of cell. Running that you'll see UsageError: Cell magic %%fake_magic not found.
Hence, your first 'error' is that you are missing that the first line of the cell where you want to use cell magic becomes special. You cannot have something else on the first line where you want to use cell magic, even if it is commented out. In the image, you have #%%flake8 above %%pycodestyle. If you remove that line, it should work.
2nd ERROR
I'm basing this on your image you posted for '2nd ERROR' and not the inaccurate code you posted:
You've stumbled upon a bug currently involving flake8. (Maybe same or more bugs seem to prevent the %%flake8 magic from working at all for now, see comments.)
The solution/workaround is very similar to the '1st ERROR'. Remove the line you were trying to comment out because it being there is causing an issue.
The reasoning appears to be complex about the way the %%flake8 cell magic appears to work behind the scenes so that you cannot have comments in the code content at this time or it won't work. (And the second time it sees that comment symbol, it throws the error you see.) This bug has been reported here.
But the solution/work-around for now is straightforward. Remove the complexity you added, and see if it works.
In case of the %%flake8 magic, running the demo notebook as shown there doesn't work as shown, and so there is indeed a bug in the current version that was introduced by actually a bug in flake8 that the extension uses, see the specific comment here and the link to the underlying issue over at the flake8 repo. (In fact the extent that it doesn't work may be greater than the notebook reflects because as discussed in the comments, even cells without commented lines fail to report any formatting issues. The demo actually doesn't have any without and so I got distracted noting it only didn't show the buffer error for the first one in the demo notebook but since it had a commented line I thought it was still related.)The other way to workaround it at present is to install an older version of flake8 as pointed out here. The solution was merged though and should be available soon, and so just avoiding the triggering code in simple cases like yours is probably easier.
Note about the inaccurate code:
Post code for what gave you the issue, not what you think gave you the issue. Part of why you are asked to provide code as text the way you ran it, it is so those looking into it can run it the same way. Plus they don't have to type and can easily run it as you did. Beyond that, there's more reason behind it: you can try to see if what you observed originally matches what you are seeing now.
If you had run what you posted under the heading '1st ERROR' as the code block text, you would have seen it without the error you showed in your image. Usually you'd then discern the error/difference yourself. In other words, starball's comment was trying to point you to why you should be doing that, and sorted that 1st error out yourself. That would ultimately make your point about the fragile nature of %%flake8 magic have more impact because it isn't diluted by report of an error that isn't really an error. Plus, you may have realized what was necessary to avoid '2nd ERROR' because that code block works without error no matter how many times you run it.
Technical notes:
Anyone wishing to try out pycodestyle_magic with some of this code and the demo notebooks can click here to launch such a session served via the mybinder.org. service with most things necessary already set up. Once the session starts up in the classic Jupyter notebook interface, you need to do some further preparation to use pycodestyle_magic. As detailed here, you can install it with pip install flake8 pycodestyle_magic. So open a new notebook with the Python kernel backing it using New drop down on the upper right side and then choose the Python3 kernel. When it opens, make a cell that has %pip install flake8 pycodestyle_magic and run it. Then put %load_ext pycodestyle_magic as a cell and run that. You can now try the magic with code or pull the demo notebooks over and run those.

RESOLVED - Rcpp is returning an error in Vector.h on MacOS Big Sur

tl;dr on the solution: this error apparently gets flagged on Big Sur using XCode CL tools when you use CharacterVector.push_back() inappropriately. I commented out an offending line, and it promptly stopped throwing the error!
I'm currently working on using Rcpp to write a C++ function for R using Rcpp::sourceCpp("FilePathName"), and it's returning a weird error.
Library/FrameWorks/R.framework/Versions/4.1/Resources/library/Rcpp/include/Rcpp/Vector.h
Line 5: no matching constructor for initialization of 'std::string' (aka 'basic_string')
I've tried running the gamut on updating XCode, gfortran, R, & Rcpp, clearing .R/Environ & .R/MakeVars, and manually editing .R/MakeVars to avoid using clang, but I can't seem to get past this one weird error. I think it has something to do with the update to Big Sur, seeing as that seems to cause some weirdness from time to time.
Any insight as to how best to proceed? For now I'm just trawling through various articles and documentation pieces to find another instance of this error, but so far I've had no luck.
Thanks

How do I get pretty error messages in RStudio?

When working in RStudio (version 0.99.482 and 1.0.136), if I source a file and an error occur I just get the error message without any context. If the file is longer than a few lines of code, that informaiton is largely useless. What I want to know when an error occurs is the following:
What function threw the error? Preferably what function I called from my script, not something burried deep inside a package.
On what line of my file did the error occur?
This seems like a very basic thing for a scripting language to do, but yet I am unable to find an easy solution. Yes, I am aware of the traceback() function, but (a) it is a hassle to call it every time there is an error, and (b) the output is massive and not that helpful.

netbeans showing errors in the end of css code but i cant find where is the error

My Netbeans is showing errors in the end of CSS code, but I cannot find where is the error, may be there will be a missing ending bracket somewhere in the code but how can I find the error line number.
There are 6000 lines in my code, This may be very simple but I cannot find a valid answer for that.
This can be an issue of a missing semicolon. If you have faced this error recently then you can look into recent changes you made in css.
Or you can trace your error from this site
http://csslint.net/

R Quandl Error, No Daily

Quandl("CHRIS/CME_CL1", trim_start=Sys.Date()-15, trim_end=Sys.Date()-10, collapse="daily")
Error in match.arg(collapse) :
'arg' should be one of “”, “weekly”, “monthly”, “quarterly”, “annual”
Any ideas why that wont work? I copied straight from website too..
I'm the maintainer.
Initially when I created the package I saw no need to support daily since by default the data returned is the most granular, which in our case is daily. However I have seen some confusion arising lately and it won't hurt to accept it. I will accept "daily" as a parameter on the next release.
This should work right now
Quandl("CHRIS/CME_CL1", trim_start=Sys.Date()-15, trim_end=Sys.Date()-10)

Resources