共用方式為


合併文法

語彙文法

lexical-unit:
      lexical-elementsopt
lexical-elements:
      lexical-element lexical-elementsopt
lexical-element:
      whitespace
      token
      註解

空白字元

whitespace:
      任何具有 Unicode 類別 Zs 的字元
      水平定位字元 (U+0009)
      垂直定位字元 (U+000B)
      換頁字元 (U+000C)
      歸位字元 (U+000D),後面接著換行字元 (U+000A) new-line-character
new-line-character:

      歸位字元 (U+000D)
      換行字元 (U+000A)
      新行字元 (U+0085)
      分行符號字元 (U+2028)
      段落分隔符號字元 (U+2029)

註解

comment:
      single-line-comment
      delimited-comment

single-line-comment:
      // single-line-comment-charactersopt
single-line-comment-characters:
      single-line-comment-character single-line-comment-charactersopt
single-line-comment-character:

      除了 new-line-character 以外的任何 Unicode 字元
delimited-comment:

      /* delimited-comment-textopt asterisks /
delimited-comment-text:
      delimited-comment-section delimited-comment-textopt
delimited-comment-section:

      /
      asterisksopt not-slash-or-asterisk
asterisks:

      * asterisksopt
not-slash-or-asterisk:

      除了 */ 以外的任何 Unicode 字元

語彙基元

token:
      identifier
      keyword
      literal
      operator-or-punctuator

字元逸出序列

character-escape-sequence:
      #( escape-sequence-list )
escape-sequence-list:
      single-escape-sequence
      escape-sequence-list
, single-escape-sequence
single-escape-sequence:
      long-unicode-escape-sequence
      short-unicode-escape-sequence
      control-character-escape-sequence
      escape-escape
long-unicode-escape-sequence:
      hex-digit hex-digit hex-digit hex-digit hex-digit hex-digit hex-digit hex-digit
short-unicode-escape-sequence:
      hex-digit hex-digit hex-digit hex-digit
control-character-escape-sequence:
      control-character
control-character:

      cr
      lf
      tab
escape-escape:
      #

常值

literal:
      logical-literal
      number-literal
      text-literal
      null-literal
      verbatim-literal
logical-literal:
      true
      false
number-literal:
      decimal-number-literal
      hexadecimal-number-literal
decimal-digits:
      decimal-digit decimal-digitsopt
decimal-digit:
下列其中一個
      0 1 2 3 4 5 6 7 8 9
hexadecimal-number-literal:
      0x hex-digits
      0X hex-digits
hex-digits:
      hex-digit hex-digitsopt
hex-digit:
下列其中一個
      0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f
decimal-number-literal:
      decimal-digits
. decimal-digits exponent-partopt
      . decimal-digits exponent-partopt
      decimal-digits exponent-partopt
exponent-part:

      e signopt decimal-digits
      E signopt decimal-digits
sign:
下列其中一個
      + -
text-literal:
      " text-literal-charactersopt "
text-literal-characters:
      text-literal-character text-literal-charactersopt
text-literal-character:
      single-text-character
      character-escape-sequence
      double-quote-escape-sequence
single-text-character:

      " 以外的任何字元 (U+0022) 或 # (U+0023),後面接著 ( (U+0028)
double-quote-escape-sequence:
      
null-literal:
      null
verbatim-literal:
      #!" text-literal-charactersopt "

Identifiers

identifier:
      regular-identifier
      quoted-identifier
regular-identifier:
      available-identifier
      available-identifier dot-character regular-identifier
available-identifier:

      keyword-or-identifier,這不是 keyword
keyword-or-identifier:
      letter-character
      underscore-character
      identifier-start-character identifier-part-characters
identifier-start-character:
      letter-character
      underscore-character
identifier-part-characters:
      identifier-part-character identifier-part-charactersopt
identifier-part-character:
      letter-character
      decimal-digit-character
      underscore-character
      connecting-character
      combining-character
      formatting-character
generalized-identifier:
      generalized-identifier-part
      generalized-identifier
separated only by blanks (U+0020) generalized-identifier-part
generalized-identifier-part:
      generalized-identifier-segment
      decimal-digit-character generalized-identifier-segment
generalized-identifier-segment:
      keyword-or-identifier
      keyword-or-identifier dot-character keyword-or-identifier
dot-character:

      
underscore-character:
      
letter-character:_
      Lu、Ll、Lt、Lm、Lo 或 Nl 類別的 Unicode 字元
combining-character:
      Mn 或 Mc 類別的 Unicode 字元
decimal-digit-character:
      Nd 類別的 Unicode 字元
connecting-character:
      Pc 類別的 Unicode 字元
formatting-character:
      Cf 類別的 Unicode 字元
quoted-identifier:
      #" text-literal-charactersopt "

關鍵字和預先定義的識別碼

預先定義的識別碼和關鍵字無法重新定義。 引號識別碼可以用來處理和預先定義識別碼或關鍵字衝突的識別碼。

keyword: 下列其中一個
and as each else error false if in is let meta not null or otherwise
      section shared then true try type #binary #date #datetime
      #datetimezone #duration #infinity #nan #sections #shared #table #time

運算子和標點符號

operator-or-punctuator: 下列其中一個
      , ; = < <= > >= <> + - * / & ( ) [ ] { } @ ? ?? => .. ...

語法文法

文件​​

document:
      section-document
      expression-document

區段文件

section-document:
      section
section:
      literal-attributesopt
section section-name ; section-membersopt
section-name:
      identifier
section-members:
      section-member section-membersopt
section-member:
      literal-attributesopt sharedopt section-member-name
= expression ;
section-member-name:
      identifier

運算式文件

運算式

expression-document:
      expression
expression:
      logical-or-expression
each-expression
      function-expression
      let-expression
      if-expression
      error-raising-expression
      error-handling-expression

邏輯運算式

logical-or-expression:
      logical-and-expression
      logical-and-expression
or logical-or-expression
logical-and-expression:
      is-expression
      logical-and-expression
and is-expression

Is 運算式

is-expression:
      as-expression
      is-expression
is nullable-primitive-type
nullable-primitive-type:

      nullableopt primitive-type

As 運算式

as-expression:
      equality-expression
      as-expression
as nullable-primitive-type

相等運算式

equality-expression:
      relational-expression
      relational-expression
= equality-expression
      relational-expression
<> equality-expression

關聯運算式

relational-expression:
      additive-expression
      additive-expression
< relational-expression
      additive-expression
> relational-expression
      additive-expression
<= relational-expression
      additive-expression
>= relational-expression

算術運算式

additive-expression:
      multiplicative-expression
      multiplicative-expression
+ additive-expression
      multiplicative-expression
- additive-expression
      multiplicative-expression
& _additive-expression
multiplicative-expression:
      metadata-expression
      metadata-expression
* multiplicative-expression
      metadata-expression
/ multiplicative-expression

中繼資料運算式

metadata-expression:
      unary-expression
      unary-expression
meta unary-expression

一元運算式

unary-expression:
      type-expression

      + unary-expression
      - unary-expression
      not unary-expression

主要運算式

primary-expression:
      literal-expression
      list-expression
      record-expression
      identifier-expression
      section-access-expression
      parenthesized-expression
      field-access-expression
      item-access-expression
      invoke-expression
      not-implemented-expression

常值運算式

literal-expression:
      literal

識別碼運算式

identifier-expression:
      identifier-reference
identifier-reference:
      exclusive-identifier-reference
      inclusive-identifier-reference
exclusive-identifier-reference:
      identifier
inclusive-identifier-reference:

      @ 識別碼

區段存取運算式

section-access-expression:
      識別碼
! 識別碼

加括弧的運算式

parenthesized-expression:
      ( 運算式 )

未實作的運算式

not-implemented-expression:
      ...

叫用運算式

invoke-expression:
      primary-expression
( argument-listopt )
argument-list:
      expression
      expression
, argument-list

清單運算式

list-expression:
      { item-listopt }
item-list:
      項目
      item
, item-list
item:
      expression
      運算式
.. 運算式

記錄運算式

record-expression:
      [ field-listopt ]
field-list:
      field
      field
, field-list
field:
      field-name
= expression
field-name:
      generalized-identifier
      quoted-identifier

項目存取運算式

item-access-expression:
      item-selection
      optional-item-selection
item-selection:
primary-expression
{ item-selector }
optional-item-selection:
      primary-expression
{ item-selector } ?
item-selector:
      expression

欄位存取運算式

field-access-expression:
      field-selection
      implicit-target-field-selection
      投影
      implicit-target-projection
field-selection:
      primary-expression field-selector
field-selector:
      required-field-selector
      optional-field-selector
required-field-selector:

      [ field-name ]
optional-field-selector:
      [ field-name ] ?
implicit-target-field-selection:
      field-selector
projection:
      primary-expression required-projection
      primary-expression optional-projection
required-projection:_
      [ required-selector-list ]
optional-projection:
      [ required-selector-list ] ?
required-selector-list:
      required-field-selector
      required-field-selector
, required-selector-list
implicit-target-projection:
      required-projection
      optional-projection

函式運算式

function-expression:
      ( parameter-listopt ) return-typeopt => function-body
function-body:
      expression
parameter-list:
      fixed-parameter-list
      fixed-parameter-list
, optional-parameter-list
      optional-parameter-list
fixed-parameter-list:
      parameter
      parameter
, fixed-parameter-list
參數:
      parameter-name parameter-typeopt
parameter-name:
      identifier
primitive-parameter-type:
      primitive-assertion
return-type:
      primitive-assertion
primitive-assertion:

      as nullable-primitive-type
optional-parameter-list:
      optional-parameter
      optional-parameter
, optional-parameter-list
optional-parameter:

      optional 參數

Each 運算式

each-expression:
      each each-expression-body
each-expression-body:
      function-body

Let 運算式

let-expression:
      let variable-list in expression
variable-list:
      variable
      variable
, variable-list
variable:
      variable-name
= 運算式
variable-name:
      identifier

If 運算式

if-expression:
      if if-condition then true-expression else false-expression
if-condition:
      expression
true-expression:
      expression
false-expression:
      expression

類型運算式

type-expression:
      primary-expression

      type primary-type
type:
      primary-expression
      primary-type
primary-type:
      primitive-type
      record-type
      list-type
      function-type
      table-type
      nullable-type
primitive-type:
下列其中一個
      any anynonnull binary date datetime datetimezone duration function
      list logical none null number record table text time type
record-type:
      [ open-record-marker ]
      [ field-specification-listopt ]
      [ field-specification-list , open-record-marker ]
field-specification-list:
      field-specification
      field-specification
, field-specification-list
field-specification:

      optionalopt field-name field-type-specificationopt
field-type-specification:

      = field-type
field-type:
      type
open-record-marker:

      ...
list-type:
      { item-type }
item-type:
      type
function-type:

      function ( parameter-specification-listopt ) return-type
parameter-specification-list:
      required-parameter-specification-list
      required-parameter-specification-list
, optional-parameter-specification-list
      optional-parameter-specification-list
required-parameter-specification-list:
      required-parameter-specification
      required-parameter-specification
, required-parameter-specification-list
required-parameter-specification:
      parameter-specification
optional-parameter-specification-list:
      optional-parameter-specification
      optional-parameter-specification
, optional-parameter-specification-list
optional-parameter-specification:

      optional parameter-specification
parameter-specification:
      parameter-name parameter-type
parameter-type:
      assertion
assertion:

      as 類型
table-type:

      table row-type
row-type:

      [ field-specification-listopt ]
nullable-type:
      nullable ‬type

發生錯誤運算式

error-raising-expression:
      error expression_

錯誤處理運算式

error-handling-expression:
      try protected-expression error-handleropt
protected-expression:
      expression
error-handler:
      otherwise-clause
      catch-clause
otherwise-clause:

      otherwise default-expression
default-expression:
      expression
catch-clause:
      catch catch-function
catch-function:
      (parameter-nameopt) => function-body

常值屬性

literal-attributes:
      record-literal
record-literal:

      [ literal-field-listopt ]
literal-field-list:
      literal-field
      literal-field
, literal-field-list
literal-field:
      field-name
= any-literal
list-literal:

      { literal-item-listopt }
literal-item-list:
      any-literal
      any-literal
, literal-item-list
any-literal:
      record-literal
      list-literal
      logical-literal
      number-literal
      text-literal
      null-literal