From 88080c750b9d0794bf60569d965c07e4f3724d0a Mon Sep 17 00:00:00 2001 From: Alek Ratzloff Date: Wed, 12 Jan 2022 22:14:54 -0800 Subject: [PATCH] Rename bang->apply ! syntax item has been referred to as "bang" instead of "apply" in some places, this is fixed Signed-off-by: Alek Ratzloff --- src/syn/lexer.rs | 6 +++--- src/syn/parser.rs | 4 ++-- src/syn/token.rs | 6 +++--- src/vm/machine.rs | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/syn/lexer.rs b/src/syn/lexer.rs index 0401ccc..2bbf29f 100644 --- a/src/syn/lexer.rs +++ b/src/syn/lexer.rs @@ -12,7 +12,7 @@ lazy_static! { | (?P\[) | (?P\]) | (?P:) - | (?P!) + | (?P!) | (?P"([^"\\]|\\["'\\ntrb])*") )"# ) @@ -103,8 +103,8 @@ impl<'t> Lexer<'t> { self.make_token(Token::RQuote) } else if let Some(_) = cap.name("colon") { self.make_token(Token::Colon) - } else if let Some(_) = cap.name("bang") { - self.make_token(Token::Bang) + } else if let Some(_) = cap.name("apply") { + self.make_token(Token::Apply) } else { panic!( "matched lex pattern, but did not catch this capture: {:?}", diff --git a/src/syn/parser.rs b/src/syn/parser.rs index 449ee5f..a9984a9 100644 --- a/src/syn/parser.rs +++ b/src/syn/parser.rs @@ -117,7 +117,7 @@ impl<'t> Parser<'t> { pub fn next_atom(&mut self) -> Result { use Token::*; - let token = self.expect_any_token(&[Assign, Word, Float, Int, Str, Bang])?; + let token = self.expect_any_token(&[Assign, Word, Float, Int, Str, Apply])?; Ok(self.token_to_atom(token)) } @@ -131,7 +131,7 @@ impl<'t> Parser<'t> { Token::Float => Atom::Float(text.parse().unwrap()), Token::Int => Atom::Int(text.parse().unwrap()), Token::Str => Atom::Str(unescape_string(text)), - Token::Bang => Atom::Apply, + Token::Apply => Atom::Apply, _ => panic!("invalid token specified for token_to_atom, it should be an atom"), }; SpAtom::new(span, atom) diff --git a/src/syn/token.rs b/src/syn/token.rs index 086ccb3..1043c7c 100644 --- a/src/syn/token.rs +++ b/src/syn/token.rs @@ -27,8 +27,8 @@ pub enum Token { /// Colon. Colon, - /// Bang (apply). - Bang, + /// Apply. + Apply, } impl Token { @@ -43,7 +43,7 @@ impl Token { LQuote => "quote begin", RQuote => "quote end", Colon => "colon", - Bang => "bang", + Apply => "apply", } } } diff --git a/src/vm/machine.rs b/src/vm/machine.rs index bb243d8..c041f49 100644 --- a/src/vm/machine.rs +++ b/src/vm/machine.rs @@ -34,7 +34,7 @@ pub struct NativeFrame { #[derive(Debug, Clone)] pub struct QuoteFrame { locals: BTreeMap>, - code: Rc>, // TODO - deduplicate this with some kind of shared pointer + code: Rc>, pc: usize, }