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

Visualizer: Shareable grammars as URL #58

Open
mroeder opened this issue Feb 5, 2016 · 7 comments
Open

Visualizer: Shareable grammars as URL #58

mroeder opened this issue Feb 5, 2016 · 7 comments

Comments

@mroeder
Copy link
Contributor

mroeder commented Feb 5, 2016

It's nice that the visualizer currently remembers the lasted grammar I worked on and the example I used with it (in local storage).
I would love to see a generated URL in the style of:

http://esprima.org/demo/parse.html?code=var%20my%20%3D%20Grammar%3B
(I would rather like to see # instead of ? but that's the general idea)

to share my grammar (and examples) with others and remember multiple grammars in my bookmarks. It's also a neat thing when reporting bugs for Ohm.

@alexwarth
Copy link

+1

@pdubroy
Copy link
Contributor

pdubroy commented Feb 11, 2016

Done. Give it a try and let me know what you think!

@mroeder
Copy link
Contributor Author

mroeder commented Feb 11, 2016

Wow! First report: It completely crashed my (Chrome) browser! All the windows, all tabs (100+). :-/
I guess it doesn’t like grammars that are still in LocalStorage?
...
But it didn't happen the second time I tried. Still, my grammar is in the LocalStorage but nowhere to be seen.

@mroeder
Copy link
Contributor Author

mroeder commented Feb 11, 2016

Oh, btw. I always like a "default grammar" when you came to the visualizer instead of an empty canvas.
Would be nice to get some example when I go straight to: http://cdglabs.org/ohm/visualizer/

@mroeder
Copy link
Contributor Author

mroeder commented Feb 11, 2016

Well, and the encoding for the URL is somewhat verbose. One character - in example or grammar - results in ~4 characters in the URL. Not that pleasant for (real) grammars like ES5, etc.
Maybe that is what crashed my browser: I had a long grammar (SL) in LocalStorage.

@pdubroy
Copy link
Contributor

pdubroy commented Feb 11, 2016

Uh...very weird. I did test with the ES5 grammar and a very large input string, no problems.

And it should be totally ignoring your grammar in localStorage...I decided not to try to load them, because it would just be some code that would be temporary that we'd want to delete later...and I figured it wasn't worth it.

pdubroy referenced this issue in ohmjs/ohm Feb 15, 2016
This reverts the changes made for #58. The feature didn't
seem to work properly in Firefox or Safari, probably due to
the ridiculously long URLs that were generated (the ES5
grammar is ~23k chars long).
@pdubroy pdubroy reopened this Feb 15, 2016
@pdubroy
Copy link
Contributor

pdubroy commented Feb 15, 2016

Re-opening as the previous fix didn't work properly in Firefox and Safari.

Given the length of some "real" grammars (e.g., the ES6 grammar is >23k chars), we will probably need to implement this with a real backend.

@pdubroy pdubroy transferred this issue from ohmjs/ohm Oct 26, 2021
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

3 participants