fixed bugs

This commit is contained in:
2024-07-11 18:02:53 +02:00
parent 84c69df276
commit 9e5079151b
2 changed files with 16 additions and 21 deletions
+3 -3
View File
@@ -9,9 +9,9 @@ pub fn parse(input: String, rule: Rule) {
match WystParser::parse(rule, &input) { match WystParser::parse(rule, &input) {
Ok(parsed) => { Ok(parsed) => {
for pair in parsed { for pair in parsed {
for inner in pair.into_inner() { println!("---------START--------");
println!("{:?}", inner.into_inner()) println!("{:?}", pair);
} println!("---------END--------");
} }
// println!("{:#?}", parsed); // println!("{:#?}", parsed);
} }
+13 -18
View File
@@ -1,6 +1,10 @@
WHITESPACE = _{ " " | "\t" | "\n" } WHITESPACE = _{ " " | "\t" | "\n" }
// [literals] // [literals]
filepath = { ("/" | identifier | "-" | "." )+ }
include = { "#" ~ "include" ~ "\"" ~ filepath ~ "\"" }
include_global = { "#" ~ "include" ~ "<" ~ filepath ~ ">" }
round = { "(" ~ (expr)* ~ ")" } round = { "(" ~ (expr)* ~ ")" }
curly = { "{" ~ (code_expr)* ~ "}" } curly = { "{" ~ (code_expr)* ~ "}" }
escape = { "\\" ~ ANY } escape = { "\\" ~ ANY }
@@ -23,7 +27,7 @@ var_def = { identifier ~ identifier }
var_def_set = { var_def ~ "=" ~ expr ~ semicolon } var_def_set = { var_def ~ "=" ~ expr ~ semicolon }
func_def = { identifier ~ identifier ~ round ~ curly } func_def = { identifier ~ identifier ~ round ~ curly }
expr = {( expr = {
round | round |
curly | curly |
char | char |
@@ -32,27 +36,18 @@ expr = {(
int | int |
bool | bool |
identifier | identifier |
string | string
semicolon }
)+}
code_expr = {( code_expr = {
round |
curly |
char |
var_def_set | var_def_set |
(var_def ~ semicolon) | (var_def ~ semicolon)
hex | }
float |
int |
bool |
// identifier |
string |
semicolon
)+}
top_expr = { top_expr = {
( (
func_def func_def |
include |
include_global
)+ )+
} }