tony-rc_parse.opp.exp 929 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
File "tony-rc_parse.mly", line 13, characters 16-20:
Warning: the token BOOL is unused.
%{
open Rc_ast 
%}
%start rcfile
%token TRUE
%token <string> STR
%token <int> INT
%token <string> ID
%token <float> FLOAT
%token FALSE
%token EQUAL
%token EOF
%token COMMA
%token <bool> BOOL

%type <Rc_ast.rcdict> rcfile
%%

rcfile:
| rclines EOF
    { $1            }

rclines:
| 
    { empty         }
| rclines rcline
    { let (id,rc) = $2 in
                                                  add id rc $1
                                                }

rcline:
| ID EQUAL value
    { ($1,$3)       }
| ID EQUAL values
    { ($1,RClist(List.rev $3))  }

value:
| ID
    { RCstr($1)     }
| STR
    { RCstr($1)     }
| TRUE
    { RCbool(true)  }
| FALSE
    { RCbool(false) }
| INT
    { RCint($1)     }
| FLOAT
    { RCfloat($1)   }

values:
| value COMMA value
    { [$3  ; $1]    }
| values COMMA value
    {  $3 :: $1     }

%%