berto
Posts: 20708
Joined: 3/13/2002 From: metro Chicago, Illinois, USA Status: offline
|
quote:
ORIGINAL: berto We're into the last lap (debugging, polishing, QA) ... Many loose ends to tie all together. Lots of dry, tedious work. For example (a recent post in the Dev Forum, of a still very much incomplete, work-in-progress QA effort): quote:
ORIGINAL: berto Another insider glimpse, this one of the CSlint work I've been doing in recent weeks: ... /* txt.l -- the cslint lexer */ #include "cslint.h" #include "txt.tab.h" #undef YY_INPUT #define YY_INPUT(buf, result, max_size) { \ signed char c = fgetc(txtin); \ result = (c == EOF) ? YY_NULL : (buf[0] = c, 1); \ } #undef ECHO #define ECHO if (isshow_text) { \ fputs(yytext, txtout); \ fflush(txtout); \ } #define DECHO(tokenstr) if (isdebug) fprintf(stdout, "\n%6d %s: #%s#\n", lineno, tokenstr, yytext); \ fflush(stdout); #define PUTBACK(n) yyless(yyleng-n) #define RETURNSTR(token) if ((! debugcomment) && (doinit || (! ignore[lineno-1]))) { \ txtlval.sval = strdup(yytext); \ return token; \ } #define RETURN(token) if ((! debugcomment) && (doinit || (! ignore[lineno-1]))) { \ return token; \ } #define OTYPE (filetype >= FILETYPE_COMPANYOOB) && (filetype <= FILETYPE_CAMPAIGNOOB) ... <PLATOONOOB>[pP]{nD}.+[\015]*\n { lineno++; ECHO; DECHO("PNAMES"); showlineno(); RETURNSTR(_PNAMES); } <PLATOONOOB>{D}+[-"./pP].+[\015]*\n { lineno++; ECHO; DECHO("PNAMES"); showlineno(); RETURNSTR(_PNAMES); } <CRYPT>.+[\015]*\n { lineno++; if ((filetype == FILETYPE_SCENARIOSCN) && (lineno == SCNORG_LINENO+1)) { BEGIN(INITIAL); } ECHO; DECHO("CRYPT"); showlineno(); RETURNSTR(_CRYPT); } <ONAME>{W}*{D}+{W}+[a-zA-Z\*].+[\015]*\n { if (typematch) { i = 0; while (isdigit(*(yytext+i)) || isspace(*(yytext+i))) { i++; } yyless(i); *(yytext+i) = '\0'; ECHO; DECHO("INTPOS1"); txtlval.lval = atol(yytext); RETURN(_INTPOS); } else { lineno++; ECHO; DECHO("ONAME1"); showlineno(); BEGIN(INITIAL); RETURNSTR(_ONAME); } } ... ... /* txt.y -- the cslint parser */ #include "cslint.h" %} %union { long lval; int ival; double fval; char *sval; } %token _FAKECMD %token _MYEOF %token _UID_DEFAULT %token _UID_AIDAT %token _UID_TIMELINESDAT %token _UID_ATTACKERDAT %token _UID_SOUNDSDAT %token _UID_ENCOUNTERSDAT %token _UID_LEADEROOB %token _UID_PLATOONOOB %token _UID_COMPANYOOB %token _UID_BATTALIONOOB %token _UID_REGIMENTOOB %token _UID_BRIGADEOOB %token _UID_DIVISIONOOB %token _UID_CORPSOOB %token _UID_ARMYOOB %token _UID_CAMPAIGNOOB %token _UID_SCENARIOSCN %token _EOL ... start: data eof ; data: aidat | timelines | attacker | sounds | encounters | leaders | platoons | companys | battalions | regiments | brigades | divisions | corpss | armys | campaigns | scenario ; scenario: _UID_SCENARIOSCN _DTAHDR int _EOL _TEXT _EOL int int int turnsegs int int int int vissegs int int int int int int int int _EOL onezero _EOL int int int int int _EOL int int int int _EOL int int int int int _EOL int int int int int _EOL crypt crypt opfires opfires opfires opfires _EOL opfires opfires opfires opfires _EOL intpos intpos _EOL intpos intpos intpos intpos _EOL side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side side _EOL _UNTDTA units _DTAFTR int int _EOL int _EOL _TEXT _EOL _DATE descs eols ; ... crypt: _CRYPT ; descs: desc | descs desc ; desc: _DESC ; texts: text | texts text ; text: _TEXT _EOL | _DEFAULT ; units: unit | units unit ; unit: _ZERO intpos intpos _PID int int int int int int int int int int int int int int int int int _EOL | int int int int int _EOL | int int int int _EOL | int int int int int int int int _EOL reinforcements ; reinforcements: reinforcement | reinforcements reinforcement ; reinforcement: _PID int int int int int int int int int int int int int int int int int _EOL ; side: _MINUSONE | _ZERO | _ONE ; opfires: intpos intpos intpos intpos ; ... Hmm, that reminds me. I am backlogged on my Coder Diaries. I really should write one up this week.
_____________________________
|