summaryrefslogtreecommitdiff
path: root/i
diff options
context:
space:
mode:
authorschodet2006-05-20 18:33:47 +0000
committerschodet2006-05-20 18:33:47 +0000
commitfc17c7e3e927cbe6fad7b90c323c1851621c5d74 (patch)
tree10d098788c8462a2452bb01ab4e28e6afeaeea9f /i
parentb03ba3b9588962971a15b38b4c9cbaef864decfa (diff)
Ajout du support des char.
Diffstat (limited to 'i')
-rw-r--r--i/marvin/src/parser/yylexer.ll30
-rw-r--r--i/marvin/src/parser/yyparser.yy12
2 files changed, 40 insertions, 2 deletions
diff --git a/i/marvin/src/parser/yylexer.ll b/i/marvin/src/parser/yylexer.ll
index 084de8f..be8d41c 100644
--- a/i/marvin/src/parser/yylexer.ll
+++ b/i/marvin/src/parser/yylexer.ll
@@ -45,16 +45,42 @@ DOUBLENUM {DOUBLE1}|{DOUBLE2}|{DOUBLE3}
%%
-"true"|"on" {
+"true"|"on"|"yes" {
yylval->b = true;
return BOOLEAN;
}
-"false"|"off" {
+"false"|"off"|"no" {
yylval->b = false;
return BOOLEAN;
}
+"'"\\n"'" {
+ yylval->c = '\n';
+ return CHAR;
+}
+"'"\\r"'" {
+ yylval->c = '\r';
+ return CHAR;
+}
+"'"\\t"'" {
+ yylval->c = '\t';
+ return CHAR;
+}
+"'"\\."'" {
+ yylval->c = yytext[1];
+ return CHAR;
+}
+"'"\\\n"'" {
+ yyextra->line++;
+ yylval->c = yytext[1];
+ return CHAR;
+}
+"'"."'" {
+ yylval->c = yytext[1];
+ return CHAR;
+}
+
[a-zA-Z][_a-zA-Z0-9.-]* {
yylval->s = new std::string (yytext);
return ID;
diff --git a/i/marvin/src/parser/yyparser.yy b/i/marvin/src/parser/yyparser.yy
index e965ffd..99d130a 100644
--- a/i/marvin/src/parser/yyparser.yy
+++ b/i/marvin/src/parser/yyparser.yy
@@ -65,6 +65,7 @@ void yyerror (void *scanner, const char *e);
%token<b> BOOLEAN
%token<c> UNKNOWN
+%token<c> CHAR
%token<i> INT
%token<d> DOUBLE
%token<s> ID STRING
@@ -96,6 +97,12 @@ item:
YYERROR;
delete $1;
}
+ | ID '=' CHAR {
+ any a ($3);
+ if (!yyextra->assign (*$1, a))
+ YYERROR;
+ delete $1;
+ }
| ID '=' INT {
any a ($3);
if (!yyextra->assign (*$1, a))
@@ -206,6 +213,11 @@ arg_list:
$1->push_back (any ());
$1->back ().swap (a);
}
+ | arg_list CHAR {
+ any a ($2);
+ $1->push_back (any ());
+ $1->back ().swap (a);
+ }
| arg_list INT {
any a ($2);
$1->push_back (any ());