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) {
Ok(parsed) => {
for pair in parsed {
for inner in pair.into_inner() {
println!("{:?}", inner.into_inner())
}
println!("---------START--------");
println!("{:?}", pair);
println!("---------END--------");
}
// println!("{:#?}", parsed);
}
+13 -18
View File
@@ -1,6 +1,10 @@
WHITESPACE = _{ " " | "\t" | "\n" }
// [literals]
filepath = { ("/" | identifier | "-" | "." )+ }
include = { "#" ~ "include" ~ "\"" ~ filepath ~ "\"" }
include_global = { "#" ~ "include" ~ "<" ~ filepath ~ ">" }
round = { "(" ~ (expr)* ~ ")" }
curly = { "{" ~ (code_expr)* ~ "}" }
escape = { "\\" ~ ANY }
@@ -23,7 +27,7 @@ var_def = { identifier ~ identifier }
var_def_set = { var_def ~ "=" ~ expr ~ semicolon }
func_def = { identifier ~ identifier ~ round ~ curly }
expr = {(
expr = {
round |
curly |
char |
@@ -32,27 +36,18 @@ expr = {(
int |
bool |
identifier |
string |
semicolon
)+}
string
}
code_expr = {(
round |
curly |
char |
code_expr = {
var_def_set |
(var_def ~ semicolon) |
hex |
float |
int |
bool |
// identifier |
string |
semicolon
)+}
(var_def ~ semicolon)
}
top_expr = {
(
func_def
func_def |
include |
include_global
)+
}