/ Check-in [37214769]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix additional typos in comments within lemon. Ticket #3215. (CVS 5405)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 372147699585ca4bd11100983de924f63c5cfce5
User & Date: drh 2008-07-14 12:27:52
Context
2008-07-14
12:30
Work around a bug in Borland C. Ticket #3216. (CVS 5406) check-in: 2c24e50d user: drh tags: trunk
12:27
Fix additional typos in comments within lemon. Ticket #3215. (CVS 5405) check-in: 37214769 user: drh tags: trunk
12:21
Fix a bug in the #line generator of lemon. Ticket #3214. (CVS 5404) check-in: dc697c26 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to tool/lemon.c.

   124    124     struct symbol *fallback; /* fallback token in case this token doesn't parse */
   125    125     int prec;                /* Precedence if defined (-1 otherwise) */
   126    126     enum e_assoc {
   127    127       LEFT,
   128    128       RIGHT,
   129    129       NONE,
   130    130       UNK
   131         -  } assoc;                 /* Associativity if predecence is defined */
          131  +  } assoc;                 /* Associativity if precedence is defined */
   132    132     char *firstset;          /* First-set for all rules of this symbol */
   133    133     Boolean lambda;          /* True if NT and can generate an empty string */
   134    134     int useCnt;              /* Number of times used */
   135    135     char *destructor;        /* Code which executes whenever this symbol is
   136    136                              ** popped from the stack during error processing */
   137    137     int destLineno;          /* Line number for start of destructor */
   138    138     char *datatype;          /* The data type of information held by this
................................................................................
   208    208   };
   209    209   
   210    210   /* Each state of the generated parser's finite state machine
   211    211   ** is encoded as an instance of the following structure. */
   212    212   struct state {
   213    213     struct config *bp;       /* The basis configurations for this state */
   214    214     struct config *cfp;      /* All configurations in this set */
   215         -  int statenum;            /* Sequencial number for this state */
          215  +  int statenum;            /* Sequential number for this state */
   216    216     struct action *ap;       /* Array of actions for this state */
   217    217     int nTknAct, nNtAct;     /* Number of actions on terminals and nonterminals */
   218    218     int iTknOfst, iNtOfst;   /* yy_action[] offset for terminals and nonterms */
   219    219     int iDflt;               /* Default action */
   220    220   };
   221    221   #define NO_OFFSET (-2147483647)
   222    222   
................................................................................
   259    259     char *vardest;           /* Code for the default non-terminal destructor */
   260    260     char *filename;          /* Name of the input file */
   261    261     char *outname;           /* Name of the current output file */
   262    262     char *tokenprefix;       /* A prefix added to token names in the .h file */
   263    263     int nconflict;           /* Number of parsing conflicts */
   264    264     int tablesize;           /* Size of the parse tables */
   265    265     int basisflag;           /* Print only basis configurations */
   266         -  int has_fallback;        /* True if any %fallback is seen in the grammer */
          266  +  int has_fallback;        /* True if any %fallback is seen in the grammar */
   267    267     char *argv0;             /* Name of the program */
   268    268   };
   269    269   
   270    270   #define MemoryCheck(X) if((X)==0){ \
   271    271     extern void memory_error(); \
   272    272     memory_error(); \
   273    273   }
................................................................................
   982    982       if( rp->canReduce ) continue;
   983    983       ErrorMsg(lemp->filename,rp->ruleline,"This rule can not be reduced.\n");
   984    984       lemp->errorcnt++;
   985    985     }
   986    986   }
   987    987   
   988    988   /* Resolve a conflict between the two given actions.  If the
   989         -** conflict can't be resolve, return non-zero.
          989  +** conflict can't be resolved, return non-zero.
   990    990   **
   991    991   ** NO LONGER TRUE:
   992    992   **   To resolve a conflict, first look to see if either action
   993    993   **   is on an error rule.  In that case, take the action which
   994    994   **   is not associated with the error rule.  If neither or both
   995    995   **   actions are associated with an error rule, then try to
   996    996   **   use precedence to resolve the conflict.
................................................................................
  1993   1993           psp->lhs = Symbol_new(x);
  1994   1994           psp->nrhs = 0;
  1995   1995           psp->lhsalias = 0;
  1996   1996           psp->state = WAITING_FOR_ARROW;
  1997   1997         }else if( x[0]=='{' ){
  1998   1998           if( psp->prevrule==0 ){
  1999   1999             ErrorMsg(psp->filename,psp->tokenlineno,
  2000         -"There is not prior rule opon which to attach the code \
         2000  +"There is no prior rule opon which to attach the code \
  2001   2001   fragment which begins on this line.");
  2002   2002             psp->errorcnt++;
  2003   2003   	}else if( psp->prevrule->code!=0 ){
  2004   2004             ErrorMsg(psp->filename,psp->tokenlineno,
  2005   2005   "Code fragment beginning on this line is not the first \
  2006   2006   to follow the previous rule.");
  2007   2007             psp->errorcnt++;
................................................................................
  2420   2420       case RESYNC_AFTER_DECL_ERROR:
  2421   2421         if( x[0]=='.' ) psp->state = WAITING_FOR_DECL_OR_RULE;
  2422   2422         if( x[0]=='%' ) psp->state = WAITING_FOR_DECL_KEYWORD;
  2423   2423         break;
  2424   2424     }
  2425   2425   }
  2426   2426   
  2427         -/* Run the proprocessor over the input file text.  The global variables
         2427  +/* Run the preprocessor over the input file text.  The global variables
  2428   2428   ** azDefine[0] through azDefine[nDefine-1] contains the names of all defined
  2429   2429   ** macros.  This routine looks for "%ifdef" and "%ifndef" and "%endif" and
  2430   2430   ** comments them out.  Text in between is also commented out as appropriate.
  2431   2431   */
  2432   2432   static void preprocess_input(char *z){
  2433   2433     int i, j, k, n;
  2434   2434     int exclude = 0;
................................................................................
  3824   3824       fprintf(out,"  %-15s",line);
  3825   3825       if( (i&3)==3 ){ fprintf(out,"\n"); lineno++; }
  3826   3826     }
  3827   3827     if( (i&3)!=0 ){ fprintf(out,"\n"); lineno++; }
  3828   3828     tplt_xfer(lemp->name,in,out,&lineno);
  3829   3829   
  3830   3830     /* Generate a table containing a text string that describes every
  3831         -  ** rule in the rule set of the grammer.  This information is used
         3831  +  ** rule in the rule set of the grammar.  This information is used
  3832   3832     ** when tracing REDUCE actions.
  3833   3833     */
  3834   3834     for(i=0, rp=lemp->rule; rp; rp=rp->next, i++){
  3835   3835       assert( rp->index==i );
  3836   3836       fprintf(out," /* %3d */ \"", i);
  3837   3837       writeRuleText(out, rp);
  3838   3838       fprintf(out,"\",\n"); lineno++;

Changes to tool/lempar.c.

     1      1   /* Driver template for the LEMON parser generator.
     2      2   ** The author disclaims copyright to this source code.
     3      3   */
     4         -/* First off, code is include which follows the "include" declaration
     5         -** in the input file. */
            4  +/* First off, code is included that follows the "include" declaration
            5  +** in the input grammar file. */
     6      6   #include <stdio.h>
     7      7   %%
     8      8   /* Next is all token values, in a form suitable for use by makeheaders.
     9      9   ** This section will be null unless lemon is run with the -m switch.
    10     10   */
    11     11   /* 
    12     12   ** These constants (all generated automatically by the parser generator)
................................................................................
    60     60   #define YY_ACCEPT_ACTION  (YYNSTATE+YYNRULE+1)
    61     61   #define YY_ERROR_ACTION   (YYNSTATE+YYNRULE)
    62     62   
    63     63   /* The yyzerominor constant is used to initialize instances of
    64     64   ** YYMINORTYPE objects to zero. */
    65     65   static const YYMINORTYPE yyzerominor;
    66     66   
    67         -/* Next are that tables used to determine what action to take based on the
           67  +/* Next are the tables used to determine what action to take based on the
    68     68   ** current state and lookahead token.  These tables are used to implement
    69     69   ** functions that take a state number and lookahead value and return an
    70     70   ** action integer.  
    71     71   **
    72     72   ** Suppose the action integer is N.  Then the action is determined as
    73     73   ** follows
    74     74   **
................................................................................
   115    115   #define YY_SZ_ACTTAB (int)(sizeof(yy_action)/sizeof(yy_action[0]))
   116    116   
   117    117   /* The next table maps tokens into fallback tokens.  If a construct
   118    118   ** like the following:
   119    119   ** 
   120    120   **      %fallback ID X Y Z.
   121    121   **
   122         -** appears in the grammer, then ID becomes a fallback token for X, Y,
          122  +** appears in the grammar, then ID becomes a fallback token for X, Y,
   123    123   ** and Z.  Whenever one of the tokens X, Y, or Z is input to the parser
   124    124   ** but it does not parse, the type of the token is changed to ID and
   125    125   ** the parse is retried before an error is thrown.
   126    126   */
   127    127   #ifdef YYFALLBACK
   128    128   static const YYCODETYPE yyFallback[] = {
   129    129   %%
................................................................................
   447    447   /*
   448    448   ** Perform a shift action.
   449    449   */
   450    450   static void yy_shift(
   451    451     yyParser *yypParser,          /* The parser to be shifted */
   452    452     int yyNewState,               /* The new state to shift in */
   453    453     int yyMajor,                  /* The major token to shift in */
   454         -  YYMINORTYPE *yypMinor         /* Pointer ot the minor token to shift in */
          454  +  YYMINORTYPE *yypMinor         /* Pointer to the minor token to shift in */
   455    455   ){
   456    456     yyStackEntry *yytos;
   457    457     yypParser->yyidx++;
   458    458   #if YYSTACKDEPTH>0 
   459    459     if( yypParser->yyidx>=YYSTACKDEPTH ){
   460    460       yyStackOverflow(yypParser, yypMinor);
   461    461       return;