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

Parsing fails for comment = ’(*’, {comment symbol}, ’*)’; #8

Open
igochkov opened this issue Jul 4, 2023 · 0 comments
Open
Assignees

Comments

@igochkov
Copy link
Owner

igochkov commented Jul 4, 2023

COMMENT is defined in the lexer. As a result, the parser has difficulties parsing it's own grammar, in particularly this line:
comment = ’(*’, {comment symbol}, ’*)’;

Everything between (* and *) is considered a comment by the lexer. Because the lexer has already matched the comment the parser sees only the rest, which is:
comment = ’’;

The solution is to define the comment rule in the parser, and not in the lexer, however it will 'pollute' the grammar with the comment rule everywhere. According the official EBNF grammar, a comment is allowed anywhere outside a <terminal string>, <meta identifier>, <integer> or <special sequence>.

comment = ’(*’, {comment symbol}, ’*)’;
comment symbol = comment | terminal string | special sequence | character;
@igochkov igochkov changed the title Parsing failes for comment = ’(*’, {comment symbol}, ’*)’; Parsing fails for comment = ’(*’, {comment symbol}, ’*)’; Jul 4, 2023
@igochkov igochkov self-assigned this Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant