Created
August 15, 2025 23:24
-
-
Save jprochazk/f0bb57cda13f9c691991b565f41aaac8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| impl<'s> ::logos::Logos<'s> for TokenKind { | |
| type Error = (); | |
| type Extras = (); | |
| type Source = str; | |
| fn lex(lex: &mut ::logos::Lexer<'s, Self>) { | |
| use ::logos::internal::{CallbackResult, LexerInternal, SkipCallbackResult}; | |
| type Lexer<'s> = ::logos::Lexer<'s, TokenKind>; | |
| fn _end<'s>(lex: &mut Lexer<'s>) { | |
| lex.end() | |
| } | |
| fn _error<'s>(lex: &mut Lexer<'s>) { | |
| lex.bump_unchecked(1); | |
| lex.error(); | |
| } | |
| static COMPACT_TABLE_0: [u8; 256] = [ | |
| 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
| 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, | |
| 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, | |
| 3, 3, 3, 3, 2, 0, 2, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, | |
| 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
| 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
| 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
| 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
| 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
| ]; | |
| #[inline] | |
| fn goto27_ctx27_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::OP_BANG)); | |
| } | |
| #[inline] | |
| fn goto22_ctx27_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::OP_NEQ)); | |
| } | |
| #[inline] | |
| fn goto71_ctx27_x<'s>(lex: &mut Lexer<'s>) { | |
| match lex.read::<&[u8; 1usize]>() { | |
| Some(b"=") => { | |
| lex.bump_unchecked(1usize); | |
| goto22_ctx27_x(lex) | |
| } | |
| _ => goto27_ctx27_x(lex), | |
| } | |
| } | |
| #[inline] | |
| fn goto47_ctx47_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::LIT_IDENT)); | |
| } | |
| #[inline] | |
| fn pattern0(byte: u8) -> bool { | |
| COMPACT_TABLE_0[byte as usize] & 1 > 0 | |
| } | |
| #[inline] | |
| fn goto48_ctx47_x<'s>(lex: &mut Lexer<'s>) { | |
| while let Some(arr) = lex.read::<&[u8; 16]>() { | |
| if pattern0(arr[0]) { | |
| if pattern0(arr[1]) { | |
| if pattern0(arr[2]) { | |
| if pattern0(arr[3]) { | |
| if pattern0(arr[4]) { | |
| if pattern0(arr[5]) { | |
| if pattern0(arr[6]) { | |
| if pattern0(arr[7]) { | |
| if pattern0(arr[8]) { | |
| if pattern0(arr[9]) { | |
| if pattern0(arr[10]) { | |
| if pattern0(arr[11]) { | |
| if pattern0(arr[12]) { | |
| if pattern0(arr[13]) { | |
| if pattern0(arr[14]) { | |
| if pattern0(arr[15]) { | |
| lex.bump_unchecked( | |
| 16, | |
| ); | |
| continue; | |
| } | |
| lex.bump_unchecked(15); | |
| return goto47_ctx47_x( | |
| lex, | |
| ); | |
| } | |
| lex.bump_unchecked(14); | |
| return goto47_ctx47_x(lex); | |
| } | |
| lex.bump_unchecked(13); | |
| return goto47_ctx47_x(lex); | |
| } | |
| lex.bump_unchecked(12); | |
| return goto47_ctx47_x(lex); | |
| } | |
| lex.bump_unchecked(11); | |
| return goto47_ctx47_x(lex); | |
| } | |
| lex.bump_unchecked(10); | |
| return goto47_ctx47_x(lex); | |
| } | |
| lex.bump_unchecked(9); | |
| return goto47_ctx47_x(lex); | |
| } | |
| lex.bump_unchecked(8); | |
| return goto47_ctx47_x(lex); | |
| } | |
| lex.bump_unchecked(7); | |
| return goto47_ctx47_x(lex); | |
| } | |
| lex.bump_unchecked(6); | |
| return goto47_ctx47_x(lex); | |
| } | |
| lex.bump_unchecked(5); | |
| return goto47_ctx47_x(lex); | |
| } | |
| lex.bump_unchecked(4); | |
| return goto47_ctx47_x(lex); | |
| } | |
| lex.bump_unchecked(3); | |
| return goto47_ctx47_x(lex); | |
| } | |
| lex.bump_unchecked(2); | |
| return goto47_ctx47_x(lex); | |
| } | |
| lex.bump_unchecked(1); | |
| return goto47_ctx47_x(lex); | |
| } | |
| return goto47_ctx47_x(lex); | |
| } | |
| while lex.test(pattern0) { | |
| lex.bump_unchecked(1); | |
| } | |
| goto47_ctx47_x(lex); | |
| } | |
| #[inline] | |
| fn goto5_ctx48_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::KW_IF)); | |
| } | |
| #[inline] | |
| fn goto55_ctx48_x<'s>(lex: &mut Lexer<'s>) { | |
| let byte = match lex.read::<u8>() { | |
| Some(byte) => byte, | |
| None => return goto5_ctx48_x(lex), | |
| }; | |
| match byte { | |
| byte if pattern0(byte) => { | |
| lex.bump_unchecked(1usize); | |
| goto48_ctx47_x(lex) | |
| } | |
| _ => goto5_ctx48_x(lex), | |
| } | |
| } | |
| #[inline] | |
| fn goto54_ctx48_x<'s>(lex: &mut Lexer<'s>) { | |
| match lex.read::<&[u8; 1usize]>() { | |
| Some(b"f") => { | |
| lex.bump_unchecked(1usize); | |
| goto55_ctx48_x(lex) | |
| } | |
| _ => goto48_ctx47_x(lex), | |
| } | |
| } | |
| #[inline] | |
| fn goto18_ctx18_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::OP_EQ)); | |
| } | |
| #[inline] | |
| fn goto21_ctx18_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::OP_EQEQ)); | |
| } | |
| #[inline] | |
| fn goto65_ctx18_x<'s>(lex: &mut Lexer<'s>) { | |
| match lex.read::<&[u8; 1usize]>() { | |
| Some(b"=") => { | |
| lex.bump_unchecked(1usize); | |
| goto21_ctx18_x(lex) | |
| } | |
| _ => goto18_ctx18_x(lex), | |
| } | |
| } | |
| #[inline] | |
| fn goto16_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::OP_STAR)); | |
| } | |
| #[inline] | |
| fn goto33_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::LIT_STR)); | |
| } | |
| #[inline] | |
| fn goto34_x<'s>(lex: &mut Lexer<'s>) { | |
| match lex.read::<&[u8; 1usize]>() { | |
| Some(b"\"") => { | |
| lex.bump_unchecked(1usize); | |
| goto33_x(lex) | |
| } | |
| _ => lex.error(), | |
| } | |
| } | |
| #[inline] | |
| fn goto33_ctx34_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::LIT_STR)); | |
| } | |
| #[inline] | |
| fn goto34_ctx34_x<'s>(lex: &mut Lexer<'s>) { | |
| match lex.read::<&[u8; 1usize]>() { | |
| Some(b"\"") => { | |
| lex.bump_unchecked(1usize); | |
| goto33_ctx34_x(lex) | |
| } | |
| _ => goto34_x(lex), | |
| } | |
| } | |
| #[inline] | |
| fn goto37_at2_ctx34_x<'s>(lex: &mut Lexer<'s>) { | |
| match lex.read_at::<&[u8; 1usize]>(2usize) { | |
| Some([128u8..=191u8]) => { | |
| lex.bump_unchecked(3usize); | |
| goto35_ctx34_x(lex) | |
| } | |
| _ => goto34_x(lex), | |
| } | |
| } | |
| #[inline] | |
| fn goto39_at2_ctx34_x<'s>(lex: &mut Lexer<'s>) { | |
| match lex.read_at::<&[u8; 2usize]>(2usize) { | |
| Some([128u8..=191u8, 128u8..=191u8]) => { | |
| lex.bump_unchecked(4usize); | |
| goto35_ctx34_x(lex) | |
| } | |
| _ => goto34_x(lex), | |
| } | |
| } | |
| #[inline] | |
| fn goto38_at2_ctx34_x<'s>(lex: &mut Lexer<'s>) { | |
| match lex.read_at::<&[u8; 2usize]>(2usize) { | |
| Some([160u8..=191u8, 128u8..=191u8]) => { | |
| lex.bump_unchecked(4usize); | |
| goto35_ctx34_x(lex) | |
| } | |
| _ => goto34_x(lex), | |
| } | |
| } | |
| #[inline] | |
| fn goto41_at2_ctx34_x<'s>(lex: &mut Lexer<'s>) { | |
| match lex.read_at::<&[u8; 3usize]>(2usize) { | |
| Some([144u8..=191u8, 128u8..=191u8, 128u8..=191u8]) => { | |
| lex.bump_unchecked(5usize); | |
| goto35_ctx34_x(lex) | |
| } | |
| _ => goto34_x(lex), | |
| } | |
| } | |
| #[inline] | |
| fn goto40_at2_ctx34_x<'s>(lex: &mut Lexer<'s>) { | |
| match lex.read_at::<&[u8; 2usize]>(2usize) { | |
| Some([128u8..=159u8, 128u8..=191u8]) => { | |
| lex.bump_unchecked(4usize); | |
| goto35_ctx34_x(lex) | |
| } | |
| _ => goto34_x(lex), | |
| } | |
| } | |
| #[inline] | |
| fn goto43_at2_ctx34_x<'s>(lex: &mut Lexer<'s>) { | |
| match lex.read_at::<&[u8; 3usize]>(2usize) { | |
| Some([128u8..=143u8, 128u8..=191u8, 128u8..=191u8]) => { | |
| lex.bump_unchecked(5usize); | |
| goto35_ctx34_x(lex) | |
| } | |
| _ => goto34_x(lex), | |
| } | |
| } | |
| #[inline] | |
| fn goto42_at2_ctx34_x<'s>(lex: &mut Lexer<'s>) { | |
| match lex.read_at::<&[u8; 3usize]>(2usize) { | |
| Some([128u8..=191u8, 128u8..=191u8, 128u8..=191u8]) => { | |
| lex.bump_unchecked(5usize); | |
| goto35_ctx34_x(lex) | |
| } | |
| _ => goto34_x(lex), | |
| } | |
| } | |
| #[inline] | |
| fn goto44_at1_ctx34_x<'s>(lex: &mut Lexer<'s>) { | |
| enum Jump { | |
| __, | |
| J37, | |
| J39, | |
| J38, | |
| J35, | |
| J41, | |
| J40, | |
| J43, | |
| J42, | |
| } | |
| const LUT: [Jump; 256] = { | |
| use Jump::*; | |
| [ | |
| J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, __, J35, J35, J35, J35, J35, | |
| J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, | |
| J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, | |
| J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, | |
| J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, | |
| J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, | |
| J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, | |
| J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, J35, | |
| __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, | |
| __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, | |
| __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, | |
| __, __, __, __, __, __, J37, J37, J37, J37, J37, J37, J37, J37, J37, J37, J37, | |
| J37, J37, J37, J37, J37, J37, J37, J37, J37, J37, J37, J37, J37, J37, J37, J37, | |
| J37, J37, J37, J38, J39, J39, J39, J39, J39, J39, J39, J39, J39, J39, J39, J39, | |
| J40, J39, J39, J41, J42, J42, J42, J43, __, __, __, __, __, __, __, __, __, __, | |
| __, | |
| ] | |
| }; | |
| let byte = match lex.read_at::<u8>(1usize) { | |
| Some(byte) => byte, | |
| None => return goto34_x(lex), | |
| }; | |
| match LUT[byte as usize] { | |
| Jump::J37 => goto37_at2_ctx34_x(lex), | |
| Jump::J39 => goto39_at2_ctx34_x(lex), | |
| Jump::J38 => goto38_at2_ctx34_x(lex), | |
| Jump::J35 => { | |
| lex.bump_unchecked(2usize); | |
| goto35_ctx34_x(lex) | |
| } | |
| Jump::J41 => goto41_at2_ctx34_x(lex), | |
| Jump::J40 => goto40_at2_ctx34_x(lex), | |
| Jump::J43 => goto43_at2_ctx34_x(lex), | |
| Jump::J42 => goto42_at2_ctx34_x(lex), | |
| Jump::__ => goto34_x(lex), | |
| } | |
| } | |
| #[inline] | |
| fn pattern1(byte: u8) -> bool { | |
| COMPACT_TABLE_0[byte as usize] & 2 > 0 | |
| } | |
| #[inline] | |
| fn goto35_ctx34_x<'s>(lex: &mut Lexer<'s>) { | |
| let byte = match lex.read::<u8>() { | |
| Some(byte) => byte, | |
| None => return goto34_ctx34_x(lex), | |
| }; | |
| match byte { | |
| b'\\' => goto44_at1_ctx34_x(lex), | |
| byte if pattern1(byte) => { | |
| lex.bump_unchecked(1usize); | |
| goto35_ctx34_x(lex) | |
| } | |
| _ => goto34_ctx34_x(lex), | |
| } | |
| } | |
| #[inline] | |
| fn goto13_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::TOK_COMMA)); | |
| } | |
| #[inline] | |
| fn goto28_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::LIT_INT)); | |
| } | |
| #[inline] | |
| fn goto15_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::OP_PLUS)); | |
| } | |
| #[inline] | |
| fn goto28_ctx28_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::LIT_INT)); | |
| } | |
| #[inline] | |
| fn goto30_ctx28_x<'s>(lex: &mut Lexer<'s>) { | |
| match lex.read::<&[u8; 3usize]>() { | |
| Some(b"0-9") => { | |
| lex.bump_unchecked(3usize); | |
| goto30_ctx28_x(lex) | |
| } | |
| _ => goto28_ctx28_x(lex), | |
| } | |
| } | |
| #[inline] | |
| fn goto9_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::TOK_LPAREN)); | |
| } | |
| #[inline] | |
| fn goto7_ctx48_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::KW_LET)); | |
| } | |
| #[inline] | |
| fn goto61_ctx48_x<'s>(lex: &mut Lexer<'s>) { | |
| let byte = match lex.read::<u8>() { | |
| Some(byte) => byte, | |
| None => return goto7_ctx48_x(lex), | |
| }; | |
| match byte { | |
| byte if pattern0(byte) => { | |
| lex.bump_unchecked(1usize); | |
| goto48_ctx47_x(lex) | |
| } | |
| _ => goto7_ctx48_x(lex), | |
| } | |
| } | |
| #[inline] | |
| fn goto60_ctx48_x<'s>(lex: &mut Lexer<'s>) { | |
| match lex.read::<&[u8; 2usize]>() { | |
| Some(b"et") => { | |
| lex.bump_unchecked(2usize); | |
| goto61_ctx48_x(lex) | |
| } | |
| _ => goto48_ctx47_x(lex), | |
| } | |
| } | |
| #[inline] | |
| fn goto11_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::TOK_LBRACE)); | |
| } | |
| #[inline] | |
| fn goto19_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::OP_OR)); | |
| } | |
| #[inline] | |
| fn goto62_at1<'s>(lex: &mut Lexer<'s>) { | |
| match lex.read_at::<&[u8; 1usize]>(1usize) { | |
| Some(b"|") => { | |
| lex.bump_unchecked(2usize); | |
| goto19_x(lex) | |
| } | |
| _ => _error(lex), | |
| } | |
| } | |
| #[inline] | |
| fn goto23_ctx23_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::OP_LT)); | |
| } | |
| #[inline] | |
| fn goto24_ctx23_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::OP_LE)); | |
| } | |
| #[inline] | |
| fn goto68_ctx23_x<'s>(lex: &mut Lexer<'s>) { | |
| match lex.read::<&[u8; 1usize]>() { | |
| Some(b"=") => { | |
| lex.bump_unchecked(1usize); | |
| goto24_ctx23_x(lex) | |
| } | |
| _ => goto23_ctx23_x(lex), | |
| } | |
| } | |
| #[inline] | |
| fn goto25_ctx25_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::OP_GT)); | |
| } | |
| #[inline] | |
| fn goto26_ctx25_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::OP_GE)); | |
| } | |
| #[inline] | |
| fn goto70_ctx25_x<'s>(lex: &mut Lexer<'s>) { | |
| match lex.read::<&[u8; 1usize]>() { | |
| Some(b"=") => { | |
| lex.bump_unchecked(1usize); | |
| goto26_ctx25_x(lex) | |
| } | |
| _ => goto25_ctx25_x(lex), | |
| } | |
| } | |
| #[inline] | |
| fn goto17_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::OP_SLASH)); | |
| } | |
| #[inline] | |
| fn goto4_ctx48_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::KW_FN)); | |
| } | |
| #[inline] | |
| fn goto52_ctx48_x<'s>(lex: &mut Lexer<'s>) { | |
| let byte = match lex.read::<u8>() { | |
| Some(byte) => byte, | |
| None => return goto4_ctx48_x(lex), | |
| }; | |
| match byte { | |
| byte if pattern0(byte) => { | |
| lex.bump_unchecked(1usize); | |
| goto48_ctx47_x(lex) | |
| } | |
| _ => goto4_ctx48_x(lex), | |
| } | |
| } | |
| #[inline] | |
| fn goto51_ctx48_x<'s>(lex: &mut Lexer<'s>) { | |
| match lex.read::<&[u8; 1usize]>() { | |
| Some(b"n") => { | |
| lex.bump_unchecked(1usize); | |
| goto52_ctx48_x(lex) | |
| } | |
| _ => goto48_ctx47_x(lex), | |
| } | |
| } | |
| #[inline] | |
| fn goto1_ctx1_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.trivia(); | |
| TokenKind::lex(lex); | |
| } | |
| #[inline] | |
| fn pattern2(byte: u8) -> bool { | |
| const LUT: u64 = 4294977024u64; | |
| match 1u64.checked_shl(byte as u32) { | |
| Some(shift) => LUT & shift != 0, | |
| None => false, | |
| } | |
| } | |
| #[inline] | |
| fn goto2_ctx1_x<'s>(lex: &mut Lexer<'s>) { | |
| while let Some(arr) = lex.read::<&[u8; 16]>() { | |
| if pattern2(arr[0]) { | |
| if pattern2(arr[1]) { | |
| if pattern2(arr[2]) { | |
| if pattern2(arr[3]) { | |
| if pattern2(arr[4]) { | |
| if pattern2(arr[5]) { | |
| if pattern2(arr[6]) { | |
| if pattern2(arr[7]) { | |
| if pattern2(arr[8]) { | |
| if pattern2(arr[9]) { | |
| if pattern2(arr[10]) { | |
| if pattern2(arr[11]) { | |
| if pattern2(arr[12]) { | |
| if pattern2(arr[13]) { | |
| if pattern2(arr[14]) { | |
| if pattern2(arr[15]) { | |
| lex.bump_unchecked( | |
| 16, | |
| ); | |
| continue; | |
| } | |
| lex.bump_unchecked(15); | |
| return goto1_ctx1_x( | |
| lex, | |
| ); | |
| } | |
| lex.bump_unchecked(14); | |
| return goto1_ctx1_x(lex); | |
| } | |
| lex.bump_unchecked(13); | |
| return goto1_ctx1_x(lex); | |
| } | |
| lex.bump_unchecked(12); | |
| return goto1_ctx1_x(lex); | |
| } | |
| lex.bump_unchecked(11); | |
| return goto1_ctx1_x(lex); | |
| } | |
| lex.bump_unchecked(10); | |
| return goto1_ctx1_x(lex); | |
| } | |
| lex.bump_unchecked(9); | |
| return goto1_ctx1_x(lex); | |
| } | |
| lex.bump_unchecked(8); | |
| return goto1_ctx1_x(lex); | |
| } | |
| lex.bump_unchecked(7); | |
| return goto1_ctx1_x(lex); | |
| } | |
| lex.bump_unchecked(6); | |
| return goto1_ctx1_x(lex); | |
| } | |
| lex.bump_unchecked(5); | |
| return goto1_ctx1_x(lex); | |
| } | |
| lex.bump_unchecked(4); | |
| return goto1_ctx1_x(lex); | |
| } | |
| lex.bump_unchecked(3); | |
| return goto1_ctx1_x(lex); | |
| } | |
| lex.bump_unchecked(2); | |
| return goto1_ctx1_x(lex); | |
| } | |
| lex.bump_unchecked(1); | |
| return goto1_ctx1_x(lex); | |
| } | |
| return goto1_ctx1_x(lex); | |
| } | |
| while lex.test(pattern2) { | |
| lex.bump_unchecked(1); | |
| } | |
| goto1_ctx1_x(lex); | |
| } | |
| #[inline] | |
| fn goto12_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::TOK_RBRACE)); | |
| } | |
| #[inline] | |
| fn goto20_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::OP_AND)); | |
| } | |
| #[inline] | |
| fn goto63_at1<'s>(lex: &mut Lexer<'s>) { | |
| match lex.read_at::<&[u8; 1usize]>(1usize) { | |
| Some(b"&") => { | |
| lex.bump_unchecked(2usize); | |
| goto20_x(lex) | |
| } | |
| _ => _error(lex), | |
| } | |
| } | |
| #[inline] | |
| fn goto14_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::OP_MINUS)); | |
| } | |
| #[inline] | |
| fn goto6_ctx48_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::KW_ELSE)); | |
| } | |
| #[inline] | |
| fn goto58_ctx48_x<'s>(lex: &mut Lexer<'s>) { | |
| let byte = match lex.read::<u8>() { | |
| Some(byte) => byte, | |
| None => return goto6_ctx48_x(lex), | |
| }; | |
| match byte { | |
| byte if pattern0(byte) => { | |
| lex.bump_unchecked(1usize); | |
| goto48_ctx47_x(lex) | |
| } | |
| _ => goto6_ctx48_x(lex), | |
| } | |
| } | |
| #[inline] | |
| fn goto57_ctx48_x<'s>(lex: &mut Lexer<'s>) { | |
| match lex.read::<&[u8; 3usize]>() { | |
| Some(b"lse") => { | |
| lex.bump_unchecked(3usize); | |
| goto58_ctx48_x(lex) | |
| } | |
| _ => goto48_ctx47_x(lex), | |
| } | |
| } | |
| #[inline] | |
| fn goto8_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::TOK_SEMI)); | |
| } | |
| #[inline] | |
| fn goto10_x<'s>(lex: &mut Lexer<'s>) { | |
| lex.set(Ok(TokenKind::TOK_RPAREN)); | |
| } | |
| #[inline] | |
| fn goto72<'s>(lex: &mut Lexer<'s>) { | |
| enum Jump { | |
| __, | |
| J71, | |
| J54, | |
| J65, | |
| J16, | |
| J35, | |
| J48, | |
| J13, | |
| J28, | |
| J15, | |
| J30, | |
| J9, | |
| J60, | |
| J11, | |
| J62, | |
| J68, | |
| J70, | |
| J17, | |
| J51, | |
| J2, | |
| J12, | |
| J63, | |
| J14, | |
| J57, | |
| J8, | |
| J10, | |
| } | |
| const LUT: [Jump; 256] = { | |
| use Jump::*; | |
| [ | |
| __, __, __, __, __, __, __, __, __, J2, J2, __, __, J2, __, __, __, __, __, __, | |
| __, __, __, __, __, __, __, __, __, __, __, __, J2, J71, J35, __, __, __, J63, | |
| __, J9, J10, J16, J15, J13, J14, __, J17, J28, J30, J30, J30, J30, J30, J30, | |
| J30, J30, J30, __, J8, J68, J65, J70, __, __, J48, J48, J48, J48, J48, J48, | |
| J48, J48, J48, J48, J48, J48, J48, J48, J48, J48, J48, J48, J48, J48, J48, J48, | |
| J48, J48, J48, J48, __, __, __, __, J48, __, J48, J48, J48, J48, J57, J51, J48, | |
| J48, J54, J48, J48, J60, J48, J48, J48, J48, J48, J48, J48, J48, J48, J48, J48, | |
| J48, J48, J48, J11, J62, J12, __, __, __, __, __, __, __, __, __, __, __, __, | |
| __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, | |
| __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, | |
| __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, | |
| __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, | |
| __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, | |
| __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, | |
| ] | |
| }; | |
| let byte = match lex.read::<u8>() { | |
| Some(byte) => byte, | |
| None => return _end(lex), | |
| }; | |
| match LUT[byte as usize] { | |
| Jump::J71 => { | |
| lex.bump_unchecked(1usize); | |
| goto71_ctx27_x(lex) | |
| } | |
| Jump::J54 => { | |
| lex.bump_unchecked(1usize); | |
| goto54_ctx48_x(lex) | |
| } | |
| Jump::J65 => { | |
| lex.bump_unchecked(1usize); | |
| goto65_ctx18_x(lex) | |
| } | |
| Jump::J16 => { | |
| lex.bump_unchecked(1usize); | |
| goto16_x(lex) | |
| } | |
| Jump::J35 => { | |
| lex.bump_unchecked(1usize); | |
| goto35_ctx34_x(lex) | |
| } | |
| Jump::J48 => { | |
| lex.bump_unchecked(1usize); | |
| goto48_ctx47_x(lex) | |
| } | |
| Jump::J13 => { | |
| lex.bump_unchecked(1usize); | |
| goto13_x(lex) | |
| } | |
| Jump::J28 => { | |
| lex.bump_unchecked(1usize); | |
| goto28_x(lex) | |
| } | |
| Jump::J15 => { | |
| lex.bump_unchecked(1usize); | |
| goto15_x(lex) | |
| } | |
| Jump::J30 => { | |
| lex.bump_unchecked(1usize); | |
| goto30_ctx28_x(lex) | |
| } | |
| Jump::J9 => { | |
| lex.bump_unchecked(1usize); | |
| goto9_x(lex) | |
| } | |
| Jump::J60 => { | |
| lex.bump_unchecked(1usize); | |
| goto60_ctx48_x(lex) | |
| } | |
| Jump::J11 => { | |
| lex.bump_unchecked(1usize); | |
| goto11_x(lex) | |
| } | |
| Jump::J62 => goto62_at1(lex), | |
| Jump::J68 => { | |
| lex.bump_unchecked(1usize); | |
| goto68_ctx23_x(lex) | |
| } | |
| Jump::J70 => { | |
| lex.bump_unchecked(1usize); | |
| goto70_ctx25_x(lex) | |
| } | |
| Jump::J17 => { | |
| lex.bump_unchecked(1usize); | |
| goto17_x(lex) | |
| } | |
| Jump::J51 => { | |
| lex.bump_unchecked(1usize); | |
| goto51_ctx48_x(lex) | |
| } | |
| Jump::J2 => { | |
| lex.bump_unchecked(1usize); | |
| goto2_ctx1_x(lex) | |
| } | |
| Jump::J12 => { | |
| lex.bump_unchecked(1usize); | |
| goto12_x(lex) | |
| } | |
| Jump::J63 => goto63_at1(lex), | |
| Jump::J14 => { | |
| lex.bump_unchecked(1usize); | |
| goto14_x(lex) | |
| } | |
| Jump::J57 => { | |
| lex.bump_unchecked(1usize); | |
| goto57_ctx48_x(lex) | |
| } | |
| Jump::J8 => { | |
| lex.bump_unchecked(1usize); | |
| goto8_x(lex) | |
| } | |
| Jump::J10 => { | |
| lex.bump_unchecked(1usize); | |
| goto10_x(lex) | |
| } | |
| Jump::__ => _error(lex), | |
| } | |
| } | |
| goto72(lex) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment