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

Version 0.2 #7

Open
wants to merge 113 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
21a873a
First part of new version guide
frantufro Apr 19, 2023
95fb3c8
Added explanation and examples related to reacting to state with cond…
frantufro Apr 19, 2023
16a95ec
palabritas parser first steps
loomstyla Apr 19, 2023
dede595
Some progress on the guide an examples.
frantufro Apr 20, 2023
6ee1e37
parser update + tests
loomstyla Apr 20, 2023
38b5231
Update palabritas.pest
loomstyla Apr 20, 2023
48fc740
named buckets must be snake_case
loomstyla Apr 21, 2023
2ff5df9
Identation update
loomstyla Apr 21, 2023
6e663d1
Parsing changes and first steps on reading logic
loomstyla May 10, 2023
e6c65d7
palabritas-common
loomstyla May 16, 2023
6433f38
palabritas parser update (WIP)
loomstyla May 18, 2023
7ab5d4b
tests and fixes
loomstyla May 22, 2023
69bee0c
compiler + parser update
loomstyla May 29, 2023
1408021
fmt + clippy
loomstyla May 29, 2023
285d22f
runtime + compiler (#8)
frantufro Jun 9, 2023
e21dd82
Added unique and tags to docs.
frantufro Jun 14, 2023
0f5c18b
Buckets support (#9)
loomstyla Jun 29, 2023
74d8b53
merge fixes
loomstyla Jun 29, 2023
ebcf906
divert fix
loomstyla Jun 29, 2023
f43aa63
Feedback cli + bug fixes
loomstyla Jun 29, 2023
953e5da
Modifier fix
loomstyla Jun 30, 2023
1068a64
set in cli + parser refactoring
loomstyla Jun 30, 2023
d9c5a0e
i18n refactor
loomstyla Jun 30, 2023
b56cbbe
varaible validations
loomstyla Jun 30, 2023
4751106
test fixes
loomstyla Jul 3, 2023
5d6251a
Section existance and invalid operators check
loomstyla Jul 3, 2023
5ced14c
Tests
loomstyla Jul 3, 2023
e7c1b81
Update parser.rs
loomstyla Jul 3, 2023
541263a
Update error.rs
loomstyla Jul 3, 2023
112ee3f
error messages refactor
loomstyla Jul 3, 2023
ff09c6d
runtime errors
loomstyla Jul 3, 2023
676f8b5
tests
loomstyla Jul 3, 2023
be77d9a
more parser errors
loomstyla Jul 4, 2023
8e52ef7
Bumped version of CLI
frantufro Jul 4, 2023
5dce035
set bool fix
loomstyla Jul 4, 2023
1bb6e6f
enum validates value
loomstyla Jul 4, 2023
7502609
compiler divert fixes
loomstyla Jul 4, 2023
8c28c42
Update cuentitos.toml
loomstyla Jul 4, 2023
98f67a0
Parser done, runtime wip
loomstyla Jul 4, 2023
7dd04b9
runtime
loomstyla Jul 5, 2023
61434a9
errors refactor
loomstyla Jul 5, 2023
48b4652
now prints sets in story
loomstyla Jul 5, 2023
edd4e97
? command
loomstyla Jul 5, 2023
3d685ed
subsections are now sections children
loomstyla Jul 6, 2023
8a064cd
runtime fix
loomstyla Jul 6, 2023
698c69d
make a choice error now prints text
loomstyla Jul 6, 2023
398e70d
update section fix
loomstyla Jul 6, 2023
92d89be
divert changes + some refactoring
loomstyla Jul 6, 2023
ecdc428
cli divert command now trims blank spaces
loomstyla Jul 6, 2023
c98df0a
boomerang divert
loomstyla Jul 6, 2023
fb277d7
boomerang divert test
loomstyla Jul 6, 2023
c85afef
print variables ordered
loomstyla Jul 7, 2023
2c80d49
cli changes
loomstyla Jul 7, 2023
78f64d3
errors refactoring + new errors
loomstyla Jul 7, 2023
963997e
Update main.rs
loomstyla Jul 7, 2023
aef940d
commands now support multiple empty lines inbetween
loomstyla Jul 7, 2023
e6e108e
wip
loomstyla Jul 10, 2023
7c54e19
fixes
loomstyla Jul 10, 2023
2a1b424
refactoring
loomstyla Jul 10, 2023
8778bcb
clippy
loomstyla Jul 10, 2023
96622dd
sections can have chances
loomstyla Jul 11, 2023
dbefaa1
cli fix
loomstyla Jul 11, 2023
44315f9
grep + cli refactor
loomstyla Jul 11, 2023
03268a5
empty lines fixes
loomstyla Jul 12, 2023
f6b94cb
Q command + boomerang command + commands test
loomstyla Jul 12, 2023
51cedcc
Errors print fix
loomstyla Jul 12, 2023
5db3642
subsections support indentation
loomstyla Jul 12, 2023
5f107f4
refactor wip
loomstyla Jul 12, 2023
19ae9f8
multiple levels of subsections
loomstyla Jul 12, 2023
b4719e7
fixes
loomstyla Jul 12, 2023
7618330
Update parser.rs
loomstyla Jul 13, 2023
1baafb2
Merge pull request #43 from hiddenpeopleclub/multiple-levels-of-subse…
loomstyla Jul 13, 2023
480d169
Merge pull request #42 from hiddenpeopleclub/cli-refactor-and-grep
loomstyla Jul 13, 2023
e031cc7
Merge pull request #41 from hiddenpeopleclub/runtime-output-refactor
loomstyla Jul 13, 2023
6a4b314
Merge pull request #40 from hiddenpeopleclub/duplicated-section-names…
loomstyla Jul 13, 2023
e9c28d0
Merge pull request #39 from hiddenpeopleclub/history
loomstyla Jul 13, 2023
890d971
Merge pull request #38 from hiddenpeopleclub/divert-changes
loomstyla Jul 13, 2023
fd6dc1b
Merge pull request #37 from hiddenpeopleclub/subsections-fix
loomstyla Jul 13, 2023
6e3358a
Merge pull request #33 from hiddenpeopleclub/full-state-print
loomstyla Jul 13, 2023
2d46796
Merge pull request #36 from hiddenpeopleclub/Feedback-cli-set
loomstyla Jul 13, 2023
972d813
Merge pull request #34 from hiddenpeopleclub/compiler-errors-prints-file
loomstyla Jul 13, 2023
2c8a823
Merge pull request #35 from hiddenpeopleclub/divert-rework
loomstyla Jul 13, 2023
f1777b7
Merge pull request #32 from hiddenpeopleclub/runtime-errors
loomstyla Jul 13, 2023
b46f7a1
Merge pull request #31 from hiddenpeopleclub/new-compiler-errors
loomstyla Jul 13, 2023
23af311
Merge pull request #30 from hiddenpeopleclub/i18n-refactor
loomstyla Jul 13, 2023
6d3057c
Merge pull request #29 from hiddenpeopleclub/set-cli
loomstyla Jul 13, 2023
a87bc89
Merge pull request #28 from hiddenpeopleclub/cli-feedback-and-bug-fixes
loomstyla Jul 13, 2023
cd21e0f
clippy
loomstyla Jul 13, 2023
1adaa91
Fixed divert bug
loomstyla Jul 13, 2023
f12e051
fixed output on choice pick + tests
loomstyla Jul 13, 2023
0efcf29
another divert fix
loomstyla Jul 13, 2023
315fa3e
Merge pull request #44 from hiddenpeopleclub/bug-fixes
loomstyla Jul 14, 2023
5abf0da
divert fixes and END changes
loomstyla Jul 19, 2023
db86ad1
Rustfmt fixes
frantufro Jul 21, 2023
95c2b27
Update palabritas.md
loomstyla Jul 21, 2023
685ca84
Unnamed buckets in sections
loomstyla Jul 21, 2023
4686a2c
Create cli.md
loomstyla Jul 21, 2023
d048c58
Update cli.md
loomstyla Jul 21, 2023
dcec7ca
documentation update
loomstyla Jul 24, 2023
06fd4ed
Update cli.md
loomstyla Jul 24, 2023
aa28c3c
Update cuentitos.toml
loomstyla Jul 24, 2023
834170f
Merge pull request #45 from hiddenpeopleclub/bug-fixes
loomstyla Jul 24, 2023
ede5667
new_compiler_errors
loomstyla Jul 26, 2023
9004e52
Crash fix
loomstyla Sep 6, 2023
0ed80be
buckets fix
loomstyla Oct 2, 2023
6cbd458
skip implementation
loomstyla Oct 2, 2023
715b40f
story_progress_style configuration
loomstyla Oct 5, 2023
007399b
Update cuentitos.toml
loomstyla Oct 5, 2023
d709e10
Merge pull request #46 from hiddenpeopleclub/skip-command
loomstyla Oct 5, 2023
9046002
skip on end fix
loomstyla Oct 6, 2023
b19889c
Update cuentitos.toml
loomstyla Oct 17, 2023
119035d
Revert "Update cuentitos.toml"
loomstyla Oct 17, 2023
83bc279
Update i18n.rs
loomstyla Nov 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ members = [
"compiler",
"runtime",
"runtime-c",
"palabritas-parser",
"cli",
"editor/src-tauri"
]
12 changes: 12 additions & 0 deletions palabritas-parser/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "palabritas-parser"
version = "0.0.0"
frantufro marked this conversation as resolved.
Show resolved Hide resolved
edition = "2021"

[[bin]]
name = "palabritas-parser"
path = "src/main.rs"

[dependencies]
pest = "2.0"
pest_derive = "2.0"
48 changes: 48 additions & 0 deletions palabritas-parser/example.palabritas
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
You've just arrived in the bustling city, full of excitement and anticipation for your new job.
The skyline reaches for the clouds, and the sounds of traffic and people surround you.
As you take your first steps in this urban jungle, you feel a mix of emotions, hoping to find your place in this new environment.
* I take a walk through a nearby park to relax and acclimate to the city.
As you stroll through the nearby park, the soothing sounds of rustling leaves and chirping birds help calm your senses.
You find a quiet bench to sit on, taking a moment to breathe deeply and gather your thoughts.
(50/100) A solitary figure sits on the bench, engrossed in a book, seemingly unfazed by the surrounding city noise.
This serene oasis gives you the confidence to face the challenges ahead as you acclimate to your new life in the bustling city.
* I visit a popular street market to experience the city's unique flavors and energy.
(50) At the bustling street market, you discover a food stand offering mouthwatering delicacies.
As you sample the delicious fare, you strike up a conversation with the enthusiastic vendor.
It's a welcome distraction from the noise around you.
(2) As you try to navigate the crowded market, you're drawn to the entrancing melody of a street musician.
The captivating sound creates a soothing bubble, momentarily transporting you away from the city's noise.
You take a moment to appreciate the beauty of the music, feeling a connection to the artist and the vibrant energy they bring to the urban landscape.
* (50%) I leave two dollars to the artist.
The musician smiles and nods thanking you.
* I nod when the musician looks my way, to show I really enjoy the music.
(500) Wandering the market, you stumble upon a hidden alley adorned with vibrant street art.
Each colorful mural tells a different story, capturing your imagination and sparking your creativity.
* (50%) I grab my phone and take pictures of the murals.
* (50%) I keep walking, even if the murals look good, the darkness of the alley is unsettling.
This unexpected oasis of visual tranquility provides a respite from the chaos of the city, inspiring you to explore more of the urban canvas and the stories it holds.

Feeling mentally and physically exhausted from the day's adventures, you decide it's time to head back to your hotel.
As you enter the peaceful sanctuary of your room, you take a deep breath, relieved to have a quiet space where you can recharge and prepare for the challenges ahead.
The sun shines bright through the window.
req time_of_day !night
The moonlight gives the room a peaceful tone.
req time_of_day night
You start to think about all the stuff you need to do tomorrow.
req time_of_day_night
That makes you feel overwhelmed.
req time_of_day_night
req energy <10
* I make some tea
req item tea
A good cup of tea is always good to regulate after the sensory overload of the city.
* I go to bed
Feeling depleted of spoons, you go right back to bed.
* I call my parents
req energy >10
(30) The phone rings twice, and dad picks up.
req energy>20
(10) The phone rings twice, and mom picks up.
req energy>20
freq time_of_day morning 100
(40) The phone rings ten times, nobody is at home.
81 changes: 81 additions & 0 deletions palabritas-parser/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
extern crate pest;
#[macro_use]
extern crate pest_derive;

use pest::{Parser, iterators::Pair};

#[derive(Parser)]
#[grammar = "palabritas.pest"]
pub struct PalabritasParser;

fn main() {
frantufro marked this conversation as resolved.
Show resolved Hide resolved

let unparsed_file = std::fs::read_to_string("example.palabritas").expect("cannot read file");
let file = PalabritasParser::parse(Rule::file, &unparsed_file)
.expect("unsuccessful parse") // unwrap the parse result
.next().unwrap();

for line in file.into_inner() {
match line.as_rule() {
Rule::text_shown => {
debug_print(line);
}
Rule::option => {
debug_print(line);
}
Rule::EOI => (),
_ => unreachable!(),
}
}
}


fn debug_print(pair: Pair<Rule>)
{
let text_parts = pair.into_inner();
let mut indent_count = 0;
for text_part in text_parts
{
if text_part.as_rule() == Rule::indent
{
indent_count+=1;
} else
if text_part.as_rule() == Rule::one_off
{
println!("one_off: {}",text_part.as_str() );
} else
if text_part.as_rule() == Rule::line
{
let mut line_parts = text_part.into_inner();
println!("(Indent{}){}",indent_count, line_parts.next().unwrap().as_str());
for requirement_or_frequency in line_parts
{
if requirement_or_frequency.as_rule() == Rule::requirement
{
let mut requirement_parts = requirement_or_frequency.into_inner();
requirement_parts.next();
let mut req_str = "req: ".to_string();
while let Some(requirement_part) = requirement_parts.next()
{
req_str = req_str + requirement_part.as_str();
}

println!("{}",req_str);

} else
if requirement_or_frequency.as_rule() == Rule::frequency
{
let mut frequency_parts = requirement_or_frequency.into_inner();
frequency_parts.next();
let mut freq_str = "freq: ".to_string();
while let Some(frequency_part) = frequency_parts.next()
{
freq_str = freq_str + frequency_part.as_str();
}

println!("{}",freq_str);
}
}
}
}
}
16 changes: 16 additions & 0 deletions palabritas-parser/src/palabritas.pest
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
char = { ASCII_ALPHANUMERIC | "." | "_" | "/" | "," | ";" | "'" | " " | "?" | "!" | "¿" | "¡"}

comparisson_operator = { "=" | "!=" | "<" | ">" | "<=" | ">=" }
condition = { ASCII_ALPHANUMERIC+ ~ " "? ~ (comparisson_operator ~ " "? ~ ASCII_ALPHANUMERIC+ | "!" ~ ASCII_ALPHANUMERIC | ASCII_ALPHANUMERIC+) }
indent = { " " | "\t" }

requirement = { NEWLINE ~ indent* ~ "req " ~ condition }
frequency = { NEWLINE ~ indent* ~ "freq " ~ condition ~ " " ~ ASCII_DIGIT+ }
one_off = { "(" ~ ((ASCII_DIGIT+ ~ "%") | ("0." ~ ASCII_DIGIT+) | (ASCII_DIGIT+ ~ "/" ~ ASCII_DIGIT+) | (ASCII_DIGIT+)) ~ ")" ~ " "? }
text = { char+ }
line = { text ~ requirement* ~ frequency? }

option = { indent* ~ "*" ~ " "? ~ one_off? ~ line }
text_shown = { indent* ~ one_off? ~ line }

file = { SOI ~ ((text_shown | option | indent)? ~ NEWLINE)* ~ (text_shown | option | indent+)? ~ EOI }