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

single character literal support for non alpha chars #816

Closed
ikappaki opened this issue Jan 16, 2024 · 0 comments · Fixed by #817
Closed

single character literal support for non alpha chars #816

ikappaki opened this issue Jan 16, 2024 · 0 comments · Fixed by #817

Comments

@ikappaki
Copy link
Contributor

Basilisp does not accept non-alphanumeric character literals

To reproduce

  1. Open up the REPL and try input some non-alphanumeric literals, the reader fails to convert them into strings
basilisp.user=> \$
Traceback (most recent call last):
  ;; ...
basilisp.lang.compiler.exception.CompilerException: unable to resolve symbol '$' in this context {:form $ :phase :analyzing}

basilisp.user=> \]
Traceback (most recent call last):
  File "C:\src\basilisp\src\basilisp\prompt.py", line 94, in _
    list(
  File "C:\src\basilisp\src\basilisp\lang\reader.py", line 1683, in read_str
    yield from read(
  File "C:\src\basilisp\src\basilisp\lang\reader.py", line 1654, in read
    expr = _read_next(ctx)
           ^^^^^^^^^^^^^^^
  File "C:\src\basilisp\src\basilisp\lang\reader.py", line 1590, in _read_next
    raise ctx.syntax_error(f"Unexpected token '{token}'")
basilisp.lang.reader.SyntaxError: Unexpected token ']' (line: 1, col: 2)

contrast this with Clojure

user> \$
\$
user> \]
\]

PR to follow.

chrisrink10 pushed a commit that referenced this issue Jan 20, 2024
Hi,

could you please consider patch to accept any character by the reader as
character literal. It fixes #816.

I've updated the test to include the new cases.

Thanks

Co-authored-by: ikappaki <ikappaki@users.noreply.github.com>
@chrisrink10 chrisrink10 added this to the Release v0.1.0b1 milestone Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants