[lasem] [Itex2mml] update to 1.3.15 (10/11/2009).
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [lasem] [Itex2mml] update to 1.3.15 (10/11/2009).
- Date: Mon, 26 Oct 2009 15:56:37 +0000 (UTC)
commit 758953d0804504a538ea02758d281def21aadcd1
Author: Emmanuel Pacaud <emmanuel gnome org>
Date: Mon Oct 26 16:52:39 2009 +0100
[Itex2mml] update to 1.3.15 (10/11/2009).
itex2mml/itex2MML.h | 6 +-
itex2mml/itex2MML.l | 88 +++++++++++++++++++++++++++++++++--------
itex2mml/itex2MML.y | 108 +++++++++++++++++++++++++++++++++++++++-----------
3 files changed, 158 insertions(+), 44 deletions(-)
---
diff --git a/itex2mml/itex2MML.h b/itex2mml/itex2MML.h
index 14a352b..41bfe20 100644
--- a/itex2mml/itex2MML.h
+++ b/itex2mml/itex2MML.h
@@ -1,11 +1,11 @@
-/* itex2MML 1.3.5
- * itex2MML.h last modified 2/29/2008
+/* itex2MML 1.3.15
+ * itex2MML.h last modified 10/11/2009
*/
#ifndef ITEX2MML_H
#define ITEX2MML_H
-#define ITEX2MML_VERSION "1.3.5"
+#define ITEX2MML_VERSION "1.3.15"
#ifdef __cplusplus
extern "C" {
diff --git a/itex2mml/itex2MML.l b/itex2mml/itex2MML.l
index d547dd3..cc63902 100644
--- a/itex2mml/itex2MML.l
+++ b/itex2mml/itex2MML.l
@@ -1,5 +1,5 @@
-/* itex2MML 1.3.6
- * itex2MML.l last modified 9/5/2008
+/* itex2MML 1.3.14
+ * itex2MML.l last modified 10/11/2009
*/
%{
@@ -71,6 +71,9 @@ int itex2MML_displaymode = 0;
"\\biggl" {return BIGGL;}
"\\Biggl" {return BBIGGL;}
+"\\mathrlap" {return RLAP;}
+"\\mathllap" {return LLAP;}
+"\\mathclap" {return CLAP;}
"\\rlap" |
"\\llap" |
"\\ulap" |
@@ -89,7 +92,7 @@ int itex2MML_displaymode = 0;
[a-zA-Z]+ {yylval=itex2MML_copy_string(yytext); return MI;}
-[0-9,.]*[0-9]+ {yylval=itex2MML_copy2(yytext, " "); return MN;}
+[0-9,.]*[0-9]+ {yylval=itex2MML_copy_string(yytext); return MN;}
"\\infty" |
"\\infinity" {yylval=itex2MML_copy_string("∞"); return MN;}
@@ -324,21 +327,45 @@ int itex2MML_displaymode = 0;
"\\leftsquigarrow" {yylval=itex2MML_copy_string("⇜"); return MOL;}
"\\rightsquigarrow" {yylval=itex2MML_copy_string("⇝"); return MOL;}
-"\\leftrightsquigarrow" {yylval=itex2MML_copy_string("↭"); return MOL;}
-"\\upuparrows" {yylval=itex2MML_copy_string("⇈"); return MOL;}
-"\\rightleftarrows" {yylval=itex2MML_copy_string("⇄"); return MOL;}
-"\\rightrightarrows" {yylval=itex2MML_copy_string("⇉"); return MOL;}
"\\dashleftarrow" {yylval=itex2MML_copy_string("⤎"); return MOL;}
"\\dashrightarrow" {yylval=itex2MML_copy_string("⤏"); return MOL;}
-"\\curvearrowleft" {yylval=itex2MML_copy_string("⤺"); return MOL;}
"\\curvearrowbotright" {yylval=itex2MML_copy_string("⤻"); return MOL;}
-"\\downdownarrows" {yylval=itex2MML_copy_string("⇊"); return MOL;}
-"\\leftleftarrows" {yylval=itex2MML_copy_string("⇇"); return MOL;}
-"\\leftrightarrows" {yylval=itex2MML_copy_string("⇆"); return MOL;}
"\\righttoleftarrow" {yylval=itex2MML_copy_string("⟲"); return MOL;}
"\\lefttorightarrow" {yylval=itex2MML_copy_string("⟳"); return MOL;}
-"\\circlearrowleft" {yylval=itex2MML_copy_string("↺"); return MOL;}
-"\\circlearrowright" {yylval=itex2MML_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" |
+"\\downharpoonleft" |
+"\\downharpoonright" |
+"\\leftrightharpoons" |
+"\\rightleftharpoons" |
+"\\upharpoonleft" |
+"\\upharpoonright" {yylval=itex2MML_copy2(yytext, ";"); if (yylval != itex2MML_empty_string) yylval[0]='&'; return MOL;}
+
"\\dots" |
"\\ldots" {yylval=itex2MML_copy_string("…"); return MO;}
@@ -346,6 +373,7 @@ int itex2MML_displaymode = 0;
"\\ddots" {yylval=itex2MML_copy_string("⋱"); return MO;}
"\\udots" {yylval=itex2MML_copy_string("⋰"); return MO;}
"\\vdots" {yylval=itex2MML_copy_string("⋮"); return MO;}
+"\\colon" {yylval=itex2MML_copy_string(":"); return MOR;}
"\\cup" |
"\&union;" |
@@ -363,6 +391,23 @@ int itex2MML_displaymode = 0;
"\\in" {yylval=itex2MML_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=itex2MML_copy_string("≔"); return MOL;}
+"\\Coloneqq" {yylval=itex2MML_copy_string("⩴"); return MOS;}
+"\\coloneq" {yylval=itex2MML_copy_string("∶−"); return MOS;}
+"\\Coloneq" {yylval=itex2MML_copy_string("∷−"); return MOS;}
+"\\eqqcolon" {yylval=itex2MML_copy_string("≕"); return MOS;}
+"\\Eqqcolon" {yylval=itex2MML_copy_string("=∷"); return MOS;}
+"\\eqcolon" {yylval=itex2MML_copy_string("∹"); return MOS;}
+"\\Eqcolon" {yylval=itex2MML_copy_string("−∷"); return MOS;}
+"\\colonapprox" {yylval=itex2MML_copy_string("∶≈"); return MOS;}
+"\\Colonapprox" {yylval=itex2MML_copy_string("∷≈"); return MOS;}
+"\\colonsim" {yylval=itex2MML_copy_string("∶∼"); return MOS;}
+"\\Colonsim" {yylval=itex2MML_copy_string("∷∼"); return MOS;}
+"\\dblcolon" {yylval=itex2MML_copy_string("∷"); return MOL;}
+
"\\gt" |
"\\lt" |
"\\approxeq" |
@@ -654,6 +699,9 @@ int itex2MML_displaymode = 0;
"\\Vee" |
"\\bigvee" {yylval=itex2MML_copy_string("⋁"); return MOB;}
+"\\invamp" |
+"\\parr" {yylval=itex2MML_copy_string("⅋"); return MOL;}
+
"\\frac" {return FRAC;}
"\\tfrac" {return TFRAC;}
@@ -667,6 +715,8 @@ int itex2MML_displaymode = 0;
"\\underbrace" {return UNDERBRACE;}
+"\\underline" {return UNDERLINE;}
+
"\\bar" {return BAR;}
"\\overline" |
"\\closure" |
@@ -676,8 +726,9 @@ int itex2MML_displaymode = 0;
"\\widevec" {return WIDEVEC;}
"\\dot" {return DOT;}
-
"\\ddot" {return DDOT;}
+"\\dddot" {return DDDOT;}
+"\\ddddot" {return DDDDOT;}
"\\tilde" {return TILDE;}
"\\widetilde" {return WIDETILDE;}
@@ -804,8 +855,10 @@ int itex2MML_displaymode = 0;
"\\href" {BEGIN(PLAINTEXT); return HREF;}
-"\\operatorname" |
-"\\mathop" {BEGIN(PLAINTEXT); return MATHOP;}
+"\\operatorname" {BEGIN(PLAINTEXT); return OPERATORNAME;}
+"\\mathop" {BEGIN(PLAINTEXT); return MATHOP;}
+"\\mathbin" {BEGIN(PLAINTEXT); return MATHBIN;}
+"\\mathrel" {BEGIN(PLAINTEXT); return MATHREL;}
"\\includegraphics"(\[[^\]]*\])?\{[^}]*\} ;
@@ -857,6 +910,7 @@ int itex2MML_displaymode = 0;
"\}" {BEGIN(MATH); return END;}
[a-z] {yylval=itex2MML_copy_string(yytext); return BBLOWERCHAR;}
[A-Z] {yylval=itex2MML_copy_string(yytext); return BBUPPERCHAR;}
+[0-9] {yylval=itex2MML_copy_string(yytext); return BBDIGIT;}
[\t\n\r ]+ ;
. {return yytext[0];}
}
@@ -878,7 +932,7 @@ int itex2MML_displaymode = 0;
}
<PLAINTEXT>{
-\{[^\}]*\} {yylval=itex2MML_copy_string(yytext+1); if ((yyleng > 1) && (yylval != itex2MML_empty_string)) yylval[yyleng-2]='\0'; BEGIN(MATH); return TEXTSTRING;}
+\{[^\}]*?\} {yylval=itex2MML_copy_string(yytext+1); if ((yyleng > 1) && (yylval != itex2MML_empty_string)) yylval[yyleng-2]='\0'; BEGIN(MATH); return TEXTSTRING;}
}
<INT1>{
diff --git a/itex2mml/itex2MML.y b/itex2mml/itex2MML.y
index 6993d12..a42d7d8 100644
--- a/itex2mml/itex2MML.y
+++ b/itex2mml/itex2MML.y
@@ -1,5 +1,5 @@
-/* itex2MML 1.3.2
- * itex2MML.y last modified 11/10/2007
+/* itex2MML 1.3.15
+ * itex2MML.y last modified 10/11/2009
*/
%{
@@ -41,9 +41,8 @@
{
if (buffer)
{
- size_t count;
if (length)
- count = fwrite (buffer, 1, length, stdout);
+ fwrite (buffer, 1, length, stdout);
else
fputs (buffer, stdout);
}
@@ -259,6 +258,16 @@
return copy ? copy : itex2MML_empty_string;
}
+ /* Create a hex character reference string corresponding to code
+ */
+ char * itex2MML_character_reference (unsigned long int code)
+ {
+#define ENTITY_LENGTH 10
+ char * entity = (char *) malloc(ENTITY_LENGTH);
+ sprintf(entity, "&#x%05x;", code);
+ return entity;
+ }
+
void itex2MML_free_string (char * str)
{
if (str && str != itex2MML_empty_string)
@@ -268,7 +277,7 @@
%}
%left TEXOVER TEXATOP
-%token CHAR STARTMATH STARTDMATH ENDMATH MI MIB MN MO SUP SUB MROWOPEN MROWCLOSE LEFT RIGHT BIG BBIG BIGG BBIGG BIGL BBIGL BIGGL BBIGGL FRAC TFRAC MATHOP MOP MOL MOLL MOF PERIODDELIM OTHERDELIM LEFTDELIM RIGHTDELIM MOS MOB SQRT ROOT BINOM UNDER OVER OVERBRACE UNDERBRACE UNDEROVER TENSOR MULTI ARRAY COLSEP ROWSEP ARRAYOPTS COLLAYOUT COLALIGN ROWALIGN ALIGN EQROWS EQCOLS ROWLINES COLLINES FRAME PADDING ATTRLIST ITALICS BOLD SLASHED RM BB ST END BBLOWERCHAR BBUPPERCHAR CALCHAR FRAKCHAR CAL FRAK ROWOPTS TEXTSIZE SCSIZE SCSCSIZE DISPLAY TEXTSTY TEXTBOX TEXTSTRING XMLSTRING CELLOPTS ROWSPAN COLSPAN THINSPACE MEDSPACE THICKSPACE QUAD QQUAD NEGSPACE PHANTOM HREF UNKNOWNCHAR EMPTYMROW STATLINE TOGGLE FGHIGHLIGHT BGHIGHLIGHT SPACE INTONE INTTWO INTTHREE BAR WIDEBAR VEC WIDEVEC HAT WIDEHAT CHECK WIDECHECK TILDE WIDETILDE DOT DDOT UNARYMINUS UNARYPLUS BEGINENV ENDENV MATRIX PMATRIX BMATRIX BBMATRIX VMATRIX VVMATRIX SVG ENDSVG SMALLMATRIX CASES ALIGNED GATHERED SUBSTACK PMOD RMCHAR COLOR
BGCOLOR
+%token CHAR STARTMATH STARTDMATH ENDMATH MI MIB MN MO SUP SUB MROWOPEN MROWCLOSE LEFT RIGHT BIG BBIG BIGG BBIGG BIGL BBIGL BIGGL BBIGGL FRAC TFRAC OPERATORNAME MATHOP MATHBIN MATHREL MOP MOL MOLL MOF MOR PERIODDELIM OTHERDELIM LEFTDELIM RIGHTDELIM MOS MOB SQRT ROOT BINOM UNDER OVER OVERBRACE UNDERLINE UNDERBRACE UNDEROVER TENSOR MULTI ARRAY COLSEP ROWSEP ARRAYOPTS COLLAYOUT COLALIGN ROWALIGN ALIGN EQROWS EQCOLS ROWLINES COLLINES FRAME PADDING ATTRLIST ITALICS BOLD SLASHED RM BB ST END BBLOWERCHAR BBUPPERCHAR BBDIGIT CALCHAR FRAKCHAR CAL FRAK CLAP LLAP RLAP ROWOPTS TEXTSIZE SCSIZE SCSCSIZE DISPLAY TEXTSTY TEXTBOX TEXTSTRING XMLSTRING CELLOPTS ROWSPAN COLSPAN THINSPACE MEDSPACE THICKSPACE QUAD QQUAD NEGSPACE PHANTOM HREF UNKNOWNCHAR EMPTYMROW STATLINE TOGGLE FGHIGHLIGHT BGHIGHLIGHT SPACE INTONE INTTWO INTTHREE BAR WIDEBAR VEC WIDEVEC HAT WIDEHAT CHECK WIDECHECK TILDE WIDETILDE DOT DDOT DDDOT DDDDOT UNARYMINUS UNARYPLUS BEGINENV ENDENV MATRIX PMATRIX BMATRIX BBMATRIX VMATRIX VV
MATRIX SVG ENDSVG SMALLMATRIX CASES ALIGNED GATHERED SUBSTACK PMOD RMCHAR COLOR BGCOLOR
%%
@@ -281,7 +290,7 @@ xmlmmlTermList:
| xmlmmlTermList char {/* all proc. in body*/}
| xmlmmlTermList expression {/* all proc. in body*/};
-char: CHAR {};
+char: CHAR {printf("%s", $1);};
expression: STARTMATH ENDMATH {/* empty math group - ignore*/}
| STARTDMATH ENDMATH {/* ditto */}
@@ -527,12 +536,18 @@ closedTerm: array
| hat
| dot
| ddot
+| dddot
+| ddddot
| check
| tilde
| moverbrace
| munderbrace
+| munderline
| munderover
| emptymrow
+| mathclap
+| mathllap
+| mathrlap
| displaystyle
| textstyle
| textsize
@@ -782,10 +797,30 @@ mo: mob
$$ = itex2MML_copy3("<mo lspace=\"0em\" rspace=\"thinmathspace\">", $1, "</mo>");
itex2MML_free_string($1);
}
-| MATHOP TEXTSTRING {
+| MOR {
+ itex2MML_rowposn = 2;
+ $$ = itex2MML_copy3("<mo lspace=\"verythinmathspace\">", $1, "</mo>");
+ itex2MML_free_string($1);
+}
+| OPERATORNAME TEXTSTRING {
itex2MML_rowposn = 2;
$$ = itex2MML_copy3("<mo lspace=\"0em\" rspace=\"thinmathspace\">", $2, "</mo>");
itex2MML_free_string($2);
+}
+| MATHOP TEXTSTRING {
+ itex2MML_rowposn = 2;
+ $$ = itex2MML_copy3("<mo lspace=\"thinmathspace\" rspace=\"thinmathspace\">", $2, "</mo>");
+ itex2MML_free_string($2);
+}
+| MATHBIN TEXTSTRING {
+ itex2MML_rowposn = 2;
+ $$ = itex2MML_copy3("<mo lspace=\"mediummathspace\" rspace=\"mediummathspace\">", $2, "</mo>");
+ itex2MML_free_string($2);
+}
+| MATHREL TEXTSTRING {
+ itex2MML_rowposn = 2;
+ $$ = itex2MML_copy3("<mo lspace=\"thickmathspace\" rspace=\"thickmathspace\">", $2, "</mo>");
+ itex2MML_free_string($2);
};
emptymrow: EMPTYMROW {
@@ -850,6 +885,21 @@ color: COLOR ATTRLIST compoundTermList {
itex2MML_free_string($3);
};
+mathrlap: RLAP closedTerm {
+ $$ = itex2MML_copy3("<mpadded width=\"0\">", $2, "</mpadded>");
+ itex2MML_free_string($2);
+};
+
+mathllap: LLAP closedTerm {
+ $$ = itex2MML_copy3("<mpadded width=\"0\" lspace=\"-100%width\">", $2, "</mpadded>");
+ itex2MML_free_string($2);
+};
+
+mathclap: CLAP closedTerm {
+ $$ = itex2MML_copy3("<mpadded width=\"0\" lspace=\"-50%width\">", $2, "</mpadded>");
+ itex2MML_free_string($2);
+};
+
textstring: TEXTBOX TEXTSTRING {
$$ = itex2MML_copy3("<mtext>", $2, "</mtext>");
itex2MML_free_string($2);
@@ -910,28 +960,35 @@ rmchars: RMCHAR {
itex2MML_free_string($2);
};
-bbold: BB ST bbletters END {
+bbold: BB ST bbchars END {
$$ = itex2MML_copy3("<mi>", $3, "</mi>");
itex2MML_free_string($3);
};
-bbletters: bbletter {
+bbchars: bbchar {
$$ = itex2MML_copy_string($1);
itex2MML_free_string($1);
}
-| bbletters bbletter {
+| bbchars bbchar {
$$ = itex2MML_copy2($1, $2);
itex2MML_free_string($1);
itex2MML_free_string($2);
};
-bbletter: BBLOWERCHAR {
+bbchar: BBLOWERCHAR {
$$ = itex2MML_copy3("&", $1, "opf;");
itex2MML_free_string($1);
}
| BBUPPERCHAR {
$$ = itex2MML_copy3("&", $1, "opf;");
itex2MML_free_string($1);
+}
+| BBDIGIT {
+ /* Blackboard digits 0-9 correspond to Unicode characters 0x1D7D8-0x1D7E1 */
+ char * end = $1 + 1;
+ int code = 0x1D7D8 + strtoul($1, &end, 10);
+ $$ = itex2MML_character_reference(code);
+ itex2MML_free_string($1);
};
frak: FRAK ST frakletters END {
@@ -1156,6 +1213,11 @@ munderbrace: UNDERBRACE closedTerm {
itex2MML_free_string($2);
};
+munderline: UNDERLINE closedTerm {
+ $$ = itex2MML_copy3("<munder>", $2, "<mo>_</mo></munder>");
+ itex2MML_free_string($2);
+};
+
moverbrace: OVERBRACE closedTerm {
$$ = itex2MML_copy3("<mover>", $2, "<mo>⏞</mo></mover>");
itex2MML_free_string($2);
@@ -1189,6 +1251,16 @@ ddot: DDOT closedTerm {
itex2MML_free_string($2);
};
+dddot: DDDOT closedTerm {
+ $$ = itex2MML_copy3("<mover>", $2, "<mo>⃛</mo></mover>");
+ itex2MML_free_string($2);
+};
+
+ddddot: DDDDOT closedTerm {
+ $$ = itex2MML_copy3("<mover>", $2, "<mo>⃜</mo></mover>");
+ itex2MML_free_string($2);
+};
+
tilde: TILDE closedTerm {
$$ = itex2MML_copy3("<mover>", $2, "<mo stretchy=\"false\">˜</mo></mover>");
itex2MML_free_string($2);
@@ -1216,19 +1288,7 @@ hat: HAT closedTerm {
itex2MML_free_string($2);
};
-msqrt: SQRT "[" closedTerm "]" closedTerm {
- if ($2[0] == '[' && $4[0] == ']')
- {
- char * s1 = itex2MML_copy3("<mroot>", $5, $3);
- $$ = itex2MML_copy2(s1, "</mroot>");
- itex2MML_free_string(s1);
- }
- itex2MML_free_string($2);
- itex2MML_free_string($3);
- itex2MML_free_string($4);
- itex2MML_free_string($5);
-}
-| SQRT closedTerm {
+msqrt: SQRT closedTerm {
$$ = itex2MML_copy3("<msqrt>", $2, "</msqrt>");
itex2MML_free_string($2);
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]