wayang-rs icon indicating copy to clipboard operation
wayang-rs copied to clipboard

Create better example

Open lunchboxav opened this issue 3 years ago • 9 comments

We need to have a more thorough example. Some ideas that I can think of:

  1. A single entry point with full introduction of a story
  2. Option to go to 2 different page, that also have a story
  3. Example of action that may go to more than 2 pages

Pls checkout the current example and see what can be expanded

lunchboxav avatar Oct 01 '21 04:10 lunchboxav

Hello, I'm trying to add new examples to cover this issue but I got these error:

warning: `wayang-rs` (bin "wayang-rs") generated 2 warnings
    Finished dev [unoptimized + debuginfo] target(s) in 0.11s
     Running `target/debug/wayang-rs`
thread 'main' panicked at 'Unsuccessful parse: Error { variant: ParsingError { positives: [item], negatives: [] }, 
location: Pos(115), line_col: Pos((4, 89)), path: None, line: "You forked this project. You check the available 
issues to see what can you do to help. There are engine related issues, default presentation issues, and 
documentation issues.␊", continued_line: None }', src/main.rs:114:63
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I'm still at my early journey in learning Rust so I guess I need some time to work on this. But I guess this is a parser related problem? I'll read more about pest and play around with the wyg.pest file to understand the problem better. Any hints to fix this would be appreciated.

Thank you

atmorojo avatar Feb 26 '22 23:02 atmorojo

Hi @atmorojo thank you very much for looking into this project. Yes, you're correct, it's an error related to the parser itself. If you want, you can try pest's playground here https://pest.rs/#editor, copy the wyg.pest as grammar and play with the input, based on one of the examples.

Though, after trying to compile wayang in a new machine, I also found another error happening. Maybe I should also update the grammar file.

Btw, did you manage to run the project on your machine? i.e run cargo run?

lunchboxav avatar Feb 27 '22 03:02 lunchboxav

@atmorojo if you have trouble in running the example, you can check for the line ending format on your IDE. Right now, using LF should fix this. See: https://github.com/lunchboxav/wayang-rs#file-format

lunchboxav avatar Feb 27 '22 03:02 lunchboxav

@lunchboxav I managed to run it before I made my own .wyg files. And it compiled to .html just fine. After I added my .wyg files and got some errors, I tried to move the problematic file to another directory and it compiled some of my .wyg files, just to find another problematic files later.

I guess mine is LF by default since I'm using Linux.

atmorojo avatar Feb 27 '22 06:02 atmorojo

Ah I see. If so, if you want, you can try post your .wyg file here so I can take a look at what's wrong. There could well be cases where I should improve the grammar file.

lunchboxav avatar Feb 27 '22 07:02 lunchboxav

This is one of the problematic files: example_contribute.txt

(renamed the file's extension)

Thank you for patiently dealing with this. I think this project has a huge potential. In my case, I want to make a DnD style educational interactive fiction stories for children.

atmorojo avatar Feb 27 '22 07:02 atmorojo

Ah thank you very much. I will take a look at the file. At a glance it looks like it should be working, but will test it and update you, once I'm back in front of laptop 🙂

lunchboxav avatar Feb 27 '22 08:02 lunchboxav

@atmorojo thank you very much for your example. I founded that I have uncovered case in my parsing grammar. If you're wondering, you can take a look at this https://github.com/lunchboxav/wayang-rs/commit/d2dffb0ef3d89e44c67c7b84369877b5d6433dc1#diff-cda4c2797fb820b674e3d56dc1d5c99d7876b6351508798895f7bf69776b02f3

Now your example works 🙌 Thank you very much for pointing out where the code can be improved.

lunchboxav avatar Feb 27 '22 11:02 lunchboxav

I see now why it didn't work. Now it works perfectly! Thank you!

atmorojo avatar Feb 27 '22 16:02 atmorojo