Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Added psuedo-BNF generator for syntax diagrams. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
678b7b774cd7a5c12c7fee0e19377044 |
User & Date: | shaneh 2010-03-25 21:30:52.000 |
Context
2010-03-25
| ||
21:31 | Updates to text based bubble diagrams to fix minor issues and add linking. (check-in: 56374346ea user: shaneh tags: trunk) | |
21:30 | Added psuedo-BNF generator for syntax diagrams. (check-in: 678b7b774c user: shaneh tags: trunk) | |
2010-03-24
| ||
04:03 | Updates to text bubble generator for Chrome. (check-in: 1477f7f3f4 user: shaneh tags: trunk) | |
Changes
Added art/syntax/all-bnf.html.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <style type='text/css'> h3 { font-family:helvetica; font-size:16px; } table, tr, td { font-family:helvetica; font-size:18px; empty-cells:show; border-collapse:separate; border-style:none; vertical-align:top; } </style> </head> <body> <h3><a name="sql-stmt-list">sql-stmt-list</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">sql-stmt-list</td><td>::=</td><td>[ <font style="white-space:nowrap; font-size:12px;"><<a href="#sql-stmt">sql-stmt</a>></font> ] [ <font style="white-space:nowrap; font-size:12px;">;</font> [ <font style="white-space:nowrap; font-size:12px;"><<a href="#sql-stmt">sql-stmt</a>></font> ] ]*</td></tr></table> <h3><a name="sql-stmt">sql-stmt</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">sql-stmt</td><td>::=</td><td>[ <font style="white-space:nowrap; font-size:12px;">EXPLAIN</font> [ <font style="white-space:nowrap; font-size:12px;">QUERY</font> <font style="white-space:nowrap; font-size:12px;">PLAN</font> ] ] [ <font style="white-space:nowrap; font-size:12px;"><<a href="#alter-table-stmt">alter-table-stmt</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#analyze-stmt">analyze-stmt</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#attach-stmt">attach-stmt</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#begin-stmt">begin-stmt</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#commit-stmt">commit-stmt</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#create-index-stmt">create-index-stmt</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#create-table-stmt">create-table-stmt</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#create-trigger-stmt">create-trigger-stmt</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#create-view-stmt">create-view-stmt</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#create-virtual-table-stmt">create-virtual-table-stmt</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#delete-stmt">delete-stmt</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#delete-stmt-limited">delete-stmt-limited</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#detach-stmt">detach-stmt</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#drop-index-stmt">drop-index-stmt</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#drop-table-stmt">drop-table-stmt</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#drop-trigger-stmt">drop-trigger-stmt</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#drop-view-stmt">drop-view-stmt</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#insert-stmt">insert-stmt</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#pragma-stmt">pragma-stmt</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#reindex-stmt">reindex-stmt</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#release-stmt">release-stmt</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#rollback-stmt">rollback-stmt</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#savepoint-stmt">savepoint-stmt</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#select-stmt">select-stmt</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#update-stmt">update-stmt</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#update-stmt-limited">update-stmt-limited</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#vacuum-stmt">vacuum-stmt</a>></font> ]<font style="vertical-align:top; font-size:12px;">1</font></td></tr></table> <h3><a name="alter-table-stmt">alter-table-stmt</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">alter-table-stmt</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">ALTER</font> <font style="white-space:nowrap; font-size:12px;">TABLE</font> [ <font style="white-space:nowrap; font-size:12px;">database-name</font> <font style="white-space:nowrap; font-size:12px;">.</font> ] <font style="white-space:nowrap; font-size:12px;">table-name</font><br>[ <font style="white-space:nowrap; font-size:12px;">RENAME</font> <font style="white-space:nowrap; font-size:12px;">TO</font> <font style="white-space:nowrap; font-size:12px;">new-table-name</font> | <font style="white-space:nowrap; font-size:12px;">ADD</font> [ <font style="white-space:nowrap; font-size:12px;">COLUMN</font> ] <font style="white-space:nowrap; font-size:12px;"><<a href="#column-def">column-def</a>></font> ]<font style="vertical-align:top; font-size:12px;">1</font></td></tr></table> <h3><a name="analyze-stmt">analyze-stmt</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">analyze-stmt</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">ANALYZE</font> [ <font style="white-space:nowrap; font-size:12px;">database-name</font> | <font style="white-space:nowrap; font-size:12px;">table-name</font> | <font style="white-space:nowrap; font-size:12px;">database-name</font> <font style="white-space:nowrap; font-size:12px;">.</font> <font style="white-space:nowrap; font-size:12px;">table-name</font> ]</td></tr></table> <h3><a name="attach-stmt">attach-stmt</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">attach-stmt</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">ATTACH</font> [ <font style="white-space:nowrap; font-size:12px;">DATABASE</font> ] <font style="white-space:nowrap; font-size:12px;">filename</font> <font style="white-space:nowrap; font-size:12px;">AS</font> <font style="white-space:nowrap; font-size:12px;">database-name</font></td></tr></table> <h3><a name="begin-stmt">begin-stmt</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">begin-stmt</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">BEGIN</font> [ <font style="white-space:nowrap; font-size:12px;">DEFERRED</font> | <font style="white-space:nowrap; font-size:12px;">IMMEDIATE</font> | <font style="white-space:nowrap; font-size:12px;">EXCLUSIVE</font> ] [ <font style="white-space:nowrap; font-size:12px;">TRANSACTION</font> ]</td></tr></table> <h3><a name="commit-stmt">commit-stmt</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">commit-stmt</td><td>::=</td><td>[ <font style="white-space:nowrap; font-size:12px;">COMMIT</font> | <font style="white-space:nowrap; font-size:12px;">END</font> ]<font style="vertical-align:top; font-size:12px;">1</font> [ <font style="white-space:nowrap; font-size:12px;">TRANSACTION</font> ]</td></tr></table> <h3><a name="rollback-stmt">rollback-stmt</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">rollback-stmt</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">ROLLBACK</font> [ <font style="white-space:nowrap; font-size:12px;">TRANSACTION</font> ] [ <font style="white-space:nowrap; font-size:12px;">TO</font> [ <font style="white-space:nowrap; font-size:12px;">SAVEPOINT</font> ] <font style="white-space:nowrap; font-size:12px;">savepoint-name</font> ]</td></tr></table> <h3><a name="savepoint-stmt">savepoint-stmt</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">savepoint-stmt</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">SAVEPOINT</font> <font style="white-space:nowrap; font-size:12px;">savepoint-name</font></td></tr></table> <h3><a name="release-stmt">release-stmt</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">release-stmt</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">RELEASE</font> [ <font style="white-space:nowrap; font-size:12px;">SAVEPOINT</font> ] <font style="white-space:nowrap; font-size:12px;">savepoint-name</font></td></tr></table> <h3><a name="create-index-stmt">create-index-stmt</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">create-index-stmt</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">CREATE</font> [ <font style="white-space:nowrap; font-size:12px;">UNIQUE</font> ] <font style="white-space:nowrap; font-size:12px;">INDEX</font> [ <font style="white-space:nowrap; font-size:12px;">IF</font> <font style="white-space:nowrap; font-size:12px;">NOT</font> <font style="white-space:nowrap; font-size:12px;">EXISTS</font> ]<br>[ <font style="white-space:nowrap; font-size:12px;">database-name</font> <font style="white-space:nowrap; font-size:12px;">.</font> ] <font style="white-space:nowrap; font-size:12px;">index-name</font> <font style="white-space:nowrap; font-size:12px;">ON</font> <font style="white-space:nowrap; font-size:12px;">table-name</font> <font style="white-space:nowrap; font-size:12px;">(</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#indexed-column">indexed-column</a>></font> [ <font style="white-space:nowrap; font-size:12px;">,</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#indexed-column">indexed-column</a>></font> ]* <font style="white-space:nowrap; font-size:12px;">)</font></td></tr></table> <h3><a name="indexed-column">indexed-column</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">indexed-column</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">column-name</font> [ <font style="white-space:nowrap; font-size:12px;">COLLATE</font> <font style="white-space:nowrap; font-size:12px;">collation-name</font> ] [ <font style="white-space:nowrap; font-size:12px;">ASC</font> | <font style="white-space:nowrap; font-size:12px;">DESC</font> ]</td></tr></table> <h3><a name="create-table-stmt">create-table-stmt</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">create-table-stmt</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">CREATE</font> [ <font style="white-space:nowrap; font-size:12px;">TEMP</font> | <font style="white-space:nowrap; font-size:12px;">TEMPORARY</font> ] <font style="white-space:nowrap; font-size:12px;">TABLE</font> [ <font style="white-space:nowrap; font-size:12px;">IF</font> <font style="white-space:nowrap; font-size:12px;">NOT</font> <font style="white-space:nowrap; font-size:12px;">EXISTS</font> ]<br>[ <font style="white-space:nowrap; font-size:12px;">database-name</font> <font style="white-space:nowrap; font-size:12px;">.</font> ] <font style="white-space:nowrap; font-size:12px;">table-name</font> [ <font style="white-space:nowrap; font-size:12px;">(</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#column-def">column-def</a>></font> [ <font style="white-space:nowrap; font-size:12px;">,</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#column-def">column-def</a>></font> ]* [ <font style="white-space:nowrap; font-size:12px;">,</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#table-constraint">table-constraint</a>></font> ]* <font style="white-space:nowrap; font-size:12px;">)</font> | <font style="white-space:nowrap; font-size:12px;">AS</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#select-stmt">select-stmt</a>></font> ]<font style="vertical-align:top; font-size:12px;">1</font></td></tr></table> <h3><a name="column-def">column-def</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">column-def</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">column-name</font> [ <font style="white-space:nowrap; font-size:12px;"><<a href="#type-name">type-name</a>></font> ] [ <font style="white-space:nowrap; font-size:12px;"><<a href="#column-constraint">column-constraint</a>></font> ]*</td></tr></table> <h3><a name="type-name">type-name</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">type-name</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">name</font> [ <font style="white-space:nowrap; font-size:12px;">(</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#signed-number">signed-number</a>></font> <font style="white-space:nowrap; font-size:12px;">)</font> | <font style="white-space:nowrap; font-size:12px;">(</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#signed-number">signed-number</a>></font> <font style="white-space:nowrap; font-size:12px;">,</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#signed-number">signed-number</a>></font> <font style="white-space:nowrap; font-size:12px;">)</font> ]</td></tr></table> <h3><a name="column-constraint">column-constraint</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">column-constraint</td><td>::=</td><td>[ <font style="white-space:nowrap; font-size:12px;">CONSTRAINT</font> <font style="white-space:nowrap; font-size:12px;">name</font> ]<br>[ <font style="white-space:nowrap; font-size:12px;">PRIMARY</font> <font style="white-space:nowrap; font-size:12px;">KEY</font> [ <font style="white-space:nowrap; font-size:12px;">ASC</font> | <font style="white-space:nowrap; font-size:12px;">DESC</font> ] <font style="white-space:nowrap; font-size:12px;"><<a href="#conflict-clause">conflict-clause</a>></font> [ <font style="white-space:nowrap; font-size:12px;">AUTOINCREMENT</font> ] | <font style="white-space:nowrap; font-size:12px;">NOT</font> <font style="white-space:nowrap; font-size:12px;">NULL</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#conflict-clause">conflict-clause</a>></font> | <font style="white-space:nowrap; font-size:12px;">UNIQUE</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#conflict-clause">conflict-clause</a>></font> | <font style="white-space:nowrap; font-size:12px;">CHECK</font> <font style="white-space:nowrap; font-size:12px;">(</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> <font style="white-space:nowrap; font-size:12px;">)</font> | <font style="white-space:nowrap; font-size:12px;">DEFAULT</font> [ <font style="white-space:nowrap; font-size:12px;"><<a href="#signed-number">signed-number</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#literal-value">literal-value</a>></font> | <font style="white-space:nowrap; font-size:12px;">(</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> <font style="white-space:nowrap; font-size:12px;">)</font> ]<font style="vertical-align:top; font-size:12px;">1</font> | <font style="white-space:nowrap; font-size:12px;">COLLATE</font> <font style="white-space:nowrap; font-size:12px;">collation-name</font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#foreign-key-clause">foreign-key-clause</a>></font> ]<font style="vertical-align:top; font-size:12px;">1</font></td></tr></table> <h3><a name="signed-number">signed-number</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">signed-number</td><td>::=</td><td>[ <font style="white-space:nowrap; font-size:12px;">+</font> | <font style="white-space:nowrap; font-size:12px;">-</font> ] [ <font style="white-space:nowrap; font-size:12px;">integer-literal</font> | <font style="white-space:nowrap; font-size:12px;">floating-point-literal</font> ]<font style="vertical-align:top; font-size:12px;">1</font></td></tr></table> <h3><a name="table-constraint">table-constraint</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">table-constraint</td><td>::=</td><td>[ <font style="white-space:nowrap; font-size:12px;">CONSTRAINT</font> <font style="white-space:nowrap; font-size:12px;">name</font> ]<br>[ [ <font style="white-space:nowrap; font-size:12px;">PRIMARY</font> <font style="white-space:nowrap; font-size:12px;">KEY</font> | <font style="white-space:nowrap; font-size:12px;">UNIQUE</font> ]<font style="vertical-align:top; font-size:12px;">1</font> <font style="white-space:nowrap; font-size:12px;">(</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#indexed-column">indexed-column</a>></font> [ <font style="white-space:nowrap; font-size:12px;">,</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#indexed-column">indexed-column</a>></font> ]* <font style="white-space:nowrap; font-size:12px;">)</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#conflict-clause">conflict-clause</a>></font> | <font style="white-space:nowrap; font-size:12px;">CHECK</font> <font style="white-space:nowrap; font-size:12px;">(</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> <font style="white-space:nowrap; font-size:12px;">)</font> | <font style="white-space:nowrap; font-size:12px;">FOREIGN</font> <font style="white-space:nowrap; font-size:12px;">KEY</font> <font style="white-space:nowrap; font-size:12px;">(</font> <font style="white-space:nowrap; font-size:12px;">column-name</font> [ <font style="white-space:nowrap; font-size:12px;">,</font> <font style="white-space:nowrap; font-size:12px;">column-name</font> ]* <font style="white-space:nowrap; font-size:12px;">)</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#foreign-key-clause">foreign-key-clause</a>></font> ]<font style="vertical-align:top; font-size:12px;">1</font></td></tr></table> <h3><a name="foreign-key-clause">foreign-key-clause</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">foreign-key-clause</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">REFERENCES</font> <font style="white-space:nowrap; font-size:12px;">foreign-table</font> [ <font style="white-space:nowrap; font-size:12px;">(</font> <font style="white-space:nowrap; font-size:12px;">column-name</font> [ <font style="white-space:nowrap; font-size:12px;">,</font> <font style="white-space:nowrap; font-size:12px;">column-name</font> ]* <font style="white-space:nowrap; font-size:12px;">)</font> ]<br>[ [ <font style="white-space:nowrap; font-size:12px;">ON</font> [ <font style="white-space:nowrap; font-size:12px;">DELETE</font> | <font style="white-space:nowrap; font-size:12px;">UPDATE</font> ]<font style="vertical-align:top; font-size:12px;">1</font> [ <font style="white-space:nowrap; font-size:12px;">SET</font> <font style="white-space:nowrap; font-size:12px;">NULL</font> | <font style="white-space:nowrap; font-size:12px;">SET</font> <font style="white-space:nowrap; font-size:12px;">DEFAULT</font> | <font style="white-space:nowrap; font-size:12px;">CASCADE</font> | <font style="white-space:nowrap; font-size:12px;">RESTRICT</font> | <font style="white-space:nowrap; font-size:12px;">NO</font> <font style="white-space:nowrap; font-size:12px;">ACTION</font> ]<font style="vertical-align:top; font-size:12px;">1</font> | <font style="white-space:nowrap; font-size:12px;">MATCH</font> <font style="white-space:nowrap; font-size:12px;">name</font> ]<font style="vertical-align:top; font-size:12px;">1</font> ]<br>[ [ <font style="white-space:nowrap; font-size:12px;">NOT</font> ] <font style="white-space:nowrap; font-size:12px;">DEFERRABLE</font> [ <font style="white-space:nowrap; font-size:12px;">INITIALLY</font> <font style="white-space:nowrap; font-size:12px;">DEFERRED</font> | <font style="white-space:nowrap; font-size:12px;">INITIALLY</font> <font style="white-space:nowrap; font-size:12px;">IMMEDIATE</font> ] ]</td></tr></table> <h3><a name="conflict-clause">conflict-clause</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">conflict-clause</td><td>::=</td><td>[ <font style="white-space:nowrap; font-size:12px;">ON</font> <font style="white-space:nowrap; font-size:12px;">CONFLICT</font> [ <font style="white-space:nowrap; font-size:12px;">ROLLBACK</font> | <font style="white-space:nowrap; font-size:12px;">ABORT</font> | <font style="white-space:nowrap; font-size:12px;">FAIL</font> | <font style="white-space:nowrap; font-size:12px;">IGNORE</font> | <font style="white-space:nowrap; font-size:12px;">REPLACE</font> ]<font style="vertical-align:top; font-size:12px;">1</font> ]</td></tr></table> <h3><a name="create-trigger-stmt">create-trigger-stmt</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">create-trigger-stmt</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">CREATE</font> [ <font style="white-space:nowrap; font-size:12px;">TEMP</font> | <font style="white-space:nowrap; font-size:12px;">TEMPORARY</font> ] <font style="white-space:nowrap; font-size:12px;">TRIGGER</font> [ <font style="white-space:nowrap; font-size:12px;">IF</font> <font style="white-space:nowrap; font-size:12px;">NOT</font> <font style="white-space:nowrap; font-size:12px;">EXISTS</font> ]<br>[ <font style="white-space:nowrap; font-size:12px;">database-name</font> <font style="white-space:nowrap; font-size:12px;">.</font> ] <font style="white-space:nowrap; font-size:12px;">trigger-name</font> [ <font style="white-space:nowrap; font-size:12px;">BEFORE</font> | <font style="white-space:nowrap; font-size:12px;">AFTER</font> | <font style="white-space:nowrap; font-size:12px;">INSTEAD</font> <font style="white-space:nowrap; font-size:12px;">OF</font> ]<br>[ <font style="white-space:nowrap; font-size:12px;">DELETE</font> | <font style="white-space:nowrap; font-size:12px;">INSERT</font> | <font style="white-space:nowrap; font-size:12px;">UPDATE</font> [ <font style="white-space:nowrap; font-size:12px;">OF</font> <font style="white-space:nowrap; font-size:12px;">column-name</font> [ <font style="white-space:nowrap; font-size:12px;">,</font> <font style="white-space:nowrap; font-size:12px;">column-name</font> ]* ] ]<font style="vertical-align:top; font-size:12px;">1</font> <font style="white-space:nowrap; font-size:12px;">ON</font> <font style="white-space:nowrap; font-size:12px;">table-name</font><br>[ <font style="white-space:nowrap; font-size:12px;">FOR</font> <font style="white-space:nowrap; font-size:12px;">EACH</font> <font style="white-space:nowrap; font-size:12px;">ROW</font> ] [ <font style="white-space:nowrap; font-size:12px;">WHEN</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> ]<br><font style="white-space:nowrap; font-size:12px;">BEGIN</font> [ <font style="white-space:nowrap; font-size:12px;"><<a href="#update-stmt">update-stmt</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#insert-stmt">insert-stmt</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#delete-stmt">delete-stmt</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#select-stmt">select-stmt</a>></font> ]<font style="vertical-align:top; font-size:12px;">1</font> <font style="white-space:nowrap; font-size:12px;">;</font> <font style="white-space:nowrap; font-size:12px;">END</font></td></tr></table> <h3><a name="create-view-stmt">create-view-stmt</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">create-view-stmt</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">CREATE</font> [ <font style="white-space:nowrap; font-size:12px;">TEMP</font> | <font style="white-space:nowrap; font-size:12px;">TEMPORARY</font> ] <font style="white-space:nowrap; font-size:12px;">VIEW</font> [ <font style="white-space:nowrap; font-size:12px;">IF</font> <font style="white-space:nowrap; font-size:12px;">NOT</font> <font style="white-space:nowrap; font-size:12px;">EXISTS</font> ]<br>[ <font style="white-space:nowrap; font-size:12px;">database-name</font> <font style="white-space:nowrap; font-size:12px;">.</font> ] <font style="white-space:nowrap; font-size:12px;">view-name</font> <font style="white-space:nowrap; font-size:12px;">AS</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#select-stmt">select-stmt</a>></font></td></tr></table> <h3><a name="create-virtual-table-stmt">create-virtual-table-stmt</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">create-virtual-table-stmt</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">CREATE</font> <font style="white-space:nowrap; font-size:12px;">VIRTUAL</font> <font style="white-space:nowrap; font-size:12px;">TABLE</font> [ <font style="white-space:nowrap; font-size:12px;">database-name</font> <font style="white-space:nowrap; font-size:12px;">.</font> ] <font style="white-space:nowrap; font-size:12px;">table-name</font><br><font style="white-space:nowrap; font-size:12px;">USING</font> <font style="white-space:nowrap; font-size:12px;">module-name</font> [ <font style="white-space:nowrap; font-size:12px;">(</font> <font style="white-space:nowrap; font-size:12px;">module-argument</font> [ <font style="white-space:nowrap; font-size:12px;">,</font> <font style="white-space:nowrap; font-size:12px;">module-argument</font> ]* <font style="white-space:nowrap; font-size:12px;">)</font> ]</td></tr></table> <h3><a name="delete-stmt">delete-stmt</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">delete-stmt</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">DELETE</font> <font style="white-space:nowrap; font-size:12px;">FROM</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#qualified-table-name">qualified-table-name</a>></font> [ <font style="white-space:nowrap; font-size:12px;">WHERE</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> ]</td></tr></table> <h3><a name="delete-stmt-limited">delete-stmt-limited</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">delete-stmt-limited</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">DELETE</font> <font style="white-space:nowrap; font-size:12px;">FROM</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#qualified-table-name">qualified-table-name</a>></font> [ <font style="white-space:nowrap; font-size:12px;">WHERE</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> ]<br>[ [ <font style="white-space:nowrap; font-size:12px;">ORDER</font> <font style="white-space:nowrap; font-size:12px;">BY</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#ordering-term">ordering-term</a>></font> [ <font style="white-space:nowrap; font-size:12px;">,</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#ordering-term">ordering-term</a>></font> ]* ]<br><font style="white-space:nowrap; font-size:12px;">LIMIT</font> <font style="white-space:nowrap; font-size:12px;">integer</font> [ [ <font style="white-space:nowrap; font-size:12px;">OFFSET</font> | <font style="white-space:nowrap; font-size:12px;">,</font> ]<font style="vertical-align:top; font-size:12px;">1</font> <font style="white-space:nowrap; font-size:12px;">integer</font> ] ]</td></tr></table> <h3><a name="detach-stmt">detach-stmt</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">detach-stmt</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">DETACH</font> [ <font style="white-space:nowrap; font-size:12px;">DATABASE</font> ] <font style="white-space:nowrap; font-size:12px;">database-name</font></td></tr></table> <h3><a name="drop-index-stmt">drop-index-stmt</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">drop-index-stmt</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">DROP</font> <font style="white-space:nowrap; font-size:12px;">INDEX</font> [ <font style="white-space:nowrap; font-size:12px;">IF</font> <font style="white-space:nowrap; font-size:12px;">EXISTS</font> ] [ <font style="white-space:nowrap; font-size:12px;">database-name</font> <font style="white-space:nowrap; font-size:12px;">.</font> ] <font style="white-space:nowrap; font-size:12px;">index-name</font></td></tr></table> <h3><a name="drop-table-stmt">drop-table-stmt</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">drop-table-stmt</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">DROP</font> <font style="white-space:nowrap; font-size:12px;">TABLE</font> [ <font style="white-space:nowrap; font-size:12px;">IF</font> <font style="white-space:nowrap; font-size:12px;">EXISTS</font> ] [ <font style="white-space:nowrap; font-size:12px;">database-name</font> <font style="white-space:nowrap; font-size:12px;">.</font> ] <font style="white-space:nowrap; font-size:12px;">table-name</font></td></tr></table> <h3><a name="drop-trigger-stmt">drop-trigger-stmt</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">drop-trigger-stmt</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">DROP</font> <font style="white-space:nowrap; font-size:12px;">TRIGGER</font> [ <font style="white-space:nowrap; font-size:12px;">IF</font> <font style="white-space:nowrap; font-size:12px;">EXISTS</font> ] [ <font style="white-space:nowrap; font-size:12px;">database-name</font> <font style="white-space:nowrap; font-size:12px;">.</font> ] <font style="white-space:nowrap; font-size:12px;">trigger-name</font></td></tr></table> <h3><a name="drop-view-stmt">drop-view-stmt</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">drop-view-stmt</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">DROP</font> <font style="white-space:nowrap; font-size:12px;">VIEW</font> [ <font style="white-space:nowrap; font-size:12px;">IF</font> <font style="white-space:nowrap; font-size:12px;">EXISTS</font> ] [ <font style="white-space:nowrap; font-size:12px;">database-name</font> <font style="white-space:nowrap; font-size:12px;">.</font> ] <font style="white-space:nowrap; font-size:12px;">view-name</font></td></tr></table> <h3><a name="expr">expr</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">expr</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;"><<a href="#literal-value">literal-value</a>></font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">expr</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;"><<a href="#bind-parameter">bind-parameter</a>></font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">expr</td><td>::=</td><td>[ [ <font style="white-space:nowrap; font-size:12px;">database-name</font> <font style="white-space:nowrap; font-size:12px;">.</font> ] <font style="white-space:nowrap; font-size:12px;">table-name</font> <font style="white-space:nowrap; font-size:12px;">.</font> ] <font style="white-space:nowrap; font-size:12px;">column-name</font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">expr</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">unary-operator</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">expr</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> <font style="white-space:nowrap; font-size:12px;">binary-operator</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">expr</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">function-name</font> <font style="white-space:nowrap; font-size:12px;">(</font> [ [ <font style="white-space:nowrap; font-size:12px;">DISTINCT</font> ] <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> [ <font style="white-space:nowrap; font-size:12px;">,</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> ]* | <font style="white-space:nowrap; font-size:12px;">*</font> ] <font style="white-space:nowrap; font-size:12px;">)</font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">expr</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">(</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> <font style="white-space:nowrap; font-size:12px;">)</font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">expr</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">CAST</font> <font style="white-space:nowrap; font-size:12px;">(</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> <font style="white-space:nowrap; font-size:12px;">AS</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#type-name">type-name</a>></font> <font style="white-space:nowrap; font-size:12px;">)</font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">expr</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> <font style="white-space:nowrap; font-size:12px;">COLLATE</font> <font style="white-space:nowrap; font-size:12px;">collation-name</font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">expr</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> [ <font style="white-space:nowrap; font-size:12px;">NOT</font> ] [ <font style="white-space:nowrap; font-size:12px;">LIKE</font> | <font style="white-space:nowrap; font-size:12px;">GLOB</font> | <font style="white-space:nowrap; font-size:12px;">REGEXP</font> | <font style="white-space:nowrap; font-size:12px;">MATCH</font> ]<font style="vertical-align:top; font-size:12px;">1</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> [ <font style="white-space:nowrap; font-size:12px;">ESCAPE</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> ]</td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">expr</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> [ <font style="white-space:nowrap; font-size:12px;">ISNULL</font> | <font style="white-space:nowrap; font-size:12px;">NOTNULL</font> | <font style="white-space:nowrap; font-size:12px;">NOT</font> <font style="white-space:nowrap; font-size:12px;">NULL</font> ]<font style="vertical-align:top; font-size:12px;">1</font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">expr</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> <font style="white-space:nowrap; font-size:12px;">IS</font> [ <font style="white-space:nowrap; font-size:12px;">NOT</font> ] <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">expr</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> [ <font style="white-space:nowrap; font-size:12px;">NOT</font> ] <font style="white-space:nowrap; font-size:12px;">BETWEEN</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> <font style="white-space:nowrap; font-size:12px;">AND</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">expr</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> [ <font style="white-space:nowrap; font-size:12px;">NOT</font> ] <font style="white-space:nowrap; font-size:12px;">IN</font> [ <font style="white-space:nowrap; font-size:12px;">(</font> [ <font style="white-space:nowrap; font-size:12px;"><<a href="#select-stmt">select-stmt</a>></font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> [ <font style="white-space:nowrap; font-size:12px;">,</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> ]* ] <font style="white-space:nowrap; font-size:12px;">)</font> | [ <font style="white-space:nowrap; font-size:12px;">database-name</font> <font style="white-space:nowrap; font-size:12px;">.</font> ] <font style="white-space:nowrap; font-size:12px;">table-name</font> ]<font style="vertical-align:top; font-size:12px;">1</font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">expr</td><td>::=</td><td>[ [ <font style="white-space:nowrap; font-size:12px;">NOT</font> ] <font style="white-space:nowrap; font-size:12px;">EXISTS</font> ] <font style="white-space:nowrap; font-size:12px;">(</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#select-stmt">select-stmt</a>></font> <font style="white-space:nowrap; font-size:12px;">)</font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">expr</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">CASE</font> [ <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> ] <font style="white-space:nowrap; font-size:12px;">WHEN</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> <font style="white-space:nowrap; font-size:12px;">THEN</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> [ <font style="white-space:nowrap; font-size:12px;">ELSE</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> ] <font style="white-space:nowrap; font-size:12px;">END</font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">expr</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;"><<a href="#raise-function">raise-function</a>></font></td></tr></table> <h3><a name="raise-function">raise-function</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">raise-function</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">RAISE</font> <font style="white-space:nowrap; font-size:12px;">(</font> [ <font style="white-space:nowrap; font-size:12px;">IGNORE</font> | [ <font style="white-space:nowrap; font-size:12px;">ROLLBACK</font> | <font style="white-space:nowrap; font-size:12px;">ABORT</font> | <font style="white-space:nowrap; font-size:12px;">FAIL</font> ]<font style="vertical-align:top; font-size:12px;">1</font> <font style="white-space:nowrap; font-size:12px;">,</font> <font style="white-space:nowrap; font-size:12px;">error-message</font> ]<font style="vertical-align:top; font-size:12px;">1</font> <font style="white-space:nowrap; font-size:12px;">)</font></td></tr></table> <h3><a name="literal-value">literal-value</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">literal-value</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">integer-literal</font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">literal-value</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">floating-point-literal</font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">literal-value</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">string-literal</font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">literal-value</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">blob-literal</font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">literal-value</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">NULL</font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">literal-value</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">CURRENT_TIME</font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">literal-value</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">CURRENT_DATE</font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">literal-value</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">CURRENT_TIMESTAMP</font></td></tr></table> <h3><a name="insert-stmt">insert-stmt</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">insert-stmt</td><td>::=</td><td>[ <font style="white-space:nowrap; font-size:12px;">INSERT</font> [ <font style="white-space:nowrap; font-size:12px;">OR</font> [ <font style="white-space:nowrap; font-size:12px;">ROLLBACK</font> | <font style="white-space:nowrap; font-size:12px;">ABORT</font> | <font style="white-space:nowrap; font-size:12px;">REPLACE</font> | <font style="white-space:nowrap; font-size:12px;">FAIL</font> | <font style="white-space:nowrap; font-size:12px;">IGNORE</font> ]<font style="vertical-align:top; font-size:12px;">1</font> ] | <font style="white-space:nowrap; font-size:12px;">REPLACE</font> ]<font style="vertical-align:top; font-size:12px;">1</font> <font style="white-space:nowrap; font-size:12px;">INTO</font> [ <font style="white-space:nowrap; font-size:12px;">database-name</font> <font style="white-space:nowrap; font-size:12px;">.</font> ] <font style="white-space:nowrap; font-size:12px;">table-name</font><br>[ [ <font style="white-space:nowrap; font-size:12px;">(</font> <font style="white-space:nowrap; font-size:12px;">column-name</font> [ <font style="white-space:nowrap; font-size:12px;">,</font> <font style="white-space:nowrap; font-size:12px;">column-name</font> ]* <font style="white-space:nowrap; font-size:12px;">)</font> ] [ <font style="white-space:nowrap; font-size:12px;">VALUES</font> <font style="white-space:nowrap; font-size:12px;">(</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> [ <font style="white-space:nowrap; font-size:12px;">,</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> ]* <font style="white-space:nowrap; font-size:12px;">)</font> | <font style="white-space:nowrap; font-size:12px;"><<a href="#select-stmt">select-stmt</a>></font> ]<font style="vertical-align:top; font-size:12px;">1</font> | <font style="white-space:nowrap; font-size:12px;">DEFAULT</font> <font style="white-space:nowrap; font-size:12px;">VALUES</font> ]<font style="vertical-align:top; font-size:12px;">1</font></td></tr></table> <h3><a name="pragma-stmt">pragma-stmt</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">pragma-stmt</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">PRAGMA</font> [ <font style="white-space:nowrap; font-size:12px;">database-name</font> <font style="white-space:nowrap; font-size:12px;">.</font> ] <font style="white-space:nowrap; font-size:12px;">pragma-name</font> [ <font style="white-space:nowrap; font-size:12px;">=</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#pragma-value">pragma-value</a>></font> | <font style="white-space:nowrap; font-size:12px;">(</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#pragma-value">pragma-value</a>></font> <font style="white-space:nowrap; font-size:12px;">)</font> ]</td></tr></table> <h3><a name="pragma-value">pragma-value</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">pragma-value</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;"><<a href="#signed-number">signed-number</a>></font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">pragma-value</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">name</font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">pragma-value</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">string-literal</font></td></tr></table> <h3><a name="reindex-stmt">reindex-stmt</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">reindex-stmt</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">REINDEX</font> [ <font style="white-space:nowrap; font-size:12px;">collation-name</font> | [ <font style="white-space:nowrap; font-size:12px;">database-name</font> <font style="white-space:nowrap; font-size:12px;">.</font> ] [ <font style="white-space:nowrap; font-size:12px;">table-name</font> | <font style="white-space:nowrap; font-size:12px;">index-name</font> ]<font style="vertical-align:top; font-size:12px;">1</font> ]<font style="vertical-align:top; font-size:12px;">1</font></td></tr></table> <h3><a name="select-stmt">select-stmt</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">select-stmt</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;"><<a href="#select-core">select-core</a>></font> [ <font style="white-space:nowrap; font-size:12px;"><<a href="#compound-operator">compound-operator</a>></font> <font style="white-space:nowrap; font-size:12px;"><<a href="#select-core">select-core</a>></font> ]*<br>[ <font style="white-space:nowrap; font-size:12px;">ORDER</font> <font style="white-space:nowrap; font-size:12px;">BY</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#ordering-term">ordering-term</a>></font> [ <font style="white-space:nowrap; font-size:12px;">,</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#ordering-term">ordering-term</a>></font> ]* ]<br>[ <font style="white-space:nowrap; font-size:12px;">LIMIT</font> <font style="white-space:nowrap; font-size:12px;">integer</font> [ [ <font style="white-space:nowrap; font-size:12px;">OFFSET</font> | <font style="white-space:nowrap; font-size:12px;">,</font> ]<font style="vertical-align:top; font-size:12px;">1</font> <font style="white-space:nowrap; font-size:12px;">integer</font> ] ]</td></tr></table> <h3><a name="select-core">select-core</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">select-core</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">SELECT</font> [ <font style="white-space:nowrap; font-size:12px;">DISTINCT</font> | <font style="white-space:nowrap; font-size:12px;">ALL</font> ] <font style="white-space:nowrap; font-size:12px;"><<a href="#result-column">result-column</a>></font> [ <font style="white-space:nowrap; font-size:12px;">,</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#result-column">result-column</a>></font> ]*<br>[ <font style="white-space:nowrap; font-size:12px;">FROM</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#join-source">join-source</a>></font> ]<br>[ <font style="white-space:nowrap; font-size:12px;">WHERE</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> ]<br>[ <font style="white-space:nowrap; font-size:12px;">GROUP</font> <font style="white-space:nowrap; font-size:12px;">BY</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#ordering-term">ordering-term</a>></font> [ <font style="white-space:nowrap; font-size:12px;">,</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#ordering-term">ordering-term</a>></font> ]* [ <font style="white-space:nowrap; font-size:12px;">HAVING</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> ] ]</td></tr></table> <h3><a name="result-column">result-column</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">result-column</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">*</font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">result-column</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">table-name</font> <font style="white-space:nowrap; font-size:12px;">.</font> <font style="white-space:nowrap; font-size:12px;">*</font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">result-column</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> [ [ <font style="white-space:nowrap; font-size:12px;">AS</font> ] <font style="white-space:nowrap; font-size:12px;">column-alias</font> ]</td></tr></table> <h3><a name="join-source">join-source</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">join-source</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;"><<a href="#single-source">single-source</a>></font> [ <font style="white-space:nowrap; font-size:12px;"><<a href="#join-op">join-op</a>></font> <font style="white-space:nowrap; font-size:12px;"><<a href="#single-source">single-source</a>></font> <font style="white-space:nowrap; font-size:12px;"><<a href="#join-constraint">join-constraint</a>></font> ]</td></tr></table> <h3><a name="single-source">single-source</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">single-source</td><td>::=</td><td>[ <font style="white-space:nowrap; font-size:12px;">database-name</font> <font style="white-space:nowrap; font-size:12px;">.</font> ] <font style="white-space:nowrap; font-size:12px;">table-name</font> [ [ <font style="white-space:nowrap; font-size:12px;">AS</font> ] <font style="white-space:nowrap; font-size:12px;">table-alias</font> ] [ <font style="white-space:nowrap; font-size:12px;">INDEXED</font> <font style="white-space:nowrap; font-size:12px;">BY</font> <font style="white-space:nowrap; font-size:12px;">index-name</font> | <font style="white-space:nowrap; font-size:12px;">NOT</font> <font style="white-space:nowrap; font-size:12px;">INDEXED</font> ]</td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">single-source</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">(</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#select-stmt">select-stmt</a>></font> <font style="white-space:nowrap; font-size:12px;">)</font> [ [ <font style="white-space:nowrap; font-size:12px;">AS</font> ] <font style="white-space:nowrap; font-size:12px;">table-alias</font> ]</td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">single-source</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">(</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#join-source">join-source</a>></font> <font style="white-space:nowrap; font-size:12px;">)</font></td></tr></table> <h3><a name="join-op">join-op</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">join-op</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">,</font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">join-op</td><td>::=</td><td>[ <font style="white-space:nowrap; font-size:12px;">NATURAL</font> ] [ [ <font style="white-space:nowrap; font-size:12px;">LEFT</font> ] [ <font style="white-space:nowrap; font-size:12px;">OUTER</font> ] | <font style="white-space:nowrap; font-size:12px;">INNER</font> | <font style="white-space:nowrap; font-size:12px;">CROSS</font> ]<font style="vertical-align:top; font-size:12px;">1</font> <font style="white-space:nowrap; font-size:12px;">JOIN</font></td></tr></table> <h3><a name="join-constraint">join-constraint</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">join-constraint</td><td>::=</td><td>[ <font style="white-space:nowrap; font-size:12px;">ON</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> | <font style="white-space:nowrap; font-size:12px;">USING</font> <font style="white-space:nowrap; font-size:12px;">(</font> <font style="white-space:nowrap; font-size:12px;">column-name</font> [ <font style="white-space:nowrap; font-size:12px;">,</font> <font style="white-space:nowrap; font-size:12px;">column-name</font> ]* <font style="white-space:nowrap; font-size:12px;">)</font> ]</td></tr></table> <h3><a name="ordering-term">ordering-term</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">ordering-term</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> [ <font style="white-space:nowrap; font-size:12px;">COLLATE</font> <font style="white-space:nowrap; font-size:12px;">collation-name</font> ] [ <font style="white-space:nowrap; font-size:12px;">ASC</font> | <font style="white-space:nowrap; font-size:12px;">DESC</font> ]</td></tr></table> <h3><a name="compound-operator">compound-operator</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">compound-operator</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">UNION</font> [ <font style="white-space:nowrap; font-size:12px;">ALL</font> ]</td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">compound-operator</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">INTERSECT</font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">compound-operator</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">EXCEPT</font></td></tr></table> <h3><a name="update-stmt">update-stmt</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">update-stmt</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">UPDATE</font> [ <font style="white-space:nowrap; font-size:12px;">OR</font> [ <font style="white-space:nowrap; font-size:12px;">ROLLBACK</font> | <font style="white-space:nowrap; font-size:12px;">ABORT</font> | <font style="white-space:nowrap; font-size:12px;">REPLACE</font> | <font style="white-space:nowrap; font-size:12px;">FAIL</font> | <font style="white-space:nowrap; font-size:12px;">IGNORE</font> ]<font style="vertical-align:top; font-size:12px;">1</font> ] <font style="white-space:nowrap; font-size:12px;"><<a href="#qualified-table-name">qualified-table-name</a>></font><br><font style="white-space:nowrap; font-size:12px;">SET</font> <font style="white-space:nowrap; font-size:12px;">column-name</font> <font style="white-space:nowrap; font-size:12px;">=</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> [ <font style="white-space:nowrap; font-size:12px;">,</font> <font style="white-space:nowrap; font-size:12px;">column-name</font> <font style="white-space:nowrap; font-size:12px;">=</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> ]* [ <font style="white-space:nowrap; font-size:12px;">WHERE</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> ]</td></tr></table> <h3><a name="update-stmt-limited">update-stmt-limited</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">update-stmt-limited</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">UPDATE</font> [ <font style="white-space:nowrap; font-size:12px;">OR</font> [ <font style="white-space:nowrap; font-size:12px;">ROLLBACK</font> | <font style="white-space:nowrap; font-size:12px;">ABORT</font> | <font style="white-space:nowrap; font-size:12px;">REPLACE</font> | <font style="white-space:nowrap; font-size:12px;">FAIL</font> | <font style="white-space:nowrap; font-size:12px;">IGNORE</font> ]<font style="vertical-align:top; font-size:12px;">1</font> ] <font style="white-space:nowrap; font-size:12px;"><<a href="#qualified-table-name">qualified-table-name</a>></font><br><font style="white-space:nowrap; font-size:12px;">SET</font> <font style="white-space:nowrap; font-size:12px;">column-name</font> <font style="white-space:nowrap; font-size:12px;">=</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> [ <font style="white-space:nowrap; font-size:12px;">,</font> <font style="white-space:nowrap; font-size:12px;">column-name</font> <font style="white-space:nowrap; font-size:12px;">=</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> ]* [ <font style="white-space:nowrap; font-size:12px;">WHERE</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#expr">expr</a>></font> ]<br>[ [ <font style="white-space:nowrap; font-size:12px;">ORDER</font> <font style="white-space:nowrap; font-size:12px;">BY</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#ordering-term">ordering-term</a>></font> [ <font style="white-space:nowrap; font-size:12px;">,</font> <font style="white-space:nowrap; font-size:12px;"><<a href="#ordering-term">ordering-term</a>></font> ]* ]<br><font style="white-space:nowrap; font-size:12px;">LIMIT</font> <font style="white-space:nowrap; font-size:12px;">integer</font> [ [ <font style="white-space:nowrap; font-size:12px;">OFFSET</font> | <font style="white-space:nowrap; font-size:12px;">,</font> ]<font style="vertical-align:top; font-size:12px;">1</font> <font style="white-space:nowrap; font-size:12px;">integer</font> ] ]</td></tr></table> <h3><a name="qualified-table-name">qualified-table-name</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">qualified-table-name</td><td>::=</td><td>[ <font style="white-space:nowrap; font-size:12px;">database-name</font> <font style="white-space:nowrap; font-size:12px;">.</font> ] <font style="white-space:nowrap; font-size:12px;">table-name</font> [ <font style="white-space:nowrap; font-size:12px;">INDEXED</font> <font style="white-space:nowrap; font-size:12px;">BY</font> <font style="white-space:nowrap; font-size:12px;">index-name</font> | <font style="white-space:nowrap; font-size:12px;">NOT</font> <font style="white-space:nowrap; font-size:12px;">INDEXED</font> ]</td></tr></table> <h3><a name="vacuum-stmt">vacuum-stmt</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">vacuum-stmt</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">VACUUM</font></td></tr></table> <h3><a name="comment-syntax">comment-syntax</a>:</h3> <table><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">comment-syntax</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">--</font> [ <font style="white-space:nowrap; font-size:12px;">anything-except-newline</font> ]* [ <font style="white-space:nowrap; font-size:12px;">newline</font> | <font style="white-space:nowrap; font-size:12px;">end-of-input</font> ]<font style="vertical-align:top; font-size:12px;">1</font></td></tr><tr><td style="font-size:12px; white-space:nowrap; padding-top:6px;">comment-syntax</td><td>::=</td><td><font style="white-space:nowrap; font-size:12px;">/*</font> [ <font style="white-space:nowrap; font-size:12px;">anything-except-*/</font> ]* [ <font style="white-space:nowrap; font-size:12px;">*/</font> | <font style="white-space:nowrap; font-size:12px;">end-of-input</font> ]<font style="vertical-align:top; font-size:12px;">1</font></td></tr></table> </body> </html> |
Added art/syntax/bubble-generator-bnf.tcl.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 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 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 | #!/bin/tclsh # # Run this TCL script to generate syntax bubble diagrams from # text descriptions. # # This version generates a pure HTML table based version with # no graphics, all in one file named "all-text.html". It may # be useful to people wanting text search or screen reader # support. # Graphs: # set all_graphs { sql-stmt-list { toploop {optx sql-stmt} ; } sql-stmt { line {opt EXPLAIN {opt QUERY PLAN}} {or alter-table-stmt analyze-stmt attach-stmt begin-stmt commit-stmt create-index-stmt create-table-stmt create-trigger-stmt create-view-stmt create-virtual-table-stmt delete-stmt delete-stmt-limited detach-stmt drop-index-stmt drop-table-stmt drop-trigger-stmt drop-view-stmt insert-stmt pragma-stmt reindex-stmt release-stmt rollback-stmt savepoint-stmt select-stmt update-stmt update-stmt-limited vacuum-stmt } } alter-table-stmt { stack {line ALTER TABLE {optx /database-name .} /table-name} {tailbranch {line RENAME TO /new-table-name} {line ADD {optx COLUMN} column-def} } } analyze-stmt { line ANALYZE {or nil /database-name /table-name {line /database-name . /table-name}} } attach-stmt { line ATTACH {or DATABASE nil} /filename AS /database-name } begin-stmt { line BEGIN {or nil DEFERRED IMMEDIATE EXCLUSIVE} {optx TRANSACTION} } commit-stmt { line {or COMMIT END} {optx TRANSACTION} } rollback-stmt { line ROLLBACK {optx TRANSACTION} {optx TO {optx SAVEPOINT} /savepoint-name} } savepoint-stmt { line SAVEPOINT /savepoint-name } release-stmt { line RELEASE {optx SAVEPOINT} /savepoint-name } create-index-stmt { stack {line CREATE {opt UNIQUE} INDEX {opt IF NOT EXISTS}} {line {optx /database-name .} /index-name ON /table-name ( {loop indexed-column ,} )} } indexed-column { line /column-name {optx COLLATE /collation-name} {or ASC DESC nil} } create-table-stmt { stack {line CREATE {or {} TEMP TEMPORARY} TABLE {opt IF NOT EXISTS}} {line {optx /database-name .} /table-name {tailbranch {line ( {loop column-def ,} {loop {} {, table-constraint}} )} {line AS select-stmt} } } } column-def { line /column-name {or type-name nil} {loop nil {nil column-constraint nil}} } type-name { line {loop /name {}} {or {} {line ( signed-number )} {line ( signed-number , signed-number )} } } column-constraint { stack {optx CONSTRAINT /name} {or {line PRIMARY KEY {or nil ASC DESC} conflict-clause {opt AUTOINCREMENT} } {line NOT NULL conflict-clause} {line UNIQUE conflict-clause} {line CHECK ( expr )} {line DEFAULT {or signed-number literal-value {line ( expr )} } } {line COLLATE /collation-name} {line foreign-key-clause} } } signed-number { line {or nil + -} {or /integer-literal /floating-point-literal} } table-constraint { stack {optx CONSTRAINT /name} {or {line {or {line PRIMARY KEY} UNIQUE} ( {loop indexed-column ,} ) conflict-clause} {line CHECK ( expr )} {line FOREIGN KEY ( {loop /column-name ,} ) foreign-key-clause } } } foreign-key-clause { stack {line REFERENCES /foreign-table {optx ( {loop /column-name ,} )}} {optx {loop {or {line ON {or DELETE UPDATE} {or {line SET NULL} {line SET DEFAULT} CASCADE RESTRICT {line NO ACTION} } } {line MATCH /name} } {} } } {optx {line {optx NOT} DEFERRABLE {or {line INITIALLY DEFERRED} {line INITIALLY IMMEDIATE} {} } } nil } } conflict-clause { opt {line ON CONFLICT {or ROLLBACK ABORT FAIL IGNORE REPLACE}} } create-trigger-stmt { stack {line CREATE {or {} TEMP TEMPORARY} TRIGGER {opt IF NOT EXISTS}} {line {optx /database-name .} /trigger-name {or BEFORE AFTER {line INSTEAD OF} nil} } {line {or DELETE INSERT {line UPDATE {opt OF {loop /column-name ,} }} } ON /table-name } {line {optx FOR EACH ROW} {optx WHEN expr} } {line BEGIN {loop {line {or update-stmt insert-stmt delete-stmt select-stmt} ;} nil } END } } create-view-stmt { stack {line CREATE {or {} TEMP TEMPORARY} VIEW {opt IF NOT EXISTS}} {line {optx /database-name .} /view-name AS select-stmt} } create-virtual-table-stmt { stack {line CREATE VIRTUAL TABLE {optx /database-name .} /table-name} {line USING /module-name {optx ( {loop /module-argument ,} )}} } delete-stmt { line DELETE FROM qualified-table-name {optx WHERE expr} } delete-stmt-limited { stack {line DELETE FROM qualified-table-name {optx WHERE expr}} {optx {stack {optx ORDER BY {loop ordering-term ,}} {line LIMIT /integer {optx {or OFFSET ,} /integer}} } } } detach-stmt { line DETACH {optx DATABASE} /database-name } drop-index-stmt { line DROP INDEX {optx IF EXISTS} {optx /database-name .} /index-name } drop-table-stmt { line DROP TABLE {optx IF EXISTS} {optx /database-name .} /table-name } drop-trigger-stmt { line DROP TRIGGER {optx IF EXISTS} {optx /database-name .} /trigger-name } drop-view-stmt { line DROP VIEW {optx IF EXISTS} {optx /database-name .} /view-name } expr { or {line literal-value} {line bind-parameter} {line {optx {optx /database-name .} /table-name .} /column-name} {line /unary-operator expr} {line expr /binary-operator expr} {line /function-name ( {or {line {optx DISTINCT} {toploop expr ,}} {} *} )} {line ( expr )} {line CAST ( expr AS type-name )} {line expr COLLATE /collation-name} {line expr {optx NOT} {or LIKE GLOB REGEXP MATCH} expr {optx ESCAPE expr}} {line expr {or ISNULL NOTNULL {line NOT NULL}}} {line expr IS {optx NOT} expr} {line expr {optx NOT} BETWEEN expr AND expr} {line expr {optx NOT} IN {or {line ( {or {} select-stmt {loop expr ,}} )} {line {optx /database-name .} /table-name} } } {line {optx {optx NOT} EXISTS} ( select-stmt )} {line CASE {optx expr} {loop {line WHEN expr THEN expr} {}} {optx ELSE expr} END} {line raise-function} } raise-function { line RAISE ( {or IGNORE {line {or ROLLBACK ABORT FAIL} , /error-message } } ) } literal-value { or {line /integer-literal} {line /floating-point-literal} {line /string-literal} {line /blob-literal} {line NULL} {line CURRENT_TIME} {line CURRENT_DATE} {line CURRENT_TIMESTAMP} } insert-stmt { stack {line {or {line INSERT {opt OR {or ROLLBACK ABORT REPLACE FAIL IGNORE}}} REPLACE } INTO {optx /database-name .} /table-name } {tailbranch {line {optx ( {loop /column-name ,} )} {tailbranch {line VALUES ( {loop expr ,} )} select-stmt } } {line DEFAULT VALUES} } } pragma-stmt { line PRAGMA {optx /database-name .} /pragma-name {or nil {line = pragma-value} {line ( pragma-value )} } } pragma-value { or signed-number /name /string-literal } reindex-stmt { line REINDEX {tailbranch /collation-name {line {optx /database-name .} {tailbranch /table-name /index-name} } } } select-stmt { stack {loop {line select-core nil} {nil compound-operator nil}} {optx ORDER BY {loop ordering-term ,}} {optx LIMIT /integer {optx {or OFFSET ,} /integer}} } select-core { stack {line SELECT {or nil DISTINCT ALL} {loop result-column ,}} {optx FROM join-source} {optx WHERE expr} {optx GROUP BY {loop ordering-term ,} {optx HAVING expr}} } result-column { or * {line /table-name . *} {line expr {optx {optx AS} /column-alias}} } join-source { line single-source {opt {loop {line nil join-op single-source join-constraint nil} {}}} } single-source { or {line {optx /database-name .} /table-name {optx {optx AS} /table-alias} {or nil {line INDEXED BY /index-name} {line NOT INDEXED}} } {line ( select-stmt ) {optx {optx AS} /table-alias} } {line ( join-source )} } join-op { or {line ,} {line {opt NATURAL} {or {line {opt LEFT} {opt OUTER}} INNER CROSS} JOIN } } join-constraint { or {line ON expr} {line USING ( {loop /column-name ,} )} nil } ordering-term { line expr {opt COLLATE /collation-name} {or nil ASC DESC} } compound-operator { or {line UNION {optx ALL}} INTERSECT EXCEPT } update-stmt { stack {line UPDATE {opt OR {or ROLLBACK ABORT REPLACE FAIL IGNORE}} qualified-table-name} {line SET {loop {line /column-name = expr} ,} {optx WHERE expr}} } update-stmt-limited { stack {line UPDATE {opt OR {or ROLLBACK ABORT REPLACE FAIL IGNORE}} qualified-table-name} {line SET {loop {line /column-name = expr} ,} {optx WHERE expr}} {optx {stack {optx ORDER BY {loop ordering-term ,}} {line LIMIT /integer {optx {or OFFSET ,} /integer}} } } } qualified-table-name { line {optx /database-name .} /table-name {or nil {line INDEXED BY /index-name} {line NOT INDEXED}} } vacuum-stmt { line VACUUM } comment-syntax { or {line -- {loop nil /anything-except-newline} {or /newline /end-of-input}} {line /* {loop nil /anything-except-*/} {or */ /end-of-input}} } } # padding (diff betwee font1 and font2) set pad "6px" # used for bubble text set font1 "12px" # used for bnf syntax [ ] | etc. set font2 "18px" # used for everything else (~ font1+5) set font3 "16px" # Draw a bubble containing $txt. # proc draw_bubble {txt} { global font1 if {$txt=="nil"} { return [list 1 ""] } if {[regexp {^/[a-z]} $txt]} { set txt [string range $txt 1 end] set istoken 1 } elseif {[regexp {^[a-z]} $txt]} { set istoken 0 } else { set istoken 1 } if {!$istoken} { set txt "<<a href=\"#$txt\">$txt</a>>" } return [list 1 "<font style=\"white-space:nowrap; font-size:$font1;\">$txt</font>"] } # Draw a sequence of terms from left to write. Each element of $lx # descripts a single term. # proc draw_line {lx} { global font1 set n [llength $lx] set h 1 set content "" set i 0 foreach term $lx { incr i set rc [draw_diagram $term] set th [lindex $rc 0] set tcontent [lindex $rc 1] if { $tcontent != "" } { if { $content != "" } { set content "$content $tcontent" } else { set content "$tcontent" } if { $th > $h } { set h $th } } } set content "$content" return [list $h $content] } # Draw a sequence of terms from top to bottom. # proc draw_stack {indent lx} { global font1 set n [llength $lx] set h 0 set content "" set i 0 foreach term $lx { if { $term != "" } { set rc [draw_diagram $term] set th [lindex $rc 0] set tcontent [lindex $rc 1] set h [ expr { $h + $th } ] incr i if {$i == 1} { set content "$tcontent" } else { set content "$content<br>$tcontent" } } } return [list $h $content] } proc draw_loop {forward back} { global font1 set h 0 set content "" set rc [draw_diagram $forward] set th [lindex $rc 0] set tcontent [lindex $rc 1] if { $tcontent != "" } { set content "$tcontent" if { $th > $h } { set h $th } } set rc [draw_line $back] set th [lindex $rc 0] set tcontent [lindex $rc 1] if { $tcontent != "" } { if { $content != "" } { set content "$content \[ $tcontent $content ]*" } else { set content "\[ $tcontent ]*" } if { $th > $h } { set h $th } } return [list $h $content] } proc draw_or {lx} { global font1 set n [llength $lx] set h 0 if {$n < 1} { set content "" } else { set content "" set i 0 set req "<font style=\"vertical-align:top; font-size:$font1;\">1</font>" foreach term $lx { set rc [draw_diagram $term] set th [lindex $rc 0] set tcontent [lindex $rc 1] if { $tcontent == "" } { set req "" } else { incr i if {$i == 1} { set content "$tcontent" } else { set content "$content | $tcontent" } if { $th > $h } { set h $th } } } } set content "\[ $content ]$req" return [list $h $content] } proc draw_diagram {spec} { global font1 set n [llength $spec] set cmd [lindex $spec 0] if {$n==1} { set rc [draw_bubble $spec] } elseif {$n==0} { set rc [draw_bubble nil] } elseif {$cmd=="line"} { set rc [draw_line [lrange $spec 1 end]] } elseif {$cmd=="stack"} { set rc [draw_stack 0 [lrange $spec 1 end]] } elseif {$cmd=="indentstack"} { set rc [draw_stack $::HSEP [lrange $spec 1 end]] } elseif {$cmd=="loop"} { set rc [draw_loop [lindex $spec 1] [lindex $spec 2]] } elseif {$cmd=="toploop"} { set rc [draw_loop [lindex $spec 1] [lindex $spec 2]] } elseif {$cmd=="or"} { set rc [draw_or [lrange $spec 1 end]] } elseif {$cmd=="opt"} { set args [lrange $spec 1 end] if {[llength $args]==1} { set rc [draw_or [list nil [lindex $args 0]]] } else { set rc [draw_or [list nil "line $args"]] } } elseif {$cmd=="optx"} { set args [lrange $spec 1 end] if {[llength $args]==1} { set rc [draw_or [list [lindex $args 0] nil]] } else { set rc [draw_or [list "line $args" nil]] } } elseif {$cmd=="tailbranch"} { # set rc [draw_tail_branch [lrange $spec 1 end]] set rc [draw_or [lrange $spec 1 end]] } else { error "unknown operator: $cmd" } set h [lindex $rc 0] set content [lindex $rc 1] return [list $h $content] } proc draw_graph {name spec} { global font1 pad set cmd1 [lindex $spec 0] if { $cmd1 == "or" } { set req 1 set spec1 [lrange $spec 1 end] foreach term $spec1 { if { $term == "" || $term == "nil"} { set req 0 } } if { $req == 1 } { set content "<table>" set h 0 foreach term $spec1 { set rc [ draw_diagram "line [list $term]"] set th [lindex $rc 0] set tcontent [lindex $rc 1] set content "$content<tr><td style=\"font-size:$font1; white-space:nowrap; padding-top:$pad;\">$name</td><td>::=</td><td>$tcontent</td></tr>" set h [ expr { $h + $th } ] } set content "$content</table>" return [list $h $content] } } set rc [ draw_diagram "line [list $spec]"] set h [lindex $rc 0] set content [lindex $rc 1] set content "<table><tr><td style=\"font-size:$font1; white-space:nowrap; padding-top:$pad;\">$name</td><td>::=</td><td>$content</td></tr></table>" return [list $h $content] } set f [open all-bnf.html w] puts $f "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">" puts $f "<html>" puts $f "<head>" puts $f "<style type='text/css'>" puts $f "h3 { font-family:helvetica; font-size:$font3; }" puts $f "table, tr, td { font-family:helvetica; font-size:$font2; empty-cells:show; border-collapse:separate; border-style:none; vertical-align:top; }" puts $f "</style>" puts $f "</head>" puts $f "<body>" foreach {name graph} $all_graphs { if {$name == "sql-stmt-list" || 1} { puts $f "<h3><a name=\"$name\">$name</a>:</h3>" set rc [draw_graph $name $graph] set h [lindex $rc 0] set content [lindex $rc 1] puts $f "$content" } } puts $f "</body>" puts $f "</html>" close $f |