Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,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_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /usr/share/doc/re2c/examples/ |
Upload File : |
/* Generated by re2c */ #include <stdio.h> #include <string.h> #define YYMAXFILL 1 static const size_t SIZE = 16; struct input_t { char buf[SIZE + YYMAXFILL]; char *lim; char *cur; char *tok; bool eof; input_t() : buf() , lim(buf + SIZE) , cur(lim) , tok(lim) , eof(false) {} bool fill(size_t need) { if (eof) { return false; } const size_t free = tok - buf; if (free < need) { return false; } memmove(buf, tok, lim - tok); lim -= free; cur -= free; tok -= free; lim += fread(lim, 1, free, stdin); if (lim < buf + SIZE) { eof = true; memset(lim, 0, YYMAXFILL); lim += YYMAXFILL; } return true; } }; static bool lex(input_t & in, unsigned int &count) { for (count = 0;;) { in.tok = in.cur; { char yych; if (in.lim <= in.cur) if (!in.fill(1)) return false; yych = *in.cur; switch (yych) { case 0x00: goto yy2; case '\n': goto yy6; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy9; default: goto yy4; } yy2: ++in.cur; { return YYMAXFILL == in.lim - in.tok; } yy4: ++in.cur; { return false; } yy6: ++in.cur; if (in.lim <= in.cur) if (!in.fill(1)) return false; yych = *in.cur; switch (yych) { case '\n': goto yy6; default: goto yy8; } yy8: { continue; } yy9: ++in.cur; if (in.lim <= in.cur) if (!in.fill(1)) return false; yych = *in.cur; switch (yych) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': goto yy9; default: goto yy11; } yy11: { ++count; continue; } } } } int main() { input_t in; unsigned int count; if (lex(in, count)) { printf("glorious %u numbers!\n", count); } else { printf("error\n"); } return 0; }