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

Generated WASM file not working #268

Open
Vokturz opened this issue Jul 31, 2024 · 5 comments
Open

Generated WASM file not working #268

Vokturz opened this issue Jul 31, 2024 · 5 comments

Comments

@Vokturz
Copy link

Vokturz commented Jul 31, 2024

Hi, I'm trying to use the generated wasm file with web-tree-sitter and the following error appears when trying to parse code:

RuntimeError: null function or function signature mismatch
    at tree-sitter.wasm:0x7960
    at tree-sitter.wasm:0x2a996
    at Parser.parse (web-tree-sitter.js?v=a1488891:676:29)

To make the wasm I'm doing:

  1. npm install --save-dev tree-sitter-cli @derekstride/tree-sitter-sql
  2. npx tree-sitter build --wasm node_modules/@derekstride/tree-sitter-sql

Did I skip any steps? I previously tried with tree-sitter-javascript and everything works perfectly.

@matthias-Q
Copy link
Collaborator

I cannot reproduce this. I did a fresh clone, using node 22 and I can build the wasm file without errors.

Building it with the rust cli also works.

@matthias-Q
Copy link
Collaborator

Can you check again. We had some releases in between, which might have solved this issue.

@duhbbx
Copy link

duhbbx commented Sep 26, 2024

maybe function pointer convert problem

I build tree-sitter, tree-sitter-sql and rust bindings, one build arg is very is import which may involved with this.

-sEMULATE_FUNCTION_POINTER_CASTS=1

@gregnis
Copy link

gregnis commented Oct 14, 2024

Could be the same issue I'm having. I did the same thing I'd done for other grammars:

git clone https://github.com/DerekStride/tree-sitter-sql
cd tree-sitter-sql
..\tree-sitter generate
..\tree-sitter build
..\tree-sitter build --wasm
..\tree-sitter playground

The tree is not generating, What I get in Chrome dev. console is this:

playground.js:324 Uncaught TypeError: Cannot read properties of null (reading 'rootNode')
    at handleCursorMovement (playground.js:324:23)
    at later (playground.js:451:30)
handleCursorMovement @ playground.js:324
later @ playground.js:451
setTimeout
(anonymous) @ playground.js:455
(anonymous) @ codemirror.min.js:1
(anonymous) @ codemirror.min.js:1
Gn @ codemirror.min.js:1
(anonymous) @ codemirror.min.js:1
playground.js:324 Uncaught TypeError: Cannot read properties of null (reading 'rootNode')
    at handleCursorMovement (playground.js:324:23)
    at later (playground.js:451:30)
handleCursorMovement @ playground.js:324
later @ playground.js:451
setTimeout
(anonymous) @ playground.js:455
(anonymous) @ codemirror.min.js:1
(anonymous) @ codemirror.min.js:1
Gn @ codemirror.min.js:1
(anonymous) @ codemirror.min.js:1
playground.js:324 Uncaught TypeError: Cannot read properties of null (reading 'rootNode')
    at handleCursorMovement (playground.js:324:23)
    at later (playground.js:451:30)
handleCursorMovement @ playground.js:324
later @ playground.js:451
setTimeout
(anonymous) @ playground.js:455
(anonymous) @ codemirror.min.js:1
(anonymous) @ codemirror.min.js:1
Gn @ codemirror.min.js:1
(anonymous) @ codemirror.min.js:1
playground.js:371 resume_parsing
playground.js:371 process version:0, version_count:1, state:1, row:0, col:0
playground.js:371 reduce sym:program, child_count:0
playground.js:371 accept
playground.js:371 done
tree-sitter.wasm:0x7960 Uncaught (in promise) RuntimeError: null function or function signature mismatch
    at tree-sitter.wasm:0x7960
    at tree-sitter.wasm:0x2a996
    at Parser.parse (tree-sitter.js:1:49283)
    at handleCodeChange (playground.js:113:28)
    at it (codemirror.min.js:1:17760)
    at jn (codemirror.min.js:1:65062)
    at codemirror.min.js:1:61536
    at codemirror.min.js:1:61545
    at codemirror.min.js:1:61216
    at Gn (codemirror.min.js:1:61222)
$ts_parser_reset @ tree-sitter.wasm:0x7960
$ts_parser_parse_wasm @ tree-sitter.wasm:0x2a996
parse @ tree-sitter.js:1
handleCodeChange @ playground.js:113
it @ codemirror.min.js:1
jn @ codemirror.min.js:1
(anonymous) @ codemirror.min.js:1
(anonymous) @ codemirror.min.js:1
(anonymous) @ codemirror.min.js:1
Gn @ codemirror.min.js:1
Xn @ codemirror.min.js:1
Vl.poll @ codemirror.min.js:1
(anonymous) @ codemirror.min.js:1
playground.js:324 Uncaught TypeError: Cannot read properties of null (reading 'rootNode')
    at handleCursorMovement (playground.js:324:23)
    at later (playground.js:451:30)
handleCursorMovement @ playground.js:324
later @ playground.js:451
setTimeout
(anonymous) @ playground.js:455
(anonymous) @ codemirror.min.js:1
(anonymous) @ codemirror.min.js:1
Gn @ codemirror.min.js:1
Xn @ codemirror.min.js:1
Vl.poll @ codemirror.min.js:1
(anonymous) @ codemirror.min.js:1

@gregnis
Copy link

gregnis commented Oct 14, 2024

BTW, I tried using -sEMULATE_FUNCTION_POINTER_CASTS=1, and it didn't help. In fact, it broke other grammars, so I reset it back.

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

No branches or pull requests

4 participants