File: test.g

package info (click to toggle)
pccts 1.33MR33-6
  • links: PTS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, squeeze, stretch, wheezy
  • size: 3,220 kB
  • ctags: 5,279
  • sloc: ansic: 46,053; cpp: 3,234; makefile: 959
file content (22 lines) | stat: -rw-r--r-- 505 bytes parent folder | download | duplicates (19)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* This is test.g which tests a simple DLG-based scanner, but with
 * a main() in another file.
 */

#header <<
#include "AToken.h"						// what's ANTLRCommonToken look like?
typedef ANTLRCommonToken ANTLRToken;	// by placing in header, Expr.h gets it
>>

#token "[\ \t\n]+"	<<skip();>>
#token Eof "@"

class Expr {				/* Define a grammar class */

e	:	IDENTIFIER NUMBER Eof
		<<fprintf(stderr, "text is %s,%s\n", $1->getText(), $2->getText());>>
	;

}

#token IDENTIFIER	"[a-z]+"
#token NUMBER		"[0-9]+"