%{ %} %option noyywrap %x MATH ATTRIBUTELIST BRACKETLIST PMBSTRING BBOLD FRAKTUR CALLIGRAPHIC SCRIPT ROMAN VERBTEXT PLAINTEXT PLAINTEXT_CURLY NUM INT1 INT2 INT3 MATHENV SVGENV SVGEND OPTARG ARRAYOPTIONS ENVOPTIONS ALIGNATOPTS COLOPTS ENCLOSEOPTS ENCLOSEATTRPARSE ENCLOSETEXTPARSE SPACEWIDTH SPACEHEIGHT SPACEDEPTH HSPACEARG TEXTOPTARG TEXTOPTARG1 RAISEBOX1 RAISEBOX2 %{ #include #define YYSTYPE char * #include "parser.h" #include "mtex2MML.h" #include "environment.h" #include "string_extras.h" #define YY_NEVER_INTERACTIVE 1 #define YY_INPUT(buffer,result,max_size) result = s_mtex2MML_read (buffer, max_size); #if defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__ || defined __DragonFly__ #undef fileno #endif extern int fileno(FILE *); /* avoids gcc warning */ static int s_mtex2MML_read (char * buffer, int max_size); #define yylval mtex2MML_yylval #define mtex2MML_optarg_depth 100 extern char * yylval; int mtex2MML_lineno = 1; int mtex2MML_inoptarg[mtex2MML_optarg_depth]; int mtex2MML_optarg_ind = 0; int mtex2MML_env_start = 0; int mtex2MML_variant_start = 0; #define YY_USER_ACTION mtex2MML_capture_eqn_src(); #define mtex2MML_eqn_bufsize 131072 char mtex2MML_eqn_src[mtex2MML_eqn_bufsize]; char * mtex2MML_eqn_end = mtex2MML_eqn_src; char mtex2MML_verbdelim; char * mtex2MML_str; int mtex2MML_rowposn = 0; typedef enum {NO_PARSE = 0, OPEN_PARSE, CLOSE_PARSE} parsingEnv; int parsing_environment = NO_PARSE; envType environment_type; /* TODO: I'm not sure what the next option does. My addition of `display_style` is to fix issue776. Probably worth merging these in the future? */ int mtex2MML_displaymode = 0; int display_style = 0; %} %% %{ if (mtex2MML_rowposn==1) mtex2MML_rowposn=0; if (mtex2MML_rowposn==2) mtex2MML_rowposn=1; %} /* "Basic heuristic is: opening $ can't be followed by whitespace, closing $ can't be followed by a digit or preceded by whitespace." -- @jgm, http://bit.ly/1HVtemx */ "$$" if (mtex2MML_delimiter_type(MTEX2MML_DELIMITER_DOUBLE)) {BEGIN(MATH); mtex2MML_inoptarg[0] = 0; mtex2MML_rowposn=2; mtex2MML_displaymode=1; return STARTDMATH; } "$"[\t\r\n ]? if (mtex2MML_delimiter_type(MTEX2MML_DELIMITER_DOLLAR)) {mtex2MML_inoptarg[0] = 0; mtex2MML_rowposn=2; if (yyleng==2) { BEGIN(ENDMATH); return INITIAL;}; BEGIN(MATH); mtex2MML_displaymode=0; return STARTMATH; } "\\(" if (mtex2MML_delimiter_type(MTEX2MML_DELIMITER_PARENS)) {BEGIN(MATH); mtex2MML_inoptarg[0] = 0; mtex2MML_rowposn=2; mtex2MML_displaymode=0; return STARTMATH; } "\\[" if (mtex2MML_delimiter_type(MTEX2MML_DELIMITER_BRACKETS)) {BEGIN(MATH); mtex2MML_inoptarg[0] = 0; mtex2MML_rowposn=2; mtex2MML_displaymode=1; return STARTDMATH; } "\\begin" if (mtex2MML_delimiter_type(MTEX2MML_DELIMITER_ENVIRONMENTS)) {BEGIN(MATHENV); parsing_environment = OPEN_PARSE; mtex2MML_env_start = 1; mtex2MML_inoptarg[0] = 0; mtex2MML_rowposn=2; mtex2MML_displaymode=0; return BEGINENV; } EOF return 0; "\n" {mtex2MML_lineno++; yylval=mtex2MML_copy_string(yytext); return CHAR;} . {yylval=mtex2MML_copy_string(yytext); return CHAR;} { "$"{1,2} if (mtex2MML_delimiter_type(MTEX2MML_DELIMITER_DOLLAR) || mtex2MML_delimiter_type(MTEX2MML_DELIMITER_DOUBLE)) { mtex2MML_eqn_src[mtex2MML_eqn_end-mtex2MML_eqn_src-yyleng]=0; mtex2MML_eqn_end=mtex2MML_eqn_src; yylval=mtex2MML_copy_escaped(mtex2MML_eqn_src); BEGIN(INITIAL); return ENDMATH;} else {yylval=mtex2MML_copy_string("$"); return MI;} "\\)" if (mtex2MML_delimiter_type(MTEX2MML_DELIMITER_PARENS)) {mtex2MML_eqn_src[mtex2MML_eqn_end-mtex2MML_eqn_src-yyleng]=0; mtex2MML_eqn_end=mtex2MML_eqn_src; yylval=mtex2MML_copy_escaped(mtex2MML_eqn_src); BEGIN(INITIAL); return ENDMATH;} "\\]" if (mtex2MML_delimiter_type(MTEX2MML_DELIMITER_BRACKETS)) {mtex2MML_eqn_src[mtex2MML_eqn_end-mtex2MML_eqn_src-yyleng]=0; mtex2MML_eqn_end=mtex2MML_eqn_src; yylval=mtex2MML_copy_escaped(mtex2MML_eqn_src); BEGIN(INITIAL); return ENDMATH;} "\\limits" return LIMITS; "\\nolimits" return NOLIMITS; "^" return SUP; "_" return SUB; "{"[\t\r\n ]*"}" return EMPTYMROW; "\\hline" | "\\hdashline" { /* Ignore */ ;} [^\\]?%.+$ { /* Ignore */ ;} "{" {mtex2MML_rowposn = 2; if(mtex2MML_inoptarg[mtex2MML_optarg_ind] != 0) mtex2MML_inoptarg[mtex2MML_optarg_ind]++; return MROWOPEN;} "}" {if(mtex2MML_inoptarg[mtex2MML_optarg_ind] != 0) mtex2MML_inoptarg[mtex2MML_optarg_ind]--; return MROWCLOSE;} "\\left" mtex2MML_rowposn=2; return LEFT; "\\right" return RIGHT; "\\big" | "\\bigr" {return BIG;} "\\Big" | "\\Bigr" {return BBIG;} "\\bigg" | "\\biggr" {return BIGG;} "\\Bigg" | "\\Biggr" {return BBIGG;} "\\bigl" {return BIGL;} "\\Bigl" {return BBIGL;} "\\biggl" {return BIGGL;} "\\Biggl" {return BBIGGL;} "\\bigm" {return BIGM;} "\\Bigm" {return BBIGM;} "\\biggm" {return BIGGM;} "\\Biggm" {return BBIGGM;} "\\mathrlap" | "\\rlap" {return RLAP;} "\\mathllap" | "\\llap" {return LLAP;} "\\mathclap" | "\\clap" {return CLAP;} "\\ulap" | "\\dlap" {/* Ignore */ ;} "&" | "&" {mtex2MML_rowposn=2; return COLSEP;} "\\&" {yylval=mtex2MML_copy_string("&"); return MI;} "\\$" {yylval=mtex2MML_copy_string("$"); return MI;} "\\%" {yylval=mtex2MML_copy_string("%"); return MI;} "\\\\"[\n\r\t ]*\[[0-9\.]+(em|ex|px|in|cm|mm|mu|pt|pc|%)\] | "\\newline"[\n\r\t ]* | "\\cr"[\n\r\t ]* | "\\\\"[\n\r\t ]* { mtex2MML_rowposn=2; if (mtex2MML_current_env_type(mtex2MML_get_environment_data_stack()) == OTHER) return NEWLINE; return ROWSEP;} [0-9\.,]+(em|ex|px|in|cm|mm|mu|pt|pc|%) {char * normalized_px = mtex2MML_str_replace(yytext, ",", "."); yylval=mtex2MML_copy_string(normalized_px); mtex2MML_free_string(normalized_px); return PXSTRING; } [a-zA-Z] {yylval=mtex2MML_copy_string(yytext); return MI;} [0-9]{1,3}(,[0-9]{3,3})*(\.[0-9]+)? | [0-9]*[\.][0-9]+ | [0-9]+ {yylval=mtex2MML_copy_string(yytext); return MN;} "\\infty" | "\\infinity" {yylval=mtex2MML_copy_string("∞"); return MN;} "(" | "[" {yylval=mtex2MML_copy_string(yytext); return LEFTDELIM;} ")" {yylval=mtex2MML_copy_string(yytext); return RIGHTDELIM;} "]" {if(mtex2MML_inoptarg[mtex2MML_optarg_ind]==1 && mtex2MML_optarg_ind > 0) {mtex2MML_inoptarg[mtex2MML_optarg_ind]=0; mtex2MML_optarg_ind--; return OPTARGCLOSE;} else {yylval=mtex2MML_copy_string(yytext); return RIGHTDELIM;}} "\\" {yylval=mtex2MML_copy_string(" "); return MTEXT;} "\\_" {yylval=mtex2MML_copy_string("_"); return MI;} "\\lbrace" | "\\{" {yylval=mtex2MML_copy_string("{"); return LEFTDELIM;} "\\rbrace" | "\\}" {yylval=mtex2MML_copy_string("}"); return RIGHTDELIM;} "\\vert" | "|" {yylval=mtex2MML_copy_string("|"); return OTHERDELIM;} "\\Vert" | "\\|" {yylval=mtex2MML_copy_string("‖"); return OTHERDELIM;} "\\lbrack" {yylval=mtex2MML_copy_string("["); return LEFTDELIM;} "\\rbrack" {yylval=mtex2MML_copy_string("]"); return RIGHTDELIM;} "\\lVert" {yylval=mtex2MML_copy_string("∥"); return LEFTDELIM;} "\\rVert" {yylval=mtex2MML_copy_string("∥"); return RIGHTDELIM;} "\\lvert" {yylval=mtex2MML_copy_string("∣"); return LEFTDELIM;} "\\rvert" {yylval=mtex2MML_copy_string("∣"); return RIGHTDELIM;} "\\bracevert" {yylval=mtex2MML_copy_string("⎪"); return OTHERDELIM;} "\\setminus" {yylval=mtex2MML_copy_string("∖"); return MO;} "\\backslash" {yylval=mtex2MML_copy_string("\"); return MO;} "\\smallsetminus" {yylval=mtex2MML_copy_string("﹨"); return MOF;} "\\sslash" {yylval=mtex2MML_copy_string("⫽"); return MO;} "\\lfloor" | "\\lceil" | "\\lang" | "\\langle" {yylval=mtex2MML_copy2(yytext, ";"); if (yylval != mtex2MML_empty_string) yylval[0]='&'; return LEFTDELIM;} "\\llangle" {yylval=mtex2MML_copy_string("⟪"); return LEFTDELIM;} "\\lgroup" {yylval=mtex2MML_copy_string("⟮"); return LEFTDELIM;} "\\rfloor" | "\\rceil" | "\\rmoustache" | "\\rang" | "\\rangle" {yylval=mtex2MML_copy2(yytext, ";"); if (yylval != mtex2MML_empty_string) yylval[0]='&'; return RIGHTDELIM;} "\\rrangle" {yylval=mtex2MML_copy_string("⟫"); return RIGHTDELIM;} "\\rgroup" {yylval=mtex2MML_copy_string("⟯"); return RIGHTDELIM;} "/" {yylval=mtex2MML_copy_string(yytext); return OTHERDELIM;} "\\uparrow" | "\\downarrow" | "\\updownarrow" {yylval=mtex2MML_copy2(yytext, ";"); if (yylval != mtex2MML_empty_string) yylval[0]='&'; return OTHERDELIM;} "." {yylval=mtex2MML_copy_string(yytext); return PERIODDELIM;} "-" {if (mtex2MML_rowposn==1) return UNARYMINUS; else {yylval=mtex2MML_copy_string("−"); return MO;}} "+" {if (mtex2MML_rowposn==1) return UNARYPLUS; else {yylval=mtex2MML_copy_string("+"); return MO;}} "\\#" {yylval=mtex2MML_copy_string("#"); return MOL;} "," {yylval=mtex2MML_copy_string(yytext); return COMMADELIM;} ":" | "!" | "=" | "~" | ";" | "?" | "#" | "`" | "@" | "*" {yylval=mtex2MML_copy_string(yytext); return MOL;} "\\prime" {yylval=mtex2MML_copy_string("′"); return MOLL;} "'" {yylval=mtex2MML_copy_string("′"); return MOL;} "''" {yylval=mtex2MML_copy_string("″"); return MOL;} "'''" {yylval=mtex2MML_copy_string("‴"); return MOL;} "''''" {yylval=mtex2MML_copy_string("⁗"); return MOL;} "\\alpha" | "\\beta" | "\\gamma" | "\\delta" | "\\zeta" | "\\eta" | "\\theta" | "\\iota" | "\\kappa" | "\\lambda" | "\\mu" | "\\nu" | "\\xi" | "\\pi" | "\\rho" | "\\sigma" | "\\tau" | "\\upsilon" | "\\chi" | "\\psi" | "\\omega" | "\\backepsilon" | "\\varkappa" | "\\varpi" | "\\varrho" | "\\varsigma" | "\\vartheta" {yylval=mtex2MML_copy2(yytext, ";"); if (yylval != mtex2MML_empty_string) yylval[0]='&'; return MI;} "\\varepsilon" {yylval=mtex2MML_copy_string("ε"); return MI;} "\\phi" {yylval=mtex2MML_copy_string("ϕ"); return MI;} "\\varphi" {yylval=mtex2MML_copy_string("φ"); return MI;} "\\varDelta" {yylval=mtex2MML_copy_string("Δ"); return MI;} "\\varGamma" {yylval=mtex2MML_copy_string("Γ"); return MI;} "\\varLambda" {yylval=mtex2MML_copy_string("Λ"); return MI;} "\\varOmega" {yylval=mtex2MML_copy_string("Ω"); return MI;} "\\varPhi" {yylval=mtex2MML_copy_string("Φ"); return MI;} "\\varPi" {yylval=mtex2MML_copy_string("Π"); return MI;} "\\varPsi" {yylval=mtex2MML_copy_string("Ψ"); return MI;} "\\varSigma" {yylval=mtex2MML_copy_string("Σ"); return MI;} "\\varTheta" {yylval=mtex2MML_copy_string("Θ"); return MI;} "\\varUpsilon" {yylval=mtex2MML_copy_string("Υ"); return MI;} "\\varXi" {yylval=mtex2MML_copy_string("Ξ"); return MI;} "\\arccos" | "\\arcsin" | "\\arctan" | "\\arg" | "\\cos" | "\\cosh" | "\\cot" | "\\coth" | "\\csc" | "\\deg" | "\\dim" | "\\exp" | "\\hom" | "\\ker" | "\\lg" | "\\ln" | "\\log" | "\\sec" | "\\sin" | "\\sinh" | "\\tan" | "\\tanh" {yylval=mtex2MML_copy_string(yytext+1); return MI;} "\\injlim" {yylval=mtex2MML_copy_string("inj lim"); return MO;} "\\projlim" {yylval=mtex2MML_copy_string("proj lim"); return MO;} "\\varinjlim" return VARINJLIM; "\\varliminf" return VARLIMINF; "\\varlimsup" return VARLIMSUP; "\\varprojlim" return VARPROJLIM; "\\det" | "\\gcd" | "\\inf" | "\\lim" | "\\liminf" | "\\limsup" | "\\max" | "\\min" | "\\Pr" | "\\sup" {yylval=mtex2MML_copy_string(yytext+1); return MIB;} "\\omicron" {yylval=mtex2MML_copy_string("ℴ"); return MI;} "\\epsilon" {yylval=mtex2MML_copy_string("ε"); return MI;} "\\cdot" {yylval=mtex2MML_copy_string("⋅"); return MO;} "\\cdotp" {yylval=mtex2MML_copy_string("·"); return MO;} "\\centerdot" {yylval=mtex2MML_copy_string("·"); return MO;} "\\dotsb" | "\\dotsi" | "\\dotsm" {yylval=mtex2MML_copy_string("⋯"); return MI;} "\\ldotp" | "\\dotsc" | "\\dotso" {yylval=mtex2MML_copy_string("…"); return MI;} "\\Alpha" | "\\Beta" | "\\Delta" | "\\Gamma" | "\\digamma" | "\\Lambda" | "\\Pi" | "\\Phi" | "\\Psi" | "\\Sigma" | "\\Theta" | "\\Xi" | "\\Zeta" | "\\Eta" | "\\Iota" | "\\Kappa" | "\\Mu" | "\\Nu" | "\\Rho" | "\\Tau" | "\\mho" | "\\Omega" {yylval=mtex2MML_copy2(yytext, ";"); if (yylval != mtex2MML_empty_string) yylval[0]='&'; return MI;} "\\Upsilon" | "\\Upsi" {yylval=mtex2MML_copy_string("ϒ"); return MI;} "\\iff" | "\\Longleftrightarrow" {yylval=mtex2MML_copy_string("⇔"); return MOL;} "\\longleftrightarrow" {yylval=mtex2MML_copy_string("⟷"); return MOL;} "\\Leftrightarrow" {yylval=mtex2MML_copy_string("⇔"); return MOL;} "\\impliedby" | "\\Leftarrow" {yylval=mtex2MML_copy_string("⇐"); return MOL;} "\\implies" | "\\Rightarrow" {yylval=mtex2MML_copy_string("⇒"); return MOL;} "\\hookleftarrow" {yylval=mtex2MML_copy_string("↩"); return MOL;} "\\embedsin" | "\\hookrightarrow" {yylval=mtex2MML_copy_string("↪"); return MOL;} "\\longleftarrow" {yylval=mtex2MML_copy_string("⟵"); return MOL;} "\\Longleftarrow" {yylval=mtex2MML_copy_string("⟸"); return MOL;} "\\longrightarrow" {yylval=mtex2MML_copy_string("⟶"); return MOL;} "\\Longrightarrow" {yylval=mtex2MML_copy_string("⟹"); return MOL;} "\\leftarrow" {yylval=mtex2MML_copy_string("←"); return MOL;} "\\to" | "\\rightarrow" {yylval=mtex2MML_copy_string("→"); return MOL;} "\\leftrightarrow" {yylval=mtex2MML_copy_string("↔"); return MOL;} "\\mapsto" | "\\map" {yylval=mtex2MML_copy_string("↦"); return MOL;} "\\nearrow" | "\\nearr" {yylval=mtex2MML_copy_string("↗"); return MOL;} "\\nwarrow" | "\\nwarr" {yylval=mtex2MML_copy_string("↖"); return MOL;} "\\searrow" | "\\searr" {yylval=mtex2MML_copy_string("↘"); return MOL;} "\\swarrow" | "\\swarr" {yylval=mtex2MML_copy_string("↙"); return MOL;} "\\neArrow" | "\\neArr" {yylval=mtex2MML_copy_string("⇗"); return MOL;} "\\nwArrow" | "\\nwArr" {yylval=mtex2MML_copy_string("⇖"); return MOL;} "\\seArrow" | "\\seArr" {yylval=mtex2MML_copy_string("⇘"); return MOL;} "\\swArrow" | "\\swArr" {yylval=mtex2MML_copy_string("⇙"); return MOL;} "\\darr" {yylval=mtex2MML_copy_string("↓"); return MOL;} "\\Downarrow" {yylval=mtex2MML_copy_string("⇓"); return MOL;} "\\Arrowvert" {yylval=mtex2MML_copy_string("‖"); return MOL;} "\\arrowvert" {yylval=mtex2MML_copy_string("⏐"); return MOL;} "\\uparr" {yylval=mtex2MML_copy_string("↑"); return MOL;} "\\Uparrow" {yylval=mtex2MML_copy_string("⇑"); return MOL;} "\\downuparrow" | "\\duparr" | "\\updarr" {yylval=mtex2MML_copy_string("↕"); return MOL;} "\\Updownarrow" {yylval=mtex2MML_copy_string("⇕"); return MOL;} "\\leftsquigarrow" {yylval=mtex2MML_copy_string("⇜"); return MOL;} "\\rightsquigarrow" {yylval=mtex2MML_copy_string("⇝"); return MOL;} "\\dashleftarrow" {yylval=mtex2MML_copy_string("⤎"); return MOL;} "\\dashrightarrow" {yylval=mtex2MML_copy_string("⤏"); return MOL;} "\\curvearrowbotright" {yylval=mtex2MML_copy_string("⤻"); return MOL;} "\\righttoleftarrow" {yylval=mtex2MML_copy_string("⟲"); return MOL;} "\\lefttorightarrow" {yylval=mtex2MML_copy_string("⟳"); return MOL;} "\\leftrightsquigarrow" | "\\upuparrows" | "\\rightleftarrows" | "\\rightrightarrows" | "\\curvearrowleft" | "\\curvearrowright" | "\\downdownarrows" | "\\leftarrowtail" | "\\rightarrowtail" | "\\leftleftarrows" | "\\leftrightarrows" | "\\Lleftarrow" | "\\Rrightarrow" | "\\looparrowleft" | "\\looparrowright" | "\\Lsh" | "\\Rsh" | "\\circlearrowleft" | "\\circlearrowright" | "\\twoheadleftarrow" | "\\twoheadrightarrow" | "\\nLeftarrow" | "\\nleftarrow" | "\\nLeftrightarrow" | "\\nleftrightarrow" | "\\nRightarrow" | "\\nrightarrow" | "\\rightharpoonup" | "\\rightharpoondown" | "\\leftharpoonup" | "\\leftharpoondown" | "\\downharpoonleft" | "\\downharpoonright" | "\\leftrightharpoons" | "\\rightleftharpoons" | "\\upharpoonleft" | "\\upharpoonright" {yylval=mtex2MML_copy2(yytext, ";"); if (yylval != mtex2MML_empty_string) yylval[0]='&'; return MOL;} "\\xrightarrow" | "\\xleftarrow" | "\\xleftrightarrow" | "\\xLeftarrow" | "\\xRightarrow" | "\\xLeftrightarrow" | "\\xleftrightharpoons" | "\\xrightleftharpoons" | "\\xhookleftarrow" | "\\xhookrightarrow" | "\\xtwoheadrightarrow" | "\\xtwoheadleftarrow" | "\\xmapsto" {BEGIN(OPTARG); yylval = mtex2MML_copy3("&", yytext+2, ";"); return XARROW;} "\\xlongequal" {BEGIN(OPTARG); yylval=mtex2MML_copy_string("="); return XARROW;} "\\xtofrom" {BEGIN(OPTARG); yylval=mtex2MML_copy_string("⇄"); return XARROW;} "\\dots" | "\\ldots" {yylval=mtex2MML_copy_string("…"); return MI;} "\\cdots" {yylval=mtex2MML_copy_string("⋯"); return MI;} "\\ddots" {yylval=mtex2MML_copy_string("⋱"); return MI;} "\\udots" {yylval=mtex2MML_copy_string("⋰"); return MI;} "\\vdots" {yylval=mtex2MML_copy_string("⋮"); return MI;} "\\colon" {yylval=mtex2MML_copy_string(":"); return MOR;} "\\cup" | "\&union;" | "\\union" {yylval=mtex2MML_copy_string("∪"); return MOL;} "\\bigcup" | "\\Union" | "\⋃" {yylval=mtex2MML_copy_string("⋃"); return MOB;} "\\cap" | "\\intersection" {yylval=mtex2MML_copy_string("∩"); return MOL;} "\\bigcap" | "\\Intersection" {yylval=mtex2MML_copy_string("⋂"); return MOB;} "\\in" {yylval=mtex2MML_copy_string("∈"); return MOL;} /* For some reason, Firefox does not put in the right spacing around some of these operators * unless we ask for it, explicitly. */ "\\coloneqq" {yylval=mtex2MML_copy_string("≔"); return MOL;} "\\Coloneqq" {yylval=mtex2MML_copy_string("⩴"); return MOS;} "\\coloneq" {yylval=mtex2MML_copy_string("∶−"); return MOS;} "\\Coloneq" {yylval=mtex2MML_copy_string("∷−"); return MOS;} "\\eqqcolon" {yylval=mtex2MML_copy_string("≕"); return MOS;} "\\Eqqcolon" {yylval=mtex2MML_copy_string("=∷"); return MOS;} "\\eqcolon" {yylval=mtex2MML_copy_string("∹"); return MOS;} "\\Eqcolon" {yylval=mtex2MML_copy_string("−∷"); return MOS;} "\\colonapprox" {yylval=mtex2MML_copy_string("∶≈"); return MOS;} "\\Colonapprox" {yylval=mtex2MML_copy_string("∷≈"); return MOS;} "\\colonsim" {yylval=mtex2MML_copy_string("∶∼"); return MOS;} "\\Colonsim" {yylval=mtex2MML_copy_string("∷∼"); return MOS;} "\\dblcolon" {yylval=mtex2MML_copy_string("∷"); return MOL;} "\\ast" | "\\Cap" | "\\Cup" | "\\circledast" | "\\circledcirc" | "\\curlyvee" | "\\curlywedge" | "\\divideontimes" | "\\dotplus" | "\\leftthreetimes" | "\\rightthreetimes" | "\\veebar" | "\\gt" | "\\lt" | "\\approxeq" | "\\backsim" | "\\backsimeq" | "\\barwedge" | "\\doublebarwedge" | "\\subset" | "\\subseteq" | "\\subseteqq" | "\\subsetneq" | "\\subsetneqq" | "\\varsubsetneq" | "\\varsubsetneqq" | "\\prec" | "\\parallel" | "\\nparallel" | "\\shortparallel" | "\\nshortparallel" | "\\perp" | "\\eqslantgtr" | "\\eqslantless" | "\\gg" | "\\ggg" | "\\geq" | "\\geqq" | "\\geqslant" | "\\gneq" | "\\gneqq" | "\\gnapprox" | "\\gnsim" | "\\gtrapprox" | "\\ge" | "\\le" | "\\leq" | "\\leqq" | "\\leqslant" | "\\lessapprox" | "\\lessdot" | "\\lesseqgtr" | "\\lesseqqgtr" | "\\lessgtr" | "\\lneq" | "\\lneqq" | "\\lnsim" | "\\lvertneqq" | "\\gtrsim" | "\\gtrdot" | "\\gtreqless" | "\\gtreqqless" | "\\gtrless" | "\\gvertneqq" | "\\lesssim" | "\\lnapprox" | "\\nsubset" | "\\nsubseteq" | "\\nsubseteqq" | "\\notin" | "\\ni" | "\\notni" | "\\nmid" | "\\nshortmid" | "\\preceq" | "\\npreceq" | "\\ll" | "\\ngeq" | "\\ngeqq" | "\\ngeqslant" | "\\nleq" | "\\nleqq" | "\\nleqslant" | "\\nless" | "\\supset" | "\\supseteq" | "\\supseteqq" | "\\supsetneq" | "\\supsetneqq" | "\\varsupsetneq" | "\\varsupsetneqq" | "\\approx" | "\\asymp" | "\\bowtie" | "\\dashv" | "\\Vdash" | "\\vDash" | "\\VDash" | "\\vdash" | "\\Vvdash" | "\\models" | "\\sim" | "\\simeq" | "\\nsim" | "\\smile" | "\\triangle" | "\\triangledown" | "\\triangleleft" | "\\cong" | "\\succ" | "\\nsucc" | "\\ngtr" | "\\nsupset" | "\\nsupseteq" | "\\propto" | "\\equiv" | "\\nequiv" | "\\frown" | "\\triangleright" | "\\ncong" | "\\succeq" | "\\succapprox" | "\\succnapprox" | "\\succcurlyeq" | "\\succsim" | "\\succnsim" | "\\nsucceq" | "\\nvDash" | "\\nvdash" | "\\nVDash" | "\\amalg" | "\\pm" | "\\mp" | "\\bigcirc" | "\\wr" | "\\odot" | "\\uplus" | "\\clubsuit" | "\\spadesuit" | "\\Diamond" | "\\diamond" | "\\sqcup" | "\\sqcap" | "\\sqsubset" | "\\sqsubseteq" | "\\sqsupset" | "\\sqsupseteq" | "\\Subset" | "\\Supset" | "\\ltimes" | "\\div" | "\\rtimes" | "\\bot" | "\\therefore" | "\\thickapprox" | "\\thicksim" | "\\varpropto" | "\\varnothing" | "\\flat" | "\\vee" | "\\because" | "\\between" | "\\Bumpeq" | "\\bumpeq" | "\\circeq" | "\\curlyeqprec" | "\\curlyeqsucc" | "\\doteq" | "\\doteqdot" | "\\eqcirc" | "\\fallingdotseq" | "\\multimap" | "\\pitchfork" | "\\precapprox" | "\\precnapprox" | "\\preccurlyeq" | "\\precsim" | "\\precnsim" | "\\risingdotseq" | "\\sharp" | "\\bullet" | "\\nexists" | "\\dagger" | "\\ddagger" | "\\top" | "\\natural" | "\\angle" | "\\measuredangle" | "\\backprime" | "\\bigstar" | "\\blacklozenge" | "\\lozenge" | "\\blacksquare" | "\\blacktriangle" | "\\blacktriangleleft" | "\\blacktriangleright" | "\\blacktriangledown" | "\\ntriangleleft" | "\\ntriangleright" | "\\ntrianglelefteq" | "\\ntrianglerighteq" | "\\trianglelefteq" | "\\trianglerighteq" | "\\triangleq" | "\\vartriangleleft" | "\\vartriangleright" | "\\forall" | "\\bigtriangleup" | "\\bigtriangledown" | "\\nprec" {yylval=mtex2MML_copy2(yytext, ";"); if (yylval != mtex2MML_empty_string) yylval[0]='&'; return MOL;} "\\textgreater" | ">" {yylval=mtex2MML_copy_string(">"); return MOL;} "\\textless" | "<" {yylval=mtex2MML_copy_string("<"); return MOL;} "≤" {yylval=mtex2MML_copy_string("≤"); return MOL;} "≥" {yylval=mtex2MML_copy_string("≥"); return MOL;} "\\land" {yylval=mtex2MML_copy_string("∧"); return MOL;} "\\lor" {yylval=mtex2MML_copy_string("∨"); return MOL;} "\\surd" {yylval=mtex2MML_copy_string("√"); return MOL;} "\\And" {yylval=mtex2MML_copy_string("&"); return MOL;} "\\checkmark" {yylval=mtex2MML_copy_string("✓"); return MOL;} "\\circledR" {yylval=mtex2MML_copy_string("®"); return MOL;} "\\circledS" {yylval=mtex2MML_copy_string("Ⓢ"); return MOL;} "\\complement" {yylval=mtex2MML_copy_string("∁"); return MOL;} "\\diagdown" {yylval=mtex2MML_copy_string("╲"); return MOL;} "\\diagup" {yylval=mtex2MML_copy_string("╱"); return MOL;} "\\doublecap" {yylval=mtex2MML_copy_string("⋒"); return MOL;} "\\doublecup" {yylval=mtex2MML_copy_string("⋓"); return MOL;} "\\eqsim" {yylval=mtex2MML_copy_string("≂"); return MOL;} "\\Finv" {yylval=mtex2MML_copy_string("Ⅎ"); return MOL;} "\\Game" {yylval=mtex2MML_copy_string("⅁"); return MOL;} "\\gggtr" {yylval=mtex2MML_copy_string("⋙"); return MOL;} "\\gets" {yylval=mtex2MML_copy_string("←"); return MOL;} "\\hslash" {yylval=mtex2MML_copy_string("ℏ"); return MOL;} "\\intop" {yylval=mtex2MML_copy_string("∫"); return MOL;} "\\Join" {yylval=mtex2MML_copy_string("⋈"); return MOL;} "\\leadsto" {yylval=mtex2MML_copy_string("⇝"); return MOL;} "\\llcorner" {yylval=mtex2MML_copy_string("⌞"); return MOL;} "\\lrcorner" {yylval=mtex2MML_copy_string("⌟"); return MOL;} "\\llless" {yylval=mtex2MML_copy_string("⋘"); return MOL;} "\\lmoustache" {yylval=mtex2MML_copy_string("⎰"); return MOL;} "\\lnot" {yylval=mtex2MML_copy_string("¬"); return MOL;} "\\longmapsto" {yylval=mtex2MML_copy_string("⟼"); return MOL;} "\\maltese" {yylval=mtex2MML_copy_string("✠"); return MOL;} "\\nsupseteqq" {yylval=mtex2MML_copy_string("⊉"); return MOL;} "\\nVdash" {yylval=mtex2MML_copy_string("⊮"); return MOL;} "\\owns" {yylval=mtex2MML_copy_string("∋"); return MOL;} "\\precneqq" {yylval=mtex2MML_copy_string("⪵"); return MOL;} "\\restriction" {yylval=mtex2MML_copy_string("↾"); return MOL;} "\\smallint" {yylval=mtex2MML_copy_string("∫"); return MOL;} "\\succneqq" {yylval=mtex2MML_copy_string("⪶"); return MOL;} "\\ulcorner" {yylval=mtex2MML_copy_string("⌜"); return MOL;} "\\urcorner" {yylval=mtex2MML_copy_string("⌝"); return MOL;} "\\vartriangle" {yylval=mtex2MML_copy_string("△"); return MOL;} "\\yen" {yylval=mtex2MML_copy_string("¥"); return MOL;} "\\TeX" {return TEXSYMBOL;} "\\LaTeX" {return LATEXSYMBOL;} "\\aleph" | "\\beth" | "\\gimel" | "\\daleth" | "\\eth" | "\\ell" | "\\hbar" | "\\Im" | "\\imath" | "\\jmath" | "\\wp" | "\\Re" {yylval=mtex2MML_copy2(yytext, ";"); if (yylval != mtex2MML_empty_string) yylval[0]='&'; return MI;} "\\Perp" | "\\Vbar" {yylval=mtex2MML_copy_string("⫫"); return MOL;} "\\boxdot" {yylval=mtex2MML_copy_string("⊡"); return MOL;} "\\Doteq" {yylval=mtex2MML_copy_string("≑"); return MOL;} "\\Box" | "\\square" {yylval=mtex2MML_copy_string("□"); return MOL;} "\\emptyset" | "\\empty" {yylval=mtex2MML_copy_string("∅"); return MI;} "\\exists" {yylval=mtex2MML_copy_string("∃"); return MOL;} "\\circ" {yylval=mtex2MML_copy_string("∘"); return MOL;} "\\rhd" {yylval=mtex2MML_copy_string("⊳"); return MOL;} "\\lhd" {yylval=mtex2MML_copy_string("⊲"); return MOL;} "\\lll" {yylval=mtex2MML_copy_string("⋘"); return MOL;} "\\unrhd" {yylval=mtex2MML_copy_string("⊵"); return MOL;} "\\unlhd" {yylval=mtex2MML_copy_string("⊴"); return MOL;} "\\Del" | "\\nabla" {yylval=mtex2MML_copy_string("∇"); return MOL;} "\\sphericalangle" {yylval=mtex2MML_copy_string("∢"); return MOL;} "\\heartsuit" {yylval=mtex2MML_copy_string("♡"); return MOL;} "\\diamondsuit" {yylval=mtex2MML_copy_string("♢"); return MOL;} "\\partial" {yylval=mtex2MML_copy_string("∂"); return MOL;} "\\qed" {yylval=mtex2MML_copy_string("▪"); return MO;} "\\mod" {yylval=mtex2MML_copy_string("mod"); return MOS;} "\\pmod" {return PMOD;} "\\bmod" {return BMOD;} "\\pod" {return POD;} "\\bottom" {yylval=mtex2MML_copy_string("⊥"); return MOL;} "\\neg" {yylval=mtex2MML_copy_string("¬"); return MOL;} "\\neq" | "\\ne" {yylval=mtex2MML_copy_string("≠"); return MOL;} "\\shortmid" | "\\mid" {yylval=mtex2MML_copy_string("∣"); return MOS;} "\\int" | "\\integral" {yylval=mtex2MML_copy_string("∫"); return MOL;} "\\iint" | "\\doubleintegral" {yylval=mtex2MML_copy_string("∬"); return MOL;} "\\iiint" | "\\tripleintegral" {yylval=mtex2MML_copy_string("∭"); return MOL;} "\\iiiint" | "\\quadrupleintegral" {yylval=mtex2MML_copy_string("⨌"); return MOL;} "\\idotsint" {yylval=mtex2MML_copy_string("∫ ⋯ ∫"); return MOL;} "\\oint" | "\\conint" | "\\contourintegral" {yylval=mtex2MML_copy_string("∮"); return MOL;} "\\times" {yylval=mtex2MML_copy_string("×"); return MOL;} "\\star" {yylval=mtex2MML_copy_string("⋆"); return MOL;} "\\circleddash" | "\\odash" {yylval=mtex2MML_copy_string("⊝"); return MOL;} "\\intercal" {yylval=mtex2MML_copy_string("⊺"); return MOL;} "\\smallfrown" {yylval=mtex2MML_copy_string("⌢"); return MOL;} "\\smallsmile" {yylval=mtex2MML_copy_string("⌣"); return MOL;} "\\boxminus" | "\\minusb" {yylval=mtex2MML_copy_string("⊟"); return MOL;} "\\boxplus" | "\\plusb" {yylval=mtex2MML_copy_string("⊞"); return MOL;} "\\boxtimes" | "\\timesb" {yylval=mtex2MML_copy_string("⊠"); return MOL;} "\\sideset" {return SIDESET;} "\\sum" {yylval=mtex2MML_copy_string("∑"); return MOB;} "\\prod" | "\\product" {yylval=mtex2MML_copy_string("∏"); return MOB;} "\\coprod" | "\\coproduct" {yylval=mtex2MML_copy_string("∐"); return MOB;} "\\otimes" {yylval=mtex2MML_copy_string("⊗"); return MOL;} "\\Otimes" {yylval=mtex2MML_copy_string("⨷"); return MOL;} "\\bigotimes" {yylval=mtex2MML_copy_string("⨂"); return MOL;} "\\ominus" {yylval=mtex2MML_copy_string("⊖"); return MOL;} "\\oslash" {yylval=mtex2MML_copy_string("⊘"); return MOL;} "\\oplus" {yylval=mtex2MML_copy_string("⊕"); return MOL;} "\\Oplus" | "\\bigoplus" {yylval=mtex2MML_copy_string("⨁"); return MOB;} "\\bigodot" {yylval=mtex2MML_copy_string("⨀"); return MOB;} "\\bigsqcup" {yylval=mtex2MML_copy_string("⨆"); return MOB;} "\\bigsqcap" {yylval=mtex2MML_copy_string("⨅"); return MOB;} "\\biginterleave" {yylval=mtex2MML_copy_string("⫼"); return MOB;} "\\biguplus" {yylval=mtex2MML_copy_string("⨄"); return MOB;} "\\wedge" {yylval=mtex2MML_copy_string("∧"); return MOL;} "\\Wedge" | "\\bigwedge" {yylval=mtex2MML_copy_string("⋀"); return MOB;} "\\Vee" | "\\bigvee" {yylval=mtex2MML_copy_string("⋁"); return MOB;} "\\invamp" | "\\parr" {yylval=mtex2MML_copy_string("⅋"); return MOL;} "\\frac" {return FRAC;} "\\tfrac" {return TFRAC;} "\\dfrac" {return DFRAC;} "\\cfrac" {return CFRAC;} "\\genfrac" {return GENFRAC;} "\\binom" {return BINOM;} "\\tbinom" {return TBINOM;} "\\brace" {return BRACE;} "\\brack" {return BRACK;} "\\choose" {return CHOOSE;} "\\dbinom" {return DBINOM;} "\\tensor" {return TENSOR;} "\\multiscripts" {return MULTI;} "\\overbrace" {return OVERBRACE;} "\\overbracket" {return OVERBRACKET;} "\\underbrace" {return UNDERBRACE;} "\\underbracket" {return UNDERBRACKET;} "\\underline" {return UNDERLINE;} "\\underleftarrow" { return UNDERLEFTARROW;} "\\underleftrightarrow" { return UNDERLEFTRIGHTARROW;} "\\underrightarrow" { return UNDERRIGHTARROW;} "\\bar" {return BAR;} "\\overline" | "\\closure" | "\\widebar" {return WIDEBAR;} "\\skew" {return SKEW; } "\\acute" {return ACUTE;} "\\grave" {return GRAVE;} "\\breve" {return BREVE;} "\\mathring" {return MATHRING;} "\\vec" {return VEC;} "\\widevec" {return WIDEVEC;} "\\dot" {return DOT;} "\\ddot" {return DDOT;} "\\dddot" {return DDDOT;} "\\ddddot" {return DDDDOT;} "\\tilde" {return TILDE;} "\\widetilde" {return WIDETILDE;} "\\check" {return CHECK;} "\\widecheck" {return WIDECHECK;} "\\hat" {return HAT;} "\\widehat" {return WIDEHAT;} "\\underset" {return UNDER;} "\\buildrel" {return BUILDREL;} "\\stackrel" | "\\overset" {return OVER;} "\\over" {return TEXOVER;} "\\overwithdelims" {return TEXOVERWITHDELIMS;} "\\atop" {return TEXATOP;} "\\atopwithdelims" {return TEXATOPWITHDELIMS;} "\\above" {return TEXABOVE;} "\\abovewithdelims" {return TEXABOVEWITHDELIMS;} "\\overleftarrow" {return OVERLEFTARROW;} "\\overleftrightarrow" {return OVERLEFTRIGHTARROW;} "\\overrightarrow" {return OVERRIGHTARROW;} "\\underoverset" {return UNDEROVER;} "\\sqrt" {BEGIN(OPTARG); return SQRT;} "\\root" {return ROOT;} "\\leftroot" {BEGIN(NUM); return LEFTROOT;} "\\uproot" {BEGIN(NUM); return UPROOT;} "\\of" {return OF;} "\\text" {BEGIN(PLAINTEXT); return TEXTBOX;} "\\verb"[^ ] {mtex2MML_verbdelim = yytext[yyleng-1]; mtex2MML_str = mtex2MML_copy_string(""); BEGIN(VERBTEXT); return VERBBOX;} "\\statusline" {BEGIN(PLAINTEXT); return STATLINE;} "\\tooltip" {BEGIN(PLAINTEXT); return TOOLTIP;} "\\toggle" {return TOGGLE;} "\\begintoggle" {return TOGGLESTART;} "\\endtoggle" {return TOGGLEEND;} "\\mathraisebox" {BEGIN(RAISEBOX1); return RAISEBOX;} "\\fghilight" | "\\fghighlight" {BEGIN(ATTRIBUTELIST); return FGHIGHLIGHT;} "\\bghilight" | "\\bghighlight" {BEGIN(ATTRIBUTELIST); return BGHIGHLIGHT;} "\\colorbox" {BEGIN(ATTRIBUTELIST); return COLORBOX;} "\\color" {BEGIN(ATTRIBUTELIST); return COLOR;} "\\bgcolor" {BEGIN(ATTRIBUTELIST); return BGCOLOR;} "\\label" {BEGIN(ATTRIBUTELIST); return LABEL;} "\\tag" {BEGIN(ATTRIBUTELIST); return TAG;} "\\bbox" {BEGIN(BRACKETLIST); return BBOX;} "\\displaystyle" {mtex2MML_displaymode=1; mtex2MML_rowposn=2; display_style = 1; return DISPLAY;} "\\textstyle" {mtex2MML_displaymode=0; mtex2MML_rowposn=2; display_style = 0; return TEXTSTY;} "\\textsize" {display_style = 0; return TEXTSIZE;} "\\scriptstyle" {display_style = 0; return SCSTY;} "\\scriptsize" {return SCSIZE;} "\\scriptscriptstyle" | "\\scriptscriptsize" {return SCSCSIZE;} "\\tiny" { return TINY; } "\\Tiny" { return TTINY; } "\\small" { return SMALL; } "\\normalsize" { return NORMALSIZE; } "\\large" { return LARGE; } "\\Large" { return LLARGE; } "\\LARGE" { return LLLARGE; } "\\huge" { return HUGE; } "\\Huge" { return HHUGE; } "\\oldstyle" {return OLDSTYLE;} "\\moveleft" {return MOVELEFT;} "\\moveright" {return MOVERIGHT;} "\\raise" { return RAISE;} "\\lower" {return LOWER;} "\\it" | "\\textit" | "\\mathit" {return ITALICS;} "\\sf" | "\\textsf" | "\\mathsf" {return SANS;} "\\tt" | "\\texttt" | "\\mathtt" {return TT;} "\\boldsymbol" | "\\bf" | "\\textbf" | "\\mathbf" {return BOLD;} "\\rm" | "\\textrm" | "\\mathrm" {BEGIN(ROMAN); return RM;} "\\scr" | "\\mathscr" {BEGIN(SCRIPT); return SCR;} "\\Bbb" | "\\mathbb" {BEGIN(BBOLD); return BB;} "\\frak" | "\\mathfrak" | "\\mathfr" {BEGIN(FRAKTUR); return FRAK;} "\\pmb" {BEGIN(PMBSTRING); return PMB;} "\\not" {return NOT;} "\\cancel" | "\\slash" {return SLASHED;} "\\bcancel" {return BCANCELED;} "\\xcancel" {return XCANCELED;} "\\cancelto" {return CANCELEDTO;} "\\boxed" {return BOXED;} "\\fbox" {return FBOX;} "\\hbox" {return HBOX;} "\\mbox" {return MBOX;} "\\mathopen" {return MATHOPEN;} "\\mathclose" {return MATHCLOSE;} "\\mathord" {return MATHORD;} "\\mathpunct" {return MATHPUNCT;} "\\vcenter" {return VCENTER;} "\\enclose" {BEGIN(ENCLOSEOPTS); return ENCLOSE;} "\\cal" | "\\mathcal" {BEGIN(CALLIGRAPHIC); return CAL;} "\\begin" {mtex2MML_env_start = 1; BEGIN(MATHENV); return BEGINENV;} "\\end" { if (parsing_environment == OPEN_PARSE) parsing_environment = CLOSE_PARSE; environment_type = OTHER; BEGIN(MATHENV); return ENDENV;} "\\notag" | "\\nonumber" { /* ignore, but address in .y */} "\\substack" {return SUBSTACK;} "\\cases" {return CASES;} "\\eqalign" {return EQALIGN;} "\\eqalignno" {return EQALIGNNO;} "\\array" {return ARRAY;} "\\arrayopts" {return ARRAYOPTS;} "\\colalign" {BEGIN(ATTRIBUTELIST); return COLALIGN;} "\\collayout" {BEGIN(ATTRIBUTELIST); return COLLAYOUT;} "\\rowalign" {BEGIN(ATTRIBUTELIST); return ROWALIGN;} "\\align" {BEGIN(ATTRIBUTELIST); return ALIGN;} "\\equalrows" {BEGIN(ATTRIBUTELIST); return EQROWS;} "\\equalcols" {BEGIN(ATTRIBUTELIST); return EQCOLS;} "\\rowlines" {BEGIN(ATTRIBUTELIST); return ROWLINES;} "\\collines" {BEGIN(ATTRIBUTELIST); return COLLINES;} "\\frame" {BEGIN(ATTRIBUTELIST); return FRAME;} "\\padding" {BEGIN(ATTRIBUTELIST); return PADDING;} "\\rowopts" {return ROWOPTS;} "\\cellopts" {return CELLOPTS;} "\\rowspan" {BEGIN(ATTRIBUTELIST); return ROWSPAN;} "\\colspan" {BEGIN(ATTRIBUTELIST); return COLSPAN;} "\\," | "\\thinspace" {return THINSPACE;} "\\:" | "\\>" | "\\medspace" {return MEDSPACE;} "\\;" | "\\thickspace" {return THICKSPACE;} "\\quad" {return QUAD;} "\\qquad" {return QQUAD;} "\\!" | "\\negspace" | "\\negthinspace" {return NEGSPACE;} "\\negmedspace" {return NEGMEDSPACE;} "\\negthickspace" {return NEGTHICKSPACE;} "\\enspace" { return ENSPACE; } "\\hskip" | "\\hspace" | "\\mspace" | "\\kern" | "\\mkern" | "\\mskip" { return HSPACE; } "\\space" | "\\nobreakspace" { yylval=mtex2MML_copy_string(" "); return MTEXT; } "\\strut" {return STRUT;} "\\mathstrut" {return MATHSTRUT;} "\\phantom" {return PHANTOM;} "\\vphantom" {return VPHANTOM;} "\\hphantom" {return HPHANTOM;} "\\smash" {return SMASH;} "\\href" {BEGIN(PLAINTEXT); return HREF;} "\\operatorname" {return OPERATORNAME;} "\\mathop" {return MATHOP;} "\\mathbin" {BEGIN(PLAINTEXT); return MATHBIN;} "\\mathinner" {BEGIN(PLAINTEXT); return MATHINNER;} "\\mathrel" {BEGIN(PLAINTEXT); return MATHREL;} "\\mtexnum" {BEGIN(PLAINTEXT); return MTEXNUM;} "\\Space" { BEGIN(SPACEWIDTH); return SPACECUBE; } "\\includegraphics"(\[[^\]]*\])?\{[^}]*\} ; "\\"[a-zA-Z]+ {yylval=mtex2MML_copy_string(yytext+1); return MOP;} "\&"[a-zA-Z_][a-zA-Z0-9_]*";" | "\&#"[0-9]+";" | "\&#x"[a-fA-F0-9]+";" {yylval=mtex2MML_copy_string(yytext); return MI;} "\n" mtex2MML_lineno++; [\r\t ]+ ; . {return UNKNOWNCHAR;} } "{"[ \t\n\r #a-zA-Z0-9.:\-]*"}" {BEGIN(MATH); yylval=mtex2MML_copy_string(yytext); if (yylval != mtex2MML_empty_string) { yylval[0]='"'; yylval[yyleng-1]='"'; } return ATTRLIST;} { "\[" {return ST;} "\]" {BEGIN(MATH); return END;} [0-9\.,]+(em|ex|px|in|cm|mm|mu|pt|pc|%) {char * normalized_px = mtex2MML_str_replace(yytext, ",", "."); if (normalized_px[0] == '.') mtex2MML_remove_first_char(normalized_px); yylval=mtex2MML_copy_string(normalized_px); mtex2MML_free_string(normalized_px); return PXSTRING; } [0-9a-zA-Z ]+":"[0-9a-zA-Z ]+ {yylval=mtex2MML_copy_string(yytext); return STYLESTRING;} #?[0-9a-zA-Z]+ {yylval=mtex2MML_copy_string(yytext); return COLORSTRING;} [\t\n\r, ]+ ; . {return yytext[0];} } { "[" {if(mtex2MML_optarg_ind < mtex2MML_optarg_depth - 1 && mtex2MML_inoptarg[mtex2MML_optarg_ind] !=1 ){mtex2MML_optarg_ind++; mtex2MML_inoptarg[mtex2MML_optarg_ind]=1;}; BEGIN(MATH); return OPTARGOPEN;} [\n\r\t ]+ ; . {mtex2MML_eqn_src[mtex2MML_eqn_end-mtex2MML_eqn_src]=0; --mtex2MML_eqn_end; BEGIN(MATH); unput(yytext[0]);} } { \{[\n\r\t ]*- {BEGIN(RAISEBOX2); return NEG;} \{[\n\r\t ]* {BEGIN(RAISEBOX2);} } { [^\}]*?\} {yylval=mtex2MML_copy_string(yytext); if ((yyleng > 1) && (yylval != mtex2MML_empty_string)) yylval[yyleng-1]='\0'; BEGIN(TEXTOPTARG1); return TEXTSTRING;} } { \[[^\]]*?\] {yylval=mtex2MML_copy_string(yytext+1); if ((yyleng > 1) && (yylval != mtex2MML_empty_string)) yylval[yyleng-2]='\0'; BEGIN(TEXTOPTARG); return TEXTSTRING;} . {mtex2MML_eqn_src[mtex2MML_eqn_end-mtex2MML_eqn_src]=0; --mtex2MML_eqn_end; BEGIN(MATH); unput(yytext[0]);} } { \[[^\]]*?\] {yylval=mtex2MML_copy_string(yytext+1); if ((yyleng > 1) && (yylval != mtex2MML_empty_string)) yylval[yyleng-2]='\0'; BEGIN(MATH); return TEXTSTRING;} . {mtex2MML_eqn_src[mtex2MML_eqn_end-mtex2MML_eqn_src]=0; --mtex2MML_eqn_end; BEGIN(MATH); unput(yytext[0]);} } { "\{equation\}" { if (parsing_environment == CLOSE_PARSE) { mtex2MML_reset_parsing_environment(); } else { BEGIN(MATH); } return EQUATION;} "\{equation*\}" { if (parsing_environment == CLOSE_PARSE) { mtex2MML_reset_parsing_environment(); } else { BEGIN(MATH); } return EQUATION_STAR;} "\{matrix\}" {if (parsing_environment == CLOSE_PARSE) { mtex2MML_reset_parsing_environment(); } else { BEGIN(MATH); } return MATRIX;} "\{pmatrix\}" {if (parsing_environment == CLOSE_PARSE) { mtex2MML_reset_parsing_environment(); } else { BEGIN(MATH); } return PMATRIX;} "\{bmatrix\}" {if (parsing_environment == CLOSE_PARSE) { mtex2MML_reset_parsing_environment(); } else { BEGIN(MATH); } return BMATRIX;} "\{Bmatrix\}" {if (parsing_environment == CLOSE_PARSE) { mtex2MML_reset_parsing_environment(); } else { BEGIN(MATH); } return BBMATRIX;} "\{vmatrix\}" {if (parsing_environment == CLOSE_PARSE) { mtex2MML_reset_parsing_environment(); } else { BEGIN(MATH); } return VMATRIX;} "\{Vmatrix\}" {if (parsing_environment == CLOSE_PARSE) { mtex2MML_reset_parsing_environment(); } else { BEGIN(MATH); } return VVMATRIX;} "\{smallmatrix\}" {if (parsing_environment == CLOSE_PARSE) { mtex2MML_reset_parsing_environment(); } else { BEGIN(MATH); }; return SMALLMATRIX;} "\{cases\}" {if (parsing_environment == CLOSE_PARSE) { mtex2MML_reset_parsing_environment(); } else { BEGIN(MATH); } return CASES;} "\{aligned\}[" {BEGIN(ENVOPTIONS); return ALIGNED;} "\{aligned\}" {if (parsing_environment == CLOSE_PARSE) { mtex2MML_reset_parsing_environment(); } else { BEGIN(MATH); } return ALIGNED;} "\{align\}" { if (parsing_environment == CLOSE_PARSE) { mtex2MML_reset_parsing_environment(); } else { BEGIN(MATH); } return ALIGNENV;} "\{align*\}" {if (parsing_environment == CLOSE_PARSE) { mtex2MML_reset_parsing_environment(); } else { BEGIN(MATH); } return ALIGNENV_STAR;} "\{alignat\}" {environment_type = ENV_ALIGNAT; if (mtex2MML_env_start == 1) BEGIN(ALIGNATOPTS); else if (parsing_environment == CLOSE_PARSE) { mtex2MML_reset_parsing_environment(); } else { BEGIN(MATH); } return ALIGNAT;} "\{alignat*\}" {environment_type = ENV_ALIGNATSTAR; if (mtex2MML_env_start == 1) BEGIN(ALIGNATOPTS); else if (parsing_environment == CLOSE_PARSE) { mtex2MML_reset_parsing_environment(); } else { BEGIN(MATH); } return ALIGNAT_STAR;} "\{alignedat\}" {if (mtex2MML_env_start == 1) BEGIN(ALIGNATOPTS); else if (parsing_environment == CLOSE_PARSE) { mtex2MML_reset_parsing_environment(); } else { BEGIN(MATH); } return ALIGNEDAT;} "\{eqnarray*\}" {if (parsing_environment == CLOSE_PARSE) { mtex2MML_reset_parsing_environment(); } else { BEGIN(MATH); } return EQNARRAY_STAR;} "\{eqnarray\}" {if (parsing_environment == CLOSE_PARSE) { mtex2MML_reset_parsing_environment(); } else { BEGIN(MATH); } return EQNARRAY;} "\{gather\}" {if (parsing_environment == CLOSE_PARSE) { mtex2MML_reset_parsing_environment(); } else { BEGIN(MATH); } return GATHER;} "\{gather*\}" {if (parsing_environment == CLOSE_PARSE) { mtex2MML_reset_parsing_environment(); } else { BEGIN(MATH); } return GATHER_STAR;} "\{gathered\}[" {BEGIN(ENVOPTIONS); return GATHERED;} "\{gathered\}" {if (parsing_environment == CLOSE_PARSE) { mtex2MML_reset_parsing_environment(); } else { BEGIN(MATH); } return GATHERED;} "\{multline*\}" {if (parsing_environment == CLOSE_PARSE) { mtex2MML_reset_parsing_environment(); } else { BEGIN(MATH); } return MULTLINE_STAR;} "\{multline\}" {if (parsing_environment == CLOSE_PARSE) { mtex2MML_reset_parsing_environment(); } else { BEGIN(MATH); } return MULTLINE;} "\{split\}" {if (parsing_environment == CLOSE_PARSE) { mtex2MML_reset_parsing_environment(); } else { BEGIN(MATH); } return ALIGNED;} "\{array\}" {if (mtex2MML_env_start == 1) BEGIN(ARRAYOPTIONS); else if (parsing_environment == CLOSE_PARSE) { mtex2MML_reset_parsing_environment(); } else { BEGIN(MATH); } return ARRAY;} "\{subarray\}" {if (mtex2MML_env_start == 1) BEGIN(ARRAYOPTIONS); else if (parsing_environment == CLOSE_PARSE) { mtex2MML_reset_parsing_environment(); } else { BEGIN(MATH); } return SUBARRAY;} "\{svg\}" {mtex2MML_env_start = 0; BEGIN(SVGENV); return SVG;} } { "[t]" {yylval=mtex2MML_copy_string("axis 1"); return ARRAYALIGN;} "[c]" {yylval=mtex2MML_copy_string("center"); return ARRAYALIGN;} "[b]" {yylval=mtex2MML_copy_string("axis -1"); return ARRAYALIGN;} "\{" {BEGIN(COLOPTS); return ST;} [\t\n\r ]+ ; } { "\{" { /* Ignore */ } [0-9]+ {yylval=mtex2MML_copy_string(yytext); return ALIGNATVALUE;} "\}" {mtex2MML_env_start = 0; BEGIN(MATH); return END;} [\t\n\r ]+ ; } { "t" {yylval=mtex2MML_copy_string("baseline 1"); return ARRAYALIGN;} "c" {yylval=mtex2MML_copy_string("center"); return ARRAYALIGN;} "b" {yylval=mtex2MML_copy_string("baseline -1"); return ARRAYALIGN;} "]" {mtex2MML_env_start = 0; BEGIN(MATH); return END; } [\t\n\r ]+ ; } { "\}" {mtex2MML_env_start = 0; BEGIN(MATH); return END;} "c" {yylval=mtex2MML_copy_string("center"); return COLUMNALIGN;} "l" {yylval=mtex2MML_copy_string("left"); return COLUMNALIGN;} "r" {yylval=mtex2MML_copy_string("right"); return COLUMNALIGN;} "|" {yylval=mtex2MML_copy_string("s"); return COLUMNALIGN;} ":" {yylval=mtex2MML_copy_string("d"); return COLUMNALIGN;} [\t\n\r ]+ ; } { "\\end\{svg" {mtex2MML_do_capture_eqn(); yylval=mtex2MML_copy_string(yytext); yylval[yyleng-8]=0; BEGIN(SVGEND); return XMLSTRING;} (.|\n) {yymore();} } { "\}" {BEGIN(MATH); return ENDSVG;} } { "\{" {mtex2MML_variant_start = 1; return ST;} "\}" {mtex2MML_variant_start = 0; BEGIN(MATH); return END;} "\\ " {yylval=mtex2MML_copy_string(" "); return RMCHAR;} [^ ] {yylval=mtex2MML_copy_string(yytext); if (mtex2MML_variant_start == 0) BEGIN(MATH); return RMCHAR;} [\t\n\r ]+ ; }