conlang: Add Quote expression as a hack for testing
Possibly removed later, or replaced with something that turns Conlang AST nodes into Conlang data structures.
This commit is contained in:
@@ -900,6 +900,18 @@ impl Parse<'_> for ExprKind {
|
||||
}
|
||||
}
|
||||
|
||||
impl Parse<'_> for Quote {
|
||||
fn parse(p: &mut Parser<'_>) -> PResult<Self> {
|
||||
let quote = delim(
|
||||
ExprKind::parse,
|
||||
(TokenKind::Grave, TokenKind::Grave),
|
||||
Parsing::ExprKind,
|
||||
)(p)?
|
||||
.into();
|
||||
Ok(Quote { quote })
|
||||
}
|
||||
}
|
||||
|
||||
impl Parse<'_> for Let {
|
||||
fn parse(p: &mut Parser) -> PResult<Let> {
|
||||
p.consume_peeked();
|
||||
|
||||
@@ -16,6 +16,7 @@ pub fn exprkind(p: &mut Parser, power: u8) -> PResult<ExprKind> {
|
||||
literal_like!() => Literal::parse(p)?.into(),
|
||||
path_like!() => exprkind_pathlike(p)?,
|
||||
TokenKind::Amp | TokenKind::AmpAmp => AddrOf::parse(p)?.into(),
|
||||
TokenKind::Grave => Quote::parse(p)?.into(),
|
||||
TokenKind::LCurly => Block::parse(p)?.into(),
|
||||
TokenKind::LBrack => exprkind_arraylike(p)?,
|
||||
TokenKind::LParen => exprkind_tuplelike(p)?,
|
||||
|
||||
Reference in New Issue
Block a user