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

Using the LuaJIT extension syntax for ULL numbers causes a parse error (despite already being supported?) #581

Open
rdw-software opened this issue Jan 20, 2024 · 1 comment
Labels
A-bin Area: selene, the program C-enhancement Category: Feature request or improvement

Comments

@rdw-software
Copy link

This is a follow-up (of sorts) to Kampfkarren/full-moon#255


As I was looking into adopting selene for use with my project, I discovered that it fails to parse the following LuaJIT-supported syntax:

local wgpu = {
	WGPU_ARRAY_LAYER_COUNT_UNDEFINED = 0xffffffffULL,
	WGPU_COPY_STRIDE_UNDEFINED = 0xffffffffULL,
	WGPU_LIMIT_U32_UNDEFINED = 0xffffffffULL,
	WGPU_LIMIT_U64_UNDEFINED = 0xffffffffffffffffULL,
	-- ... rest omitted for brevity
}

Running selene on this with base: lua51 in the config fails with a parser error:

error[parse_error]: unexpected token `{`
  ┌─ Runtime/Bindings/webgpu.lua:3:14
  │
3 │ local wgpu = {
  │              ^ expected expression

I've tried changing the base to lua51+lua52 and just lua52 as well - to no effect. This was using the latest git checkout of selene.


It seems that selene uses a recent version of the parser (according to the cargo file), which should include support for the extension. Is there anything in particular that I need to do in order to enable this feature? The PR mentioned lua52 so that's what I tried. FWIW, StyLua seems to take no issue with the code and it's using the same parser, so I'm a bit confused as to why selene choked on the file :)

@chriscerie
Copy link
Collaborator

Related to #224. A quick workaround would be to fork selene with full-moon's lua52 and build locally.

@chriscerie chriscerie added C-enhancement Category: Feature request or improvement A-bin Area: selene, the program labels Jan 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-bin Area: selene, the program C-enhancement Category: Feature request or improvement
Projects
None yet
Development

No branches or pull requests

2 participants