Style fixes
[lhc/web/wiklou.git] / math / lexer.mll
index ff871cb..4dd31e0 100644 (file)
@@ -16,6 +16,10 @@ let aboxchars = ['0'-'9' 'a'-'z' 'A'-'Z' '+' '-' '*' ',' '=' '(' ')' ':' '/' ';'
 
 rule token = parse
     space +                    { token lexbuf }
+  | "\\text" space * '{' boxchars + '}'
+                               { Texutil.tex_use_ams (); let str = Lexing.lexeme lexbuf in
+                                 let n = String.index str '{' + 1 in
+                                 BOX ("\\text", String.sub str n (String.length str - n - 1)) }
   | "\\mbox" space * '{' aboxchars + '}'
                                { let str = Lexing.lexeme lexbuf in
                                  let n = String.index str '{' + 1 in
@@ -47,10 +51,13 @@ rule token = parse
   | literal_mn                 { let str = Lexing.lexeme lexbuf in LITERAL (MHTMLABLEC (FONT_RM, str,str,MN,str)) }
   | literal_uf_lt              { let str = Lexing.lexeme lexbuf in LITERAL (HTMLABLEC (FONT_UFH, str,str)) }
   | delimiter_uf_lt            { let str = Lexing.lexeme lexbuf in DELIMITER (HTMLABLEC (FONT_UFH, str,str)) }
+  | "-"                                { let str = Lexing.lexeme lexbuf in LITERAL (MHTMLABLEC (FONT_UFH,"-"," − ",MO,str))}
   | literal_uf_op              { let str = Lexing.lexeme lexbuf in LITERAL (MHTMLABLEC (FONT_UFH, str," "^str^" ",MO,str)) }
   | delimiter_uf_op            { let str = Lexing.lexeme lexbuf in DELIMITER (MHTMLABLEC (FONT_UFH, str," "^str^" ",MO,str)) }
   | "\\" alpha +               { Texutil.find (Lexing.lexeme lexbuf) }
   | "\\sqrt" space * "["       { FUN_AR1opt "\\sqrt" }
+  | "\\xleftarrow" space * "[" { Texutil.tex_use_ams(); FUN_AR1opt "\\xleftarrow" }
+  | "\\xrightarrow" space * "["        { Texutil.tex_use_ams(); FUN_AR1opt "\\xrightarrow" }
   | "\\,"                      { LITERAL (HTMLABLE (FONT_UF, "\\,"," ")) }
   | "\\ "                      { LITERAL (HTMLABLE (FONT_UF, "\\ "," ")) }
   | "\\;"                      { LITERAL (HTMLABLE (FONT_UF, "\\;"," ")) }
@@ -61,6 +68,7 @@ rule token = parse
   | "\\_"                      { LITERAL (HTMLABLEC(FONT_UFH,"\\_","_")) }
   | "\\#"                      { LITERAL (HTMLABLE (FONT_UFH,"\\#","#")) }
   | "\\%"                      { LITERAL (HTMLABLE (FONT_UFH,"\\%","%")) }
+  | "\\$"                      { LITERAL (HTMLABLE (FONT_UFH,"\\$","$")) }
   | "&"                                { NEXT_CELL }
   | "\\\\"                     { NEXT_ROW }
   | "\\begin{matrix}"          { Texutil.tex_use_ams(); BEGIN__MATRIX }
@@ -75,11 +83,20 @@ rule token = parse
   | "\\end{vmatrix}"           { END_VMATRIX }
   | "\\begin{Vmatrix}"         { Texutil.tex_use_ams(); BEGIN_VVMATRIX }
   | "\\end{Vmatrix}"           { END_VVMATRIX }
+  | "\\begin{array}"           { Texutil.tex_use_ams(); BEGIN_ARRAY }
+  | "\\end{array}"             { END_ARRAY }
+  | "\\begin{align}"           { Texutil.tex_use_ams(); BEGIN_ALIGN }
+  | "\\end{align}"             { END_ALIGN }
+  | "\\begin{alignat}"         { Texutil.tex_use_ams(); BEGIN_ALIGNAT }
+  | "\\end{alignat}"           { END_ALIGNAT }
+  | "\\begin{smallmatrix}"     { Texutil.tex_use_ams(); BEGIN_SMALLMATRIX }
+  | "\\end{smallmatrix}"       { END_SMALLMATRIX }
   | "\\begin{cases}"           { Texutil.tex_use_ams(); BEGIN_CASES }
   | "\\end{cases}"             { END_CASES }
   | '>'                                { LITERAL (HTMLABLEC(FONT_UFH,">"," > ")) }
   | '<'                                { LITERAL (HTMLABLEC(FONT_UFH,"<"," &lt; ")) }
   | '%'                                { LITERAL (HTMLABLEC(FONT_UFH,"\\%","%")) }
+  | '$'                                { LITERAL (HTMLABLEC(FONT_UFH,"\\$","$")) }
   | '~'                                { LITERAL (HTMLABLE (FONT_UF, "~","&nbsp;")) }
   | '['                                { DELIMITER (HTMLABLEC(FONT_UFH,"[","[")) }
   | ']'                                { SQ_CLOSE }