Add "!" syntatic form - a bit like the single quote, but !(a b c) d => !(a b c d). Useful for like !(let a 1) (+ a 3) or w/e. Break out some of the infinate nesting"
This commit is contained in:
@@ -9,6 +9,9 @@ pub Term: Form = {
|
||||
SYM => Form::Symbol(<>.to_owned()),
|
||||
"(" <ListInside?> ")" => <>.unwrap_or(Form::Nil),
|
||||
"'" <Term> => Form::Pair(Rc::new(Form::Symbol("quote".to_owned())), Rc::new(Form::Pair(Rc::new(<>), Rc::new(Form::Nil)))),
|
||||
"!" <h: Term> <t: Term> => {
|
||||
h.append(Rc::new(t)).unwrap()
|
||||
},
|
||||
};
|
||||
ListInside: Form = {
|
||||
<Term> => Form::Pair(Rc::new(<>), Rc::new(Form::Nil)),
|
||||
@@ -20,6 +23,7 @@ match {
|
||||
")",
|
||||
".",
|
||||
"'",
|
||||
"!",
|
||||
r"[0-9]+" => NUM,
|
||||
r"[a-zA-Z+*/_=?%&|^-][\w+*/=_?%&|^-]*" => SYM,
|
||||
r"(;[^\n]*\n)|\s+" => { }
|
||||
|
||||
Reference in New Issue
Block a user