]> matita.cs.unibo.it Git - helm.git/blob - helm/DEVEL/lablgtk/lablgtk_20000829-0.1.0/applications/radtest/load_parser.mly
Initial revision
[helm.git] / helm / DEVEL / lablgtk / lablgtk_20000829-0.1.0 / applications / radtest / load_parser.mly
1 %{
2 open Utils
3 %}
4
5 %token EOF NAME EQUAL SUP WINDOW_START WINDOW_END
6 %token <string> WIDGET_START WIDGET_END IDENT
7
8 %type <string> window_start
9 %type <string * string> property widget_start
10 %type <(string * string) list> property_list
11 %type <Utils.yywidget_tree> widget window
12 %type <Utils.yywidget_tree list> children window_list project
13
14 %start project
15 %start window
16 %start widget
17
18 %%
19
20 project : window_list EOF        { List.rev $1 }
21
22 window_list :                    { [] }
23             | window_list window { $2 :: $1 }
24
25
26 window : window_start property_list children WINDOW_END 
27   { 
28     Node (("window", $1, List.rev $2), $3)
29   } 
30 ;
31
32 window_start : WINDOW_START NAME EQUAL IDENT SUP   { $4 }
33 ;
34
35 children  :                  { [] }
36           | children widget   { $2 :: $1 }
37 ;
38
39 widget : widget_start property_list children WIDGET_END
40   { 
41     let classe, name = $1 in
42     if classe <> $4 then raise Parsing.Parse_error;
43     Node ((classe, name, List.rev $2), $3)
44   } 
45 ;
46
47 widget_start  : WIDGET_START NAME EQUAL IDENT SUP   { $1, $4 }
48 ;
49
50 property_list :                         { [] }
51               | property_list property  { $2 :: $1 }
52 ;
53
54 property      : IDENT EQUAL IDENT       { $1, $3 }
55 ;
56