2017-12-28 16:21:54 -06:00
|
|
|
// Generated from grammar.ron
|
2017-12-28 15:56:36 -06:00
|
|
|
use tree::{SyntaxKind, SyntaxInfo};
|
|
|
|
|
2018-01-01 09:58:46 -06:00
|
|
|
pub const USE_KW: SyntaxKind = SyntaxKind(0);
|
|
|
|
pub const FN_KW: SyntaxKind = SyntaxKind(1);
|
|
|
|
pub const STRUCT_KW: SyntaxKind = SyntaxKind(2);
|
|
|
|
pub const ENUM_KW: SyntaxKind = SyntaxKind(3);
|
|
|
|
pub const TRAIT_KW: SyntaxKind = SyntaxKind(4);
|
|
|
|
pub const IMPL_KW: SyntaxKind = SyntaxKind(5);
|
2018-01-08 12:21:59 -06:00
|
|
|
pub const TRUE_KW: SyntaxKind = SyntaxKind(6);
|
|
|
|
pub const FALSE_KW: SyntaxKind = SyntaxKind(7);
|
2018-01-08 15:06:42 -06:00
|
|
|
pub const AS_KW: SyntaxKind = SyntaxKind(8);
|
|
|
|
pub const EXTERN_KW: SyntaxKind = SyntaxKind(9);
|
|
|
|
pub const CRATE_KW: SyntaxKind = SyntaxKind(10);
|
2018-01-09 13:35:55 -06:00
|
|
|
pub const MOD_KW: SyntaxKind = SyntaxKind(11);
|
2018-01-12 13:05:46 -06:00
|
|
|
pub const PUB_KW: SyntaxKind = SyntaxKind(12);
|
|
|
|
pub const SELF_KW: SyntaxKind = SyntaxKind(13);
|
|
|
|
pub const SUPER_KW: SyntaxKind = SyntaxKind(14);
|
2018-01-13 02:55:03 -06:00
|
|
|
pub const IN_KW: SyntaxKind = SyntaxKind(15);
|
2018-01-13 13:00:26 -06:00
|
|
|
pub const WHERE_KW: SyntaxKind = SyntaxKind(16);
|
|
|
|
pub const ERROR: SyntaxKind = SyntaxKind(17);
|
|
|
|
pub const IDENT: SyntaxKind = SyntaxKind(18);
|
|
|
|
pub const UNDERSCORE: SyntaxKind = SyntaxKind(19);
|
|
|
|
pub const WHITESPACE: SyntaxKind = SyntaxKind(20);
|
|
|
|
pub const INT_NUMBER: SyntaxKind = SyntaxKind(21);
|
|
|
|
pub const FLOAT_NUMBER: SyntaxKind = SyntaxKind(22);
|
|
|
|
pub const SEMI: SyntaxKind = SyntaxKind(23);
|
|
|
|
pub const COMMA: SyntaxKind = SyntaxKind(24);
|
|
|
|
pub const DOT: SyntaxKind = SyntaxKind(25);
|
|
|
|
pub const DOTDOT: SyntaxKind = SyntaxKind(26);
|
|
|
|
pub const DOTDOTDOT: SyntaxKind = SyntaxKind(27);
|
|
|
|
pub const DOTDOTEQ: SyntaxKind = SyntaxKind(28);
|
|
|
|
pub const L_PAREN: SyntaxKind = SyntaxKind(29);
|
|
|
|
pub const R_PAREN: SyntaxKind = SyntaxKind(30);
|
|
|
|
pub const L_CURLY: SyntaxKind = SyntaxKind(31);
|
|
|
|
pub const R_CURLY: SyntaxKind = SyntaxKind(32);
|
|
|
|
pub const L_BRACK: SyntaxKind = SyntaxKind(33);
|
|
|
|
pub const R_BRACK: SyntaxKind = SyntaxKind(34);
|
|
|
|
pub const L_ANGLE: SyntaxKind = SyntaxKind(35);
|
|
|
|
pub const R_ANGLE: SyntaxKind = SyntaxKind(36);
|
|
|
|
pub const AT: SyntaxKind = SyntaxKind(37);
|
|
|
|
pub const POUND: SyntaxKind = SyntaxKind(38);
|
|
|
|
pub const TILDE: SyntaxKind = SyntaxKind(39);
|
|
|
|
pub const QUESTION: SyntaxKind = SyntaxKind(40);
|
|
|
|
pub const COLON: SyntaxKind = SyntaxKind(41);
|
|
|
|
pub const COLONCOLON: SyntaxKind = SyntaxKind(42);
|
|
|
|
pub const DOLLAR: SyntaxKind = SyntaxKind(43);
|
|
|
|
pub const EQ: SyntaxKind = SyntaxKind(44);
|
|
|
|
pub const EQEQ: SyntaxKind = SyntaxKind(45);
|
|
|
|
pub const FAT_ARROW: SyntaxKind = SyntaxKind(46);
|
|
|
|
pub const NEQ: SyntaxKind = SyntaxKind(47);
|
|
|
|
pub const EXCL: SyntaxKind = SyntaxKind(48);
|
|
|
|
pub const LIFETIME: SyntaxKind = SyntaxKind(49);
|
|
|
|
pub const CHAR: SyntaxKind = SyntaxKind(50);
|
|
|
|
pub const BYTE: SyntaxKind = SyntaxKind(51);
|
|
|
|
pub const STRING: SyntaxKind = SyntaxKind(52);
|
|
|
|
pub const RAW_STRING: SyntaxKind = SyntaxKind(53);
|
|
|
|
pub const BYTE_STRING: SyntaxKind = SyntaxKind(54);
|
|
|
|
pub const RAW_BYTE_STRING: SyntaxKind = SyntaxKind(55);
|
|
|
|
pub const PLUS: SyntaxKind = SyntaxKind(56);
|
|
|
|
pub const MINUS: SyntaxKind = SyntaxKind(57);
|
|
|
|
pub const STAR: SyntaxKind = SyntaxKind(58);
|
|
|
|
pub const SLASH: SyntaxKind = SyntaxKind(59);
|
|
|
|
pub const CARET: SyntaxKind = SyntaxKind(60);
|
|
|
|
pub const PERCENT: SyntaxKind = SyntaxKind(61);
|
|
|
|
pub const AMPERSAND: SyntaxKind = SyntaxKind(62);
|
|
|
|
pub const PIPE: SyntaxKind = SyntaxKind(63);
|
|
|
|
pub const THIN_ARROW: SyntaxKind = SyntaxKind(64);
|
|
|
|
pub const COMMENT: SyntaxKind = SyntaxKind(65);
|
|
|
|
pub const DOC_COMMENT: SyntaxKind = SyntaxKind(66);
|
|
|
|
pub const SHEBANG: SyntaxKind = SyntaxKind(67);
|
|
|
|
pub const FILE: SyntaxKind = SyntaxKind(68);
|
|
|
|
pub const STRUCT_ITEM: SyntaxKind = SyntaxKind(69);
|
|
|
|
pub const NAMED_FIELD: SyntaxKind = SyntaxKind(70);
|
|
|
|
pub const POS_FIELD: SyntaxKind = SyntaxKind(71);
|
|
|
|
pub const FN_ITEM: SyntaxKind = SyntaxKind(72);
|
|
|
|
pub const EXTERN_CRATE_ITEM: SyntaxKind = SyntaxKind(73);
|
|
|
|
pub const ATTR: SyntaxKind = SyntaxKind(74);
|
|
|
|
pub const META_ITEM: SyntaxKind = SyntaxKind(75);
|
|
|
|
pub const MOD_ITEM: SyntaxKind = SyntaxKind(76);
|
|
|
|
pub const USE_ITEM: SyntaxKind = SyntaxKind(77);
|
|
|
|
pub const USE_TREE: SyntaxKind = SyntaxKind(78);
|
|
|
|
pub const PATH: SyntaxKind = SyntaxKind(79);
|
|
|
|
pub const PATH_SEGMENT: SyntaxKind = SyntaxKind(80);
|
|
|
|
pub const LITERAL: SyntaxKind = SyntaxKind(81);
|
|
|
|
pub const ALIAS: SyntaxKind = SyntaxKind(82);
|
|
|
|
pub const VISIBILITY: SyntaxKind = SyntaxKind(83);
|
2017-12-28 15:56:36 -06:00
|
|
|
|
2018-01-13 13:00:26 -06:00
|
|
|
static INFOS: [SyntaxInfo; 84] = [
|
2018-01-01 09:58:46 -06:00
|
|
|
SyntaxInfo { name: "USE_KW" },
|
|
|
|
SyntaxInfo { name: "FN_KW" },
|
|
|
|
SyntaxInfo { name: "STRUCT_KW" },
|
|
|
|
SyntaxInfo { name: "ENUM_KW" },
|
|
|
|
SyntaxInfo { name: "TRAIT_KW" },
|
|
|
|
SyntaxInfo { name: "IMPL_KW" },
|
2018-01-08 12:21:59 -06:00
|
|
|
SyntaxInfo { name: "TRUE_KW" },
|
|
|
|
SyntaxInfo { name: "FALSE_KW" },
|
2018-01-08 15:06:42 -06:00
|
|
|
SyntaxInfo { name: "AS_KW" },
|
|
|
|
SyntaxInfo { name: "EXTERN_KW" },
|
|
|
|
SyntaxInfo { name: "CRATE_KW" },
|
2018-01-09 13:35:55 -06:00
|
|
|
SyntaxInfo { name: "MOD_KW" },
|
2018-01-12 13:05:46 -06:00
|
|
|
SyntaxInfo { name: "PUB_KW" },
|
|
|
|
SyntaxInfo { name: "SELF_KW" },
|
|
|
|
SyntaxInfo { name: "SUPER_KW" },
|
2018-01-13 02:55:03 -06:00
|
|
|
SyntaxInfo { name: "IN_KW" },
|
2018-01-13 13:00:26 -06:00
|
|
|
SyntaxInfo { name: "WHERE_KW" },
|
2017-12-29 15:48:47 -06:00
|
|
|
SyntaxInfo { name: "ERROR" },
|
2017-12-29 11:47:54 -06:00
|
|
|
SyntaxInfo { name: "IDENT" },
|
2017-12-29 15:48:47 -06:00
|
|
|
SyntaxInfo { name: "UNDERSCORE" },
|
2017-12-29 11:47:54 -06:00
|
|
|
SyntaxInfo { name: "WHITESPACE" },
|
2017-12-30 06:22:40 -06:00
|
|
|
SyntaxInfo { name: "INT_NUMBER" },
|
|
|
|
SyntaxInfo { name: "FLOAT_NUMBER" },
|
2017-12-30 07:30:37 -06:00
|
|
|
SyntaxInfo { name: "SEMI" },
|
|
|
|
SyntaxInfo { name: "COMMA" },
|
|
|
|
SyntaxInfo { name: "DOT" },
|
|
|
|
SyntaxInfo { name: "DOTDOT" },
|
|
|
|
SyntaxInfo { name: "DOTDOTDOT" },
|
|
|
|
SyntaxInfo { name: "DOTDOTEQ" },
|
|
|
|
SyntaxInfo { name: "L_PAREN" },
|
|
|
|
SyntaxInfo { name: "R_PAREN" },
|
|
|
|
SyntaxInfo { name: "L_CURLY" },
|
|
|
|
SyntaxInfo { name: "R_CURLY" },
|
|
|
|
SyntaxInfo { name: "L_BRACK" },
|
|
|
|
SyntaxInfo { name: "R_BRACK" },
|
2017-12-30 11:56:54 -06:00
|
|
|
SyntaxInfo { name: "L_ANGLE" },
|
|
|
|
SyntaxInfo { name: "R_ANGLE" },
|
2017-12-30 07:30:37 -06:00
|
|
|
SyntaxInfo { name: "AT" },
|
|
|
|
SyntaxInfo { name: "POUND" },
|
|
|
|
SyntaxInfo { name: "TILDE" },
|
|
|
|
SyntaxInfo { name: "QUESTION" },
|
|
|
|
SyntaxInfo { name: "COLON" },
|
|
|
|
SyntaxInfo { name: "COLONCOLON" },
|
|
|
|
SyntaxInfo { name: "DOLLAR" },
|
2017-12-30 09:25:37 -06:00
|
|
|
SyntaxInfo { name: "EQ" },
|
|
|
|
SyntaxInfo { name: "EQEQ" },
|
|
|
|
SyntaxInfo { name: "FAT_ARROW" },
|
|
|
|
SyntaxInfo { name: "NEQ" },
|
2018-01-07 10:50:54 -06:00
|
|
|
SyntaxInfo { name: "EXCL" },
|
2017-12-31 01:41:42 -06:00
|
|
|
SyntaxInfo { name: "LIFETIME" },
|
2017-12-31 05:02:55 -06:00
|
|
|
SyntaxInfo { name: "CHAR" },
|
|
|
|
SyntaxInfo { name: "BYTE" },
|
|
|
|
SyntaxInfo { name: "STRING" },
|
|
|
|
SyntaxInfo { name: "RAW_STRING" },
|
|
|
|
SyntaxInfo { name: "BYTE_STRING" },
|
|
|
|
SyntaxInfo { name: "RAW_BYTE_STRING" },
|
2017-12-31 06:29:09 -06:00
|
|
|
SyntaxInfo { name: "PLUS" },
|
|
|
|
SyntaxInfo { name: "MINUS" },
|
|
|
|
SyntaxInfo { name: "STAR" },
|
|
|
|
SyntaxInfo { name: "SLASH" },
|
|
|
|
SyntaxInfo { name: "CARET" },
|
|
|
|
SyntaxInfo { name: "PERCENT" },
|
|
|
|
SyntaxInfo { name: "AMPERSAND" },
|
|
|
|
SyntaxInfo { name: "PIPE" },
|
|
|
|
SyntaxInfo { name: "THIN_ARROW" },
|
2017-12-31 07:42:22 -06:00
|
|
|
SyntaxInfo { name: "COMMENT" },
|
|
|
|
SyntaxInfo { name: "DOC_COMMENT" },
|
|
|
|
SyntaxInfo { name: "SHEBANG" },
|
2017-12-31 14:27:36 -06:00
|
|
|
SyntaxInfo { name: "FILE" },
|
2018-01-01 13:13:04 -06:00
|
|
|
SyntaxInfo { name: "STRUCT_ITEM" },
|
2018-01-13 13:00:26 -06:00
|
|
|
SyntaxInfo { name: "NAMED_FIELD" },
|
|
|
|
SyntaxInfo { name: "POS_FIELD" },
|
2018-01-07 07:01:30 -06:00
|
|
|
SyntaxInfo { name: "FN_ITEM" },
|
2018-01-08 15:06:42 -06:00
|
|
|
SyntaxInfo { name: "EXTERN_CRATE_ITEM" },
|
2018-01-07 10:50:54 -06:00
|
|
|
SyntaxInfo { name: "ATTR" },
|
2018-01-07 12:40:18 -06:00
|
|
|
SyntaxInfo { name: "META_ITEM" },
|
2018-01-09 13:35:55 -06:00
|
|
|
SyntaxInfo { name: "MOD_ITEM" },
|
2018-01-09 14:32:18 -06:00
|
|
|
SyntaxInfo { name: "USE_ITEM" },
|
2018-01-13 04:42:19 -06:00
|
|
|
SyntaxInfo { name: "USE_TREE" },
|
2018-01-09 14:32:18 -06:00
|
|
|
SyntaxInfo { name: "PATH" },
|
|
|
|
SyntaxInfo { name: "PATH_SEGMENT" },
|
2018-01-08 12:40:00 -06:00
|
|
|
SyntaxInfo { name: "LITERAL" },
|
2018-01-08 15:06:42 -06:00
|
|
|
SyntaxInfo { name: "ALIAS" },
|
2018-01-12 13:05:46 -06:00
|
|
|
SyntaxInfo { name: "VISIBILITY" },
|
2017-12-29 11:47:54 -06:00
|
|
|
];
|
2017-12-28 15:56:36 -06:00
|
|
|
|
|
|
|
pub(crate) fn syntax_info(kind: SyntaxKind) -> &'static SyntaxInfo {
|
2017-12-29 11:47:54 -06:00
|
|
|
&INFOS[kind.0 as usize]
|
2017-12-28 16:21:54 -06:00
|
|
|
}
|
2018-01-01 09:58:46 -06:00
|
|
|
|
|
|
|
pub(crate) fn ident_to_keyword(ident: &str) -> Option<SyntaxKind> {
|
|
|
|
match ident {
|
|
|
|
"use" => Some(USE_KW),
|
|
|
|
"fn" => Some(FN_KW),
|
|
|
|
"struct" => Some(STRUCT_KW),
|
|
|
|
"enum" => Some(ENUM_KW),
|
|
|
|
"trait" => Some(TRAIT_KW),
|
|
|
|
"impl" => Some(IMPL_KW),
|
2018-01-08 12:21:59 -06:00
|
|
|
"true" => Some(TRUE_KW),
|
|
|
|
"false" => Some(FALSE_KW),
|
2018-01-08 15:06:42 -06:00
|
|
|
"as" => Some(AS_KW),
|
|
|
|
"extern" => Some(EXTERN_KW),
|
|
|
|
"crate" => Some(CRATE_KW),
|
2018-01-09 13:35:55 -06:00
|
|
|
"mod" => Some(MOD_KW),
|
2018-01-12 13:05:46 -06:00
|
|
|
"pub" => Some(PUB_KW),
|
|
|
|
"self" => Some(SELF_KW),
|
|
|
|
"super" => Some(SUPER_KW),
|
2018-01-13 02:55:03 -06:00
|
|
|
"in" => Some(IN_KW),
|
2018-01-13 13:00:26 -06:00
|
|
|
"where" => Some(WHERE_KW),
|
2018-01-01 09:58:46 -06:00
|
|
|
_ => None,
|
|
|
|
}
|
|
|
|
}
|