From cccb21df3b4c6fe0aaa99743c418aa973aeebad0 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 04:10:59 +0200 Subject: Merging upstream version 2:9.1.0374. Signed-off-by: Daniel Baumann --- runtime/syntax/testdir/input/java_comments.java | 85 ++++++++++++-- .../testdir/input/java_contextual_keywords.java | 48 ++++++++ .../syntax/testdir/input/java_methods_indent.java | 70 ++++++++++++ .../syntax/testdir/input/java_methods_style.java | 66 +++++++++++ runtime/syntax/testdir/input/vim9_keymap.vim | 26 +++++ .../syntax/testdir/input/vim9_legacy_header.vim | 16 +++ .../testdir/input/vim9_legacy_header_fold.vim | 17 +++ runtime/syntax/testdir/input/vim_ex_commands.vim | 4 +- .../syntax/testdir/input/vim_ex_comment-vim9.vim | 41 +++++++ runtime/syntax/testdir/input/vim_ex_comment.vim | 45 ++++++++ runtime/syntax/testdir/input/vim_ex_def.vim | 18 +-- runtime/syntax/testdir/input/vim_ex_def_fold.vim | 38 +++--- runtime/syntax/testdir/input/vim_ex_def_nested.vim | 20 ++++ .../testdir/input/vim_ex_def_nested_fold.vim | 22 ++++ .../syntax/testdir/input/vim_ex_function_fold.vim | 40 +++++++ .../testdir/input/vim_ex_function_nested.vim | 38 ++++++ .../testdir/input/vim_ex_function_nested_fold.vim | 40 +++++++ runtime/syntax/testdir/input/vim_expr.vim | 15 +-- runtime/syntax/testdir/input/vim_keymap.vim | 3 +- .../syntax/testdir/input/vim_object_methods.vim | 56 +++++++++ runtime/syntax/testdir/input/yaml.yaml | 127 +++++++++++++++++++++ 21 files changed, 781 insertions(+), 54 deletions(-) create mode 100644 runtime/syntax/testdir/input/java_contextual_keywords.java create mode 100644 runtime/syntax/testdir/input/java_methods_indent.java create mode 100644 runtime/syntax/testdir/input/java_methods_style.java create mode 100644 runtime/syntax/testdir/input/vim9_keymap.vim create mode 100644 runtime/syntax/testdir/input/vim9_legacy_header.vim create mode 100644 runtime/syntax/testdir/input/vim9_legacy_header_fold.vim create mode 100644 runtime/syntax/testdir/input/vim_ex_comment-vim9.vim create mode 100644 runtime/syntax/testdir/input/vim_ex_comment.vim create mode 100644 runtime/syntax/testdir/input/vim_ex_def_nested.vim create mode 100644 runtime/syntax/testdir/input/vim_ex_def_nested_fold.vim create mode 100644 runtime/syntax/testdir/input/vim_ex_function_nested.vim create mode 100644 runtime/syntax/testdir/input/vim_ex_function_nested_fold.vim create mode 100644 runtime/syntax/testdir/input/vim_object_methods.vim create mode 100644 runtime/syntax/testdir/input/yaml.yaml (limited to 'runtime/syntax/testdir/input') diff --git a/runtime/syntax/testdir/input/java_comments.java b/runtime/syntax/testdir/input/java_comments.java index be347d7..3c1a8a2 100644 --- a/runtime/syntax/testdir/input/java_comments.java +++ b/runtime/syntax/testdir/input/java_comments.java @@ -1,11 +1,68 @@ -// VIM_TEST_SETUP unlet! g:java_ignore_javadoc g:java_no_trail_space_error -// VIM_TEST_SETUP unlet! g:java_no_tab_space_error +// VIM_TEST_SETUP unlet! g:java_ignore_javadoc g:java_no_trail_space_error +// VIM_TEST_SETUP unlet! g:java_no_tab_space_error // VIM_TEST_SETUP let [g:java_space_errors,g:java_comment_strings] = [1,1] -// VIM_TEST_SETUP setlocal spell +// VIM_TEST_SETUP setlocal spell | highlight link javaCommentStart Todo + + + + +/**/ /*/ */ /* /*/ /*/*/ /*//*/ /** Comment tests. + *

There is no entry point method {@code main}: + * {@snippet file = Snippets.java region = main id = _01} + *

There is no textual representation: + * {@snippet class = Snippets region = toString id = _02} */ class CommentsTests -{ /* TRAILING BLANKS AND MESSPILLINGS ARE SIGNIFICANT! */ - /** - * The method {@code main} must be declared {@code public}, {@code +{ + /** No-op, i. e. no operation. + * ({@literal@literal} may be used with {@code .} for contraction.) + * @return {@code null} */ + Void noOp1() { return null; } + + /** No-op, i.e. no operation. + * ({@literal} may be used after {@code .} for contraction.) + * @return {@code null} */ + Void noOp2() { return null; } + + /** No-op, i.e\u002e no operation. + * ({@literal\u005cu002e} is processed early, use alternatives.) + * @return {@code null} */ + Void noOp3() { return null; } + + /** No-op, i.e{@literal .} no operation. + * @return {@code null} */ + Void noOp4() { return null; } + + /** No-op, i.e. no operation. + * @return {@code null} */ + Void noOp5() { return null; } + + /** No-op, i.e. no operation. + * @return {@code null} */ + Void noOp6() { return null; } + + /** {@return {@code null}, with no-op, i.e. no operation} */ + Void noOp7() { return null; } + + /** {@return {@code null}, with no-op, i.e. no operation}.. */ + Void noOp8() { return null; } + + /** {@return {@code null}, with no-op, i.e. no operation} . . */ + Void noOp9() { return null; } + + /** Returns an empty string for an @Override annotated method + * (see Chapter 9.6.4.4 {@literal @Override} in a Java Language + * Specification) overridden from java.lang.Object + * + * @return an empty string */// No period for the above summary! + @Override public String toString() { return ""; } +} + +// javadoc --snippet-path . --source-path . -d /tmp/doc/ -package \ +// -tag 'jls:a:See Java Language Specification:' Snippets.java +/** Snippets for comment tests. */ +class Snippets +{ /* TRAILING BLANKS AND MESSPILLINGS ARE SIGNIFICANT! */ + /** The method {@code main} must be declared {@code public}, {@code * static}, and {@code void}. It must specify a formal parameter * whose declared type is array of {@link String}. Therefore, * either of the following declarations is acceptable: @@ -16,10 +73,18 @@ class CommentsTests *{@code public static void main(String... args) { }} * * @param args optional commande-line arguments - * @jls 12.1.4 Invoke {@code Test.main} - */ - // @start region = main + * @jls 12.1.4 Invoke {@code Test.main} */ + // @start region = main // @link substring = 'String' target = 'java.lang.String' : public static void main(String[] args) { } - // @end + // @end + + /** {@return an empty string} + * @see 3.10.5 String Literals + * @see Object#toString() */ + // @start region = toString + // @replace substring = '""' replacement = "\u0022\u0022" + // @link regex = '\bString' target = java.lang.String type = linkplain : + @Override public String toString() { return ""; } + // @end } diff --git a/runtime/syntax/testdir/input/java_contextual_keywords.java b/runtime/syntax/testdir/input/java_contextual_keywords.java new file mode 100644 index 0000000..0940379 --- /dev/null +++ b/runtime/syntax/testdir/input/java_contextual_keywords.java @@ -0,0 +1,48 @@ +class ContextualKeywordsTests // See JLS, §3.9 Keywords. +{ + private ContextualKeywordsTests() { throw new Error(); } + + // ModuleDeclaration: module open. + void module() { Object module = null; when(); } + void open() { Object open = null; module(); } + // ModuleDirective: exports opens provides requires to uses with. + void exports() { Object exports = null; open(); } + void opens() { Object opens = null; exports(); } + void provides() { Object provides = null; opens(); } + void requires() { Object requires = null; provides(); } + void to() { Object to = null; requires(); } + void uses() { Object uses = null; to(); } + void with() { Object with = null; uses(); } + // RequiresModifier: transitive. + void transitive() { Object transitive = null; with(); } + // LocalVariableType | LambdaParameterType: var. + void var() { var var = new Object(); transitive(); } + // YieldStatement: yield (see java_switch.java). + void yield() { Object yield = null; var(); } + // RecordDeclaration: record. + void record() { Object record = null; this.yield(); } + // Normal{Class,Interface}Declaration: non-sealed permits sealed. + void permits() { Object permits = null; record(); } + void sealed() { Object sealed = null; permits(); } + // Guard: when (see java_switch.java). + void when() { Object when = null; sealed(); } + + sealed interface I1 permits C1, I3 { } + sealed interface I2 permits C1, I3 { } + non-sealed interface I3 extends I1, I2 { } + interface I4 extends I3 { } + + abstract sealed class C1 implements I1, I2 permits C2, C3 { } + abstract non-sealed class C2 extends C1 { } + final class C3 extends C1 implements I3 { } + class C4 extends C2 { } + + record R() implements I3 { } + enum E implements I3 { INSTANCE } + + static I i1() { return (var var) -> var; } + static I i2() { return (T var) -> var; } + static I i3() { return (var) -> var; } + static I i4() { return var -> var; } + interface I { T i(T i); default I self() { return this; } } +} diff --git a/runtime/syntax/testdir/input/java_methods_indent.java b/runtime/syntax/testdir/input/java_methods_indent.java new file mode 100644 index 0000000..627eb8b --- /dev/null +++ b/runtime/syntax/testdir/input/java_methods_indent.java @@ -0,0 +1,70 @@ +// VIM_TEST_SETUP let g:java_highlight_functions = 'indent' + + +import java.lang.annotation.Target; + +abstract class IndentMethodsTests +{ // DO NOT retab! THIS FILE; REMEMBER ABOUT testdir/ftplugin. + protected IndentMethodsTests() { } + + record Τʬ<α>(α a) { } + + enum 𝓔 + { + A("𝕬"), B("𝕭"), C("𝕮"), D("𝕯"), + E("𝕰"), F("𝕱"), G("𝕲"), H("𝕳"); + final String 𝐬; + private 𝓔(String 𝐬) { this.𝐬 = 𝐬; } + } + + @Target(java.lang.annotation.ElementType.METHOD) + @java.lang.annotation.Repeatable(Tɐggablɘs.class) + @interface Tɐggablɘ + { + String[] value() default ""; + } + + @Target(java.lang.annotation.ElementType.METHOD) + @interface Tɐggablɘs + { + Tɐggablɘ[] value(); + } + + interface Stylable<Α> + { + default void ascii$0_() { } + default Α μʭʭ$0_() { return null; } + } + + @Tɐggablɘ @Tɐggablɘ + abstract void ascii$0_(); + + @Tɐggablɘ @Tɐggablɘ + abstract <α, β> Τʬ<α> μʭʭ$0_(β 𝛽); + + @Tɐggablɘ + private native void ascii$1_(); + + @Tɐggablɘ + private native <α, β> Τʬ<α>[] μʭʭ$1_( + java.util.function.Function<β, Τʬ<α>[]> ƒ); + + static final native synchronized void ascii$98_(); + static final native synchronized <α, β> Τʬ<α>[][] μʭʭ$98_( + java.util.function.Function<β, Τʬ<α>[][]> ƒ); + + @SuppressWarnings("strictfp") + protected static final synchronized strictfp void ascii$99_() + { ascii$98_(); } + + @SuppressWarnings("strictfp") + protected static final synchronized strictfp <α, β> Τʬ<α>[] μʭʭ$99_( + java.util.function.Function<β, Τʬ<α>[][]> ƒ) + { + return + IndentMethodsTests.<α, β>μʭʭ$98_(ƒ)[0]; + } + + @Override @SuppressWarnings("cast") + public String toString() { return (String) "IndentMethodsTests"; } +} diff --git a/runtime/syntax/testdir/input/java_methods_style.java b/runtime/syntax/testdir/input/java_methods_style.java new file mode 100644 index 0000000..b3e36fb --- /dev/null +++ b/runtime/syntax/testdir/input/java_methods_style.java @@ -0,0 +1,66 @@ +// VIM_TEST_SETUP let g:java_highlight_functions = 'style' + + +import java.lang.annotation.Target; + +abstract class StyleMethodsTests +{ + protected StyleMethodsTests() { } + + record Τʬ<α>(α a) { } + + enum 𝓔 + { + A("𝕬"), B("𝕭"), C("𝕮"), D("𝕯"), + E("𝕰"), F("𝕱"), G("𝕲"), H("𝕳"); + final String 𝐬; + private 𝓔(String 𝐬) { this.𝐬 = 𝐬; } + } + + @Target(java.lang.annotation.ElementType.METHOD) + @java.lang.annotation.Repeatable(Tɐggablɘs.class) + @interface Tɐggablɘ + { + String[] value() default ""; + } + + @Target(java.lang.annotation.ElementType.METHOD) + @interface Tɐggablɘs + { + Tɐggablɘ[] value(); + } + + interface Stylable<Α> + { + default void ascii$0_() { } + default Α μʭʭ$0_() { return null; } + } + + @Tɐggablɘ @Tɐggablɘ abstract void ascii$0_(//////////////// + ); + @Tɐggablɘ @Tɐggablɘ abstract <α, β> Τʬ<α> μʭʭ$0_( + /* TODO: @SuppressWarnings("bespoke")*/ β 𝛽); + + @Tɐggablɘ private native void ascii$1_(/*////////////*/); + @Tɐggablɘ private native <α, β> Τʬ<α>[] μʭʭ$1_( + java.util.function.Function<β, Τʬ<α>[]> ƒ); + + static final native synchronized void ascii$98_(); + static final native synchronized <α, β> Τʬ<α>[][] μʭʭ$98_( + java.util.function.Function<β, Τʬ<α>[][]> ƒ); + + @SuppressWarnings("strictfp") + protected static final synchronized strictfp void ascii$99_() + { ascii$98_(); } + + @SuppressWarnings("strictfp") + protected static final synchronized strictfp <α, β> Τʬ<α>[] μʭʭ$99_( + java.util.function.Function<β, Τʬ<α>[][]> ƒ) + { + return + StyleMethodsTests.<α, β>μʭʭ$98_(ƒ)[0]; + } + + @Override @SuppressWarnings("cast") + public String toString() { return (String) "StyleMethodsTests"; } +} diff --git a/runtime/syntax/testdir/input/vim9_keymap.vim b/runtime/syntax/testdir/input/vim9_keymap.vim new file mode 100644 index 0000000..a69b723 --- /dev/null +++ b/runtime/syntax/testdir/input/vim9_keymap.vim @@ -0,0 +1,26 @@ +vim9script + +# Vim Keymap file for syntax testing + +scriptencoding utf-8 + +let b:keymap_name = "syntax-test" + +loadkeymap + +# Line comment + + # Another line comment + +a A Basic mapping +'a á More than one char in first column + +# Special notation + B Special notation allowed in LHS - decimal +c Special notation allowed in RHS - octal + Special notation allowed in LHS and RHS - hexadecimal + +# Vim-script comment characters +\# Line should not match as a Vim9-script comment +" “ Line should not match as a legacy-script comment +: # Line should not match as a Vim9-script comment diff --git a/runtime/syntax/testdir/input/vim9_legacy_header.vim b/runtime/syntax/testdir/input/vim9_legacy_header.vim new file mode 100644 index 0000000..66aeb39 --- /dev/null +++ b/runtime/syntax/testdir/input/vim9_legacy_header.vim @@ -0,0 +1,16 @@ +" comment + +if !has('vim9script') + # 42 " comment + source foo.vim + finish +endif + +" comment + +vim9script noclear + +# comment + + # string only recognised with leading char + "useless string" diff --git a/runtime/syntax/testdir/input/vim9_legacy_header_fold.vim b/runtime/syntax/testdir/input/vim9_legacy_header_fold.vim new file mode 100644 index 0000000..6e0e71e --- /dev/null +++ b/runtime/syntax/testdir/input/vim9_legacy_header_fold.vim @@ -0,0 +1,17 @@ +" VIM_TEST_SETUP let g:vimsyn_folding = "H" | set fdm=syntax +" comment + +if !has('vim9script') + # 42 " comment + source foo.vim + finish +endif + +" comment + +vim9script noclear + +# comment + + # string only recognised with leading char + "useless string" diff --git a/runtime/syntax/testdir/input/vim_ex_commands.vim b/runtime/syntax/testdir/input/vim_ex_commands.vim index 571fd7b..aaa351b 100644 --- a/runtime/syntax/testdir/input/vim_ex_commands.vim +++ b/runtime/syntax/testdir/input/vim_ex_commands.vim @@ -558,7 +558,7 @@ :verbose :vertical :vim9cmd -:vim9script +" :vim9script :vimgrep :vimgrepadd :visual @@ -1152,7 +1152,7 @@ call Foo() | version call Foo() | verbose call Foo() | vertical call Foo() | vim9cmd -call Foo() | vim9script +" call Foo() | vim9script call Foo() | vimgrep call Foo() | vimgrepadd call Foo() | visual diff --git a/runtime/syntax/testdir/input/vim_ex_comment-vim9.vim b/runtime/syntax/testdir/input/vim_ex_comment-vim9.vim new file mode 100644 index 0000000..786d11b --- /dev/null +++ b/runtime/syntax/testdir/input/vim_ex_comment-vim9.vim @@ -0,0 +1,41 @@ +vim9script + +# Vim comments + +# Vim9-script comment + + # string only recognised with leading char + "useless string" + +function! Foo() + " Legacy-script comment + # 42 " comment +endfunction + +def! Bar() + # Vim9-script comment + "useless string" # comment +enddef + +command -count FooCommand { + # Vim9-script comment + "useless string" # comment +} + +autocmd BufNewFile * { + # Vim9-script comment + "useless string" # comment +} + + +# Issue: #13047 + +if !exists(":DiffOrig") + command DiffOrig vert new | set bt=nofile | r ++edit %% | 0d_ | diffthis + \ | wincmd p | diffthis +endif + + +# Issue: #11307 and #11560 + +# This is what we call " blah diff --git a/runtime/syntax/testdir/input/vim_ex_comment.vim b/runtime/syntax/testdir/input/vim_ex_comment.vim new file mode 100644 index 0000000..54e514e --- /dev/null +++ b/runtime/syntax/testdir/input/vim_ex_comment.vim @@ -0,0 +1,45 @@ +" Vim comments + +" Legacy-script comment + +# 42 " comment + +function! Foo() + " Legacy-script comment + # 42 " comment +endfunction + +def! Bar() + # Vim9-script comment + "useless string" # comment +enddef + +command -nargs=1 FooCommand { + # Vim9-script comment + "useless string" # comment +} + +autocmd BufNewFile * { + # Vim9-script comment + "useless string" # comment +} + + +" Issue: #13047 + +if !exists(":DiffOrig") + command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis + \ | wincmd p | diffthis +endif + + +" Issue: #11307 and #11560 + +" This is what we call " blah + + +" Issue # #9587 + +def CommentTitle() + # Title: ... +enddef diff --git a/runtime/syntax/testdir/input/vim_ex_def.vim b/runtime/syntax/testdir/input/vim_ex_def.vim index dd4ecd1..2685ba5 100644 --- a/runtime/syntax/testdir/input/vim_ex_def.vim +++ b/runtime/syntax/testdir/input/vim_ex_def.vim @@ -19,27 +19,11 @@ def Foo " comment def Foo() enddef -# curly-brace names -def {"F"}oo() -enddef - -def F{"o"}o() -enddef - -def Fo{"o"}() -enddef - -def {"F"}o{"o"}() -enddef - -def {"F"}{"o"}{"o"}() -enddef - def Foo(): number return 42 enddef -# trailing whitespace +" trailing whitespace def Foo(): number return 42 enddef diff --git a/runtime/syntax/testdir/input/vim_ex_def_fold.vim b/runtime/syntax/testdir/input/vim_ex_def_fold.vim index 7ab3e3f..3326075 100644 --- a/runtime/syntax/testdir/input/vim_ex_def_fold.vim +++ b/runtime/syntax/testdir/input/vim_ex_def_fold.vim @@ -20,27 +20,11 @@ def Foo " comment def Foo() enddef -# curly-brace names -def {"F"}oo() -enddef - -def F{"o"}o() -enddef - -def Fo{"o"}() -enddef - -def {"F"}o{"o"}() -enddef - -def {"F"}{"o"}{"o"}() -enddef - def Foo(): number return 42 enddef -# trailing whitespace +" trailing whitespace def Foo(): number return 42 enddef @@ -124,3 +108,23 @@ def Foo() "useless string" enddef + +" fold-region ending + +def Foo() + # enddef +enddef + +def Foo() + echo "enddef" +enddef + +def Foo() + let x =<< END + endfunction + END +enddef + +:def Foo() +:enddef + diff --git a/runtime/syntax/testdir/input/vim_ex_def_nested.vim b/runtime/syntax/testdir/input/vim_ex_def_nested.vim new file mode 100644 index 0000000..008c415 --- /dev/null +++ b/runtime/syntax/testdir/input/vim_ex_def_nested.vim @@ -0,0 +1,20 @@ +vim9script +# Vim9 :def command (nested) + +class Test + const name: string + + def new() + def Name(): string + function GiveName() + return "any" + endfunction + + return GiveName() + enddef + + this.name = Name() + enddef +endclass + +echo Test.new() diff --git a/runtime/syntax/testdir/input/vim_ex_def_nested_fold.vim b/runtime/syntax/testdir/input/vim_ex_def_nested_fold.vim new file mode 100644 index 0000000..601f553 --- /dev/null +++ b/runtime/syntax/testdir/input/vim_ex_def_nested_fold.vim @@ -0,0 +1,22 @@ +vim9script +# Vim9 :def command (nested) +# VIM_TEST_SETUP let g:vimsyn_folding = 'f' +# VIM_TEST_SETUP setl fdc=2 fdm=syntax + +class Test + const name: string + + def new() + def Name(): string + function GiveName() + return "any" + endfunction + + return GiveName() + enddef + + this.name = Name() + enddef +endclass + +echo Test.new() diff --git a/runtime/syntax/testdir/input/vim_ex_function_fold.vim b/runtime/syntax/testdir/input/vim_ex_function_fold.vim index f9d9bee..dd260ca 100644 --- a/runtime/syntax/testdir/input/vim_ex_function_fold.vim +++ b/runtime/syntax/testdir/input/vim_ex_function_fold.vim @@ -181,3 +181,43 @@ delfunction foo.bar delfunction! Foo delfunction foo.bar + +" fold-region ending + +function Foo() + " endfunction +endfunction + +function Foo() + echo "endfunction" +endfunction + +function Foo() + let x =<< END + endfunction + END + +endfunction + +function Foo() + append + endfunction +. +endfunction + +function Foo() + change + endfunction +. + +endfunction + +function Foo() + insert + endfunction +. +endfunction + +:function Foo() +:endfunction + diff --git a/runtime/syntax/testdir/input/vim_ex_function_nested.vim b/runtime/syntax/testdir/input/vim_ex_function_nested.vim new file mode 100644 index 0000000..749b572 --- /dev/null +++ b/runtime/syntax/testdir/input/vim_ex_function_nested.vim @@ -0,0 +1,38 @@ +" Vim :def and :function commands (nested) + +def FunA(): string + def DoFunA(): string + return "." + enddef + + return DoFunA() +enddef + +def FunB(): string + function DoFunB() + return ".." + endfunction + + return DoFunB() +enddef + +function FunC() + def DoFunC(): string + return "..." + enddef + + return DoFunC() +endfunction + +function FunD() + function DoFunD() + return "...." + endfunction + + return DoFunD() +endfunction + +echo FunA() +echo FunB() +echo FunC() +echo FunD() diff --git a/runtime/syntax/testdir/input/vim_ex_function_nested_fold.vim b/runtime/syntax/testdir/input/vim_ex_function_nested_fold.vim new file mode 100644 index 0000000..d966ef3 --- /dev/null +++ b/runtime/syntax/testdir/input/vim_ex_function_nested_fold.vim @@ -0,0 +1,40 @@ +" Vim :def and :function commands (nested) +" VIM_TEST_SETUP let g:vimsyn_folding = 'f' +" VIM_TEST_SETUP setl fdc=2 fdm=syntax + +def FunA(): string + def DoFunA(): string + return "." + enddef + + return DoFunA() +enddef + +def FunB(): string + function DoFunB() + return ".." + endfunction + + return DoFunB() +enddef + +function FunC() + def DoFunC(): string + return "..." + enddef + + return DoFunC() +endfunction + +function FunD() + function DoFunD() + return "...." + endfunction + + return DoFunD() +endfunction + +echo FunA() +echo FunB() +echo FunC() +echo FunD() diff --git a/runtime/syntax/testdir/input/vim_expr.vim b/runtime/syntax/testdir/input/vim_expr.vim index cf5838c..610c2be 100644 --- a/runtime/syntax/testdir/input/vim_expr.vim +++ b/runtime/syntax/testdir/input/vim_expr.vim @@ -57,15 +57,16 @@ echo -0b11111111 echo -0B11111111 " Float -123.456 -+0.0001 -55.0 --0.123 -1.234e03 -1.0E-6 --3.1416e+88 +echo 123.456 +echo +0.0001 +echo 55.0 +echo -0.123 +echo 1.234e03 +echo 1.0E-6 +echo -3.1416e+88 " Blob +echo 0z echo 0zFF00ED015DAF echo 0zFF00.ED01.5DAF echo 0zFF.00.ED.01.5D.AF diff --git a/runtime/syntax/testdir/input/vim_keymap.vim b/runtime/syntax/testdir/input/vim_keymap.vim index 983c822..424d437 100644 --- a/runtime/syntax/testdir/input/vim_keymap.vim +++ b/runtime/syntax/testdir/input/vim_keymap.vim @@ -23,4 +23,5 @@ c Special notation allowed in RHS - octal " Vim-script comment characters # Line should not match as a Vim9-script comment -\" “ Line should not match as a legacy-script comment +\" “ Line should not match as a legacy-script comment +: " Line should not match as a legacy-script comment diff --git a/runtime/syntax/testdir/input/vim_object_methods.vim b/runtime/syntax/testdir/input/vim_object_methods.vim new file mode 100644 index 0000000..d22c7f2 --- /dev/null +++ b/runtime/syntax/testdir/input/vim_object_methods.vim @@ -0,0 +1,56 @@ +vim9script +# VIM_TEST_SETUP hi link vimMethodName Todo + + +# Vim |builtin-object-methods| and namesake builtin functions. +class PairClassTest + public const a: any + public const b: any + + def new(a: any, b: any) + this.a = a + this.b = b + enddef + + def empty(): bool + return false + enddef + def len(): number + return 2 + enddef + def string(): string + return printf('(%s, %s)', this.a, this.b) + enddef +endclass + +enum MarkerEnumTest + INSTANCE + + def NoOp() + enddef + + def empty(): bool + return true + enddef + def len(): number + return 0 + enddef + def string(): string + return this.name + enddef +endenum + +const b1: bool = empty(MarkerEnumTest.INSTANCE) +const n1: number = len(MarkerEnumTest.INSTANCE) +const s1: string = string(MarkerEnumTest.INSTANCE) +echo b1 && MarkerEnumTest.INSTANCE.empty() +echo n1 == 0 && MarkerEnumTest.INSTANCE.len() == 0 +echo s1 == 'INSTANCE' && MarkerEnumTest.INSTANCE.string() == 'INSTANCE' + +const pair: PairClassTest = PairClassTest.new(0, 1) +const b2: bool = !pair.empty() +const n2: number = pair.len() +const s2: string = pair.string() +echo b2 && !empty(pair) +echo n2 == 2 && len(pair) == 2 +echo s2 == '(0, 1)' && string(pair) == '(0, 1)' diff --git a/runtime/syntax/testdir/input/yaml.yaml b/runtime/syntax/testdir/input/yaml.yaml new file mode 100644 index 0000000..d87aca2 --- /dev/null +++ b/runtime/syntax/testdir/input/yaml.yaml @@ -0,0 +1,127 @@ +%YAML 1.2 +%TAG ! tag:yaml.org,2002: # primary tag handle +%TAG !! tag:yaml.org,2002: # secondary tag handle +%TAG !yaml! tag:yaml.org,2002: # named tag handle +--- +- !str 0 # primary tag handle +- !!str 0 # secondary tag handle +- !yaml!str 0 # named tag handle +--- + +boolean: [false, true, FALSE, TRUE, False, True] +null: [null, ~,] +integer: [12345, -12_345, +12_345] +float: [ + 12345.15, -12_345.15, +12_345.15, 1.23015e+3, + -12_345.15e+10, +12_345.15e-10, 1.234_515e-10 +] +binary: [0b101010, -0b1010_1010, +0b1010_1010] +octal: [0777, 0o777, +0777, -0o777] +hexadecimal: [0xFEFF_0000, -0xabcd_ef00, +0x1234_5678] +sexagesimal: [10:20:30, -19:29:39, +19:29:39] +infinity: [.inf, -.Inf, +.INF] +not a number: [.nan, .NaN, .NAN] + +plain strings: + - a b c + - a * b & c @ d# e : f # comment + - {{ f(' ') }} #8234 +double quoted strings: + - "" + - "a b c": "d e f" # comment + - "\\\"\a\b\f\n\r\t\v\0\_\ \N\L\P\x41\u0041\U00000041" +single quoted strings: + - '' + - 'a b c': 'd e f' # comment + - 'a''b''c' + +block folded string: > + foo + bar: 1 + + baz: null + + "qux" +block literal string: | + foo + bar: 1 + + baz: null + + 'qux' + +chomping strings: + - block folded string: >- # comment + foo + bar: 1 + - block literal string: |+ # comment + foo + bar: 1 + - |- #11517 + foo "\" + bar: 1 +block indentation indicator: + - block folded string: >1 # comment + foo + bar: 1 + - block literal string: |1- # comment + foo + bar: 1 + - |-1 # comment + foo + bar: 1 + +flow collection: + empty sequence: [] + empty mapping: {} + flow sequence: [foo, bar, baz] + flow mapping: {foo: bar, baz: qux} + flow string: + foo + bar + baz + "double quoted \" string": " + foo + bar + baz" + 'single quoted '' string': ' + foo + bar + baz' + inside block mapping: + foo: {bar: baz} + bar: ["foo": {baz: qux}] + flow collection: [foo # comment + , {bar: [{ # comment + baz: ' + qux # not comment + ' # comment + }]}] + +explicit mapping: + ? foo # comment + : bar # comment + ? - foo + - bar + : - baz + - qux + ? [1, 2, 3] + : ? 1 + : one + ? 2 + : - ? 3 + : three + - {?4: four, ? 5: five, ? # comment + 6: # comment + {7:seven}} + +mapping merge: + foo: &foo + bar: baz + bar: + <<: *foo + baz: &bar + foo: [*foo] + qux: + <<: [*foo, *bar] + baz: {<<: *foo, qux: [{<< : *foo}]} -- cgit v1.2.3