]> pd.if.org Git - pccts/blobdiff - testcpp/8/test.g
auto commit for import
[pccts] / testcpp / 8 / test.g
diff --git a/testcpp/8/test.g b/testcpp/8/test.g
new file mode 100755 (executable)
index 0000000..d7af59e
--- /dev/null
@@ -0,0 +1,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]+"