Server IP : 85.214.239.14 / Your IP : 3.15.225.164 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/2/task/2/root/proc/2/root/usr/share/doc/re2c/examples/rust/headers/ |
Upload File : |
/* Generated by re2c */ // re2rust $INPUT -o $OUTPUT --header lexer/state.rs mod lexer; use lexer::state::State; // the module is generated by re2c fn lex(st: &mut State) -> usize { let t: usize; { #[allow(unused_assignments)] let mut yych : u8 = 0; let mut yystate : usize = 0; 'yyl: loop { match yystate { 0 => { yych = unsafe {*st.str.get_unchecked(st.cur)}; match yych { 0x61 => { st.cur += 1; yystate = 0; continue 'yyl; } 0x62 => { st.yyt1 = st.cur; st.cur += 1; yystate = 2; continue 'yyl; } _ => { st.yyt1 = st.cur; yystate = 1; continue 'yyl; } } } 1 => { t = st.yyt1; { return t; } } 2 => { yych = unsafe {*st.str.get_unchecked(st.cur)}; match yych { 0x62 => { st.cur += 1; yystate = 2; continue 'yyl; } _ => { yystate = 1; continue 'yyl; } } } _ => { panic!("internal lexer error") } } } } } fn main() { let mut st = State { str: b"ab\0", cur: 0, yyt1: 0, }; assert_eq!(lex(&mut st), 1); } /* Generated by re2c */ pub struct State<'a> { pub str: &'a [u8], pub cur: usize, pub yyt1: usize, } rust/headers/header.re:26:21: warning: rule matches empty string [-Wmatch-empty-string]