fixed bugs
This commit is contained in:
+3
-3
@@ -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
@@ -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
|
||||
)+
|
||||
}
|
||||
Reference in New Issue
Block a user