Skip to content

Commit

Permalink
Update docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
mithrandie committed May 19, 2019
1 parent 7105a6c commit b2f772d
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 20 deletions.
5 changes: 4 additions & 1 deletion docs/_posts/2006-01-02-command.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ csvq >

This option can be specified multiple formats using JSON array of strings.

--ansi-quotes, -k
: Use double quotation mark (U+0022 `"`) as identifier enclosure.

--wait-timeout value, -w value
: Limit of the waiting time in seconds to wait for locked files to be released. The default is 10.

Expand Down Expand Up @@ -516,7 +519,7 @@ In command parameters and statements, following strings represent special charac
| \r | U+000D Carriage Return |
| \t | U+0009 Horizontal Tab |
| \v | U+000b Vertical Tab |
| \\" | U+0022 Double Quote (in strings only) |
| \\" | U+0022 Double Quote |
| \\' | U+0027 Single Quote (in strings only) |
| \\\` | U+0060 Grave Accent (in identifiers only) |
| \\\\ | U+005c Backslash |
Expand Down
1 change: 1 addition & 0 deletions docs/_posts/2006-01-02-flag.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ A flag is a representation of a [command option]({{ '/reference/command.html#opt
| @@REPOSITORY | string | Directory path where files are located |
| @@TIMEZONE | string | Default TimeZone |
| @@DATETIME_FORMAT | string | Datetime Format to parse strings |
| @@ANSI_QUOTES | boolean | Use double quotation mark as identifier enclosure |
| @@WAIT_TIMEOUT | float | Limit of the waiting time in seconds to wait for locked files to be released |
| @@IMPORT_FORMAT | string | Default format to load files |
| @@DELIMITER | string | Field delimiter for CSV |
Expand Down
25 changes: 17 additions & 8 deletions docs/_posts/2006-01-02-statement.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,18 @@ csvq > EXIT;
You can use following types in statements.

Identifier
: A identifier is a word starting with any unicode letter or a Low Line(U+005F `_`) and followed by a character string that contains any unicode letters, any digits or Low Lines(U+005F `_`).
You cannot use [reserved words](#reserved_words) as a identifier.
: An identifier is a word starting with any unicode letter or a Low Line(U+005F `_`) and followed by a character string that contains any unicode letters, any digits or Low Lines(U+005F `_`).
You cannot use [reserved words](#reserved_words) as an identifier.

Notwithstanding above naming restriction, you can use most character strings as a identifier by enclosing in Grave Accents(U+0060 ` ).
Back quotes are escaped by back slashes.
Notwithstanding above naming restriction, you can use most character strings as an identifier by enclosing in Grave Accents(U+0060 \` ) or Quotation Marks(U+0022 `"`) if [--ansi-quotes]({{ '/reference/command.html#options' | relative_url }}) is specified.
Enclosure characters are escaped by back slashes or double enclosures.

Identifiers represent tables, columns, functions or cursors.
Character case is insensitive except file paths, and whether file paths are case insensitive or not depends on your file system.

String
: A string is a character string enclosed in Apostrophes(U+0027 `'`) or Quotation Marks(U+0022 `"`).
In a string, single quotes or double quotes are escaped by back slashes.
: A string is a character string enclosed in Apostrophes(U+0027 `'`) or Quotation Marks(U+0022 `"`) if [--ansi-quotes]({{ '/reference/command.html#options' | relative_url }}) is not specified.
In a string, enclosure characters are escaped by back slashes or double enclosures.

Integer
: An integer is a word that contains only \[0-9\].
Expand Down Expand Up @@ -159,9 +159,10 @@ Runtime Information
```sql
abcde -- identifier
識別子 -- identifier
`ab+c\`de` -- identifier
`abc\`de` -- identifier
`abc``de` -- identifier
'abcd\'e' -- string
"abcd\"e" -- string
'abcd''e' -- string
123 -- integer
123.456 -- float
true -- ternary
Expand All @@ -172,6 +173,14 @@ null -- null
@%ENV_VAR -- environment variable
@%`ENV_VAR` -- environment variable
@#INFO -- runtime information

/* if --ansi-quotes is specified */
"abcd\"e" -- identifier
"abcd""e" -- identifier
/* if --ansi-quotes is not specified */
"abcd\"e" -- string
"abcd""e" -- string
```

## Comments
Expand Down
6 changes: 3 additions & 3 deletions docs/sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
</url>
<url>
<loc>https://mithrandie.github.io/csvq/reference/command.html</loc>
<lastmod>2019-05-04T12:09:52+00:00</lastmod>
<lastmod>2019-05-19T09:32:34+00:00</lastmod>
</url>
<url>
<loc>https://mithrandie.github.io/csvq/reference/statement.html</loc>
<lastmod>2018-11-24T06:47:39+00:00</lastmod>
<lastmod>2019-05-19T09:32:34+00:00</lastmod>
</url>
<url>
<loc>https://mithrandie.github.io/csvq/reference/value.html</loc>
Expand Down Expand Up @@ -102,7 +102,7 @@
</url>
<url>
<loc>https://mithrandie.github.io/csvq/reference/flag.html</loc>
<lastmod>2018-11-17T22:33:20+00:00</lastmod>
<lastmod>2019-05-19T09:32:34+00:00</lastmod>
</url>
<url>
<loc>https://mithrandie.github.io/csvq/reference/environment-variable.html</loc>
Expand Down
22 changes: 14 additions & 8 deletions lib/syntax/syntax.go
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,8 @@ var CsvqSyntax = []Expression{
"%s <type::%s>\n" +
" > Datetime Format to parse strings.\n" +
"%s <type::%s>\n" +
" > Use double quotation mark(U+0022 \") as identifier enclosure.\n" +
"%s <type::%s>\n" +
" > Limit of the waiting time in seconds to wait for locked files to be released.\n" +
"%s <type::%s>\n" +
" > Default format to load files.\n" +
Expand Down Expand Up @@ -1045,6 +1047,7 @@ var CsvqSyntax = []Expression{
Flag("@@REPOSITORY"), String("string"),
Flag("@@TIMEZONE"), String("string"), Link("Timezone"),
Flag("@@DATETIME_FORMAT"), String("string"),
Flag("@@ANSI_QUOTES"), String("boolean"),
Flag("@@WAIT_TIMEOUT"), Float("float"),
Flag("@@IMPORT_FORMAT"), String("string"),
Flag("@@DELIMITER"), String("string"),
Expand Down Expand Up @@ -2675,23 +2678,26 @@ var CsvqSyntax = []Expression{
Description: Description{
Template: "" +
"%s\n" +
" > A identifier is a word starting with any unicode letter or" +
" > An identifier is a word starting with any unicode letter or" +
" a Low Line(U+005F _) and followed by a character string that" +
" contains any unicode letters, any digits or Low Lines(U+005F _)." +
" You cannot use %s as a identifier.\n" +
" contains any unicode letters, any digits or Low Lines(U+005F _)." +
" You cannot use %s as an identifier.\n" +
"\n" +
" > Notwithstanding above naming restriction, you can use most" +
" character strings as a identifier by enclosing in" +
" Grave Accents(U+0060 `). Back quotes are escaped by back slashes.\n" +
" character strings as an identifier by enclosing in" +
" Grave Accents(U+0060 `) or Quotation Marks(U+0022 \") if" +
" --ansi-quotes is specified. Enclosure characters are escaped by" +
" back slashes or double enclosures.\n" +
"\n" +
" > Identifiers represent tables, columns, functions or cursors." +
" Character case is insensitive except file paths, and whether file" +
" paths are case insensitive or not depends on your file system.\n" +
"\n" +
"%s\n" +
" > A string is a character string enclosed in Apostrophes(U+0027 ') or" +
" Quotation Marks(U+0022 \"). In a string, single quotes or double" +
" quotes are escaped by back slashes.\n" +
" Quotation Marks(U+0022 \") if --ansi-quotes is not specified." +
" In a string, enclosure characters are escaped by back slashes or" +
" double enclosures.\n" +
"\n" +
"%s\n" +
" > An integer is a word that contains only [0-9].\n" +
Expand Down Expand Up @@ -2774,7 +2780,7 @@ var CsvqSyntax = []Expression{
" | \\r | U+000D Carriage Return |\n" +
" | \\t | U+0009 Horizontal Tab |\n" +
" | \\v | U+000b Vertical Tab |\n" +
" | \\\" | U+0022 Double Quote (in strings only) |\n" +
" | \\\" | U+0022 Double Quote |\n" +
" | \\' | U+0027 Single Quote (in strings only) |\n" +
" | \\` | U+0060 Grave Accent (in identifiers only) |\n" +
" | \\\\ | U+005c Backslash |\n" +
Expand Down

0 comments on commit b2f772d

Please sign in to comment.