Skip to content

Fix minor parser errors#8

Merged
Bogdanp merged 5 commits into
Bogdanp:masterfrom
mxork:fix-parser-minors
Jul 18, 2026
Merged

Fix minor parser errors#8
Bogdanp merged 5 commits into
Bogdanp:masterfrom
mxork:fix-parser-minors

Conversation

@mxork

@mxork mxork commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

I was messing around and found a couple minor bugs in the parser.

  1. Failure on reading a numeric like 1.
  2. Failure on parsing a return statement without any return values
  3. No srcloc reporting if current-source-name is false

Test program:

#lang racket

(require lua/lang/parser
               lua/lang/lexer)

(parse-chunk (make-lexer (open-input-string "return 1.")))
(parse-chunk (make-lexer (open-input-string "return")))

My changes are a little tasteless, but I think they're sound. The digit change is covered by lua:read-number. parse-exprs* parses zero or more expressions via copy-pasta.

@mxork

mxork commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

I'm not planning on fixing this, but hex numbers with decimal points fail to parse. They do in lua:

Lua 5.4.8  Copyright (C) 1994-2025 Lua.org, PUC-Rio
> 0x.1
0.0625

@Bogdanp
Bogdanp merged commit fdef675 into Bogdanp:master Jul 18, 2026
1 check passed
@Bogdanp

Bogdanp commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Thanks!

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 this pull request may close these issues.

2 participants