From 69ab0e19ed782cb28bc0972a75f787fd7cfa128d Mon Sep 17 00:00:00 2001 From: Julian Kuiyu CHANG Date: Thu, 12 Jul 2018 17:39:37 +0800 Subject: [PATCH 1/3] allowed numeric suffixes for csTopicName & csFunction --- syntax/ChatScript.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntax/ChatScript.vim b/syntax/ChatScript.vim index c05483c..d300b72 100644 --- a/syntax/ChatScript.vim +++ b/syntax/ChatScript.vim @@ -11,8 +11,8 @@ endif syntax match csWildcard '\*' -syntax match csTopicName '\v\~[a-z_\.A-Z]*' -syntax match csFunction '\v\^[a-z_\.A-Z]+' +syntax match csTopicName '\v\~[a-z_\.A-Z][_0-9a-zA-Z]*' +syntax match csFunction '\v\^[a-z_\.A-Z][_0-9a-zA-Z]*' " User permanent variables From 1f69b04f83461a863e1969873e59ea954d0c0762 Mon Sep 17 00:00:00 2001 From: Julian Kuiyu CHANG Date: Fri, 13 Jul 2018 10:43:05 +0800 Subject: [PATCH 2/3] added system variables, and made comments more dynamic --- syntax/ChatScript.vim | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/syntax/ChatScript.vim b/syntax/ChatScript.vim index d300b72..2d0bd60 100644 --- a/syntax/ChatScript.vim +++ b/syntax/ChatScript.vim @@ -14,6 +14,8 @@ syntax match csWildcard '\*' syntax match csTopicName '\v\~[a-z_\.A-Z][_0-9a-zA-Z]*' syntax match csFunction '\v\^[a-z_\.A-Z][_0-9a-zA-Z]*' +" System variables +syntax match csSystemVariable '\v\%[a-zA-Z][\._0-9a-zA-Z\[\]]*' " User permanent variables syntax match csPermanentVariable '\v\$[a-zA-Z][\._0-9a-zA-Z\[\]]*' @@ -30,12 +32,12 @@ syntax match csFactset '@\(\d*\|\*\)' " Boolean & state syntax match csBoolean '\v(null|true|false)' -" Assigment +" Assignment syntax match csOperator '\v(\?!|\+\=|-\=|\=|\%\=|\*\=|<<\=|>>\=|<<|>>|&\=|\^\=)' syntax match csOperator '\v(\'|!|\?|\=\=|and|or|AND|OR|>\=|<\=|!\=|>|<)' " Execution flow -syntax match csOperator '\v(\s*^if\s*|\s*if\s*|\s*else\s*|\s*^else\s*|\s*else if\s*|\s*^else if\s*|\s*loop\s*|\s*^loop\s*)' +syntax match csOperator '\v(\s*^if\s*|\s*if\s*|\s*else\s*|\s*^else\s*|\s*else if\s*|\s*^else if\s*|\s*loop\s+|\s*^loop\s+)' " Match variables syntax match csMatchVariable '\v_\d+' @@ -53,9 +55,13 @@ syntax match csBlockDelimiter '\v[{}]' syntax match csKeyword '\v(topic:|concept:|table:|tablemacro:|outputmacro:|patternmacro:|dualmacro:)' syntax match csKeyword '\v(bot:|data:|canon:|query:|plan:|describe:|replace:)' -syntax match csComment '\v^\s*#.*$' -syntax match csTestComment '\v^\s*#!.*$' +" baseline (working) +" syntax match csComment '\v^\s*#.*$' +" syntax match csTestComment '\v^\s*#!.*$' +" Works with halfway comments +syntax match csComment '#.*$' +syntax match csTestComment '#!.*$' syntax match csString '".*"' syntax match csString '\'.*\'' @@ -74,8 +80,8 @@ highlight csOperator ctermfg=215 highlight csSpecialChar ctermfg=12 highlight csFactset ctermfg=12 -highlight csComment ctermfg=8 -highlight csTestComment ctermfg=7 +highlight csComment ctermfg=11 +highlight csTestComment ctermfg=3 highlight csPatternDelimiter ctermfg=15 highlight csBracketsDelimiter ctermfg=7 @@ -83,14 +89,14 @@ highlight csBlockDelimiter ctermfg=215 " variables -highlight csSystemVariable ctermfg=15 +highlight csSystemVariable ctermfg=13 highlight csPermanentVariable ctermfg=10 highlight csMatchVariable ctermfg=123 highlight csWildcard ctermfg=123 highlight csLocalVariable ctermfg=35 -highlight csTransientVariable ctermfg=24 +highlight csTransientVariable ctermfg=34 -highlight csTopicName ctermfg=10 +highlight csTopicName ctermfg=62 highlight csFunction ctermfg=37 highlight csBoolean ctermfg=15 From 866f4a98acc65e7ff24c231a34a529883bd9ce10 Mon Sep 17 00:00:00 2001 From: Julian Kuiyu CHANG Date: Fri, 13 Jul 2018 12:28:48 +0800 Subject: [PATCH 3/3] added named constants csNameConstant in red --- syntax/ChatScript.vim | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/syntax/ChatScript.vim b/syntax/ChatScript.vim index 2d0bd60..c1314e9 100644 --- a/syntax/ChatScript.vim +++ b/syntax/ChatScript.vim @@ -14,16 +14,19 @@ syntax match csWildcard '\*' syntax match csTopicName '\v\~[a-z_\.A-Z][_0-9a-zA-Z]*' syntax match csFunction '\v\^[a-z_\.A-Z][_0-9a-zA-Z]*' +" Named Constant #DO_SUBSTITUTE_SYSTEM +syntax match csNamedConstant '#[a-zA-Z][\._0-9a-zA-Z]*' + " System variables syntax match csSystemVariable '\v\%[a-zA-Z][\._0-9a-zA-Z\[\]]*' -" User permanent variables +" User permanent variables (global) $name syntax match csPermanentVariable '\v\$[a-zA-Z][\._0-9a-zA-Z\[\]]*' -" User transient variables +" User transient variables (global) $$mood syntax match csTransientVariable '\v\$\$[a-zA-Z][\._0-9a-zA-Z\[\]]*' -" Local variables +" Local variables $_heartbeat syntax match csLocalVariable '\v\$_[a-zA-Z][\._0-9a-zA-Z\[\]]*' " Fact set @@ -55,13 +58,16 @@ syntax match csBlockDelimiter '\v[{}]' syntax match csKeyword '\v(topic:|concept:|table:|tablemacro:|outputmacro:|patternmacro:|dualmacro:)' syntax match csKeyword '\v(bot:|data:|canon:|query:|plan:|describe:|replace:)' -" baseline (working) +" baseline (original) " syntax match csComment '\v^\s*#.*$' " syntax match csTestComment '\v^\s*#!.*$' " Works with halfway comments -syntax match csComment '#.*$' -syntax match csTestComment '#!.*$' +syntax match csComment '#\s.*$' +syntax match csTestComment '#!\s.*$' + +" comment block ##<< junk multiple lines ##>> +syntax region csCommentBlock start='##<<.*$' end='##>>.*$' syntax match csString '".*"' syntax match csString '\'.*\'' @@ -82,6 +88,7 @@ highlight csFactset ctermfg=12 highlight csComment ctermfg=11 highlight csTestComment ctermfg=3 +highlight csCommentBlock ctermfg=3 highlight csPatternDelimiter ctermfg=15 highlight csBracketsDelimiter ctermfg=7 @@ -99,8 +106,8 @@ highlight csTransientVariable ctermfg=34 highlight csTopicName ctermfg=62 highlight csFunction ctermfg=37 -highlight csBoolean ctermfg=15 -highlight csConstant ctermfg=15 +highlight csBoolean ctermfg=9 +highlight csNamedConstant ctermfg=1 " strings highlight csString ctermfg=69