Skip to content
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

"Symbol was not declared." on tokens defined with %precedence #5

Closed
DubiousDoggo opened this issue Oct 21, 2020 · 3 comments
Closed
Labels
enhancement New feature or request

Comments

@DubiousDoggo
Copy link

Tokens defined with %precedence are not detected as being declared.
Example:

%precedence token1
%precedence token2
%%
rule1: token1 token2

Gives the error Symbol was not declared. for both tokens, although the code is accepted by bison.

Tested on:
Yash 0.2.5
GNU bison 3.7

@DubiousDoggo
Copy link
Author

After digging though the code a bit I think this could be fixed by adding a case for %precedence here:

case '%left':
case '%right':
case '%nonassoc':
lastNode = { nodeType: NodeType.Precedence, offset: offset, length: -1, end: -1 }
state = ParserState.WaitingPrecedence;
break;

@Sceriffo Sceriffo pinned this issue Oct 21, 2020
@Sceriffo
Copy link
Collaborator

@DubiousDoggo thanks for the issue.

Yes, it seems that we skipped one case. It will be fixed soon in the next version.

@Sceriffo Sceriffo unpinned this issue Oct 21, 2020
@Sceriffo Sceriffo added the enhancement New feature or request label Oct 21, 2020
@babyraging
Copy link
Owner

@DubiousDoggo sorry for the late response.

Indeed, great find, that one line case is all we need.
A new patch will be released soon fixing the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants