Mercurial > hg > freeDiameter
diff extensions/rt_default/rtd_conf.y @ 169:f8507f57a3c0
Allow '+' and '-' operators in conf file
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Tue, 02 Feb 2010 10:24:32 +0900 |
parents | 6db078b955e3 |
children | 5df55136361b |
line wrap: on
line diff
--- a/extensions/rt_default/rtd_conf.y Tue Feb 02 10:15:05 2010 +0900 +++ b/extensions/rt_default/rtd_conf.y Tue Feb 02 10:24:32 2010 +0900 @@ -142,6 +142,7 @@ %type <tstring> TSTRING %type <criteria> CRITERIA %type <target> TARGET +%type <integer> EXPR_INT /* Tokens */ %token OH @@ -164,7 +165,7 @@ ; /* a RULE entry */ -rule: CRITERIA ':' TARGET '+' '=' INTEGER ';' +rule: CRITERIA ':' TARGET '+' '=' EXPR_INT ';' { int flag = 0; if ($1.regex) @@ -255,3 +256,18 @@ $$.type = RTD_TAR_REALM; } ; + + /* An expression that has an integer value; we allow + and - operators cause it is convenient */ +EXPR_INT: INTEGER + { + $$ = $1; + } + | EXPR_INT '+' INTEGER + { + $$ = $1 + $3; + } + | EXPR_INT '-' INTEGER + { + $$ = $1 - $3; + } + ;