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

SPT tests ignore start symbol #118

Closed
MeAmAnUsername opened this issue Jun 8, 2022 · 1 comment
Closed

SPT tests ignore start symbol #118

MeAmAnUsername opened this issue Jun 8, 2022 · 1 comment
Labels
C-Bug Category: bug. Not working as expected

Comments

@MeAmAnUsername
Copy link

Summary

SPT tests parse from start symbol defined in spoofaxc.cfg > parser > default-start-symbol instead of the start symbol defined in the SPT file.

What you did

Given these files:
start.sdf3:

module start

context-free start-symbols

  Start

lexical start-symbols

  NAT

context-free sorts

  Start
  Exp
  MatchCase

context-free syntax

  Start.Program = Exp

  Exp.Block = [{Exp "\n"}+]

context-free syntax

  Exp.Num = NAT
  Exp.Add = [[Exp] + [Exp]]
  Exp.UnaryMinus = [-[Exp]]
  Exp.BinaryMinus = [[Exp] - [Exp]]

lexical sorts NAT
lexical syntax

  NAT = [0-9]+
  
lexical restrictions

  NAT -/- [0-9]

lexical syntax

  LAYOUT = [\ \n\t\v\f\r]

context-free restrictions

  LAYOUT? -/- [\ \n\t\v\f\r]

nat.spt:

module lexical/nat
language rpgdsl
start symbol NAT

test negative [[ -4 ]] parse fails
test plus [[ 2 + 4 ]] parse fails
test actual [[ 1 + 2 ]] parse to Program(Add(Num("1"), Num("2")))

What you expected to happen

Tests negative and plus succeed, i.e. parsing 2 + 4 as a NAT fails. Test actual should fail.

What actually happened

Tests negative and plus fail, test actual succeeds.

Context

  • Spoofax version: Spoofax-pie 0.19.2
  • Operating system & version: MacOS Mojave, 10.14.6 (18G9323)
  • Java version (if applicable): 11 (bundled with Spoofax)
  • Eclipse version (if applicable): 4.23.0.20220310-1200
  • Gradle version (if applicable): N.A.
@MeAmAnUsername MeAmAnUsername added the C-Bug Category: bug. Not working as expected label Jun 8, 2022
@molenzwiebel
Copy link
Contributor

Duplicate of #48.

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