第 12 章 表达式 EBNF 定义

本节提供 X DevAPI 中使用的表达式语言语法可视化参考指南。

ident

ident 
   ::= ID | QUOTED_ID

图 12.1 ident

Image shows the syntax in EBNF form as described in the preceding text.

schemaQualifiedIdent

schemaQualifiedIdent 
                  ::= ( ident_schema '.' )? ident

图 12.2 schemaQualifiedIdent

Image shows the syntax in EBNF form as described in the preceding text.

columnIdent

图 12.3 columnIdent

columnIdent
         ::= ( ident '.' ( ident '.' )? )? ident ( ( '->' | '->>' ) "'" '$' documentPath "'" )?
Image shows the syntax in EBNF form as described in the preceding text.

documentPathLastItem

documentPathLastItem
         ::= '[*]'
           | '[' INT ']'
           | '.*'
           | '.' documentPathMember

图 12.4 documentPathLastItem

Image shows the syntax in EBNF form as described in the preceding text.

documentPathItem

documentPathItem
         ::= documentPathLastItem
           | '**'

图 12.5 documentPathItem

Image shows the syntax in EBNF form as described in the preceding text.

documentPath

documentPath        
          ::= documentPathItem* documentPathLastItem

图 12.6 documentPath

Image shows the syntax in EBNF form as described in the preceding text.

documentField

图 12.7 documentField

documentField
         ::= fieldId documentPath*
           | '$' documentPath
Image shows the syntax in EBNF form as described in the preceding text.

argsList

argsList ::= expr ( ',' expr )*

图 12.8 argsList

Image shows the syntax in EBNF form as described in the preceding text.

lengthSpec

lengthSpec ::= '(' INT ')'

图 12.9 lengthSpec

Image shows the syntax in EBNF form as described in the preceding text.

castType

castType ::= 'SIGNED' 'INTEGER'*
           | 'UNSIGNED' 'INTEGER'*
           | 'CHAR' lengthSpec*
           | 'BINARY' lengthSpec*
           | 'DECIMAL' ( lengthSpec | '(' INT ',' INT ')' )?
           | 'TIME'
           | 'DATE'
           | 'DATETIME'
           | 'JSON'

图 12.10 castType

Image shows the syntax in EBNF form as described in the preceding text.

functionCall

functionCall
         ::= schemaQualifiedIdent '(' argsList? ')'

图 12.11 functionCall

Image shows the syntax in EBNF form as described in the preceding text.

placeholder

placeholder ::= ':' ID

图 12.12 placeholder

Image shows the syntax in EBNF form as described in the preceding text.

groupedExpr

groupedExpr ::= '(' expr ')'

图 12.13 groupedExpr

Image shows the syntax in EBNF form as described in the preceding text.

unaryOp

unaryOp  ::= ( '!' | '~' | '+' | '-' ) atomicExpr

图 12.14 unaryOp

Image shows the syntax in EBNF form as described in the preceding text.

literal

literal  ::= INT
           | FLOAT
           | STRING_SQ
           | STRING_DQ
           | 'NULL'
           | 'FALSE'
           | 'TRUE'

图 12.15 literal

Image shows the syntax in EBNF form as described in the preceding text.

jsonKeyValue

jsonKeyValue ::= STRING_DQ ':' expr

图 12.16 jsonKeyValue

Image shows the syntax in EBNF form as described in the preceding text.

jsonDoc

jsonDoc  ::= '{' ( jsonKeyValue ( ',' jsonKeyValue )* )* '}'

图 12.17 jsonDoc

Image shows the syntax in EBNF form as described in the preceding text.

jsonarray

jsonArray ::= '[' ( expr ( ',' expr )* )* ']'

图 12.18 jsonarray

Image shows the syntax in EBNF form as described in the preceding text.

atomicExpr

atomicExpr
         ::= placeholder
           | columnOrPath
           | functionCall
           | groupedExpr
           | unaryOp
           | castOp

图 12.19 atomicExpr

Image shows the syntax in EBNF form as described in the preceding text.

intervalUnit

INTERVAL_UNIT
         ::= 'MICROSECOND'
           | 'SECOND'
           | 'MINUTE'
           | 'HOUR'
           | 'DAY'
           | 'WEEK'
           | 'MONTH'
           | 'QUARTER'
           | 'YEAR'
           | 'SECOND_MICROSECOND'
           | 'MINUTE_MICROSECOND'
           | 'MINUTE_SECOND'
           | 'HOUR_MICROSECOND'
           | 'HOUR_SECOND'
           | 'HOUR_MINUTE'
           | 'DAY_MICROSECOND'
           | 'DAY_SECOND'
           | 'DAY_MINUTE'
           | 'DAY_HOUR'
           | 'YEAR_MONTH'

图 12.20 INTERVAL_UNIT

Image shows the syntax in EBNF form as described in the preceding text.

interval

interval ::= 'INTERVAL' expr INTERVAL_UNIT

图 12.21 interval

Image shows the syntax in EBNF form as described in the preceding text.

intervalExpr

intervalExpr
         ::= atomicExpr ( ( '+' | '-' ) interval )*

图 12.22 intervalExpr

Image shows the syntax in EBNF form as described in the preceding text.

mulDivExpr

mulDivExpr
         ::= intervalExpr ( ( '*' | '/' | '%' ) intervalExpr )*

图 12.23 mulDivExpr

Image shows the syntax in EBNF form as described in the preceding text.

addSubExpr

addSubExpr
         ::= mulDivExpr ( ( '+' | '-' ) mulDivExpr )*

图 12.24 addSubExpr

Image shows the syntax in EBNF form as described in the preceding text.

shiftExpr

shiftExpr
         ::= addSubExpr ( ( '<<' | '>>' ) addSubExpr )*

图 12.25 shiftExpr

Image shows the syntax in EBNF form as described in the preceding text.

bitExpr

bitExpr  ::= shiftExpr ( ( '&' | '|' | '^' ) shiftExpr )*

图 12.26 bitExpr

Image shows the syntax in EBNF form as described in the preceding text.

compExpr

compExpr ::= bitExpr ( ( '>=' | '>' | '<=' | '<' | '=' | '<>' | '!=' ) bitExpr )*

图 12.27 compExpr

Image shows the syntax in EBNF form as described in the preceding text.

ilriExpr

ilriExpr ::= compExpr 'IS' 'NOT'* ( 'NULL' | 'TRUE' | 'FALSE' )
           | compExpr 'NOT'* 'IN' '(' argsList* ')'
           | compExpr 'NOT'* 'IN' compExpr
           | compExpr 'NOT'* 'LIKE' compExpr ( 'ESCAPE' compExpr )*
           | compExpr 'NOT'* 'BETWEEN' compExpr 'AND' compExpr
           | compExpr 'NOT'* 'REGEXP' compExpr
           | compExpr

图 12.28 ilriExpr

Image shows the syntax in EBNF form as described in the preceding text.

andExpr

andExpr  ::= ilriExpr ( ( '&&' | 'AND' ) ilriExpr )*

图 12.29 andExpr

Image shows the syntax in EBNF form as described in the preceding text.

orExpr

orExpr   ::= andExpr ( ( '||' | 'OR' ) andExpr )*

图 12.30 orExpr

Image shows the syntax in EBNF form as described in the preceding text.

expr

expr     ::= orExpr

图 12.31 expr

Image shows the syntax in EBNF form as described in the preceding text.

DIGIT

DIGIT    ::= '0' - '9'

图 12.32 DIGIT

Image shows the syntax in EBNF form as described in the preceding text.

FLOAT

FLOAT    ::= DIGIT* '.' DIGIT+ ( 'E' ( '+' | '-' )* DIGIT+ )*
           | DIGIT+ 'E' ( '+' | '-' )* DIGIT+

图 12.33 FLOAT

Image shows the syntax in EBNF form as described in the preceding text.

INT

INT      ::= DIGIT+

图 12.34 INT

Image shows the syntax in EBNF form as described in the preceding text.

QUOTED_ID

QUOTED_ID
         ::= '`' ID '`'
           | '`' ( '~' '`'* | '``' )* '`'

图 12.35 QUOTED_ID

Image shows the syntax in EBNF form as described in the preceding text.

ID

ID       ::= ( 'a' - 'z' | 'A' - 'Z' | '_' ) ( 'a' - 'z' | 'A' - 'Z' | '0' - '9' | '_' )*

图 12.36 ID

Image shows the syntax in EBNF form as described in the preceding text.

WS

WS       ::= [ \t\r\n]+

图 12.37 WS

Image shows the syntax in EBNF form as described in the preceding text.

SCHAR

SCHAR    ::= [\u0020\u0021\u0023\u0024\u0025\u0026\u0028-\u005B\u005D-\u007E]

图 12.38 SCHAR

Image shows the syntax in EBNF form as described in the preceding text.

STRING_DQ

STRING_DQ
         ::= '"' ( SCHAR | "'" | ESCAPED_DQ )* '"'

图 12.39 STRING_DQ

Image shows the syntax in EBNF form as described in the preceding text.

STRING_SQ

STRING_SQ
         ::= "'" ( SCHAR | '"' | ESCAPED_SQ )* "'"

图 12.40 STRING_SQ

Image shows the syntax in EBNF form as described in the preceding text.