summaryrefslogtreecommitdiffstats
path: root/runtime/syntax/testdir
diff options
context:
space:
mode:
authorAliaksei Budavei <32549825+zzzyxwvut@users.noreply.github.com>2024-02-18 21:02:14 +0300
committerGitHub <noreply@github.com>2024-02-18 19:02:14 +0100
commitdfcef890cbdd3ec26de040b2e26d77444dc46862 (patch)
treecaa5628500d3122ec56454d30af27852900aa52b /runtime/syntax/testdir
parentc86bff1771ed9c340f8f4433ae5530fd6de97980 (diff)
runtime(vim): Distinguish Vim9 constructor definitions from the :new ex command (#14050)
With the arrival of Vim9 classes, the syntax must allow for _new_ constructors; multiple constructor definitions are supported for a class, provided distinct suffix-names are used. Currently, the defined constructors match either vimCommand or vimFunctionError (for any newBar). For example: ------------------------------------------------------------ vim9script class Foo def new() enddef def newBar() enddef endclass ------------------------------------------------------------ Since every constructor is required to bear a lower-cased _new_ prefix name, it should suffice to distinguish them from functions, and so there are no new highlight or syntax groups introduced. Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com> Signed-off-by: h-east <h.east.727@gmail.com> Signed-off-by: Doug Kearns <dougkearns@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'runtime/syntax/testdir')
-rw-r--r--runtime/syntax/testdir/dumps/vim_new_00.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim_new_99.dump20
-rw-r--r--runtime/syntax/testdir/input/vim_new.vim17
3 files changed, 57 insertions, 0 deletions
diff --git a/runtime/syntax/testdir/dumps/vim_new_00.dump b/runtime/syntax/testdir/dumps/vim_new_00.dump
new file mode 100644
index 0000000000..6306faefad
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_new_00.dump
@@ -0,0 +1,20 @@
+>v+0#af5f00255#ffffff0|i|m|9|s|c|r|i|p|t| +0#0000000&@64
+@75
+|#+0#0000e05&| |V|i|m| |:|n|e|w| |c|o|m@1|a|n|d| |a|n|d| |c|l|a|s@1| |c|o|n|s|t|r|u|c|t|o|r|s|.| +0#0000000&@32
+|c+0#af5f00255&|l|a|s@1| +0#0000000&|T|e|s|t| @64
+@8|d+0#af5f00255&|e|f| +0#0000000&|n|e|w|(+0#e000e06&|)| +0#0000000&@57
+@8|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@60
+@8|d+0#af5f00255&|e|f| +0#0000000&|n|e|w|O|t|h|e|r|(+0#e000e06&|)| +0#0000000&@52
+@8|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@60
+@8|d+0#af5f00255&|e|f| +0#0000000&|n|e|w|y|e|t|a|n|o|t|h|e|r|(+0#e000e06&|)| +0#0000000&@47
+@8|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@60
+|e+0#af5f00255&|n|d|c|l|a|s@1| +0#0000000&@66
+@75
+|T|e|s|t|.+0#af5f00255&|n+0#0000000&|e|w|(+0#e000e06&|)| +0#0000000&@64
+|T|e|s|t|.+0#af5f00255&|n+0#0000000&|e|w|O|t|h|e|r|(+0#e000e06&|)| +0#0000000&@59
+|T|e|s|t|.+0#af5f00255&|n+0#0000000&|e|w|y|e|t|a|n|o|t|h|e|r|(+0#e000e06&|)| +0#0000000&@54
+|n+0#af5f00255&|e|w| +0#0000000&@71
+|q+0#af5f00255&|u|i|t| +0#0000000&@70
+|~+0#4040ff13&| @73
+|~| @73
+|"+0#0000000&|i|n|p|u|t|/|v|i|m|_|n|e|w|.|v|i|m|"| |1|7|L|,| |2|0|5|B| @27|1|,|1| @10|A|l@1|
diff --git a/runtime/syntax/testdir/dumps/vim_new_99.dump b/runtime/syntax/testdir/dumps/vim_new_99.dump
new file mode 100644
index 0000000000..50a54f2807
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_new_99.dump
@@ -0,0 +1,20 @@
+|v+0#af5f00255#ffffff0|i|m|9|s|c|r|i|p|t| +0#0000000&@64
+@75
+|#+0#0000e05&| |V|i|m| |:|n|e|w| |c|o|m@1|a|n|d| |a|n|d| |c|l|a|s@1| |c|o|n|s|t|r|u|c|t|o|r|s|.| +0#0000000&@32
+|c+0#af5f00255&|l|a|s@1| +0#0000000&|T|e|s|t| @64
+@8|d+0#af5f00255&|e|f| +0#0000000&|n|e|w|(+0#e000e06&|)| +0#0000000&@57
+@8|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@60
+@8|d+0#af5f00255&|e|f| +0#0000000&|n|e|w|O|t|h|e|r|(+0#e000e06&|)| +0#0000000&@52
+@8|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@60
+@8|d+0#af5f00255&|e|f| +0#0000000&|n|e|w|y|e|t|a|n|o|t|h|e|r|(+0#e000e06&|)| +0#0000000&@47
+@8|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@60
+|e+0#af5f00255&|n|d|c|l|a|s@1| +0#0000000&@66
+@75
+|T|e|s|t|.+0#af5f00255&|n+0#0000000&|e|w|(+0#e000e06&|)| +0#0000000&@64
+|T|e|s|t|.+0#af5f00255&|n+0#0000000&|e|w|O|t|h|e|r|(+0#e000e06&|)| +0#0000000&@59
+|T|e|s|t|.+0#af5f00255&|n+0#0000000&|e|w|y|e|t|a|n|o|t|h|e|r|(+0#e000e06&|)| +0#0000000&@54
+|n+0#af5f00255&|e|w| +0#0000000&@71
+>q+0#af5f00255&|u|i|t| +0#0000000&@70
+|~+0#4040ff13&| @73
+|~| @73
+|"+0#0000000&|i|n|p|u|t|/|v|i|m|_|n|e|w|.|v|i|m|"| |1|7|L|,| |2|0|5|B| @27|1|7|,|1| @9|A|l@1|
diff --git a/runtime/syntax/testdir/input/vim_new.vim b/runtime/syntax/testdir/input/vim_new.vim
new file mode 100644
index 0000000000..985cfd3c11
--- /dev/null
+++ b/runtime/syntax/testdir/input/vim_new.vim
@@ -0,0 +1,17 @@
+vim9script
+
+# Vim :new command and class constructors.
+class Test
+ def new()
+ enddef
+ def newOther()
+ enddef
+ def newyetanother()
+ enddef
+endclass
+
+Test.new()
+Test.newOther()
+Test.newyetanother()
+new
+quit