%token <int> NUM
%token <string> TEXT
-%token NAME TABLE CSS SR OC CC OB CB PS EOF
+%token SPACE NAME TABLE CSS SR OC CC OB CB PS OP CP AT EOF
%start script
-%type <(string * Table.table * Css.atoms) list> script
+%type <(string * string) list * (string * Table.table * Css.atoms) list> script
%%
+space:
+ | SPACE TEXT TEXT { $2, $3 }
+;
+
+spaces:
+ | { [] }
+ | space spaces { $1 :: $2 }
+;
+
text:
- | TEXT { $1 }
+ | TEXT { T.Plain $1 }
+ | AT OP TEXT TEXT CP { T.Link ($3, $4) }
+;
texts:
| text { [$1] }
| name TABLE table atoms { $1, $3, $4 }
;
+directives:
+ | { [] }
+ | directive directives { $1 :: $2 }
+;
+
script:
- | EOF { [] }
- | directive script { $1 :: $2 }
+ | spaces directives EOF { $1, $2 }
;