All Downloads are FREE. Search and download functionalities are using the official Maven repository.

app.cash.sqldelight.dialects.hsql.grammar.hsql.bnf Maven / Gradle / Ivy

There is a newer version: 2.0.2
Show newest version
{
  // Specify the parent parser.
  overrides="com.alecstrong.sql.psi.core.SqlParser"
  elementTypeClass = "com.alecstrong.sql.psi.core.SqlElementType"

  implements="com.alecstrong.sql.psi.core.psi.SqlCompositeElement"
  extends="com.alecstrong.sql.psi.core.psi.SqlCompositeElementImpl"
  psiClassPrefix = "Hsql"

  parserImports=[
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.ALWAYS"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.AND"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.AS"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.ASC"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.BETWEEN"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.BY"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.COLLATE"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.COMMA"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.CONSTRAINT"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.DEFAULT"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.DESC"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.DIGIT"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.DOT"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.GENERATED"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.GROUP"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.ID"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.INSERT"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.INTO"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.KEY"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.LP"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.MERGE"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.MULTIPLY"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.NO"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.NOT"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.NULL"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.ORDER"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.PARTITION"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.PRIMARY"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.ROW"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.RP"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.TO"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.UNIQUE"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.WHERE"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.WITH"
    "static com.alecstrong.sql.psi.core.psi.SqlTypes.WITHOUT"
  ]
}
overrides ::= type_name | column_constraint | bind_parameter | insert_stmt | result_column | generated_clause
type_name ::= (
  tiny_int_data_type |
  small_int_data_type |
  int_data_type |
  big_int_data_type |
  fixed_point_data_type |
  approximate_numeric_data_type |
  boolean_data_type |
  date_data_type |
  character_string_data_type |
  binary_string_data_type |
  bit_string_data_type |
  interval_data_type
) {
  extends = "com.alecstrong.sql.psi.core.psi.impl.SqlTypeNameImpl"
  implements = "com.alecstrong.sql.psi.core.psi.SqlTypeName"
  override = true
}
column_constraint ::= [ CONSTRAINT {identifier} ] (
  'AUTO_INCREMENT' |
  PRIMARY KEY [ ASC | DESC ] {conflict_clause} |
  NOT NULL {conflict_clause} |
  UNIQUE {conflict_clause} |
  {check_constraint} |
  generated_clause |
  {default_constraint} |
  COLLATE {collation_name} |
  {foreign_key_clause}
) {
  extends = "com.alecstrong.sql.psi.core.psi.impl.SqlColumnConstraintImpl"
  implements = "com.alecstrong.sql.psi.core.psi.SqlColumnConstraint"
  override = true
}
bind_parameter ::= DEFAULT | ( '?' | ':' {identifier} ) {
  mixin = "app.cash.sqldelight.dialect.grammar.mixins.BindParameterMixin"
  extends = "com.alecstrong.sql.psi.core.psi.impl.SqlBindParameterImpl"
  implements = "com.alecstrong.sql.psi.core.psi.SqlBindParameter"
  override = true
}

tiny_int_data_type ::= 'TINYINT'
small_int_data_type ::= 'SMALLINT'
int_data_type ::= 'INTEGER' | 'INT'
big_int_data_type ::= 'BIGINT'
fixed_point_data_type ::= { 'NUMERIC' | 'DECIMAL' | 'DEC' } [ LP precision [ COMMA scale ] RP ]
approximate_numeric_data_type ::= 'FLOAT' [ LP precision RP ] | 'REAL' | ( 'DOUBLE' 'PRECISION' ) | 'DOUBLE'
precision ::= digit
scale ::= digit

boolean_data_type ::= 'BOOLEAN'

character_string_data_type ::= { ('CHARACTER' 'VARYING') | ('CHAR' 'VARYING') | 'VARCHAR' } LP digit RP | character_large_object_data_type | { 'CHARACTER' | 'CHAR' | 'LONGVARCHAR' } [ LP digit RP ]
character_large_object_data_type ::= { ('CHARACTER' 'LARGE' 'OBJECT') | ('CHAR' 'LARGE' 'OBJECT') | 'CLOB' } [ LP character_large_object_length RP ]
character_large_object_length ::= digit [ multiplier ] [ char_length_units ]
multiplier ::= 'K' | 'M' | 'G'
char_length_units ::= 'CHARACTERS' | 'OCTETS'

binary_string_data_type ::= { ('BINARY' 'VARYING') | 'VARBINARY' } LP digit RP | binary_large_object_string_data_type | { 'BINARY' | 'LONGVARBINARY' } [ LP digit RP ] | 'UUID'
binary_large_object_string_data_type ::= { ('BINARY' 'LARGE' 'OBJECT') | 'BLOB' } [ LP digit RP ]

bit_string_data_type ::= ('BIT' 'VARYING') LP digit RP | 'BIT' [ LP digit RP ]

date_data_type ::= 'DATE' | ( 'TIME' | 'TIMESTAMP' ) [ LP digit RP ] [ ( WITH | WITHOUT ) 'TIME' 'ZONE' ]

interval_data_type ::= 'INTERVAL' interval_qualifier
interval_qualifier ::= start_field TO end_field | single_datetime_field
start_field ::= non_second_primary_datetime_field [ LP digit RP ]
end_field ::= non_second_primary_datetime_field | 'SECOND' [ LP digit RP ]
single_datetime_field ::= non_second_primary_datetime_field [ LP digit RP ] | 'SECOND' [ LP digit [ COMMA digit ] RP ]
non_second_primary_datetime_field ::= 'YEAR' | 'MONTH' | 'DAY' | 'HOUR' | 'MINUTE'

generated_clause ::= GENERATED ( ( (ALWAYS | BY DEFAULT) AS 'IDENTITY' ) | (ALWAYS AS <>) ) {
  extends = "com.alecstrong.sql.psi.core.psi.impl.SqlGeneratedClauseImpl"
  implements = "com.alecstrong.sql.psi.core.psi.SqlGeneratedClause"
  override = true
}

insert_stmt ::= [ {with_clause} ] ( INSERT | MERGE ) INTO [ {database_name} DOT ] {table_name} [ AS {table_alias} ] [ LP {column_name} ( COMMA {column_name} ) * RP ] [ merge_key_selector ] {insert_stmt_values} {
  extends = "com.alecstrong.sql.psi.core.psi.impl.SqlInsertStmtImpl"
  implements = "com.alecstrong.sql.psi.core.psi.SqlInsertStmt"
  override = true
  pin = 5
}

merge_key_selector ::= KEY LP {column_name} RP

result_column ::= ( MULTIPLY
                  | {table_name} DOT MULTIPLY
                  | (window_function_invocation | <>) [ [ AS ] {column_alias} ] ) {
  mixin = "app.cash.sqldelight.dialects.hsql.grammar.mixins.ResultColumnMixin"
  implements = "com.alecstrong.sql.psi.core.psi.SqlResultColumn"
  override = true
}

window_function_invocation ::=
  window_func LP [ MULTIPLY | ( <> ( COMMA <> ) * ) ] RP [ 'FILTER' LP WHERE <> RP] 'OVER' ( window_defn | window_name) {
  pin = 6
}

window_defn ::= LP [ base_window_name ]
  [ PARTITION BY <> ( COMMA <> ) * ]
  [ ORDER BY {ordering_term} ( COMMA {ordering_term} ) * ]
  [ frame_spec ]
RP {
  pin = 1
  mixin = "app.cash.sqldelight.dialects.hsql.grammar.mixins.WindowDefinitionMixin"
}

frame_spec ::= ( 'RANGE' | 'ROWS' | 'GROUPS' )
  (
    BETWEEN (
      'UNBOUNDED' 'PRECEDING' |
      'CURRENT' ROW |
      <> 'PRECEDING' |
      <> 'FOLLOWING'
    ) AND (
      'UNBOUNDED' 'FOLLOWING' |
      'CURRENT' ROW |
      <> 'PRECEDING' |
      <> 'FOLLOWING'
    ) |
    'UNBOUNDED' 'PRECEDING' |
    'CURRENT' ROW |
    <> 'PRECEDING'
  ) [ 'EXCLUDE' NO 'OTHERS' | 'EXCLUDE' 'CURRENT' ROW | 'EXCLUDE' GROUP | 'EXCLUDE' 'TIES' ] {
  pin = 1
}

window_func ::= id
window_name ::= id
base_window_name ::= id




© 2015 - 2024 Weber Informatics LLC | Privacy Policy