/itexToMML

To download this project, use:
bzr branch http://golem.ph.utexas.edu/~distler/code/itexToMML/

« back to all changes in this revision

Viewing changes to itex-src/itex2MML.y

  • Committer: Jacques Distler
  • Date: 2010-09-12 06:24:52 UTC
  • Revision ID: distler@golem.ph.utexas.edu-20100912062452-xei1zzwqn7diesv0
Tags: 1.4.2
Extensible Arrows (Again)

Fixed a bug in the optional argument parsing.
Also recognize when the mandatory argument is blank,
and emit an <munder> element instead of <munderover>.

Show diffs side-by-side

added added

removed removed

1
 
/*             itex2MML 1.4.0
2
 
 *   itex2MML.y last modified 9/7/2010
 
1
/*             itex2MML 1.4.2
 
2
 *   itex2MML.y last modified 9/12/2010
3
3
 */
4
4
 
5
5
%{
825
825
  itex2MML_free_string($2);
826
826
};
827
827
 
828
 
emptymrow: EMPTYMROW {
829
 
  $$ = itex2MML_copy_string("<mrow></mrow>");
830
 
};
831
 
 
832
828
space: SPACE ST INTONE END ST INTTWO END ST INTTHREE END {
833
829
  char * s1 = itex2MML_copy3("<mspace height=\"", $3, "ex\" depth=\"");
834
830
  char * s2 = itex2MML_copy3($6, "ex\" width=\"", $9);
1316
1312
  itex2MML_free_string($3);
1317
1313
};
1318
1314
 
1319
 
munder: UNDER closedTerm closedTerm {
 
1315
munder: XARROW OPTARGOPEN compoundTermList OPTARGCLOSE EMPTYMROW {
 
1316
  char * s1 = itex2MML_copy3("<munder><mrow>", $3, "</mrow>");
 
1317
  $$ = itex2MML_copy3(s1, $1, "</munder>");
 
1318
  itex2MML_free_string(s1);
 
1319
  itex2MML_free_string($1);
 
1320
  itex2MML_free_string($3);
 
1321
}
 
1322
| UNDER closedTerm closedTerm {
1320
1323
  char * s1 = itex2MML_copy3("<munder>", $3, $2);
1321
1324
  $$ = itex2MML_copy2(s1, "</munder>");
1322
1325
  itex2MML_free_string(s1);
1339
1342
  itex2MML_free_string($3);
1340
1343
};
1341
1344
 
1342
 
munderover: XARROW OPTARGOPEN closedTerm OPTARGCLOSE closedTerm {
1343
 
  char * s1 = itex2MML_copy3("<munderover><mo>", $1, "</mo>");
1344
 
  char * s2 = itex2MML_copy3(s1, $3, $5);
1345
 
  $$ = itex2MML_copy2(s2, "</munderover>");
 
1345
munderover: XARROW OPTARGOPEN compoundTermList OPTARGCLOSE closedTerm {
 
1346
  char * s1 = itex2MML_copy3("<munderover><mo>", $1, "</mo><mrow>");
 
1347
  char * s2 = itex2MML_copy3(s1, $3, "</mrow>");
 
1348
  $$ = itex2MML_copy3(s2, $5, "</munderover>");
1346
1349
  itex2MML_free_string(s1);
1347
1350
  itex2MML_free_string(s2);
1348
1351
  itex2MML_free_string($1);
1358
1361
  itex2MML_free_string($4);
1359
1362
};
1360
1363
 
 
1364
emptymrow: EMPTYMROW {
 
1365
  $$ = itex2MML_copy_string("<mrow></mrow>");
 
1366
};
 
1367
 
1361
1368
mathenv: BEGINENV MATRIX tableRowList ENDENV MATRIX {
1362
1369
  $$ = itex2MML_copy3("<mrow><mtable rowspacing=\"0.5ex\">", $3, "</mtable></mrow>");
1363
1370
  itex2MML_free_string($3);