--- capa/capa51/pProj/capaGrammarDef.y 2000/02/09 22:10:24 1.8 +++ capa/capa51/pProj/capaGrammarDef.y 2000/07/07 18:33:03 1.12 @@ -1,6 +1,30 @@ +/* main CAPA parser + Copyright (C) 1992-2000 Michigan State University + + The CAPA system is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The CAPA system is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the CAPA system; see the file COPYING. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + + As a special exception, you have permission to link this program + with the TtH/TtM library and distribute executables, as long as you + follow the requirements of the GNU GPL in regard to all of the + software in the executable aside from TtH/TtM. +*/ + /* ========================================================================== */ /* capaGrammarDef.y created by Isaac Tsai */ -/* 1998, 1999 copyrighted by Isaac Tsai */ +/* 1998, 1999 by Isaac Tsai */ /* no longer there is a length constrain on string concatenation July 13 1998 */ /* /RMAP() function */ /* TODO: new mechanism to collect answer informations */ @@ -36,13 +60,13 @@ case S_VAR: case S_CONSTANT: \ printf("STR(%s)\n",(xx)->s_str); break; \ } } -#else +#else /* YACC_DBUG */ #define YYDBUG_PR1(xx) { } #define YYDBUG_PR2(xx,yy) { } #define YYDBUG_PR3(xx,yy,zz) { } #define YYDBUG_PR4(xx,yy,zz,aa) { } #define YYDBUG_SYM(xx) { } -#endif +#endif /* YACC_DBUG */ int yylex(); void yyerror(char*); @@ -118,7 +142,7 @@ PointsList_t *LastPtsList; %token ANS_OFF ANS_ON ANS_OR ANS_ORDERED %token ANS_PATH ANS_PCREDIT ANS_PLUS ANS_RANGE %token ANS_SHOW_BR ANS_SIG ANS_TOLERANCE ANS_TRY ANS_TYPE -%token ANS_UNFMT ANS_UNIT ANS_WEIGHT +%token ANS_UNFMT ANS_UNIT ANS_VERBATIM ANS_WEIGHT %token VAR_RANGE VERBATIM %token SLASH FORMAT %token EQ_op NE_op GT_op GE_op LT_op LE_op AND_op OR_op EoL @@ -506,6 +530,10 @@ ans_infospec : ANS_TOLERANCE '=' a_numbe } | ANS_SHOW_BR '=' ANS_OFF { LexiProblem_p->show_br = DONOT_SHOW; } + | ANS_VERBATIM '=' ANS_ON { LexiProblem_p->verbatim = DO_VERBATIM; + } + | ANS_VERBATIM '=' ANS_OFF { LexiProblem_p->verbatim = DONOT_VERBATIM; + } | ANS_BOX_SHOW '=' ANS_ON { LexiProblem_p->show_ans_box = DO_SHOW; } | ANS_BOX_SHOW '=' ANS_OFF { LexiProblem_p->show_ans_box = DONOT_SHOW; @@ -845,7 +873,10 @@ an_integer : I_CONSTANT a_real : R_CONSTANT { $$ = $1; } ; -an_array : ARRAY_ID '[' calc_expr ']' { $$=get_array_symbol($1,$3,1); } +an_array : ARRAY_ID '[' calc_expr ']' { + YYDBUG_PR1(" an_array <= ARRAY_ID '['calc_expr ']' "); + $$=get_array_symbol($1,$3,1); + } ; startQ : { /* first matching will occur before first line of input text */