github.com/runner-mei/ql@v1.1.0/ql.ebnf (about) 1 andand = "&&" . 2 andnot = "&^" . 3 ascii_letter = "a" … "z" | "A" … "Z" . 4 big_u_value = "\\" "U" hex_digit hex_digit hex_digit hex_digit hex_digit hex_digit hex_digit hex_digit . 5 byte_value = octal_byte_value | hex_byte_value . 6 decimal_digit = "0" … "9" . 7 decimal_lit = ( "1" … "9" ) { decimal_digit } . 8 decimals = decimal_digit { decimal_digit } . 9 eq = "==" | "=" . 10 escaped_char = "\\" ( 11 "a" 12 | "b" 13 | "f" 14 | "n" 15 | "r" 16 | "t" 17 | "v" 18 | "\\" 19 | "'" 20 | "\"" 21 ) . 22 exponent = ( "e" | "E" ) [ "+" | "-" ] decimals . 23 float_lit = decimals "." [ decimals ] [ exponent ] 24 | decimals exponent 25 | "." decimals [ exponent ] . 26 ge = ">=" . 27 hex_byte_value = "\\" "x" hex_digit hex_digit . 28 hex_digit = "0" … "9" 29 | "A" … "F" 30 | "a" … "f" . 31 hex_lit = "0" ( "x" | "X" ) hex_digit { hex_digit } . 32 identifier = letter { letter | decimal_digit } . 33 imaginary_lit = ( decimals | float_lit ) "i" . 34 int_lit = decimal_lit 35 | octal_lit 36 | hex_lit . 37 interpreted_string_lit = "\"" { unicode_value | byte_value } "\"" . 38 le = "<=" . 39 letter = ascii_letter | "_" . 40 little_u_value = "\\" "u" hex_digit hex_digit hex_digit hex_digit . 41 lsh = "<<" . 42 neq = "!=" . 43 newline = . 44 octal_byte_value = "\\" octal_digit octal_digit octal_digit . 45 octal_digit = "0" … "7" . 46 octal_lit = "0" { octal_digit } . 47 oror = "||" . 48 ql_parameter = ( "?" | "$" ) "1" … "9" { "0" … "9" } . 49 raw_string_lit = "`" { unicode_char | newline } "`" . 50 rsh = ">>" . 51 rune_lit = "'" ( unicode_value | byte_value ) "'" . 52 string_lit = raw_string_lit | interpreted_string_lit . 53 unicode_char = . 54 unicode_value = unicode_char 55 | little_u_value 56 | big_u_value 57 | escaped_char . 58 59 AlterTableStmt = "ALTER" "TABLE" TableName ( 60 "ADD" ColumnDef 61 | "DROP" "COLUMN" ColumnName 62 ) . 63 Assignment = ColumnName "=" Expression . 64 AssignmentList = Assignment { "," Assignment } [ "," ] . 65 BeginTransactionStmt = "BEGIN" "TRANSACTION" . 66 Call = "(" [ "*" | ExpressionList ] ")" . 67 ColumnDef = ColumnName Type [ 68 "NOT" "NULL" 69 | Expression 70 ] [ "DEFAULT" Expression ] . 71 ColumnName = identifier . 72 ColumnNameList = ColumnName { "," ColumnName } [ "," ] . 73 CommitStmt = "COMMIT" . 74 Conversion = Type "(" Expression ")" . 75 CreateIndexStmt = "CREATE" [ "UNIQUE" ] "INDEX" [ 76 "IF" "NOT" "EXISTS" 77 ] IndexName "ON" TableName "(" ExpressionList ")" . 78 CreateTableStmt = "CREATE" "TABLE" [ 79 "IF" "NOT" "EXISTS" 80 ] TableName "(" ColumnDef { "," ColumnDef } [ "," ] ")" . 81 DeleteFromStmt = "DELETE" "FROM" TableName [ WhereClause ] . 82 DropIndexStmt = "DROP" "INDEX" [ "IF" "EXISTS" ] IndexName . 83 DropTableStmt = "DROP" "TABLE" [ "IF" "EXISTS" ] TableName . 84 EmptyStmt = . 85 ExplainStmt = "EXPLAIN" Statement . 86 Expression = Term { 87 ( oror | "OR" ) Term 88 } . 89 ExpressionList = Expression { "," Expression } [ "," ] . 90 Factor = PrimaryFactor { 91 ( 92 ge 93 | ">" 94 | le 95 | "<" 96 | neq 97 | eq 98 | "LIKE" 99 ) PrimaryFactor 100 } [ Predicate ] . 101 Field = Expression [ "AS" identifier ] . 102 FieldList = Field { "," Field } [ "," ] . 103 GroupByClause = "GROUP BY" ColumnNameList . 104 Index = "[" Expression "]" . 105 IndexName = identifier . 106 InsertIntoStmt = "INSERT" "INTO" TableName [ 107 "(" ColumnNameList ")" 108 ] ( Values | SelectStmt ) . 109 JoinClause = ( 110 "LEFT" 111 | "RIGHT" 112 | "FULL" 113 ) [ "OUTER" ] "JOIN" RecordSet "ON" Expression . 114 Limit = "Limit" Expression . 115 Literal = "FALSE" 116 | "NULL" 117 | "TRUE" 118 | float_lit 119 | imaginary_lit 120 | int_lit 121 | rune_lit 122 | string_lit 123 | ql_parameter . 124 Offset = "OFFSET" Expression . 125 Operand = Literal 126 | QualifiedIdent 127 | "(" Expression ")" . 128 OrderBy = "ORDER" "BY" ExpressionList [ "ASC" | "DESC" ] . 129 Predicate = ( 130 [ "NOT" ] ( 131 "IN" "(" ExpressionList ")" 132 | "IN" "(" SelectStmt [ ";" ] ")" 133 | "BETWEEN" PrimaryFactor "AND" PrimaryFactor 134 ) 135 | "IS" [ "NOT" ] "NULL" 136 ) . 137 PrimaryExpression = Operand 138 | Conversion 139 | PrimaryExpression Index 140 | PrimaryExpression Slice 141 | PrimaryExpression Call . 142 PrimaryFactor = PrimaryTerm { 143 ( 144 "^" 145 | "|" 146 | "-" 147 | "+" 148 ) PrimaryTerm 149 } . 150 PrimaryTerm = UnaryExpr { 151 ( 152 andnot 153 | "&" 154 | lsh 155 | rsh 156 | "%" 157 | "/" 158 | "*" 159 ) UnaryExpr 160 } . 161 QualifiedIdent = identifier [ "." identifier ] . 162 RecordSet = ( 163 TableName 164 | "(" SelectStmt [ ";" ] ")" 165 ) [ "AS" identifier ] . 166 RecordSetList = RecordSet { "," RecordSet } [ "," ] . 167 RollbackStmt = "ROLLBACK" . 168 SelectStmt = "SELECT" [ "DISTINCT" ] ( "*" | FieldList ) "FROM" RecordSetList [ JoinClause ] [ WhereClause ] [ GroupByClause ] [ OrderBy ] [ Limit ] [ Offset ] . 169 Slice = "[" [ Expression ] ":" [ Expression ] "]" . 170 Statement = EmptyStmt 171 | AlterTableStmt 172 | BeginTransactionStmt 173 | CommitStmt 174 | CreateIndexStmt 175 | CreateTableStmt 176 | DeleteFromStmt 177 | DropIndexStmt 178 | DropTableStmt 179 | InsertIntoStmt 180 | RollbackStmt 181 | SelectStmt 182 | TruncateTableStmt 183 | UpdateStmt 184 | ExplainStmt . 185 StatementList = Statement { ";" Statement } . 186 TableName = identifier . 187 Term = Factor { 188 ( andand | "AND" ) Factor 189 } . 190 TruncateTableStmt = "TRUNCATE" "TABLE" TableName . 191 Type = "bigint" 192 | "bigrat" 193 | "blob" 194 | "bool" 195 | "byte" 196 | "complex128" 197 | "complex64" 198 | "duration" 199 | "float" 200 | "float32" 201 | "float64" 202 | "int" 203 | "int16" 204 | "int32" 205 | "int64" 206 | "int8" 207 | "rune" 208 | "string" 209 | "time" 210 | "uint" 211 | "uint16" 212 | "uint32" 213 | "uint64" 214 | "uint8" . 215 UnaryExpr = [ 216 "^" 217 | "!" 218 | "-" 219 | "+" 220 ] PrimaryExpression . 221 UpdateStmt = "UPDATE" TableName [ "SET" ] AssignmentList [ WhereClause ] . 222 Values = "VALUES" "(" ExpressionList ")" { 223 "," "(" ExpressionList ")" 224 } [ "," ] . 225 WhereClause = "WHERE" Expression .