| Server IP : 189.126.111.107 / Your IP : 216.73.217.69 Web Server : Apache System : Linux www.gadotticar.com.br 5.4.0-135-generic #152-Ubuntu SMP Wed Nov 23 20:19:22 UTC 2022 x86_64 User : gadotticar ( 1000) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/doc/re2c/examples/ |
Upload File : |
/* Generated by re2c */
#include <stdio.h>
#include <string.h>
#define YYMAXFILL 1
struct input_t {
size_t len;
char *str;
input_t(const char *s)
: len(strlen(s))
, str(new char[len + YYMAXFILL])
{
memcpy(str, s, len);
memset(str + len, 'a', YYMAXFILL);
}
~input_t()
{
delete[]str;
}
};
static bool lex(const input_t & input)
{
const char *YYCURSOR = input.str;
const char *const YYLIMIT = input.str + input.len + YYMAXFILL;
{
char yych;
if (YYLIMIT <= YYCURSOR) return false;
yych = *YYCURSOR;
switch (yych) {
case '"': goto yy4;
case '\'': goto yy6;
default: goto yy2;
}
yy2:
++YYCURSOR;
{ return false; }
yy4:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) return false;
yych = *YYCURSOR;
switch (yych) {
case '"': goto yy8;
default: goto yy4;
}
yy6:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) return false;
yych = *YYCURSOR;
switch (yych) {
case '\'': goto yy8;
default: goto yy6;
}
yy8:
++YYCURSOR;
{ return YYLIMIT - YYCURSOR == YYMAXFILL; }
}
}
int main(int argc, char **argv)
{
for (int i = 1; i < argc; ++i) {
input_t arg(argv[i]);
printf("%s: %s\n", lex(arg) ? "str" : "err", argv[i]);
}
return 0;
}