aboutsummaryrefslogtreecommitdiffhomepage
path: root/parse_productions.h
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-07-26 23:59:12 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-07-26 23:59:12 -0700
commit9dc91925e7bf4dc43936f7657a1a85cbd1ec4909 (patch)
treeda8ccb626b422d3cb254ad144aa4b5e694937c13 /parse_productions.h
parent4f8d4f378cffa71b4e80bfa2049e2152b429615c (diff)
Fewer templates
Diffstat (limited to 'parse_productions.h')
-rw-r--r--parse_productions.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/parse_productions.h b/parse_productions.h
index 5ded6af0..d3743014 100644
--- a/parse_productions.h
+++ b/parse_productions.h
@@ -55,10 +55,12 @@ namespace parse_productions
-struct Production_t
-{
- enum parse_token_type_t symbols[MAX_SYMBOLS_PER_PRODUCTION];
-};
+/* A production is an array of unsigned char. Symbols are encoded directly as their symbol value. Keywords are encoded with an offset of LAST_TOKEN_OR_SYMBOL + 1. So essentially we glom together keywords and symbols. */
+typedef unsigned char Production_t[MAX_SYMBOLS_PER_PRODUCTION];
+
+typedef Production_t ProductionList_t[MAX_PRODUCTIONS];
+
+#define PRODUCE_KEYWORD(x) ((x) + LAST_TOKEN_OR_SYMBOL + 1)
struct Symbol_t
{