]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/www/lambdadelta/bin/xhtbl/textParser.mly
- we begin the new site based on ld_web
[helm.git] / helm / www / lambdadelta / bin / xhtbl / textParser.mly
index 333d3421f2fa27a3f0c89db7f395266ebe793ee0..3864bc53c05ec6087b2a0c2fdc1da50c03d39a4b 100644 (file)
@@ -15,15 +15,26 @@ let mk_atom s rs =
 
 %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]     }
@@ -89,7 +100,11 @@ directive:
    | name TABLE table atoms { $1, $3, $4 }
 ;
 
+directives:
+   |                      { []       }
+   | directive directives { $1 :: $2 }
+;
+
 script:
-   | EOF              { []       }
-   | directive script { $1 :: $2 }
+   | spaces directives EOF { $1, $2 }
 ;