summaryrefslogtreecommitdiffstats
path: root/dimension
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-02-11 19:50:03 -0500
committerTavian Barnes <tavianator@gmail.com>2010-02-11 20:18:40 -0500
commita2b5336d126a95b58527151584c249876d50f0e8 (patch)
treefb2e542fd27180723f6a491c0d96f1f97cd1b2b6 /dimension
parent6dfea71b967f6e4ab1372a26653bf806f77443c7 (diff)
downloaddimension-a2b5336d126a95b58527151584c249876d50f0e8.tar.xz
Add all language directives to lexer.
Diffstat (limited to 'dimension')
-rw-r--r--dimension/common.terminals30
-rw-r--r--dimension/lexer.l15
2 files changed, 30 insertions, 15 deletions
diff --git a/dimension/common.terminals b/dimension/common.terminals
index f7428aa..c50c7a9 100644
--- a/dimension/common.terminals
+++ b/dimension/common.terminals
@@ -491,32 +491,32 @@
%token DMNSN_T_Z "z"
/* Directives (#declare etc.) */
-%token DMNSN_T_BREAK
-%token DMNSN_T_CASE
-%token DMNSN_T_DEBUG
+%token DMNSN_T_BREAK "#break"
+%token DMNSN_T_CASE "#case"
+%token DMNSN_T_DEBUG "#debug"
%token DMNSN_T_DECLARE "#declare"
-%token DMNSN_T_DEFAULT
+%token DMNSN_T_DEFAULT "#default"
%token DMNSN_T_ELSE "#else"
%token DMNSN_T_END "#end"
-%token DMNSN_T_ERROR
-%token DMNSN_T_FCLOSE
-%token DMNSN_T_FOPEN
+%token DMNSN_T_ERROR "#error"
+%token DMNSN_T_FCLOSE "#fclose"
+%token DMNSN_T_FOPEN "#fopen"
%token DMNSN_T_IF "#if"
%token DMNSN_T_IFDEF "#ifdef"
%token DMNSN_T_IFNDEF "#ifndef"
%token DMNSN_T_INCLUDE "#include"
%token DMNSN_T_LOCAL "#local"
-%token DMNSN_T_MACRO
-%token DMNSN_T_RANGE
-%token DMNSN_T_READ
-%token DMNSN_T_RENDER
-%token DMNSN_T_STATISTICS
-%token DMNSN_T_SWITCH
+%token DMNSN_T_MACRO "#macro"
+%token DMNSN_T_RANGE "#range"
+%token DMNSN_T_READ "#read"
+%token DMNSN_T_RENDER "#render"
+%token DMNSN_T_STATISTICS "#statistics"
+%token DMNSN_T_SWITCH "#switch"
%token DMNSN_T_UNDEF "#undef"
%token DMNSN_T_VERSION "#version"
-%token DMNSN_T_WARNING
+%token DMNSN_T_WARNING "#warning"
%token DMNSN_T_WHILE "#while"
-%token DMNSN_T_WRITE
+%token DMNSN_T_WRITE "#write"
/* Identifiers */
%token <value> DMNSN_T_IDENTIFIER "identifier"
diff --git a/dimension/lexer.l b/dimension/lexer.l
index d065ed5..3c23d78 100644
--- a/dimension/lexer.l
+++ b/dimension/lexer.l
@@ -207,17 +207,32 @@ unsigned long wchar;
"z" RETURN_TOKEN(DMNSN_T_Z);
(?# Directives)
+#[\b\r\t\v ]*break RETURN_TOKEN(DMNSN_T_BREAK);
+#[\b\r\t\v ]*case RETURN_TOKEN(DMNSN_T_CASE);
+#[\b\r\t\v ]*debug RETURN_TOKEN(DMNSN_T_DEBUG);
#[\b\r\t\v ]*declare RETURN_TOKEN(DMNSN_T_DECLARE);
+#[\b\r\t\v ]*default RETURN_TOKEN(DMNSN_T_DEFAULT);
#[\b\r\t\v ]*else RETURN_TOKEN(DMNSN_T_ELSE);
#[\b\r\t\v ]*end RETURN_TOKEN(DMNSN_T_END);
+#[\b\r\t\v ]*error RETURN_TOKEN(DMNSN_T_ERROR);
+#[\b\r\t\v ]*fclose RETURN_TOKEN(DMNSN_T_FCLOSE);
+#[\b\r\t\v ]*fopen RETURN_TOKEN(DMNSN_T_FOPEN);
#[\b\r\t\v ]*if RETURN_TOKEN(DMNSN_T_IF);
#[\b\r\t\v ]*ifdef RETURN_TOKEN(DMNSN_T_IFDEF);
#[\b\r\t\v ]*ifndef RETURN_TOKEN(DMNSN_T_IFNDEF);
#[\b\r\t\v ]*include RETURN_TOKEN(DMNSN_T_INCLUDE);
#[\b\r\t\v ]*local RETURN_TOKEN(DMNSN_T_LOCAL);
+#[\b\r\t\v ]*macro RETURN_TOKEN(DMNSN_T_MACRO);
+#[\b\r\t\v ]*range RETURN_TOKEN(DMNSN_T_RANGE);
+#[\b\r\t\v ]*read RETURN_TOKEN(DMNSN_T_READ);
+#[\b\r\t\v ]*render RETURN_TOKEN(DMNSN_T_RENDER);
+#[\b\r\t\v ]*statistics RETURN_TOKEN(DMNSN_T_STATISTICS);
+#[\b\r\t\v ]*switch RETURN_TOKEN(DMNSN_T_SWITCH);
#[\b\r\t\v ]*undef RETURN_TOKEN(DMNSN_T_UNDEF);
#[\b\r\t\v ]*version RETURN_TOKEN(DMNSN_T_VERSION);
+#[\b\r\t\v ]*warning RETURN_TOKEN(DMNSN_T_WARNING);
#[\b\r\t\v ]*while RETURN_TOKEN(DMNSN_T_WHILE);
+#[\b\r\t\v ]*write RETURN_TOKEN(DMNSN_T_WRITE);
#[\b\r\t\v ]*[[:alnum:]_]* {
dmnsn_diagnostic(filename, yylineno, yycolumn,
"Unrecognized language directive '%s'", yytext);