Giter Site home page Giter Site logo

pest-parser / site Goto Github PK

View Code? Open in Web Editor NEW
11.0 5.0 12.0 866 KB

This repo contains the source code for https://pest.rs

Home Page: http://pest.rs/

License: Apache License 2.0

HTML 24.43% CSS 31.65% Rust 19.12% TypeScript 24.36% JavaScript 0.44%
parser pest rust wasm webassembly

site's People

Contributors

birkenfeld avatar dragostis avatar drvirgilio avatar huacnlee avatar jamalam360 avatar leodog896 avatar nathanielknight avatar specy avatar svenstaro avatar tomtau avatar yam76 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

site's Issues

playground: rule names only update once you edit the grammar

"Try it now" boxes don't work / have panicked?

Typing in code into the boxes under "Editor" (the "Try it Here!" button) does nothing.

In both FF & Chrome, it seems like some Rust in WASM is panicking:

Finished loading Rust wasm module 'pest_site'
pest-site.wasm:0x569b6 Uncaught RuntimeError: unreachable
    at __rust_start_panic (pest-site.wasm:0x569b6)
    at rust_panic (pest-site.wasm:0x567a6)
    at std::panicking::rust_panic_with_hook::h51f1c855dfa04d94 (pest-site.wasm:0x564bd)
    at std::panicking::continue_panic_fmt::h728aed66c815f8d0 (pest-site.wasm:0x56385)
    at rust_begin_unwind (pest-site.wasm:0x56309)
    at core::panicking::panic_fmt::h59066e1e00f1980f (pest-site.wasm:0x58faa)
    at core::panicking::panic::h2629fd904a66558c (pest-site.wasm:0x58ed2)
    at pest_site::parse_input::h8ebf157918e4c235 (pest-site.wasm:0x86cd)
    at stdweb::webapi::window_or_worker::funcall_adapter::h0353d924de912f2e (pest-site.wasm:0x2e16)
    at Object.Module.STDWEB_PRIVATE.dyncall (pest-site.js:425)

Comparison diagram should be less misleading

There are complaints about the performance comparison diagram used on the pest.rs site.

It should be edited; for example, the bars can be broken at the beginning (example), or it can just start at 0ms instead of 20ms to avoid over-emphasizing the difference. Additionally, special nom version that partially parses data (see the linked article above) should be included.

Code and tracebacks are ill-formatted on deployed site

When I build the project locally the code and traceback examples on the site are properly formatted:

image

On the deployed site, the formatted code is missing line breaks:

image

It looks like the deployed site has a bunch of whitespace removed compared to the output of the build task.

Home page example doesn't work as described

upd: the website Editor should try to pick the semantically top-level rule instead of the first in an alphabetically sorted order, or if it's not possible, at least do this for the example from the homepage

Or maybe the easier option is to just document that the user needs to select the general rule manually

Describe the bug

I was trying out the example from the home page and instead of getting the error mentioned there got a working - alpha: "a"

To Reproduce

  1. add the grammar from the home page
alpha = { 'a'..'z' | 'A'..'Z' }
digit = { '0'..'9' }

ident = { (alpha | digit)+ }

ident_list = _{ !digit ~ ident ~ (" " ~ ident)+ }
          // ^
          // ident_list rule is silent (produces no tokens or error reports)
  1. paste ab *

Expected behavior

Get the error message

thread 'main' panicked at ' --> 1:1
  |
1 | ab *
  |    ^---
  |
  = expected ident', src/main.rs:12

Actual behavior

Happy parsing outcome - alpha: "a"

Additional context

Add Licence

The website seems to be missing a licence file. Is it also under MIT/Apache like the main pest repo?

trying to open pest.rs hangs, consuming 200% CPU in Chromium

I'm trying to open https://pest.rs in Chromium (Version 72.0.3626.7 (Developer Build) built on Debian buster/sid, running on Debian buster/sid (64-bit)). This never succeeds. The tab hangs and consumes 200% CPU according to the Chromium task manager. I cannot acquire a backtrace because it appears that the Chromium debugger cannot interrupt the loop it is stuck in, for some reason.

Separate playground

As discussed in previous pull requests, having the playground as a separate page leaves us open to better playground design decisions. (This should also make it easier to integrate #14 and #19).

Add label support for the online editor

Unless I missed something the online editor does support labels (introduced by version 2.6.1) but does not show them in the result window.
It would be really nice to add support for them as it would help newcomers like me create better grammars without the need to add unneeded rules.

Proposal to upgrade site implementations.

  1. Switch CodeMirror to Monaco Editor.
    Monaco Editor have a better API for code editing, for example diagnostics.
  2. Integration Tailwind CSS for better CSS development and add mobile support.
  3. Add Vite as the front-end build tool.
  4. JavaScript to TypeScript and Use React for build view.
  5. Add a link on top right navigation bar (Before the Book), named Play.

If we agree that, I can do it.

Separate book deployment

(Raising as an issue as this repository doesn't have discussions)

If instead of https://pest.rs/book, the book was located at https://book.pest.rs, we can seperate the build steps from the book and the site separately, allowing the book repo to contain its own CI/CD pipeline rather than relying on site.

unicode characters in input break the share button

put a unicode character in the input and click "Copy share link"

the error log will show:

[Error] InvalidCharacterError: The string contains invalid characters.

btoa (index.bb963137.js:1:19493)
(anonymous function) (index.bb963137.js:1:19493)
(anonymous function) (index.bb963137.js:1:19615)

Pest format bug

Describe the bug
using the editor on pest.rs I found a bug in the formater that creates an invalid schema

To Reproduce
Here is the link to the editor, clicking on format moves the closing } on the number rule into a comment.

https://pest.rs/?g=N4Ig5gTghgtjURALhAdQBIEkAqBRAygAoCCAwrgAQC8FA%2BsBQBQA6IFrFAPuyM8wC4duAOVyoAMplEBKCgF9mAOyUA3KABsArgFMKe-dQoNGAewBGAK20BjflwoJoAT3sBnfhACWisPY877ADMNV11uRU11dVkFRXMrWwM9GgZWYA4APyZ4m35aAAcoTwgKLJYQABpMihzbAqKIaQAqaQB%2BUp4FNljavMLiwwZ3Lx8O1iRqtS1dWMcoFyTBngBtSY0AstYqtiypnWaxkABdDliImDNtEqSUpQNWAFpWdqyKAHo3ildPMGVFPXKAAYhBQAOQARlBADooaCAJygjrEfCkTCYWgAEUwAHEcC0OuUodVkaj0VjcdgWi89B8KIFoLZPCY-npWLhWJxWNpquUANQgx6sNqlElozE4vHvT7aAAe%2BWZ2kUgkUsX8ukWS1YatOSmC6lCGpSPD1oR1igiUQ1mpAFvUZqUw28vit%2BhoABJUrw%2BLwdhRvIorrRHaMsqw%2BGHukp-YHg86DDQAAIMaMQIMeJ20awACwQTXkUfNMfTPkzOZKNCMd30AEJyuGffYw%2BGhUjhABNKvcJv1gndhtdr09gdvAUgMyjwKj5RsAcQUeCEDSTs8Zs81iaYkosXoXAADXFFOAABY5EuVUpKiBvPlNPxkCB0v99KwA%2B4neMjDwUzVLLkP8A5HkKon1ZEAoH%2BOYnA-ZZwShABWCoKDVRDbUQ8FtAeAA2I5gPuEBYwoAB3Tx%2BCzChtFcawoHybQABMKFokxNDMdRdAAR00Ex%2BAojgkBXb0OM8awAGsKDMCATEI-5AhMGUeO9MMVRAOQgA#editor 

Or here is the un-formated input.

WHITESPACE = _{ (" " | "\t" | NEWLINE) }

value       = { (object | array | string | true | false | null) }
object      = { "{" ~ (object_pair ~ ("," ~ object_pair)*)? ~ "}" }
object_pair = { string ~ ":" ~ value }
array       = { "[" ~ value ~ ("," ~ value)* ~ "]" }
number      = {
    "-"? ~  // sign
  ("0" | '1'..'9' ~ ASCII_DIGIT*) ~ ("." ~ ASCII_DIGIT*)? ~  // fraction
  "E"|"e" ~ ("+" | "-")? ~ASCII_DIGIT* // exponent
}
true        = { "true" }
false       = { "false" }
null        = { "null" }

string            = ${ "\"" ~ inner_string ~ "\"" }
inner_string      = @{ inner_string_char* }
inner_string_char =  {
    !("\"" | "\\") ~ ANY
  | "\\" ~ ("\"" | "\\" | "/" | "b" | "f" | "n" | "r" | "t")
  | "\\" ~ ("u" ~ ASCII_HEX_DIGIT{4})
}

Expected behavior
Running format should not change the semantics of the source

Track and/or limit site size

This site is Pest's public face, and currently loads quickly and performs well. In an effort to keep it that way, we should be mindful about how much extra JavaScript, CSS, etc. we ask Pest's users (or prospective users) to download.

"Historical" site sizes can be checked by checking out and building old versions of the site. Alternatively, if we can set up our publishing process to use Releases, we can save each build and see site size trivially.

If we want to set hard limits to the site size, we might consider adopting a tool like bundlesize to catch any unexpectedly large changes in site size.

Make online editor full page

The online editor at pest.rs is a amazing feature for me. It allowed me to:

  • See how easy it is to start creating rules
  • Debug my rules with my content

The request I have is to have a button/page to make it full screen. (I have currently hacked the boxes in firefox to give me more room.). If easy - then maybe make the boxes resizable (often the rules can be made smaller - as I am focusing on a small subset of the whole grammar.
Why:

  • Have less wrapping - makes it easier to see the rules, content to parse more easily.
  • Having more vertical width let's me see more of everything (especially the output usually)

Thank you for Pest - I love it!

Comparison diagram isn't very informative and makes pest look bad.

  • It only lists two competitors, and only one of those is in the parser family. Benchmarks against more of the common parsers like combine and lalrpop would also be useful.

  • Pest is the listed as the slowest solution, with barely any explanation as to how it could be better. Making excuses for why they run faster is a weak argument; highlighting Pest's strengths is a lot better.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.