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

Numeric value not allowed is variable assignment #27

Open
chrysaora-achlyos opened this issue Jul 27, 2024 · 1 comment
Open

Numeric value not allowed is variable assignment #27

chrysaora-achlyos opened this issue Jul 27, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@chrysaora-achlyos
Copy link

Describe the bug

var num = 0.9 generates a syntax error. This is different from AppStore Jellycuts

To Reproduce

Steps to reproduce the behavior:

  1. Paste the above code into file oj_dURL_post_2.jelly
  2. compile with command jelly oj_dURL_post_2.jelly --export --out u_oj_dURL_post_2.shortcut
  3. Observe output
Variable 0.9 does not exist. Make sure that you have initialized the variable 0.9 Found 1 errors

Expected behavior

File will similar code compiles in AppStore Jellycuts to "# 0.9" action

Information

  • Device: [MacBook Pro, 14-inch, 2021]
  • OS: [Sonoma 14.5]
  • Jellycuts Version [???, jelly command does not provide method to generate version (/opt/homebrew/bin/jelly)]
  • Jailbroken? [No]

Additional context

fix may be in tree-sitter-jelly

@chrysaora-achlyos chrysaora-achlyos added the bug Something isn't working label Jul 27, 2024
@chrysaora-achlyos
Copy link
Author

chrysaora-achlyos commented Aug 24, 2024

part of the fix is in Sources/Open-Jellycore/Core/Compiler/Core Nodes/Classes/PrimitiveNodes.swift similar to chrysaora-achlyos@d8d68b7

NumberNode init() need self.type = .number

That would fix the problem with var num =0.9 but not with var num = 0
for Integers, the tree-sitter-grammer also needs some rearrangement as in chrysaora-achlyos/tree-sitter-jelly@7e6b32e so strings that are valid numbers are assigned primitive type of number not identifier (With the big NOTE that 0 is a valid shortcuts identifier and semantics are ambiguous Jellycuts/Jellycuts-Issues#144 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant