Nested parsing: TypeError: Cannot read property 'some' of undefined #1

Closed
opened 2020-12-31 17:42:09 +01:00 by SomaticIT · 9 comments
SomaticIT commented 2020-12-31 17:42:09 +01:00 (Migrated from github.com)

Hi,

Thank you for your work on this project.

I try to experiment building a lezer parser for a language similar to HTML.

When I run the tests, I get this error on mixed tests:

TypeError: Cannot read property 'some' of undefined
      at hasChild (file:///.../lezer-html/node_modules/lezer-tree/dist/tree.es.js:713:26)
      at TreeNode.nextChild (file:///.../lezer-html/node_modules/lezer-tree/dist/tree.es.js:381:61)
      at TreeCursor.enter (file:///.../lezer-html/node_modules/lezer-tree/dist/tree.es.js:563:42)
      at TreeCursor.firstChild (file:///.../lezer-html/node_modules/lezer-tree/dist/tree.es.js:573:32)
      at Tree.iterate (file:///.../lezer-html/node_modules/lezer-tree/dist/tree.es.js:261:23)
      at testTree (file:///.../lezer-html/node_modules/lezer-generator/dist/test.js:125:10)
      at run (file:///.../lezer-html/node_modules/lezer-generator/dist/test.js:190:17)
      at Context.<anonymous> (file:///.../lezer-html/test/test-html.js:26:22)
      at processImmediate (internal/timers.js:461:21)

I can replicate this error on lezer-html when testing mixed.txt using 0.13 deps.
I use node 14.

Do you have the same issue?

Thanks

Hi, Thank you for your work on this project. I try to experiment building a lezer parser for a language similar to HTML. When I run the tests, I get this error on mixed tests: ``` TypeError: Cannot read property 'some' of undefined at hasChild (file:///.../lezer-html/node_modules/lezer-tree/dist/tree.es.js:713:26) at TreeNode.nextChild (file:///.../lezer-html/node_modules/lezer-tree/dist/tree.es.js:381:61) at TreeCursor.enter (file:///.../lezer-html/node_modules/lezer-tree/dist/tree.es.js:563:42) at TreeCursor.firstChild (file:///.../lezer-html/node_modules/lezer-tree/dist/tree.es.js:573:32) at Tree.iterate (file:///.../lezer-html/node_modules/lezer-tree/dist/tree.es.js:261:23) at testTree (file:///.../lezer-html/node_modules/lezer-generator/dist/test.js:125:10) at run (file:///.../lezer-html/node_modules/lezer-generator/dist/test.js:190:17) at Context.<anonymous> (file:///.../lezer-html/test/test-html.js:26:22) at processImmediate (internal/timers.js:461:21) ``` I can replicate this error on `lezer-html` when testing `mixed.txt` using `0.13` deps. I use node 14. Do you have the same issue? Thanks
marijnh commented 2021-01-04 16:43:02 +01:00 (Migrated from github.com)

The tests in the lezer-html repository run fine for me, also on a fresh checkout. Could you say a bit more about what you are doing?

The tests in the lezer-html repository run fine for me, also on a fresh checkout. Could you say a bit more about what you are doing?
poacher2k commented 2023-02-17 11:20:30 +01:00 (Migrated from github.com)

I'm experiencing a similar issue, which occurs when attempting to write anything inside a script block. Not sure if they're related, but based on the stack trace it looks very similar:

"@codemirror/basic-setup": "^0.20.0",
"@codemirror/lang-html": "^6.4.2",
"@codemirror/state": "^6.2.0",
"@codemirror/theme-one-dark": "^6.1.0",
"@codemirror/view": "^6.9.0",

image

image

I'm experiencing a similar issue, which occurs when attempting to write anything inside a `script` block. Not sure if they're related, but based on the stack trace it looks very similar: ``` "@codemirror/basic-setup": "^0.20.0", "@codemirror/lang-html": "^6.4.2", "@codemirror/state": "^6.2.0", "@codemirror/theme-one-dark": "^6.1.0", "@codemirror/view": "^6.9.0", ``` ![image](https://user-images.githubusercontent.com/2255960/219617507-a7bdf5af-538d-4d2a-96e2-5bd92afb9025.png) ![image](https://user-images.githubusercontent.com/2255960/219617322-6602500f-f13b-4ab5-9035-790d9d13aa39.png)
poacher2k commented 2023-02-17 11:24:12 +01:00 (Migrated from github.com)
Maybe related to https://github.com/codemirror/dev/issues/1064 ?
marijnh commented 2023-02-17 12:56:53 +01:00 (Migrated from github.com)

"@codemirror/basic-setup": "^0.20.0",

This package is deprecated. Use the package named "codemirror" instead.

> "@codemirror/basic-setup": "^0.20.0", This package is deprecated. Use the package named ["codemirror"](https://www.npmjs.com/package/codemirror) instead.
poacher2k commented 2023-02-17 13:18:50 +01:00 (Migrated from github.com)

"@codemirror/basic-setup": "^0.20.0",

This package is deprecated. Use the package named "codemirror" instead.

Yes, apologies. It's not used in the project (just forgot to remove the package) - I'm using the latest (^6.0.1) of codemirror.

> > "@codemirror/basic-setup": "^0.20.0", > > This package is deprecated. Use the package named ["codemirror"](https://www.npmjs.com/package/codemirror) instead. Yes, apologies. It's not used in the project (just forgot to remove the package) - I'm using the latest (`^6.0.1`) of `codemirror`.
marijnh commented 2023-02-17 13:21:45 +01:00 (Migrated from github.com)

I can't seem to reproduce what you are describing.

I can't seem to [reproduce](https://codemirror.net/try/?c=aW1wb3J0IHtiYXNpY1NldHVwLCBFZGl0b3JWaWV3fSBmcm9tICJjb2RlbWlycm9yIgppbXBvcnQge2h0bWx9IGZyb20gIkBjb2RlbWlycm9yL2xhbmctaHRtbCIKCm5ldyBFZGl0b3JWaWV3KHsKICBkb2M6ICI8c2NyaXB0PlxuXG48L3NjcmlwdD4iLAogIGV4dGVuc2lvbnM6IFtiYXNpY1NldHVwLCBodG1sKCldLAogIHBhcmVudDogZG9jdW1lbnQuYm9keQp9KQo=) what you are describing.
poacher2k commented 2023-02-17 13:39:50 +01:00 (Migrated from github.com)

Same, maybe this has something to do with react. Strange that it's almost the exact same error though.

Same, maybe this has something to do with react. Strange that it's almost the exact same error though.
poacher2k commented 2023-02-17 14:26:19 +01:00 (Migrated from github.com)

It's very strange, can't seem to replicate it on CodeSandbox either, using the exact same packages I use locally.

https://codesandbox.io/p/sandbox/rodemirror-forked-vdgcvj?file=%2Fpages%2Findex.tsx&selection=%5B%7B%22endColumn%22%3A42%2C%22endLineNumber%22%3A10%2C%22startColumn%22%3A42%2C%22startLineNumber%22%3A10%7D%5D

Locally, I don't even get any syntax highlighting. No clue what's going on - sorry for bumping this issue!
image
image

It's very strange, can't seem to replicate it on CodeSandbox either, using the exact same packages I use locally. https://codesandbox.io/p/sandbox/rodemirror-forked-vdgcvj?file=%2Fpages%2Findex.tsx&selection=%5B%7B%22endColumn%22%3A42%2C%22endLineNumber%22%3A10%2C%22startColumn%22%3A42%2C%22startLineNumber%22%3A10%7D%5D Locally, I don't even get any syntax highlighting. No clue what's going on - sorry for bumping this issue! <img width="386" alt="image" src="https://user-images.githubusercontent.com/2255960/219664595-783b4b68-f9fd-41e1-9f64-1f05a331ffd1.png"> <img width="524" alt="image" src="https://user-images.githubusercontent.com/2255960/219664703-377e6dd3-c237-421f-82e9-aed7377aea5d.png">
poacher2k commented 2023-02-17 14:29:27 +01:00 (Migrated from github.com)

Solved by npm uninstalling all related packages and reinstalling them fresh. Thank you for your patience, hope you have a good weekend :)

image
Solved by `npm uninstall`ing all related packages and reinstalling them fresh. Thank you for your patience, hope you have a good weekend :) <img width="519" alt="image" src="https://user-images.githubusercontent.com/2255960/219665310-04be9b0e-5562-4b28-9ce9-785818c489e7.png">
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lezer/html#1
No description provided.