From ea186fe2c073dfd56f834068ee928a9c875b0279 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 8 Jan 2018 21:40:00 +0300 Subject: G: inner attributes --- src/parser/event_parser/grammar/expressions.rs | 13 ++++++++++++- src/syntax_kinds.rs | 4 +++- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/parser/event_parser/grammar/expressions.rs b/src/parser/event_parser/grammar/expressions.rs index 9b43bdf2a..a6a1b302b 100644 --- a/src/parser/event_parser/grammar/expressions.rs +++ b/src/parser/event_parser/grammar/expressions.rs @@ -1,5 +1,16 @@ use super::*; pub(super) fn literal(p: &mut Parser) -> bool { - p.eat(INT_NUMBER) || p.eat(FLOAT_NUMBER) + match p.current() { + TRUE_KW | FALSE_KW + | INT_NUMBER | FLOAT_NUMBER + | BYTE | CHAR + |STRING | RAW_STRING | BYTE_STRING | RAW_BYTE_STRING => { + node(p, LITERAL, |p| { + p.bump(); + }); + true + } + _ => false + } } \ No newline at end of file diff --git a/src/syntax_kinds.rs b/src/syntax_kinds.rs index 53ea0775a..b82a4f7f2 100644 --- a/src/syntax_kinds.rs +++ b/src/syntax_kinds.rs @@ -66,8 +66,9 @@ pub const STRUCT_FIELD: SyntaxKind = SyntaxKind(61); pub const FN_ITEM: SyntaxKind = SyntaxKind(62); pub const ATTR: SyntaxKind = SyntaxKind(63); pub const META_ITEM: SyntaxKind = SyntaxKind(64); +pub const LITERAL: SyntaxKind = SyntaxKind(65); -static INFOS: [SyntaxInfo; 65] = [ +static INFOS: [SyntaxInfo; 66] = [ SyntaxInfo { name: "USE_KW" }, SyntaxInfo { name: "FN_KW" }, SyntaxInfo { name: "STRUCT_KW" }, @@ -133,6 +134,7 @@ static INFOS: [SyntaxInfo; 65] = [ SyntaxInfo { name: "FN_ITEM" }, SyntaxInfo { name: "ATTR" }, SyntaxInfo { name: "META_ITEM" }, + SyntaxInfo { name: "LITERAL" }, ]; pub(crate) fn syntax_info(kind: SyntaxKind) -> &'static SyntaxInfo { -- cgit v1.2.3