diff options
Diffstat (limited to 'runtime/syntax/testdir/input')
61 files changed, 3592 insertions, 135 deletions
diff --git a/runtime/syntax/testdir/input/java_annotations_signature.java b/runtime/syntax/testdir/input/java_annotations_signature.java new file mode 100644 index 0000000..8236218 --- /dev/null +++ b/runtime/syntax/testdir/input/java_annotations_signature.java @@ -0,0 +1,78 @@ +// VIM_TEST_SETUP let g:java_highlight_functions = 'style' +// VIM_TEST_SETUP let g:java_highlight_signature = 1 + +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +class Annotations$Tests +{ + @Target(ElementType.TYPE_USE) + @interface Tag + { + String value() default ""; + String kind() default ""; + } + + @Target(ElementType.TYPE_USE) + @interface Text + { + String[] value() default {""}; + } + + @Target({ + ElementType.METHOD, + ElementType.PARAMETER, + ElementType.TYPE, + }) + @interface Labels + { + Label[] value(); + } + + @java.lang.annotation.Target({ + java.lang.annotation.ElementType.METHOD, + java.lang.annotation.ElementType.PARAMETER, + java.lang.annotation.ElementType.TYPE, + }) + @java.lang.annotation.Repeatable(Labels.class) + @interface Label + { + String value() default ""; + Class<?> type() default Label.class; + boolean redundant() default true; + Text text() default @Text; + Tag head() default @Tag(); + Tag tail() default @Tag(value = "", kind = ""); + } + + /* Use identity cast expressions to nest TYPE_USE annotations. */ + @Label( + (@Text({ + (@Text({ "a", "aa", "aaa", "aaaa", }) String) "as", + (@Text({ "b", "bb", "bbb", "bbbb", }) String) "bs", + (@Text({ "c", "cc", "ccc", "cccc", }) String) "cs", + (@Text({ "d", "dd", "ddd", "dddd", }) String) "ds", + }) String) "abcd") + interface Primer { } + + @Label @Label() @Label(""" + n\ + o\ + O\ + p""") + @Label(head = @Tag(value = "@Label"/*, kind = "name"*/)) + @Label(// value = "Method", + type = Annotations$Tests.class, + redundant = !!!(1 != 1), + head = @Tag(value = "@Label"), + text = @Text({ "})", "({" })) + static void noOp(@Label @Label() @Label("dummy") + @Label(head = @Tag(/*value = "@Label",*/ kind = "name")) + @Label(// value = "Parameter", + type = Annotations$Tests.class, + head = @Tag(value = "@Label"), + text = @Text({ "){", "}(" })) + Object dummy) + { + } +} diff --git a/runtime/syntax/testdir/input/java_enfoldment.java b/runtime/syntax/testdir/input/java_enfoldment.java index b534122..a1d8822 100644 --- a/runtime/syntax/testdir/input/java_enfoldment.java +++ b/runtime/syntax/testdir/input/java_enfoldment.java @@ -1,5 +1,5 @@ // VIM_TEST_SETUP setlocal foldenable foldcolumn=2 foldmethod=syntax -// VIM_TEST_SETUP let g:java_mark_braces_in_parens_as_errors = 1 +// VIM_TEST_SETUP let g:java_foldtext_show_first_or_second_line = 1 @SuppressWarnings({ """ @@ -39,7 +39,7 @@ class FoldingTests { break; } default: ; - }; + } } { Object bb = ((Object) new byte[]{}); } @@ -51,6 +51,18 @@ out: { } while (false); } } +/*\\\*/ { + (new java.util.function.Function<Object, Object>() { + /** + * {@inheritDoc} */ + public Object apply(Object o) { return o; }; + }).apply( + (new java.util.function.Function<Object, Object>() { + /** {@inheritDoc} + */ + public Object apply(Object o) { return o; }; + })); + } /** * No operation. diff --git a/runtime/syntax/testdir/input/java_generics.java b/runtime/syntax/testdir/input/java_generics.java new file mode 100644 index 0000000..c9b001a --- /dev/null +++ b/runtime/syntax/testdir/input/java_generics.java @@ -0,0 +1,140 @@ +// VIM_TEST_SETUP let g:java_highlight_functions = 'style' +// VIM_TEST_SETUP let g:java_highlight_generics = 1 +// VIM_TEST_SETUP hi link javaGenericsC1 Todo +// VIM_TEST_SETUP hi link javaGenericsC2 Error + +import java.math.BigInteger; +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.function.LongFunction; +import java.util.function.Predicate; + +class GenericsTests<T extends Number & Comparable<? super T>, U> +{ // JDK 21+. + static final Function<Function<Object, Object>, Object> PARTIAL = + GenericsTests.y0(); + static final Function<BigInteger, BigInteger> FACTORIAL_2000 = + GenericsTests.<BigInteger, BigInteger>y1() + .apply(f -> x -> (x.compareTo(BigInteger.ONE) < 1) + ? BigInteger.ONE + : x.multiply(f.apply(x.subtract(BigInteger.ONE)))); + + static <T1> Y0<T1> y0() + { + return (Function<T1, T1> f) -> f.apply( + GenericsTests.<T1>y0() + .apply(f)); + } + + static <T1, T2> Y1<T1, T2> y1() + { + return (Function<Function<T1, T2>, Function<T1, T2>> f) -> + (T1 x) -> f.apply(GenericsTests.<T1, T2>y1() + .apply(f)) + .apply(x); + } + + static<T> void noOp(T dummy) { } + + interface alpha<T> { } + + interface Y0<T1> extends Function<Function<T1, T1>, T1> { } + + interface Y1<T1, T2> extends Function<Function<Function<T1, T2>, + Function<T1, T2>>, + Function<T1, T2>> { } + + interface Stackable<E> extends Iterable<E> + { + boolean isEmpty(); + E peek(); + E pop(); + Stackable<E> popAll(Stackable<? super E> elements); + Stackable<E> popSome(Stackable<? super E> elements, + Predicate<? super E> filter); + Stackable<E> push(E element); + Stackable<E> pushAll(Iterable<? extends E> elements); + Stackable<E> pushSome(Iterable<? extends E> elements, + Predicate<? super E> filter); + Stackable<E> wind(Consumer<? super Stackable<E>> action); + } + + sealed interface Num<N extends Number> + { + int radix(); + N value(); + } + + record Bin<N extends Number>(N value) implements Num<N> + { + public int radix() { return 2; } + } + + record Dec<N extends Number>(N value) implements Num<N> + { + public int radix() { return 10; } + } + + record Hex<N extends Number>(N value) implements Num<N> + { + public int radix() { return 16; } + } + + record Oct<N extends Number>(N value) implements Num<N> + { + public int radix() { return 8; } + } + + static Num<Long> fromDecimal(long x, int radix) + { + record Pair(LongFunction<Num<Long>> a, + LongFunction<String> b) { } + final Pair p = switch (radix) { + case 2 -> new Pair(Bin::new, Long::toBinaryString); + case 8 -> new Pair(Oct::new, Long::toOctalString); + case 16 -> new Pair(Hex::new, Long::toHexString); + default -> new Pair(Dec::new, + y -> Long.toString(y)); + }; + return p.a().apply(Long.parseLong(p.b().apply(x), radix)); + } + + static long toDecimal(Num<Long> x) + { + return Long.parseLong(switch (x) { + case Bin<?>(Long b) -> Long.toBinaryString(b); + case Oct<?>(Long o) -> Long.toOctalString(o); + case Hex<?>(Long h) -> Long.toHexString(h); + default -> Long.toString(x.value()); + }, x.radix()); + } + + @java.lang.annotation.Target( + java.lang.annotation.ElementType.TYPE_USE) + @interface Taggable + { + String value() default ""; + } + + { + int N = 0, X = 1, Y = 2; + Predicate<T> f = y->N<y.intValue(); + Predicate<T> g = y->X<N&&(Integer)y>N; + boolean[] bb = { + X<N||N>Y, X < Y, X <Y, X <(Y), X<(Y), (X)<Y, + Double.isFinite(X<<Y), + X<=Y, X<(int)(byte)Y, X<~Y, X<-Y, X<+Y, + }; + Class<?> klass = GenericsTests.class; + Class< java.lang.Class<@Taggable("<>")int[][]> [] [] > + [ ] [ ] $ [ ] [ ]; + if (false) { new GenericsTests<>(); } + alpha<?> ao; + alpha<U> au; + alpha<alpha<U>> aau; + alpha<Y0<?>> ay0o; + alpha<Y0<U>> ay0u; + Y0<alpha<?>> y0ao; + Y0<alpha<U>> y0au; + } +} diff --git a/runtime/syntax/testdir/input/java_generics_signature.java b/runtime/syntax/testdir/input/java_generics_signature.java new file mode 100644 index 0000000..505e70e --- /dev/null +++ b/runtime/syntax/testdir/input/java_generics_signature.java @@ -0,0 +1,140 @@ +// VIM_TEST_SETUP let g:java_highlight_functions = 'style' +// VIM_TEST_SETUP let g:java_highlight_signature = 1 +// VIM_TEST_SETUP let g:java_highlight_generics = 1 +// VIM_TEST_SETUP hi link javaGenericsC1 Todo +// VIM_TEST_SETUP hi link javaGenericsC2 Error +import java.math.BigInteger; +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.function.LongFunction; +import java.util.function.Predicate; + +class Generics$Tests<T extends Number & Comparable<? super T>, U> +{ // JDK 21+. + static final Function<Function<Object, Object>, Object> PARTIAL = + Generics$Tests.y0(); + static final Function<BigInteger, BigInteger> FACTORIAL_2000 = + Generics$Tests.<BigInteger, BigInteger>y1() + .apply(f -> x -> (x.compareTo(BigInteger.ONE) < 1) + ? BigInteger.ONE + : x.multiply(f.apply(x.subtract(BigInteger.ONE)))); + + static <T1> Y0<T1> y0() + { + return (Function<T1, T1> f) -> f.apply( + Generics$Tests.<T1>y0() + .apply(f)); + } + + static <T1, T2> Y1<T1, T2> y1() + { + return (Function<Function<T1, T2>, Function<T1, T2>> f) -> + (T1 x) -> f.apply(Generics$Tests.<T1, T2>y1() + .apply(f)) + .apply(x); + } + + static<T> void noOp(T dummy) { } + + interface alpha<T> { } + + interface Y0<T1> extends Function<Function<T1, T1>, T1> { } + + interface Y1<T1, T2> extends Function<Function<Function<T1, T2>, + Function<T1, T2>>, + Function<T1, T2>> { } + + interface Stackable<E> extends Iterable<E> + { + boolean isEmpty(); + E peek(); + E pop(); + Stackable<E> popAll(Stackable<? super E> elements); + Stackable<E> popSome(Stackable<? super E> elements, + Predicate<? super E> filter); + Stackable<E> push(E element); + Stackable<E> pushAll(Iterable<? extends E> elements); + Stackable<E> pushSome(Iterable<? extends E> elements, + Predicate<? super E> filter); + Stackable<E> wind(Consumer<? super Stackable<E>> action); + } + + sealed interface Num<N extends Number> + { + int radix(); + N value(); + } + + record Bin<N extends Number>(N value) implements Num<N> + { + public int radix() { return 2; } + } + + record Dec<N extends Number>(N value) implements Num<N> + { + public int radix() { return 10; } + } + + record Hex<N extends Number>(N value) implements Num<N> + { + public int radix() { return 16; } + } + + record Oct<N extends Number>(N value) implements Num<N> + { + public int radix() { return 8; } + } + + static Num<Long> fromDecimal(long x, int radix) + { + record Pair(LongFunction<Num<Long>> a, + LongFunction<String> b) { } + final Pair p = switch (radix) { + case 2 -> new Pair(Bin::new, Long::toBinaryString); + case 8 -> new Pair(Oct::new, Long::toOctalString); + case 16 -> new Pair(Hex::new, Long::toHexString); + default -> new Pair(Dec::new, + y -> Long.toString(y)); + }; + return p.a().apply(Long.parseLong(p.b().apply(x), radix)); + } + + static long toDecimal(Num<Long> x) + { + return Long.parseLong(switch (x) { + case Bin<?>(Long b) -> Long.toBinaryString(b); + case Oct<?>(Long o) -> Long.toOctalString(o); + case Hex<?>(Long h) -> Long.toHexString(h); + default -> Long.toString(x.value()); + }, x.radix()); + } + + @java.lang.annotation.Target( + java.lang.annotation.ElementType.TYPE_USE) + @interface Taggable + { + String value() default ""; + } + + { + int N = 0, X = 1, Y = 2; + Predicate<T> f = y->N<y.intValue(); + Predicate<T> g = y->X<N&&(Integer)y>N; + boolean[] bb = { + X<N||N>Y, X < Y, X <Y, X <(Y), X<(Y), (X)<Y, + Double.isFinite(X<<Y), + X<=Y, X<(int)(byte)Y, X<~Y, X<-Y, X<+Y, + }; + Class<?> klass = Generics$Tests.class; + Class< java.lang.Class<@Taggable("<>")int[][]> [] [] > + [ ] [ ] $ [ ] [ ]; + if (false) { new Generics$Tests<>(); } + alpha<?> ao; + alpha<U> au; + alpha<alpha<U>> aau; + alpha<Y0<?>> ay0o; + alpha<Y0<U>> ay0u; + Y0<alpha<?>> y0ao; + Y0<alpha<U>> y0au; + } +} diff --git a/runtime/syntax/testdir/input/java_lambda_expressions.java b/runtime/syntax/testdir/input/java_lambda_expressions.java index 75f5af4..95531f9 100644 --- a/runtime/syntax/testdir/input/java_lambda_expressions.java +++ b/runtime/syntax/testdir/input/java_lambda_expressions.java @@ -136,7 +136,7 @@ class LambdaExpressionsTests // JDK 21+. case String str_ -> str_; }): { echo(str); break; } case null: default: { echo("Other"); } - }; + } echo(switch (null) { case String str when !"<empty>".equals( diff --git a/runtime/syntax/testdir/input/java_lambda_expressions_signature.java b/runtime/syntax/testdir/input/java_lambda_expressions_signature.java new file mode 100644 index 0000000..0d89e9c --- /dev/null +++ b/runtime/syntax/testdir/input/java_lambda_expressions_signature.java @@ -0,0 +1,154 @@ +// VIM_TEST_SETUP let g:java_highlight_functions = 'style' +// VIM_TEST_SETUP let g:java_highlight_signature = 1 + +import java.lang.annotation.ElementType; +import java.util.function.BinaryOperator; +import java.util.function.Function; +import java.util.function.Predicate; + +class LambdaExpressions$Tests // JDK 21+. +{ + <I1, C1, C2, T1, T2, T3, Z1, Z2, Z3, S1, S2, S3> void test() + { // Schönfinkel's functions. + I<I1> i = x -> x; + C<C1, C2> c = x -> y -> x; + T<T1, T2, T3> t = f -> y -> x -> f.apply(x).apply(y); + Z<Z1, Z2, Z3> z = f -> g -> x -> f.apply(g.apply(x)); + S<S1, S2, S3> s = f -> g -> x -> f.apply(x) + .apply(g.apply(x)); + + I<I1> i01 = (var x) -> x; + I<I1> i02 = (@Taggable var x) -> x; + I<I1> i03 = (@Taggable @Taggable var x) -> x; + I<I1> i04 = (final var x) -> x; + I<I1> i05 = (@Taggable final var x) -> x; + I<I1> i06 = (@Taggable @Taggable final var x) -> x; + I<I1> i07 = (I1 x) -> x; + I<I1> i08 = (@Taggable I1 x) -> x; + I<I1> i09 = (@Taggable @Taggable I1 x) -> x; + I<I1> i10 = (final I1 x) -> x; + I<I1> i11 = (@Taggable final I1 x) -> x; + I<I1> i12 = (@Taggable @Taggable final I1 x) -> x; + + I<I1[]> ii01 = (I1... x) -> x; + I<I1[]> ii02 = (@Taggable I1... x) -> x; + I<I1[]> ii03 = (@Taggable @Taggable I1... x) -> x; + I<I1[]> ii04 = (final I1... x) -> x; + I<I1[]> ii05 = (@Taggable final I1... x) -> x; + I<I1[]> ii06 = (@Taggable @Taggable final I1... x) -> x; + + BinaryOperator<I1> leftConst01 = (var x, var y) -> x; + BinaryOperator<I1> leftConst02 = (@Taggable var x, + @Taggable var y) -> x; + BinaryOperator<I1> leftConst03 = (@Taggable @Taggable var + x, @Taggable @Taggable var y) -> x; + BinaryOperator<I1> leftConst04 = (final var x, + final var y) -> x; + BinaryOperator<I1> leftConst05 = (@Taggable final + var x, @Taggable final var y) -> x; + BinaryOperator<I1> leftConst06 = (@Taggable + @Taggable final var x, + @Taggable + @Taggable final var y) -> x; + BinaryOperator<I1> leftConst07 = (I1 x, I1 y) -> x; + BinaryOperator<I1> leftConst08 = (@Taggable I1 x, + @Taggable I1 y) -> x; + BinaryOperator<I1> leftConst09 = (@Taggable @Taggable I1 + x, @Taggable @Taggable I1 y) -> x; + BinaryOperator<I1> leftConst10 = (final I1 x, + final I1 y) -> x; + BinaryOperator<I1> leftConst11 = (@Taggable final + I1 x, @Taggable final I1 y) -> x; + BinaryOperator<I1> leftConst12 = (@Taggable + @Taggable final I1 x, + @Taggable + @Taggable final I1 y) -> x; + + Runnable noOp = () -> {}; + BinaryOperator<I1> leftConst = (x, y) -> x; + I<I1> id1 = (x) -> (x); + @SuppressWarnings("unchecked") I<I1> id2 = + ((I<I<I1>>) (I<?>) (Function<I1, + I1> x) -> x).apply(switch (0) { + case ((int) (byte) 1) -> (I1 x) -> x; + default -> (@Taggable I1 x) -> x; }); + C<C1, C2> const1 = (x) -> (y) -> (x); + C<C1, C2> const2 = switch(switch ("") { + case "->"->"(s)->(s)"; + default->"default"; }) { + case ("->")->(var x)->(var y)->(x); + default->(@Taggable var x)->(@Taggable var y) + ->(x); + }; + } + + @java.lang.annotation.Target(ElementType.PARAMETER) + @java.lang.annotation.Repeatable(Taggables.class) + @interface Taggable { String[] value() default ""; } + + @java.lang.annotation.Target(ElementType.PARAMETER) + @interface Taggables { Taggable[] value(); } + + interface I<A1> extends Function<A1, A1> { } + interface C<A1, A2> extends Function<A1, Function<A2, A1>> { } + interface T<A1, A2, A3> extends + Function<Function<A1, Function<A2, A3>>, + Function<A2, + Function<A1, A3>>> { } + interface Z<A1, A2, A3> extends Function<Function<A2, A3>, + Function<Function<A1, A2>, + Function<A1, A3>>> { } + interface S<A1, A2, A3> extends + Function<Function<A1, Function<A2, A3>>, + Function<Function<A1, A2>, + Function<A1, A3>>> { } + + static void echo(Object o) { System.out.println(o); } + + static { + enum Letters { OTHER, ALPHA, BETA } + + Letters other = Letters.OTHER; + + switch (other) { + case Letters alpha when Letters.ALPHA == alpha: + { echo(alpha); break; } + case Letters beta when Letters.BETA == beta: + { echo(beta); break; } + default: { echo(other); } + } + + echo(switch (other) { + case Letters alpha when Letters.ALPHA == alpha + -> alpha; + case Letters beta when Letters.BETA == beta + -> beta; + default -> other; + }); + + switch (null) { + case String str when !"<empty>".equals(switch (str) { + case String str_ when + Predicate.<String>not(text -> + !text.isEmpty()) + .test(str_) + -> "<empty>"; + case String str_ -> str_; + }): { echo(str); break; } + case null: default: { echo("Other"); } + } + + echo(switch (null) { + case String str when !"<empty>".equals( + switch (str) { + case String str_ when + Predicate.<String>not(text -> + !text.isEmpty()) + .test(str_) + -> "<empty>"; + case String str_ -> str_; + }) -> str; + case null, default -> "Other"; + }); + } +} diff --git a/runtime/syntax/testdir/input/java_method_references.java b/runtime/syntax/testdir/input/java_method_references.java new file mode 100644 index 0000000..d9cdf42 --- /dev/null +++ b/runtime/syntax/testdir/input/java_method_references.java @@ -0,0 +1,186 @@ +// VIM_TEST_SETUP let g:java_highlight_functions = 'style' +// VIM_TEST_SETUP let g:java_highlight_generics = 1 + + +import java.lang.invoke.MethodHandle; +import java.util.function.BiPredicate; +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.function.IntFunction; +import java.util.function.IntSupplier; +import java.util.function.Predicate; +import java.util.function.Supplier; +import java.util.function.ToIntFunction; +import java.util.function.UnaryOperator; + +class MethodReferencesTests +{ + static { + // Primary :: [TypeArguments] Identifier + try { + Runnable r1 = ((Runtime) null)::gc; + } catch (NullPointerException expected) { + } + + Supplier<Integer> s1 = ((Number) 0)::hashCode; + Supplier<Integer> s2 = ((Comparable<?>) '\0')::hashCode; + Supplier<Integer> s3 = ((Comparable<?>) false)::hashCode; + Supplier<Integer> s4 = "::"::hashCode; + Supplier<Class<?>> s5 = int[].class::arrayType; + Supplier<Integer> s6 = new MethodReferencesTests() :: + hashCode; + Supplier<Integer> s7 = ((Number) + (new MethodReferencesTests().xy)[0])::intValue; + Supplier<int[]> s8 = new MethodReferencesTests().xy:: + clone; + Consumer<Object> c1 = System.out :: println; + Supplier<byte[]> s9 = ((Supplier<String>) ()->"()").get() + ::getBytes; + Supplier<String> sa = ((Supplier<String>) + ((Supplier<String>) ((Supplier<String>) + ((Supplier<String>) ((Supplier<String>) + () -> "() -> ()") + ::toString) + ::toString) + ::get) + ::toString) + ::toString; + + // ExpressionName :: [TypeArguments] Identifier + // ReferenceType :: [TypeArguments] Identifier + Function<String, IntSupplier> f1 = s -> + s :: length; + Function<int[][], Supplier<int[]>> f2 = ii -> + ((int[]) (ii.length > 0 ? ii[0] : ii)) + :: clone; + UnaryOperator<String> uo1 = String::valueOf; + ToIntFunction<String> tif1 = s -> s.transform( + String :: length); + + // ClassType :: [TypeArguments] new + // ArrayType :: new + Function<Object, C2> f3 = C2::<Object>new; + Function<C2, C2.C21> f4 = pci -> pci.new + <String>C21(null); // Cf. "d". + Supplier<C1<?>> sb = C1::new; + Function<Byte, C1<?>> f5 = C1<Void> :: <Byte> new; + IntFunction<C1<?>[]> if1 = C1<?>[] :: new; + IntFunction<byte[]> if2 = byte[] :: new; + } + + final int[] xy = { 0, 1 }; + + // super :: [TypeArguments] Identifier + // TypeName . super :: [TypeArguments] Identifier + <T> MethodReferencesTests() + { + Predicate<T> p1 = MethodReferencesTests.super::equals; + Predicate<T> p2 = MethodReferencesTests.this::equals; + } + + interface I4<T> extends I3<T> + { + default Predicate<T> superEqualist() + { + return I3 + .super::equals; /* "a" */ + } + } + + interface I3<T> extends I2<T> + { + default Predicate<T> superEqualist() + { + return I2. + super::equals; /* "b" */ + } + } + + interface I2<T> extends I1<T> + { + default Predicate<T> superEqualist() + { /* Non-capturing gymnastics for super::equals. */ + return Function.<Function<MethodHandle, + Predicate<T>>> + identity() + .apply(mh -> o -> MethodReferencesTests + .invokePredicate(mh, o)) + .apply(EQUALS.bindTo(this)); + } + } + + interface I1<T> + { + default Predicate<T> equalist() + { /* Non-capturing gymnastics for this::equals. */ + return Function.<Function<I1<T>, Predicate<T>>> + identity() + .apply(that -> o -> Function + .<BiPredicate<I1<T>, T>> + identity() + .apply(I1<T>:: /* "c" */ + equals) + .test(that, o)) + .apply(I1.this); + } + } + + static <T> boolean invokePredicate(MethodHandle mh, T o) + { + try { + return (boolean) mh.invokeExact(o); + } catch (Throwable th) { + throw new RuntimeException(th); + } + } + + private static final MethodHandle EQUALS; + + static { + try { + EQUALS = java.lang.invoke.MethodHandles.lookup() + .findSpecial( + I1.class, + "equals", + java.lang.invoke.MethodType.methodType( + boolean.class, + Object.class), + I2.class); + } catch (ReflectiveOperationException e) { + throw new Error(e); + } + } + + static class C1<T> + { + C1() { } + <A> C1(A dummy) { } + } + + static class C2 + { + C2() { <String> this(""); } + + <A> C2(A dummy) + { + C2.stringer().apply(((Function<C2, C2.C21>) + C2.C21::new) /* "d" */ + .apply(C2.this)); + } + + class C21 + { + C21() { <String> this(""); } + + <B> C21(B dummy) + { + C2.stringer().apply(C2.this); + } + } + + static <T extends Object> Function<T, String> stringer() + { + return T::toString; /* "e" */ + } + } +} diff --git a/runtime/syntax/testdir/input/java_method_references_signature.java b/runtime/syntax/testdir/input/java_method_references_signature.java new file mode 100644 index 0000000..a154b12 --- /dev/null +++ b/runtime/syntax/testdir/input/java_method_references_signature.java @@ -0,0 +1,186 @@ +// VIM_TEST_SETUP let g:java_highlight_functions = 'style' +// VIM_TEST_SETUP let g:java_highlight_signature = 1 +// VIM_TEST_SETUP let g:java_highlight_generics = 1 + +import java.lang.invoke.MethodHandle; +import java.util.function.BiPredicate; +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.function.IntFunction; +import java.util.function.IntSupplier; +import java.util.function.Predicate; +import java.util.function.Supplier; +import java.util.function.ToIntFunction; +import java.util.function.UnaryOperator; + +class MethodReferences$Tests +{ + static { + // Primary :: [TypeArguments] Identifier + try { + Runnable r1 = ((Runtime) null)::gc; + } catch (NullPointerException expected) { + } + + Supplier<Integer> s1 = ((Number) 0)::hashCode; + Supplier<Integer> s2 = ((Comparable<?>) '\0')::hashCode; + Supplier<Integer> s3 = ((Comparable<?>) false)::hashCode; + Supplier<Integer> s4 = "::"::hashCode; + Supplier<Class<?>> s5 = int[].class::arrayType; + Supplier<Integer> s6 = new MethodReferences$Tests() :: + hashCode; + Supplier<Integer> s7 = ((Number) + (new MethodReferences$Tests().xy)[0])::intValue; + Supplier<int[]> s8 = new MethodReferences$Tests().xy:: + clone; + Consumer<Object> c1 = System.out :: println; + Supplier<byte[]> s9 = ((Supplier<String>) ()->"()").get() + ::getBytes; + Supplier<String> sa = ((Supplier<String>) + ((Supplier<String>) ((Supplier<String>) + ((Supplier<String>) ((Supplier<String>) + () -> "() -> ()") + ::toString) + ::toString) + ::get) + ::toString) + ::toString; + + // ExpressionName :: [TypeArguments] Identifier + // ReferenceType :: [TypeArguments] Identifier + Function<String, IntSupplier> f1 = s -> + s :: length; + Function<int[][], Supplier<int[]>> f2 = ii -> + ((int[]) (ii.length > 0 ? ii[0] : ii)) + :: clone; + UnaryOperator<String> uo1 = String::valueOf; + ToIntFunction<String> tif1 = s -> s.transform( + String :: length); + + // ClassType :: [TypeArguments] new + // ArrayType :: new + Function<Object, C2> f3 = C2::<Object>new; + Function<C2, C2.C21> f4 = pci -> pci.new + <String>C21(null); // Cf. "d". + Supplier<C1<?>> sb = C1::new; + Function<Byte, C1<?>> f5 = C1<Void> :: <Byte> new; + IntFunction<C1<?>[]> if1 = C1<?>[] :: new; + IntFunction<byte[]> if2 = byte[] :: new; + } + + final int[] xy = { 0, 1 }; + + // super :: [TypeArguments] Identifier + // TypeName . super :: [TypeArguments] Identifier + <T> MethodReferences$Tests() + { + Predicate<T> p1 = MethodReferences$Tests.super::equals; + Predicate<T> p2 = MethodReferences$Tests.this::equals; + } + + interface I4<T> extends I3<T> + { + default Predicate<T> superEqualist() + { + return I3 + .super::equals; /* "a" */ + } + } + + interface I3<T> extends I2<T> + { + default Predicate<T> superEqualist() + { + return I2. + super::equals; /* "b" */ + } + } + + interface I2<T> extends I1<T> + { + default Predicate<T> superEqualist() + { /* Non-capturing gymnastics for super::equals. */ + return Function.<Function<MethodHandle, + Predicate<T>>> + identity() + .apply(mh -> o -> MethodReferences$Tests + .invokePredicate(mh, o)) + .apply(EQUALS.bindTo(this)); + } + } + + interface I1<T> + { + default Predicate<T> equalist() + { /* Non-capturing gymnastics for this::equals. */ + return Function.<Function<I1<T>, Predicate<T>>> + identity() + .apply(that -> o -> Function + .<BiPredicate<I1<T>, T>> + identity() + .apply(I1<T>:: /* "c" */ + equals) + .test(that, o)) + .apply(I1.this); + } + } + + static <T> boolean invokePredicate(MethodHandle mh, T o) + { + try { + return (boolean) mh.invokeExact(o); + } catch (Throwable th) { + throw new RuntimeException(th); + } + } + + private static final MethodHandle EQUALS; + + static { + try { + EQUALS = java.lang.invoke.MethodHandles.lookup() + .findSpecial( + I1.class, + "equals", + java.lang.invoke.MethodType.methodType( + boolean.class, + Object.class), + I2.class); + } catch (ReflectiveOperationException e) { + throw new Error(e); + } + } + + static class C1<T> + { + C1() { } + <A> C1(A dummy) { } + } + + static class C2 + { + C2() { <String> this(""); } + + <A> C2(A dummy) + { + C2.stringer().apply(((Function<C2, C2.C21>) + C2.C21::new) /* "d" */ + .apply(C2.this)); + } + + class C21 + { + C21() { <String> this(""); } + + <B> C21(B dummy) + { + C2.stringer().apply(C2.this); + } + } + + static <T extends Object> Function<T, String> stringer() + { + return T::toString; /* "e" */ + } + } +} diff --git a/runtime/syntax/testdir/input/java_methods_indent2.java b/runtime/syntax/testdir/input/java_methods_indent2.java index 58a6900..3754cc4 100644 --- a/runtime/syntax/testdir/input/java_methods_indent2.java +++ b/runtime/syntax/testdir/input/java_methods_indent2.java @@ -84,9 +84,21 @@ abstract class Indent2MethodsTests enum E2 { @SuppressWarnings("bespoke") A("a"), - B("b"), - C("c"), D("d"), - E("e"), F("f"), G("g"), H("h"); + B("b" + /*\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\*/), + C("c", new Thread( + + () -> { + })), D("d", (java.util.function.BooleanSupplier) () -> true), + E("e", new char[] { 'a', 'b', 'c', 'd' }), F("f", new Object() { + transient String name = ""; + @Override public String toString() { return this.name; } + }), //\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\// + G("g"), @Deprecated H("h"); + final String s; private E2(String s) { this.s = s; } + private <δ> E2(String s, δ dummy) { this(s); } + + @Override public String toString() { return name().toUpperCase(); } } diff --git a/runtime/syntax/testdir/input/java_methods_indent2_signature.java b/runtime/syntax/testdir/input/java_methods_indent2_signature.java new file mode 100644 index 0000000..05e633b --- /dev/null +++ b/runtime/syntax/testdir/input/java_methods_indent2_signature.java @@ -0,0 +1,104 @@ +// VIM_TEST_SETUP let g:java_highlight_functions = 'indent2' +// VIM_TEST_SETUP let g:java_highlight_signature = 1 +// VIM_TEST_SETUP set encoding=utf-8 termencoding=utf-8 +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +abstract class Indent2$MethodsTests +{ // DO NOT retab! THIS FILE; REMEMBER ABOUT testdir/ftplugin. + // TYPES. + record Τʬ<α>(α a) { } + + enum E + { + A("a"), B("b"), C("c"), D("d"), + E("e"), F("f"), G("g"), H("h"); + final String s; + private E(String s) { this.s = s; } + } + + @Target({ElementType.METHOD, ElementType.CONSTRUCTOR}) + @java.lang.annotation.Repeatable(Tɐggablɘs.class) + @interface Tɐggablɘ + { + String[] value() default ""; + } + + @Target({ElementType.METHOD, ElementType.CONSTRUCTOR}) + @interface Tɐggablɘs + { + Tɐggablɘ[] value(); + } + + interface Stylable<Α> + { + default void ascii$0_() { } + default Α μʭʭ$0_() { return null; } + } + + // FIELDS. + private static final Class<?> CLASS_LOCK = classLock(); + + private final Object instanceLock = new Object(); + + // CONSTRUCTORS. + @Tɐggablɘ @Tɐggablɘ protected Indent2$MethodsTests() { } + <T extends Comparable<T>> Indent2$MethodsTests(T t, Void v) { } + private <T extends Comparable<T>> Indent2$MethodsTests(T t) { } + + // METHODS. + @Tɐggablɘ @Tɐggablɘ abstract void ascii$0_(//////////////// + ); + @Tɐggablɘ @Tɐggablɘ abstract <α, β> Τʬ<α> μʭʭ$0_( + @SuppressWarnings("bespoke") β b); + + @Tɐggablɘ private native void ascii$1_(/*////////////*/); + @Tɐggablɘ private native <α, β> Τʬ<α>[] μʭʭ$1_( + java.util.function.Function<β, Τʬ<α>[]> ƒ); + + void Ascii$2_() { } + <T, U extends Stylable<T>> void Μʭʭ$2_(U u) { } + + 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 + Indent2$MethodsTests.<α, β>μʭʭ$98_(ƒ)[0]; + } + + public static Class<?> classLock() { return Indent2$MethodsTests.class; } + + @Override @SuppressWarnings("cast") + public String toString() { return (String) "Indent2$MethodsTests"; } +} + +enum E2$ +{ + @SuppressWarnings("bespoke") A("a"), + B("b" + /*\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\*/), + C("c", new Thread( + + () -> { + })), D("d", (java.util.function.BooleanSupplier) () -> true), + E("e", new char[] { 'a', 'b', 'c', 'd' }), F("f", new Object() { + transient String name = ""; + @Override public String toString() { return this.name; } + }), //\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\// + G("g"), @Deprecated H("h"); + + final String s; + private E2$(String s) { this.s = s; } + private <δ> E2$(String s, δ dummy) { this(s); } + + @Override public String toString() { return name().toUpperCase(); } +} diff --git a/runtime/syntax/testdir/input/java_methods_indent4.java b/runtime/syntax/testdir/input/java_methods_indent4.java index 972cdf3..8fc05c0 100644 --- a/runtime/syntax/testdir/input/java_methods_indent4.java +++ b/runtime/syntax/testdir/input/java_methods_indent4.java @@ -84,9 +84,21 @@ abstract class Indent4MethodsTests enum E4 { @SuppressWarnings("bespoke") A("a"), - B("b"), - C("c"), D("d"), - E("e"), F("f"), G("g"), H("h"); + B("b" + /*\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\*/), + C("c", new Thread( + + () -> { + })), D("d", (java.util.function.BooleanSupplier) () -> true), + E("e", new char[] { 'a', 'b', 'c', 'd' }), F("f", new Object() { + transient String name = ""; + @Override public String toString() { return this.name; } + }), //\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\// + G("g"), @Deprecated H("h"); + final String s; private E4(String s) { this.s = s; } + private <δ> E4(String s, δ dummy) { this(s); } + + @Override public String toString() { return name().toUpperCase(); } } diff --git a/runtime/syntax/testdir/input/java_methods_indent4_signature.java b/runtime/syntax/testdir/input/java_methods_indent4_signature.java new file mode 100644 index 0000000..f21d95d --- /dev/null +++ b/runtime/syntax/testdir/input/java_methods_indent4_signature.java @@ -0,0 +1,104 @@ +// VIM_TEST_SETUP let g:java_highlight_functions = 'indent4' +// VIM_TEST_SETUP let g:java_highlight_signature = 1 +// VIM_TEST_SETUP set encoding=utf-8 termencoding=utf-8 +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +abstract class Indent4$MethodsTests +{ // DO NOT retab! THIS FILE; REMEMBER ABOUT testdir/ftplugin. + // TYPES. + record Τʬ<α>(α a) { } + + enum E + { + A("a"), B("b"), C("c"), D("d"), + E("e"), F("f"), G("g"), H("h"); + final String s; + private E(String s) { this.s = s; } + } + + @Target({ElementType.METHOD, ElementType.CONSTRUCTOR}) + @java.lang.annotation.Repeatable(Tɐggablɘs.class) + @interface Tɐggablɘ + { + String[] value() default ""; + } + + @Target({ElementType.METHOD, ElementType.CONSTRUCTOR}) + @interface Tɐggablɘs + { + Tɐggablɘ[] value(); + } + + interface Stylable<Α> + { + default void ascii$0_() { } + default Α μʭʭ$0_() { return null; } + } + + // FIELDS. + private static final Class<?> CLASS_LOCK = classLock(); + + private final Object instanceLock = new Object(); + + // CONSTRUCTORS. + @Tɐggablɘ @Tɐggablɘ protected Indent4$MethodsTests() { } + <T extends Comparable<T>> Indent4$MethodsTests(T t, Void v) { } + private <T extends Comparable<T>> Indent4$MethodsTests(T t) { } + + // METHODS. + @Tɐggablɘ @Tɐggablɘ abstract void ascii$0_(//////////////// + ); + @Tɐggablɘ @Tɐggablɘ abstract <α, β> Τʬ<α> μʭʭ$0_( + @SuppressWarnings("bespoke") β b); + + @Tɐggablɘ private native void ascii$1_(/*////////////*/); + @Tɐggablɘ private native <α, β> Τʬ<α>[] μʭʭ$1_( + java.util.function.Function<β, Τʬ<α>[]> ƒ); + + void Ascii$2_() { } + <T, U extends Stylable<T>> void Μʭʭ$2_(U u) { } + + 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 + Indent4$MethodsTests.<α, β>μʭʭ$98_(ƒ)[0]; + } + + public static Class<?> classLock() { return Indent4$MethodsTests.class; } + + @Override @SuppressWarnings("cast") + public String toString() { return (String) "Indent4$MethodsTests"; } +} + +enum E4$ +{ + @SuppressWarnings("bespoke") A("a"), + B("b" + /*\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\*/), + C("c", new Thread( + + () -> { + })), D("d", (java.util.function.BooleanSupplier) () -> true), + E("e", new char[] { 'a', 'b', 'c', 'd' }), F("f", new Object() { + transient String name = ""; + @Override public String toString() { return this.name; } + }), //\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\// + G("g"), @Deprecated H("h"); + + final String s; + private E4$(String s) { this.s = s; } + private <δ> E4$(String s, δ dummy) { this(s); } + + @Override public String toString() { return name().toUpperCase(); } +} diff --git a/runtime/syntax/testdir/input/java_methods_indent8.java b/runtime/syntax/testdir/input/java_methods_indent8.java index 40fd26b..d27830c 100644 --- a/runtime/syntax/testdir/input/java_methods_indent8.java +++ b/runtime/syntax/testdir/input/java_methods_indent8.java @@ -84,9 +84,21 @@ abstract class Indent8MethodsTests enum E8 { @SuppressWarnings("bespoke") A("a"), - B("b"), - C("c"), D("d"), - E("e"), F("f"), G("g"), H("h"); + B("b" + /*\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\*/), + C("c", new Thread( + + () -> { + })), D("d", (java.util.function.BooleanSupplier) () -> true), + E("e", new char[] { 'a', 'b', 'c', 'd' }), F("f", new Object() { + transient String name = ""; + @Override public String toString() { return this.name; } + }), //\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\// + G("g"), @Deprecated H("h"); + final String s; private E8(String s) { this.s = s; } + private <δ> E8(String s, δ dummy) { this(s); } + + @Override public String toString() { return name().toUpperCase(); } } diff --git a/runtime/syntax/testdir/input/java_methods_indent8_signature.java b/runtime/syntax/testdir/input/java_methods_indent8_signature.java new file mode 100644 index 0000000..8d82196 --- /dev/null +++ b/runtime/syntax/testdir/input/java_methods_indent8_signature.java @@ -0,0 +1,104 @@ +// VIM_TEST_SETUP let g:java_highlight_functions = 'indent8' +// VIM_TEST_SETUP let g:java_highlight_signature = 1 +// VIM_TEST_SETUP set encoding=utf-8 termencoding=utf-8 +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +abstract class Indent8$MethodsTests +{ // DO NOT retab! THIS FILE; REMEMBER ABOUT testdir/ftplugin. + // TYPES. + record Τʬ<α>(α a) { } + + enum E + { + A("a"), B("b"), C("c"), D("d"), + E("e"), F("f"), G("g"), H("h"); + final String s; + private E(String s) { this.s = s; } + } + + @Target({ElementType.METHOD, ElementType.CONSTRUCTOR}) + @java.lang.annotation.Repeatable(Tɐggablɘs.class) + @interface Tɐggablɘ + { + String[] value() default ""; + } + + @Target({ElementType.METHOD, ElementType.CONSTRUCTOR}) + @interface Tɐggablɘs + { + Tɐggablɘ[] value(); + } + + interface Stylable<Α> + { + default void ascii$0_() { } + default Α μʭʭ$0_() { return null; } + } + + // FIELDS. + private static final Class<?> CLASS_LOCK = classLock(); + + private final Object instanceLock = new Object(); + + // CONSTRUCTORS. + @Tɐggablɘ @Tɐggablɘ protected Indent8$MethodsTests() { } + <T extends Comparable<T>> Indent8$MethodsTests(T t, Void v) { } + private <T extends Comparable<T>> Indent8$MethodsTests(T t) { } + + // METHODS. + @Tɐggablɘ @Tɐggablɘ abstract void ascii$0_(//////////////// + ); + @Tɐggablɘ @Tɐggablɘ abstract <α, β> Τʬ<α> μʭʭ$0_( + @SuppressWarnings("bespoke") β b); + + @Tɐggablɘ private native void ascii$1_(/*////////////*/); + @Tɐggablɘ private native <α, β> Τʬ<α>[] μʭʭ$1_( + java.util.function.Function<β, Τʬ<α>[]> ƒ); + + void Ascii$2_() { } + <T, U extends Stylable<T>> void Μʭʭ$2_(U u) { } + + 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 + Indent8$MethodsTests.<α, β>μʭʭ$98_(ƒ)[0]; + } + + public static Class<?> classLock() { return Indent8$MethodsTests.class; } + + @Override @SuppressWarnings("cast") + public String toString() { return (String) "Indent8$MethodsTests"; } +} + +enum E8$ +{ + @SuppressWarnings("bespoke") A("a"), + B("b" + /*\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\*/), + C("c", new Thread( + + () -> { + })), D("d", (java.util.function.BooleanSupplier) () -> true), + E("e", new char[] { 'a', 'b', 'c', 'd' }), F("f", new Object() { + transient String name = ""; + @Override public String toString() { return this.name; } + }), //\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\//\// + G("g"), @Deprecated H("h"); + + final String s; + private E8$(String s) { this.s = s; } + private <δ> E8$(String s, δ dummy) { this(s); } + + @Override public String toString() { return name().toUpperCase(); } +} diff --git a/runtime/syntax/testdir/input/java_methods_style_signature.java b/runtime/syntax/testdir/input/java_methods_style_signature.java new file mode 100644 index 0000000..8e3b4d6 --- /dev/null +++ b/runtime/syntax/testdir/input/java_methods_style_signature.java @@ -0,0 +1,82 @@ +// VIM_TEST_SETUP let g:java_highlight_functions = 'style' +// VIM_TEST_SETUP let g:java_highlight_signature = 1 +// VIM_TEST_SETUP set encoding=utf-8 termencoding=utf-8 +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +abstract class Style$MethodsTests +{ + // TYPES. + record Τʬ<α>(α a) { } + + enum E + { + A("a"), B("b"), C("c"), D("d"), + E("e"), F("f"), G("g"), H("h"); + final String s; + private E(String s) { this.s = s; } + } + + @Target({ElementType.METHOD, ElementType.CONSTRUCTOR}) + @java.lang.annotation.Repeatable(Tɐggablɘs.class) + @interface Tɐggablɘ + { + String[] value() default ""; + } + + @Target({ElementType.METHOD, ElementType.CONSTRUCTOR}) + @interface Tɐggablɘs + { + Tɐggablɘ[] value(); + } + + interface Stylable<Α> + { + default void ascii$0_() { } + default Α μʭʭ$0_() { return null; } + } + + // FIELDS. + private static final Class<?> CLASS_LOCK = classLock(); + + private final Object instanceLock = new Object(); + + // CONSTRUCTORS. + @Tɐggablɘ @Tɐggablɘ protected Style$MethodsTests() { } + <T extends Comparable<T>> Style$MethodsTests(T t, Void v) { } + private <T extends Comparable<T>> Style$MethodsTests(T t) { } + + // METHODS. + @Tɐggablɘ @Tɐggablɘ abstract void ascii$0_(//////////////// + ); + @Tɐggablɘ @Tɐggablɘ abstract <α, β> Τʬ<α> μʭʭ$0_( + @SuppressWarnings("bespoke") β b); + + @Tɐggablɘ private native void ascii$1_(/*////////////*/); + @Tɐggablɘ private native <α, β> Τʬ<α>[] μʭʭ$1_( + java.util.function.Function<β, Τʬ<α>[]> ƒ); + + void Ascii$2_() { } + <T, U extends Stylable<T>> void Μʭʭ$2_(U u) { } + + 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 + Style$MethodsTests.<α, β>μʭʭ$98_(ƒ)[0]; + } + + public static Class<?> classLock() { return Style$MethodsTests.class; } + + @Override @SuppressWarnings("cast") + public String toString() { return (String) "Style$MethodsTests"; } +} diff --git a/runtime/syntax/testdir/input/java_previews_430.java b/runtime/syntax/testdir/input/java_previews_430.java new file mode 100644 index 0000000..15d8ba2 --- /dev/null +++ b/runtime/syntax/testdir/input/java_previews_430.java @@ -0,0 +1,68 @@ +// VIM_TEST_SETUP let g:java_syntax_previews = [430] + + + +class StringTemplateTests // JDK 21+ (--enable-preview --release 21). +{ + static { + System.out.println(STR.""" + " + \{"\"\""} + \{"\"\""}\{"\u005c\u0022"} + \{"\"\""}\{"\u005c\u0022"}" + \{"\"\""}\"\{"\u005c\u0022\u005c\u0022"} + \{"\"\""}\"\{"\"\""}\{"\u005c\u0022"} + \{"\"\""}\"\{"\"\""}\"" + \{"\"\""}\"\{"\"\""}\""\""""); + + String woof = "Woof", dog = "dog", fox = "fox"; + + String s1 = STR + ."A quick brown \{fox} jumps over the lazy \{dog}"; + String s2 = STR.process(StringTemplate.RAW + ."\"\{woof}\s!\""); + String s3 = STR.""" + A\s\ + quick \ + brown\s\ + \{fox} \ + jumps\s\ + over \ + the\s\ + lazy \ + \{dog}"""; + String s4 = STR.process(StringTemplate.RAW + . + """ + "\{woof}\s!\""""); + String s5 = java.util.FormatProcessor.FMT + . "%-14s\{"A\s" + STR . "quick" + "brown"}%s\{fox} " + + java.util.FormatProcessor.FMT + . "%-20s\{"jumps\sover the\s" + + STR . "lazy"}%s\{dog}"; + String s6 = STR.""" + \"\{ // A nested comment. + (new java.util.function.Function<String, String>() { + public String apply(String bay) { return bay; }; + }).apply(woof) + }\s!\""""; + String s7 = java.util.FormatProcessor.FMT + .""" + %-14s\{STR.""" + A\s\ + \{ "quick" } \ + brown"""}\ + %s\{ fox } \ + %-20s\{STR.""" + jumps\s\ + over \ + the\s\ + \{ "lazy" } """}\ + %s\{ dog }"""; + String s8 = STR + ."\"\{ /* A nested comment. */ + ((java.util.function.Function<String, String>) bay -> bay) + .apply(woof) + }\s!\""; + } +} diff --git a/runtime/syntax/testdir/input/java_string.java b/runtime/syntax/testdir/input/java_string.java index 43a7a05..51c30b9 100644 --- a/runtime/syntax/testdir/input/java_string.java +++ b/runtime/syntax/testdir/input/java_string.java @@ -1,4 +1,4 @@ -class StringTests // JDK 21+ (--enable-preview --release 21). +class StringTests { static { String s1 = "A quick brown fox jumps over the lazy dog"; @@ -40,65 +40,5 @@ class StringTests // JDK 21+ (--enable-preview --release 21). ""\"""\u005c\u0022 ""\"""\"" ""\"""\""\""""); - - System.out.println(STR.""" - " - \{"\"\""} - \{"\"\""}\{"\u005c\u0022"} - \{"\"\""}\{"\u005c\u0022"}" - \{"\"\""}\"\{"\u005c\u0022\u005c\u0022"} - \{"\"\""}\"\{"\"\""}\{"\u005c\u0022"} - \{"\"\""}\"\{"\"\""}\"" - \{"\"\""}\"\{"\"\""}\""\""""); // JDK 21+. - - String woof = "Woof", dog = "dog", fox = "fox"; - - String s6 = STR - ."A quick brown \{fox} jumps over the lazy \{dog}"; - String s7 = STR.process(StringTemplate.RAW - ."\"\{woof}\s!\""); - String s8 = STR.""" - A\s\ - quick \ - brown\s\ - \{fox} \ - jumps\s\ - over \ - the\s\ - lazy \ - \{dog}"""; - String s9 = STR.process(StringTemplate.RAW - . - """ - "\{woof}\s!\""""); - String s10 = java.util.FormatProcessor.FMT - . "%-14s\{"A\s" + STR . "quick" + "brown"}%s\{fox} " - + java.util.FormatProcessor.FMT - . "%-20s\{"jumps\sover the\s" - + STR . "lazy"}%s\{dog}"; - String s11 = STR.""" - \"\{ // A nested comment. - (new java.util.function.Function<String, String>() { - public String apply(String bay) { return bay; }; - }).apply(woof) - }\s!\""""; - String s12 = java.util.FormatProcessor.FMT - .""" - %-14s\{STR.""" - A\s\ - \{ "quick" } \ - brown"""}\ - %s\{ fox } \ - %-20s\{STR.""" - jumps\s\ - over \ - the\s\ - \{ "lazy" } """}\ - %s\{ dog }"""; - String s13 = STR - ."\"\{ /* A nested comment. */ - ((java.util.function.Function<String, String>) bay -> bay) - .apply(woof) - }\s!\""; } } diff --git a/runtime/syntax/testdir/input/java_switch.java b/runtime/syntax/testdir/input/java_switch.java index 14b2e11..d82fcb1 100644 --- a/runtime/syntax/testdir/input/java_switch.java +++ b/runtime/syntax/testdir/input/java_switch.java @@ -55,7 +55,7 @@ class SwitchTests // JDK 21+. case null: { echo("null"); break; } case Letters[] ll: { echo("SwitchTests$1Letters[]"); break; } default: { echo("java.lang.Object"); break; } - }; + } echo(switch (o) { case null -> "null"; @@ -69,7 +69,7 @@ class SwitchTests // JDK 21+. case 'a': { echo('a'); break; } case 'b': { echo('b'); break; } default: { echo('\u0000'); break; } - }; + } echo(switch (ch) { case 'a' -> 'a'; @@ -83,7 +83,7 @@ class SwitchTests // JDK 21+. case ((byte) 0): { echo((byte) 0); break; } case ((byte) 1): { echo((byte) 1); break; } default: { echo((byte) -1); break; } - }; + } echo(switch (b) { case ((byte) 0) -> (byte) 0; @@ -97,7 +97,7 @@ class SwitchTests // JDK 21+. case ((short) 0): { echo((short) 0); break; } case ((short) 1): { echo((short) 1); break; } default: { echo((short) -1); break; } - }; + } echo(switch (sh) { case ((short) 0) -> (short) 0; @@ -111,7 +111,7 @@ class SwitchTests // JDK 21+. case 0b0__00___000: { echo(0); break; } case 0x000___00__1: { echo(1); break; } default: { echo(-1); break; } - }; + } echo(switch (i) { case 0_0_0_0_0 -> 0; diff --git a/runtime/syntax/testdir/input/java_unfoldment.java b/runtime/syntax/testdir/input/java_unfoldment.java index 78dd234..ffea216 100644 --- a/runtime/syntax/testdir/input/java_unfoldment.java +++ b/runtime/syntax/testdir/input/java_unfoldment.java @@ -39,7 +39,7 @@ class UnfoldingTests { break; } default: ; - }; + } } { Object bb = ((Object) new byte[]{}); } @@ -51,6 +51,18 @@ out: { } while (false); } } +/*\\\*/ { + (new java.util.function.Function<Object, Object>() { + /** + * {@inheritDoc} */ + public Object apply(Object o) { return o; }; + }).apply( + (new java.util.function.Function<Object, Object>() { + /** {@inheritDoc} + */ + public Object apply(Object o) { return o; }; + })); + } /** * No operation. diff --git a/runtime/syntax/testdir/input/progress_comments.p b/runtime/syntax/testdir/input/progress_comments.p new file mode 100644 index 0000000..dd831fe --- /dev/null +++ b/runtime/syntax/testdir/input/progress_comments.p @@ -0,0 +1,45 @@ +/* + * VIM_TEST_SETUP set filetype=progress + */ + +define variable customer_name as character no-undo. + +/* The test setup above is an example of a multi-line comment. +This is too; the leading * and left-hand alignment are not required. */ +for each customer no-lock + where customer.customer_id = 12345 +: + assign cust_name = customer.customer_name. /* Comments can also appear + at the end of a line. */ +end. /* for each customer */ + +/* Comments can be /* nested */. Here's the same query as above, but +commented out this time: + +for each customer no-lock + where customer.customer_id = 12345 +: + assign cust_name = customer.customer_name. /* Comments can also appear + at the end of a line. */ +end. /* for each customer */ + +TODO: Note that /*/ does not end the comment, because it actually starts a +new comment whose first character is a '/'. Now we need two end-comment +markers to return to actual code. */ */ + +display customer_name. + +// This is the single-line comment syntax. + +//No space is required after the slashes. Also, a /* here does not begin a +//new block comment. + +for each supplier no-lock: + /* However, a block comment can end inside (what looks like) a + single-line comment, because the slashes are just text as far as the + // block comment is concerned. */ + display supplier. + + // TODO: Observe that todo highlighting works in line comments too. +end. + diff --git a/runtime/syntax/testdir/input/selftestdir/README.txt b/runtime/syntax/testdir/input/selftestdir/README.txt new file mode 100644 index 0000000..035701d --- /dev/null +++ b/runtime/syntax/testdir/input/selftestdir/README.txt @@ -0,0 +1,10 @@ +The test files with made-up syntax in this directory serve for additional +linewise checks to be manually performed whenever the algorithm managing +screen dump file generation is modified (../../runtest.vim#RunTest()). + +This is mainly used for debugging and testing the syntax test suite. + +Please test any changes as follows: + cd runtime/syntax/ + VIM_SYNTAX_SELF_TESTING=1 make clean test + diff --git a/runtime/syntax/testdir/input/vim_keymap.vim b/runtime/syntax/testdir/input/selftestdir/dots_01 index 424d437..cf78d97 100644 --- a/runtime/syntax/testdir/input/vim_keymap.vim +++ b/runtime/syntax/testdir/input/selftestdir/dots_01 @@ -1,27 +1,60 @@ -" Vim Keymap file for syntax testing - -" Maintainer: Doug Kearns <dougkearns@gmail.com> -" Last Changed: 2023 Nov 21 - -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 -<char-62> B Special notation allowed in LHS - decimal -c <char-0103> Special notation allowed in RHS - octal -<char-0x0064> <char-0x0044> Special notation allowed in LHS and RHS - hexadecimal - -" Vim-script comment characters -# <char-0x00a3> 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 +..........................................................................1 +..........................................................................2 +..........................................................................3 +..........................................................................4 +..............................winwidth(0): 75.............................5 +.............................winheight(0): 19.............................6 +.................................ruler....................................7 +..........................................................................8 +..........................................................................9 +.........................................................................10 +.........................................................................11 +.........................................................................12 +.........................................................................13 +.........................................................................14 +.........................................................................15 +.........................................................................16 +.........................................................................17 +.........................................................................18 +.........................................................................19 +.........................................................................20 +.........................................................................21 +.........................................................................22 +.........................................................................23 +.........................................................................24 +.........................................................................25 +.........................................................................26 +.........................................................................27 +.........................................................................28 +.........................................................................29 +.........................................................................30 +.........................................................................31 +.........................................................................32 +.........................................................................33 +.........................................................................34 +.........................................................................35 +.........................................................................36 +.........................................................................37 +.........................................................................38 +.........................................................................39 +.........................................................................40 +.........................................................................41 +.........................................................................42 +.........................................................................43 +.........................................................................44 +.........................................................................45 +.........................................................................46 +.........................................................................47 +.........................................................................48 +.........................................................................49 +.........................................................................50 +.........................................................................51 +.........................................................................52 +.........................................................................53 +.........................................................................54 +.........................................................................55 +.........................................................................56 +.........................................................................57 +.........................................................................58 +.........................................................................59 +.........................................................................60 diff --git a/runtime/syntax/testdir/input/selftestdir/dots_02 b/runtime/syntax/testdir/input/selftestdir/dots_02 new file mode 100644 index 0000000..4748fa1 --- /dev/null +++ b/runtime/syntax/testdir/input/selftestdir/dots_02 @@ -0,0 +1,30 @@ +1..........................................................................2 +3..........................................................................4 +5..........................................................................6 +7..........................................................................8 +9............................winwidth(0): 75...............................10 +11..........................winheight(0): 19...............................12 +13..............................ruler......................................14 +15.........................................................................16 +17.........................................................................18 +19.........................................................................20 +21.........................................................................22 +23.........................................................................24 +25.........................................................................26 +27.........................................................................28 +29.........................................................................30 +31.........................................................................32 +33.........................................................................34 +35.........................................................................36 +37.........................................................................38 +39.........................................................................40 +41.........................................................................42 +43.........................................................................44 +45.........................................................................46 +47.........................................................................48 +49.........................................................................50 +51.........................................................................52 +53.........................................................................54 +55.........................................................................56 +57.........................................................................58 +59.........................................................................60 diff --git a/runtime/syntax/testdir/input/selftestdir/dots_03 b/runtime/syntax/testdir/input/selftestdir/dots_03 new file mode 100644 index 0000000..a8a16e9 --- /dev/null +++ b/runtime/syntax/testdir/input/selftestdir/dots_03 @@ -0,0 +1,20 @@ +1..........................................................................2..........................................................................3 +4..........................................................................5..........................................................................6 +7..........................................................................8..........................................................................9 +10.........................................................................11.........................................................................12 +13...........................winwidth(0): 75...............................14.........................................................................15 +16..........................winheight(0): 19...............................17.........................................................................18 +19..............................ruler......................................20.........................................................................21 +22.........................................................................23.........................................................................24 +25.........................................................................26.........................................................................27 +28.........................................................................29.........................................................................30 +31.........................................................................32.........................................................................33 +34.........................................................................35.........................................................................36 +37.........................................................................38.........................................................................39 +40.........................................................................41.........................................................................42 +43.........................................................................44.........................................................................45 +46.........................................................................47.........................................................................48 +49.........................................................................50.........................................................................51 +52.........................................................................53.........................................................................54 +55.........................................................................56.........................................................................57 +58.........................................................................59.........................................................................60 diff --git a/runtime/syntax/testdir/input/selftestdir/dots_04 b/runtime/syntax/testdir/input/selftestdir/dots_04 new file mode 100644 index 0000000..ac0a26a --- /dev/null +++ b/runtime/syntax/testdir/input/selftestdir/dots_04 @@ -0,0 +1,15 @@ +1..........................................................................2..........................................................................3..........................................................................4 +5..........................................................................6..........................................................................7..........................................................................8 +9..........................................................................10.........................................................................11.........................................................................12 +13.........................................................................14.........................................................................15.........................................................................16 +17...........................winwidth(0): 75...............................18.........................................................................19.........................................................................20 +21..........................winheight(0): 19...............................22.........................................................................23.........................................................................24 +25..............................ruler......................................26.........................................................................27.........................................................................28 +29.........................................................................30.........................................................................31.........................................................................32 +33.........................................................................34.........................................................................35.........................................................................36 +37.........................................................................38.........................................................................39.........................................................................40 +41.........................................................................42.........................................................................43.........................................................................44 +45.........................................................................46.........................................................................47.........................................................................48 +49.........................................................................50.........................................................................51.........................................................................52 +53.........................................................................54.........................................................................55.........................................................................56 +57.........................................................................58.........................................................................59.........................................................................60 diff --git a/runtime/syntax/testdir/input/selftestdir/dots_05 b/runtime/syntax/testdir/input/selftestdir/dots_05 new file mode 100644 index 0000000..2dfb5be --- /dev/null +++ b/runtime/syntax/testdir/input/selftestdir/dots_05 @@ -0,0 +1,12 @@ +1..........................................................................2..........................................................................3..........................................................................4..........................................................................5 +6..........................................................................7..........................................................................8..........................................................................9..........................................................................10 +11.........................................................................12.........................................................................13.........................................................................14.........................................................................15 +16.........................................................................17.........................................................................18.........................................................................19.........................................................................20 +21...........................winwidth(0): 75...............................22.........................................................................23.........................................................................24.........................................................................25 +26..........................winheight(0): 19...............................27.........................................................................28.........................................................................29.........................................................................30 +31..............................ruler......................................32.........................................................................33.........................................................................34.........................................................................35 +36.........................................................................37.........................................................................38.........................................................................39.........................................................................40 +41.........................................................................42.........................................................................43.........................................................................44.........................................................................45 +46.........................................................................47.........................................................................48.........................................................................49.........................................................................50 +51.........................................................................52.........................................................................53.........................................................................54.........................................................................55 +56.........................................................................57.........................................................................58.........................................................................59.........................................................................60 diff --git a/runtime/syntax/testdir/input/selftestdir/dots_06 b/runtime/syntax/testdir/input/selftestdir/dots_06 new file mode 100644 index 0000000..87eaf76 --- /dev/null +++ b/runtime/syntax/testdir/input/selftestdir/dots_06 @@ -0,0 +1,10 @@ +1..........................................................................2..........................................................................3..........................................................................4..........................................................................5..........................................................................6 +7..........................................................................8..........................................................................9..........................................................................10.........................................................................11.........................................................................12 +13.........................................................................14.........................................................................15.........................................................................16.........................................................................17.........................................................................18 +19.........................................................................20.........................................................................21.........................................................................22.........................................................................23.........................................................................24 +25...........................winwidth(0): 75...............................26.........................................................................27.........................................................................28.........................................................................29.........................................................................30 +31..........................winheight(0): 19...............................32.........................................................................33.........................................................................34.........................................................................35.........................................................................36 +37..............................ruler......................................38.........................................................................39.........................................................................40.........................................................................41.........................................................................42 +43.........................................................................44.........................................................................45.........................................................................46.........................................................................47.........................................................................48 +49.........................................................................50.........................................................................51.........................................................................52.........................................................................53.........................................................................54 +55.........................................................................56.........................................................................57.........................................................................58.........................................................................59.........................................................................60 diff --git a/runtime/syntax/testdir/input/selftestdir/dots_07 b/runtime/syntax/testdir/input/selftestdir/dots_07 new file mode 100644 index 0000000..801c470 --- /dev/null +++ b/runtime/syntax/testdir/input/selftestdir/dots_07 @@ -0,0 +1,9 @@ +1..........................................................................2..........................................................................3..........................................................................4..........................................................................5..........................................................................6..........................................................................7 +8..........................................................................9..........................................................................10.........................................................................11.........................................................................12.........................................................................13.........................................................................14 +15.........................................................................16.........................................................................17.........................................................................18.........................................................................19.........................................................................20.........................................................................21 +22.........................................................................23.........................................................................24.........................................................................25.........................................................................26.........................................................................27.........................................................................28 +29...........................winwidth(0): 75...............................30.........................................................................31.........................................................................32.........................................................................33.........................................................................34.........................................................................35 +36..........................winheight(0): 19...............................37.........................................................................38.........................................................................39.........................................................................40.........................................................................41.........................................................................42 +43..............................ruler......................................44.........................................................................45.........................................................................46.........................................................................47.........................................................................48.........................................................................49 +50.........................................................................51.........................................................................52.........................................................................53.........................................................................54.........................................................................55.........................................................................56 +57.........................................................................58.........................................................................59.........................................................................60.........................................................................61.........................................................................62.........................................................................63 diff --git a/runtime/syntax/testdir/input/selftestdir/dots_08 b/runtime/syntax/testdir/input/selftestdir/dots_08 new file mode 100644 index 0000000..2b7bdd9 --- /dev/null +++ b/runtime/syntax/testdir/input/selftestdir/dots_08 @@ -0,0 +1,8 @@ +1..........................................................................2..........................................................................3..........................................................................4..........................................................................5..........................................................................6..........................................................................7..........................................................................8 +9..........................................................................10.........................................................................11.........................................................................12.........................................................................13.........................................................................14.........................................................................15.........................................................................16 +17.........................................................................18.........................................................................19.........................................................................20.........................................................................21.........................................................................22.........................................................................23.........................................................................24 +25.........................................................................26.........................................................................27.........................................................................28.........................................................................29.........................................................................30.........................................................................31.........................................................................32 +33...........................winwidth(0): 75...............................34.........................................................................35.........................................................................36.........................................................................37.........................................................................38.........................................................................39.........................................................................40 +41..........................winheight(0): 19...............................42.........................................................................43.........................................................................44.........................................................................45.........................................................................46.........................................................................47.........................................................................48 +49..............................ruler......................................50.........................................................................51.........................................................................52.........................................................................53.........................................................................54.........................................................................55.........................................................................56 +57.........................................................................58.........................................................................59.........................................................................60.........................................................................61.........................................................................62.........................................................................63.........................................................................64 diff --git a/runtime/syntax/testdir/input/selftestdir/dots_09 b/runtime/syntax/testdir/input/selftestdir/dots_09 new file mode 100644 index 0000000..76b25e6 --- /dev/null +++ b/runtime/syntax/testdir/input/selftestdir/dots_09 @@ -0,0 +1,7 @@ +1..........................................................................2..........................................................................3..........................................................................4..........................................................................5..........................................................................6..........................................................................7..........................................................................8..........................................................................9 +10.........................................................................11.........................................................................12.........................................................................13.........................................................................14.........................................................................15.........................................................................16.........................................................................17.........................................................................18 +19.........................................................................20.........................................................................21.........................................................................22.........................................................................23.........................................................................24.........................................................................25.........................................................................26.........................................................................27 +28.........................................................................29.........................................................................30.........................................................................31.........................................................................32.........................................................................33.........................................................................34.........................................................................35.........................................................................36 +37...........................winwidth(0): 75...............................38.........................................................................39.........................................................................40.........................................................................41.........................................................................42.........................................................................43.........................................................................44.........................................................................45 +46..........................winheight(0): 19...............................47.........................................................................48.........................................................................49.........................................................................50.........................................................................51.........................................................................52.........................................................................53.........................................................................54 +55..............................ruler......................................56.........................................................................57.........................................................................58.........................................................................59.........................................................................60.........................................................................61.........................................................................62.........................................................................63 diff --git a/runtime/syntax/testdir/input/selftestdir/dots_10 b/runtime/syntax/testdir/input/selftestdir/dots_10 new file mode 100644 index 0000000..9d6a158 --- /dev/null +++ b/runtime/syntax/testdir/input/selftestdir/dots_10 @@ -0,0 +1,6 @@ +1..........................................................................2..........................................................................3..........................................................................4..........................................................................5..........................................................................6..........................................................................7..........................................................................8..........................................................................9..........................................................................10 +11.........................................................................12.........................................................................13.........................................................................14.........................................................................15.........................................................................16.........................................................................17.........................................................................18.........................................................................19.........................................................................20 +21.........................................................................22.........................................................................23.........................................................................24.........................................................................25.........................................................................26.........................................................................27.........................................................................28.........................................................................29.........................................................................30 +31...........................winwidth(0): 75...............................32.........................................................................33.........................................................................34.........................................................................35.........................................................................36.........................................................................37.........................................................................38.........................................................................39.........................................................................40 +41..........................wihheight(0): 19...............................42.........................................................................43.........................................................................44.........................................................................45.........................................................................46.........................................................................47.........................................................................48.........................................................................49.........................................................................50 +51..............................ruler......................................52.........................................................................53.........................................................................54.........................................................................55.........................................................................56.........................................................................57.........................................................................58.........................................................................59.........................................................................60 diff --git a/runtime/syntax/testdir/input/selftestdir/dots_11 b/runtime/syntax/testdir/input/selftestdir/dots_11 new file mode 100644 index 0000000..503b734 --- /dev/null +++ b/runtime/syntax/testdir/input/selftestdir/dots_11 @@ -0,0 +1,6 @@ +1..........................................................................2..........................................................................3..........................................................................4..........................................................................5..........................................................................6..........................................................................7..........................................................................8..........................................................................9..........................................................................10.........................................................................11 +12.........................................................................13.........................................................................14.........................................................................15.........................................................................16.........................................................................17.........................................................................18.........................................................................19.........................................................................20.........................................................................21.........................................................................22 +23.........................................................................24.........................................................................25.........................................................................26.........................................................................27.........................................................................28.........................................................................29.........................................................................30.........................................................................31.........................................................................32.........................................................................33 +34...........................winwidth(0): 75...............................35.........................................................................36.........................................................................37.........................................................................38.........................................................................39.........................................................................40.........................................................................41.........................................................................42.........................................................................43.........................................................................44 +45..........................winheight(0): 19...............................46.........................................................................47.........................................................................48.........................................................................49.........................................................................50.........................................................................51.........................................................................52.........................................................................53.........................................................................54.........................................................................55 +56..............................ruler......................................57.........................................................................58.........................................................................59.........................................................................60.........................................................................61.........................................................................62.........................................................................63.........................................................................64.........................................................................65.........................................................................66 diff --git a/runtime/syntax/testdir/input/selftestdir/dots_12 b/runtime/syntax/testdir/input/selftestdir/dots_12 new file mode 100644 index 0000000..347feb2 --- /dev/null +++ b/runtime/syntax/testdir/input/selftestdir/dots_12 @@ -0,0 +1,5 @@ +1..........................................................................2..........................................................................3..........................................................................4..........................................................................5..........................................................................6..........................................................................7..........................................................................8..........................................................................9..........................................................................10.........................................................................11.........................................................................12 +13.........................................................................14.........................................................................15.........................................................................16.........................................................................17.........................................................................18.........................................................................19.........................................................................20.........................................................................21.........................................................................22.........................................................................23.........................................................................24 +25...........................winwidth(0): 75...............................26.........................................................................27.........................................................................28.........................................................................29.........................................................................30.........................................................................31.........................................................................32.........................................................................33.........................................................................34.........................................................................35.........................................................................36 +37..........................winheight(0): 19...............................38.........................................................................39.........................................................................40.........................................................................41.........................................................................42.........................................................................43.........................................................................44.........................................................................45.........................................................................46.........................................................................47.........................................................................48 +49..............................ruler......................................50.........................................................................51.........................................................................52.........................................................................53.........................................................................54.........................................................................55.........................................................................56.........................................................................57.........................................................................58.........................................................................59.........................................................................60 diff --git a/runtime/syntax/testdir/input/selftestdir/dots_13 b/runtime/syntax/testdir/input/selftestdir/dots_13 new file mode 100644 index 0000000..b177614 --- /dev/null +++ b/runtime/syntax/testdir/input/selftestdir/dots_13 @@ -0,0 +1,5 @@ +1..........................................................................2..........................................................................3..........................................................................4..........................................................................5..........................................................................6..........................................................................7..........................................................................8..........................................................................9..........................................................................10.........................................................................11.........................................................................12.........................................................................13 +14.........................................................................15.........................................................................16.........................................................................17.........................................................................18.........................................................................19.........................................................................20.........................................................................21.........................................................................22.........................................................................23.........................................................................24.........................................................................25.........................................................................26 +27...........................winwidth(0): 75...............................28.........................................................................29.........................................................................30.........................................................................31.........................................................................32.........................................................................33.........................................................................34.........................................................................35.........................................................................36.........................................................................37.........................................................................38.........................................................................39 +40..........................winheight(0): 19...............................41.........................................................................42.........................................................................43.........................................................................44.........................................................................45.........................................................................46.........................................................................47.........................................................................48.........................................................................49.........................................................................50.........................................................................51.........................................................................52 +53..............................ruler......................................54.........................................................................55.........................................................................56.........................................................................57.........................................................................58.........................................................................59.........................................................................60.........................................................................61.........................................................................62.........................................................................63.........................................................................64.........................................................................65 diff --git a/runtime/syntax/testdir/input/selftestdir/dots_14 b/runtime/syntax/testdir/input/selftestdir/dots_14 new file mode 100644 index 0000000..9a46c3e --- /dev/null +++ b/runtime/syntax/testdir/input/selftestdir/dots_14 @@ -0,0 +1,5 @@ +1..........................................................................2..........................................................................3..........................................................................4..........................................................................5..........................................................................6..........................................................................7..........................................................................8..........................................................................9..........................................................................10.........................................................................11.........................................................................12.........................................................................13.........................................................................14 +15.........................................................................16.........................................................................17.........................................................................18.........................................................................19.........................................................................20.........................................................................21.........................................................................22.........................................................................23.........................................................................24.........................................................................25.........................................................................26.........................................................................27.........................................................................28 +29...........................winwidth(0): 75...............................30.........................................................................31.........................................................................32.........................................................................33.........................................................................34.........................................................................35.........................................................................36.........................................................................37.........................................................................38.........................................................................39.........................................................................40.........................................................................41.........................................................................42 +43..........................winheight(0): 19...............................44.........................................................................45.........................................................................46.........................................................................47.........................................................................48.........................................................................49.........................................................................50.........................................................................51.........................................................................52.........................................................................53.........................................................................54.........................................................................55.........................................................................56 +57..............................ruler......................................58.........................................................................59.........................................................................60.........................................................................61.........................................................................62.........................................................................63.........................................................................64.........................................................................65.........................................................................66.........................................................................67.........................................................................68.........................................................................69.........................................................................70 diff --git a/runtime/syntax/testdir/input/selftestdir/dots_15 b/runtime/syntax/testdir/input/selftestdir/dots_15 new file mode 100644 index 0000000..45fbef9 --- /dev/null +++ b/runtime/syntax/testdir/input/selftestdir/dots_15 @@ -0,0 +1,4 @@ +1..........................................................................2..........................................................................3..........................................................................4..........................................................................5..........................................................................6..........................................................................7..........................................................................8..........................................................................9..........................................................................10.........................................................................11.........................................................................12.........................................................................13.........................................................................14.........................................................................15 +16...........................winwidth(0): 75...............................17.........................................................................18.........................................................................19.........................................................................20.........................................................................21.........................................................................22.........................................................................23.........................................................................24.........................................................................25.........................................................................26.........................................................................27.........................................................................28.........................................................................29.........................................................................30 +31..........................winheight(0): 19...............................32.........................................................................33.........................................................................34.........................................................................35.........................................................................36.........................................................................37.........................................................................38.........................................................................39.........................................................................40.........................................................................41.........................................................................42.........................................................................43.........................................................................44.........................................................................45 +46..............................ruler......................................47.........................................................................48.........................................................................49.........................................................................50.........................................................................51.........................................................................52.........................................................................53.........................................................................54.........................................................................55.........................................................................56.........................................................................57.........................................................................58.........................................................................59.........................................................................60 diff --git a/runtime/syntax/testdir/input/selftestdir/dots_16 b/runtime/syntax/testdir/input/selftestdir/dots_16 new file mode 100644 index 0000000..1af3caa --- /dev/null +++ b/runtime/syntax/testdir/input/selftestdir/dots_16 @@ -0,0 +1,4 @@ +1..........................................................................2..........................................................................3..........................................................................4..........................................................................5..........................................................................6..........................................................................7..........................................................................8..........................................................................9..........................................................................10.........................................................................11.........................................................................12.........................................................................13.........................................................................14.........................................................................15.........................................................................16 +17...........................winwidth(0): 75...............................18.........................................................................19.........................................................................20.........................................................................21.........................................................................22.........................................................................23.........................................................................24.........................................................................25.........................................................................26.........................................................................27.........................................................................28.........................................................................29.........................................................................30.........................................................................31.........................................................................32 +33..........................winheight(0): 19...............................34.........................................................................35.........................................................................36.........................................................................37.........................................................................38.........................................................................39.........................................................................40.........................................................................41.........................................................................42.........................................................................43.........................................................................44.........................................................................45.........................................................................46.........................................................................47.........................................................................48 +49..............................ruler......................................50.........................................................................51.........................................................................52.........................................................................53.........................................................................54.........................................................................55.........................................................................56.........................................................................57.........................................................................58.........................................................................59.........................................................................60.........................................................................61.........................................................................62.........................................................................63.........................................................................64 diff --git a/runtime/syntax/testdir/input/selftestdir/dots_17 b/runtime/syntax/testdir/input/selftestdir/dots_17 new file mode 100644 index 0000000..6dc5050 --- /dev/null +++ b/runtime/syntax/testdir/input/selftestdir/dots_17 @@ -0,0 +1,4 @@ +1..........................................................................2..........................................................................3..........................................................................4..........................................................................5..........................................................................6..........................................................................7..........................................................................8..........................................................................9..........................................................................10.........................................................................11.........................................................................12.........................................................................13.........................................................................14.........................................................................15.........................................................................16.........................................................................17 +18...........................winwidth(0): 75...............................19.........................................................................20.........................................................................21.........................................................................22.........................................................................23.........................................................................24.........................................................................25.........................................................................26.........................................................................27.........................................................................28.........................................................................29.........................................................................30.........................................................................31.........................................................................32.........................................................................33.........................................................................34 +35..........................winheight(0): 19...............................36.........................................................................37.........................................................................38.........................................................................39.........................................................................40.........................................................................41.........................................................................42.........................................................................43.........................................................................44.........................................................................45.........................................................................46.........................................................................47.........................................................................48.........................................................................49.........................................................................50.........................................................................51 +52...............................ruler.....................................53.........................................................................54.........................................................................55.........................................................................56.........................................................................57.........................................................................58.........................................................................59.........................................................................60.........................................................................61.........................................................................62.........................................................................63.........................................................................64.........................................................................65.........................................................................66.........................................................................67.........................................................................68 diff --git a/runtime/syntax/testdir/input/selftestdir/dots_18 b/runtime/syntax/testdir/input/selftestdir/dots_18 new file mode 100644 index 0000000..f84a827 --- /dev/null +++ b/runtime/syntax/testdir/input/selftestdir/dots_18 @@ -0,0 +1,4 @@ +1..........................................................................2..........................................................................3..........................................................................4..........................................................................5..........................................................................6..........................................................................7..........................................................................8..........................................................................9..........................................................................10.........................................................................11.........................................................................12.........................................................................13.........................................................................14.........................................................................15.........................................................................16.........................................................................17.........................................................................18 +19...........................winwidth(0): 75...............................20.........................................................................21.........................................................................22.........................................................................23.........................................................................24.........................................................................25.........................................................................26.........................................................................27.........................................................................28.........................................................................29.........................................................................30.........................................................................31.........................................................................32.........................................................................33.........................................................................34.........................................................................35.........................................................................36 +37..........................winheight(0): 19...............................38.........................................................................39.........................................................................40.........................................................................41.........................................................................42.........................................................................43.........................................................................44.........................................................................45.........................................................................46.........................................................................47.........................................................................48.........................................................................49.........................................................................50.........................................................................51.........................................................................52.........................................................................53.........................................................................54 +55...............................ruler.....................................56.........................................................................57.........................................................................58.........................................................................59.........................................................................60.........................................................................61.........................................................................62.........................................................................63.........................................................................64.........................................................................65.........................................................................66.........................................................................67.........................................................................68.........................................................................69.........................................................................70.........................................................................71.........................................................................72 diff --git a/runtime/syntax/testdir/input/selftestdir/dots_19 b/runtime/syntax/testdir/input/selftestdir/dots_19 new file mode 100644 index 0000000..9f0ad00 --- /dev/null +++ b/runtime/syntax/testdir/input/selftestdir/dots_19 @@ -0,0 +1,4 @@ +1..........................................................................2..........................................................................3..........................................................................4..........................................................................5..........................................................................6..........................................................................7..........................................................................8..........................................................................9..........................................................................10.........................................................................11.........................................................................12.........................................................................13.........................................................................14.........................................................................15.........................................................................16.........................................................................17.........................................................................18.........................................................................19 +20...........................winwidth(0): 75...............................21.........................................................................22.........................................................................23.........................................................................24.........................................................................25.........................................................................26.........................................................................27.........................................................................28.........................................................................29.........................................................................30.........................................................................31.........................................................................32.........................................................................33.........................................................................34.........................................................................35.........................................................................36.........................................................................37.........................................................................38 +39..........................winheight(0): 19...............................40.........................................................................41.........................................................................42.........................................................................43.........................................................................44.........................................................................45.........................................................................46.........................................................................47.........................................................................48.........................................................................49.........................................................................50.........................................................................51.........................................................................52.........................................................................53.........................................................................54.........................................................................55.........................................................................56.........................................................................57 +58...............................ruler.....................................59.........................................................................60.........................................................................61.........................................................................62.........................................................................63.........................................................................64.........................................................................65.........................................................................66.........................................................................67.........................................................................68.........................................................................69.........................................................................70.........................................................................71.........................................................................72.........................................................................73.........................................................................74.........................................................................75.........................................................................76 diff --git a/runtime/syntax/testdir/input/selftestdir/dots_20 b/runtime/syntax/testdir/input/selftestdir/dots_20 new file mode 100644 index 0000000..ca3a93d --- /dev/null +++ b/runtime/syntax/testdir/input/selftestdir/dots_20 @@ -0,0 +1,2 @@ +1..........................................................................2..........................................................................3..........................................................................4..........................................................................5.............................winwidth(0): 75..............................6............................winheight(0): 19..............................7................................ruler.....................................8..........................................................................9..........................................................................10.........................................................................11.........................................................................12.........................................................................13.........................................................................14.........................................................................15.........................................................................16.........................................................................17.........................................................................18.........................................................................19.........................................................................20.........................................................................21.........................................................................22.........................................................................23.........................................................................24.........................................................................25.........................................................................26.........................................................................27.........................................................................28.........................................................................29.........................................................................30.........................................................................31.........................................................................32.........................................................................33.........................................................................34.........................................................................35.........................................................................36.........................................................................37.........................................................................38 +39.........................................................................40.........................................................................41.........................................................................42.........................................................................43.........................................................................44.........................................................................45.........................................................................46.........................................................................47.........................................................................48.........................................................................49.........................................................................50.........................................................................51.........................................................................52.........................................................................53.........................................................................54.........................................................................55.........................................................................56.........................................................................57.........................................................................58.........................................................................59.........................................................................60.........................................................................61.........................................................................62.........................................................................63.........................................................................64.........................................................................65.........................................................................66.........................................................................67.........................................................................68.........................................................................69.........................................................................70.........................................................................71.........................................................................72.........................................................................73.........................................................................74.........................................................................75.........................................................................76 diff --git a/runtime/syntax/testdir/input/vim9_ex_commands.vim b/runtime/syntax/testdir/input/vim9_ex_commands.vim new file mode 100644 index 0000000..92ab9dc --- /dev/null +++ b/runtime/syntax/testdir/input/vim9_ex_commands.vim @@ -0,0 +1,1225 @@ +vim9script + +# Vim9 Ex commands + +# START NOT MATCHED +:@ +:@@ +:Next +:X +# END NOT MATCHED + +:help + :help +: help + : help + +:2match +:3match +:abbreviate +:abclear +:aboveleft +:abstract +:all +:amenu +:anoremenu +:argadd +:argdedupe +:argdelete +:argdo +:argedit +:argglobal +:arglocal +:args +:argument +:ascii +:augroup Foo +:augroup END +:aunmenu +:autocmd +:badd +:ball +:balt +:bdelete +:behave mswin +:behave xterm +:belowright +:bfirst +:blast +:bmodified +:bnext +:bNext +:botright +:bprevious +:break +:breakadd +:breakdel +:breaklist +:brewind +:browse +:bufdo +:buffer +:buffers +:bunload +:bwipeout +:cabbrev +:cabclear +:cabove +:caddbuffer +:caddexpr +:caddfile +:cafter +:call +:catch +:cbefore +:cbelow +:cbottom +:cbuffer +:cc +:cclose +:cd +:cdo +:center +:cexpr +:cfdo +:cfile +:cfirst +:cgetbuffer +:cgetexpr +:cgetfile +:changes +:chdir +:checkpath +:checktime +:chistory +:class +:class +:clast +:clearjumps +:clist +:close +:cmap +:cmapclear +:cmenu +:cnewer +:cnext +:cNext +:cnfile +:cNfile +:cnoreabbrev +:cnoremap +:cnoremenu +:colder +:colorscheme +:comclear +:command +:compiler +:confirm +:const +:continue +:copen +:copy +:cpfile +:cprevious +:cquit +:crewind +:cscope +:cstag +:cunabbrev +:cunmap +:cunmenu +:cwindow +:debug +:debuggreedy +:def +:defcompile +:defcompile +:defer +:delcommand +:delete +:delfunction +:delmarks +:diffget +:diffoff +:diffpatch +:diffput +:diffsplit +:diffthis +:diffupdate +:digraphs +:disassemble +:disassemble +:display +:djump +:dl +:dlist +:doautoall +:doautocmd +:dp +:drop +:dsearch +:dsplit +:earlier +:echo +:echoconsole +:echoerr +:echohl +:echomsg +:echon +:echowindow +:edit +:else +:elseif +:emenu +:endclass +:endclass +:enddef +:endenum +:endfor +:endfunction +:endif +:endinterface +:endtry +:endwhile +:enew +:enum +:eval +:ex +:execute +:exit +:export +:export +:exusage +:file +:files +:filetype +:filter +:final +:finally +:find +:finish +:first +:fixdel +:fold +:foldclose +:folddoclosed +:folddoopen +:foldopen +:for +:function +:global/.../ +:goto +:grep +:grepadd +:gui +:gvim +:hardcopy +:help +:helpclose +:helpfind +:helpgrep +:helptags +:hide +:highlight +:history +:horizontal +:iabbrev +:iabclear +:if +:ijump +:ilist +:imap +:imapclear +:imenu +:import +:inoreabbrev +:inoremap +:inoremenu +:interface +:intro +:isearch +:isplit +:iunabbrev +:iunmap +:iunmenu +:join +:jumps +:k +:keepalt +:keepjumps +:keepmarks +:keeppatterns +:labove +:laddbuffer +:laddexpr +:laddfile +:lafter +:language +:last +:later +:lbefore +:lbelow +:lbottom +:lbuffer +:lcd +:lchdir +:lclose +:lcscope +:ldo +:left +:leftabove +:legacy +:lexpr +:lfdo +:lfile +:lfirst +:lgetbuffer +:lgetexpr +:lgetfile +:lgrep +:lgrepadd +:lhelpgrep +:lhistory +:list +:ll +:llast +:llist +:lmake +:lmap +:lmapclear +:lnewer +:lnext +:lNext +:lnfile +:lNfile +:lnoremap +# :loadkeymap # disabled - runs until EOF +:loadview +:lockmarks +:lockvar +:lolder +:lopen +:lpfile +:lprevious +:lrewind +:ls +:ltag +:lua +:luado +:luafile +:lunmap +:lvimgrep +:lvimgrepadd +:lwindow +:make +:mapclear +:map +:mark +:marks +:match +:menu +:menutranslate +:messages +:mkexrc +:mksession +:mkspell +:mkview +:mkvimrc +:move +:mzfile +:mzscheme +:nbclose +:nbkey +:nbstart +:new +:next +:nmap +:nmapclear +:nmenu +:nnoremap +:nnoremenu +:noautocmd +:nohlsearch +:noreabbrev +:noremap +:noremenu +:normal +:noswapfile +:number +:nunmap +:nunmenu +:oldfiles +:omap +:omapclear +:omenu +:only +:onoremap +:onoremenu +:options +:ounmap +:ounmenu +:ownsyntax +:packadd +:packloadall +:pclose +:pedit +:perl +:perldo +:pop +:popup +:ppop +:preserve +:previous +:print +:profdel +:profile +:promptfind +:promptrepl +:psearch +:ptag +:ptfirst +:ptjump +:ptlast +:ptnext +:ptNext +:ptprevious +:ptrewind +:ptselect +:public +:public +:put +:pwd +:py3 +:py3do +:py3file +:pydo +:pyfile +:python +:python3 +:pythonx +:pyx +:pyxdo +:pyxfile +:qall +:quit +:quitall +:read +:recover +:redir +:redo +:redraw +:redrawstatus +:redrawtabline +:registers +:resize +:retab +:return +:rewind +:right +:rightbelow +:ruby +:rubydo +:rubyfile +:rundo +:runtime +:rviminfo +:sall +:sandbox +:sargument +:saveas +:sball +:sbfirst +:sblast +:sbmodified +:sbnext +:sbNext +:sbprevious +:sbrewind +:sbuffer +:scriptencoding +:scriptnames +:scriptversion +:scscope +:set +:setfiletype +:setglobal +:setlocal +:sfind +:sfirst +:shell +:sign +:silent +:simalt +:slast +:sleep +:sleep! +:smagic +:smap +:smapclear +:smenu +:smile +:snext +:sNext +:snomagic +:snoremap +:snoremenu +:sort +:source +:spelldump +:spellgood +:spellinfo +:spellrare +:spellrepall +:spellundo +:spellwrong +:split +:sprevious +:srewind +:stag +:startgreplace +:startinsert +:startreplace +:static +:static +:stjump +:stop +:stopinsert +:stselect +:substitute +:sunhide +:sunmap +:sunmenu +:suspend +:sview +:swapname +:syncbind +:syntax +:syntime +:tab +:tabclose +:tabdo +:tabedit +:tabfind +:tabfirst +:tablast +:tabmove +:tabnew +:tabnext +:tabNext +:tabonly +:tabprevious +:tabrewind +:tabs +:tag +:tags +:tcd +:tchdir +:tcl +:tcldo +:tclfile +:tearoff +:terminal +:tfirst +:throw +:tjump +:tlast +:tlmenu +:tlnoremenu +:tlunmenu +:tmap +:tmapclear +:tmenu +:tnext +:tNext +:tnoremap +:topleft +:tprevious +:trewind +:try +:tselect +:tunmap +:tunmenu +:type +:unabbreviate +:unabbreviate +:undo +:undojoin +:undolist +:unhide +:unlockvar +:unmap +:unmenu +:unsilent +:update +:var +:verbose +:version +:vertical +:vglobal/.../ +:view +:vim9cmd +# :vim9script +:vimgrep +:vimgrepadd +:visual +:viusage +:vmap +:vmapclear +:vmenu +:vnew +:vnoremap +:vnoremenu +:vsplit +:vunmap +:vunmenu +:wall +:while +:wincmd +:windo +:winpos +:winsize +:wnext +:wNext +:wprevious +:wq +:wqall +:write +:wundo +:wviminfo +:xall +:xmap +:xmapclear +:xmenu +:xnoremap +:xnoremenu +:xrestore +:xunmap +:xunmenu +:yank +:z + +Foo()|help +Foo() | help +Foo() |help +Foo()| help + +Foo() | 2match +Foo() | 3match +Foo() | abbreviate +Foo() | abclear +Foo() | aboveleft +Foo() | abstract +Foo() | all +Foo() | amenu +Foo() | anoremenu +Foo() | argadd +Foo() | argdedupe +Foo() | argdelete +Foo() | argdo +Foo() | argedit +Foo() | argglobal +Foo() | arglocal +Foo() | args +Foo() | argument +Foo() | ascii +Foo() | augroup Foo | augroup END +Foo() | aunmenu +Foo() | autocmd +Foo() | badd +Foo() | ball +Foo() | balt +Foo() | bdelete +Foo() | behave mswin +Foo() | behave xterm +Foo() | belowright +Foo() | bfirst +Foo() | blast +Foo() | bmodified +Foo() | bnext +Foo() | bNext +Foo() | botright +Foo() | bprevious +Foo() | break +Foo() | breakadd +Foo() | breakdel +Foo() | breaklist +Foo() | brewind +Foo() | browse +Foo() | bufdo +Foo() | buffer +Foo() | buffers +Foo() | bunload +Foo() | bwipeout +Foo() | cabbrev +Foo() | cabclear +Foo() | cabove +Foo() | caddbuffer +Foo() | caddexpr +Foo() | caddfile +Foo() | cafter +Foo() | call +Foo() | catch +Foo() | cbefore +Foo() | cbelow +Foo() | cbottom +Foo() | cbuffer +Foo() | cc +Foo() | cclose +Foo() | cd +Foo() | cdo +Foo() | center +Foo() | cexpr +Foo() | cfdo +Foo() | cfile +Foo() | cfirst +Foo() | cgetbuffer +Foo() | cgetexpr +Foo() | cgetfile +Foo() | changes +Foo() | chdir +Foo() | checkpath +Foo() | checktime +Foo() | chistory +Foo() | class +Foo() | class +Foo() | clast +Foo() | clearjumps +Foo() | clist +Foo() | close +Foo() | cmap +Foo() | cmapclear +Foo() | cmenu +Foo() | cnewer +Foo() | cnext +Foo() | cNext +Foo() | cnfile +Foo() | cNfile +Foo() | cnoreabbrev +Foo() | cnoremap +Foo() | cnoremenu +Foo() | colder +Foo() | colorscheme +Foo() | comclear +Foo() | command +Foo() | compiler +Foo() | confirm +Foo() | const +Foo() | continue +Foo() | copen +Foo() | copy +Foo() | cpfile +Foo() | cprevious +Foo() | cquit +Foo() | crewind +Foo() | cscope +Foo() | cstag +Foo() | cunabbrev +Foo() | cunmap +Foo() | cunmenu +Foo() | cwindow +Foo() | debug +Foo() | debuggreedy +Foo() | def +Foo() | defcompile +Foo() | defcompile +Foo() | defer +Foo() | delcommand +Foo() | delete +Foo() | delfunction +Foo() | delmarks +Foo() | diffget +Foo() | diffoff +Foo() | diffpatch +Foo() | diffput +Foo() | diffsplit +Foo() | diffthis +Foo() | diffupdate +Foo() | digraphs +Foo() | disassemble +Foo() | disassemble +Foo() | display +Foo() | djump +Foo() | dl +Foo() | dlist +Foo() | doautoall +Foo() | doautocmd +Foo() | dp +Foo() | drop +Foo() | dsearch +Foo() | dsplit +Foo() | earlier +Foo() | echo +Foo() | echoconsole +Foo() | echoerr +Foo() | echohl +Foo() | echomsg +Foo() | echon +Foo() | echowindow +Foo() | edit +Foo() | else +Foo() | elseif +Foo() | emenu +Foo() | endclass +Foo() | endclass +Foo() | enddef +Foo() | endenum +Foo() | endfor +Foo() | endfunction +Foo() | endif +Foo() | endinterface +Foo() | endtry +Foo() | endwhile +Foo() | enew +Foo() | enum +Foo() | eval +Foo() | ex +Foo() | execute +Foo() | exit +Foo() | export +Foo() | export +Foo() | exusage +Foo() | file +Foo() | files +Foo() | filetype +Foo() | filter +Foo() | final +Foo() | finally +Foo() | find +Foo() | finish +Foo() | first +Foo() | fixdel +Foo() | fold +Foo() | foldclose +Foo() | folddoclosed +Foo() | folddoopen +Foo() | foldopen +Foo() | for +Foo() | function +Foo() | global/.../ +Foo() | goto +Foo() | grep +Foo() | grepadd +Foo() | gui +Foo() | gvim +Foo() | hardcopy +Foo() | help +Foo() | helpclose +Foo() | helpfind +Foo() | helpgrep +Foo() | helptags +Foo() | hide +Foo() | highlight +Foo() | history +Foo() | horizontal +Foo() | iabbrev +Foo() | iabclear +Foo() | if +Foo() | ijump +Foo() | ilist +Foo() | imap +Foo() | imapclear +Foo() | imenu +Foo() | import +Foo() | inoreabbrev +Foo() | inoremap +Foo() | inoremenu +Foo() | interface +Foo() | intro +Foo() | isearch +Foo() | isplit +Foo() | iunabbrev +Foo() | iunmap +Foo() | iunmenu +Foo() | join +Foo() | jumps +Foo() | keepalt +Foo() | keepjumps +Foo() | keepmarks +Foo() | keeppatterns +Foo() | labove +Foo() | laddbuffer +Foo() | laddexpr +Foo() | laddfile +Foo() | lafter +Foo() | language +Foo() | last +Foo() | later +Foo() | lbefore +Foo() | lbelow +Foo() | lbottom +Foo() | lbuffer +Foo() | lcd +Foo() | lchdir +Foo() | lclose +Foo() | lcscope +Foo() | ldo +Foo() | left +Foo() | leftabove +Foo() | legacy +Foo() | lexpr +Foo() | lfdo +Foo() | lfile +Foo() | lfirst +Foo() | lgetbuffer +Foo() | lgetexpr +Foo() | lgetfile +Foo() | lgrep +Foo() | lgrepadd +Foo() | lhelpgrep +Foo() | lhistory +Foo() | list +Foo() | ll +Foo() | llast +Foo() | llist +Foo() | lmake +Foo() | lmap +Foo() | lmapclear +Foo() | lnewer +Foo() | lnext +Foo() | lNext +Foo() | lnfile +Foo() | lNfile +Foo() | lnoremap +# Foo() | loadkeymap # disabled - runs until EOF +Foo() | loadview +Foo() | lockmarks +Foo() | lockvar +Foo() | lolder +Foo() | lopen +Foo() | lpfile +Foo() | lprevious +Foo() | lrewind +Foo() | ls +Foo() | ltag +Foo() | lua +Foo() | luado +Foo() | luafile +Foo() | lunmap +Foo() | lvimgrep +Foo() | lvimgrepadd +Foo() | lwindow +Foo() | make +Foo() | mark +Foo() | move +Foo() | map +Foo() | mapclear +Foo() | marks +Foo() | match +Foo() | menu +Foo() | menutranslate +Foo() | messages +Foo() | mkexrc +Foo() | mksession +Foo() | mkspell +Foo() | mkview +Foo() | mkvimrc +Foo() | mzfile +Foo() | mzscheme +Foo() | nbclose +Foo() | nbkey +Foo() | nbstart +Foo() | new +Foo() | next +Foo() | nmap +Foo() | nmapclear +Foo() | nmenu +Foo() | nnoremap +Foo() | nnoremenu +Foo() | noautocmd +Foo() | nohlsearch +Foo() | noreabbrev +Foo() | noremap +Foo() | noremenu +Foo() | normal +Foo() | noswapfile +Foo() | number +Foo() | nunmap +Foo() | nunmenu +Foo() | oldfiles +Foo() | omap +Foo() | omapclear +Foo() | omenu +Foo() | only +Foo() | onoremap +Foo() | onoremenu +Foo() | options +Foo() | ounmap +Foo() | ounmenu +Foo() | ownsyntax +Foo() | packadd +Foo() | packloadall +Foo() | pclose +Foo() | pedit +Foo() | perl +Foo() | perldo +Foo() | pop +Foo() | popup +Foo() | ppop +Foo() | preserve +Foo() | previous +Foo() | print +Foo() | profdel +Foo() | profile +Foo() | promptfind +Foo() | promptrepl +Foo() | psearch +Foo() | ptag +Foo() | ptfirst +Foo() | ptjump +Foo() | ptlast +Foo() | ptnext +Foo() | ptNext +Foo() | ptprevious +Foo() | ptrewind +Foo() | ptselect +Foo() | public +Foo() | public +Foo() | put +Foo() | pwd +Foo() | py3 +Foo() | py3do +Foo() | py3file +Foo() | pydo +Foo() | pyfile +Foo() | python +Foo() | python3 +Foo() | pythonx +Foo() | pyx +Foo() | pyxdo +Foo() | pyxfile +Foo() | qall +Foo() | quit +Foo() | quitall +Foo() | read +Foo() | recover +Foo() | redir +Foo() | redo +Foo() | redraw +Foo() | redrawstatus +Foo() | redrawtabline +Foo() | registers +Foo() | resize +Foo() | retab +Foo() | return +Foo() | rewind +Foo() | right +Foo() | rightbelow +Foo() | ruby +Foo() | rubydo +Foo() | rubyfile +Foo() | rundo +Foo() | runtime +Foo() | rviminfo +Foo() | sall +Foo() | sandbox +Foo() | sargument +Foo() | saveas +Foo() | sball +Foo() | sbfirst +Foo() | sblast +Foo() | sbmodified +Foo() | sbnext +Foo() | sbNext +Foo() | sbprevious +Foo() | sbrewind +Foo() | sbuffer +Foo() | scriptencoding +Foo() | scriptnames +Foo() | scriptversion +Foo() | scscope +Foo() | set +Foo() | setfiletype +Foo() | setglobal +Foo() | setlocal +Foo() | sfind +Foo() | sfirst +Foo() | shell +Foo() | sign +Foo() | silent +Foo() | simalt +Foo() | slast +Foo() | sleep +Foo() | sleep! +Foo() | smagic +Foo() | smap +Foo() | smapclear +Foo() | smenu +Foo() | smile +Foo() | snext +Foo() | sNext +Foo() | snomagic +Foo() | snoremap +Foo() | snoremenu +Foo() | sort +Foo() | source +Foo() | spelldump +Foo() | spellgood +Foo() | spellinfo +Foo() | spellrare +Foo() | spellrepall +Foo() | spellundo +Foo() | spellwrong +Foo() | split +Foo() | sprevious +Foo() | srewind +Foo() | stag +Foo() | startgreplace +Foo() | startinsert +Foo() | startreplace +Foo() | static +Foo() | static +Foo() | stjump +Foo() | stop +Foo() | stopinsert +Foo() | stselect +Foo() | substitute +Foo() | sunhide +Foo() | sunmap +Foo() | sunmenu +Foo() | suspend +Foo() | sview +Foo() | swapname +Foo() | syncbind +Foo() | syntax +Foo() | syntime +Foo() | tab +Foo() | tabclose +Foo() | tabdo +Foo() | tabedit +Foo() | tabfind +Foo() | tabfirst +Foo() | tablast +Foo() | tabmove +Foo() | tabnew +Foo() | tabnext +Foo() | tabNext +Foo() | tabonly +Foo() | tabprevious +Foo() | tabrewind +Foo() | tabs +Foo() | tag +Foo() | tags +Foo() | tcd +Foo() | tchdir +Foo() | tcl +Foo() | tcldo +Foo() | tclfile +Foo() | tearoff +Foo() | terminal +Foo() | tfirst +Foo() | throw +Foo() | tjump +Foo() | tlast +Foo() | tlmenu +Foo() | tlnoremenu +Foo() | tlunmenu +Foo() | tmap +Foo() | tmapclear +Foo() | tmenu +Foo() | tnext +Foo() | tNext +Foo() | tnoremap +Foo() | topleft +Foo() | tprevious +Foo() | trewind +Foo() | try +Foo() | tselect +Foo() | tunmap +Foo() | tunmenu +Foo() | type +Foo() | unabbreviate +Foo() | unabbreviate +Foo() | undo +Foo() | undojoin +Foo() | undolist +Foo() | unhide +Foo() | unlockvar +Foo() | unmap +Foo() | unmenu +Foo() | unsilent +Foo() | update +Foo() | var +Foo() | verbose +Foo() | version +Foo() | vertical +Foo() | vglobal/.../ +Foo() | vim9cmd +# call Foo() | vim9script +Foo() | vimgrep +Foo() | vimgrepadd +Foo() | visual +Foo() | viusage +Foo() | view +Foo() | vmap +Foo() | vmapclear +Foo() | vmenu +Foo() | vnew +Foo() | vnoremap +Foo() | vnoremenu +Foo() | vsplit +Foo() | vunmap +Foo() | vunmenu +Foo() | windo +Foo() | write +Foo() | wNext +Foo() | wall +Foo() | while +Foo() | winsize +Foo() | wincmd +Foo() | winpos +Foo() | wnext +Foo() | wprevious +Foo() | wq +Foo() | wqall +Foo() | wundo +Foo() | wviminfo +Foo() | xall +Foo() | xmapclear +Foo() | xmap +Foo() | xmenu +Foo() | xrestore +Foo() | xnoremap +Foo() | xnoremenu +Foo() | xunmap +Foo() | xunmenu +Foo() | yank +Foo() | z + + +# Legacy-script only + +:Print +:append + text +. +:change + text +. +:insert + text +. +:k +:let +:mode +:open +:t +:unlet +:xit + +Foo() | append + text +. +Foo() | change + text +. +Foo() | insert + text +. +Foo() | k +Foo() | let +Foo() | mode +Foo() | open +Foo() | t +Foo() | unlet +Foo() | xit + diff --git a/runtime/syntax/testdir/input/vim9_ex_function_def_tail_comment_errors.vim b/runtime/syntax/testdir/input/vim9_ex_function_def_tail_comment_errors.vim new file mode 100644 index 0000000..b4b9f6d --- /dev/null +++ b/runtime/syntax/testdir/input/vim9_ex_function_def_tail_comment_errors.vim @@ -0,0 +1,44 @@ +vim9script + +# Vim9 :function and :def tail comment errors +# VIM_TEST_SETUP unlet! g:vimsyn_folding + +fun Test1() abort # fun + return 1 +endfun # endfun + +def Test2(): number " def + return 2 +enddef " enddef + +fun Test3() abort # fun + fun s:DoTest3() abort # fun + return 3 + endfun # endfun + return s:DoTest3() +endfun # endfun + +def Test4(): number " def + def DoTest4(): number " def + return 4 + enddef " enddef + return DoTest4() +enddef " enddef + +def Test5(): number " def + fun DoTest5() abort # fun + return 5 + endfun # endfun + return DoTest5() +enddef " enddef + +fun Test6() abort # fun + def s:DoTest6(): number " def + return 6 + enddef " enddef + return s:DoTest6() +endfun # endfun + +for d in range(1, 6) + exec $'echo Test{d}()' +endfor diff --git a/runtime/syntax/testdir/input/vim9_ex_function_def_tail_comments.vim b/runtime/syntax/testdir/input/vim9_ex_function_def_tail_comments.vim new file mode 100644 index 0000000..12f7942 --- /dev/null +++ b/runtime/syntax/testdir/input/vim9_ex_function_def_tail_comments.vim @@ -0,0 +1,44 @@ +vim9script + +# Vim9 :function and :def tail comments +# VIM_TEST_SETUP unlet! g:vimsyn_folding + +fun Test1() abort " fun + return 1 +endfun " endfun + +def Test2(): number # def + return 2 +enddef # enddef + +fun Test3() abort " fun + fun s:DoTest3() abort " fun + return 3 + endfun " endfun + return s:DoTest3() +endfun " endfun + +def Test4(): number # def + def DoTest4(): number # def + return 4 + enddef # enddef + return DoTest4() +enddef # enddef + +def Test5(): number # def + fun DoTest5() abort " fun + return 5 + endfun " endfun + return DoTest5() +enddef # enddef + +fun Test6() abort " fun + def s:DoTest6(): number # def + return 6 + enddef # enddef + return s:DoTest6() +endfun " endfun + +for d in range(1, 6) + exec $'echo Test{d}()' +endfor diff --git a/runtime/syntax/testdir/input/vim9_keymap.vim b/runtime/syntax/testdir/input/vim9_ex_loadkeymap.vim index a69b723..126c6dd 100644 --- a/runtime/syntax/testdir/input/vim9_keymap.vim +++ b/runtime/syntax/testdir/input/vim9_ex_loadkeymap.vim @@ -1,10 +1,10 @@ vim9script -# Vim Keymap file for syntax testing +# Vim :loadkeymap command scriptencoding utf-8 -let b:keymap_name = "syntax-test" +b:keymap_name = "syntax-test" loadkeymap diff --git a/runtime/syntax/testdir/input/vim_ex_call.vim b/runtime/syntax/testdir/input/vim_ex_call.vim new file mode 100644 index 0000000..ae6bdc9 --- /dev/null +++ b/runtime/syntax/testdir/input/vim_ex_call.vim @@ -0,0 +1,51 @@ +" Vim :call command + + +" functions for which there are same-named Ex commands + +call browse(save, title, initdir, default) +call call(func, arglist, dict) +call chdir(dir) +call confirm(msg, choices, default, type) +call copy(expr) +call delete(fname, flags) +call eval(string) +call execute(command) +call filter(expr1, expr2) +call function(name, arglist, dict) +call insert(object, item, idx) +call join(list, sep) +call map(expr1, expr2) +call match(expr, pat, start, count) +call mode(expr) +call sort(list, how, dict) +call split(string, pattern, keepempty) +call substitute(str, pat, sub, flags) +call swapname(buf) + +call browse (save, title, initdir, default) +call call (func, arglist, dict) +call chdir (dir) +call confirm (msg, choices, default, type) +call copy (expr) +call delete (fname, flags) +call eval (string) +call execute (command) +call filter (expr1, expr2) +call function (name, arglist, dict) +call insert (object, item, idx) +call join (list, sep) +call map (expr1, expr2) +call match (expr, pat, start, count) +call mode (expr) +call sort (list, how, dict) +call split (string, pattern, keepempty) +call substitute (str, pat, sub, flags) +call swapname (buf) + +call Foo() +call Foo(arg1) +call Foo(arg1, arg2) + +let res = call(func, arglist, dict) +let res = call (func, arglist, dict) diff --git a/runtime/syntax/testdir/input/vim_ex_commands.vim b/runtime/syntax/testdir/input/vim_ex_commands.vim index aaa351b..3d03ac3 100644 --- a/runtime/syntax/testdir/input/vim_ex_commands.vim +++ b/runtime/syntax/testdir/input/vim_ex_commands.vim @@ -98,7 +98,6 @@ :checkpath :checktime :chistory -:class :clast :clearjumps :clist @@ -172,7 +171,6 @@ :else :elseif :emenu -:endclass :enddef :endif :endfor @@ -184,7 +182,6 @@ :ex :execute :exit -:export :exusage :file :files @@ -292,7 +289,7 @@ :lnewer :lnfile :lnoremap -:loadkeymap +" :loadkeymap " disabled - runs until EOF :loadview :lockmarks :lockvar @@ -313,8 +310,7 @@ :move :mark :make -" requires trailing whitespace to distinguish from map() -:map +:map :mapclear :marks :match @@ -553,12 +549,10 @@ :unsilent :update :vglobal/.../ -:var :version :verbose :vertical :vim9cmd -" :vim9script :vimgrep :vimgrepadd :visual @@ -691,7 +685,6 @@ call Foo() | chdir call Foo() | checkpath call Foo() | checktime call Foo() | chistory -call Foo() | class call Foo() | clast call Foo() | clearjumps call Foo() | clist @@ -765,7 +758,6 @@ call Foo() | echowindow call Foo() | else call Foo() | elseif call Foo() | emenu -call Foo() | endclass call Foo() | enddef call Foo() | endif call Foo() | endfor @@ -777,7 +769,6 @@ call Foo() | eval call Foo() | ex call Foo() | execute call Foo() | exit -call Foo() | export call Foo() | exusage call Foo() | file call Foo() | files @@ -886,7 +877,7 @@ call Foo() | lnext call Foo() | lnewer call Foo() | lnfile call Foo() | lnoremap -call Foo() | loadkeymap +" call Foo() | loadkeymap " disabled - runs until EOF call Foo() | loadview call Foo() | lockmarks call Foo() | lockvar @@ -907,8 +898,7 @@ call Foo() | lwindow call Foo() | move call Foo() | mark call Foo() | make -" requires trailing whitespace to distinguish from map() -call Foo() | map +call Foo() | map call Foo() | mapclear call Foo() | marks call Foo() | match @@ -1147,12 +1137,10 @@ call Foo() | unmenu call Foo() | unsilent call Foo() | update call Foo() | vglobal/.../ -call Foo() | var call Foo() | version call Foo() | verbose call Foo() | vertical call Foo() | vim9cmd -" call Foo() | vim9script call Foo() | vimgrep call Foo() | vimgrepadd call Foo() | visual @@ -1193,3 +1181,39 @@ call Foo() | xunmap call Foo() | xunmenu call Foo() | yank call Foo() | z + + +" Vim9-script only + +:abstract +:class +:defcompile +:disassemble +:endclass +:endinterface +:endenum +:enum +:export +:final +:interface +:public +:static +:type +:var + +Foo() | abstract +Foo() | class +Foo() | defcompile +Foo() | disassemble +Foo() | endclass +Foo() | endenum +Foo() | endinterface +Foo() | enum +Foo() | export +Foo() | final +Foo() | interface +Foo() | public +Foo() | static +Foo() | type +Foo() | var + diff --git a/runtime/syntax/testdir/input/vim_ex_def.vim b/runtime/syntax/testdir/input/vim_ex_def.vim index 2685ba5..a1d5381 100644 --- a/runtime/syntax/testdir/input/vim_ex_def.vim +++ b/runtime/syntax/testdir/input/vim_ex_def.vim @@ -85,7 +85,7 @@ def Foo() enddef | echo "Foo" def Foo() -enddef " comment +enddef # comment " parameters diff --git a/runtime/syntax/testdir/input/vim_ex_def_fold.vim b/runtime/syntax/testdir/input/vim_ex_def_fold.vim index 3326075..60b1151 100644 --- a/runtime/syntax/testdir/input/vim_ex_def_fold.vim +++ b/runtime/syntax/testdir/input/vim_ex_def_fold.vim @@ -86,7 +86,7 @@ def Foo() enddef | echo "Foo" def Foo() -enddef " comment +enddef # comment " parameters @@ -120,7 +120,7 @@ def Foo() enddef def Foo() - let x =<< END + var x =<< trim END endfunction END enddef diff --git a/runtime/syntax/testdir/input/vim_ex_function_def_tail_comment_errors.vim b/runtime/syntax/testdir/input/vim_ex_function_def_tail_comment_errors.vim new file mode 100644 index 0000000..e5d7464 --- /dev/null +++ b/runtime/syntax/testdir/input/vim_ex_function_def_tail_comment_errors.vim @@ -0,0 +1,43 @@ +" Vim :function and :def tail comment errors +" VIM_TEST_SETUP unlet! g:vimsyn_folding + +fun s:Test1() abort # fun + return 1 +endfun # endfun + +def s:Test2(): number " def + return 2 +enddef " enddef + +fun s:Test3() abort # fun + fun s:DoTest3() abort # fun + return 3 + endfun # endfun + return s:DoTest3() +endfun # endfun + +def s:Test4(): number " def + def DoTest4(): number " def + return 4 + enddef " enddef + return DoTest4() +enddef " enddef + +def s:Test5(): number " def + fun DoTest5() abort # fun + return 5 + endfun # endfun + return DoTest5() +enddef " enddef + +fun s:Test6() abort # fun + def s:DoTest6(): number " def + return 6 + enddef " enddef + return s:DoTest6() +endfun # endfun + +for d in range(1, 6)->reverse() + exec $'echo s:Test{d}()' + exec $'delfunction s:Test{d}' +endfor diff --git a/runtime/syntax/testdir/input/vim_ex_function_def_tail_comments.vim b/runtime/syntax/testdir/input/vim_ex_function_def_tail_comments.vim new file mode 100644 index 0000000..e46bf75 --- /dev/null +++ b/runtime/syntax/testdir/input/vim_ex_function_def_tail_comments.vim @@ -0,0 +1,43 @@ +" Vim :function and :def tail comments +" VIM_TEST_SETUP unlet! g:vimsyn_folding + +fun s:Test1() abort " fun + return 1 +endfun " endfun + +def s:Test2(): number # def + return 2 +enddef # enddef + +fun s:Test3() abort " fun + fun s:DoTest3() abort " fun + return 3 + endfun " endfun + return s:DoTest3() +endfun " endfun + +def s:Test4(): number # def + def DoTest4(): number # def + return 4 + enddef # enddef + return DoTest4() +enddef # enddef + +def s:Test5(): number # def + fun DoTest5() abort " fun + return 5 + endfun " endfun + return DoTest5() +enddef # enddef + +fun s:Test6() abort " fun + def s:DoTest6(): number # def + return 6 + enddef # enddef + return s:DoTest6() +endfun " endfun + +for d in range(1, 6)->reverse() + exec $'echo s:Test{d}()' + exec $'delfunction s:Test{d}' +endfor diff --git a/runtime/syntax/testdir/input/vim_ex_function_fold.vim b/runtime/syntax/testdir/input/vim_ex_function_fold.vim index dd260ca..fa7edbb 100644 --- a/runtime/syntax/testdir/input/vim_ex_function_fold.vim +++ b/runtime/syntax/testdir/input/vim_ex_function_fold.vim @@ -193,10 +193,9 @@ function Foo() endfunction function Foo() - let x =<< END + let x =<< trim END endfunction END - endfunction function Foo() diff --git a/runtime/syntax/testdir/input/vim_ex_let_heredoc.vim b/runtime/syntax/testdir/input/vim_ex_let_heredoc.vim new file mode 100644 index 0000000..2f88f93 --- /dev/null +++ b/runtime/syntax/testdir/input/vim_ex_let_heredoc.vim @@ -0,0 +1,196 @@ +" Vim :let heredoc command +" VIM_TEST_SETUP let g:vimsyn_folding = "h" +" VIM_TEST_SETUP setl fdc=2 fdl=99 fdm=syntax + + +let foo =<< END +line1 +line2 +END + + let foo =<< END +line1 +line2 +END + + +" trim + +let foo =<< trim END + line1 + line2 +END + + let foo =<< trim END + line1 + line2 + END + + +" interpolation + +let foo =<< eval END +line{1 + 0} +line{1 + 1} +END + + let foo =<< eval END +line{1 + 0} +line{1 + 1} +END + +let foo =<< trim eval END + line{1 + 0} + line{1 + 1} +END + + let foo =<< trim eval END + line{1 + 0} + line{1 + 1} + END + +" no interpolation (escaped { and }) + +let foo =<< eval END +line{{1 + 0}} +line{{1 + 1}} +END + + let foo =<< eval END +line{{1 + 0}} +line{{1 + 1}} +END + +let foo =<< trim eval END + line{{1 + 0}} + line{{1 + 1}} +END + + let foo =<< trim eval END + line{{1 + 0}} + line{{1 + 1}} + END + + +" no interpolation + +let foo =<< END +line{1 + 0} +line{1 + 1} +END + + let foo =<< END +line{1 + 0} +line{1 + 1} +END + +let foo =<< trim END + line{1 + 0} + line{1 + 1} +END + + let foo =<< trim END + line{1 + 0} + line{1 + 1} + END + + +" end marker must not be followed by whitespace + +" assert_equal(foo, ["END "]) +let foo =<< END +END +END + +" assert_equal(foo, [" END "]) +let foo =<< END + END +END + +" assert_equal(foo, ["END "]) +let foo =<< trim END + END +END + +" assert_equal(foo, ["END "]) + let foo =<< trim END + END + END + + +" end marker must be vertically aligned with :let (if preceded by whitespace) + +" assert_equal(foo, ["END"]) +let foo =<< trim END + END +END + + " assert_equal(foo, ["END"]) + let foo =<< trim END + END + END + +" assert_equal(foo, ["END "]) +let foo =<< trim END +END +END + + " assert_equal(foo, ["END"]) + let foo =<< trim END + END + END + + " assert_equal(foo, ["END "]) + let foo =<< trim END + END + END + + " assert_equal(foo, ["END"]) + let foo =<< trim END + END + END + + " assert_equal(foo, ["END "]) + let foo =<< trim END + END + END + + " assert_equal(foo, ["END "]) + let foo =<< trim END +END +END + + " assert_equal(foo, ["END"]) + let foo =<< trim END + END +END + + " assert_equal(foo, ["END"]) + let foo =<< trim END + END +END + + +" end markers + +let foo =<< !@#$%^&*()_+ +line1 +line2 +!@#$%^&*()_+ + +let foo =<< 0!@#$%^&*()_+ +line1 +line2 +0!@#$%^&*()_+ + +let foo =<< A!@#$%^&*()_+ +line1 +line2 +A!@#$%^&*()_+ + +" error - leading lowercase character +let foo =<< a!@#$%^&*()_+ +line1 +line2 +a!@#$%^&*()_+ + diff --git a/runtime/syntax/testdir/input/vim_ex_loadkeymap.vim b/runtime/syntax/testdir/input/vim_ex_loadkeymap.vim new file mode 100644 index 0000000..8f4484d --- /dev/null +++ b/runtime/syntax/testdir/input/vim_ex_loadkeymap.vim @@ -0,0 +1,24 @@ +" Vim :loadkeymap command + +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 +<char-62> B Special notation allowed in LHS - decimal +c <char-0103> Special notation allowed in RHS - octal +<char-0x0064> <char-0x0044> Special notation allowed in LHS and RHS - hexadecimal + +" Vim-script comment characters +# <char-0x00a3> 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 diff --git a/runtime/syntax/testdir/input/vim_ex_loadkeymap_after_bar.vim b/runtime/syntax/testdir/input/vim_ex_loadkeymap_after_bar.vim new file mode 100644 index 0000000..029af2c --- /dev/null +++ b/runtime/syntax/testdir/input/vim_ex_loadkeymap_after_bar.vim @@ -0,0 +1,10 @@ +" Vim :loadkeymap command (after "|") + +scriptencoding utf-8 + +let b:keymap_name = "syntax-test" + +echo "..." | loadkeymap + +a A Basic mapping + diff --git a/runtime/syntax/testdir/input/vim_ex_loadkeymap_after_colon.vim b/runtime/syntax/testdir/input/vim_ex_loadkeymap_after_colon.vim new file mode 100644 index 0000000..61578b6 --- /dev/null +++ b/runtime/syntax/testdir/input/vim_ex_loadkeymap_after_colon.vim @@ -0,0 +1,10 @@ +" Vim :loadkeymap command (after ":") + +scriptencoding utf-8 + +let b:keymap_name = "syntax-test" + +:loadkeymap + +a A Basic mapping + diff --git a/runtime/syntax/testdir/input/vim_ex_map.vim b/runtime/syntax/testdir/input/vim_ex_map.vim index 95f4292..3ddc9e9 100644 --- a/runtime/syntax/testdir/input/vim_ex_map.vim +++ b/runtime/syntax/testdir/input/vim_ex_map.vim @@ -5,9 +5,6 @@ map! lhs rhs map map lhs rhs -call map(list, 'v:val') -call map (list, 'v:val') - mapclear <buffer> mapclear! <buffer> nmapclear <buffer> @@ -69,6 +66,27 @@ map lhs echo "clear" +" Differentiate map() from :map + +map ( :echo "open-paren"<CR> + +call map(list, 'v:val') +call map (list, 'v:val') + +function Foo() + map ( :echo "open-paren"<CR> + call map(list, 'v:val') + call map (list, 'v:val') +endfunction + +def Foo() + map ( :echo "open-paren"<CR> + map(list, 'v:val') + # :map LHS=(list, RHS='v:val') + map (list, 'v:val') +enddef + + " Issue #12672 nnoremap <leader>foo :echo call( diff --git a/runtime/syntax/testdir/input/vim_ex_match.vim b/runtime/syntax/testdir/input/vim_ex_match.vim new file mode 100644 index 0000000..8d14628 --- /dev/null +++ b/runtime/syntax/testdir/input/vim_ex_match.vim @@ -0,0 +1,32 @@ +" Vim :match, :2match and :3match commands + +match FooGroup /Foo/ +match +match none + +2match FooGroup /Foo/ +2match +2match none + +3match FooGroup /Foo/ +3match +3match none + + +" Differentiate map() from :map + +call match(haystack, 'needle') +call match (haystack, 'needle') + +function Foo() + match FooGroup /Foo/ + call match(haystack, 'needle') + call match (haystack, 'needle') +endfunction + +def Foo() + match FooGroup /Foo/ + match(haystack, 'needle') + # Error: bad :match command - trailing characters + match (haystack, 'needle') +enddef diff --git a/runtime/syntax/testdir/input/vim_ex_range.vim b/runtime/syntax/testdir/input/vim_ex_range.vim new file mode 100644 index 0000000..3383702 --- /dev/null +++ b/runtime/syntax/testdir/input/vim_ex_range.vim @@ -0,0 +1,6 @@ +" Ex command ranges + +'<,'>print +'(,')print +'{,'}print +'[,']print diff --git a/runtime/syntax/testdir/input/vim_ex_set.vim b/runtime/syntax/testdir/input/vim_ex_set.vim new file mode 100644 index 0000000..00e53a0 --- /dev/null +++ b/runtime/syntax/testdir/input/vim_ex_set.vim @@ -0,0 +1,93 @@ +" Vim :set command + +set +set! +set all +set! all +set termcap +set! termcap + +set aleph? +set aleph + +set noallowrevins + +set allowrevins! +set invallowrevins + +set aleph& +set aleph&vi +set aleph&vim + +set all& + +set aleph=128 +set aleph:128 + +set aleph =128 +set aleph :128 + +set aleph+=96 +set aleph^=2 +set aleph-=96 + +set backspace+=nostop +set backspace^=nostop +set backspace-=nostop + +set ai nosi sw=3 tw=3 + +set <t_#4>=^[Ot " FIXME +set <M-b>=^[b " FIXME + +setlocal autoread +setglobal noautoread +set autoread< + + +" :help option-backslash + +" When setting options using |:let| and |literal-string|, you need to use one +" fewer layer of backslash. A few examples: +set makeprg=make\ file " results in "make file" +let &makeprg='make file' " (same as above) +set makeprg=make\\\ file " results in "make\ file" +set tags=tags\ /usr/tags " results in "tags" and "/usr/tags" +set tags=tags\\\ file " results in "tags file" +let &tags='tags\ file' " (same as above) + +set makeprg=make,file " results in "make,file" +set makeprg=make\\,file " results in "make\,file" +set tags=tags,file " results in "tags" and "file" +set tags=tags\\,file " results in "tags,file" +let &tags='tags\,file' " (same as above) + +" This example sets the 'titlestring' option to "hi|there": +set titlestring=hi\|there +" This sets the 'titlestring' option to "hi" and 'iconstring' to "there": +set titlestring=hi|set iconstring=there + +set dir=\\machine\path " results in "\\machine\path" +set dir=\\\\machine\\path " results in "\\machine\path" +set dir=\\path\\file " results in "\\path\file" (wrong!) + + +" :help :set_env + +set term=$TERM.new +set path=/usr/$INCLUDE,$HOME/include,. + + +" Multiline :set and option values + +set path=abc,def,ghi + "\ def is the 'define' option + \ def=abc,def,ghi + +set path=abc, + "\ def is a 'path' directory value + \def,ghi + +set path= + "\ def is a 'path' directory value + \abc,def diff --git a/runtime/syntax/testdir/input/yaml.yaml b/runtime/syntax/testdir/input/yaml.yaml index d87aca2..72e0a0d 100644 --- a/runtime/syntax/testdir/input/yaml.yaml +++ b/runtime/syntax/testdir/input/yaml.yaml @@ -24,7 +24,7 @@ not a number: [.nan, .NaN, .NAN] plain strings: - a b c - - a * b & c @ d# e : f # comment + - a:b & c @ d# e * f # comment - {{ f(' ') }} #8234 double quoted strings: - "" @@ -91,9 +91,10 @@ flow collection: inside block mapping: foo: {bar: baz} bar: ["foo": {baz: qux}] - flow collection: [foo # comment + flow:collection: [foo # comment , {bar: [{ # comment - baz: ' + baz: + ' qux # not comment ' # comment }]}] |