Skip to content
This repository has been archived by the owner on Mar 8, 2020. It is now read-only.

Parsing fails on valid JS file: extra + parenthesized/parenStart #56

Closed
bzz opened this issue Feb 12, 2019 · 5 comments · Fixed by #57
Closed

Parsing fails on valid JS file: extra + parenthesized/parenStart #56

bzz opened this issue Feb 12, 2019 · 5 comments · Fixed by #57
Assignees
Labels
Milestone

Comments

@bzz
Copy link
Contributor

bzz commented Feb 12, 2019

Discovered though #54 (comment)

Using latest bblfshd v2.11.6/client.v3/javasript driver v2.6.0 parsing of the valid 2.4 mb .js file fails.

Steps to reproduce

wget https://raw.githubusercontent.com/laravel/telescope/6f0a10ec586cfa1a22218b6778bf9c1572b97912/public/app.js
node --check app.js // check JS syntax
go install github.com/bblfsh/client-go/cmd/bblfsh-cli/...
bblfsh-cli ./app.js

Expected

Very long semantic UAST printed in YAML format.

Actual

couldn't parse public/app.js: transform failed: received 15 errors:
	check: key "extra": field was not used: parenthesized
	check: key "extra": field was not used: parenthesized
	check: key "extra": field was not used: parenthesized
	check: key "extra": field was not used: parenthesized
	check: key "extra": field was not used: parenthesized
	check: key "extra": field was not used: parenthesized
	check: key "extra": field was not used: parenthesized
	check: key "extra": field was not used: parenStart
	check: key "extra": field was not used: parenStart
	check: key "extra": field was not used: parenStart
	check: key "extra": field was not used: parenthesized
	check: key "extra": field was not used: parenthesized
	check: key "extra": field was not used: parenthesized
	check: key "extra": field was not used: parenthesized
	check: key "extra": field was not used: parenStart

As noted #54 (comment) actual order of the failing Transformations can vary.

@juanjux
Copy link
Contributor

juanjux commented Feb 13, 2019

Context: this is because SDK 2.14.0 added new checks to the semantic checker for silently dropped fields.

@bzz
Copy link
Contributor Author

bzz commented Feb 22, 2019

npm install @babel/parser
NODE_OPTIONS=--max_old_space_size=12000 ./node_modules/.bin/parser app.js  > app-js.ast

JavaScript: 2.5Mb
Native AST: 357Mb

😱

@creachadair
Copy link
Contributor

npm install @babel/parser
NODE_OPTIONS=--max_old_space_size=12000 ./node_modules/.bin/parser app.js  > app-js.ast

JavaScript: 2.5Mb
Native AST: 357Mb

😱

I'm not too surprised—though this is a more dramatic expansion than usual. Syntactic structure is expensive in general, and very much not linear in file size. 🙃

@bzz
Copy link
Contributor Author

bzz commented Mar 2, 2019

Syntactic structure is expensive in general, and very much not linear in file size. 🙃
Indeed!

Just for the sake of experiment:
JavaScript: 2.5Mb
Native AST in JSON: 357Mb
bblfsh .native in YAML: 504Mb

and so far SDK tests finish with PASS without producing UAST for this AST (only .native) regardless of the test timeout.

bzz added a commit to bzz/javascript-driver that referenced this issue Mar 3, 2019
Parenthisized literals result in this information saved
in 'extra' field.

Signed-off-by: Alexander Bezzubov <bzz@apache.org>
@bzz
Copy link
Contributor Author

bzz commented Mar 5, 2019

This issue though is fixed in #57

@bzz bzz added this to the 2.7.0 release milestone Mar 5, 2019
@bzz bzz closed this as completed in #57 Mar 5, 2019
@bzz bzz changed the title Parsing fails on valid JS file Parsing fails on valid JS file: extra + parenthesized/parenStart Mar 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants