⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.93
Server IP:
65.108.141.171
Server:
Linux server.heloix.com 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
7.4.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
doc
/
re2c
/
examples
/
View File Name :
02_recognizing_strings.i.re
#include <stdio.h> #include <string.h> /*!max:re2c*/ 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; /*!re2c re2c:define:YYCTYPE = char; re2c:define:YYFILL = "return false;"; re2c:define:YYFILL:naked = 1; sstr = "'" [^']* "'"; dstr = "\"" [^"]* "\""; * { return false; } (sstr | dstr) { 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; }