Skip to content

Commit c6b36b2

Browse files
fix: Add missing ? and ! characters to keyword character set
Keywords now properly support ? and ! characters as required by the specification in docs/ptc-lisp-specification.md:1388. Fixes: Missing keyword-char support for ? and ! in parser
1 parent 41e3bdb commit c6b36b2

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/ptc_runner/lisp/parser.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ defmodule PtcRunner.Lisp.Parser do
9595
# Keywords (no / allowed)
9696
keyword =
9797
ignore(string(":"))
98-
|> ascii_string([?a..?z, ?A..?Z, ?0..?9, ?-, ?_], min: 1)
98+
|> ascii_string([?a..?z, ?A..?Z, ?0..?9, ?-, ?_, ??, ?!], min: 1)
9999
|> reduce({ParserHelpers, :build_keyword, []})
100100

101101
# Symbols (/ allowed for namespacing)

test/ptc_runner/lisp/parser_test.exs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ defmodule PtcRunner.Lisp.ParserTest do
3434
test "keywords" do
3535
assert {:ok, {:keyword, :name}} = Parser.parse(":name")
3636
assert {:ok, {:keyword, :user_id}} = Parser.parse(":user_id")
37+
assert {:ok, {:keyword, :empty?}} = Parser.parse(":empty?")
38+
assert {:ok, {:keyword, :valid!}} = Parser.parse(":valid!")
3739
end
3840
end
3941

0 commit comments

Comments
 (0)