/ Check-in [c0cb3a01]
Login

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

Overview
Comment:Additional grammar cleanup resulting from the %fallback directive. (CVS 606)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:c0cb3a012e02df1a7965413a92f9b5a77331edb4
User & Date: drh 2002-06-06 19:04:16
Context
2002-06-06
23:16
Fix for ticket #62: Do not report an SQLITE_READONLY error until the application actually tries to write data into a readonly file. It is OK to start a transaction on a read-only file, and doing so will get you a read lock. This change allows TEMP tables to be read/write even though the main database is readonly. (CVS 607) check-in: 9ef795d1 user: drh tags: trunk
19:04
Additional grammar cleanup resulting from the %fallback directive. (CVS 606) check-in: c0cb3a01 user: drh tags: trunk
18:54
Added the %fallback directive to the lemon parser generator and used this in the parser to make the parse tables much smaller. This reduced the size of the library by 15K. (CVS 605) check-in: 7ac5bd29 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/parse.y.

    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains SQLite's grammar for SQL.  Process this file
    13     13   ** using the lemon parser generator to generate C code that runs
    14     14   ** the parser.  Lemon will also generate a header file containing
    15     15   ** numeric codes for all of the tokens.
    16     16   **
    17         -** @(#) $Id: parse.y,v 1.71 2002/06/06 18:54:40 drh Exp $
           17  +** @(#) $Id: parse.y,v 1.72 2002/06/06 19:04:16 drh Exp $
    18     18   */
    19     19   %token_prefix TK_
    20     20   %token_type {Token}
    21     21   %default_type {Token}
    22     22   %extra_argument {Parse *pParse}
    23     23   %syntax_error {
    24     24     sqliteSetString(&pParse->zErrMsg,"syntax error",0);
................................................................................
   106    106   column ::= columnid type carglist. 
   107    107   columnid ::= ids(X).                {sqliteAddColumn(pParse,&X);}
   108    108   
   109    109   // An IDENTIFIER can be a generic identifier, or one of several
   110    110   // keywords.  Any non-standard keyword can also be an identifier.
   111    111   //
   112    112   %type id {Token}
   113         -//id(A) ::= ABORT(X).      {A = X;}
   114         -//id(A) ::= AFTER(X).      {A = X;}
   115         -//id(A) ::= ASC(X).        {A = X;}
   116         -//id(A) ::= BEFORE(X).     {A = X;}
   117         -//id(A) ::= BEGIN(X).      {A = X;}
   118         -//id(A) ::= CASCADE(X).    {A = X;}
   119         -//id(A) ::= CLUSTER(X).    {A = X;}
   120         -//id(A) ::= CONFLICT(X).   {A = X;}
   121         -//id(A) ::= COPY(X).       {A = X;}
   122         -//id(A) ::= DEFERRED(X).   {A = X;}
   123         -//id(A) ::= DELIMITERS(X). {A = X;}
   124         -//id(A) ::= DESC(X).       {A = X;}
   125         -//id(A) ::= EACH(X).       {A = X;}
   126         -//id(A) ::= END(X).        {A = X;}
   127         -//id(A) ::= EXPLAIN(X).    {A = X;}
   128         -//id(A) ::= FAIL(X).       {A = X;}
   129         -//id(A) ::= FOR(X).        {A = X;}
   130         -//id(A) ::= FULL(X).       {A = X;}
   131    113   id(A) ::= ID(X).         {A = X;}
   132         -//id(A) ::= IGNORE(X).     {A = X;}
   133         -//id(A) ::= IMMEDATE(X).   {A = X;}
   134         -//id(A) ::= INITIALLY(X).  {A = X;}
   135         -//id(A) ::= INSTEAD(X).    {A = X;}
   136         -//id(A) ::= MATCH(X).      {A = X;}
   137         -//id(A) ::= JOIN(X).       {A = X;}
   138         -//id(A) ::= KEY(X).        {A = X;}
   139         -//id(A) ::= OF(X).         {A = X;}
   140         -//id(A) ::= OFFSET(X).     {A = X;}
   141         -//id(A) ::= PARTIAL(X).    {A = X;}
   142         -//id(A) ::= PRAGMA(X).     {A = X;}
   143         -//id(A) ::= REPLACE(X).    {A = X;}
   144         -//id(A) ::= RESTRICT(X).   {A = X;}
   145         -//id(A) ::= ROW(X).        {A = X;}
   146         -//id(A) ::= STATEMENT(X).  {A = X;}
   147         -//id(A) ::= TEMP(X).       {A = X;}
   148         -//id(A) ::= TRIGGER(X).    {A = X;}
   149         -//id(A) ::= VACUUM(X).     {A = X;}
   150         -//id(A) ::= VIEW(X).       {A = X;}
   151    114   
          115  +// The following directive causes tokens ABORT, AFTER, ASC, etc. to
          116  +// fallback to ID if they will not parse as their original value.
          117  +// This obviates the need for the "id" nonterminal.
          118  +//
   152    119   %fallback ID 
   153    120     ABORT AFTER ASC BEFORE BEGIN CASCADE CLUSTER CONFLICT
   154    121     COPY DEFERRED DELIMITERS DESC EACH END EXPLAIN FAIL FOR
   155    122     FULL IGNORE IMMEDIATE INITIALLY INSTEAD MATCH JOIN KEY
   156    123     OF OFFSET PARTIAL PRAGMA REPLACE RESTRICT ROW STATEMENT
   157    124     TEMP TRIGGER VACUUM VIEW.
   158    125