{ "name": "psql", "word": "_identifier", "rules": { "source_file": { "type": "REPEAT", "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "statement" } ] } }, "statement": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_ddl_statement" }, { "type": "BLANK" } ] }, { "type": "STRING", "value": ";" } ] }, "_ddl_statement": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_create_statement" } ] }, "_create_statement": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "create_table" } ] }, "create_table": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "keyword_create" }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "keyword_temporary" }, { "type": "SYMBOL", "name": "keyword_unlogged" } ] }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "keyword_table" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_if_not_exists" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "table_reference" }, { "type": "SYMBOL", "name": "column_definitions" } ] }, "column_definitions": { "type": "SEQ", "members": [ { "type": "STRING", "value": "(" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "column_definition" } ] }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "column_definition" } ] } ] } } ] }, { "type": "BLANK" } ] }, { "type": "STRING", "value": ")" } ] }, "column_definition": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "name", "content": { "type": "SYMBOL", "name": "identifier" } }, { "type": "FIELD", "name": "datatype", "content": { "type": "SYMBOL", "name": "_type" } }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "column_constraint" } } ] }, "column_constraint": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "keyword_constraint" }, { "type": "FIELD", "name": "name", "content": { "type": "SYMBOL", "name": "identifier" } } ] }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_not_null" }, { "type": "SYMBOL", "name": "keyword_null" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "keyword_default" }, { "type": "SYMBOL", "name": "_expression" } ] }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "keyword_unique" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "keyword_nulls" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "keyword_not" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "keyword_distinct" } ] }, { "type": "BLANK" } ] } ] }, { "type": "SYMBOL", "name": "_primary_key" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "keyword_references" }, { "type": "SYMBOL", "name": "table_reference" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "(" }, { "type": "FIELD", "name": "refcolumn", "content": { "type": "SYMBOL", "name": "identifier" } }, { "type": "STRING", "value": ")" } ] }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_foreign_key_match" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_foreign_key_on_delete" }, { "type": "SYMBOL", "name": "_foreign_key_on_update" } ] }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_foreign_key_on_update" }, { "type": "SYMBOL", "name": "_foreign_key_on_delete" } ] } ] }, { "type": "BLANK" } ] } ] } ] } ] }, "_foreign_key_match": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "keyword_match" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "keyword_full" }, { "type": "SYMBOL", "name": "keyword_partial" }, { "type": "SYMBOL", "name": "keyword_simple" } ] } ] }, "_foreign_key_on_delete": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "keyword_on" }, { "type": "SYMBOL", "name": "keyword_delete" }, { "type": "SYMBOL", "name": "referencial_action" } ] }, "_foreign_key_on_update": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "keyword_on" }, { "type": "SYMBOL", "name": "keyword_update" }, { "type": "SYMBOL", "name": "referencial_action" } ] }, "referencial_action": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "keyword_no" }, { "type": "SYMBOL", "name": "keyword_action" } ] }, { "type": "SYMBOL", "name": "keyword_restrict" }, { "type": "SYMBOL", "name": "keyword_cascade" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "keyword_set" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "keyword_null" }, { "type": "SYMBOL", "name": "keyword_default" } ] }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "(" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "identifier" } ] } } ] }, { "type": "STRING", "value": ")" } ] }, { "type": "BLANK" } ] } ] } ] }, "table_reference": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "FIELD", "name": "schema", "content": { "type": "SYMBOL", "name": "identifier" } }, { "type": "STRING", "value": "." } ] }, { "type": "BLANK" } ] }, { "type": "FIELD", "name": "name", "content": { "type": "SYMBOL", "name": "identifier" } } ] }, "_expression": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "literal" } ] }, "literal": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "number" }, { "type": "SYMBOL", "name": "literal_string" }, { "type": "SYMBOL", "name": "keyword_true" }, { "type": "SYMBOL", "name": "keyword_false" }, { "type": "SYMBOL", "name": "keyword_null" } ] }, "_type": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_type_numeric" }, { "type": "SYMBOL", "name": "_type_character" }, { "type": "SYMBOL", "name": "_type_datetime" }, { "type": "SYMBOL", "name": "_type_geometric" }, { "type": "SYMBOL", "name": "_type_net" }, { "type": "SYMBOL", "name": "_type_bit_string" }, { "type": "SYMBOL", "name": "_type_text_search" }, { "type": "SYMBOL", "name": "keyword_money" }, { "type": "SYMBOL", "name": "keyword_bytea" }, { "type": "SYMBOL", "name": "keyword_boolean" }, { "type": "SYMBOL", "name": "keyword_uuid" }, { "type": "SYMBOL", "name": "keyword_xml" } ] }, "_type_numeric": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "keyword_smallint" }, { "type": "SYMBOL", "name": "keyword_integer" }, { "type": "SYMBOL", "name": "keyword_bigint" }, { "type": "SYMBOL", "name": "keyword_real" }, { "type": "SYMBOL", "name": "keyword_smallserial" }, { "type": "SYMBOL", "name": "keyword_serial" }, { "type": "SYMBOL", "name": "keyword_bigserial" }, { "type": "SYMBOL", "name": "double" }, { "type": "SYMBOL", "name": "numeric" }, { "type": "SYMBOL", "name": "decimal" } ] }, "double": { "type": "SEQ", "members": [ { "type": "PATTERN", "value": "double|DOUBLE" }, { "type": "PATTERN", "value": "precision|PRECISION" } ] }, "decimal": { "type": "CHOICE", "members": [ { "type": "PREC_RIGHT", "value": 0, "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "keyword_decimal" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "keyword_decimal" }, { "type": "STRING", "value": "(" }, { "type": "FIELD", "name": "precision", "content": { "type": "SYMBOL", "name": "number" } }, { "type": "STRING", "value": ")" } ] } ] } }, { "type": "PREC_RIGHT", "value": 0, "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "keyword_decimal" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "keyword_decimal" }, { "type": "STRING", "value": "(" }, { "type": "FIELD", "name": "precision", "content": { "type": "SYMBOL", "name": "number" } }, { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "FIELD", "name": "scale", "content": { "type": "SYMBOL", "name": "number" } } ] }, { "type": "STRING", "value": ")" } ] } ] } } ] }, "numeric": { "type": "CHOICE", "members": [ { "type": "PREC_RIGHT", "value": 0, "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "keyword_numeric" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "keyword_numeric" }, { "type": "STRING", "value": "(" }, { "type": "FIELD", "name": "precision", "content": { "type": "SYMBOL", "name": "number" } }, { "type": "STRING", "value": ")" } ] } ] } }, { "type": "PREC_RIGHT", "value": 0, "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "keyword_numeric" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "keyword_numeric" }, { "type": "STRING", "value": "(" }, { "type": "FIELD", "name": "precision", "content": { "type": "SYMBOL", "name": "number" } }, { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "FIELD", "name": "scale", "content": { "type": "SYMBOL", "name": "number" } } ] }, { "type": "STRING", "value": ")" } ] } ] } } ] }, "_type_character": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "keyword_text" }, { "type": "SYMBOL", "name": "char" }, { "type": "SYMBOL", "name": "varchar" } ] }, "char": { "type": "PREC_RIGHT", "value": 0, "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "keyword_char" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "keyword_char" }, { "type": "STRING", "value": "(" }, { "type": "FIELD", "name": "size", "content": { "type": "SYMBOL", "name": "number" } }, { "type": "STRING", "value": ")" } ] } ] } }, "varchar": { "type": "PREC_RIGHT", "value": 0, "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "keyword_varchar" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "keyword_varchar" }, { "type": "STRING", "value": "(" }, { "type": "FIELD", "name": "size", "content": { "type": "SYMBOL", "name": "number" } }, { "type": "STRING", "value": ")" } ] } ] } }, "_type_datetime": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "keyword_date" }, { "type": "SYMBOL", "name": "keyword_datetime" }, { "type": "SYMBOL", "name": "keyword_time" }, { "type": "SYMBOL", "name": "keyword_timestamp" }, { "type": "SYMBOL", "name": "keyword_timestamptz" } ] }, "_type_geometric": { "type": "CHOICE", "members": [] }, "_type_net": { "type": "CHOICE", "members": [] }, "_type_bit_string": { "type": "CHOICE", "members": [] }, "_type_text_search": { "type": "CHOICE", "members": [] }, "_type_json": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "keyword_json" }, { "type": "SYMBOL", "name": "keyword_jsonb" } ] }, "_primary_key": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "keyword_primary" }, { "type": "SYMBOL", "name": "keyword_key" } ] }, "_foreign_key": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "keyword_foreign" }, { "type": "SYMBOL", "name": "keyword_key" } ] }, "_if_not_exists": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "keyword_if" }, { "type": "SYMBOL", "name": "keyword_not" }, { "type": "SYMBOL", "name": "keyword_exists" } ] }, "_not_null": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "keyword_not" }, { "type": "SYMBOL", "name": "keyword_null" } ] }, "_without_time_zone": { "type": "SEQ", "members": [ { "type": "PATTERN", "value": "without|WITHOUT" }, { "type": "SYMBOL", "name": "_keyword_time_zone" } ] }, "_with_time_zone": { "type": "SEQ", "members": [ { "type": "PATTERN", "value": "with|WITH" }, { "type": "SYMBOL", "name": "_keyword_time_zone" } ] }, "_keyword_time_zone": { "type": "SEQ", "members": [ { "type": "PATTERN", "value": "time|TIME" }, { "type": "PATTERN", "value": "zone|ZONE" } ] }, "keyword_create": { "type": "PATTERN", "value": "create|CREATE" }, "keyword_table": { "type": "PATTERN", "value": "table|TABLE" }, "keyword_temporary": { "type": "CHOICE", "members": [ { "type": "PATTERN", "value": "temporary|TEMPORARY" }, { "type": "PATTERN", "value": "temp|TEMP" } ] }, "keyword_unlogged": { "type": "PATTERN", "value": "unlogged|UNLOGGED" }, "keyword_if": { "type": "PATTERN", "value": "if|IF" }, "keyword_not": { "type": "PATTERN", "value": "not|NOT" }, "keyword_exists": { "type": "PATTERN", "value": "exists|EXISTS" }, "keyword_null": { "type": "PATTERN", "value": "null|NULL" }, "keyword_constraint": { "type": "PATTERN", "value": "constraint|CONSTRAINT" }, "keyword_default": { "type": "PATTERN", "value": "default|DEFAULT" }, "keyword_true": { "type": "PATTERN", "value": "true|TRUE" }, "keyword_false": { "type": "PATTERN", "value": "false|FALSE" }, "keyword_nulls": { "type": "PATTERN", "value": "nulls|NULLS" }, "keyword_distinct": { "type": "PATTERN", "value": "distinct|DISTINCT" }, "keyword_unique": { "type": "PATTERN", "value": "unique|UNIQUE" }, "keyword_primary": { "type": "PATTERN", "value": "primary|PRIMARY" }, "keyword_foreign": { "type": "PATTERN", "value": "foreign|FOREIGN" }, "keyword_key": { "type": "PATTERN", "value": "key|KEY" }, "keyword_references": { "type": "PATTERN", "value": "references|REFERENCES" }, "keyword_on": { "type": "PATTERN", "value": "on|ON" }, "keyword_no": { "type": "PATTERN", "value": "no|NO" }, "keyword_delete": { "type": "PATTERN", "value": "delete|DELETE" }, "keyword_update": { "type": "PATTERN", "value": "update|UPDATE" }, "keyword_match": { "type": "PATTERN", "value": "match|MATCH" }, "keyword_full": { "type": "PATTERN", "value": "full|FULL" }, "keyword_partial": { "type": "PATTERN", "value": "partial|PARTIAL" }, "keyword_simple": { "type": "PATTERN", "value": "simple|SIMPLE" }, "keyword_action": { "type": "PATTERN", "value": "action|ACTION" }, "keyword_set": { "type": "PATTERN", "value": "set|SET" }, "keyword_restrict": { "type": "PATTERN", "value": "restrict|RESTRICT" }, "keyword_cascade": { "type": "PATTERN", "value": "cascade|CASCADE" }, "keyword_xml": { "type": "PATTERN", "value": "xml|XML" }, "keyword_uuid": { "type": "PATTERN", "value": "uuid|UUID" }, "keyword_json": { "type": "PATTERN", "value": "json|JSON" }, "keyword_jsonb": { "type": "PATTERN", "value": "jsonb|JSONB" }, "keyword_boolean": { "type": "PATTERN", "value": "boolean|BOOLEAN" }, "keyword_smallint": { "type": "PATTERN", "value": "smallint|SMALLINT" }, "keyword_integer": { "type": "PATTERN", "value": "integer|INTEGER" }, "keyword_bigint": { "type": "PATTERN", "value": "bigint|BIGINT" }, "keyword_decimal": { "type": "PATTERN", "value": "decimal|DECIMAL" }, "keyword_numeric": { "type": "PATTERN", "value": "numeric|NUMERIC" }, "keyword_real": { "type": "PATTERN", "value": "real|REAL" }, "keyword_smallserial": { "type": "PATTERN", "value": "smallserial|SMALLSERIAL" }, "keyword_serial": { "type": "PATTERN", "value": "serial|SERIAL" }, "keyword_bigserial": { "type": "PATTERN", "value": "bigserial|BIGSERIAL" }, "keyword_money": { "type": "PATTERN", "value": "money|MONEY" }, "keyword_text": { "type": "PATTERN", "value": "text|TEXT" }, "keyword_char": { "type": "CHOICE", "members": [ { "type": "PATTERN", "value": "character|CHARACTER" }, { "type": "PATTERN", "value": "char|CHAR" } ] }, "keyword_varchar": { "type": "CHOICE", "members": [ { "type": "PATTERN", "value": "varchar|VARCHAR" }, { "type": "SEQ", "members": [ { "type": "PATTERN", "value": "character|CHARACTER" } ] } ] }, "keyword_bytea": { "type": "PATTERN", "value": "bytea|BYTEA" }, "keyword_date": { "type": "PATTERN", "value": "date|DATE" }, "keyword_datetime": { "type": "PATTERN", "value": "datetime|DATETIME" }, "keyword_time": { "type": "SEQ", "members": [ { "type": "PATTERN", "value": "time|TIME" }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_without_time_zone" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_with_time_zone" } ] } ] }, "keyword_timestamp": { "type": "SEQ", "members": [ { "type": "PATTERN", "value": "timestamp|TIMESTAMP" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_without_time_zone" }, { "type": "BLANK" } ] } ] }, "keyword_timestamptz": { "type": "CHOICE", "members": [ { "type": "PATTERN", "value": "timestamptz|TIMESTAMPTZ" }, { "type": "SEQ", "members": [ { "type": "PATTERN", "value": "timestamp|TIMESTAMP" }, { "type": "SYMBOL", "name": "_with_time_zone" } ] } ] }, "line_comment": { "type": "SEQ", "members": [ { "type": "STRING", "value": "--" }, { "type": "PATTERN", "value": ".*\\n" } ] }, "block_comment": { "type": "SEQ", "members": [ { "type": "STRING", "value": "/*" }, { "type": "PATTERN", "value": "[^*]*\\*+(?:[^/*][^*]*\\*+)*" }, { "type": "STRING", "value": "/" } ] }, "literal_string": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "'" }, { "type": "PATTERN", "value": "[^']*" }, { "type": "STRING", "value": "'" } ] } ] }, "number": { "type": "PATTERN", "value": "\\d+" }, "identifier": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_identifier" }, { "type": "SEQ", "members": [ { "type": "STRING", "value": "\"" }, { "type": "PATTERN", "value": "[^\"]+" }, { "type": "STRING", "value": "\"" } ] } ] }, "_identifier": { "type": "PATTERN", "value": "([a-zA-Z_][0-9a-zA-Z_]*)" } }, "extras": [ { "type": "PATTERN", "value": "\\s\\n" }, { "type": "PATTERN", "value": "\\s" }, { "type": "SYMBOL", "name": "line_comment" }, { "type": "SYMBOL", "name": "block_comment" } ], "conflicts": [ [ "keyword_char", "keyword_varchar" ] ], "precedences": [], "externals": [], "inline": [], "supertypes": [] }