/ 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 Unified Diffs Ignore Whitespace Patch

Changes to src/parse.y.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
...
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151




152
153
154
155
156
157
158
**
*************************************************************************
** This file contains SQLite's grammar for SQL.  Process this file
** using the lemon parser generator to generate C code that runs
** the parser.  Lemon will also generate a header file containing
** numeric codes for all of the tokens.
**
** @(#) $Id: parse.y,v 1.71 2002/06/06 18:54:40 drh Exp $
*/
%token_prefix TK_
%token_type {Token}
%default_type {Token}
%extra_argument {Parse *pParse}
%syntax_error {
  sqliteSetString(&pParse->zErrMsg,"syntax error",0);
................................................................................
column ::= columnid type carglist. 
columnid ::= ids(X).                {sqliteAddColumn(pParse,&X);}

// An IDENTIFIER can be a generic identifier, or one of several
// keywords.  Any non-standard keyword can also be an identifier.
//
%type id {Token}
//id(A) ::= ABORT(X).      {A = X;}
//id(A) ::= AFTER(X).      {A = X;}
//id(A) ::= ASC(X).        {A = X;}
//id(A) ::= BEFORE(X).     {A = X;}
//id(A) ::= BEGIN(X).      {A = X;}
//id(A) ::= CASCADE(X).    {A = X;}
//id(A) ::= CLUSTER(X).    {A = X;}
//id(A) ::= CONFLICT(X).   {A = X;}
//id(A) ::= COPY(X).       {A = X;}
//id(A) ::= DEFERRED(X).   {A = X;}
//id(A) ::= DELIMITERS(X). {A = X;}
//id(A) ::= DESC(X).       {A = X;}
//id(A) ::= EACH(X).       {A = X;}
//id(A) ::= END(X).        {A = X;}
//id(A) ::= EXPLAIN(X).    {A = X;}
//id(A) ::= FAIL(X).       {A = X;}
//id(A) ::= FOR(X).        {A = X;}
//id(A) ::= FULL(X).       {A = X;}
id(A) ::= ID(X).         {A = X;}
//id(A) ::= IGNORE(X).     {A = X;}
//id(A) ::= IMMEDATE(X).   {A = X;}
//id(A) ::= INITIALLY(X).  {A = X;}
//id(A) ::= INSTEAD(X).    {A = X;}
//id(A) ::= MATCH(X).      {A = X;}
//id(A) ::= JOIN(X).       {A = X;}
//id(A) ::= KEY(X).        {A = X;}
//id(A) ::= OF(X).         {A = X;}
//id(A) ::= OFFSET(X).     {A = X;}
//id(A) ::= PARTIAL(X).    {A = X;}
//id(A) ::= PRAGMA(X).     {A = X;}
//id(A) ::= REPLACE(X).    {A = X;}
//id(A) ::= RESTRICT(X).   {A = X;}
//id(A) ::= ROW(X).        {A = X;}
//id(A) ::= STATEMENT(X).  {A = X;}
//id(A) ::= TEMP(X).       {A = X;}
//id(A) ::= TRIGGER(X).    {A = X;}
//id(A) ::= VACUUM(X).     {A = X;}
//id(A) ::= VIEW(X).       {A = X;}





%fallback ID 
  ABORT AFTER ASC BEFORE BEGIN CASCADE CLUSTER CONFLICT
  COPY DEFERRED DELIMITERS DESC EACH END EXPLAIN FAIL FOR
  FULL IGNORE IMMEDIATE INITIALLY INSTEAD MATCH JOIN KEY
  OF OFFSET PARTIAL PRAGMA REPLACE RESTRICT ROW STATEMENT
  TEMP TRIGGER VACUUM VIEW.








|







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<

>
>
>
>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
...
106
107
108
109
110
111
112


















113



















114
115
116
117
118
119
120
121
122
123
124
125
**
*************************************************************************
** This file contains SQLite's grammar for SQL.  Process this file
** using the lemon parser generator to generate C code that runs
** the parser.  Lemon will also generate a header file containing
** numeric codes for all of the tokens.
**
** @(#) $Id: parse.y,v 1.72 2002/06/06 19:04:16 drh Exp $
*/
%token_prefix TK_
%token_type {Token}
%default_type {Token}
%extra_argument {Parse *pParse}
%syntax_error {
  sqliteSetString(&pParse->zErrMsg,"syntax error",0);
................................................................................
column ::= columnid type carglist. 
columnid ::= ids(X).                {sqliteAddColumn(pParse,&X);}

// An IDENTIFIER can be a generic identifier, or one of several
// keywords.  Any non-standard keyword can also be an identifier.
//
%type id {Token}


















id(A) ::= ID(X).         {A = X;}




















// The following directive causes tokens ABORT, AFTER, ASC, etc. to
// fallback to ID if they will not parse as their original value.
// This obviates the need for the "id" nonterminal.
//
%fallback ID 
  ABORT AFTER ASC BEFORE BEGIN CASCADE CLUSTER CONFLICT
  COPY DEFERRED DELIMITERS DESC EACH END EXPLAIN FAIL FOR
  FULL IGNORE IMMEDIATE INITIALLY INSTEAD MATCH JOIN KEY
  OF OFFSET PARTIAL PRAGMA REPLACE RESTRICT ROW STATEMENT
  TEMP TRIGGER VACUUM VIEW.