From 26100d7e121bebf6aeb11f3bcd68baa269621392 Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sun, 9 Oct 2022 18:28:26 +0100 Subject: [PATCH 01/42] Add filetype detection for TypeQL --- ftdetect/typedb-tql.vim | 1 + ftdetect/typeql.vim | 0 2 files changed, 1 insertion(+) create mode 100644 ftdetect/typedb-tql.vim delete mode 100644 ftdetect/typeql.vim diff --git a/ftdetect/typedb-tql.vim b/ftdetect/typedb-tql.vim new file mode 100644 index 0000000..97e836b --- /dev/null +++ b/ftdetect/typedb-tql.vim @@ -0,0 +1 @@ +au BufNewFile,BufRead *.tql set filetype=typedb-tql diff --git a/ftdetect/typeql.vim b/ftdetect/typeql.vim deleted file mode 100644 index e69de29..0000000 From d4f34bfd5f51838a8f6b9e1363e09e600705c785 Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sun, 9 Oct 2022 18:36:28 +0100 Subject: [PATCH 02/42] Add basic tab/indentation settings --- ftplugin/typedb-tql.vim | 3 +++ ftplugin/typeql.vim | 0 2 files changed, 3 insertions(+) create mode 100644 ftplugin/typedb-tql.vim delete mode 100644 ftplugin/typeql.vim diff --git a/ftplugin/typedb-tql.vim b/ftplugin/typedb-tql.vim new file mode 100644 index 0000000..9aba802 --- /dev/null +++ b/ftplugin/typedb-tql.vim @@ -0,0 +1,3 @@ +set tabstop=4 +set softtabstop=4 +set shiftwidth=4 diff --git a/ftplugin/typeql.vim b/ftplugin/typeql.vim deleted file mode 100644 index e69de29..0000000 From db9a5c498fa9820d6653b6c96e3010d065e0df86 Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sun, 9 Oct 2022 18:48:49 +0100 Subject: [PATCH 03/42] Add header/manifest to syntax file --- syntax/typedb-tql.vim | 7 +++++++ syntax/typeql.vim | 0 2 files changed, 7 insertions(+) create mode 100644 syntax/typedb-tql.vim delete mode 100644 syntax/typeql.vim diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim new file mode 100644 index 0000000..7d67af2 --- /dev/null +++ b/syntax/typedb-tql.vim @@ -0,0 +1,7 @@ +" Vim syntax file +" Language: TypeQL for TypeDB +" Maintainer: agrski <20504869+agrski@users.noreply.github.com> +" Last Change: 2022 Oct 09 + +" Based on the reserved keywords defined in TypeDB's documentation: +" https://docs.vaticle.com/docs/schema/overview#reserved-keywords diff --git a/syntax/typeql.vim b/syntax/typeql.vim deleted file mode 100644 index e69de29..0000000 From 4785a06ae4873de7ce323939486e555e0e4cf85d Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sun, 9 Oct 2022 18:49:20 +0100 Subject: [PATCH 04/42] Add prelude/syntax check to syntax file --- syntax/typedb-tql.vim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index 7d67af2..9d88880 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -5,3 +5,8 @@ " Based on the reserved keywords defined in TypeDB's documentation: " https://docs.vaticle.com/docs/schema/overview#reserved-keywords + +" Prelude {{{1 +if exists("b:current_syntax") + finish +endif From dcee0a586d7eded275d28a3ef62a75d0714aa48c Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sun, 9 Oct 2022 19:45:44 +0100 Subject: [PATCH 05/42] Add syntax matching options for case and keyword characters --- syntax/typedb-tql.vim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index 9d88880..93e79c0 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -10,3 +10,8 @@ if exists("b:current_syntax") finish endif + +" Syntax matching options {{{1 +syntax case match + +setlocal iskeyword+=! From 1e72feb29600029ab86ae3b14939c5a6b2b09ca4 Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sun, 9 Oct 2022 19:59:32 +0100 Subject: [PATCH 06/42] Add TypeQL keywords --- syntax/typedb-tql.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index 93e79c0..ed89796 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -15,3 +15,13 @@ endif syntax case match setlocal iskeyword+=! + +" Keywords {{{1 +syn keyword typedbTqlNativeType thing entity attribute relation role +syn keyword typedbTqlDataType long double string boolean datetime +syn keyword typedbTqlQueryCmd define undefine match get insert delete +syn keyword typedbTqlQueryModifier offset limit group sort asc desc +syn keyword typedbTqlStatementProp abstract as has iid isa isa! owns plays regex relates rule sub sub! then type value when +syn keyword typedbTqlOperator is like or not +syn keyword typedbTqlLiteral false true + From d5607fa20d01c3c68b7d37e808f5d7ca7e4e6693 Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sun, 9 Oct 2022 20:21:46 +0100 Subject: [PATCH 07/42] Add default highlighting for keyword groups --- syntax/typedb-tql.vim | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index ed89796..8c041e3 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -25,3 +25,12 @@ syn keyword typedbTqlStatementProp abstract as has iid isa isa! owns plays rege syn keyword typedbTqlOperator is like or not syn keyword typedbTqlLiteral false true +" Default highlighting +highlight default link typedbTqlNativeType Identifier +highlight default link typedbTqlDataType Type +highlight default link typedbTqlQueryCmd Statement +highlight default link typedbTqlQueryModifier Statement +highlight default link typedbTqlStatementProp Statement +highlight default link typedbTqlOperator Operator +highlight default link typedbTqlLiteral Constant + From 5aaf8452b755aeff88a5c80cb19776c3bd3ea017 Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Mon, 10 Oct 2022 01:00:55 +0100 Subject: [PATCH 08/42] Use full-form syntax instead of syn for keyword definitions --- syntax/typedb-tql.vim | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index 8c041e3..cb8ee4b 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -17,13 +17,13 @@ syntax case match setlocal iskeyword+=! " Keywords {{{1 -syn keyword typedbTqlNativeType thing entity attribute relation role -syn keyword typedbTqlDataType long double string boolean datetime -syn keyword typedbTqlQueryCmd define undefine match get insert delete -syn keyword typedbTqlQueryModifier offset limit group sort asc desc -syn keyword typedbTqlStatementProp abstract as has iid isa isa! owns plays regex relates rule sub sub! then type value when -syn keyword typedbTqlOperator is like or not -syn keyword typedbTqlLiteral false true +syntax keyword typedbTqlNativeType thing entity attribute relation role +syntax keyword typedbTqlDataType long double string boolean datetime +syntax keyword typedbTqlQueryCmd define undefine match get insert delete +syntax keyword typedbTqlQueryModifier offset limit group sort asc desc +syntax keyword typedbTqlStatementProp abstract as has iid isa isa! owns plays regex relates rule sub sub! then type value when +syntax keyword typedbTqlOperator is like or not +syntax keyword typedbTqlLiteral false true " Default highlighting highlight default link typedbTqlNativeType Identifier From 2efc29b3b8989609fb5a7f0010962f012aef3a02 Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Mon, 10 Oct 2022 01:01:17 +0100 Subject: [PATCH 09/42] Add Vim fold marker for highlighting section --- syntax/typedb-tql.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index cb8ee4b..35f8ac3 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -25,7 +25,7 @@ syntax keyword typedbTqlStatementProp abstract as has iid isa isa! owns plays r syntax keyword typedbTqlOperator is like or not syntax keyword typedbTqlLiteral false true -" Default highlighting +" Default highlighting {{{1 highlight default link typedbTqlNativeType Identifier highlight default link typedbTqlDataType Type highlight default link typedbTqlQueryCmd Statement From a68e8e2839a1208b2246cc8f2f07758c3a1e2e3d Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Mon, 10 Oct 2022 01:02:39 +0100 Subject: [PATCH 10/42] Add syntactic matching & highlighting for comments & TODOs --- syntax/typedb-tql.vim | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index 35f8ac3..4a59def 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -25,6 +25,10 @@ syntax keyword typedbTqlStatementProp abstract as has iid isa isa! owns plays r syntax keyword typedbTqlOperator is like or not syntax keyword typedbTqlLiteral false true +" Comments {{{1 +syntax keyword typedbTqlTodo contained TODO FIXME XXX NOTE +syntax match typedbTqlComment /#.*$/ contains=typedbTqlTodo + " Default highlighting {{{1 highlight default link typedbTqlNativeType Identifier highlight default link typedbTqlDataType Type @@ -33,4 +37,6 @@ highlight default link typedbTqlQueryModifier Statement highlight default link typedbTqlStatementProp Statement highlight default link typedbTqlOperator Operator highlight default link typedbTqlLiteral Constant +highlight default link typedbTqlTodo Todo +highlight default link typedbTqlComment Comment From 4403394a7d6f24ea11120b40df45acf49ca7418e Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Mon, 10 Oct 2022 01:11:19 +0100 Subject: [PATCH 11/42] Add syntactic matching & highlighting for string literals --- syntax/typedb-tql.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index 4a59def..9b4bb33 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -29,6 +29,9 @@ syntax keyword typedbTqlLiteral false true syntax keyword typedbTqlTodo contained TODO FIXME XXX NOTE syntax match typedbTqlComment /#.*$/ contains=typedbTqlTodo +" Strings {{{1 +syntax match typedbTqlString /".*"/ + " Default highlighting {{{1 highlight default link typedbTqlNativeType Identifier highlight default link typedbTqlDataType Type @@ -39,4 +42,5 @@ highlight default link typedbTqlOperator Operator highlight default link typedbTqlLiteral Constant highlight default link typedbTqlTodo Todo highlight default link typedbTqlComment Comment +highlight default link typedbTqlString String From 2700c5a215216d1887f6bbba4b0745b38a6beda9 Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Fri, 14 Oct 2022 00:48:34 +0100 Subject: [PATCH 12/42] Add matches & region identifiers for blocks in inference rules --- syntax/typedb-tql.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index 9b4bb33..603b8c2 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -29,6 +29,11 @@ syntax keyword typedbTqlLiteral false true syntax keyword typedbTqlTodo contained TODO FIXME XXX NOTE syntax match typedbTqlComment /#.*$/ contains=typedbTqlTodo +" Block {{{1 +syntax match typedbTqlVar /\$[a-zA-Z-_]\+/ contained +syntax match typedbTqlBlockDelimiter /[{}()]/ contained +syntax region typedbTqlBlock start='{' end='}' contains=typedbTqlVar,typedbTqlStatementProp,typedbTqlBlockDelimiter fold transparent + " Strings {{{1 syntax match typedbTqlString /".*"/ @@ -40,7 +45,12 @@ highlight default link typedbTqlQueryModifier Statement highlight default link typedbTqlStatementProp Statement highlight default link typedbTqlOperator Operator highlight default link typedbTqlLiteral Constant + highlight default link typedbTqlTodo Todo highlight default link typedbTqlComment Comment + +highlight default link typedbTqlVar Identifier +highlight default link typedbTqlBlockDelimiter Structure + highlight default link typedbTqlString String From aaf51fe498995ea94301259ee90da5a0ad4dc1bc Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sat, 29 Oct 2022 19:19:50 +0100 Subject: [PATCH 13/42] Align syntax file header block --- syntax/typedb-tql.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index 603b8c2..c813138 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: TypeQL for TypeDB -" Maintainer: agrski <20504869+agrski@users.noreply.github.com> -" Last Change: 2022 Oct 09 +" Language: TypeQL for TypeDB +" Maintainer: agrski <20504869+agrski@users.noreply.github.com> +" Last Change: 2022 Oct 09 " Based on the reserved keywords defined in TypeDB's documentation: " https://docs.vaticle.com/docs/schema/overview#reserved-keywords From 5e2ca6607c48631161f3461069a80cd5f5c2739b Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sat, 29 Oct 2022 19:20:32 +0100 Subject: [PATCH 14/42] Add creation metadata to syntax file --- syntax/typedb-tql.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index c813138..19ed4bf 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -1,7 +1,8 @@ " Vim syntax file " Language: TypeQL for TypeDB " Maintainer: agrski <20504869+agrski@users.noreply.github.com> -" Last Change: 2022 Oct 09 +" Created: 2022 Oct 09 +" Last Change: 2022 Oct 29 " Based on the reserved keywords defined in TypeDB's documentation: " https://docs.vaticle.com/docs/schema/overview#reserved-keywords From 69b1d979936071edbb84082c7d54b7e1d813b649 Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sat, 29 Oct 2022 19:40:01 +0100 Subject: [PATCH 15/42] Update link for source of TypeQL grammar Replacing the informal list of reserved keywords with the official ANTLR grammar. --- syntax/typedb-tql.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index 19ed4bf..cff7f0d 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -4,8 +4,8 @@ " Created: 2022 Oct 09 " Last Change: 2022 Oct 29 -" Based on the reserved keywords defined in TypeDB's documentation: -" https://docs.vaticle.com/docs/schema/overview#reserved-keywords +" Based on the ANTLR grammar defined for TypeQL: +" https://github.com/vaticle/typeql/blob/fd78c825e87058293290d4801834593823a329a8/grammar/TypeQL.g4 " Prelude {{{1 if exists("b:current_syntax") From 279239dcf9219cf787068193164313cf2e412945 Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sat, 29 Oct 2022 20:27:19 +0100 Subject: [PATCH 16/42] Add missing keywords to a couple of syntax groups --- syntax/typedb-tql.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index cff7f0d..fa6d5af 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -18,9 +18,9 @@ syntax case match setlocal iskeyword+=! " Keywords {{{1 -syntax keyword typedbTqlNativeType thing entity attribute relation role +syntax keyword typedbTqlNativeType thing entity attribute relation role rule syntax keyword typedbTqlDataType long double string boolean datetime -syntax keyword typedbTqlQueryCmd define undefine match get insert delete +syntax keyword typedbTqlQueryCmd define undefine match get insert delete compute syntax keyword typedbTqlQueryModifier offset limit group sort asc desc syntax keyword typedbTqlStatementProp abstract as has iid isa isa! owns plays regex relates rule sub sub! then type value when syntax keyword typedbTqlOperator is like or not From f4363b1c9d22309dbf2f106cec66b73f40474ade Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sat, 29 Oct 2022 20:27:38 +0100 Subject: [PATCH 17/42] Remove keyword from wrong syntax group --- syntax/typedb-tql.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index fa6d5af..3a1f0c2 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -21,7 +21,7 @@ setlocal iskeyword+=! syntax keyword typedbTqlNativeType thing entity attribute relation role rule syntax keyword typedbTqlDataType long double string boolean datetime syntax keyword typedbTqlQueryCmd define undefine match get insert delete compute -syntax keyword typedbTqlQueryModifier offset limit group sort asc desc +syntax keyword typedbTqlQueryModifier offset limit sort asc desc syntax keyword typedbTqlStatementProp abstract as has iid isa isa! owns plays regex relates rule sub sub! then type value when syntax keyword typedbTqlOperator is like or not syntax keyword typedbTqlLiteral false true From 7e0a2fc1cb37658feb6581c2fb31c09ec555ebf6 Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sat, 29 Oct 2022 23:02:28 +0100 Subject: [PATCH 18/42] Add keyword group for type var constraints --- syntax/typedb-tql.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index 3a1f0c2..c7b72dc 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -20,9 +20,10 @@ setlocal iskeyword+=! " Keywords {{{1 syntax keyword typedbTqlNativeType thing entity attribute relation role rule syntax keyword typedbTqlDataType long double string boolean datetime +syntax keyword typedbTqlTypeVarConstraint abstract type sub sub! owns plays as regex when then relates @key syntax keyword typedbTqlQueryCmd define undefine match get insert delete compute syntax keyword typedbTqlQueryModifier offset limit sort asc desc -syntax keyword typedbTqlStatementProp abstract as has iid isa isa! owns plays regex relates rule sub sub! then type value when +syntax keyword typedbTqlStatementProp has iid isa isa! value syntax keyword typedbTqlOperator is like or not syntax keyword typedbTqlLiteral false true From 341e3a0cc5aec7278cf2c86a671136ece4c0c3d4 Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sat, 29 Oct 2022 23:04:43 +0100 Subject: [PATCH 19/42] Update & rename keyword group for thing-var constraints --- syntax/typedb-tql.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index c7b72dc..f197d20 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -23,8 +23,8 @@ syntax keyword typedbTqlDataType long double string boolean datetime syntax keyword typedbTqlTypeVarConstraint abstract type sub sub! owns plays as regex when then relates @key syntax keyword typedbTqlQueryCmd define undefine match get insert delete compute syntax keyword typedbTqlQueryModifier offset limit sort asc desc -syntax keyword typedbTqlStatementProp has iid isa isa! value -syntax keyword typedbTqlOperator is like or not +syntax keyword typedbTqlThingVarConstraint has iid is isa isa! value +syntax keyword typedbTqlOperator like or not syntax keyword typedbTqlLiteral false true " Comments {{{1 @@ -44,7 +44,7 @@ highlight default link typedbTqlNativeType Identifier highlight default link typedbTqlDataType Type highlight default link typedbTqlQueryCmd Statement highlight default link typedbTqlQueryModifier Statement -highlight default link typedbTqlStatementProp Statement +highlight default link typedbTqlThingVarConstraint Statement highlight default link typedbTqlOperator Operator highlight default link typedbTqlLiteral Constant From f0c9dee5fe89c3b546a246d4e83eddc2f1942dd3 Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sat, 29 Oct 2022 23:05:33 +0100 Subject: [PATCH 20/42] Update keyword group for operators --- syntax/typedb-tql.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index f197d20..f0e9659 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -24,7 +24,7 @@ syntax keyword typedbTqlTypeVarConstraint abstract type sub sub! owns plays as r syntax keyword typedbTqlQueryCmd define undefine match get insert delete compute syntax keyword typedbTqlQueryModifier offset limit sort asc desc syntax keyword typedbTqlThingVarConstraint has iid is isa isa! value -syntax keyword typedbTqlOperator like or not +syntax keyword typedbTqlOperator or not syntax keyword typedbTqlLiteral false true " Comments {{{1 From b86593fe0e78d5a15450859192d8173fb3712ca3 Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sat, 29 Oct 2022 23:06:59 +0100 Subject: [PATCH 21/42] Add keyword group for predicates --- syntax/typedb-tql.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index f0e9659..7e5fbbf 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -25,6 +25,7 @@ syntax keyword typedbTqlQueryCmd define undefine match get insert delete c syntax keyword typedbTqlQueryModifier offset limit sort asc desc syntax keyword typedbTqlThingVarConstraint has iid is isa isa! value syntax keyword typedbTqlOperator or not +syntax keyword typedbTqlPredicate = != < <= > >= like contains syntax keyword typedbTqlLiteral false true " Comments {{{1 From dcf29e6e79e8e2ca5afe4c2a504927fa100aea80 Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sat, 29 Oct 2022 23:08:54 +0100 Subject: [PATCH 22/42] Add keyword group for query aggregations --- syntax/typedb-tql.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index 7e5fbbf..07b5674 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -23,6 +23,7 @@ syntax keyword typedbTqlDataType long double string boolean datetime syntax keyword typedbTqlTypeVarConstraint abstract type sub sub! owns plays as regex when then relates @key syntax keyword typedbTqlQueryCmd define undefine match get insert delete compute syntax keyword typedbTqlQueryModifier offset limit sort asc desc +syntax keyword typedbTqlAggregateCmd group count min max mean median std sum syntax keyword typedbTqlThingVarConstraint has iid is isa isa! value syntax keyword typedbTqlOperator or not syntax keyword typedbTqlPredicate = != < <= > >= like contains From 477730dc401bd2c86daee61199fecad7981648a6 Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sat, 29 Oct 2022 23:58:27 +0100 Subject: [PATCH 23/42] Use consistent alignment for keywords section --- syntax/typedb-tql.vim | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index 07b5674..e92c263 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -18,16 +18,16 @@ syntax case match setlocal iskeyword+=! " Keywords {{{1 -syntax keyword typedbTqlNativeType thing entity attribute relation role rule -syntax keyword typedbTqlDataType long double string boolean datetime -syntax keyword typedbTqlTypeVarConstraint abstract type sub sub! owns plays as regex when then relates @key -syntax keyword typedbTqlQueryCmd define undefine match get insert delete compute -syntax keyword typedbTqlQueryModifier offset limit sort asc desc -syntax keyword typedbTqlAggregateCmd group count min max mean median std sum +syntax keyword typedbTqlNativeType thing entity attribute relation role rule +syntax keyword typedbTqlDataType long double string boolean datetime +syntax keyword typedbTqlTypeVarConstraint abstract type sub sub! owns plays as regex when then relates @key +syntax keyword typedbTqlQueryCmd define undefine match get insert delete compute +syntax keyword typedbTqlQueryModifier offset limit sort asc desc +syntax keyword typedbTqlAggregateCmd group count min max mean median std sum syntax keyword typedbTqlThingVarConstraint has iid is isa isa! value -syntax keyword typedbTqlOperator or not -syntax keyword typedbTqlPredicate = != < <= > >= like contains -syntax keyword typedbTqlLiteral false true +syntax keyword typedbTqlOperator or not +syntax keyword typedbTqlPredicate = != < <= > >= like contains +syntax keyword typedbTqlLiteral false true " Comments {{{1 syntax keyword typedbTqlTodo contained TODO FIXME XXX NOTE From 22eaa9b5e0cbfb97316b8decbad0fa588f721312 Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sun, 30 Oct 2022 00:08:58 +0100 Subject: [PATCH 24/42] Reorder keyword groups for logical grouping --- syntax/typedb-tql.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index e92c263..f3e272f 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -21,10 +21,10 @@ setlocal iskeyword+=! syntax keyword typedbTqlNativeType thing entity attribute relation role rule syntax keyword typedbTqlDataType long double string boolean datetime syntax keyword typedbTqlTypeVarConstraint abstract type sub sub! owns plays as regex when then relates @key +syntax keyword typedbTqlThingVarConstraint has iid is isa isa! value syntax keyword typedbTqlQueryCmd define undefine match get insert delete compute syntax keyword typedbTqlQueryModifier offset limit sort asc desc syntax keyword typedbTqlAggregateCmd group count min max mean median std sum -syntax keyword typedbTqlThingVarConstraint has iid is isa isa! value syntax keyword typedbTqlOperator or not syntax keyword typedbTqlPredicate = != < <= > >= like contains syntax keyword typedbTqlLiteral false true From 10bce20d8b97714294b64f1fe02fcaca7efde651 Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sun, 30 Oct 2022 00:09:20 +0100 Subject: [PATCH 25/42] Add default highlight for new keyword groups --- syntax/typedb-tql.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index f3e272f..5199532 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -44,10 +44,13 @@ syntax match typedbTqlString /".*"/ " Default highlighting {{{1 highlight default link typedbTqlNativeType Identifier highlight default link typedbTqlDataType Type +highlight default link typedbTqlTypeVarConstraint Statement +highlight default link typedbTqlThingVarConstraint Operator highlight default link typedbTqlQueryCmd Statement highlight default link typedbTqlQueryModifier Statement -highlight default link typedbTqlThingVarConstraint Statement +highlight default link typedbTqlAggregateCmd Statement highlight default link typedbTqlOperator Operator +highlight default link typedbTqlPredicate Operator highlight default link typedbTqlLiteral Constant highlight default link typedbTqlTodo Todo From af4f813b7ec9bd797e5e10e4c7b6f026a7b5de06 Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sun, 30 Oct 2022 00:14:41 +0100 Subject: [PATCH 26/42] Split region definition over multiple lines for legibility --- syntax/typedb-tql.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index 5199532..4b8ef85 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -36,7 +36,11 @@ syntax match typedbTqlComment /#.*$/ contains=typedbTqlTodo " Block {{{1 syntax match typedbTqlVar /\$[a-zA-Z-_]\+/ contained syntax match typedbTqlBlockDelimiter /[{}()]/ contained -syntax region typedbTqlBlock start='{' end='}' contains=typedbTqlVar,typedbTqlStatementProp,typedbTqlBlockDelimiter fold transparent +syntax region typedbTqlBlock + \ start='{' + \ end='}' + \ contains=typedbTqlVar,typedbTqlThingVarConstraint,typedbTqlBlockDelimiter + \ fold transparent " Strings {{{1 syntax match typedbTqlString /".*"/ From f5d48077214d2636d716f14feae21a181a291d33 Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sun, 30 Oct 2022 00:26:57 +0100 Subject: [PATCH 27/42] Move Booleans to literals section & rename syntax group --- syntax/typedb-tql.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index 4b8ef85..d998424 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -27,7 +27,6 @@ syntax keyword typedbTqlQueryModifier offset limit sort asc desc syntax keyword typedbTqlAggregateCmd group count min max mean median std sum syntax keyword typedbTqlOperator or not syntax keyword typedbTqlPredicate = != < <= > >= like contains -syntax keyword typedbTqlLiteral false true " Comments {{{1 syntax keyword typedbTqlTodo contained TODO FIXME XXX NOTE @@ -42,8 +41,9 @@ syntax region typedbTqlBlock \ contains=typedbTqlVar,typedbTqlThingVarConstraint,typedbTqlBlockDelimiter \ fold transparent -" Strings {{{1 -syntax match typedbTqlString /".*"/ +" Literals {{{1 +syntax keyword typedbTqlBoolean false true +syntax match typedbTqlString /".*"/ " Default highlighting {{{1 highlight default link typedbTqlNativeType Identifier @@ -55,7 +55,6 @@ highlight default link typedbTqlQueryModifier Statement highlight default link typedbTqlAggregateCmd Statement highlight default link typedbTqlOperator Operator highlight default link typedbTqlPredicate Operator -highlight default link typedbTqlLiteral Constant highlight default link typedbTqlTodo Todo highlight default link typedbTqlComment Comment @@ -63,5 +62,6 @@ highlight default link typedbTqlComment Comment highlight default link typedbTqlVar Identifier highlight default link typedbTqlBlockDelimiter Structure +highlight default link typedbTqlBoolean Constant highlight default link typedbTqlString String From 569ff3179635c014db0b79d9af6072e43a9cb967 Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sun, 30 Oct 2022 00:27:13 +0100 Subject: [PATCH 28/42] Add match for single-quoted strings --- syntax/typedb-tql.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index d998424..31db4a7 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -44,6 +44,7 @@ syntax region typedbTqlBlock " Literals {{{1 syntax keyword typedbTqlBoolean false true syntax match typedbTqlString /".*"/ +syntax match typedbTqlString /'.*'/ " Default highlighting {{{1 highlight default link typedbTqlNativeType Identifier From 77634e251555a0e1ca5883edc15cfc8d9bf3805c Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sun, 30 Oct 2022 00:40:20 +0100 Subject: [PATCH 29/42] Add syntactic matching & highlighting for integer literals --- syntax/typedb-tql.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index 31db4a7..0779048 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -45,6 +45,7 @@ syntax region typedbTqlBlock syntax keyword typedbTqlBoolean false true syntax match typedbTqlString /".*"/ syntax match typedbTqlString /'.*'/ +syntax match typedbTqlLong /\v(\+|-)?[0-9]+/ " Default highlighting {{{1 highlight default link typedbTqlNativeType Identifier @@ -65,4 +66,4 @@ highlight default link typedbTqlBlockDelimiter Structure highlight default link typedbTqlBoolean Constant highlight default link typedbTqlString String - +highlight default link typedbTqlLong Number From 061d8580c81eb7f3bc542e841315e9aac7e3044b Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sun, 30 Oct 2022 00:43:30 +0100 Subject: [PATCH 30/42] Add syntactic matching & highlighting for floating-point literals --- syntax/typedb-tql.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index 0779048..28b6fe9 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -46,6 +46,7 @@ syntax keyword typedbTqlBoolean false true syntax match typedbTqlString /".*"/ syntax match typedbTqlString /'.*'/ syntax match typedbTqlLong /\v(\+|-)?[0-9]+/ +syntax match typedbTqlDouble /\v(\+|-)?[0-9]+\.[0-9]+/ " Default highlighting {{{1 highlight default link typedbTqlNativeType Identifier @@ -67,3 +68,4 @@ highlight default link typedbTqlBlockDelimiter Structure highlight default link typedbTqlBoolean Constant highlight default link typedbTqlString String highlight default link typedbTqlLong Number +highlight default link typedbTqlDouble Float From cb60226e1f17d4fe500ece2e9036ae3ed5cd0800 Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sun, 30 Oct 2022 00:43:47 +0100 Subject: [PATCH 31/42] Highlight Booleans as such, not as general constants --- syntax/typedb-tql.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index 28b6fe9..d90a669 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -65,7 +65,7 @@ highlight default link typedbTqlComment Comment highlight default link typedbTqlVar Identifier highlight default link typedbTqlBlockDelimiter Structure -highlight default link typedbTqlBoolean Constant +highlight default link typedbTqlBoolean Boolean highlight default link typedbTqlString String highlight default link typedbTqlLong Number highlight default link typedbTqlDouble Float From 4b9c4f0fbd3ca41a953d17b0c5badb2029f00659 Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sun, 30 Oct 2022 01:00:23 +0100 Subject: [PATCH 32/42] Add syntactic matching & highlighting for date & date-time literals --- syntax/typedb-tql.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index d90a669..5fa96c0 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -47,6 +47,8 @@ syntax match typedbTqlString /".*"/ syntax match typedbTqlString /'.*'/ syntax match typedbTqlLong /\v(\+|-)?[0-9]+/ syntax match typedbTqlDouble /\v(\+|-)?[0-9]+\.[0-9]+/ +syntax match typedbTqlDate /\v([0-9]{4}|(\+|-)[0-9]+)-[0-1][0-9]-[0-3][0-9]/ +syntax match typedbTqlDateTime /\v([0-9]{4}|(\+|-)[0-9]+)-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9](:[0-6][0-9](\.[0-9]{1,3})?)?/ " Default highlighting {{{1 highlight default link typedbTqlNativeType Identifier @@ -69,3 +71,5 @@ highlight default link typedbTqlBoolean Boolean highlight default link typedbTqlString String highlight default link typedbTqlLong Number highlight default link typedbTqlDouble Float +highlight default link typedbTqlDate Constant +highlight default link typedbTqlDateTime Constant From 284728d9aea054d9d8c097fc938e60ba4a86d1ea Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sun, 30 Oct 2022 01:09:23 +0100 Subject: [PATCH 33/42] Reorder syntax definition sections --- syntax/typedb-tql.vim | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index 5fa96c0..caff289 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -32,15 +32,6 @@ syntax keyword typedbTqlPredicate = != < <= > >= like contains syntax keyword typedbTqlTodo contained TODO FIXME XXX NOTE syntax match typedbTqlComment /#.*$/ contains=typedbTqlTodo -" Block {{{1 -syntax match typedbTqlVar /\$[a-zA-Z-_]\+/ contained -syntax match typedbTqlBlockDelimiter /[{}()]/ contained -syntax region typedbTqlBlock - \ start='{' - \ end='}' - \ contains=typedbTqlVar,typedbTqlThingVarConstraint,typedbTqlBlockDelimiter - \ fold transparent - " Literals {{{1 syntax keyword typedbTqlBoolean false true syntax match typedbTqlString /".*"/ @@ -50,6 +41,15 @@ syntax match typedbTqlDouble /\v(\+|-)?[0-9]+\.[0-9]+/ syntax match typedbTqlDate /\v([0-9]{4}|(\+|-)[0-9]+)-[0-1][0-9]-[0-3][0-9]/ syntax match typedbTqlDateTime /\v([0-9]{4}|(\+|-)[0-9]+)-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9](:[0-6][0-9](\.[0-9]{1,3})?)?/ +" Block {{{1 +syntax match typedbTqlVar /\$[a-zA-Z-_]\+/ contained +syntax match typedbTqlBlockDelimiter /[{}()]/ contained +syntax region typedbTqlBlock + \ start='{' + \ end='}' + \ contains=typedbTqlVar,typedbTqlThingVarConstraint,typedbTqlBlockDelimiter + \ fold transparent + " Default highlighting {{{1 highlight default link typedbTqlNativeType Identifier highlight default link typedbTqlDataType Type From bbfcca08cab138a26fcb8a7b1f85be4fcc3efec8 Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sun, 30 Oct 2022 01:10:11 +0100 Subject: [PATCH 34/42] Separate variable detection to separate section --- syntax/typedb-tql.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index caff289..ee4eba8 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -41,8 +41,10 @@ syntax match typedbTqlDouble /\v(\+|-)?[0-9]+\.[0-9]+/ syntax match typedbTqlDate /\v([0-9]{4}|(\+|-)[0-9]+)-[0-1][0-9]-[0-3][0-9]/ syntax match typedbTqlDateTime /\v([0-9]{4}|(\+|-)[0-9]+)-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9](:[0-6][0-9](\.[0-9]{1,3})?)?/ -" Block {{{1 +" Variables {{{1 syntax match typedbTqlVar /\$[a-zA-Z-_]\+/ contained + +" Blocks {{{1 syntax match typedbTqlBlockDelimiter /[{}()]/ contained syntax region typedbTqlBlock \ start='{' From 3d8f2c312cd8b1733dd0289a8d043faccf6ff34d Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sun, 30 Oct 2022 01:11:32 +0100 Subject: [PATCH 35/42] Add syntactic matching for anonymous variables --- syntax/typedb-tql.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index ee4eba8..1d893b7 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -42,6 +42,7 @@ syntax match typedbTqlDate /\v([0-9]{4}|(\+|-)[0-9]+)-[0-1][0-9]-[0-3][ syntax match typedbTqlDateTime /\v([0-9]{4}|(\+|-)[0-9]+)-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9](:[0-6][0-9](\.[0-9]{1,3})?)?/ " Variables {{{1 +syntax match typedbTqlVar /\$_/ syntax match typedbTqlVar /\$[a-zA-Z-_]\+/ contained " Blocks {{{1 From 9089cdcf8dc110e3cca4e4ea8c8ff7c43ecfe0cb Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sun, 30 Oct 2022 01:16:44 +0100 Subject: [PATCH 36/42] Update syntactic matching for named variables Update allowed regex. Remove containment modifier, for now. --- syntax/typedb-tql.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index 1d893b7..e054cc6 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -43,7 +43,7 @@ syntax match typedbTqlDateTime /\v([0-9]{4}|(\+|-)[0-9]+)-[0-1][0-9]-[0-3][ " Variables {{{1 syntax match typedbTqlVar /\$_/ -syntax match typedbTqlVar /\$[a-zA-Z-_]\+/ contained +syntax match typedbTqlVar /\$[a-zA-Z0-9][a-zA-Z0-9_-]*/ " Blocks {{{1 syntax match typedbTqlBlockDelimiter /[{}()]/ contained From c52f7d76ad97658187810759bc566f562f780abb Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sun, 30 Oct 2022 01:18:28 +0100 Subject: [PATCH 37/42] Use consistent alignmnt for highlighting section --- syntax/typedb-tql.vim | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index e054cc6..9798d5c 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -54,25 +54,25 @@ syntax region typedbTqlBlock \ fold transparent " Default highlighting {{{1 -highlight default link typedbTqlNativeType Identifier -highlight default link typedbTqlDataType Type +highlight default link typedbTqlNativeType Identifier +highlight default link typedbTqlDataType Type highlight default link typedbTqlTypeVarConstraint Statement highlight default link typedbTqlThingVarConstraint Operator -highlight default link typedbTqlQueryCmd Statement -highlight default link typedbTqlQueryModifier Statement -highlight default link typedbTqlAggregateCmd Statement -highlight default link typedbTqlOperator Operator -highlight default link typedbTqlPredicate Operator +highlight default link typedbTqlQueryCmd Statement +highlight default link typedbTqlQueryModifier Statement +highlight default link typedbTqlAggregateCmd Statement +highlight default link typedbTqlOperator Operator +highlight default link typedbTqlPredicate Operator -highlight default link typedbTqlTodo Todo -highlight default link typedbTqlComment Comment +highlight default link typedbTqlTodo Todo +highlight default link typedbTqlComment Comment -highlight default link typedbTqlVar Identifier -highlight default link typedbTqlBlockDelimiter Structure +highlight default link typedbTqlVar Identifier +highlight default link typedbTqlBlockDelimiter Structure -highlight default link typedbTqlBoolean Boolean -highlight default link typedbTqlString String -highlight default link typedbTqlLong Number -highlight default link typedbTqlDouble Float -highlight default link typedbTqlDate Constant -highlight default link typedbTqlDateTime Constant +highlight default link typedbTqlBoolean Boolean +highlight default link typedbTqlString String +highlight default link typedbTqlLong Number +highlight default link typedbTqlDouble Float +highlight default link typedbTqlDate Constant +highlight default link typedbTqlDateTime Constant From 3737281b774a5905719c3fed8e64d181d80b8f85 Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sun, 30 Oct 2022 01:28:15 +0100 Subject: [PATCH 38/42] Order values lexically per keyword group --- syntax/typedb-tql.vim | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index 9798d5c..64c1fd4 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -18,18 +18,18 @@ syntax case match setlocal iskeyword+=! " Keywords {{{1 -syntax keyword typedbTqlNativeType thing entity attribute relation role rule -syntax keyword typedbTqlDataType long double string boolean datetime -syntax keyword typedbTqlTypeVarConstraint abstract type sub sub! owns plays as regex when then relates @key +syntax keyword typedbTqlNativeType attribute entity relation role rule thing +syntax keyword typedbTqlDataType boolean datetime double long string +syntax keyword typedbTqlTypeVarConstraint abstract as @key owns plays regex relates sub sub! then type when syntax keyword typedbTqlThingVarConstraint has iid is isa isa! value -syntax keyword typedbTqlQueryCmd define undefine match get insert delete compute -syntax keyword typedbTqlQueryModifier offset limit sort asc desc -syntax keyword typedbTqlAggregateCmd group count min max mean median std sum -syntax keyword typedbTqlOperator or not -syntax keyword typedbTqlPredicate = != < <= > >= like contains +syntax keyword typedbTqlQueryCmd compute define delete get insert match undefine +syntax keyword typedbTqlQueryModifier asc desc limit offset sort +syntax keyword typedbTqlAggregateCmd count group max mean median min std sum +syntax keyword typedbTqlOperator not or +syntax keyword typedbTqlPredicate != < <= = > >= contains like " Comments {{{1 -syntax keyword typedbTqlTodo contained TODO FIXME XXX NOTE +syntax keyword typedbTqlTodo contained FIXME NOTE TODO XXX syntax match typedbTqlComment /#.*$/ contains=typedbTqlTodo " Literals {{{1 From 0aee33fe0d3569ba825fa6b9b4d00219ec8d2b41 Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sun, 30 Oct 2022 01:50:31 +0100 Subject: [PATCH 39/42] Use match for keyword that aliases a Vim syntax option --- syntax/typedb-tql.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index 64c1fd4..69bf09c 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -26,7 +26,8 @@ syntax keyword typedbTqlQueryCmd compute define delete get insert mat syntax keyword typedbTqlQueryModifier asc desc limit offset sort syntax keyword typedbTqlAggregateCmd count group max mean median min std sum syntax keyword typedbTqlOperator not or -syntax keyword typedbTqlPredicate != < <= = > >= contains like +syntax keyword typedbTqlPredicate != < <= = > >= like +syntax match typedbTqlPredicate /contains/ " Comments {{{1 syntax keyword typedbTqlTodo contained FIXME NOTE TODO XXX From 492177b4b4ea0dd9d5ae53498eca5db45b668b74 Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sun, 10 Dec 2023 16:54:50 +0000 Subject: [PATCH 40/42] Add TODO comments for syntax concerns --- syntax/typedb-tql.vim | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/syntax/typedb-tql.vim b/syntax/typedb-tql.vim index 69bf09c..2bb6aa5 100644 --- a/syntax/typedb-tql.vim +++ b/syntax/typedb-tql.vim @@ -7,6 +7,9 @@ " Based on the ANTLR grammar defined for TypeQL: " https://github.com/vaticle/typeql/blob/fd78c825e87058293290d4801834593823a329a8/grammar/TypeQL.g4 +" TODO - make sure to capture of all the below +" https://github.com/vaticle/typeql/blob/master/grammar/TypeQL.g4 + " Prelude {{{1 if exists("b:current_syntax") finish @@ -17,6 +20,12 @@ syntax case match setlocal iskeyword+=! +" INPUT TOKEN PATTERNS +" 0x[0-9a-f]+ +" (labels... again rules to apply) +" +" Add matches for various regions + " Keywords {{{1 syntax keyword typedbTqlNativeType attribute entity relation role rule thing syntax keyword typedbTqlDataType boolean datetime double long string From 52742ee19b7c2bc089037f53a9a8b3a3b7cfcb44 Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sun, 10 Dec 2023 16:56:16 +0000 Subject: [PATCH 41/42] Add placeholder indentation file --- indent/typedb-tql.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 indent/typedb-tql.vim diff --git a/indent/typedb-tql.vim b/indent/typedb-tql.vim new file mode 100644 index 0000000..98f974a --- /dev/null +++ b/indent/typedb-tql.vim @@ -0,0 +1,10 @@ +" Vim indent file +" Language: TypeQL for TypeDB +" Maintainer: agrski <20504869+agrski@users.noreply.github.com> +" Created: 2022 Oct 29 +" Last Change: 2022 Oct 29 + +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 From a6efec761608503e4dc35c146a99c035c10f3f4b Mon Sep 17 00:00:00 2001 From: Alex Rakowski <20504869+agrski@users.noreply.github.com> Date: Sun, 10 Dec 2023 16:56:44 +0000 Subject: [PATCH 42/42] Add notes on how to set up Vim indentation files --- indent/typedb-tql.vim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/indent/typedb-tql.vim b/indent/typedb-tql.vim index 98f974a..821db20 100644 --- a/indent/typedb-tql.vim +++ b/indent/typedb-tql.vim @@ -8,3 +8,8 @@ if exists("b:did_indent") finish endif let b:did_indent = 1 + +" https://psy.swansea.ac.uk/staff/carter/vim/vim_indent.htm +" +" define -> dedent to start of line +" , -> ensure indented to one level beyond last keyword = 1 indent