Lexer: angle brackets

This commit is contained in:
Aleksey Kladov 2017-12-30 20:56:54 +03:00
parent 412948c0e2
commit 492f6e6b1c
5 changed files with 26 additions and 14 deletions

View file

@ -18,6 +18,8 @@ Grammar(
"R_CURLY",
"L_BRACK",
"R_BRACK",
"L_ANGLE",
"R_ANGLE",
"AT",
"POUND",
"TILDE",

View file

@ -47,6 +47,8 @@ fn next_token_inner(c: char, ptr: &mut Ptr) -> SyntaxKind {
'}' => return R_CURLY,
'[' => return L_BRACK,
']' => return R_BRACK,
'<' => return L_ANGLE,
'>' => return R_ANGLE,
'@' => return AT,
'#' => return POUND,
'~' => return TILDE,

View file

@ -19,20 +19,22 @@ pub const L_CURLY: SyntaxKind = SyntaxKind(14);
pub const R_CURLY: SyntaxKind = SyntaxKind(15);
pub const L_BRACK: SyntaxKind = SyntaxKind(16);
pub const R_BRACK: SyntaxKind = SyntaxKind(17);
pub const AT: SyntaxKind = SyntaxKind(18);
pub const POUND: SyntaxKind = SyntaxKind(19);
pub const TILDE: SyntaxKind = SyntaxKind(20);
pub const QUESTION: SyntaxKind = SyntaxKind(21);
pub const COLON: SyntaxKind = SyntaxKind(22);
pub const COLONCOLON: SyntaxKind = SyntaxKind(23);
pub const DOLLAR: SyntaxKind = SyntaxKind(24);
pub const EQ: SyntaxKind = SyntaxKind(25);
pub const EQEQ: SyntaxKind = SyntaxKind(26);
pub const FAT_ARROW: SyntaxKind = SyntaxKind(27);
pub const NEQ: SyntaxKind = SyntaxKind(28);
pub const NOT: SyntaxKind = SyntaxKind(29);
pub const L_ANGLE: SyntaxKind = SyntaxKind(18);
pub const R_ANGLE: SyntaxKind = SyntaxKind(19);
pub const AT: SyntaxKind = SyntaxKind(20);
pub const POUND: SyntaxKind = SyntaxKind(21);
pub const TILDE: SyntaxKind = SyntaxKind(22);
pub const QUESTION: SyntaxKind = SyntaxKind(23);
pub const COLON: SyntaxKind = SyntaxKind(24);
pub const COLONCOLON: SyntaxKind = SyntaxKind(25);
pub const DOLLAR: SyntaxKind = SyntaxKind(26);
pub const EQ: SyntaxKind = SyntaxKind(27);
pub const EQEQ: SyntaxKind = SyntaxKind(28);
pub const FAT_ARROW: SyntaxKind = SyntaxKind(29);
pub const NEQ: SyntaxKind = SyntaxKind(30);
pub const NOT: SyntaxKind = SyntaxKind(31);
static INFOS: [SyntaxInfo; 30] = [
static INFOS: [SyntaxInfo; 32] = [
SyntaxInfo { name: "ERROR" },
SyntaxInfo { name: "IDENT" },
SyntaxInfo { name: "UNDERSCORE" },
@ -51,6 +53,8 @@ static INFOS: [SyntaxInfo; 30] = [
SyntaxInfo { name: "R_CURLY" },
SyntaxInfo { name: "L_BRACK" },
SyntaxInfo { name: "R_BRACK" },
SyntaxInfo { name: "L_ANGLE" },
SyntaxInfo { name: "R_ANGLE" },
SyntaxInfo { name: "AT" },
SyntaxInfo { name: "POUND" },
SyntaxInfo { name: "TILDE" },

View file

@ -1,4 +1,4 @@
; , ( ) { } [ ] @ # ~ ? $
; , ( ) { } [ ] < > @ # ~ ? $
. .. ... ..=
: ::
= =>

View file

@ -14,6 +14,10 @@ L_BRACK 1 "["
WHITESPACE 1 " "
R_BRACK 1 "]"
WHITESPACE 1 " "
L_ANGLE 1 "<"
WHITESPACE 1 " "
R_ANGLE 1 ">"
WHITESPACE 1 " "
AT 1 "@"
WHITESPACE 1 " "
POUND 1 "#"