Add raw idents to lexer and parser

This commit is contained in:
Josh Robson Chase
2019-01-23 12:15:47 -05:00
parent 0b942cbcb0
commit 1cd6d6539a
26 changed files with 124 additions and 40 deletions

View File

@@ -142,7 +142,7 @@ impl Attr {
pub fn as_atom(&self) -> Option<SmolStr> {
let tt = self.value()?;
let (_bra, attr, _ket) = tt.syntax().children().collect_tuple()?;
if attr.kind() == IDENT {
if attr.kind().is_ident() {
Some(attr.leaf_text().unwrap().clone())
} else {
None
@@ -153,7 +153,7 @@ impl Attr {
let tt = self.value()?;
let (_bra, attr, args, _ket) = tt.syntax().children().collect_tuple()?;
let args = TokenTree::cast(args)?;
if attr.kind() == IDENT {
if attr.kind().is_ident() {
Some((attr.leaf_text().unwrap().clone(), args))
} else {
None