diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-07-10 13:07:39 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-07-10 13:07:39 +0200 |
| commit | 36b3067c19c8743032a44f888ee48702b88d135b (patch) | |
| tree | 89893f4501109b35bb6498b93bda4f3cc82dba40 /src/parse/mod.rs | |
| parent | 9950627789358b4d46c7fd8ba20d1428aee7bf01 (diff) | |
Eco string 🌱
Diffstat (limited to 'src/parse/mod.rs')
| -rw-r--r-- | src/parse/mod.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/parse/mod.rs b/src/parse/mod.rs index c3d532a7..4c2fd129 100644 --- a/src/parse/mod.rs +++ b/src/parse/mod.rs @@ -15,6 +15,7 @@ pub use tokens::*; use std::rc::Rc; use crate::diag::Pass; +use crate::eco::EcoString; use crate::syntax::*; /// Parse a string of source code. @@ -151,10 +152,10 @@ fn node(p: &mut Parser, at_start: &mut bool) -> Option<Node> { } /// Handle a unicode escape sequence. -fn unicode_escape(p: &mut Parser, token: UnicodeEscapeToken) -> String { +fn unicode_escape(p: &mut Parser, token: UnicodeEscapeToken) -> EcoString { let span = p.peek_span(); let text = if let Some(c) = resolve::resolve_hex(token.sequence) { - c.to_string() + c.into() } else { // Print out the escape sequence verbatim if it is invalid. p.diag(error!(span, "invalid unicode escape sequence")); @@ -774,7 +775,7 @@ fn ident(p: &mut Parser) -> Option<Ident> { if let Some(Token::Ident(string)) = p.peek() { Some(Ident { span: p.eat_span(), - string: string.to_string(), + string: string.into(), }) } else { p.expected("identifier"); |
