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

Forgetting to specify context-free start-symbols in SDF3 leads to unclear parsing errors #113

Open
molenzwiebel opened this issue Apr 28, 2022 · 1 comment
Labels
C-Bug Category: bug. Not working as expected

Comments

@molenzwiebel
Copy link
Contributor

Summary

If the spoofaxc is configured to use a specific start symbol, but there is no [context-free] start-symbols entry for that symbol in the SDF3, parsing will fail with unclear errors.

What you did

SDF3:

// intentionally commented out:
// context-free start-symbols Module
context-free sorts Module
context-free syntax
  Module.Module =
<module <ModName>

<{Decl "\n\n"}*>>

spoofaxc.cfg:

parser {
  default-start-symbol = sort Module
}

Test file:

module foo

What you expected to happen

Either an error during parsing that the start-symbol does not exist/was not registered as such, or parsing to succeed into Module("foo", []).

What actually happened

Multiple markers at this line
- Syntax error near unexpected character 'm'
- Unexpected end of file
- Analysis failed. Exception: mb.jsglr.common.JsglrParseExceptions$ParseFail: Parsing failed; see error messages Messages of eclipse-resource##/ministratego/test.mstr: ERROR 0-6@1: Syntax error near unexpected character 'm' ERROR 7-10@1: Unexpected end of file 

Context

  • Spoofax version: devenv with spoofax-pie 389964a5
@molenzwiebel molenzwiebel added the C-Bug Category: bug. Not working as expected label Apr 28, 2022
@Gohla
Copy link
Member

Gohla commented May 11, 2022

This could maybe be checked by inspecting the produced ParseTable and checking if it contains the start symbol, if the ParseTable API allows you to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Bug Category: bug. Not working as expected
Projects
None yet
Development

No branches or pull requests

2 participants