Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/lang/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,8 @@ static ray_t* parse_symbol(ray_parser_t *p) {
}

/* Regular symbol */
while (PA(*p->pos) == PA_ALPHA || PA(*p->pos) == PA_DIGIT || *p->pos == '_' || *p->pos == '.')
while (PA(*p->pos) == PA_ALPHA || PA(*p->pos) == PA_DIGIT
|| *p->pos == '_' || *p->pos == '.' || *p->pos == '-')
p->pos++;
size_t len = (size_t)(p->pos - start);
int64_t id = (len == 0) ? 0 : ray_sym_intern(start, len); /* empty symbol — sym 0 */
Expand Down
1 change: 0 additions & 1 deletion test/rfl/cmp/gt.rfl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
(> ['b 'b 'b] ['a 'b 'c]) -- [true false false]

;; mixed inline (≤ 12 bytes) and pooled (> 12 bytes) — exercises SSO.
;; Note: hyphens in symbols would be parsed as ops, so use underscore.
;; 's' > 'l' so 'short > 'longer_…
(> 'short 'longer_than_twelve_bytes_symbol) -- true
(> 'longer_than_twelve_bytes_symbol 'short) -- false
Expand Down
3 changes: 3 additions & 0 deletions test/rfl/lang/parse_branch_cov.rfl
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@
;; dotted / underscored symbol chars (parse_symbol loop :456)
(as 'STR 'a.b.c) -- "a.b.c"
(as 'STR 'a_b) -- "a_b"
;; hyphenated quoted symbol chars match the documented symbol syntax
(as 'STR 'a-b) -- "a-b"
(== 'a-b 'a-b) -- true
;; empty symbol before a closing bracket / brace / paren
;; (parse_symbol terminator guard :408-409)
(count (list ')) -- 1
Expand Down
Loading