Server IP : 85.214.239.14 / Your IP : 18.216.126.33 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/3/root/proc/self/root/usr/share/doc/re2c/examples/c/includes/ |
Upload File : |
/* Generated by re2c */ // re2c $INPUT -o $OUTPUT -i #include <assert.h> typedef enum { OK, FAIL } Result; Result lex(const char *s) { const char *YYCURSOR = s, *YYMARKER; { char yych; unsigned int yyaccept = 0; yych = *YYCURSOR; switch (yych) { case '.': goto yy3; case '0': goto yy4; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy5; default: goto yy1; } yy1: ++YYCURSOR; yy2: { return FAIL; } yy3: yych = *++YYCURSOR; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy7; default: goto yy2; } yy4: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); switch (yych) { case '.': goto yy7; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy9; case 'E': case 'e': goto yy11; default: goto yy2; } yy5: yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); switch (yych) { case '.': goto yy7; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy5; case 'E': case 'e': goto yy11; default: goto yy6; } yy6: { return OK; } yy7: yyaccept = 2; yych = *(YYMARKER = ++YYCURSOR); switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy7; case 'E': case 'e': goto yy11; default: goto yy8; } yy8: { return OK; } yy9: yych = *++YYCURSOR; switch (yych) { case '.': goto yy7; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy9; case 'E': case 'e': goto yy11; default: goto yy10; } yy10: YYCURSOR = YYMARKER; switch (yyaccept) { case 0: goto yy2; case 1: goto yy6; default: goto yy8; } yy11: yych = *++YYCURSOR; switch (yych) { case '+': case '-': goto yy12; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy13; default: goto yy10; } yy12: yych = *++YYCURSOR; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy13; default: goto yy10; } yy13: yych = *++YYCURSOR; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy13; default: goto yy8; } } } int main() { assert(lex("123") == OK); assert(lex("123.4567") == OK); return 0; }