Documentation Source Text

Check-in [8cad2470c0]
Login

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

Overview
Comment:Add ACTION and NO to the list of keywords in the lang_keywords.html document. Reformat the keyword lists into testable statements.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8cad2470c0b79dcebe5e989350ac0a0d8d70d530
User & Date: drh 2010-01-02 03:20:17
Context
2010-01-02
18:49
Add source code for documentation search page. check-in: 793a5fcb1b user: dan tags: trunk
03:20
Add ACTION and NO to the list of keywords in the lang_keywords.html document. Reformat the keyword lists into testable statements. check-in: 8cad2470c0 user: drh tags: trunk
2010-01-01
14:46
Updates to the datatype3.html document to fix issues found while writing tests against that document. check-in: 490c97c96c user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to matrix.tcl.

32
33
34
35
36
37
38
39
40
41


42
43
44
45
46
47
48
...
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
...
319
320
321
322
323
324
325

326
327




328
329
330
331
332
333
334
...
463
464
465
466
467
468
469
470
471
472


473
474
475
476
477
478
479
...
548
549
550
551
552
553
554

#
#    <img alt="syntax diagram NAME" src="FILENAME.gif">
#
# The requirement table of the docinfo.db is populated with requirement
# information.  See the schema.tcl source file for a definition of the
# requirment table.
#
puts "Scanning documentation for testable statements..."
flush stdout
foreach file $filelist {


  set in [open $file]
  set x [read $in [file size $file]]
  close $in
  set orig_x $x
  set origlen [string length $x]
  regsub {^doc/} $file {} srcfile
  set seqno 0
................................................................................
}
db eval COMMIT
set cnt [db one {SELECT count(*) FROM requirement}]
set evcnt [db one {
  SELECT count(*) FROM requirement WHERE reqno IN (SELECT reqno FROM evidence)
}]
set evpct [format {%.1f%%} [expr {$evcnt*100.0/$cnt}]]
puts "Found $cnt testable statements. Evidence exists for $evcnt or $evpct"

# Report all evidence for which there is no corresponding requirement.
# Such evidence is probably "stale" - the requirement text has changed but
# the evidence text did not.
#
db eval {
  SELECT reqno, srcfile, srcline FROM evidence
................................................................................
#
proc wrap_in_comment {out prefix txt} {
  while {[string length $txt]>70} {
    set break [string last { } $txt 70]
    if {$break == 0} {
      set break [string first { } $txt]
    }

    puts $out "$prefix [string range $txt 0 [expr {$break-1}]]"
    set txt [string trim [string range $txt $break end]]




  }
  puts $out "$prefix $txt"
}



# Detail matrixes for each document.
................................................................................
  }
  puts $out {</table>}
  close $out
}

# Translate documentation to show requirements with links to the matrix.
#
puts "Translating documentation..."
flush stdout
foreach file $filelist {


  regsub {^doc/} $file {} basename
  set outfile doc/matrix/$basename
  if {![info exists matrixname($basename)]} {
    file copy -force $file $outfile
    continue
  }
  set in [open $file]
................................................................................
    }
  }
  append out $x
  set outfd [open $outfile w]
  puts -nonewline $outfd $out
  close $outfd
}








|


>
>







 







|







 







>
|
|
>
>
>
>







 







|


>
>







 







>
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
...
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
...
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
...
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
...
557
558
559
560
561
562
563
564
#
#    <img alt="syntax diagram NAME" src="FILENAME.gif">
#
# The requirement table of the docinfo.db is populated with requirement
# information.  See the schema.tcl source file for a definition of the
# requirment table.
#
puts -nonewline "Scanning documentation for testable statements"
flush stdout
foreach file $filelist {
  puts -nonewline .
  flush stdout
  set in [open $file]
  set x [read $in [file size $file]]
  close $in
  set orig_x $x
  set origlen [string length $x]
  regsub {^doc/} $file {} srcfile
  set seqno 0
................................................................................
}
db eval COMMIT
set cnt [db one {SELECT count(*) FROM requirement}]
set evcnt [db one {
  SELECT count(*) FROM requirement WHERE reqno IN (SELECT reqno FROM evidence)
}]
set evpct [format {%.1f%%} [expr {$evcnt*100.0/$cnt}]]
puts "\nFound $cnt testable statements. Evidence exists for $evcnt or $evpct"

# Report all evidence for which there is no corresponding requirement.
# Such evidence is probably "stale" - the requirement text has changed but
# the evidence text did not.
#
db eval {
  SELECT reqno, srcfile, srcline FROM evidence
................................................................................
#
proc wrap_in_comment {out prefix txt} {
  while {[string length $txt]>70} {
    set break [string last { } $txt 70]
    if {$break == 0} {
      set break [string first { } $txt]
    }
    if {$break>0} {
      puts $out "$prefix [string range $txt 0 [expr {$break-1}]]"
      set txt [string trim [string range $txt $break end]]
    } else {
      puts $out "$prefix $txt"
      return
    }
  }
  puts $out "$prefix $txt"
}



# Detail matrixes for each document.
................................................................................
  }
  puts $out {</table>}
  close $out
}

# Translate documentation to show requirements with links to the matrix.
#
puts -nonewline "Translating documentation"
flush stdout
foreach file $filelist {
  puts -nonewline .
  flush stdout
  regsub {^doc/} $file {} basename
  set outfile doc/matrix/$basename
  if {![info exists matrixname($basename)]} {
    file copy -force $file $outfile
    continue
  }
  set in [open $file]
................................................................................
    }
  }
  append out $x
  set outfd [open $outfile w]
  puts -nonewline $outfd $out
  close $outfd
}
puts ""

Changes to pages/lang.in.

2688
2689
2690
2691
2692
2693
2694

2695
2696
2697
2698
2699
2700
2701
....
2762
2763
2764
2765
2766
2767
2768

2769
2770
2771
2772
2773
2774
2775
....
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893







2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904


2905
2906
2907
2908
2909

2910
2911

2912



















































2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
<tcl>
#############################################################################
# A list of keywords.  A asterisk occurs after the keyword if it is on
# the fallback list.
#
set keyword_list [lsort {
   ABORT*

   ADD
   AFTER*
   ALL
   ALTER
   ANALYZE*
   AND
   AS
................................................................................
   JOIN
   KEY*
   LEFT
   LIKE*
   LIMIT
   MATCH*
   NATURAL

   NOT
   NOTNULL
   NULL
   OF*
   OFFSET*
   ON
   OR
................................................................................

<p>Programmers are cautioned not to use the two exceptions described in
the previous bullets.  We emphasize that they exist only so that old
and ill-formed SQL statements will run correctly.  Future versions of
SQLite might change to raise errors instead of accepting the malformed
statements covered by the exceptions above.</p>

<p>SQLite is extended to allow many keywords to be used unquoted
as the names of databases, tables, indices, triggers, views, columns,
user-defined functions, collations, attached databases, and virtual
function modules.
In the list of keywords that follows, those that can be used as identifiers
are shown in an italic font.  Keywords that must be quoted in order to be
used as identifiers are shown in bold.</p>

<p>
SQLite adds new keywords from time to time when it takes on new features.
So to prevent your code from being broken by future enhancements, you should
normally quote any identifier that is an English language word, even if
you do not have to.
</p>

<p>
The following are the keywords currently recognized by SQLite:







</p>

<blockquote>
<table width="100%" class="pdf_keywords">
<tr>
<td align="left" valign="top" width="20%">

<tcl>
set n [llength $keyword_list]
set nCol 5
set nRow [expr {($n+$nCol-1)/$nCol}]


set i 0
foreach word $keyword_list {
  if {[string index $word end]=="*"} {
    set word [string range $word 0 end-1]
    set font i

  } else {
    set font b

  }



















































  if {$i==$nRow} {
    hd_puts "</td><td valign=\"top\" align=\"left\" width=\"20%\">"
    set i 1
  } else {
    incr i
  }
  hd_puts "<$font>$word</$font><br>"
}
</tcl>
</td></tr></table></blockquote>

<h2>Special names</h2>

<p>The following are not keywords in SQLite, but are used as names of 
system objects.  They can be used as an identifier for a different 
type of object.</p>








>







 







>







 







<
<
<
<
<
<
<
<








|
>
>
>
>
>
>
>



|
<

<




>
>





>


>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>






|


|







2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
....
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
....
2872
2873
2874
2875
2876
2877
2878








2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898

2899

2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
<tcl>
#############################################################################
# A list of keywords.  A asterisk occurs after the keyword if it is on
# the fallback list.
#
set keyword_list [lsort {
   ABORT*
   ACTION*
   ADD
   AFTER*
   ALL
   ALTER
   ANALYZE*
   AND
   AS
................................................................................
   JOIN
   KEY*
   LEFT
   LIKE*
   LIMIT
   MATCH*
   NATURAL
   NO*
   NOT
   NOTNULL
   NULL
   OF*
   OFFSET*
   ON
   OR
................................................................................

<p>Programmers are cautioned not to use the two exceptions described in
the previous bullets.  We emphasize that they exist only so that old
and ill-formed SQL statements will run correctly.  Future versions of
SQLite might change to raise errors instead of accepting the malformed
statements covered by the exceptions above.</p>









<p>
SQLite adds new keywords from time to time when it takes on new features.
So to prevent your code from being broken by future enhancements, you should
normally quote any identifier that is an English language word, even if
you do not have to.
</p>

<p>
The list below shows all possible keywords used by any build of
SQLite regardless of [compile-time options].  
Most reasonable configurations use more or all of these keywords,
but some keywords may be omitted when SQL language features are
disabled.
^(Regardless of the compile-time configuration, any identifier that is not on
the following <tcl>hd_puts [llength $keyword_list]</tcl> element
list is not a keyword to the SQL parser in SQLite:
</p>

<blockquote>
<table width="100%"><tr>

<td align="left" valign="top" width="20%">

<tcl>
set n [llength $keyword_list]
set nCol 5
set nRow [expr {($n+$nCol-1)/$nCol}]
set nRowStar 0
set nRowNoStar 0
set i 0
foreach word $keyword_list {
  if {[string index $word end]=="*"} {
    set word [string range $word 0 end-1]
    set font i
    incr nRowStar
  } else {
    set font b
    incr nRowNoStar
  }
  if {$i==$nRow} {
    hd_puts "</td><td valign=\"top\" align=\"left\" width=\"20%\">"
    set i 1
  } else {
    incr i
  }
  hd_puts "$word<br>\n"
}
</tcl>
</td></tr></table></blockquote>)^

<p>SQLite is extended to allow many keywords to be used unquoted
as the names of databases, tables, indices, triggers, views, columns,
user-defined functions, collations, attached databases, and virtual
function modules.
^(The following subset of SQLite keywords can be used unquoted as object
names:</p>

<blockquote>
<table width="100%"><tr>
<td align="left" valign="top" width="20%">
<tcl>
set nCol 5
set nRow [expr {($nRowStar+$nCol-1)/$nCol}]
set i 0
foreach word $keyword_list {
  if {[string index $word end]!="*"} continue
  set word [string range $word 0 end-1]
  if {$i==$nRow} {
    hd_puts "</td><td valign=\"top\" align=\"left\" width=\"20%\">"
    set i 1
  } else {
    incr i
  }
  hd_puts "$word<br>\n"
}
</tcl>
</td></tr></table></blockquote>)^

<p>^(The next subset of keywords are those that must be quoted in
order to be used as object names:</p>

<blockquote>
<table width="100%"><tr>
<td align="left" valign="top" width="20%">
<tcl>
set nCol 5
set nRow [expr {($nRowNoStar+$nCol-1)/$nCol}]
set i 0
foreach word $keyword_list {
  if {[string index $word end]=="*"} continue
  if {$i==$nRow} {
    hd_puts "</td><td valign=\"top\" align=\"left\" width=\"20%\">"
    set i 1
  } else {
    incr i
  }
  hd_puts "$word<br>\n"
}
</tcl>
</td></tr></table></blockquote>)^

<h2>Special names</h2>

<p>The following are not keywords in SQLite, but are used as names of 
system objects.  They can be used as an identifier for a different 
type of object.</p>