1 | // re2c $INPUT -o $OUTPUT -i --case-ranges |
2 | #include <assert.h> |
3 | #include <stdio.h> |
4 | |
5 | bool lex(const char *s) { |
6 | const char *YYCURSOR = s; |
7 | /*!re2c |
8 | re2c:yyfill:enable = 0; |
9 | re2c:define:YYCTYPE = char; |
10 | |
11 | number = [1-9][0-9]*; |
12 | |
13 | number { return true; } |
14 | * { return false; } |
15 | */ |
16 | } |
17 | |
18 | int main(int argc, char** argv) { |
19 | const char *s = argv[1]; |
20 | bool matched = lex(s); |
21 | printf("%d %s\n", matched, s); |
22 | } |