Skip to content

Commit

Permalink
improve parser grammar
Browse files Browse the repository at this point in the history
Signed-off-by: Adityo Pratomo <pratomo.adityo@gmail.com>
  • Loading branch information
lunchboxav committed Feb 27, 2022
1 parent 66c4ad1 commit d2dffb0
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 6 deletions.
4 changes: 2 additions & 2 deletions result/scene 1.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
</div>
<div class="choice">
<div class="choiceContent">
<a href="scene 2.html">Go to left.</a>
<a href="scene 3.html">Go to right.</a>
<a href="scene 2.html">Go to left. </a>
<a href="scene 3.html">Go to right. </a>
</div>
</div>
</body>
Expand Down
4 changes: 2 additions & 2 deletions result/scene 2.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
</div>
<div class="choice">
<div class="choiceContent">
<a href="scene 2.html">Go to left.</a>
<a href="scene 3.html">Go to right.</a>
<a href="scene 2.html">Go to left. </a>
<a href="scene 3.html">Go to right. </a>
</div>
</div>
</body>
Expand Down
24 changes: 24 additions & 0 deletions result/scene contribute.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<html>
<head>
<title>scene contribute</title>
</head>
<body>
<div class="scene">
<div class="sceneContent">
You forked this project. You check the available issues to see what you can do to help. There are engine related issues, default presentation issues, and documentation issues.
</div>
</div>
<div class="event">
<div class="eventContent">
You opened your text editor.
</div>
</div>
<div class="choice">
<div class="choiceContent">
<a href="scene engine.html">Hone your Rust programming skill. </a>
<a href="scene presentation.html">Hone your HTML and CSS skill. </a>
<a href="scene documentation.html">Hone your technical writing skill. </a>
</div>
</div>
</body>
</html>
6 changes: 4 additions & 2 deletions src/wyg.pest
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ char = {
}

word = _{(LETTER | NUMBER)+}
sentence = _{word ~ ","? ~ (SPACE_SEPARATOR ~ word)* ~ ("." | "?" | "!")}
paragraph = _{sentence ~ (" " ~ sentence)* }
sentence = _{(word ~ (",")* ~ SPACE_SEPARATOR)+ ~ word ~ ("." | "?" | "!") ~ SPACE_SEPARATOR?}
paragraph = _{(sentence)+ }
// sentence = _{word ~ (SPACE_SEPARATOR ~ word)* ~ "," ? ~ (SPACE_SEPARATOR ~ word)* ~ ("." | "?" | "!")}
// paragraph = _{sentence ~ (" " ~ sentence)* }

title = { word }
item = @{ paragraph }
Expand Down
12 changes: 12 additions & 0 deletions story/test_3.wyg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[scene contribute]

Scene:
You forked this project. You check the available issues to see what you can do to help. There are engine related issues, default presentation issues, and documentation issues.

Event:
You opened your text editor.

Choice:
- Hone your Rust programming skill. -> [scene engine]
- Hone your HTML and CSS skill. -> [scene presentation]
- Hone your technical writing skill. -> [scene documentation]

0 comments on commit d2dffb0

Please sign in to comment.