version 1.7, 2001/01/30 21:03:25
|
version 1.11, 2001/11/21 18:48:05
|
Line 119 Symbol *FmlSymbLast_p;
|
Line 119 Symbol *FmlSymbLast_p;
|
int FmlSymb_cnt; |
int FmlSymb_cnt; |
int Symb_count; |
int Symb_count; |
|
|
int IFstatus[MAX_FUNC_NEST]; /* <-- perhaps we can use linked list */ |
|
int IFcurrent[MAX_FUNC_NEST]; /* <-- perhaps we can use linked list */ |
|
int IFcount; |
int IFcount; |
WhileLoop_t WhileStack[MAX_FUNC_NEST]; /* <-- perhaps we can use linked list */ |
WhileLoop_t WhileStack[MAX_FUNC_NEST]; /* <-- perhaps we can use linked list */ |
int While_idx, Wcount; |
int While_idx, Wcount; |
|
int sccount; /* Semi-colon count for MAP and RMAP */ |
|
|
#ifdef USE_DYNAMIC_SYMBOLS |
#ifdef USE_DYNAMIC_SYMBOLS |
Symbol *SymbList_p; |
Symbol *SymbList_p; |
Line 361 EndLine ([\r][\n]|[\n])
|
Line 360 EndLine ([\r][\n]|[\n])
|
%n 1000 |
%n 1000 |
%x S_COMMENT S_HINT S_HINTEXLAINX S_IMPORT S_EXPLAIN S_ENDX S_UNIT S_IGNORE |
%x S_COMMENT S_HINT S_HINTEXLAINX S_IMPORT S_EXPLAIN S_ENDX S_UNIT S_IGNORE |
%x S_SKIP S_VARIABLE S_LET S_DEFINE S_TEXT S_MAP S_FIGURE S_ANSWER |
%x S_SKIP S_VARIABLE S_LET S_DEFINE S_TEXT S_MAP S_FIGURE S_ANSWER |
%x S_STRING S_ANSCONTINUE S_TRUE_FALSE_STMT S_IF_SKIP S_WHILE_SKIP |
%x S_STRING S_ANSCONTINUE S_TRUE_FALSE_STMT S_WHILE_SKIP |
%x S_NEXT_LINE S_VERB S_ECHO S_STRINGINANS |
%x S_NEXT_LINE S_VERB S_ECHO S_STRINGINANS |
%array |
%array |
|
|
Line 401 EndLine ([\r][\n]|[\n])
|
Line 400 EndLine ([\r][\n]|[\n])
|
send("<PRE>\n"); |
send("<PRE>\n"); |
} |
} |
^{Spaces}"/HIN"{Alpha}*{Spaces} { LLDBUG_PRL1("[HIN]"); |
^{Spaces}"/HIN"{Alpha}*{Spaces} { LLDBUG_PRL1("[HIN]"); |
start_mode(MODE_BLOCK, |
start_mode(MODE_HINT, ""); |
"condition=\"&hinton\""); |
|
BEGIN S_HINT; |
BEGIN S_HINT; |
} |
} |
^{Spaces}"/EXP"{Alpha}*{Spaces} { start_mode(MODE_BLOCK,"condition=&explanation"); |
^{Spaces}"/EXP"{Alpha}*{Spaces} { start_mode(MODE_BLOCK,"condition=&explanation"); |
Line 436 EndLine ([\r][\n]|[\n])
|
Line 434 EndLine ([\r][\n]|[\n])
|
BEGIN S_ANSWER; |
BEGIN S_ANSWER; |
end_mode(); |
end_mode(); |
start_mode(MODE_ANSWER,NULL); |
start_mode(MODE_ANSWER,NULL); |
send("<caparesponse answer=\""); |
send("<numericalresponse answer=\""); |
dosend=1; |
dosend=1; |
firstparam=1; |
firstparam=1; |
} |
} |
Line 444 EndLine ([\r][\n]|[\n])
|
Line 442 EndLine ([\r][\n]|[\n])
|
Pcount = 0; |
Pcount = 0; |
BEGIN S_ANSWER; |
BEGIN S_ANSWER; |
end_mode(); |
end_mode(); |
|
start_mode(MODE_ANSWER,NULL); |
send("<capasubjectiveresponse"); |
send("<capasubjectiveresponse"); |
dosend=1; |
dosend=1; |
firstparam=1; |
firstparam=1; |
} |
} |
^{Spaces}"/MAP" { LLDBUG_PRL1("[MAP]"); Pcount = 0; BEGIN S_MAP; start_mode(MODE_SCRIPT,NULL);send("&map("); } |
^{Spaces}"/MAP" { LLDBUG_PRL1("[MAP]"); Pcount = 0; sccount = 0; BEGIN S_MAP; start_mode(MODE_SCRIPT,NULL);send("&map("); } |
^{Spaces}"/RMAP" { LLDBUG_PRL1("[RMAP]"); Pcount = 0; BEGIN S_MAP; start_mode(MODE_SCRIPT,NULL);send("&rmap("); } |
^{Spaces}"/RMAP" { LLDBUG_PRL1("[RMAP]"); Pcount = 0; sccount = 0; BEGIN S_MAP; start_mode(MODE_SCRIPT,NULL);send("&rmap("); } |
^{Spaces}"/ENDWHILE"([^\n])* { long int file_pos; |
^{Spaces}"/ENDWHILE"([^\n])* { long int file_pos; |
int top_item, input_idx; |
int top_item, input_idx; |
LLDBUG_PRL2("[ENDWHILE While_idx=<%d>]\n",While_idx); |
LLDBUG_PRL2("[ENDWHILE While_idx=<%d>]\n",While_idx); |
Line 485 EndLine ([\r][\n]|[\n])
|
Line 484 EndLine ([\r][\n]|[\n])
|
BEGIN S_TRUE_FALSE_STMT; RETURN(CAPA_WHILE); |
BEGIN S_TRUE_FALSE_STMT; RETURN(CAPA_WHILE); |
|
|
} |
} |
^{Spaces}"/IF" { IFcount++; IFcurrent[IFcount] = RUN_IF_PORTION; |
^{Spaces}"/IF" { int i; |
LLDBUG_PRL2("[IF <IFcount=%d>]",IFcount); BEGIN S_TRUE_FALSE_STMT; RETURN(CAPA_IF); } |
IFcount++; |
^{Spaces}"/ELSE"([^\n])* { LLDBUG_PRL2("[ELSE <IFcount=%d>]\n",IFcount); |
LLDBUG_PRL2("[IF <IFcount=%d>]",IFcount); |
IFcurrent[IFcount] = RUN_ELSE_PORTION; |
BEGIN S_TRUE_FALSE_STMT; |
if( IFstatus[IFcount] == IF_TRUE ) { |
if ( IFcount == 1) { |
LLDBUG_PRL1("[ELSE begin Skip]\n"); |
start_streams(2); |
BEGIN S_IF_SKIP; |
watch_mode[1]=1; |
} |
} |
} |
end_mode_stream(0); |
^{Spaces}"/ENDIF"([^\n])* { IFcount--; LLDBUG_PRL2("[ENDIF <IFcount=%d>]\n",IFcount); |
start_mode_stream(1,MODE_SCRIPT,NULL); |
|
for(i=1;i<IFcount;i++) {send("\t",NULL);} |
|
send_stream(0,"<block condition=\"",NULL); |
|
send_stream(1,"if (",NULL); |
|
new_cache(); |
|
start_cache(); |
|
} |
|
^{Spaces}"/ELSE"([^\n])* { int i; |
|
LLDBUG_PRL2("[ELSE <IFcount=%d>]\n",IFcount); |
|
end_mode_stream(0); |
|
for(i=1;i<IFcount;i++) {send("\t",NULL);} |
|
send_stream(0, |
|
"</block>\n<block condition=\"!(%s)\">", |
|
cached_data[current_cache].str); |
|
send_stream(1,"} else {"); |
|
} |
|
^{Spaces}"/ENDIF"([^\n])* { int i; |
|
IFcount--; |
|
end_mode_stream(0); |
|
for(i=0;i<IFcount;i++) {send("\t",NULL);} |
|
send_stream(0,"</block>"); |
|
send_stream(1,"}"); |
|
if (IFcount == 0) { |
|
if (watch_mode[1]) { |
|
end_streams(1); |
|
} else { |
|
end_streams(0); |
|
} |
|
} |
|
delete_cache(); |
|
LLDBUG_PRL2("[ENDIF <IFcount=%d>]\n",IFcount); |
} |
} |
"/AND" { LLDBUG_PRL1("[AND]"); BEGIN S_ANSCONTINUE; RETURN(ANS_AND); } |
"/AND" { LLDBUG_PRL1("[AND]"); /*implict in LON-CAPA*/} |
"/DIS" { /* since S_VARIABLE treat {Space} as null, so here we do not match ( */ |
"/DIS" { /* since S_VARIABLE treat {Space} as null, so here we do not match ( */ |
/* so that between /DIS and ( can have as many {Space} as we want */ |
/* so that between /DIS and ( can have as many {Space} as we want */ |
LLDBUG_PR1("[DIS<]"); |
LLDBUG_PR1("[DIS<]"); |
Line 629 EndLine ([\r][\n]|[\n])
|
Line 658 EndLine ([\r][\n]|[\n])
|
<S_HINT,S_EXPLAIN>{ |
<S_HINT,S_EXPLAIN>{ |
[/][Dd][Ii][Ss]{Space}*[\(]{Space}* { yy_push_state(S_HINTEXLAINX); } |
[/][Dd][Ii][Ss]{Space}*[\(]{Space}* { yy_push_state(S_HINTEXLAINX); } |
[^/\n]+[/\\] { char *aptr = yytext; |
[^/\n]+[/\\] { char *aptr = yytext; |
int ii; |
|
|
|
yyless(yyleng-1); |
yyless(yyleng-1); |
send(aptr); |
send(aptr); |
} |
} |
Line 638 EndLine ([\r][\n]|[\n])
|
Line 665 EndLine ([\r][\n]|[\n])
|
[\\] { send("\\"); } |
[\\] { send("\\"); } |
[\\]{Space}*[\n] { LLDBUG_PR1("[\\CR hint explain continue]"); /* Hint and explain continuation */ } |
[\\]{Space}*[\n] { LLDBUG_PR1("[\\CR hint explain continue]"); /* Hint and explain continuation */ } |
[^/\n\\]+$ {char *aptr = yytext; |
[^/\n\\]+$ {char *aptr = yytext; |
int ii; |
send(aptr); |
send(aptr); |
|
} |
} |
} |
} |
<S_HINT>{ |
<S_HINT>{ |
Line 656 EndLine ([\r][\n]|[\n])
|
Line 682 EndLine ([\r][\n]|[\n])
|
} |
} |
|
|
<S_HINTEXLAINX>{ |
<S_HINTEXLAINX>{ |
{Alpha}{AlphaNum}* { char *aptr; |
{Alpha}{AlphaNum}* {send("${%s}",yytext);} |
char tmp_str[QUARTER_K],warn_msg[ONE_K]; |
|
int ii, len; |
|
Symbol *tmp_p; |
|
|
|
/*tmp_p = find_identifier(yytext);*/ |
|
switch(tmp_p->s_type) { |
|
case IDENTIFIER: |
|
sprintf(warn_msg,"var %s not defined.\n", yytext); |
|
capa_msg(MESSAGE_ERROR,warn_msg); |
|
break; |
|
case I_VAR: |
|
case I_CONSTANT: |
|
sprintf(tmp_str,"%ld",tmp_p->s_int); |
|
len = strlen(tmp_str); |
|
for(ii=0;ii< len;ii++) { |
|
*Current_char_p++ = tmp_str[ii]; |
|
} |
|
break; |
|
case R_VAR: |
|
case R_CONSTANT: |
|
sprintf(tmp_str,"%g",tmp_p->s_real); |
|
len = strlen(tmp_str); |
|
for(ii=0;ii< len;ii++) { |
|
*Current_char_p++ = tmp_str[ii]; |
|
} |
|
break; |
|
case S_VAR: |
|
case S_CONSTANT: |
|
len = strlen(tmp_p->s_str); |
|
aptr = tmp_p->s_str; |
|
for(ii=0;ii< len;ii++) { |
|
*Current_char_p++ = *aptr++; |
|
} |
|
break; |
|
} |
|
printf("FIXME!Hint: %s\n",yytext); |
|
} |
|
{Space}+ { } |
{Space}+ { } |
[)] { yy_pop_state(); } |
[)] { yy_pop_state(); } |
} |
} |
|
|
<S_IMPORT>{ |
<S_IMPORT>{ |
{FileName}{Space}* { end_mode();send("<import>/res/capa/%s</import>\n",yytext); BEGIN S_SKIP; } |
{FileName}{Space}* { char *endquote; |
{Identifier}{Space}* { end_mode();send("<import>$%s</import>\n",yytext); BEGIN S_SKIP; } |
end_mode(); |
|
start_mode(MODE_IMPORT,NULL); |
|
endquote = strrchr(yytext,'\"'); |
|
*endquote = '\0'; |
|
if (yytext[1] == '/') { |
|
send("%s%s",import_prefix,&yytext[1]); |
|
} else { |
|
send("%s",&yytext[1]); |
|
} |
|
} |
|
{Identifier}{Space}* { end_mode(); |
|
start_mode(MODE_IMPORT,NULL); |
|
send("$%s",yytext); |
|
} |
|
{Space}+ { } |
|
{EndLine} {end_mode(); BEGIN S_TEXT;} |
|
|
} |
} |
|
|
<S_ANSWER>{ |
<S_ANSWER>{ |
Line 722 EndLine ([\r][\n]|[\n])
|
Line 727 EndLine ([\r][\n]|[\n])
|
[,=] { LLDBUG_PR2("[symbol(%s)]",yytext);} |
[,=] { LLDBUG_PR2("[symbol(%s)]",yytext);} |
[%] { LLDBUG_PR2("[symbol(%s)]",yytext); |
[%] { LLDBUG_PR2("[symbol(%s)]",yytext); |
if (dosend==1) send("%s",yytext); |
if (dosend==1) send("%s",yytext); |
if (dosend==2) add_delayed("%s",yytext); |
if (dosend==2) add_delayed("%%%s",yytext); |
} |
} |
[:@#-] { LLDBUG_PR2("[symbol(%s)]",yytext); |
[:@#-] { LLDBUG_PR2("[symbol(%s)]",yytext); |
if (dosend==1) send("%s",yytext); |
if (dosend==1) send("%s",yytext); |
Line 738 EndLine ([\r][\n]|[\n])
|
Line 743 EndLine ([\r][\n]|[\n])
|
} |
} |
|
|
[Pp][Cc][Rr] | |
[Pp][Cc][Rr] | |
[Hh][Gg][Rr] { if (firstparam) firstparam=0; else add_delayed("\"></responseparam>\n\t"); |
[Hh][Gg][Rr] { if (firstparam) { |
add_delayed("<responseparam type=\"hgr\" value=\"on|off\" default=\""); |
firstparam=0; |
|
} else { |
|
add_delayed("\" />\n\t"); |
|
} |
|
add_delayed("<responseparam name=\"hgr\" type=\"on|off\" default=\""); |
dosend=2; |
dosend=2; |
} |
} |
[Tt][Oo][Ll] { LLDBUG_PR2("[tol(%s)]",yytext); |
[Tt][Oo][Ll] { LLDBUG_PR2("[tol(%s)]",yytext); |
if (firstparam) firstparam=0; else add_delayed("\"></responseparam>\n\t"); |
if (firstparam) { |
add_delayed("<responseparam type=\"tol\" value=\"tolerance\" default=\""); |
firstparam=0; |
|
} else { |
|
add_delayed("\" />\n\t"); |
|
} |
|
add_delayed("<responseparam name=\"tol\" type=\"tolerance\" description=\"Numerical Tolerance\" default=\""); |
dosend=2; |
dosend=2; |
} |
} |
[Ss][Ii][Gg] { |
[Ss][Ii][Gg] { |
LLDBUG_PR2("[SIG(%s)]",yytext); |
LLDBUG_PR2("[SIG(%s)]",yytext); |
if (firstparam) firstparam=0; else add_delayed("\"></responseparam>\n\t"); |
if (firstparam) { |
add_delayed("<responseparam type=\"sig\" value=\"int,range,0-12\" default=\""); |
firstparam=0; |
|
} else { |
|
add_delayed("\" />\n\t"); |
|
} |
|
add_delayed("<responseparam name=\"sig\" type=\"int,range,0-12\" description=\"Significant Figures\" default=\""); |
dosend=2; |
dosend=2; |
} |
} |
|
|
Line 780 EndLine ([\r][\n]|[\n])
|
Line 797 EndLine ([\r][\n]|[\n])
|
send("\">\n\t"); |
send("\">\n\t"); |
dosend=1; |
dosend=1; |
flush_delayed(); |
flush_delayed(); |
if (!firstparam) send("\">"); |
if (firstparam!=1) send("\" />\n"); |
send("\n\t<textline></textline>\n</caparesponse>\n"); |
send("\t<textline />\n</numericalresponse>\n"); |
} |
} |
} |
} |
|
|
Line 837 EndLine ([\r][\n]|[\n])
|
Line 854 EndLine ([\r][\n]|[\n])
|
<S_VARIABLE,S_TRUE_FALSE_STMT,S_MAP,S_LET>{ |
<S_VARIABLE,S_TRUE_FALSE_STMT,S_MAP,S_LET>{ |
[\"] { LLDBUG_PR1("[TF,V,LET,MAP str\" ]"); |
[\"] { LLDBUG_PR1("[TF,V,LET,MAP str\" ]"); |
Current_char_p = String_buf; |
Current_char_p = String_buf; |
send("\""); |
send("'"); |
yy_push_state(S_STRING); |
yy_push_state(S_STRING); |
} |
} |
} |
} |
Line 850 EndLine ([\r][\n]|[\n])
|
Line 867 EndLine ([\r][\n]|[\n])
|
} |
} |
|
|
<S_VARIABLE,S_TRUE_FALSE_STMT,S_MAP,S_ANSWER>{ |
<S_VARIABLE,S_TRUE_FALSE_STMT,S_MAP,S_ANSWER>{ |
[\(] { LLDBUG_PR1("[dis let ans map (]"); |
[\(] { LLDBUG_PR1("[let if ans map (]"); |
Pcount++; |
Pcount++; |
if (Pcount > 1 ) { |
if (Pcount > 1 ) { |
if (dosend==1) send(yytext); |
if (dosend==1) send(yytext); |
Line 860 EndLine ([\r][\n]|[\n])
|
Line 877 EndLine ([\r][\n]|[\n])
|
} |
} |
|
|
<S_LET>{ |
<S_LET>{ |
[\(] { LLDBUG_PR1("[dis let ans map (]"); |
[\(] { LLDBUG_PR1("[let (]"); |
Pcount++; |
Pcount++; |
send(yytext); |
send(yytext); |
} |
} |
Line 870 EndLine ([\r][\n]|[\n])
|
Line 887 EndLine ([\r][\n]|[\n])
|
end_delayed(); |
end_delayed(); |
send("&format("); |
send("&format("); |
flush_delayed(); |
flush_delayed(); |
send(",\"%s\")",yytext+1); |
send(",'%s')",yytext+1); |
} |
} |
<S_ANSWER>[:]{Number}+[EeFf] { |
<S_ANSWER>[:]{Number}+[EeFf] { |
if (dosend) send("\" format=\"%s",yytext+1); |
if (dosend) send("\" format=\"%s",yytext+1); |
} |
} |
|
|
|
<S_MAP>{ |
|
[;] { |
|
if (sccount==0) { |
|
send(",[\\"); |
|
sccount++; |
|
} else if (sccount==1) { |
|
send("],["); |
|
sccount++; |
|
} |
|
} |
|
[,] { |
|
if (sccount==1) { |
|
send(",\\"); |
|
} else { |
|
send(","); |
|
} |
|
} |
|
[\)] { |
|
LLDBUG_PR1("[) in MAP]"); Pcount--; |
|
if(Pcount==0) { |
|
BEGIN S_SKIP; |
|
} |
|
/* you might need a ; in the string below */ |
|
send("]%c;\n",yytext[0]); |
|
sccount=0; |
|
} |
|
} |
|
|
<S_VARIABLE,S_TRUE_FALSE_STMT,S_LET,S_MAP>{ |
<S_VARIABLE,S_TRUE_FALSE_STMT,S_LET,S_MAP>{ |
"==" { LLDBUG_PR1("[==]"); send(yytext); } |
"==" { LLDBUG_PR1("[==]"); send(yytext); } |
"!=" { LLDBUG_PR1("[!=]"); send(yytext); } |
"!=" { LLDBUG_PR1("[!=]"); send(yytext); } |
Line 914 EndLine ([\r][\n]|[\n])
|
Line 959 EndLine ([\r][\n]|[\n])
|
} |
} |
|
|
<S_TRUE_FALSE_STMT>{ |
<S_TRUE_FALSE_STMT>{ |
[\)] { LLDBUG_PRL1("[) in TRUE_FALSE]"); Pcount--; if(Pcount == 0) BEGIN S_NEXT_LINE; return(yytext[0]); } |
[\)] { |
[\\]{Space}*{EndLine} { LLDBUG_PR2("[\\EoL continue in S_TRUE_FALSE_STMT](%s)",yytext); /* continuation on next line */ } |
LLDBUG_PRL1("[) in TRUE_FALSE]"); |
{EndLine} { LLDBUG_PR1("[EoL within /IF()]\n"); RETURN(EoL); } |
Pcount--; |
. { char warn_msg[WARN_MSG_LENGTH]; |
if(Pcount == 0) { |
|
stop_cache(); |
|
send_stream(0,"\">\n"); |
|
send_stream(1,") {\n"); |
|
BEGIN S_NEXT_LINE; |
|
} |
|
} |
|
[\\]{Space}*{EndLine} { |
|
LLDBUG_PR2("[\\EoL continue in S_TRUE_FALSE_STMT](%s)",yytext); /* continuation on next line */ |
|
} |
|
{EndLine} { |
|
LLDBUG_PR1("[EoL within /IF()]\n"); RETURN(EoL); |
|
} |
|
. { |
|
char warn_msg[WARN_MSG_LENGTH]; |
sprintf(warn_msg,"In /IF(), an unexpected char [%c] is encountered.\n",yytext[0]); |
sprintf(warn_msg,"In /IF(), an unexpected char [%c] is encountered.\n",yytext[0]); |
capa_msg(MESSAGE_ERROR,warn_msg); |
capa_msg(MESSAGE_ERROR,warn_msg); |
} |
} |
Line 931 EndLine ([\r][\n]|[\n])
|
Line 990 EndLine ([\r][\n]|[\n])
|
[\\][\"] { /**Current_char_p++ = '"';*/ send("\\\""); } |
[\\][\"] { /**Current_char_p++ = '"';*/ send("\\\""); } |
[\\]{Space}*[\n] { LLDBUG_PR2("[\\CR continue in S_STRING](%s)",yytext); /* continuation on next line */ } |
[\\]{Space}*[\n] { LLDBUG_PR2("[\\CR continue in S_STRING](%s)",yytext); /* continuation on next line */ } |
[\"] { /* end of a string constant -- */ |
[\"] { /* end of a string constant -- */ |
send("\""); |
send("'"); |
yy_pop_state(); |
yy_pop_state(); |
} |
} |
{EndLine} { /* check for termination of string constant */ |
{EndLine} { /* check for termination of string constant */ |
Line 995 EndLine ([\r][\n]|[\n])
|
Line 1054 EndLine ([\r][\n]|[\n])
|
} |
} |
} |
} |
|
|
<S_MAP>{ |
|
[;,] { LLDBUG_PR2("[%c]",yytext[0]); send("%c",yytext[0]); } |
|
[\)] { LLDBUG_PR1("[) in MAP]"); Pcount--; |
|
if(Pcount==0) { |
|
BEGIN S_SKIP; |
|
} |
|
send("%c",yytext[0]); |
|
} |
|
} |
|
|
|
<S_ANSCONTINUE>{ |
<S_ANSCONTINUE>{ |
{Space}+ { /* ignore white spaces */ } |
{Space}+ { /* ignore white spaces */ } |
[\\]{Space}*{EndLine} { /* continuation */ } |
[\\]{Space}*{EndLine} { /* continuation */ } |
{EndLine} { /* end of answer and/or other answers */ LLDBUG_PR1("[complete an answer<EoL>]"); |
{EndLine} { /* end of answer and/or other answers */ LLDBUG_PR1("[complete an answer<EoL>]"); |
BEGIN S_TEXT; } |
BEGIN S_TEXT; } |
"/AND" { LLDBUG_PR1("[AND]"); RETURN(ANS_AND); } |
"/AND" { LLDBUG_PR1("[AND]"); /* implicit in LON-CAPA */ } |
"/OR" { LLDBUG_PR1("[OR]"); RETURN(ANS_OR); } |
"/OR" { LLDBUG_PR1("[OR]"); RETURN(ANS_OR); } |
} |
} |
|
|
<S_IF_SKIP>{ |
|
^{Spaces}"/IF"[^\n]*{EndLine} { IFcount++; LLDBUG_PRL2("[Skip IF <IFcount=%d>]\n",IFcount); |
|
IFstatus[IFcount] = IF_DONT_CARE; |
|
} |
|
^{Spaces}"/ELSE"[^\n]*{EndLine} { LLDBUG_PRL2("[Skip ELSE <IFcount=%d>]",IFcount); |
|
IFcurrent[IFcount]=RUN_ELSE_PORTION; |
|
if( IFstatus[IFcount] == IF_FALSE ) { |
|
LLDBUG_PRL1("[ELSE begin TEXT CR]\n"); |
|
BEGIN S_TEXT; |
|
} |
|
if( IFstatus[IFcount] == IF_TRUE ) { |
|
LLDBUG_PRL1("[ELSE THIS SHOULD NEVER HAPPEN.]\n"); |
|
} |
|
} |
|
^{Spaces}"/ENDIF"[^\n]*{EndLine} { IFcount--; LLDBUG_PRL2("[Skip ENDIF <IFcount=%d>]\n",IFcount); |
|
if( IFcount == 0 ) { |
|
LLDBUG_PRL1("[ENDIF begin TEXT CR]\n"); |
|
BEGIN S_TEXT; |
|
} |
|
if( (IFcurrent[IFcount] == RUN_IF_PORTION )&&(IFstatus[IFcount] == IF_TRUE)) { |
|
LLDBUG_PRL1("[ENDIF begin TEXT CR]\n"); |
|
BEGIN S_TEXT; |
|
} |
|
if( (IFcurrent[IFcount] == RUN_ELSE_PORTION )&&(IFstatus[IFcount] == IF_FALSE)) { |
|
LLDBUG_PRL1("[ENDIF begin TEXT CR]\n"); |
|
BEGIN S_TEXT; |
|
} |
|
} |
|
{EndLine} { LLDBUG_PRL1("[SkipIF a CR]\n"); } |
|
[^\n]*$ { LLDBUG_PRL2("[SkipIF anything <IFcount=%d>]",IFcount); } |
|
} |
|
<S_NEXT_LINE>{ |
<S_NEXT_LINE>{ |
([.]*){EndLine} { /* this ignores everything until it hits an EoL */ |
([.]*){EndLine} { /* this ignores everything until it hits an EoL */ |
LLDBUG_PRL2("[<S_NEXT_LINE> skip \'%s\' until EoL]\n",yytext); |
LLDBUG_PRL2("[<S_NEXT_LINE> skip \'%s\' until EoL]\n",yytext); |
Line 1081 EndLine ([\r][\n]|[\n])
|
Line 1099 EndLine ([\r][\n]|[\n])
|
%% |
%% |
|
|
/* ========================================================================================== */ |
/* ========================================================================================== */ |
extern void |
|
begin_if_skip() { BEGIN S_IF_SKIP; } |
|
|
|
extern void |
extern void |
begin_while_skip() { Wcount=0; While_idx--; /* while is FALSE, pop it out from stack */ BEGIN S_WHILE_SKIP; } |
begin_while_skip() { Wcount=0; While_idx--; /* while is FALSE, pop it out from stack */ BEGIN S_WHILE_SKIP; } |