File: basic.c

package info (click to toggle)
re2c 4.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 51,512 kB
  • sloc: cpp: 34,160; ml: 8,494; sh: 5,311; makefile: 1,014; haskell: 611; python: 431; ansic: 234; javascript: 113
file content (51 lines) | stat: -rw-r--r-- 885 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* Generated by re2c */
// re2c $INPUT -o $OUTPUT --case-ranges --recursive-functions -i

#include <assert.h>


int yy0(const char* YYCURSOR);
int yy1(const char* YYCURSOR);
int yy2(const char* YYCURSOR);
int yy3(const char* YYCURSOR);
int lex(const char* YYCURSOR);

int yy0(const char* YYCURSOR) {
	char yych = *YYCURSOR++;
	switch (yych) {
		case 'A' ... 'Z':
		case 'a' ... 'z': return yy2(YYCURSOR);
		default: return yy1(YYCURSOR);
	}
}

int yy1(const char* YYCURSOR) {
	return 1;
}

int yy2(const char* YYCURSOR) {
	char yych = *YYCURSOR;
	switch (yych) {
		case '0' ... '9':
		case 'A' ... 'Z':
		case 'a' ... 'z':
			++YYCURSOR;
			return yy2(YYCURSOR);
		default: return yy3(YYCURSOR);
	}
}

int yy3(const char* YYCURSOR) {
	return 0;
}

int lex(const char* YYCURSOR) {
	return yy0(YYCURSOR);
}



int main() {
    assert(lex("qwerty42") == 0);
    assert(lex("??") == 1);
}