version 1.4, 2000/07/06 21:06:22
|
version 1.9, 2001/11/15 21:42:42
|
Line 124 int IFcurrent[MAX_FUNC_NEST];
|
Line 124 int IFcurrent[MAX_FUNC_NEST];
|
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 382 EndLine ([\r][\n]|[\n])
|
Line 383 EndLine ([\r][\n]|[\n])
|
|
|
<S_COMMENT>{ |
<S_COMMENT>{ |
{EndLine}{Spaces}"//"[^\n]*$ {LLDBUG_PRL2("[COMMENT<%s>]\n",yytext); |
{EndLine}{Spaces}"//"[^\n]*$ {LLDBUG_PRL2("[COMMENT<%s>]\n",yytext); |
send("# %s",&yytext[2]); |
send("# %s\n",&yytext[2]); |
} |
} |
[^\n]*{EndLine} { |
[^\n]*{EndLine} { |
send("\n"); BEGIN S_TEXT; |
send("\n"); BEGIN S_TEXT; |
Line 401 EndLine ([\r][\n]|[\n])
|
Line 402 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 436 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 448 EndLine ([\r][\n]|[\n])
|
Line 448 EndLine ([\r][\n]|[\n])
|
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 656 EndLine ([\r][\n]|[\n])
|
Line 656 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>%s</import>\n",yytext); BEGIN S_SKIP; } |
{FileName}{Space}* { end_mode();send("<import>/res/ohiou/%s</import>\n",yytext); BEGIN S_SKIP; } |
{Identifier}{Space}* { end_mode();send("<import>$%s</import>\n",yytext); BEGIN S_SKIP; } |
{Identifier}{Space}* { end_mode();send("<import>$%s</import>\n",yytext); BEGIN S_SKIP; } |
} |
} |
|
|
Line 738 EndLine ([\r][\n]|[\n])
|
Line 701 EndLine ([\r][\n]|[\n])
|
} |
} |
|
|
[Pp][Cc][Rr] | |
[Pp][Cc][Rr] | |
[Hh][Gg][Rr] { if (firstparam) firstparam=0; else add_delayed("\">\n\t"); |
[Hh][Gg][Rr] { if (firstparam) firstparam=0; else add_delayed("\" />\n\t"); |
add_delayed("<param type=\"hgr\" value=\"on|off\" default=\""); |
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("\">\n\t"); |
if (firstparam) firstparam=0; else add_delayed("\" />\n\t"); |
add_delayed("<param type=\"tol\" value=\"tolerance\" default=\""); |
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("\">\n\t"); |
if (firstparam) firstparam=0; else add_delayed("\" />\n\t"); |
add_delayed("<param type=\"sig\" value=\"int,range,0-12\" default=\""); |
add_delayed("<responseparam name=\"sig\" type=\"int,range,0-12\" description=\"Significant Figures\" default=\""); |
dosend=2; |
dosend=2; |
} |
} |
|
|
[Ss][Tt][Rr] { LLDBUG_PR1("[STR]"); send("\" str="); dosend=1; } |
[Ss][Tt][Rr] { LLDBUG_PR1("[STR]"); send("\" str=\""); dosend=1; } |
[Ee][Vv][Aa][Ll] | |
[Ee][Vv][Aa][Ll] | |
[Ee][Vv][Aa][Ll][Uu][Aa][Tt][Ee] { LLDBUG_PR1("[EVAL]");send("\" eval="); dosend=1;} |
[Ee][Vv][Aa][Ll][Uu][Aa][Tt][Ee] { LLDBUG_PR1("[EVAL]");send("\" eval="); dosend=1;} |
[Uu][Nn][Ii][Tt] | |
[Uu][Nn][Ii][Tt] | |
Line 780 EndLine ([\r][\n]|[\n])
|
Line 743 EndLine ([\r][\n]|[\n])
|
send("\">\n\t"); |
send("\">\n\t"); |
dosend=1; |
dosend=1; |
flush_delayed(); |
flush_delayed(); |
if (!firstparam) send("\">"); |
if (!firstparam) send("\" />"); |
send("\n\t<textline></textline>\n</caparesponse>\n"); |
send("\n\t<textline />\n</numericalresponse>\n"); |
} |
} |
} |
} |
|
|
Line 837 EndLine ([\r][\n]|[\n])
|
Line 800 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 870 EndLine ([\r][\n]|[\n])
|
Line 833 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 931 EndLine ([\r][\n]|[\n])
|
Line 922 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 986 EndLine ([\r][\n]|[\n])
|
} |
} |
} |
} |
|
|
<S_MAP>{ |
|
[;,] { LLDBUG_PR2("[%c]",yytext[0]); return(yytext[0]); } |
|
[\)] { LLDBUG_PR1("[) in MAP]"); Pcount--; |
|
if(Pcount==0) { |
|
BEGIN S_SKIP; |
|
} |
|
return(yytext[0]); |
|
} |
|
} |
|
|
|
<S_ANSCONTINUE>{ |
<S_ANSCONTINUE>{ |
{Space}+ { /* ignore white spaces */ } |
{Space}+ { /* ignore white spaces */ } |
[\\]{Space}*{EndLine} { /* continuation */ } |
[\\]{Space}*{EndLine} { /* continuation */ } |