Add include statement
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -19,6 +19,7 @@ assign = { ":" ~ word }
|
||||
atom = { float | int | assign | word | str | apply }
|
||||
quote = { "[" ~ stmt* ~ "]" }
|
||||
expr = { atom | quote }
|
||||
stmt = { expr }
|
||||
include = { "%include" ~ str }
|
||||
stmt = { include | expr }
|
||||
|
||||
file = { SOI ~ stmt* ~ EOI }
|
||||
@@ -95,6 +95,7 @@ fn parse_stmt(source: &Rc<String>, pair: Pair<Rule>) -> Result<SpStmt> {
|
||||
let pair_span = pair.as_span();
|
||||
let stmt = match pair.as_rule() {
|
||||
Rule::expr => Stmt::Expr(parse_expr(source, pair.into_inner().next().unwrap())?),
|
||||
Rule::include => Stmt::Include(unescape_string(pair.into_inner().next().unwrap().as_str())),
|
||||
rule => unreachable!("{:?}", rule),
|
||||
};
|
||||
let span = Span {
|
||||
|
||||
Reference in New Issue
Block a user