/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.l

  • Committer: Jacques Distler
  • Date: 2013-12-08 16:55:17 UTC
  • Revision ID: distler@golem.ph.utexas.edu-20131208165517-vvk8ranvb352nqzt
itex2MML 1.5.0beta4

Fix bug in equation capture during
optarg parsing.
Thanks to Frederic Wang for reporting
the bug.

Show diffs side-by-side

added added

removed removed

31
31
 
32
32
#define YY_USER_ACTION itex2MML_capture_eqn_src();
33
33
# define itex2MML_eqn_bufsize 131072
34
 
char itex2MML_eqn_src[itex2MML_eqn_bufsize];
35
 
char * itex2MML_eqn_end = itex2MML_eqn_src;
 
34
char itex2MML_eqn_buffer[itex2MML_eqn_bufsize];
 
35
char * itex2MML_eqn_src = itex2MML_eqn_buffer;
 
36
char * itex2MML_eqn_end = itex2MML_eqn_buffer;
36
37
 
37
38
int itex2MML_rowposn = 0;
38
39
int itex2MML_displaymode = 0;
55
56
 
56
57
 
57
58
"$"{1,2} |
58
 
"\\]"           {itex2MML_eqn_src[itex2MML_eqn_end-itex2MML_eqn_src-yyleng]=0; itex2MML_eqn_end=itex2MML_eqn_src; yylval=itex2MML_copy_escaped(itex2MML_eqn_src); BEGIN(INITIAL); return ENDMATH;}
 
59
"\\]"           {itex2MML_eqn_buffer[itex2MML_eqn_end-itex2MML_eqn_src-yyleng]=0; itex2MML_eqn_end=itex2MML_eqn_buffer; yylval=itex2MML_copy_escaped(itex2MML_eqn_src); BEGIN(INITIAL); return ENDMATH;}
59
60
 
60
61
 
61
62
"^"            return SUP;
952
953
<OPTARG>{
953
954
"[" {if(itex2MML_optarg_ind < itex2MML_optarg_depth - 1 && itex2MML_inoptarg[itex2MML_optarg_ind] !=1 ){itex2MML_optarg_ind++; itex2MML_inoptarg[itex2MML_optarg_ind]=1;}; BEGIN(MATH); return OPTARGOPEN;}
954
955
[\n\r\t ]+    ;
955
 
.   {itex2MML_eqn_src[itex2MML_eqn_end-itex2MML_eqn_src]=0; --itex2MML_eqn_end; BEGIN(MATH); unput(yytext[0]);}
 
956
.   {itex2MML_eqn_buffer[itex2MML_eqn_end-itex2MML_eqn_src]=0; --itex2MML_eqn_end; BEGIN(MATH); unput(yytext[0]);}
956
957
}
957
958
 
958
959
<RAISEBOX1>{
967
968
 
968
969
<TEXTOPTARG1>{
969
970
\[[^\]]*?\] {yylval=itex2MML_copy_string(yytext+1); if ((yyleng > 1) && (yylval != itex2MML_empty_string)) yylval[yyleng-2]='\0'; BEGIN(TEXTOPTARG); return TEXTSTRING;}
970
 
. {itex2MML_eqn_src[itex2MML_eqn_end-itex2MML_eqn_src]=0; --itex2MML_eqn_end; BEGIN(MATH); unput(yytext[0]);}
 
971
. {itex2MML_eqn_buffer[itex2MML_eqn_end-itex2MML_eqn_src]=0; --itex2MML_eqn_end; BEGIN(MATH); unput(yytext[0]);}
971
972
}
972
973
 
973
974
<TEXTOPTARG>{
974
975
\[[^\]]*?\] {yylval=itex2MML_copy_string(yytext+1); if ((yyleng > 1) && (yylval != itex2MML_empty_string)) yylval[yyleng-2]='\0'; BEGIN(MATH); return TEXTSTRING;}
975
 
. {itex2MML_eqn_src[itex2MML_eqn_end-itex2MML_eqn_src]=0; --itex2MML_eqn_end; BEGIN(MATH); unput(yytext[0]);}
 
976
. {itex2MML_eqn_buffer[itex2MML_eqn_end-itex2MML_eqn_src]=0; --itex2MML_eqn_end; BEGIN(MATH); unput(yytext[0]);}
976
977
}
977
978
 
978
979
<MATHENV>{