Navigation


Changeset 169:f8507f57a3c0 in freeDiameter for extensions/rt_default


Ignore:
Timestamp:
Feb 2, 2010, 10:24:32 AM (14 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Allow '+' and '-' operators in conf file

Location:
extensions/rt_default
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/rt_default/rtd_conf.l

    r168 r169  
    136136                       
    137137        /* Valid single characters for yyparse */
    138 [*:=+;]                 { return yytext[0]; }
     138[*:=+-;]                { return yytext[0]; }
    139139
    140140        /* Unrecognized sequence, if it did not match any previous pattern */
  • extensions/rt_default/rtd_conf.y

    r168 r169  
    143143%type <criteria> CRITERIA
    144144%type <target>   TARGET
     145%type <integer>  EXPR_INT
    145146
    146147/* Tokens */
     
    165166                       
    166167        /* a RULE entry */
    167 rule:                   CRITERIA ':' TARGET '+' '=' INTEGER ';'
     168rule:                   CRITERIA ':' TARGET '+' '=' EXPR_INT ';'
    168169                        {
    169170                                int flag = 0;
     
    256257                        }
    257258                        ;
     259       
     260        /* An expression that has an integer value; we allow + and - operators cause it is convenient */
     261EXPR_INT:               INTEGER
     262                        {
     263                                $$ = $1;
     264                        }
     265                        | EXPR_INT '+' INTEGER
     266                        {
     267                                $$ = $1 + $3;
     268                        }
     269                        | EXPR_INT '-' INTEGER
     270                        {
     271                                $$ = $1 - $3;
     272                        }
     273                        ;
Note: See TracChangeset for help on using the changeset viewer.