reimplement C string literals
This commit is contained in:
parent
cec34a43b1
commit
df9bd80d74
10 changed files with 48 additions and 89 deletions
|
@ -24,6 +24,10 @@ impl<'a> Cursor<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn as_str(&self) -> &'a str {
|
||||
self.chars.as_str()
|
||||
}
|
||||
|
||||
/// Returns the last eaten symbol (or `'\0'` in release builds).
|
||||
/// (For debug assertions only.)
|
||||
pub(crate) fn prev(&self) -> char {
|
||||
|
|
|
@ -367,6 +367,13 @@ impl Cursor<'_> {
|
|||
Some(|terminated| Byte { terminated }),
|
||||
),
|
||||
|
||||
// c-string literal, raw c-string literal or identifier.
|
||||
'c' => self.c_or_byte_string(
|
||||
|terminated| CStr { terminated },
|
||||
|n_hashes| RawCStr { n_hashes },
|
||||
None,
|
||||
),
|
||||
|
||||
// Identifier (this should be checked after other variant that can
|
||||
// start as identifier).
|
||||
c if is_id_start(c) => self.ident_or_unknown_prefix(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue