Regenerate nvim config
This commit is contained in:
@ -0,0 +1,6 @@
|
||||
if (( $(tree-sitter parse test/Petalisp/**/*.lisp -q | wc -l) > 2 )); then
|
||||
# ^ @punctuation.special
|
||||
# ^ @punctuation.special
|
||||
# ^ @punctuation.bracket
|
||||
exit 1
|
||||
fi
|
||||
@ -0,0 +1,21 @@
|
||||
enum Foo{
|
||||
a,
|
||||
// ^ @constant
|
||||
aa,
|
||||
// ^ @constant
|
||||
C,
|
||||
};
|
||||
|
||||
void foo(enum Foo f){
|
||||
switch ( f ) {
|
||||
case a:
|
||||
// ^ @constant
|
||||
break;
|
||||
case aa:
|
||||
// ^ @constant
|
||||
break;
|
||||
case C:
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,633 @@
|
||||
# Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors
|
||||
# Licensed under the MIT License:
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
@0xd508eebdc2dc42b8;
|
||||
# <- @keyword.directive
|
||||
# ^ @punctuation.delimiter
|
||||
|
||||
using Cxx = import "c++.capnp";
|
||||
# <- @keyword.import
|
||||
# ^^^ @type
|
||||
# ^ @operator
|
||||
# ^^^^^^ @keyword.import
|
||||
# ^^^^^^^^^^^ @string.special.path
|
||||
|
||||
# Use a namespace likely to cause trouble if the generated code doesn't use fully-qualified
|
||||
# names for stuff in the capnproto namespace.
|
||||
$Cxx.namespace("capnproto_test::capnp::test");
|
||||
|
||||
enum TestEnum {
|
||||
# <- @keyword.type
|
||||
# ^^^^^^^^ @type
|
||||
foo @0;
|
||||
# ^^^ @constant
|
||||
# ^^ @label
|
||||
bar @1;
|
||||
baz @2;
|
||||
qux @3;
|
||||
quux @4;
|
||||
corge @5;
|
||||
grault @6;
|
||||
garply @7;
|
||||
}
|
||||
# <- @punctuation.bracket
|
||||
|
||||
struct TestAllTypes {
|
||||
# <- @keyword.type
|
||||
voidField @0 : Void;
|
||||
# ^^^^^^^^^ @variable.member
|
||||
# ^ @punctuation.special
|
||||
# ^^^^ @type.builtin
|
||||
boolField @1 : Bool;
|
||||
int8Field @2 : Int8;
|
||||
int16Field @3 : Int16;
|
||||
int32Field @4 : Int32;
|
||||
int64Field @5 : Int64;
|
||||
uInt8Field @6 : UInt8;
|
||||
uInt16Field @7 : UInt16;
|
||||
uInt32Field @8 : UInt32;
|
||||
uInt64Field @9 : UInt64;
|
||||
float32Field @10 : Float32;
|
||||
float64Field @11 : Float64;
|
||||
textField @12 : Text;
|
||||
dataField @13 : Data;
|
||||
structField @14 : TestAllTypes;
|
||||
enumField @15 : TestEnum;
|
||||
interfaceField @16 : Void; # TODO
|
||||
|
||||
voidList @17 : List(Void);
|
||||
boolList @18 : List(Bool);
|
||||
int8List @19 : List(Int8);
|
||||
int16List @20 : List(Int16);
|
||||
int32List @21 : List(Int32);
|
||||
int64List @22 : List(Int64);
|
||||
uInt8List @23 : List(UInt8);
|
||||
uInt16List @24 : List(UInt16);
|
||||
uInt32List @25 : List(UInt32);
|
||||
uInt64List @26 : List(UInt64);
|
||||
float32List @27 : List(Float32);
|
||||
float64List @28 : List(Float64);
|
||||
textList @29 : List(Text);
|
||||
dataList @30 : List(Data);
|
||||
structList @31 : List(TestAllTypes);
|
||||
enumList @32 : List(TestEnum);
|
||||
interfaceList @33 : List(Void); # TODO
|
||||
}
|
||||
|
||||
struct TestInterleavedGroups {
|
||||
group1 :group {
|
||||
foo @0 :UInt32;
|
||||
bar @2 :UInt64;
|
||||
union {
|
||||
# ^^^^^ @keyword.type
|
||||
qux @4 :UInt16;
|
||||
corge :group {
|
||||
# ^^^^^ @type
|
||||
grault @6 :UInt64;
|
||||
garply @8 :UInt16;
|
||||
plugh @14 :Text;
|
||||
xyzzy @16 :Text;
|
||||
}
|
||||
|
||||
fred @12 :Text;
|
||||
}
|
||||
|
||||
waldo @10 :Text;
|
||||
}
|
||||
|
||||
group2 :group {
|
||||
# ^^^^^ @keyword.type
|
||||
foo @1 :UInt32;
|
||||
bar @3 :UInt64;
|
||||
union {
|
||||
qux @5 :UInt16;
|
||||
corge :group {
|
||||
grault @7 :UInt64;
|
||||
garply @9 :UInt16;
|
||||
plugh @15 :Text;
|
||||
xyzzy @17 :Text;
|
||||
}
|
||||
|
||||
fred @13 :Text;
|
||||
}
|
||||
|
||||
waldo @11 :Text;
|
||||
}
|
||||
}
|
||||
|
||||
struct TestUnionDefaults {
|
||||
s16s8s64s8Set @0 :TestUnion =
|
||||
(union0 = (u0f0s16 = 321), union1 = (u1f0s8 = 123), union2 = (u2f0s64 = 12345678901234567),
|
||||
# ^^^ @number
|
||||
union3 = (u3f0s8 = 55));
|
||||
s0sps1s32Set @1 :TestUnion =
|
||||
(union0 = (u0f1s0 = void), union1 = (u1f0sp = "foo"), union2 = (u2f0s1 = true),
|
||||
# ^^^^^ @string
|
||||
# ^^^^ @boolean
|
||||
union3 = (u3f0s32 = 12345678));
|
||||
|
||||
unnamed1 @2 :TestUnnamedUnion = (foo = 123);
|
||||
unnamed2 @3 :TestUnnamedUnion = (bar = 321, before = "foo", after = "bar");
|
||||
}
|
||||
|
||||
struct TestUsing {
|
||||
using OuterNestedEnum = TestNestedTypes.NestedEnum;
|
||||
# ^^^^^ @keyword.import
|
||||
using TestNestedTypes.NestedStruct.NestedEnum;
|
||||
|
||||
outerNestedEnum @1 :OuterNestedEnum = bar;
|
||||
innerNestedEnum @0 :NestedEnum = quux;
|
||||
}
|
||||
|
||||
struct TestListDefaults {
|
||||
lists @0 :TestLists = (
|
||||
list0 = [(f = void), (f = void)],
|
||||
# ^^^^ @constant.builtin
|
||||
list1 = [(f = true), (f = false), (f = true), (f = true)],
|
||||
list8 = [(f = 123), (f = 45)],
|
||||
list16 = [(f = 12345), (f = 6789)],
|
||||
list32 = [(f = 123456789), (f = 234567890)],
|
||||
list64 = [(f = 1234567890123456), (f = 2345678901234567)],
|
||||
listP = [(f = "foo"), (f = "bar")],
|
||||
int32ListList = [[1, 2, 3], [4, 5], [12341234]],
|
||||
textListList = [["foo", "bar"], ["baz"], ["qux", "corge"]],
|
||||
structListList = [[(int32Field = 123), (int32Field = 456)], [(int32Field = 789)]]);
|
||||
}
|
||||
|
||||
struct TestWholeFloatDefault {
|
||||
# At one point, these failed to compile in C++ because it would produce literals like "123f",
|
||||
# which is not valid; it needs to be "123.0f".
|
||||
field @0 :Float32 = 123;
|
||||
bigField @1 :Float32 = 2e30;
|
||||
const constant :Float32 = 456;
|
||||
const bigConstant :Float32 = 4e30;
|
||||
# ^^^^ @number.float
|
||||
}
|
||||
|
||||
struct TestGenerics(Foo, Bar) {
|
||||
foo @0 :Foo;
|
||||
rev @1 :TestGenerics(Bar, Foo);
|
||||
|
||||
union {
|
||||
uv @2:Void;
|
||||
ug :group {
|
||||
ugfoo @3:Int32;
|
||||
}
|
||||
}
|
||||
|
||||
list @4 :List(Inner);
|
||||
# At one time this failed to compile with MSVC due to poor expression SFINAE support.
|
||||
|
||||
struct Inner {
|
||||
foo @0 :Foo;
|
||||
bar @1 :Bar;
|
||||
}
|
||||
|
||||
struct Inner2(Baz) {
|
||||
bar @0 :Bar;
|
||||
baz @1 :Baz;
|
||||
innerBound @2 :Inner;
|
||||
innerUnbound @3 :TestGenerics.Inner;
|
||||
|
||||
struct DeepNest(Qux) {
|
||||
foo @0 :Foo;
|
||||
bar @1 :Bar;
|
||||
baz @2 :Baz;
|
||||
qux @3 :Qux;
|
||||
|
||||
interface DeepNestInterface(Quux) {
|
||||
# ^^^^^^^^^ @keyword.type
|
||||
# At one time this failed to compile.
|
||||
call @0 () -> ();
|
||||
# ^^^^ @function.method
|
||||
# ^^ @punctuation.delimiter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface Interface(Qux) {
|
||||
call @0 Inner2(Text) -> (qux :Qux, gen :TestGenerics(TestAllTypes, TestAnyPointer));
|
||||
# ^^^ @variable.parameter
|
||||
# ^^^ @variable.parameter
|
||||
}
|
||||
|
||||
annotation ann(struct) :Foo;
|
||||
# ^^^^^^^^^^ @keyword.type
|
||||
# ^^^ @function.method
|
||||
# ^^^^^^ @variable.parameter.builtin
|
||||
|
||||
using AliasFoo = Foo;
|
||||
using AliasInner = Inner;
|
||||
using AliasInner2 = Inner2;
|
||||
using AliasInner2Text = Inner2(Text);
|
||||
using AliasRev = TestGenerics(Bar, Foo);
|
||||
|
||||
struct UseAliases {
|
||||
foo @0 :AliasFoo;
|
||||
inner @1 :AliasInner;
|
||||
inner2 @2 :AliasInner2;
|
||||
inner2Bind @3 :AliasInner2(Text);
|
||||
inner2Text @4 :AliasInner2Text;
|
||||
revFoo @5 :AliasRev.AliasFoo;
|
||||
}
|
||||
}
|
||||
|
||||
struct BoxedText { text @0 :Text; }
|
||||
using BrandedAlias = TestGenerics(BoxedText, Text);
|
||||
|
||||
struct TestGenericsWrapper(Foo, Bar) {
|
||||
value @0 :TestGenerics(Foo, Bar);
|
||||
}
|
||||
|
||||
struct TestGenericsWrapper2 {
|
||||
value @0 :TestGenericsWrapper(Text, TestAllTypes);
|
||||
}
|
||||
|
||||
interface TestImplicitMethodParams {
|
||||
call @0 [T, U] (foo :T, bar :U) -> TestGenerics(T, U);
|
||||
# ^ @type
|
||||
# ^ @type
|
||||
}
|
||||
|
||||
interface TestImplicitMethodParamsInGeneric(V) {
|
||||
call @0 [T, U] (foo :T, bar :U) -> TestGenerics(T, U);
|
||||
}
|
||||
|
||||
struct TestGenericsUnion(Foo, Bar) {
|
||||
# At one point this failed to compile.
|
||||
|
||||
union {
|
||||
foo @0 :Foo;
|
||||
bar @1 :Bar;
|
||||
}
|
||||
}
|
||||
|
||||
struct TestUseGenerics $TestGenerics(Text, Data).ann("foo") {
|
||||
# ^ @punctuation.special
|
||||
# ^^^^^^^^^^^^ @attribute
|
||||
# ^ @punctuation.delimiter
|
||||
# ^^^ @attribute
|
||||
basic @0 :TestGenerics(TestAllTypes, TestAnyPointer);
|
||||
inner @1 :TestGenerics(TestAllTypes, TestAnyPointer).Inner;
|
||||
inner2 @2 :TestGenerics(TestAllTypes, TestAnyPointer).Inner2(Text);
|
||||
unspecified @3 :TestGenerics;
|
||||
unspecifiedInner @4 :TestGenerics.Inner2(Text);
|
||||
wrapper @8 :TestGenericsWrapper(TestAllTypes, TestAnyPointer);
|
||||
cap @18 :TestGenerics(TestInterface, Text);
|
||||
genericCap @19 :TestGenerics(TestAllTypes, List(UInt32)).Interface(Data);
|
||||
|
||||
default @5 :TestGenerics(TestAllTypes, Text) =
|
||||
(foo = (int16Field = 123), rev = (foo = "text", rev = (foo = (int16Field = 321))));
|
||||
defaultInner @6 :TestGenerics(TestAllTypes, Text).Inner =
|
||||
(foo = (int16Field = 123), bar = "text");
|
||||
defaultUser @7 :TestUseGenerics = (basic = (foo = (int16Field = 123)));
|
||||
defaultWrapper @9 :TestGenericsWrapper(Text, TestAllTypes) =
|
||||
(value = (foo = "text", rev = (foo = (int16Field = 321))));
|
||||
defaultWrapper2 @10 :TestGenericsWrapper2 =
|
||||
(value = (value = (foo = "text", rev = (foo = (int16Field = 321)))));
|
||||
|
||||
aliasFoo @11 :TestGenerics(TestAllTypes, TestAnyPointer).AliasFoo = (int16Field = 123);
|
||||
aliasInner @12 :TestGenerics(TestAllTypes, TestAnyPointer).AliasInner
|
||||
= (foo = (int16Field = 123));
|
||||
aliasInner2 @13 :TestGenerics(TestAllTypes, TestAnyPointer).AliasInner2
|
||||
= (innerBound = (foo = (int16Field = 123)));
|
||||
aliasInner2Bind @14 :TestGenerics(TestAllTypes, TestAnyPointer).AliasInner2(List(UInt32))
|
||||
= (baz = [12, 34], innerBound = (foo = (int16Field = 123)));
|
||||
aliasInner2Text @15 :TestGenerics(TestAllTypes, TestAnyPointer).AliasInner2Text
|
||||
= (baz = "text", innerBound = (foo = (int16Field = 123)));
|
||||
aliasRev @16 :TestGenerics(TestAnyPointer, Text).AliasRev.AliasFoo = "text";
|
||||
|
||||
useAliases @17 :TestGenerics(TestAllTypes, List(UInt32)).UseAliases = (
|
||||
foo = (int16Field = 123),
|
||||
inner = (foo = (int16Field = 123)),
|
||||
inner2 = (innerBound = (foo = (int16Field = 123))),
|
||||
inner2Bind = (baz = "text", innerBound = (foo = (int16Field = 123))),
|
||||
inner2Text = (baz = "text", innerBound = (foo = (int16Field = 123))),
|
||||
revFoo = [12, 34, 56]);
|
||||
}
|
||||
|
||||
struct TestEmptyStruct {}
|
||||
|
||||
struct TestConstants {
|
||||
const voidConst :Void = void;
|
||||
# ^^^^^ @keyword.modifier
|
||||
const boolConst :Bool = true;
|
||||
const int8Const :Int8 = -123;
|
||||
const int16Const :Int16 = -12345;
|
||||
const int32Const :Int32 = -12345678;
|
||||
const int64Const :Int64 = -123456789012345;
|
||||
const uint8Const :UInt8 = 234;
|
||||
const uint16Const :UInt16 = 45678;
|
||||
const uint32Const :UInt32 = 3456789012;
|
||||
const uint64Const :UInt64 = 12345678901234567890;
|
||||
const float32Const :Float32 = 1234.5;
|
||||
const float64Const :Float64 = -123e45;
|
||||
const textConst :Text = "foo";
|
||||
const dataConst :Data = "bar";
|
||||
const structConst :TestAllTypes = (
|
||||
voidField = void,
|
||||
boolField = true,
|
||||
int8Field = -12,
|
||||
int16Field = 3456,
|
||||
int32Field = -78901234,
|
||||
int64Field = 56789012345678,
|
||||
uInt8Field = 90,
|
||||
uInt16Field = 1234,
|
||||
uInt32Field = 56789012,
|
||||
uInt64Field = 345678901234567890,
|
||||
float32Field = -1.25e-10,
|
||||
float64Field = 345,
|
||||
textField = "baz",
|
||||
dataField = "qux",
|
||||
structField = (
|
||||
textField = "nested",
|
||||
structField = (textField = "really nested")),
|
||||
enumField = baz,
|
||||
# interfaceField can't have a default
|
||||
|
||||
voidList = [void, void, void],
|
||||
boolList = [false, true, false, true, true],
|
||||
int8List = [12, -34, -0x80, 0x7f],
|
||||
int16List = [1234, -5678, -0x8000, 0x7fff],
|
||||
int32List = [12345678, -90123456, -0x80000000, 0x7fffffff],
|
||||
int64List = [123456789012345, -678901234567890, -0x8000000000000000, 0x7fffffffffffffff],
|
||||
uInt8List = [12, 34, 0, 0xff],
|
||||
uInt16List = [1234, 5678, 0, 0xffff],
|
||||
uInt32List = [12345678, 90123456, 0, 0xffffffff],
|
||||
uInt64List = [123456789012345, 678901234567890, 0, 0xffffffffffffffff],
|
||||
float32List = [0, 1234567, 1e37, -1e37, 1e-37, -1e-37],
|
||||
float64List = [0, 123456789012345, 1e306, -1e306, 1e-306, -1e-306],
|
||||
textList = ["quux", "corge", "grault"],
|
||||
dataList = ["garply", "waldo", "fred"],
|
||||
structList = [
|
||||
(textField = "x " "structlist"
|
||||
" 1"),
|
||||
(textField = "x structlist 2"),
|
||||
(textField = "x structlist 3")],
|
||||
enumList = [qux, bar, grault]
|
||||
# interfaceList can't have a default
|
||||
);
|
||||
const enumConst :TestEnum = corge;
|
||||
|
||||
const voidListConst :List(Void) = [void, void, void, void, void, void];
|
||||
const boolListConst :List(Bool) = [true, false, false, true];
|
||||
const int8ListConst :List(Int8) = [111, -111];
|
||||
const int16ListConst :List(Int16) = [11111, -11111];
|
||||
const int32ListConst :List(Int32) = [111111111, -111111111];
|
||||
const int64ListConst :List(Int64) = [1111111111111111111, -1111111111111111111];
|
||||
const uint8ListConst :List(UInt8) = [111, 222] ;
|
||||
const uint16ListConst :List(UInt16) = [33333, 44444];
|
||||
const uint32ListConst :List(UInt32) = [3333333333];
|
||||
const uint64ListConst :List(UInt64) = [11111111111111111111];
|
||||
const float32ListConst :List(Float32) = [5555.5, inf, -inf, nan];
|
||||
const float64ListConst :List(Float64) = [7777.75, inf, -inf, nan];
|
||||
const textListConst :List(Text) = ["plugh", "xyzzy", "thud"];
|
||||
const dataListConst :List(Data) = ["oops", "exhausted", "rfc3092"];
|
||||
const structListConst :List(TestAllTypes) = [
|
||||
(textField = "structlist 1"),
|
||||
(textField = "structlist 2"),
|
||||
(textField = "structlist 3")];
|
||||
const enumListConst :List(TestEnum) = [foo, garply];
|
||||
}
|
||||
|
||||
const globalInt :UInt32 = 12345;
|
||||
const globalText :Text = "foobar";
|
||||
const globalStruct :TestAllTypes = (int32Field = 54321);
|
||||
const globalPrintableStruct :TestPrintInlineStructs = (someText = "foo");
|
||||
const derivedConstant :TestAllTypes = (
|
||||
uInt32Field = .globalInt,
|
||||
textField = TestConstants.textConst,
|
||||
structField = TestConstants.structConst,
|
||||
int16List = TestConstants.int16ListConst,
|
||||
structList = TestConstants.structListConst);
|
||||
|
||||
const genericConstant :TestGenerics(TestAllTypes, Text) =
|
||||
(foo = (int16Field = 123), rev = (foo = "text", rev = (foo = (int16Field = 321))));
|
||||
|
||||
const embeddedData :Data = embed "testdata/packed";
|
||||
# ^^^^^ @keyword.import
|
||||
const embeddedText :Text = embed "testdata/short.txt";
|
||||
const embeddedStruct :TestAllTypes = embed "testdata/binary";
|
||||
|
||||
const nonAsciiText :Text = "♫ é ✓";
|
||||
|
||||
const blockText :Text =
|
||||
`foo bar baz
|
||||
`"qux" `corge` 'grault'
|
||||
"regular\"quoted\"line"
|
||||
`garply\nwaldo\tfred\"plugh\"xyzzy\'thud
|
||||
;
|
||||
|
||||
struct TestAnyPointerConstants {
|
||||
anyKindAsStruct @0 :AnyPointer;
|
||||
anyStructAsStruct @1 :AnyStruct;
|
||||
anyKindAsList @2 :AnyPointer;
|
||||
anyListAsList @3 :AnyList;
|
||||
}
|
||||
|
||||
const anyPointerConstants :TestAnyPointerConstants = (
|
||||
anyKindAsStruct = TestConstants.structConst,
|
||||
anyStructAsStruct = TestConstants.structConst,
|
||||
anyKindAsList = TestConstants.int32ListConst,
|
||||
anyListAsList = TestConstants.int32ListConst,
|
||||
);
|
||||
|
||||
interface TestInterface {
|
||||
foo @0 (i :UInt32, j :Bool) -> (x :Text);
|
||||
# ^ @variable.parameter
|
||||
bar @1 () -> ();
|
||||
baz @2 (s: TestAllTypes);
|
||||
}
|
||||
|
||||
interface TestExtends extends(TestInterface) {
|
||||
# ^^^^^^^ @keyword
|
||||
qux @0 ();
|
||||
corge @1 TestAllTypes -> ();
|
||||
grault @2 () -> TestAllTypes;
|
||||
}
|
||||
|
||||
interface TestTailCallee $Cxx.allowCancellation {
|
||||
struct TailResult {
|
||||
i @0 :UInt32;
|
||||
t @1 :Text;
|
||||
c @2 :TestCallOrder;
|
||||
}
|
||||
|
||||
foo @0 (i :Int32, t :Text) -> TailResult;
|
||||
}
|
||||
|
||||
interface TestTailCaller {
|
||||
foo @0 (i :Int32, callee :TestTailCallee) -> TestTailCallee.TailResult;
|
||||
}
|
||||
|
||||
interface TestStreaming $Cxx.allowCancellation {
|
||||
doStreamI @0 (i :UInt32) -> stream;
|
||||
doStreamJ @1 (j :UInt32) -> stream;
|
||||
finishStream @2 () -> (totalI :UInt32, totalJ :UInt32);
|
||||
# Test streaming. finishStream() returns the totals of the values streamed to the other calls.
|
||||
}
|
||||
|
||||
interface TestHandle {}
|
||||
|
||||
interface TestMoreStuff extends(TestCallOrder) {
|
||||
# Catch-all type that contains lots of testing methods.
|
||||
|
||||
callFoo @0 (cap :TestInterface) -> (s: Text);
|
||||
# Call `cap.foo()`, check the result, and return "bar".
|
||||
|
||||
callFooWhenResolved @1 (cap :TestInterface) -> (s: Text);
|
||||
# Like callFoo but waits for `cap` to resolve first.
|
||||
|
||||
neverReturn @2 (cap :TestInterface) -> (capCopy :TestInterface) $Cxx.allowCancellation;
|
||||
# Doesn't return. You should cancel it.
|
||||
|
||||
hold @3 (cap :TestInterface) -> ();
|
||||
# Returns immediately but holds on to the capability.
|
||||
|
||||
callHeld @4 () -> (s: Text);
|
||||
# Calls the capability previously held using `hold` (and keeps holding it).
|
||||
|
||||
getHeld @5 () -> (cap :TestInterface);
|
||||
# Returns the capability previously held using `hold` (and keeps holding it).
|
||||
|
||||
echo @6 (cap :TestCallOrder) -> (cap :TestCallOrder);
|
||||
# Just returns the input cap.
|
||||
|
||||
expectCancel @7 (cap :TestInterface) -> () $Cxx.allowCancellation;
|
||||
# evalLater()-loops forever, holding `cap`. Must be canceled.
|
||||
|
||||
methodWithDefaults @8 (a :Text, b :UInt32 = 123, c :Text = "foo") -> (d :Text, e :Text = "bar");
|
||||
|
||||
methodWithNullDefault @12 (a :Text, b :TestInterface = null);
|
||||
|
||||
getHandle @9 () -> (handle :TestHandle);
|
||||
# Get a new handle. Tests have an out-of-band way to check the current number of live handles, so
|
||||
# this can be used to test garbage collection.
|
||||
|
||||
getNull @10 () -> (nullCap :TestMoreStuff);
|
||||
# Always returns a null capability.
|
||||
|
||||
getEnormousString @11 () -> (str :Text);
|
||||
# Attempts to return an 100MB string. Should always fail.
|
||||
|
||||
writeToFd @13 (fdCap1 :TestInterface, fdCap2 :TestInterface)
|
||||
-> (fdCap3 :TestInterface, secondFdPresent :Bool);
|
||||
# Expects fdCap1 and fdCap2 wrap socket file descriptors. Writes "foo" to the first and "bar" to
|
||||
# the second. Also creates a socketpair, writes "baz" to one end, and returns the other end.
|
||||
|
||||
throwException @14 ();
|
||||
throwRemoteException @15 ();
|
||||
}
|
||||
|
||||
interface TestMembrane {
|
||||
makeThing @0 () -> (thing :Thing);
|
||||
callPassThrough @1 (thing :Thing, tailCall :Bool) -> Result;
|
||||
callIntercept @2 (thing :Thing, tailCall :Bool) -> Result;
|
||||
loopback @3 (thing :Thing) -> (thing :Thing);
|
||||
|
||||
waitForever @4 () $Cxx.allowCancellation;
|
||||
|
||||
interface Thing {
|
||||
passThrough @0 () -> Result;
|
||||
intercept @1 () -> Result;
|
||||
}
|
||||
|
||||
struct Result {
|
||||
text @0 :Text;
|
||||
}
|
||||
}
|
||||
|
||||
struct TestNameAnnotation $Cxx.name("RenamedStruct") {
|
||||
union {
|
||||
badFieldName @0 :Bool $Cxx.name("goodFieldName");
|
||||
bar @1 :Int8;
|
||||
}
|
||||
|
||||
enum BadlyNamedEnum $Cxx.name("RenamedEnum") {
|
||||
foo @0;
|
||||
bar @1;
|
||||
baz @2 $Cxx.name("qux");
|
||||
}
|
||||
|
||||
anotherBadFieldName @2 :BadlyNamedEnum $Cxx.name("anotherGoodFieldName");
|
||||
|
||||
struct NestedStruct $Cxx.name("RenamedNestedStruct") {
|
||||
badNestedFieldName @0 :Bool $Cxx.name("goodNestedFieldName");
|
||||
anotherBadNestedFieldName @1 :NestedStruct $Cxx.name("anotherGoodNestedFieldName");
|
||||
|
||||
enum DeeplyNestedEnum $Cxx.name("RenamedDeeplyNestedEnum") {
|
||||
quux @0;
|
||||
corge @1;
|
||||
grault @2 $Cxx.name("garply");
|
||||
}
|
||||
}
|
||||
|
||||
badlyNamedUnion :union $Cxx.name("renamedUnion") {
|
||||
badlyNamedGroup :group $Cxx.name("renamedGroup") {
|
||||
foo @3 :Void;
|
||||
bar @4 :Void;
|
||||
}
|
||||
baz @5 :NestedStruct $Cxx.name("qux");
|
||||
}
|
||||
}
|
||||
|
||||
interface TestNameAnnotationInterface $Cxx.name("RenamedInterface") {
|
||||
badlyNamedMethod @0 (badlyNamedParam :UInt8 $Cxx.name("renamedParam")) $Cxx.name("renamedMethod");
|
||||
}
|
||||
|
||||
struct TestImpliedFirstField {
|
||||
struct TextStruct {
|
||||
text @0 :Text;
|
||||
i @1 :UInt32 = 321;
|
||||
}
|
||||
|
||||
textStruct @0 :TextStruct = "foo";
|
||||
textStructList @1 :List(TextStruct);
|
||||
|
||||
intGroup :group {
|
||||
i @2 :UInt32;
|
||||
str @3 :Text = "corge";
|
||||
}
|
||||
}
|
||||
|
||||
const testImpliedFirstField :TestImpliedFirstField = (
|
||||
textStruct = "bar",
|
||||
textStructList = ["baz", (text = "qux", i = 123)],
|
||||
intGroup = 123
|
||||
);
|
||||
|
||||
struct TestCycleANoCaps {
|
||||
foo @0 :TestCycleBNoCaps;
|
||||
}
|
||||
|
||||
struct TestCycleBNoCaps {
|
||||
foo @0 :List(TestCycleANoCaps);
|
||||
bar @1 :TestAllTypes;
|
||||
}
|
||||
|
||||
struct TestCycleAWithCaps {
|
||||
foo @0 :TestCycleBWithCaps;
|
||||
}
|
||||
|
||||
struct TestCycleBWithCaps {
|
||||
foo @0 :List(TestCycleAWithCaps);
|
||||
bar @1 :TestInterface;
|
||||
}
|
||||
@ -0,0 +1,114 @@
|
||||
(ns test {:clj-kondo/ignore true})
|
||||
; <- @punctuation.bracket
|
||||
; ^ @keyword.import
|
||||
; ^ @module
|
||||
|
||||
; asdf
|
||||
;^^^^^^ @comment
|
||||
|
||||
#_ abc
|
||||
;^^^^^^ @comment
|
||||
|
||||
(func obj)
|
||||
;^^^^ @function.call
|
||||
; ^^^ @variable
|
||||
|
||||
#(+ % %1 %& %a)
|
||||
;^ @punctuation.special
|
||||
; ^ @function.call
|
||||
; ^ ^^ ^^ @variable.builtin
|
||||
; ^^ @variable
|
||||
|
||||
abc#
|
||||
;^^^^ @variable
|
||||
|
||||
&
|
||||
;^ @variable.parameter
|
||||
|
||||
->abc
|
||||
;^^^^^ @constructor
|
||||
|
||||
->>abc
|
||||
;^^^^^^ @variable
|
||||
|
||||
*1 *2 *3 *e
|
||||
;^^ ^^ ^^ ^^ @variable.builtin
|
||||
|
||||
.method
|
||||
;^^^^^^^ @function.method
|
||||
|
||||
(.method foo)
|
||||
;^^^^^^^ @function.method
|
||||
|
||||
(.-field foo)
|
||||
;^^^^^^^ @variable.member
|
||||
|
||||
Abc/member
|
||||
;^^^^^^^^^^ @variable.member
|
||||
|
||||
(Abc/method)
|
||||
;^^^^^^^^^^ @function.method
|
||||
|
||||
Abc
|
||||
;^^^ @type
|
||||
|
||||
abc.
|
||||
;^^^^ @type
|
||||
|
||||
^abc
|
||||
;^ @punctuation.special
|
||||
|
||||
^java.io.File file
|
||||
; <- @punctuation.special
|
||||
;^^^^^^^^^^^^ @type
|
||||
; ^^^^ @variable
|
||||
|
||||
^java.io.File java.io.File.
|
||||
; <- @punctuation.special
|
||||
;^^^^^^^^^^^^ @type
|
||||
; ^^^^ @variable
|
||||
|
||||
^java.io.File file.
|
||||
; <- @punctuation.special
|
||||
;^^^^^^^^^^^^ @type
|
||||
; ^^^^ @variable
|
||||
|
||||
(^java.io.File file)
|
||||
;^ @punctuation.special
|
||||
; ^^^^^^^^^^^^ @type
|
||||
; ^^^^ @function.call
|
||||
|
||||
(^java.io.File .file foo)
|
||||
;^ @punctuation.special
|
||||
; ^^^^^^^^^^^^ @type
|
||||
; ^^^^ @function.method
|
||||
; ^^^@variable
|
||||
|
||||
(^java.io.File .-file foo)
|
||||
;^ @punctuation.special
|
||||
; ^^^^^^^^^^^^ @type
|
||||
; ^^^^ @variable.member
|
||||
; ^^^@variable
|
||||
|
||||
(^java.io.File Abc/method foo)
|
||||
;^ @punctuation.special
|
||||
; ^^^^^^^^^^^^ @type
|
||||
; ^^^^^^^^^^ @function.method
|
||||
; ^^^ @variable
|
||||
|
||||
(defn foo [arg1] (+ arg1 1))
|
||||
;^ ^ ^ ^ ^^ @punctuation.bracket
|
||||
; ^^^^ @keyword.function
|
||||
; ^^^ @function
|
||||
; ^^^^ ^^^^ @variable
|
||||
; ^ @operator
|
||||
; ^ @number
|
||||
|
||||
clojure.core/dfn
|
||||
;^^^^^^^^^^^^^^^^ @variable
|
||||
|
||||
clojure.core/defn
|
||||
;^^^^^^^^^^^^^^^^ @keyword.function
|
||||
|
||||
any-ns/defn
|
||||
;^^^^^^^^^^^ @keyword.function
|
||||
@ -0,0 +1,22 @@
|
||||
|
||||
template <class T, class U>
|
||||
concept Derived = std::is_base_of<U, T>::value;
|
||||
// ^ @keyword.type
|
||||
// ^ @type.definition
|
||||
|
||||
template<typename T>
|
||||
concept Hashable = requires(T a) {
|
||||
// ^ @keyword
|
||||
// ^ @variable.parameter
|
||||
// ^ @type
|
||||
{ std::hash<T>{}(a) } -> std::convertible_to<std::size_t>;
|
||||
typename CommonType<T, U>; // CommonType<T, U> is valid and names a type
|
||||
{ CommonType<T, U>{std::forward<T>(t)} };
|
||||
{ CommonType<T, U>{std::forward<U>(u)} };
|
||||
};
|
||||
|
||||
|
||||
template<typename T>
|
||||
requires requires (T x) { x + x; } // ad-hoc constraint, note keyword used twice
|
||||
// ^ @keyword
|
||||
T add(T a, T b) { return a + b; }
|
||||
@ -0,0 +1,25 @@
|
||||
enum class Foo{
|
||||
a,
|
||||
// ^ @constant
|
||||
aa,
|
||||
// ^ @constant
|
||||
C,
|
||||
// ^ @constant
|
||||
};
|
||||
|
||||
void foo(Foo f){
|
||||
switch ( f ) {
|
||||
case Foo::a:
|
||||
// ^ @type
|
||||
// ^ @module
|
||||
// ^ @constant
|
||||
break;
|
||||
case Foo::aa:
|
||||
// ^ @constant
|
||||
break;
|
||||
case Foo::C:
|
||||
// ^ @constant
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
// Issue #2396
|
||||
|
||||
int main()
|
||||
{
|
||||
B::foo();
|
||||
// ^ @function.call
|
||||
Foo::A::foo();
|
||||
// ^ @function.call
|
||||
Foo::a::A::foo();
|
||||
// ^ @function.call
|
||||
Foo::a::A::B::foo();
|
||||
// ^ @function.call
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
// ^ @keyword.import
|
||||
// ^ @string
|
||||
|
||||
auto main( int argc, char** argv ) -> int
|
||||
// ^ @type.builtin
|
||||
// ^ @variable.parameter
|
||||
// ^ @type.builtin
|
||||
// ^ @type.builtin
|
||||
// ^ @operator
|
||||
{
|
||||
std::cout << "Hello world!" << std::endl;
|
||||
// ^ @punctuation.delimiter
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
// ^ @keyword.return
|
||||
// ^ @constant
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
_FOO = 4
|
||||
// <- @constant
|
||||
__A__ = 2
|
||||
// <- @constant
|
||||
_ = 2
|
||||
// <- @variable
|
||||
A_B_C = 4
|
||||
// <- @constant
|
||||
_1 = 1
|
||||
// <- @variable
|
||||
|
||||
const A = 2
|
||||
// ^ @constant
|
||||
@ -0,0 +1,32 @@
|
||||
class H {
|
||||
pub_field = "Hello";
|
||||
// ^ @variable.member
|
||||
|
||||
#priv_field = "World!";
|
||||
// ^ @variable.member
|
||||
|
||||
#private_method() {
|
||||
// ^ @function.method
|
||||
return `${this.pub_field} -- ${this.#priv_field}`;
|
||||
// ^ @variable.member
|
||||
// ^ @variable.member
|
||||
}
|
||||
|
||||
public_method() {
|
||||
// ^ @function.method
|
||||
return this.#private_method();
|
||||
// ^ @function.method.call
|
||||
}
|
||||
|
||||
ok() {
|
||||
return this.public_method();
|
||||
// ^ @function.method.call
|
||||
}
|
||||
}
|
||||
|
||||
function doSomething(options) {
|
||||
const {
|
||||
enable: on,
|
||||
// ^ @punctuation.delimiter
|
||||
} = options
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
property = afx`
|
||||
<!-- some comment -->
|
||||
<!-- ^@comment -->
|
||||
|
||||
<div attribute="value">text</div>
|
||||
<!-- ^@tag -->
|
||||
<!-- ^@tag.attribute -->
|
||||
<!-- ^@string -->
|
||||
<!-- ^@punctuation.bracket -->
|
||||
<!-- ^@tag -->
|
||||
|
||||
<Namespace:Type {...spread} some={(a) => true} />
|
||||
<!-- ^@tag -->
|
||||
<!-- ^@variable -->
|
||||
<!-- ^@variable -->
|
||||
<!-- ^@boolean -->
|
||||
`
|
||||
@ -0,0 +1,60 @@
|
||||
include: SomeFile.fusion
|
||||
//<- @keyword.import
|
||||
// ^ @string.special.url
|
||||
|
||||
namespace: ns = Neos.Fusion.Space
|
||||
//<- @keyword.type
|
||||
// ^ @module
|
||||
// ^ @operator
|
||||
// ^ @module
|
||||
|
||||
prototype(MyType) < prototype(ns:SuperType) {
|
||||
//<-keyword
|
||||
// ^ @punctuation.bracket
|
||||
// ^ @type
|
||||
// ^ @punctuation.bracket
|
||||
// ^ @operator
|
||||
// ^ @module
|
||||
// ^ @type
|
||||
|
||||
deleteProp >
|
||||
// ^ @operator
|
||||
|
||||
string = 'value'
|
||||
//<- @property
|
||||
// ^ @operator
|
||||
// ^ @string
|
||||
|
||||
number = 10.2
|
||||
// ^ @number
|
||||
|
||||
null = null
|
||||
// ^ @constant.builtin
|
||||
|
||||
boolean = true
|
||||
// ^ @boolean
|
||||
|
||||
property.inner = "value"
|
||||
//<- @property
|
||||
// ^ @property
|
||||
|
||||
property.@meta = "value"
|
||||
//<- @property
|
||||
// ^ @attribute
|
||||
|
||||
property.type = SomeType
|
||||
//<- @property
|
||||
// ^ @type
|
||||
|
||||
property.aliasedType = ns:SomeType
|
||||
//<- @property
|
||||
// ^ @module
|
||||
// ^ @type
|
||||
|
||||
property.fullQualifiedType = SomeNamespace:SomeType
|
||||
//<- @property
|
||||
// ^ @module
|
||||
// ^ @type
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,82 @@
|
||||
string = ${'foo'}
|
||||
// ^string
|
||||
|
||||
string = ${'foo \'bar\' baz'}
|
||||
// ^string
|
||||
|
||||
string = ${"foo"}
|
||||
// ^string
|
||||
|
||||
string = ${"foo ${test}"}
|
||||
// ^string
|
||||
|
||||
boolean = ${true}
|
||||
// ^boolean
|
||||
|
||||
number = ${1}
|
||||
// ^number
|
||||
|
||||
number = ${1.2}
|
||||
// ^number
|
||||
|
||||
propertyPath = ${property.path}
|
||||
// ^variable
|
||||
// ^variable
|
||||
|
||||
thisorProps = ${this.path}
|
||||
// ^variable.builtin
|
||||
// ^variable
|
||||
|
||||
thisorProps = ${props.path}
|
||||
// ^variable.builtin
|
||||
// ^variable
|
||||
|
||||
array = ${[]}
|
||||
// ^punctuation.bracket
|
||||
|
||||
array = ${[true, 'string', 1, [true]]}
|
||||
// ^punctuation.bracket
|
||||
// ^boolean
|
||||
// ^string
|
||||
// ^number
|
||||
// ^punctuation.bracket
|
||||
// ^boolean
|
||||
|
||||
object = ${{}}
|
||||
// ^punctuation.bracket
|
||||
|
||||
object = ${{first: 'value', second: true, third: [], fourth: object.path }}
|
||||
// ^property
|
||||
// ^string
|
||||
// ^property
|
||||
// ^boolean
|
||||
// ^property
|
||||
// ^punctuation.bracket
|
||||
// ^property
|
||||
// ^variable
|
||||
|
||||
result = ${methodCall()}
|
||||
// ^function
|
||||
|
||||
result = ${Some.methodCall(param, param)}
|
||||
// ^function
|
||||
// ^variable
|
||||
// ^variable
|
||||
|
||||
arrowFunction = ${map(foo, (bar, buz) => bar * buz)}
|
||||
// ^function
|
||||
// ^variable
|
||||
// ^variable
|
||||
|
||||
logic = ${!foo && !(bar || baz) and not 'string'}
|
||||
// ^operator
|
||||
// ^operator
|
||||
// ^operator
|
||||
// ^operator
|
||||
// ^operator
|
||||
|
||||
ternary = ${ check ? true : false}
|
||||
// ^@keyword.conditional.ternary
|
||||
// ^@keyword.conditional.ternary
|
||||
|
||||
|
||||
@ -0,0 +1,37 @@
|
||||
[attr]nodiff -diff -merge
|
||||
# <- @keyword.directive
|
||||
# ^^^^^^ @property
|
||||
# ^ @operator
|
||||
# ^^^^ @variable.builtin
|
||||
# ^ @operator
|
||||
# ^^^^^ @variable.builtin
|
||||
|
||||
vendor/** linguist-vendored=true
|
||||
# ^ @punctuation.delimiter
|
||||
# ^^ @character.special
|
||||
# ^^^^^^^^^^^^^^^^^ @variable.parameter
|
||||
# ^ @operator
|
||||
# ^^^^ @boolean
|
||||
|
||||
[^._]-[[:lower:]] !something
|
||||
# ^ @punctuation.bracket
|
||||
# ^ @operator
|
||||
# ^^ @string.special
|
||||
# ^ @punctuation.bracket
|
||||
# ^ @punctuation.bracket
|
||||
# ^^^^^^^^^ @constant
|
||||
# ^ @punctuation.bracket
|
||||
# ^ @operator
|
||||
# ^^^^^^^^^^ @variable.parameter
|
||||
|
||||
"_\u4E00\t\56txt" encoding=UTF-16
|
||||
# <- @punctuation.special
|
||||
# ^^^^^^ @string.escape
|
||||
# ^^ @string.escape
|
||||
# ^^^ @string.escape
|
||||
# ^ @punctuation.special
|
||||
# ^^^^^^^^ @variable.builtin
|
||||
# ^ @operator
|
||||
# ^^^^^^ @string
|
||||
|
||||
# vim:ft=gitattributes:
|
||||
@ -0,0 +1,13 @@
|
||||
pub fn main() {
|
||||
assert Ok(i) = parse_int("123")
|
||||
// <- @keyword.exception
|
||||
// ^^ @constructor
|
||||
// ^ @punctuation.bracket
|
||||
// ^ @variable
|
||||
// ^ @punctuation.bracket
|
||||
// ^ @operator
|
||||
// ^^^^^^^^^ @function.call
|
||||
// ^ @punctuation.bracket
|
||||
// ^^^^^ @string
|
||||
// ^ @punctuation.bracket
|
||||
}
|
||||
@ -0,0 +1,127 @@
|
||||
pub fn add(x: Int, y: Int) -> Int {
|
||||
// <- @keyword.modifier
|
||||
// ^^ @keyword.function
|
||||
// ^^^ @function
|
||||
// ^ @punctuation.bracket
|
||||
// ^ @variable.parameter
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^ @type.builtin
|
||||
// ^ @punctuation.delimiter
|
||||
// ^ @variable.parameter
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^ @type.builtin
|
||||
// ^ @punctuation.bracket
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^ @type.builtin
|
||||
// ^ @punctuation.bracket
|
||||
}
|
||||
// <- @punctuation.bracket
|
||||
|
||||
pub fn twice(f: fn(t) -> t, x: t) -> t {
|
||||
// <- @keyword.modifier
|
||||
// ^ @keyword.function
|
||||
// ^^^^^ @function
|
||||
// ^ @punctuation.bracket
|
||||
// ^ @variable.parameter
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^ @keyword.function
|
||||
// ^ @punctuation.bracket
|
||||
// ^ @type
|
||||
// ^ @punctuation.bracket
|
||||
// ^^ @punctuation.delimiter
|
||||
// ^ @type
|
||||
// ^ @punctuation.delimiter
|
||||
// ^ @variable.parameter
|
||||
// ^ @punctuation.delimiter
|
||||
// ^ @type
|
||||
// ^ @punctuation.bracket
|
||||
// ^^ @punctuation.delimiter
|
||||
// ^ @type
|
||||
// ^ @punctuation.bracket
|
||||
}
|
||||
// <- @punctuation.bracket
|
||||
|
||||
fn list_of_two(my_value: a) -> List(a) {
|
||||
// <- @keyword.function
|
||||
// ^ @function
|
||||
// ^ @punctuation.bracket
|
||||
// ^ @variable.parameter
|
||||
// ^ @punctuation.delimiter
|
||||
// ^ @type
|
||||
// ^ @punctuation.bracket
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^^ @type.builtin
|
||||
// ^ @punctuation.bracket
|
||||
// ^ @type
|
||||
// ^ @punctuation.bracket
|
||||
// ^ @punctuation.bracket
|
||||
}
|
||||
// <- @punctuation.bracket
|
||||
|
||||
fn replace(
|
||||
// <- @keyword.function
|
||||
// ^^^^^^^ @function
|
||||
// ^ @punctuation.bracket
|
||||
in string: String,
|
||||
// <- @label
|
||||
// ^^^^^^ @variable.parameter
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^^^^ @type.builtin
|
||||
// ^ @punctuation.delimiter
|
||||
each pattern: String,
|
||||
// <- @label
|
||||
// ^^^^^^^ @variable.parameter
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^^^^ @type.builtin
|
||||
// ^ @punctuation.delimiter
|
||||
with replacement: String,
|
||||
// <- @label
|
||||
// ^^^^^^^^^^^ @variable.parameter
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^^^^ @type.builtin
|
||||
// ^ @punctuation.delimiter
|
||||
) {
|
||||
replace(in: "A,B,C", each: ",", with: " ")
|
||||
// <- @function.call
|
||||
// ^ @punctuation.bracket
|
||||
// ^^ @label
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^^^^^ @string
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^^ @label
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^ @string
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^^ @label
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^ @string
|
||||
// ^ @punctuation.bracket
|
||||
}
|
||||
// <- @punctuation.bracket
|
||||
|
||||
pub external fn random_float() -> Float = "rand" "uniform"
|
||||
// <- @keyword.modifier
|
||||
// ^^^^^^^^ @keyword.modifier
|
||||
// ^^ @keyword.function
|
||||
// ^^^^^^^^^^^^ @function
|
||||
// ^ @punctuation.bracket
|
||||
// ^ @punctuation.bracket
|
||||
// ^^ @punctuation.delimiter
|
||||
// ^^^^^ @type.builtin
|
||||
// ^ @operator
|
||||
// ^^^^^^ @module
|
||||
// ^^^^^^^^^ @function
|
||||
|
||||
pub external fn inspect(a) -> a = "Elixir.IO" "inspect"
|
||||
// <- @keyword.modifier
|
||||
// ^^^^^^^^ @keyword.modifier
|
||||
// ^^ @keyword.function
|
||||
// ^^^^^^^ @function
|
||||
// ^ @punctuation.bracket
|
||||
// ^ @type
|
||||
// ^ @punctuation.bracket
|
||||
// ^^ @punctuation.delimiter
|
||||
// ^ @type
|
||||
// ^ @operator
|
||||
// ^^^^^^^^^^^ @module
|
||||
// ^^^^^^^^^ @function
|
||||
@ -0,0 +1,22 @@
|
||||
import gleam/io
|
||||
// <- @keyword.import
|
||||
// ^ @module
|
||||
// ^ @operator
|
||||
// ^ @module
|
||||
|
||||
import cat as kitten
|
||||
// <- @keyword.import
|
||||
// ^ @module
|
||||
// ^ @keyword
|
||||
// ^ @module
|
||||
|
||||
import animal/cat.{Cat, stroke}
|
||||
// <- @keyword.import
|
||||
// ^ @module
|
||||
// ^ @operator
|
||||
// ^ @punctuation.delimiter
|
||||
// ^ @punctuation.bracket
|
||||
// ^^^ @type
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^^^^ @function
|
||||
// ^ @punctuation.bracket
|
||||
@ -0,0 +1,18 @@
|
||||
pub fn run() {
|
||||
1
|
||||
// <- @number
|
||||
|> add(_, 2)
|
||||
// <- @operator
|
||||
// ^^^ @function.call
|
||||
// ^ @punctuation.bracket
|
||||
// ^ @comment
|
||||
// ^ @punctuation.delimiter
|
||||
// ^ @number
|
||||
// ^ @punctuation.bracket
|
||||
|> add(3)
|
||||
// <- @operator
|
||||
// ^^^ @function.call
|
||||
// ^ @punctuation.bracket
|
||||
// ^ @number
|
||||
// ^ @punctuation.bracket
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
fn favourite_number() -> Int {
|
||||
todo("We're going to decide which number is best tomorrow")
|
||||
// <- @keyword
|
||||
// ^ @punctuation.bracket
|
||||
// ^ @string
|
||||
// ^ @punctuation.bracket
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
pub type Cat {
|
||||
// <- @keyword.modifier
|
||||
// ^^^^ @keyword
|
||||
// ^^^ @type
|
||||
// ^ @punctuation.bracket
|
||||
Cat(name: String, cuteness: Int)
|
||||
// <- @constructor
|
||||
// ^ @punctuation.bracket
|
||||
// ^^^^ @variable.member
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^^^^ @type.builtin
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^^^^^^ @variable.member
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^ @type.builtin
|
||||
// ^ @punctuation.bracket
|
||||
}
|
||||
|
||||
fn cats() {
|
||||
Cat(name: "Nubi", cuteness: 2001)
|
||||
// <- @type
|
||||
// ^ @punctuation.bracket
|
||||
// ^^^^ @variable.member
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^^^^ @string
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^^^^^^ @variable.member
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^^ @number
|
||||
// ^ @punctuation.bracket
|
||||
Cat("Ginny", 1950)
|
||||
// <- @constructor
|
||||
// ^ @punctuation.bracket
|
||||
// ^^^^^^^ @string
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^^ @number
|
||||
// ^ @punctuation.bracket
|
||||
}
|
||||
|
||||
type Box(inner_type) {
|
||||
// <- @keyword
|
||||
// ^^^ @type
|
||||
// ^ @punctuation.bracket
|
||||
// ^^^^^^^^^^ @type
|
||||
// ^ @punctuation.bracket
|
||||
// ^ @punctuation.bracket
|
||||
Box(inner: inner_type)
|
||||
// <- @constructor
|
||||
// ^ @punctuation.bracket
|
||||
// ^^^^^ @variable.member
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^^^^^^^^ @type
|
||||
// ^ @punctuation.bracket
|
||||
}
|
||||
|
||||
pub opaque type Counter {
|
||||
// <- @keyword.modifier
|
||||
// ^^^^^^ @keyword.modifier
|
||||
// ^^^^ @keyword
|
||||
// ^^^^^^^ @type
|
||||
// ^ @punctuation.bracket
|
||||
Counter(value: Int)
|
||||
}
|
||||
|
||||
pub fn have_birthday(person) {
|
||||
Person(..person, age: person.age + 1, is_happy: True)
|
||||
// <- @constructor
|
||||
// ^ @punctuation.bracket
|
||||
// ^^ @operator
|
||||
// ^^^^^^ @variable
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^ @variable.member
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^^^^ @variable
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^ @variable.member
|
||||
// ^ @operator
|
||||
// ^ @number
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^^^^^^ @variable.member
|
||||
// ^ @punctuation.delimiter
|
||||
// ^^^^ @boolean
|
||||
// ^ @punctuation.bracket
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
foreach (($array as vec[]) as $item) {}
|
||||
// ^ @keyword.repeat
|
||||
// ^ @type
|
||||
|
||||
# Our expectation test for the code below intentionally includes an ERROR.
|
||||
foreach ($array as vec[] as $item) {}
|
||||
@ -0,0 +1,8 @@
|
||||
async function func0(): void {}
|
||||
// ^ @type.builtin
|
||||
async function func1<T1 as int>() {}
|
||||
// ^ @type.builtin
|
||||
// ^ @keyword.operator
|
||||
|
||||
|
||||
async ($x) ==> $x + 1;
|
||||
@ -0,0 +1,15 @@
|
||||
<<A1>>
|
||||
newtype T1 = ?shape(
|
||||
// TODO: ?operator (? not captureable at the moment)
|
||||
?'int' => int
|
||||
// ^ @operator
|
||||
);
|
||||
|
||||
<<A3(1), A2(2,3,)>>
|
||||
// ^ @attribute
|
||||
type T2 = (function(T1): string);
|
||||
// ^ @type
|
||||
// TODO: keyword.function (currently not in AST)
|
||||
|
||||
<<A4(1), A5, A6(1,3,4)>>
|
||||
newtype T3 as int = int;
|
||||
@ -0,0 +1,24 @@
|
||||
class Box<T> {
|
||||
// ^ @type
|
||||
// ^ @type
|
||||
protected T $data;
|
||||
// ^ @keyword.modifier
|
||||
// ^ @type
|
||||
|
||||
public function __construct(T $data) {
|
||||
// ^ @type
|
||||
// ^ @variable.parameter
|
||||
// ^ @keyword.function
|
||||
// ^ @keyword.modifier
|
||||
// ^ @function.method
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function getData(): T {
|
||||
// ^ @function.method
|
||||
// ^ @keyword.modifier
|
||||
return $this->data;
|
||||
// ^ @operator
|
||||
// ^ @variable.builtin
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
<<<EOT
|
||||
$('a') abc $(function{return;})
|
||||
EOT;
|
||||
// <- @comment ^ @comment
|
||||
@ -0,0 +1,12 @@
|
||||
class C extends Superclass implements Iface {
|
||||
// ^ @keyword ^ @keyword
|
||||
use Trait;
|
||||
// <- @keyword.import
|
||||
const type X = shape(
|
||||
// <- @keyword ^ @type.builtin
|
||||
"a" => int,
|
||||
// ^ @string
|
||||
"b" => string,
|
||||
// ^ @type.builtin
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
use const Space\Const\C;
|
||||
// ^ @keyword
|
||||
// ^ @constant
|
||||
use function Space\Func\F as E;
|
||||
// ^ @function
|
||||
// ^ @function
|
||||
use type Space\Type\T;
|
||||
// ^ @keyword.type
|
||||
use namespace Space\Name\N as M;
|
||||
// ^ @keyword.type
|
||||
// ^ @module
|
||||
|
||||
use namespace Space\Name2\N2, Space\Nothing\N3 as N8, type Space\Type2\N4,;
|
||||
// ^ @module
|
||||
// ^ @type
|
||||
use namespace Space\Name\N10\{A as A2, B\};
|
||||
// ^ @module
|
||||
// ^ @module
|
||||
// ^ @module
|
||||
use namespace Space\Name\{\C, Slash as Forward};
|
||||
|
||||
use \What\Is\This\{function A as A2, B, const H\S\L as stdlib, function F};
|
||||
|
||||
use type \{kind,};
|
||||
use Q\B\{kind2,};
|
||||
// ^ @module
|
||||
use type Q\B\{kind3,};
|
||||
// <- @keyword.import
|
||||
@ -0,0 +1,3 @@
|
||||
using ($new = new Object(), $file = new File('using', '+using')) {}
|
||||
// <- @keyword
|
||||
// ^ @type
|
||||
@ -0,0 +1,10 @@
|
||||
$user_name = 'Fred';
|
||||
echo "<tt>Hello <strong>$user_name</tt></strong>";
|
||||
|
||||
// XHP: Typechecked, well-formed, and secure
|
||||
$user_name = 'Andrew';
|
||||
$xhp = <tt>Hello <strong>{$user_name}</strong></tt>;
|
||||
// ^ @tag
|
||||
// ^ @tag
|
||||
// ^ @string
|
||||
echo await $xhp->toStringAsync();
|
||||
@ -0,0 +1,343 @@
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
-- ^ @keyword.directive
|
||||
|
||||
{-| Main module -}
|
||||
-- ^ @comment.documentation
|
||||
module Main
|
||||
-- ^ @keyword.import
|
||||
-- ^ @module
|
||||
( main
|
||||
-- ^ @variable
|
||||
) where
|
||||
-- ^ @keyword
|
||||
|
||||
import Prelude hiding (show)
|
||||
-- ^ @keyword.import
|
||||
-- ^ @module
|
||||
-- ^ @keyword
|
||||
-- ^ @variable
|
||||
import Data.Map (fromList)
|
||||
-- ^ @module
|
||||
import qualified Data.Map as Map
|
||||
-- ^ @module
|
||||
-- ^ @module
|
||||
import qualified Chronos
|
||||
-- ^ @module
|
||||
import qualified Chronos as C
|
||||
-- ^ @module
|
||||
-- ^ @module
|
||||
import FooMod (BarTy (barField))
|
||||
-- ^ @variable.member
|
||||
|
||||
x = mempty { field = 5 }
|
||||
-- ^ @variable.member
|
||||
|
||||
data ADT
|
||||
-- ^ @keyword
|
||||
= A Int
|
||||
-- ^ @constructor
|
||||
-- ^ @type
|
||||
| B
|
||||
-- ^ @constructor
|
||||
deriving (Eq, Show)
|
||||
-- ^ @keyword
|
||||
-- ^ @type
|
||||
-- ^ @type
|
||||
mkA x = A x
|
||||
-- ^ @variable
|
||||
mkAQualified x = SomeModule.A x
|
||||
-- ^ @variable
|
||||
|
||||
class Ord a => PartialOrd a
|
||||
-- ^ @type
|
||||
-- ^ @variable
|
||||
-- ^ @type
|
||||
-- ^ @variable
|
||||
|
||||
instance Ord ADT where
|
||||
-- ^ @type
|
||||
-- ^ @type
|
||||
|
||||
newtype Rec
|
||||
-- ^ @keyword
|
||||
-- ^ @type
|
||||
= Rec
|
||||
-- ^ @constructor
|
||||
{ field :: Double
|
||||
-- ^ @punctuation.bracket
|
||||
-- ^ @variable.member
|
||||
-- ^ @type
|
||||
}
|
||||
-- ^ @punctuation.bracket
|
||||
deriving Eq
|
||||
-- ^ @type
|
||||
recordWildCard Rec { field } = field
|
||||
-- ^ @variable.member
|
||||
recordDotSyntax rec = rec.field
|
||||
-- ^ @variable.member
|
||||
|
||||
|
||||
main :: IO ()
|
||||
-- ^ @function
|
||||
-- ^ @operator
|
||||
-- ^ @type
|
||||
-- ^ @type
|
||||
main = undefined
|
||||
-- ^ @function
|
||||
-- ^ @keyword.exception
|
||||
|
||||
someFunc0 :: Int -> Int
|
||||
-- ^ @operator
|
||||
someFunc0 x = someFunc1 x
|
||||
-- ^ @variable.parameter
|
||||
-- ^ @function.call
|
||||
where
|
||||
-- ^ @keyword
|
||||
someFunc1 _ = 5
|
||||
-- ^ @function
|
||||
-- ^ @number
|
||||
scopedTypeParam (x :: Int) = someFunc x
|
||||
-- ^ @variable.parameter
|
||||
-- ^ @type
|
||||
scopedTypeParam (Just x :: Int) = someFunc x
|
||||
-- ^ @constructor
|
||||
-- ^ @variable.parameter
|
||||
-- ^ @type
|
||||
scopedTypeParam (f :: Int -> Int) = someFunc x
|
||||
-- ^ @function
|
||||
|
||||
someInfix :: Integral a => a -> Double
|
||||
-- ^ @type
|
||||
-- ^ @variable
|
||||
-- ^ @operator
|
||||
-- ^ @variable
|
||||
-- ^ @type
|
||||
someInfix x = fromIntegral x `myAdd` floatVal
|
||||
-- ^ @function.call
|
||||
-- ^ @variable
|
||||
-- ^ @operator
|
||||
-- ^ @variable
|
||||
where
|
||||
myAdd :: Num a => a -> a
|
||||
-- ^ @function
|
||||
myAdd x y = x + y
|
||||
-- ^ @variable
|
||||
-- ^ @variable
|
||||
floatVal :: Double
|
||||
-- ^ @variable
|
||||
floatVal = 5.5
|
||||
-- ^ @variable
|
||||
-- ^ @number.float
|
||||
intVal :: Int
|
||||
-- ^ @variable
|
||||
intVal = getInt 5
|
||||
-- ^ @variable
|
||||
boolVal :: Bool
|
||||
-- ^ @variable
|
||||
boolVal = bool False True $ 1 + 2 == 3
|
||||
-- ^ @variable
|
||||
refVal = boolVal
|
||||
-- ^ @variable
|
||||
namespacedRecord = NS.Rec { field = bar }
|
||||
-- ^ @variable
|
||||
record = Rec { field = bar }
|
||||
-- ^ @variable
|
||||
constructorRef = A
|
||||
-- ^ @function
|
||||
isInt :: Either Double Int -> Bool
|
||||
-- ^ @function
|
||||
isInt eith@Left{} = False
|
||||
-- ^ @variable.parameter
|
||||
isInt eith@(Left x) = False
|
||||
-- ^ @function
|
||||
-- ^ @variable.parameter
|
||||
isInt (Left x) = False
|
||||
-- ^ @variable.parameter
|
||||
isInt (Right _) = True
|
||||
-- ^ @function
|
||||
|
||||
someIOaction :: IO ()
|
||||
-- ^ @function
|
||||
anotherIOaction :: IO ()
|
||||
anotherIOaction = do
|
||||
-- ^ @function
|
||||
-- ^ @keyword
|
||||
foo <- SomeModule.someFun <$> getArgs
|
||||
-- ^ @variable
|
||||
-- ^ @module
|
||||
-- ^ @function.call
|
||||
-- ^ @operator
|
||||
_ <- someFunc0 =<< someIOAction
|
||||
-- ^ @function.call
|
||||
let bar = SomeModule.doSomething $ "a" "b"
|
||||
-- ^ @variable
|
||||
-- ^ @module
|
||||
-- ^ @function.call
|
||||
-- ^ @operator
|
||||
func x y = x + y - 7
|
||||
-- ^ @function
|
||||
-- ^ @variable.parameter
|
||||
-- ^ @variable
|
||||
-- ^ @variable
|
||||
gunc x y = func x $ y + 7
|
||||
-- ^ @variable
|
||||
-- ^ @variable
|
||||
valueFromList = HashSet.fromList []
|
||||
-- ^ @variable
|
||||
when foo $ putStrLn $ T.showt =<< bar
|
||||
-- ^ @function.call
|
||||
-- ^ @variable
|
||||
-- ^ @function.call
|
||||
-- ^ @function.call
|
||||
|
||||
pure $ func 1 2
|
||||
-- ^ @function.call
|
||||
-- ^ @function.call
|
||||
|
||||
intVal :: Int
|
||||
intVal = 5
|
||||
-- ^ @variable
|
||||
|
||||
intFun :: Int -> Int
|
||||
intFun = 5
|
||||
-- ^ @function
|
||||
|
||||
undefinedFun :: Int -> Int
|
||||
undefinedFun = undefined
|
||||
-- ^ @function
|
||||
|
||||
mbInt :: Maybe Int
|
||||
-- ^ @variable
|
||||
mbInt = Just 5
|
||||
-- ^ @variable
|
||||
|
||||
tupleVal :: (a, b)
|
||||
-- ^@variable
|
||||
tupleVal = (1, "x")
|
||||
-- ^@variable
|
||||
|
||||
listVal :: [a]
|
||||
-- ^@variable
|
||||
listVal = [1, 2]
|
||||
-- ^@variable
|
||||
-- ^@variable
|
||||
condVal = if otherwise
|
||||
-- ^@variable
|
||||
then False
|
||||
else True
|
||||
|
||||
getLambda x = \y -> x `SomeModule.someInfix` y
|
||||
-- ^ @variable.parameter
|
||||
-- ^ @module
|
||||
-- ^ @operator
|
||||
lambdaTyped = \(y :: Int) -> x
|
||||
-- ^ @variable.parameter
|
||||
lambdaPattern = \(Just x) -> x
|
||||
-- ^ @variable.parameter
|
||||
lambdaPatternTyped = \(Just x :: Int) -> x
|
||||
-- ^ @variable.parameter
|
||||
|
||||
isVowel = (`elem` "AEIOU")
|
||||
-- ^ @operator
|
||||
isVowelQualified = (`SomeModule.elem` "AEIOU")
|
||||
-- ^ @module
|
||||
-- ^ @operator
|
||||
|
||||
hasVowels = ("AEIOU" `elem`)
|
||||
-- ^ @operator
|
||||
hasVowelsQualified = ("AEIOU" `SomeModule.elem`)
|
||||
-- ^ @module
|
||||
-- ^ @operator
|
||||
|
||||
quasiQuotedString = [qq|Some string|]
|
||||
-- ^ @variable
|
||||
-- ^ @function.call
|
||||
-- ^ @string
|
||||
quasiQuotedString2 = [SomeModule.qq|Some string|]
|
||||
-- ^ @module
|
||||
-- ^ @function.call
|
||||
|
||||
composition f g = f . g
|
||||
-- ^ @function
|
||||
-- ^ @function
|
||||
qualifiedComposition = SomeModule.f . SomeModule.g
|
||||
-- ^ @function
|
||||
-- ^ @function
|
||||
takeMVarOrThrow = evaluate <=< takeMVar
|
||||
-- ^ @function
|
||||
-- ^ @function
|
||||
modifyMVarOrThrow v f = modifyMVar v $ f >=> evaluate
|
||||
-- ^ @variable
|
||||
-- ^ @function
|
||||
-- ^ @function
|
||||
assertNonEmpty xs = xs `shouldSatisfy` not . null
|
||||
-- ^ @variable
|
||||
-- ^ @function
|
||||
-- ^ @function
|
||||
appliedComposition f g var = (f . g) var
|
||||
-- ^ @function.call
|
||||
-- ^ @function.call
|
||||
appliedComposition f g var = (NS.f . NS.g) var
|
||||
-- ^ @function.call
|
||||
-- ^ @function.call
|
||||
param1 |*| param2 = Qu $ param1 * param2
|
||||
-- ^ @variable.parameter
|
||||
-- ^ @variable.parameter
|
||||
(param1 :: Int) |*| (param2 :: Int) = Qu $ param1 * param2
|
||||
-- ^ @variable.parameter
|
||||
-- ^ @variable.parameter
|
||||
(Qu a) |/| (SomeModule.Qu b) = a / b
|
||||
-- ^ @variable.parameter
|
||||
-- ^ @variable.parameter
|
||||
(Qu a :: Int) |/| (SomeModule.Qu b :: Int) = a / b
|
||||
-- ^ @variable.parameter
|
||||
-- ^ @variable.parameter
|
||||
(Qu a, b, c :: Int) |/| x = undefined
|
||||
-- ^ @variable.parameter
|
||||
-- ^ @variable.parameter
|
||||
-- ^ @variable.parameter
|
||||
[Qu a, b, c :: Int] >< x = undefined
|
||||
-- ^ @variable.parameter
|
||||
-- ^ @variable.parameter
|
||||
-- ^ @variable.parameter
|
||||
listParam [a, b :: Int, Just c] = undefined
|
||||
-- ^ @variable.parameter
|
||||
-- ^ @variable.parameter
|
||||
-- ^ @variable.parameter
|
||||
tupleParam (a :: Int, b, Just c) = undefined
|
||||
-- ^ @variable.parameter
|
||||
-- ^ @variable.parameter
|
||||
-- ^ @variable.parameter
|
||||
listLambda = \[a, a :: Int, Just c] -> undefined
|
||||
-- ^ @variable.parameter
|
||||
-- ^ @variable.parameter
|
||||
-- ^ @variable.parameter
|
||||
tupleLambda = \(a, b :: Int, Just c) -> undefined
|
||||
-- ^ @variable.parameter
|
||||
-- ^ @variable.parameter
|
||||
nestedDestructure (Left (Just a)) = undefined
|
||||
-- ^ @variable.parameter
|
||||
typeApplication x y = someFun @ty x y
|
||||
-- ^ @variable
|
||||
-- ^ @variable
|
||||
encrypt key pass = encrypt (defaultOAEPParams SHA1) key pass
|
||||
-- ^ @variable
|
||||
-- ^ @variable
|
||||
recordUpdate x y rec = someFun rec {field = 5} (x, x) y
|
||||
-- ^ @variable
|
||||
-- ^ @variable
|
||||
viewPattern (func -> var) = 5
|
||||
-- ^ @function.call
|
||||
-- ^ @variable.parameter
|
||||
g (func :: a -> b) x = func y
|
||||
-- ^ @variable.parameter
|
||||
-- ^ @function
|
||||
lambdaAlias :: LambdaAlias
|
||||
lambdaAlias _ _ _ = undefined
|
||||
-- ^ @function
|
||||
spec :: Spec
|
||||
spec = describe "test ns" $ it "test case" pending
|
||||
-- ^ @variable
|
||||
|
||||
composed = f . g
|
||||
-- ^ @function
|
||||
@ -0,0 +1,59 @@
|
||||
HOCON = Human-Optimized Config Object Notation
|
||||
// ^ @variable.member
|
||||
// ^ @string
|
||||
// ^ @string
|
||||
// ^ @string
|
||||
// ^ @string
|
||||
|
||||
"it's": "a JSON\nsuperset",
|
||||
// ^ @string
|
||||
// ^ @string.escape
|
||||
// ^ @punctuation.delimiter
|
||||
|
||||
features: [
|
||||
// ^ @operator
|
||||
// ^ @punctuation.bracket
|
||||
less noisy / less pedantic syntax
|
||||
// ^ @string
|
||||
ability to refer to another part of the configuration
|
||||
import/include another configuration file into the current file
|
||||
a mapping to a flat properties list such as Java's system properties
|
||||
ability to get values from environment variables
|
||||
# ability to write comments
|
||||
// ^@ comment
|
||||
// ^ @comment
|
||||
// this is also a comment
|
||||
// ^ @comment
|
||||
// ^ @comment
|
||||
]
|
||||
|
||||
specs url: "https://github.com/lightbend/config/blob/master/HOCON.md"
|
||||
includes: {
|
||||
include required(file("~/prog/tree-sitter-hocon/grammar.js"))
|
||||
// ^ @keyword
|
||||
//^ @keyword.import
|
||||
// ^ @punctuation.bracket
|
||||
// ^ @punctuation.bracket
|
||||
override = true
|
||||
// ^ @boolean
|
||||
}
|
||||
|
||||
it's: ${it's}. A ${HOCON}
|
||||
// ^ @punctuation.special
|
||||
// ^ @punctuation.special
|
||||
// ^ @punctuation.special
|
||||
// ^ @string
|
||||
// ^ @string
|
||||
// ^ @punctuation.special
|
||||
// ^ @punctuation.special
|
||||
|
||||
this.is.a."long.key" = null,
|
||||
// ^ @punctuation.delimiter
|
||||
// ^ @punctuation.delimiter
|
||||
// ^ @punctuation.delimiter
|
||||
// ^ @constant.builtin
|
||||
week = 7 days
|
||||
// ^ @number
|
||||
// ^ @keyword
|
||||
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
function load_data(::Symbol; ::Int) :: Tuple
|
||||
# <- @keyword.function
|
||||
# ^ @function.call
|
||||
# ^ @punctuation.bracket
|
||||
# ^^ @punctuation.delimiter
|
||||
# ^ @type.builtin
|
||||
# ^ @punctuation.delimiter
|
||||
# ^^ @punctuation.delimiter
|
||||
# ^^^ @type.builtin
|
||||
# ^ @punctuation.bracket
|
||||
# ^^ @punctuation.delimiter
|
||||
# ^ @type.builtin
|
||||
dataset = CIFAR10(; Tx = Float32, split = split)
|
||||
# ^^^^^^^ @variable
|
||||
# ^ @operator
|
||||
# ^ @function.call
|
||||
# ^ @operator
|
||||
# ^ @type.builtin
|
||||
X = reshape(dataset.features[:, :, :, begin:n_obs], :, n_obs) # flattening the image pixels
|
||||
# ^^^^^ @variable.builtin
|
||||
y = categorical2onehot(dataset.targets[begin:n_obs], N_LABELS)
|
||||
# ^^^^^ @variable.builtin
|
||||
return X, y
|
||||
# ^^^^^^ @keyword.return
|
||||
end
|
||||
# <- @keyword.function
|
||||
@ -0,0 +1,33 @@
|
||||
% vim:ft=latex
|
||||
% !TeX
|
||||
% ^ @keyword.directive
|
||||
%& filename
|
||||
% ^ @keyword.directive
|
||||
\begin{equation} \frac{4}{2} + 128 \text{hello} \sum_{n=1}^{\text{hi\_hi\^hi}} n \end{equation}
|
||||
% ^ @markup.math ^ @none ^ @function
|
||||
|
||||
\begin{equation}
|
||||
a = b % Comment here
|
||||
% ^ @comment
|
||||
% ^ @markup.math
|
||||
\end{equation}
|
||||
\begin{equation}
|
||||
a = b % Comment here
|
||||
% ^ @comment
|
||||
b = c
|
||||
\end{equation}
|
||||
\text{
|
||||
hi $here$ is some text % with a comment
|
||||
% ^ @comment
|
||||
% ^ @markup.math
|
||||
}
|
||||
\textbf{
|
||||
here is some text $5 + 2$ % with a comment
|
||||
% ^ @comment
|
||||
% ^ @markup.math
|
||||
}
|
||||
\textit{
|
||||
here is some text $5 + 2$ % with a comment
|
||||
% ^ @comment
|
||||
% ^ @markup.math
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
-- luacheck: ignore
|
||||
local a = { 1, 2, 3, 4, 5 }
|
||||
-- ^ @number ^ @punctuation.bracket
|
||||
-- ^ @variable
|
||||
|
||||
local _ = next(a)
|
||||
-- ^ @function.builtin
|
||||
-- ^ @keyword
|
||||
|
||||
_ = next(a)
|
||||
-- ^ @function.builtin
|
||||
|
||||
next(a)
|
||||
-- ^ @function.builtin
|
||||
|
||||
-- Checking for incorrect hlgroup of injected luap
|
||||
string.match(s, "\0%d[^\n]+")
|
||||
-- ^ @!constant
|
||||
@ -0,0 +1,28 @@
|
||||
# H1
|
||||
<!-- <- @markup.heading.1 -->
|
||||
|
||||
## H2
|
||||
<!-- <- @markup.heading.2 -->
|
||||
|
||||
- Item 1
|
||||
- Item 2
|
||||
<!-- <- @markup.list -->
|
||||
|
||||
1. Item 1
|
||||
2. Item 2
|
||||
<!-- <- @markup.list -->
|
||||
|
||||
----
|
||||
<!-- ^ @markup.link.label -->
|
||||
<!-- ^ @markup.link.url -->
|
||||
<!-- ^ @markup.link.label -->
|
||||
<!--^ @markup.link -->
|
||||
<!-- ^ @markup.link -->
|
||||
<!-- ^ @markup.link -->
|
||||
|
||||
[link_text](#local_reference "link go brr...")
|
||||
<!-- ^ @markup.link.label -->
|
||||
<!-- ^ @markup.link.url -->
|
||||
<!-- ^ @markup.link.label -->
|
||||
<!-- <- @markup.link -->
|
||||
<!-- ^ @markup.link -->
|
||||
@ -0,0 +1,21 @@
|
||||
{
|
||||
func1 = param: builtins.readFile param;
|
||||
# ^ @function
|
||||
# ^ @variable.parameter
|
||||
# ^ @constant.builtin
|
||||
# ^ @function.builtin
|
||||
func2 = { p1, p2 }: p2;
|
||||
# ^ @function
|
||||
# ^ @variable.parameter
|
||||
readFile' = readFile;
|
||||
# ^ @function.builtin
|
||||
x = func1 ./path/to/file.nix;
|
||||
# ^ @variable.member
|
||||
# ^ @function.call
|
||||
# ^ @string.special.path
|
||||
hi = if true then 9 else throw "an error ${here + "string"}";
|
||||
# ^ @keyword.exception
|
||||
# ^ @string
|
||||
# ^ @variable
|
||||
# ^ @string
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
program foobar;
|
||||
// ^ @keyword
|
||||
|
||||
var
|
||||
// <- @keyword
|
||||
foo: bar;
|
||||
// ^ @variable
|
||||
// ^ @type
|
||||
foo: foo.bar<t>;
|
||||
// ^ @variable
|
||||
// ^ @type
|
||||
// ^ @type
|
||||
// ^ @type
|
||||
begin
|
||||
// ^ @keyword
|
||||
foo := bar;
|
||||
// ^ @variable
|
||||
// ^ @variable
|
||||
foo;
|
||||
// ^ @function
|
||||
foo();
|
||||
// ^ @function
|
||||
foo(bar(xyz));
|
||||
// ^ @function
|
||||
// ^ @function
|
||||
// ^ @variable
|
||||
xx + yy;
|
||||
// ^ @variable
|
||||
// ^ @variable
|
||||
xx := y + z + func(a, b, c);
|
||||
// ^ @variable
|
||||
// ^ @variable
|
||||
// ^ @variable
|
||||
// ^ @function
|
||||
// ^ @variable
|
||||
// ^ @variable
|
||||
// ^ @variable
|
||||
end.
|
||||
// <- @keyword
|
||||
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
abstract class A
|
||||
{
|
||||
protected readonly static $a;
|
||||
//^^^^^^^^^ @keyword.modifier
|
||||
// ^^^^^^^^ @keyword.modifier
|
||||
// ^^^^^^ @keyword.modifier
|
||||
public static function foo(): static {}
|
||||
//^^^^^^ @keyword.modifier
|
||||
// ^^^^^^ @keyword.modifier
|
||||
// ^^^^^^^^ @keyword.function
|
||||
// ^^^ @function.method
|
||||
// ^^^^^^ @type.builtin
|
||||
}
|
||||
|
||||
class B extends A implements T
|
||||
// ^ @type
|
||||
// ^^^^^^^ @keyword
|
||||
// ^^^^^^^^^^ @keyword
|
||||
{
|
||||
use T, U {
|
||||
//^^^ @keyword.import
|
||||
U::small insteadof T;
|
||||
// ^ @type
|
||||
// ^^^^^ @function.method
|
||||
// ^^^^^^^^^ @keyword
|
||||
// ^ @type
|
||||
T::big as protected tBig;
|
||||
// ^ @type
|
||||
// ^^^ @function.method
|
||||
// ^^ @keyword.operator
|
||||
// ^^^^^^^^^ @keyword.modifier
|
||||
// ^^^^ @function.method
|
||||
big as private tBig;
|
||||
// ^^^ @function.method
|
||||
// ^^ @keyword.operator
|
||||
// ^^^^^^^^^ @keyword.modifier
|
||||
// ^^^^ @function.method
|
||||
}
|
||||
public function foo(callable $call): self
|
||||
// ^^^^^^^^ @type.builtin
|
||||
// ^^^^ @type.builtin
|
||||
{
|
||||
static $a;
|
||||
// ^^^^^^ @keyword.modifier
|
||||
yield $a;
|
||||
// ^^^^^ @keyword.return
|
||||
yield from $a;
|
||||
// ^^^^ @keyword.return
|
||||
print "a";
|
||||
// ^^^^^ @keyword
|
||||
print("a");
|
||||
// ^^^^^ @keyword
|
||||
exit;
|
||||
// ^^^^ @keyword.return
|
||||
exit();
|
||||
// ^^^^ @function.builtin
|
||||
exit(1);
|
||||
// ^^^^ @function.builtin
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
function b(int $a, string $b): Foo\Dog {}
|
||||
// ^^^ @type.builtin
|
||||
// ^^ @variable.parameter
|
||||
// ^^^^^^ @type.builtin
|
||||
// ^^^ @module
|
||||
// ^^^ @type
|
||||
|
||||
function a(array $b) {
|
||||
// ^^^^^ @type.builtin
|
||||
echo (int) $foo;
|
||||
// ^^^ @type.builtin
|
||||
}
|
||||
|
||||
class A {
|
||||
public function foo(self $a): self {}
|
||||
// ^^^^ @type.builtin
|
||||
// ^^^^ @type.builtin
|
||||
private function baz(): static {}
|
||||
// ^^^^^^ @type.builtin
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
class A {
|
||||
public function foo(self $a): self {
|
||||
// ^ @variable.parameter
|
||||
new self();
|
||||
// ^^^^ @constructor
|
||||
new static();
|
||||
// ^^^^^^ @constructor
|
||||
new parent();
|
||||
// ^^^^^^ @constructor
|
||||
$this->foo();
|
||||
// ^^^^ @variable.builtin
|
||||
// ^^^ @function.method.call
|
||||
self::foo();
|
||||
// ^^^^ @variable.builtin
|
||||
// ^^^ @function.call
|
||||
static::foo();
|
||||
// ^^^^^^ @variable.builtin
|
||||
parent::foo();
|
||||
// ^^^^^^ @variable.builtin
|
||||
$this->foo;
|
||||
// ^^^ @variable.member
|
||||
$this->foo(a: 5);
|
||||
// ^ @variable.parameter
|
||||
A::$foo::$bar;
|
||||
// ^^^ @variable.member
|
||||
// ^^^ @variable.member
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
generator client {
|
||||
// ^ keyword
|
||||
provider = "go run github.com/prisma/prisma-client-go"
|
||||
// ^ variable
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
// ^ string
|
||||
url = env("DATABASE_URL")
|
||||
// ^ function
|
||||
}
|
||||
|
||||
model User {
|
||||
email String
|
||||
// ^ type
|
||||
username String @id
|
||||
// ^ operator
|
||||
password String
|
||||
fullName String @map("full_name")
|
||||
// ^ function
|
||||
avatarUrl String @map("avatar_url")
|
||||
about String?
|
||||
// ^ type
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
@@map("user")
|
||||
}
|
||||
|
||||
model Reaction {
|
||||
// ^ punctuation.bracket
|
||||
id Int @id @default(autoincrement())
|
||||
// ^ punctuation.bracket
|
||||
postId Int @map("post_id")
|
||||
userId String @map("user_id")
|
||||
type ReactionType
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
post Post @relation(fields: [postId], references: [id])
|
||||
// ^ property
|
||||
user User @relation(fields: [userId], references: [username])
|
||||
// ^ punctuation.bracket
|
||||
|
||||
@@map("reaction")
|
||||
}
|
||||
|
||||
enum ReactionType {
|
||||
// ^ keyword.type
|
||||
LIKE
|
||||
HAHA
|
||||
SAD
|
||||
ANGRY
|
||||
// ^ constant
|
||||
}
|
||||
|
||||
view ReactionView {
|
||||
// ^ keyword
|
||||
id Int @unique
|
||||
postId Int
|
||||
userId String
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
class Fields:
|
||||
def __init__(self, fields: list[int]) -> None:
|
||||
# ^^^ @type.builtin
|
||||
# ^^^^ @constant.builtin
|
||||
self.fields = fields
|
||||
# ^^^^^^ @variable.member
|
||||
self.__dunderfield__ = None
|
||||
# ^^^^^^^^^^^^^^^ @variable.member
|
||||
self._FunKyFielD = 0
|
||||
# ^^^^^^^^^^^ @variable.member
|
||||
self.NOT_A_FIELD = "IM NOT A FIELD"
|
||||
# ^^^^^^^^^^^ @constant
|
||||
@ -0,0 +1,4 @@
|
||||
from __future__ import print_function
|
||||
# ^ @keyword.import
|
||||
# ^ @constant.builtin
|
||||
# ^ @keyword.import
|
||||
@ -0,0 +1,51 @@
|
||||
match command.split():
|
||||
# ^ @keyword.conditional
|
||||
case ["quit"]:
|
||||
# ^ @keyword.conditional
|
||||
print("Goodbye!")
|
||||
quit_game()
|
||||
case ["look"]:
|
||||
# ^ @keyword.conditional
|
||||
current_room.describe()
|
||||
case ["get", obj]:
|
||||
# ^ @keyword.conditional
|
||||
character.get(obj, current_room)
|
||||
case ["go", direction]:
|
||||
# ^ @keyword.conditional
|
||||
current_room = current_room.neighbor(direction)
|
||||
# The rest of your commands go here
|
||||
|
||||
match command.split():
|
||||
# ^ @keyword.conditional
|
||||
case ["drop", *objects]:
|
||||
# ^ @keyword.conditional
|
||||
for obj in objects:
|
||||
character.drop(obj, current_room)
|
||||
|
||||
match command.split():
|
||||
# ^ @keyword.conditional
|
||||
case ["quit"]: ... # Code omitted for brevity
|
||||
case ["go", direction]: pass
|
||||
case ["drop", *objects]: pass
|
||||
case _:
|
||||
print(f"Sorry, I couldn't understand {command!r}")
|
||||
# ^^ @@function.macro
|
||||
|
||||
match command.split():
|
||||
# ^ @keyword.conditional
|
||||
case ["north"] | ["go", "north"]:
|
||||
# ^ @keyword.conditional
|
||||
current_room = current_room.neighbor("north")
|
||||
case ["get", obj] | ["pick", "up", obj] | ["pick", obj, "up"]:
|
||||
# ^ @keyword.conditional
|
||||
pass
|
||||
|
||||
match = 2
|
||||
# ^ @variable
|
||||
match, a = 2, 3
|
||||
# ^ @variable
|
||||
match: int = secret
|
||||
# ^ @variable
|
||||
x, match: str = 2, "hey, what's up?"
|
||||
# <- @variable
|
||||
# ^ @variable
|
||||
@ -0,0 +1,6 @@
|
||||
try:
|
||||
print(1 / 0)
|
||||
except Exception:
|
||||
raise RuntimeError from None
|
||||
# ^ @keyword.exception
|
||||
# ^ @keyword.exception
|
||||
@ -0,0 +1,7 @@
|
||||
from foo import bar
|
||||
# ^ @keyword.import
|
||||
# ^ @keyword.import
|
||||
def generator():
|
||||
yield from bar(42)
|
||||
# ^ @keyword.return
|
||||
# ^ @keyword.return
|
||||
@ -0,0 +1,47 @@
|
||||
init <- 1
|
||||
# ^ @variable
|
||||
# ^ @operator
|
||||
# ^ @number.float
|
||||
|
||||
r"{(\1\2)}" -> `%r%`
|
||||
# ^ @string
|
||||
# ^ @string.escape
|
||||
# ^ @operator
|
||||
# ^ @variable
|
||||
|
||||
|
||||
foo <- c(1L, 2L)
|
||||
# ^ @function.call
|
||||
# ^ @number
|
||||
|
||||
b <- list(TRUE, FALSE, NA, Inf)
|
||||
# ^ @boolean
|
||||
# ^ @boolean
|
||||
# ^ @constant.builtin
|
||||
# ^ @constant.builtin
|
||||
|
||||
b <- list(name = "r", version = R.version$major)
|
||||
# ^ @variable.parameter
|
||||
# ^ @string
|
||||
# ^ @operator
|
||||
# ^ @variable.member
|
||||
|
||||
Lang$new(name = "r")$print()
|
||||
# ^ @function.method.call
|
||||
|
||||
for(i in 1:10) {
|
||||
# <- @keyword.repeat
|
||||
# ^ @keyword.repeat
|
||||
}
|
||||
|
||||
add <- function(a, b = 1, ...) {
|
||||
# ^ @keyword.function
|
||||
# ^ @variable.parameter
|
||||
# ^ @variable.parameter
|
||||
# ^ @keyword
|
||||
return(a + b)
|
||||
}
|
||||
|
||||
base::letters
|
||||
# ^ @module
|
||||
# ^ @variable
|
||||
@ -0,0 +1,15 @@
|
||||
struct Foo;
|
||||
|
||||
// Issue https://github.com/nvim-treesitter/nvim-treesitter/issues/3641
|
||||
// Distinguish between for in loop or impl_item
|
||||
impl Drop for Foo {
|
||||
// ^ @keyword
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
for i in 0..128 {
|
||||
// <- @keyword.repeat
|
||||
println!("{i}");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
use crate::a;
|
||||
// ^ @module
|
||||
// ^ !keyword
|
||||
use crate::{b, c};
|
||||
// ^ @module
|
||||
// ^ !keyword
|
||||
use super::a;
|
||||
// ^ @module
|
||||
// ^ !keyword
|
||||
use super::{b, c};
|
||||
// ^ @module
|
||||
// ^ !keyword
|
||||
@ -0,0 +1,261 @@
|
||||
.class public Lbaksmali/test/class;
|
||||
# <- @keyword
|
||||
# ^^^^^^ @keyword.modifier
|
||||
.super Ljava/lang/Object;
|
||||
# ^ @character.special
|
||||
# ^^^^ @type.builtin
|
||||
# ^ @punctuation.delimiter
|
||||
|
||||
.source "baksmali_test_class.smali"
|
||||
# <- @keyword.import
|
||||
|
||||
.implements Lsome/interface;
|
||||
.implements Lsome/other/interface;
|
||||
|
||||
|
||||
.annotation build Lsome/annotation;
|
||||
# ^^^^^ @keyword.modifier
|
||||
# ^^^^ @type
|
||||
# ^ @punctuation.delimiter
|
||||
value1 = "test"
|
||||
# ^^^^^^ @variable.member
|
||||
# ^ @operator
|
||||
# ^^^^^^ @string
|
||||
value2 = .subannotation Lsome/annotation;
|
||||
value1 = "test2"
|
||||
value2 = Lsome/enum;
|
||||
.end subannotation
|
||||
.end annotation
|
||||
|
||||
.annotation system Lsome/annotation;
|
||||
.end annotation
|
||||
|
||||
|
||||
|
||||
.field public static aStaticFieldWithoutAnInitializer:I
|
||||
# ^ @punctuation.delimiter
|
||||
# ^ @type.builtin
|
||||
|
||||
.field public static longStaticField:J = 0x300000000L
|
||||
# ^^^^^^^^^^^^ @number
|
||||
.field public static longNegStaticField:J = -0x300000000L
|
||||
|
||||
.field public static intStaticField:I = 0x70000000
|
||||
.field public static intNegStaticField:I = -500
|
||||
|
||||
.field public static shortStaticField:S = 500s
|
||||
.field public static shortNegStaticField:S = -500s
|
||||
|
||||
.field public static byteStaticField:B = 123t
|
||||
.field public static byteNegStaticField:B = 0xAAt
|
||||
|
||||
.field public static floatStaticField:F = 3.1415926f
|
||||
# ^^^^^^^^^^ @number.float
|
||||
|
||||
.field public static doubleStaticField:D = 3.141592653589793
|
||||
|
||||
.field public static charStaticField:C = 'a'
|
||||
# ^^^ @character
|
||||
.field public static charEscapedStaticField:C = '\n'
|
||||
# ^^ @string.escape
|
||||
|
||||
.field public static boolTrueStaticField:Z = true
|
||||
# ^^^^ @boolean
|
||||
.field public static boolFalseStaticField:Z = false
|
||||
|
||||
.field public static typeStaticField:Ljava/lang/Class; = Lbaksmali/test/class;
|
||||
|
||||
.field public static stringStaticField:Ljava/lang/String; = "test"
|
||||
.field public static stringEscapedStaticField:Ljava/lang/String; = "test\ntest"
|
||||
|
||||
|
||||
.field public static fieldStaticField:Ljava/lang/reflect/Field; = Lbaksmali/test/class;->fieldStaticField:Ljava/lang/reflect/Field;
|
||||
|
||||
.field public static methodStaticField:Ljava/lang/reflect/Method; = Lbaksmali/test/class;->testMethod(ILjava/lang/String;)Ljava/lang/String;
|
||||
# ^^ @punctuation.delimiter
|
||||
# ^^^^^^^^^^ @function.method.call
|
||||
|
||||
.field public static arrayStaticField:[I = {1, 2, 3, {1, 2, 3, 4}}
|
||||
# ^ @punctuation.special
|
||||
# ^ @punctuation.bracket
|
||||
# ^ @punctuation.delimiter
|
||||
|
||||
.field public static enumStaticField:Lsome/enum; = .enum Lsome/enum;->someEnumValue:Lsome/enum;
|
||||
# ^^^^^^^^^^^^^ @variable.member
|
||||
|
||||
.field public static annotationStaticField:Lsome/annotation; = .subannotation Lsome/annotation;
|
||||
value1 = "test"
|
||||
value2 = .subannotation Lsome/annotation;
|
||||
value1 = "test2"
|
||||
value2 = Lsome/enum;
|
||||
.end subannotation
|
||||
.end subannotation
|
||||
|
||||
.field public static staticFieldWithAnnotation:I
|
||||
.annotation runtime La/field/annotation;
|
||||
# ^^^^^^^ @keyword.modifier
|
||||
this = "is"
|
||||
a = "test"
|
||||
.end annotation
|
||||
.annotation runtime Lorg/junit/Test;
|
||||
.end annotation
|
||||
.end field
|
||||
|
||||
.field public instanceField:Ljava/lang/String;
|
||||
|
||||
|
||||
|
||||
.method public constructor <init>()V
|
||||
# <- @keyword.function
|
||||
# ^^^^^^^^^^^ @constructor
|
||||
# ^^^^^^ @constructor
|
||||
.registers 1
|
||||
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
||||
# ^^^^^^^^^^^^^ @keyword.operator
|
||||
# ^^ @variable.parameter.builtin
|
||||
return-void
|
||||
# ^^^^^^^^^^^ @keyword.return
|
||||
.end method
|
||||
|
||||
.method public testMethod(ILjava/lang/String;)Ljava/lang/String;
|
||||
# ^^^^^^^^^^ @function.method
|
||||
.registers 3
|
||||
.annotation runtime Lorg/junit/Test;
|
||||
.end annotation
|
||||
.annotation system Lyet/another/annotation;
|
||||
somevalue = 1234
|
||||
anothervalue = 3.14159
|
||||
.end annotation
|
||||
|
||||
const-string v0, "testing\n123"
|
||||
# ^^ @variable.builtin
|
||||
|
||||
goto switch:
|
||||
# ^^^^^^^ @label
|
||||
|
||||
sget v0, Lbaksmali/test/class;->staticField:I
|
||||
|
||||
switch:
|
||||
packed-switch v0, pswitch:
|
||||
|
||||
try_start:
|
||||
const/4 v0, 7
|
||||
const v0, 10
|
||||
nop
|
||||
try_end:
|
||||
.catch Ljava/lang/Exception; {try_start: .. try_end:} handler:
|
||||
# ^^^^^^ @keyword.exception
|
||||
.catchall {try_start: .. try_end:} handler2:
|
||||
# ^^^^^^^^^ @keyword.exception
|
||||
# ^^ @operator
|
||||
|
||||
handler:
|
||||
|
||||
Label10:
|
||||
Label11:
|
||||
Label12:
|
||||
Label13:
|
||||
return-object v0
|
||||
|
||||
|
||||
|
||||
.array-data 4
|
||||
1 2 3 4 5 6 200
|
||||
.end array-data
|
||||
|
||||
pswitch:
|
||||
.packed-switch 10
|
||||
Label10:
|
||||
Label11:
|
||||
Label12:
|
||||
Label13:
|
||||
.end packed-switch
|
||||
|
||||
handler2:
|
||||
|
||||
return-void
|
||||
|
||||
.end method
|
||||
|
||||
.method public abstract testMethod2()V
|
||||
.annotation runtime Lsome/annotation;
|
||||
subannotation = .subannotation Lsome/other/annotation;
|
||||
value = "value"
|
||||
.end subannotation
|
||||
.end annotation
|
||||
.annotation runtime Lorg/junit/Test;
|
||||
.end annotation
|
||||
.end method
|
||||
|
||||
|
||||
.method public tryTest()V
|
||||
.registers 1
|
||||
|
||||
handler:
|
||||
nop
|
||||
|
||||
|
||||
try_start:
|
||||
const/4 v0, 7
|
||||
const v0, 10
|
||||
nop
|
||||
try_end:
|
||||
.catch Ljava/lang/Exception; {try_start: .. try_end:} handler:
|
||||
.end method
|
||||
|
||||
|
||||
.method public debugTest(IIIII)V
|
||||
.registers 10
|
||||
|
||||
.parameter "Blah"
|
||||
.parameter
|
||||
.parameter "BlahWithAnnotations"
|
||||
.annotation runtime Lsome/annotation;
|
||||
something = "some value"
|
||||
somethingelse = 1234
|
||||
.end annotation
|
||||
.annotation runtime La/second/annotation;
|
||||
.end annotation
|
||||
.end parameter
|
||||
.parameter
|
||||
.annotation runtime Lsome/annotation;
|
||||
something = "some value"
|
||||
somethingelse = 1234
|
||||
.end annotation
|
||||
.end parameter
|
||||
.parameter "LastParam"
|
||||
|
||||
.prologue
|
||||
# ^^^^^^^^^ @keyword
|
||||
|
||||
nop
|
||||
nop
|
||||
|
||||
.source "somefile.java"
|
||||
# ^^^^^^^ @keyword.import
|
||||
.line 101
|
||||
# ^^^ @string.special
|
||||
|
||||
nop
|
||||
|
||||
|
||||
.line 50
|
||||
|
||||
.local v0, aNumber:I
|
||||
# ^^^^^^^ @variable
|
||||
const v0, 1234
|
||||
.end local v0
|
||||
|
||||
.source "someotherfile.java"
|
||||
.line 900
|
||||
|
||||
const-string v0, "1234"
|
||||
|
||||
.restart local v0
|
||||
const v0, 6789
|
||||
.end local v0
|
||||
|
||||
.epilogue
|
||||
# ^^^^^^^^^ @keyword
|
||||
|
||||
.end method
|
||||
@ -0,0 +1,186 @@
|
||||
// Example contract from official documentation at https://github.com/ethereum/solidity/blob/v0.8.12/docs/examples/voting.rst
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
// ^ @comment
|
||||
pragma solidity >=0.7.0 <0.9.0;
|
||||
// ^ @keyword.directive
|
||||
// ^ @keyword.directive
|
||||
|
||||
import * as something from "anotherFile";
|
||||
// ^ ^ ^ @keyword.import
|
||||
|
||||
/// @title Voting with delegation.
|
||||
// <- @comment
|
||||
contract Ballot {
|
||||
// ^keyword.type
|
||||
// ^ @type
|
||||
// This declares a new complex type which will
|
||||
// be used for variables later.
|
||||
// It will represent a single voter.
|
||||
struct Voter {
|
||||
// ^ @type
|
||||
uint weight; // weight is accumulated by delegation
|
||||
// ^ @type.builtin
|
||||
// ^ @variable.member
|
||||
bool voted; // if true, that person already voted
|
||||
address delegate; // person delegated to
|
||||
uint vote; // index of the voted proposal
|
||||
}
|
||||
|
||||
// This is a type for a single proposal.
|
||||
struct Proposal {
|
||||
bytes32 name; // short name (up to 32 bytes)
|
||||
uint voteCount; // number of accumulated votes
|
||||
}
|
||||
|
||||
address public chairperson;
|
||||
// ^ @type.builtin
|
||||
|
||||
// This declares a state variable that
|
||||
// stores a `Voter` struct for each possible address.
|
||||
mapping(address => Voter) public voters;
|
||||
// ^ ^ @punctuation.bracket
|
||||
// ^ @punctuation.delimiter
|
||||
|
||||
// A dynamically-sized array of `Proposal` structs.
|
||||
Proposal[] public proposals;
|
||||
|
||||
enum ActionChoices { GoLeft, GoRight, GoStraight, SitStill }
|
||||
// ^ @constant
|
||||
|
||||
/// Create a new ballot to choose one of `proposalNames`.
|
||||
constructor(bytes32[] memory proposalNames) {
|
||||
// ^ @constructor
|
||||
chairperson = msg.sender;
|
||||
voters[chairperson].weight = 1;
|
||||
|
||||
// For each of the provided proposal names,
|
||||
// create a new proposal object and add it
|
||||
// to the end of the array.
|
||||
for (uint i = 0; i < proposalNames.length; i++) {
|
||||
// `Proposal({...})` creates a temporary
|
||||
// Proposal object and `proposals.push(...)`
|
||||
// appends it to the end of `proposals`.
|
||||
proposals.push(Proposal({
|
||||
name: proposalNames[i],
|
||||
// ^ @variable.member
|
||||
voteCount: 0
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
// Give `voter` the right to vote on this ballot.
|
||||
// May only be called by `chairperson`.
|
||||
function giveRightToVote(address voter) external {
|
||||
// ^ @keyword.function
|
||||
// ^ @function
|
||||
// ^ @variable.parameter
|
||||
// If the first argument of `require` evaluates
|
||||
// to `false`, execution terminates and all
|
||||
// changes to the state and to Ether balances
|
||||
// are reverted.
|
||||
// This used to consume all gas in old EVM versions, but
|
||||
// not anymore.
|
||||
// It is often a good idea to use `require` to check if
|
||||
// functions are called correctly.
|
||||
// As a second argument, you can also provide an
|
||||
// explanation about what went wrong.
|
||||
require(
|
||||
msg.sender == chairperson,
|
||||
"Only chairperson can give right to vote."
|
||||
);
|
||||
require(
|
||||
!voters[voter].voted,
|
||||
"The voter already voted."
|
||||
);
|
||||
require(voters[voter].weight == 0);
|
||||
voters[voter].weight = 1;
|
||||
}
|
||||
|
||||
/// Delegate your vote to the voter `to`.
|
||||
function delegate(address to) external {
|
||||
// assigns reference
|
||||
Voter storage sender = voters[msg.sender];
|
||||
require(!sender.voted, "You already voted.");
|
||||
|
||||
require(to != msg.sender, "Self-delegation is disallowed.");
|
||||
|
||||
// Forward the delegation as long as
|
||||
// `to` also delegated.
|
||||
// In general, such loops are very dangerous,
|
||||
// because if they run too long, they might
|
||||
// need more gas than is available in a block.
|
||||
// In this case, the delegation will not be executed,
|
||||
// but in other situations, such loops might
|
||||
// cause a contract to get "stuck" completely.
|
||||
while (voters[to].delegate != address(0)) {
|
||||
to = voters[to].delegate;
|
||||
|
||||
// We found a loop in the delegation, not allowed.
|
||||
require(to != msg.sender, "Found loop in delegation.");
|
||||
}
|
||||
|
||||
// Since `sender` is a reference, this
|
||||
// modifies `voters[msg.sender].voted`
|
||||
Voter storage delegate_ = voters[to];
|
||||
|
||||
// Voters cannot delegate to wallets that cannot vote.
|
||||
require(delegate_.weight >= 1);
|
||||
sender.voted = true;
|
||||
sender.delegate = to;
|
||||
if (delegate_.voted) {
|
||||
// If the delegate already voted,
|
||||
// directly add to the number of votes
|
||||
proposals[delegate_.vote].voteCount += sender.weight;
|
||||
} else {
|
||||
// If the delegate did not vote yet,
|
||||
// add to her weight.
|
||||
delegate_.weight += sender.weight;
|
||||
}
|
||||
}
|
||||
|
||||
/// Give your vote (including votes delegated to you)
|
||||
/// to proposal `proposals[proposal].name`.
|
||||
function vote(uint proposal) external {
|
||||
Voter storage sender = voters[msg.sender];
|
||||
require(sender.weight != 0, "Has no right to vote");
|
||||
require(!sender.voted, "Already voted.");
|
||||
sender.voted = true;
|
||||
sender.vote = proposal;
|
||||
|
||||
// If `proposal` is out of the range of the array,
|
||||
// this will throw automatically and revert all
|
||||
// changes.
|
||||
proposals[proposal].voteCount += sender.weight;
|
||||
}
|
||||
|
||||
/// @dev Computes the winning proposal taking all
|
||||
/// previous votes into account.
|
||||
function winningProposal() public view
|
||||
returns (uint winningProposal_)
|
||||
{
|
||||
uint winningVoteCount = 0;
|
||||
for (uint p = 0; p < proposals.length; p++) {
|
||||
if (proposals[p].voteCount > winningVoteCount) {
|
||||
winningVoteCount = proposals[p].voteCount;
|
||||
winningProposal_ = p;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Calls winningProposal() function to get the index
|
||||
// of the winner contained in the proposals array and then
|
||||
// returns the name of the winner
|
||||
function winnerName() external view
|
||||
returns (bytes32 winnerName_)
|
||||
{
|
||||
winnerName_ = proposals[winningProposal()].name;
|
||||
}
|
||||
}
|
||||
|
||||
contract Another {
|
||||
Ballot b = new Ballot(new bytes32[](1));
|
||||
// ^ @keyword.operator
|
||||
}
|
||||
|
||||
// vim:ft=solidity
|
||||
@ -0,0 +1,10 @@
|
||||
// This is a comment
|
||||
; <- @comment
|
||||
|
||||
; Another comment
|
||||
; <- @comment
|
||||
|
||||
ECHO &a // This is a trailing comment
|
||||
; ^ @comment
|
||||
|
||||
// vim: set ft=t32:
|
||||
@ -0,0 +1,125 @@
|
||||
PRIVATE &password
|
||||
; <- @keyword
|
||||
; ^ @variable.builtin
|
||||
ENTRY &password
|
||||
; <- @keyword
|
||||
; ^ @variable.parameter
|
||||
|
||||
ENTRY %LINE &salt
|
||||
; <- @keyword
|
||||
; ^ @constant.builtin
|
||||
; ^ @variable.parameter
|
||||
|
||||
IF "&password"==""
|
||||
; <- @keyword.conditional
|
||||
; ^ @string
|
||||
; ^ @variable.builtin
|
||||
; ^ @operator
|
||||
(
|
||||
ECHO "Failed to provide password."
|
||||
ENDDO
|
||||
; ^ @keyword.return
|
||||
)
|
||||
ELSE
|
||||
; <- @keyword.conditional
|
||||
(
|
||||
PRIVATE &pass
|
||||
|
||||
&pass=FALSE()
|
||||
; ^ @function.builtin
|
||||
WHILE !&pass
|
||||
; ^ @operator
|
||||
(
|
||||
GOSUB verify_password "&password"
|
||||
; ^ @function.call
|
||||
RETURNVALUES &pass
|
||||
; ^ @variable.parameter
|
||||
WAIT 10.ms
|
||||
; ^ @number.float
|
||||
)
|
||||
|
||||
IF !&pass
|
||||
GOTO fail
|
||||
; ^ @label
|
||||
ELSE IF &debug
|
||||
; ^ @keyword.conditional
|
||||
; ^ @keyword.conditional
|
||||
(
|
||||
GOSUB start_debug
|
||||
; ^ @function.call
|
||||
)
|
||||
)
|
||||
|
||||
LOCAL &num
|
||||
; ^ @variable.builtin
|
||||
|
||||
&num = 2.
|
||||
; ^ @number
|
||||
|
||||
RePeaT &num PRINT "Password: &password"
|
||||
; ^ @variable.builtin
|
||||
; ^ @variable.builtin
|
||||
|
||||
WinCLEAR
|
||||
FramePOS ,,,,Maximized
|
||||
; ^ @punctuation.delimiter
|
||||
; ^ @constant.builtin
|
||||
WinPOS 0% 50% 100% 35%
|
||||
; ^ @number.float
|
||||
COVerage.ListFunc
|
||||
|
||||
ENDDO
|
||||
|
||||
|
||||
fail:
|
||||
; <- @label
|
||||
PRINT %ERROR "Password verification failed."
|
||||
END
|
||||
; ^ @keyword.return
|
||||
|
||||
|
||||
verify_password:
|
||||
; <- @function
|
||||
(
|
||||
PARAMETERS &password
|
||||
; ^ @variable.parameter
|
||||
|
||||
SYStem.Option.KEYCODE "&password"
|
||||
SYStem.JtagClock 1kHz
|
||||
; ^ @number.float
|
||||
SYStem.Mode.Attach
|
||||
|
||||
Data.Set N: EAXI:0x34000000 %Long 0x34000100 0x34000021 /verify
|
||||
; ^ @constant.builtin
|
||||
; ^ @constant.builtin
|
||||
; ^ @number
|
||||
; ^ @constant.builtin
|
||||
; ^ @number
|
||||
; ^ @constant.builtin
|
||||
|
||||
RETURN TRUE()
|
||||
; ^ @keyword.return
|
||||
)
|
||||
|
||||
|
||||
SUBROUTINE start_debug
|
||||
; <- @keyword.function
|
||||
; ^ @function
|
||||
(
|
||||
COVerage.ListModule %MULTI.OBC \sieve
|
||||
; ^ @keyword
|
||||
; ^ @constant.builtin
|
||||
; ^ @string.special.symbol
|
||||
|
||||
Var.DRAW flags[0..16] /Alternate 3
|
||||
; ^ @keyword
|
||||
; ^ @variable
|
||||
; ^ @constant.builtin
|
||||
; ^ @number
|
||||
|
||||
Go main
|
||||
RETURN
|
||||
; ^ @keyword.return
|
||||
)
|
||||
|
||||
// vim: set ft=t32:
|
||||
@ -0,0 +1,39 @@
|
||||
WinPOS ,,1000.,,,,myWatchWindow
|
||||
; ^ @number
|
||||
|
||||
PRinTer.OPEN "~~~/varwatch.txt" ASCIIE
|
||||
; ^ @string
|
||||
|
||||
sYmbol.NEW _InitialSP 0x34000100
|
||||
; ^ @number
|
||||
|
||||
DO ~~~~/test.cmm
|
||||
; ^ @string.special.path
|
||||
|
||||
WAIT 1.ns
|
||||
; ^ @number.float
|
||||
|
||||
SYStem.JtagClock 100.GHZ
|
||||
; ^ @number.float
|
||||
|
||||
DATA.SET P:&HEAD+0x4 %LONG DATA.LONG(EA:&HEAD+0x4)&0xFFFFFF
|
||||
; ^ @constant.builtin
|
||||
|
||||
List `main`
|
||||
; ^ @string.special.symbol
|
||||
|
||||
&range = 'a'--'z'||'0'--'9'
|
||||
; ^ @character
|
||||
; ^ @operator
|
||||
; ^ @character
|
||||
|
||||
Data.Set N: 0xffff800000 0y0011xx01xx&&a
|
||||
; ^ @constant.builtin
|
||||
; ^ @number
|
||||
; ^ @number
|
||||
; ^ @operator
|
||||
|
||||
WinPOS 0% 85% 100% 15%
|
||||
; ^ @number.float
|
||||
|
||||
// vim: set ft=t32:
|
||||
@ -0,0 +1,75 @@
|
||||
Var.NEWGLOBAL char[4][32] \myarr
|
||||
; <- @keyword
|
||||
; ^ @type.builtin
|
||||
; ^ @variable.builtin
|
||||
LOCAL &i &data
|
||||
|
||||
&data="zero|one|two|three"
|
||||
|
||||
&i=0.
|
||||
WHILE &i<4
|
||||
(
|
||||
PRIVATE &val
|
||||
&val=STRing.SPLIT("&data","|",&i)
|
||||
Var.Assign \myarr[&i]="&val"
|
||||
; ^ @variable.builtin
|
||||
; ^ @operator
|
||||
&i=&i+1.
|
||||
)
|
||||
|
||||
Var.NEWLOCAL \x
|
||||
; <- @keyword
|
||||
; ^ @variable.builtin
|
||||
Var.set \x=func3(5,3)
|
||||
; ^ @variable.builtin
|
||||
; ^ @function.call
|
||||
; ^ @number
|
||||
PRINT Var.VALUE(\x)
|
||||
; ^ @variable.builtin
|
||||
PRINT Var.VALUE('a')
|
||||
; ^ @character
|
||||
Var.Assign (*ap)[2..4] = &a
|
||||
; ^ @variable
|
||||
; ^ @variable
|
||||
Var.Assign sp = &s.n+offset
|
||||
; ^ @variable
|
||||
; ^ @variable
|
||||
; ^ @variable.member
|
||||
; ^ @variable
|
||||
Var.Assign padd = (CAddition const * volatile)&d
|
||||
; ^ @variable
|
||||
; ^ @type
|
||||
; ^ @keyword.modifier
|
||||
; ^ @keyword.modifier
|
||||
; ^ @variable
|
||||
Var.Assign e1 = (enum e2)&e
|
||||
; ^ @variable
|
||||
; ^ @keyword.type
|
||||
; ^ @type
|
||||
; ^ @variable
|
||||
Var.Assign *vector = (struct Vector3d*)&acceleration
|
||||
; ^ @variable
|
||||
; ^ @keyword.type
|
||||
; ^ @type
|
||||
; ^ @variable
|
||||
Var.Assign z = (union foo)x
|
||||
; ^ @variable
|
||||
; ^ @keyword.type
|
||||
; ^ @type
|
||||
; ^ @variable
|
||||
Var.Assign b = -a
|
||||
; ^ @variable
|
||||
; ^ @variable
|
||||
Var.Assign c = i++
|
||||
; ^ @variable
|
||||
; ^ @variable
|
||||
Var.Assign d = sizeof(int)
|
||||
; ^ @variable
|
||||
; ^ @keyword.operator
|
||||
; ^ @type.builtin
|
||||
Var.call strcmp(key,buffer)
|
||||
; ^ @function.call
|
||||
; ^ @variable
|
||||
; ^ @variable
|
||||
|
||||
// vim: set ft=t32:
|
||||
@ -0,0 +1,44 @@
|
||||
let
|
||||
var a := exit(0)
|
||||
/* ^ @function.builtin */
|
||||
|
||||
primitive exit(ret: int) /* Shadowing the prelude-included built-in */
|
||||
/* ^ @type.builtin */
|
||||
|
||||
var b := exit(0)
|
||||
/* ^ @function.builtin */
|
||||
|
||||
type int = string /* Shadowing the built-in type */
|
||||
/* ^ @type.builtin */
|
||||
|
||||
var c : int := "This is an \"int\""
|
||||
/* ^ @type.builtin (not sure why it isn't 'type')*/
|
||||
|
||||
var d : Object := nil
|
||||
/* ^ @type.builtin */
|
||||
|
||||
type Object = int
|
||||
|
||||
var self := "self"
|
||||
in
|
||||
let
|
||||
var c : int := "This is an int"
|
||||
/* ^ @type.builtin (not sure why it isn't 'type')*/
|
||||
var d : Object := "This is an object"
|
||||
/* ^ @type.builtin (not sure why it isn't 'type')*/
|
||||
in
|
||||
end;
|
||||
|
||||
exit(1);
|
||||
/* <- @function.builtin */
|
||||
|
||||
print("shadowing is fun");
|
||||
/* <- @function.builtin */
|
||||
|
||||
self;
|
||||
/* <- @variable.builtin */
|
||||
|
||||
b := print
|
||||
/* ^ @variable */
|
||||
end
|
||||
/* vim: set ft=tiger: */
|
||||
@ -0,0 +1,6 @@
|
||||
/* This is /* a nested */ comment */
|
||||
/* <- @comment
|
||||
^ @comment
|
||||
^ @comment
|
||||
*/
|
||||
/* vim: set ft=tiger: */
|
||||
@ -0,0 +1,9 @@
|
||||
primitive print(s: string)
|
||||
/* ^ @function */
|
||||
/* ^ @variable.parameter */
|
||||
|
||||
function func(a: int) : int = (print("Hello World!"); a)
|
||||
/* ^ @function */
|
||||
/* ^ @variable.parameter */
|
||||
/* ^ @function.builtin */
|
||||
/* vim: set ft=tiger: */
|
||||
@ -0,0 +1,30 @@
|
||||
type int = int
|
||||
/* ^ @variable */
|
||||
/* ^ @type.builtin */
|
||||
|
||||
type int_array = array of int
|
||||
/* ^ @type.builtin */
|
||||
|
||||
type record = {a: int, b: string}
|
||||
/* ^ @variable.member */
|
||||
/* ^ @type.builtin */
|
||||
/* ^ @variable.member */
|
||||
/* ^ @type.builtin */
|
||||
|
||||
var record := record {a = 12, b = "27"}
|
||||
/* ^ @variable */
|
||||
/* ^ @type */
|
||||
/* ^ @variable.member */
|
||||
/* ^ @variable.member */
|
||||
|
||||
var array := int_array[12] of 27;
|
||||
/* ^ @variable */
|
||||
/* ^ @type */
|
||||
|
||||
primitive func(a: int, b: string) : array
|
||||
/* ^ @variable.parameter */
|
||||
/* ^ @type.builtin */
|
||||
/* ^ @variable.parameter */
|
||||
/* ^ @type.builtin */
|
||||
/* ^ @type */
|
||||
/* vim: set ft=tiger: */
|
||||
@ -0,0 +1,4 @@
|
||||
import "lib.tih"
|
||||
/* <- @keyword.import */
|
||||
/* ^ @string.special.path */
|
||||
/* vim: set ft=tiger: */
|
||||
@ -0,0 +1,42 @@
|
||||
let
|
||||
/* <- @keyword */
|
||||
|
||||
var a := 12
|
||||
/* <- @keyword */
|
||||
|
||||
function f() : int = a
|
||||
/* <- @keyword.function */
|
||||
primitive g()
|
||||
/* <- @keyword.function */
|
||||
|
||||
import "lib.tih"
|
||||
/* <- @keyword.import */
|
||||
|
||||
type array_of_int = array of int
|
||||
/* <- @keyword */
|
||||
/* ^ @keyword */
|
||||
/* ^ @keyword */
|
||||
|
||||
in
|
||||
/* <- @keyword */
|
||||
|
||||
12;
|
||||
|
||||
if 12 then 27 else 42;
|
||||
/* <- @keyword */
|
||||
/* ^ @keyword */
|
||||
/* ^ @keyword */
|
||||
|
||||
for i := 12 to 27 do 42;
|
||||
/* <- @keyword.repeat */
|
||||
/* ^ @keyword.repeat */
|
||||
/* ^ @keyword.repeat */
|
||||
|
||||
while 12 do break
|
||||
/* <- @keyword.repeat */
|
||||
/* ^ @keyword.repeat */
|
||||
/* ^ @keyword */
|
||||
|
||||
end
|
||||
/* <- @keyword */
|
||||
/* vim: set ft=tiger: */
|
||||
@ -0,0 +1,9 @@
|
||||
nil
|
||||
/* <- @constant.builtin */
|
||||
42
|
||||
/* <- @number */
|
||||
"Hello World!\n"
|
||||
/* <- @string
|
||||
^ @string.escape
|
||||
*/
|
||||
/* vim: set ft=tiger: */
|
||||
@ -0,0 +1,14 @@
|
||||
let
|
||||
_chunks(42)
|
||||
/* <- @keyword */
|
||||
|
||||
in
|
||||
_lvalue(12) : _namety(42) := _cast("I'm So Meta Even This Acronym", string);
|
||||
/* <- @keyword */
|
||||
/* ^ @keyword */
|
||||
/* ^ @keyword */
|
||||
|
||||
_exp(42)
|
||||
/* <- @keyword */
|
||||
end
|
||||
/* vim: set ft=tiger: */
|
||||
@ -0,0 +1,29 @@
|
||||
let
|
||||
class A extends Object {}
|
||||
/* <- @keyword.type */
|
||||
/* ^ @keyword */
|
||||
/* ^ @type.builtin */
|
||||
|
||||
type B = class extends A {
|
||||
/* ^ @keyword.type */
|
||||
/* ^ @keyword */
|
||||
/* ^ @type */
|
||||
|
||||
var a := 12
|
||||
|
||||
method meth() : int = self.a
|
||||
/* <- @keyword.function */
|
||||
/* ^ @function.method */
|
||||
/* ^ @variable.builtin */
|
||||
}
|
||||
|
||||
var object := new B
|
||||
/* ^ @keyword.operator */
|
||||
in
|
||||
object.a := 27;
|
||||
/* ^ @variable.member */
|
||||
|
||||
object.meth()
|
||||
/* ^ @function.method */
|
||||
end
|
||||
/* vim: set ft=tiger: */
|
||||
@ -0,0 +1,49 @@
|
||||
let
|
||||
var a : int := 42
|
||||
/* ^ @punctuation.delimiter */
|
||||
/* ^ @operator */
|
||||
in
|
||||
(
|
||||
/* <- @punctuation.bracket */
|
||||
|
||||
-1 | 2 & 3 + 4 * 5;
|
||||
/* <- @operator */
|
||||
/* ^ @operator */
|
||||
/* ^ @operator */
|
||||
/* ^ @operator */
|
||||
/* ^ @operator */
|
||||
/* ^ @punctuation.delimiter */
|
||||
|
||||
12 >= 27;
|
||||
/* ^ @operator */
|
||||
12 <= 27;
|
||||
/* ^ @operator */
|
||||
12 = 27;
|
||||
/* ^ @operator */
|
||||
12 <> 27;
|
||||
/* ^ @operator */
|
||||
12 < 27;
|
||||
/* ^ @operator */
|
||||
12 > 27;
|
||||
/* ^ @operator */
|
||||
|
||||
record.field;
|
||||
/* ^ @punctuation.delimiter */
|
||||
|
||||
func(a, b);
|
||||
/* ^ @punctuation.bracket */
|
||||
/* ^ @punctuation.bracket */
|
||||
/* ^ @punctuation.delimiter */
|
||||
|
||||
record_type { };
|
||||
/* ^ @punctuation.bracket */
|
||||
/* ^ @punctuation.bracket */
|
||||
|
||||
array[42]
|
||||
/* ^ @punctuation.bracket */
|
||||
/* ^ @punctuation.bracket */
|
||||
|
||||
)
|
||||
/* <- @punctuation.bracket */
|
||||
end
|
||||
/* vim: set ft=tiger: */
|
||||
@ -0,0 +1,8 @@
|
||||
import * as foo from 'foo';
|
||||
// ^ @keyword.import
|
||||
|
||||
export { foo as bar };
|
||||
// ^ @keyword.import
|
||||
|
||||
const n = 5 as number;
|
||||
// ^ @keyword.operator
|
||||
@ -0,0 +1,118 @@
|
||||
def Xform "cube" (
|
||||
assetInfo = {
|
||||
# <- @keyword
|
||||
asset[] payloadAssetDependencies = [@fizz.usd@, @buzz.usd@]
|
||||
# <- @type
|
||||
# ^ @keyword
|
||||
# ^ @string.special.url
|
||||
# ^ @string.special.url
|
||||
}
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
def "root" (
|
||||
add references = @foo.usda@</Model> (offset = 1; scale = 2.0)
|
||||
# <- @string.special.url
|
||||
# ^ @string.special
|
||||
# ^ @keyword
|
||||
# ^ @number
|
||||
# ^ @punctuation.delimiter
|
||||
# ^ @keyword
|
||||
# ^ @number.float
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
def "World"
|
||||
{
|
||||
over "points" (
|
||||
clips = {
|
||||
# <- @keyword
|
||||
dictionary default = {
|
||||
# <- @type
|
||||
# ^ @variable
|
||||
double2[] times = [(101, 101), (102, 102)]
|
||||
# <- @type
|
||||
# ^ @keyword
|
||||
# ^ @number
|
||||
}
|
||||
}
|
||||
)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
def Xform "torch_2" (
|
||||
payload = @./torch.usda@
|
||||
kind = "model"
|
||||
)
|
||||
{
|
||||
// Pre-published light list
|
||||
# <- @comment
|
||||
rel lightList = [ <light> ] # inline comment
|
||||
# ^ @comment
|
||||
token lightList:cacheBehavior = "consumeAndContinue"
|
||||
|
||||
double3 xformOp:translate = (1, 0, 0.5)
|
||||
uniform token[] xformOpOrder = ["xformOp:translate"]
|
||||
}
|
||||
|
||||
def "foo" (
|
||||
"some comment"
|
||||
# <- @comment.documentation
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
def "foo" (
|
||||
# inline comment
|
||||
"actual in-description comment"
|
||||
# <- @comment.documentation
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
def "foo" (
|
||||
add references = @foo.usda@
|
||||
# <- @function.call
|
||||
append references = @foo.usda@
|
||||
# <- @function.call
|
||||
delete references = @foo.usda@
|
||||
# <- @function.call
|
||||
reorder references = [@foo.usda@]
|
||||
# <- @function.call
|
||||
|
||||
references = [@foo.usda@] # explicit
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
over "Parent" (
|
||||
prepend references = [</InternalRef>, @./ref.usda@</RefParent>]
|
||||
# <- @function.call
|
||||
# ^ @keyword
|
||||
# ^ @string.special
|
||||
# ^ @string.special.url
|
||||
# ^ @string.special
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
def "foo"
|
||||
{
|
||||
float value.timeSamples = {
|
||||
# <- @type
|
||||
# ^ @variable
|
||||
# ^ @property
|
||||
-414: 14.4
|
||||
# <- @number
|
||||
# ^ @number.float
|
||||
10: 201.0,
|
||||
# <- @number
|
||||
# ^ @number.float
|
||||
10.123: 201.0123,
|
||||
# <- @number.float
|
||||
# ^ @number.float
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
dictionary foo = {}
|
||||
# <- @type
|
||||
half[] foo = [2, 1, 2]
|
||||
# <- @type
|
||||
string foo = "something"
|
||||
# <- @type
|
||||
timecode time = 1.0
|
||||
# <- @type
|
||||
token[] purpose = ["default", "render"]
|
||||
# <- @type
|
||||
|
||||
rel material:binding:collection:Erasers = None
|
||||
# <- @type
|
||||
# ^ @module
|
||||
# ^ @punctuation.delimiter
|
||||
# ^ @module
|
||||
# ^ @punctuation.delimiter
|
||||
# ^ @module
|
||||
# ^ @punctuation.delimiter
|
||||
# ^ @variable
|
||||
# ^ @constant.builtin
|
||||
@ -0,0 +1,9 @@
|
||||
#usda 1.0
|
||||
(
|
||||
subLayers = [
|
||||
# <- @keyword
|
||||
@./model_sub.usda@ (offset = 1)
|
||||
# <- @string.special.url
|
||||
# ^ @keyword
|
||||
]
|
||||
)
|
||||
@ -0,0 +1,19 @@
|
||||
bring cloud;
|
||||
// <- @keyword
|
||||
|
||||
class Foo {
|
||||
// <- @keyword.type
|
||||
// ^ @type
|
||||
// ^ @punctuation.bracket
|
||||
name: str;
|
||||
//^ @variable.member
|
||||
// ^ @type.builtin
|
||||
// ^ @punctuation.delimiter
|
||||
new(name: str) {
|
||||
//^ @keyword
|
||||
// ^ @variable
|
||||
this.name = name;
|
||||
// ^ @punctuation.delimiter
|
||||
// ^ @operator
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
test1.test2.test3();
|
||||
// <- @variable
|
||||
// ^ @variable.member
|
||||
// ^ @function.method.call
|
||||
@ -0,0 +1,46 @@
|
||||
// From https://docs.hhvm.com/hack/XHP/introduction (MIT licensed)
|
||||
|
||||
use namespace Facebook\XHP\Core as x;
|
||||
use type Facebook\XHP\HTML\{XHPHTMLHelpers, a, form};
|
||||
|
||||
|
||||
final xhp class a_post extends x\element {
|
||||
// ^ @keyword.modifier
|
||||
// ^ @keyword.modifier
|
||||
// ^ @keyword
|
||||
use XHPHTMLHelpers;
|
||||
|
||||
attribute string href @required;
|
||||
// ^ @attribute
|
||||
attribute string target;
|
||||
// ^ @keyword
|
||||
|
||||
<<__Override>>
|
||||
protected async function renderAsync(): Awaitable<x\node> {
|
||||
$id = $this->getID();
|
||||
|
||||
$anchor = <a>{$this->getChildren()}</a>;
|
||||
// ^ @tag.delimiter
|
||||
// ^ @tag
|
||||
$form = (
|
||||
<form
|
||||
id={$id}
|
||||
method="post"
|
||||
action={$this->:href}
|
||||
target={$this->:target}
|
||||
class="postLink">
|
||||
{$anchor}
|
||||
</form>
|
||||
);
|
||||
|
||||
$anchor->setAttribute(
|
||||
'onclick',
|
||||
'document.getElementById("'.$id.'").submit(); return false;',
|
||||
);
|
||||
$anchor->setAttribute('href', '#');
|
||||
// ^ @function.method.call
|
||||
|
||||
return $form;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,123 @@
|
||||
local highlighter = require "vim.treesitter.highlighter"
|
||||
local parsers = require "nvim-treesitter.parsers"
|
||||
local ts = vim.treesitter
|
||||
|
||||
local COMMENT_NODES = {
|
||||
markdown = "html_block",
|
||||
haskell = "haddock",
|
||||
}
|
||||
|
||||
local function check_assertions(file)
|
||||
local buf = vim.fn.bufadd(file)
|
||||
vim.fn.bufload(file)
|
||||
local lang = parsers.get_buf_lang(buf)
|
||||
assert.same(
|
||||
1,
|
||||
vim.fn.executable "highlight-assertions",
|
||||
'"highlight-assertions" not executable!'
|
||||
.. ' Get it via "cargo install --git https://github.com/theHamsta/highlight-assertions"'
|
||||
)
|
||||
local comment_node = COMMENT_NODES[lang] or "comment"
|
||||
local assertions = vim.fn.json_decode(
|
||||
vim.fn.system(
|
||||
"highlight-assertions -p '"
|
||||
.. vim.api.nvim_get_runtime_file("parser/" .. lang .. ".so", false)[1]
|
||||
.. "' -s '"
|
||||
.. file
|
||||
.. "' -c "
|
||||
.. comment_node
|
||||
)
|
||||
)
|
||||
local parser = parsers.get_parser(buf, lang)
|
||||
|
||||
local self = highlighter.new(parser, {})
|
||||
|
||||
assert.True(#assertions > 0, "No assertions detected!")
|
||||
for _, assertion in ipairs(assertions) do
|
||||
local row = assertion.position.row
|
||||
local col = assertion.position.column
|
||||
|
||||
local captures = {}
|
||||
local highlights = {}
|
||||
self.tree:for_each_tree(function(tstree, tree)
|
||||
if not tstree then
|
||||
return
|
||||
end
|
||||
|
||||
local root = tstree:root()
|
||||
local root_start_row, _, root_end_row, _ = root:range()
|
||||
|
||||
-- Only worry about trees within the line range
|
||||
if root_start_row > row or root_end_row < row then
|
||||
return
|
||||
end
|
||||
|
||||
local query = self:get_query(tree:lang())
|
||||
|
||||
-- Some injected languages may not have highlight queries.
|
||||
if not query:query() then
|
||||
return
|
||||
end
|
||||
|
||||
local iter = query:query():iter_captures(root, self.bufnr, row, row + 1)
|
||||
|
||||
for capture, node, _ in iter do
|
||||
local hl = query.hl_cache[capture]
|
||||
assert.is.truthy(hl)
|
||||
|
||||
assert.Truthy(node)
|
||||
assert.is.number(row)
|
||||
assert.is.number(col)
|
||||
if hl and ts.is_in_node_range(node, row, col) then
|
||||
local c = query._query.captures[capture] -- name of the capture in the query
|
||||
if c ~= nil and c ~= "spell" and c ~= "conceal" then
|
||||
captures[c] = true
|
||||
highlights[c] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end, true)
|
||||
if assertion.expected_capture_name:match "^!" then
|
||||
assert.Falsy(
|
||||
captures[assertion.expected_capture_name:sub(2)] or highlights[assertion.expected_capture_name:sub(2)],
|
||||
"Error in at "
|
||||
.. file
|
||||
.. ":"
|
||||
.. (row + 1)
|
||||
.. ":"
|
||||
.. (col + 1)
|
||||
.. ': expected "'
|
||||
.. assertion.expected_capture_name
|
||||
.. '", captures: '
|
||||
.. vim.inspect(vim.tbl_keys(captures))
|
||||
.. '", highlights: '
|
||||
.. vim.inspect(vim.tbl_keys(highlights))
|
||||
)
|
||||
else
|
||||
assert.True(
|
||||
captures[assertion.expected_capture_name] or highlights[assertion.expected_capture_name],
|
||||
"Error in at "
|
||||
.. file
|
||||
.. ":"
|
||||
.. (row + 1)
|
||||
.. ":"
|
||||
.. (col + 1)
|
||||
.. ': expected "'
|
||||
.. assertion.expected_capture_name
|
||||
.. '", captures: '
|
||||
.. vim.inspect(vim.tbl_keys(captures))
|
||||
.. '", highlights: '
|
||||
.. vim.inspect(vim.tbl_keys(highlights))
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe("highlight queries", function()
|
||||
local files = vim.fn.split(vim.fn.glob "tests/query/highlights/**/*.*")
|
||||
for _, file in ipairs(files) do
|
||||
it(file, function()
|
||||
check_assertions(file)
|
||||
end)
|
||||
end
|
||||
end)
|
||||
@ -0,0 +1,86 @@
|
||||
require "nvim-treesitter.highlight" -- yes, this is necessary to set the hlmap
|
||||
local highlighter = require "vim.treesitter.highlighter"
|
||||
local configs = require "nvim-treesitter.configs"
|
||||
local parsers = require "nvim-treesitter.parsers"
|
||||
local ts = vim.treesitter
|
||||
|
||||
local function check_assertions(file)
|
||||
local buf = vim.fn.bufadd(file)
|
||||
vim.fn.bufload(file)
|
||||
local lang = parsers.get_buf_lang(buf)
|
||||
assert.same(
|
||||
1,
|
||||
vim.fn.executable "highlight-assertions",
|
||||
'"highlight-assertions" not executable!'
|
||||
.. ' Get it via "cargo install --git https://github.com/theHamsta/highlight-assertions"'
|
||||
)
|
||||
local assertions = vim.fn.json_decode(
|
||||
vim.fn.system(
|
||||
"highlight-assertions -p '" .. configs.get_parser_install_dir() .. "/" .. lang .. ".so'" .. " -s '" .. file .. "'"
|
||||
)
|
||||
)
|
||||
local parser = parsers.get_parser(buf, lang)
|
||||
|
||||
local self = highlighter.new(parser, {})
|
||||
local top_level_root = parser:parse()[1]:root()
|
||||
|
||||
for _, assertion in ipairs(assertions) do
|
||||
local row = assertion.position.row
|
||||
local col = assertion.position.column
|
||||
|
||||
local neg_assert = assertion.expected_capture_name:match "^!"
|
||||
assertion.expected_capture_name = neg_assert and assertion.expected_capture_name:sub(2)
|
||||
or assertion.expected_capture_name
|
||||
local found = false
|
||||
self.tree:for_each_tree(function(tstree, tree)
|
||||
if not tstree then
|
||||
return
|
||||
end
|
||||
local root = tstree:root()
|
||||
--- If there are multiple tree with the smallest range possible
|
||||
--- Check all of them to see if they fit or not
|
||||
if not ts.is_in_node_range(root, row, col) or root == top_level_root then
|
||||
return
|
||||
end
|
||||
if assertion.expected_capture_name == tree:lang() then
|
||||
found = true
|
||||
end
|
||||
end, true)
|
||||
if neg_assert then
|
||||
assert.False(
|
||||
found,
|
||||
"Error in at "
|
||||
.. file
|
||||
.. ":"
|
||||
.. (row + 1)
|
||||
.. ":"
|
||||
.. (col + 1)
|
||||
.. ': expected "'
|
||||
.. assertion.expected_capture_name
|
||||
.. '" not to be injected here!'
|
||||
)
|
||||
else
|
||||
assert.True(
|
||||
found,
|
||||
"Error in at "
|
||||
.. file
|
||||
.. ":"
|
||||
.. (row + 1)
|
||||
.. ":"
|
||||
.. (col + 1)
|
||||
.. ': expected "'
|
||||
.. assertion.expected_capture_name
|
||||
.. '" to be injected here!'
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe("injections", function()
|
||||
local files = vim.fn.split(vim.fn.glob "tests/query/injections/**/*.*")
|
||||
for _, file in ipairs(files) do
|
||||
it(file, function()
|
||||
check_assertions(file)
|
||||
end)
|
||||
end
|
||||
end)
|
||||
@ -0,0 +1,2 @@
|
||||
#define FOO(X,Y) X + Y
|
||||
// ^ @cuda
|
||||
@ -0,0 +1,6 @@
|
||||
FROM foo
|
||||
RUN bar
|
||||
# ^ @bash
|
||||
RUN \
|
||||
baz
|
||||
# ^ @bash
|
||||
@ -0,0 +1,9 @@
|
||||
html`<p></p>`;
|
||||
// ^ @html
|
||||
html(`<p></p>`);
|
||||
// ^ @html
|
||||
svg`<p></p>`;
|
||||
// ^ @html
|
||||
svg(`<p></p>`);
|
||||
// ^ @html
|
||||
|
||||
@ -0,0 +1,55 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title></title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="css/style.css" rel="stylesheet">
|
||||
<style> footer{ } </style>
|
||||
<!-- ^ @css -->
|
||||
<style title="Test Style without type attribute"> footer{ } </style>
|
||||
<!-- ^ @css -->
|
||||
<style type="text/css" title="test style with defined type attribute"> footer{ } </style>
|
||||
<!-- ^ @css -->
|
||||
</head>
|
||||
<body>
|
||||
<script> const x = 1 </script>
|
||||
<!-- ^ @javascript -->
|
||||
<script defer> const x = 1 </script>
|
||||
<!-- ^ @javascript -->
|
||||
<script async defer> const x = 1 </script>
|
||||
<!-- ^ @javascript -->
|
||||
<script type="text/javascript"> const x = 1 </script>
|
||||
<!-- ^ @javascript -->
|
||||
<script type="text/ecmascript"> const x = 1 </script>
|
||||
<!-- ^ @javascript -->
|
||||
<script type="application/ecmascript"> const x = 1 </script>
|
||||
<!-- ^ @javascript -->
|
||||
<script type="application/javascript"> const x = 1 </script>
|
||||
<!-- ^ @javascript -->
|
||||
<script type="module"> import { foo } from "bar" </script>
|
||||
<!-- ^ @javascript -->
|
||||
<script defer type="text/javascript"> const x = 1 </script>
|
||||
<!-- ^ @javascript -->
|
||||
<script type="text/markdown">## Hello *World*!</script>
|
||||
<!-- ^ @markdown -->
|
||||
<script type="application/graphql">query OK { dokey }</script>
|
||||
<!-- ^ @graphql -->
|
||||
<script type="application/typescript">type A = number;</script>
|
||||
<!-- ^ @typescript -->
|
||||
<script type="application/json">{ "true": false }</script>
|
||||
<!-- ^ @json -->
|
||||
<script type="importmap">{ "true": false }</script>
|
||||
<!-- ^ @json -->
|
||||
<div style="height: 100%">
|
||||
<!-- ^ @css -->
|
||||
Test div to test css injections for style attributes
|
||||
</div>
|
||||
|
||||
<input pattern="[0-9]+">
|
||||
<!-- ^ @regex -->
|
||||
<input pattern=[0-9]+ type="tel">
|
||||
<!-- ^ @regex -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,22 @@
|
||||
<script> import Button from "./Button.svelte"; </script>
|
||||
<!-- ^ @javascript -->
|
||||
<script lang="ts"> const foo: number = 1
|
||||
</script>
|
||||
<!-- ^ @typescript -->
|
||||
<!-- ^ @!javascript -->
|
||||
|
||||
<style> main { font-family: sans-serif; text-align: center; } </style>
|
||||
<!-- ^ @css -->
|
||||
<style lang="scss"> main { &:hover { } } </style>
|
||||
<!-- ^ @scss -->
|
||||
<!-- ^ @!css -->
|
||||
|
||||
<main>
|
||||
<h1>Test file</h1>
|
||||
{#each someItems as someItem}
|
||||
<!-- ^ @javascript -->
|
||||
<div>{someItem}</div>
|
||||
<!-- ^ @javascript -->
|
||||
{/each}
|
||||
<Button />
|
||||
<button on:click={() => foo++}></button>
|
||||
@ -0,0 +1,4 @@
|
||||
<script lang="ts"> const foo: number = "1" </script>
|
||||
<!-- ^ @!javascript -->
|
||||
<style lang="scss"> .bar { &-baz { &.page{ } } } </style>
|
||||
<!-- ^ @!css -->
|
||||
@ -0,0 +1,39 @@
|
||||
<template>
|
||||
<span>{{"Text inside interpolation"}}</span>
|
||||
<!-- ^ @typescript -->
|
||||
|
||||
<template lang="pug"> a(:href="url") some link title in pug: </template>
|
||||
<!-- ^ @pug -->
|
||||
|
||||
<template v-if="'text inside directives'"></template>
|
||||
<!-- ^ @typescript -->
|
||||
</template>
|
||||
<script> const foo = "1" </script>
|
||||
<!-- ^ @javascript -->
|
||||
<script defer> const foo = "1" </script>
|
||||
<!-- ^ @javascript -->
|
||||
<script lang="js">function x(){ return 1;}</script>
|
||||
<!-- ^ @javascript -->
|
||||
<script lang="ts"> const foo: number = "1" </script>
|
||||
<!-- ^ @typescript -->
|
||||
<!-- ^ @!javascript -->
|
||||
<script lang="ts" defer>const foo: number = 1 </script>
|
||||
<!-- ^ @typescript -->
|
||||
<!-- ^ @!javascript -->
|
||||
<script lang="tsx" defer>const foo: number = 1</script>
|
||||
<!-- ^ @tsx -->
|
||||
<!-- ^ @!jsx -->
|
||||
<!-- ^ @!typescript -->
|
||||
<style> .bar { .foo{ } } </style>
|
||||
<!-- ^ @css -->
|
||||
<style scoped> .page.page--news { background: rebeccapurple; } </style>
|
||||
<!-- ^ @css -->
|
||||
<style lang="css"> .bar { justify-content: center; } </style>
|
||||
<!-- ^ @css -->
|
||||
<style lang="scss"> .bar { &-baz { } } </style>
|
||||
<!-- ^ @scss -->
|
||||
<!-- ^ @!css -->
|
||||
<style scoped lang="scss">body{} </style>
|
||||
<!-- ^ @scss -->
|
||||
<!-- ^ @!css -->
|
||||
// const file = files[0];
|
||||
@ -0,0 +1,32 @@
|
||||
name: CI
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '16'
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
# ^ @bash
|
||||
- name: Run tests
|
||||
run: npm test
|
||||
# ^ @bash
|
||||
- name: Parse Petalisp
|
||||
run: |
|
||||
git submodule init
|
||||
git submodule update
|
||||
if (( $(node_modules/tree-sitter-cli/tree-sitter parse test/Petalisp/**/*.lisp -q | wc -l) > 2 )); then # There are 2 known failures (strings that are not format strings but use ~X syntax)
|
||||
exit 1
|
||||
else
|
||||
echo "Successfully parsed Petalisp"
|
||||
fi
|
||||
# ^ @bash
|
||||
- name: Run tests
|
||||
run: npm test
|
||||
@ -0,0 +1,19 @@
|
||||
groups:
|
||||
- name: Hardware alerts
|
||||
rules:
|
||||
- alert: Node down
|
||||
expr: up{job="node_exporter"} == 0
|
||||
# ^ @promql
|
||||
for: 3m
|
||||
labels:
|
||||
severity: warning
|
||||
annotations:
|
||||
title: Node {{ $labels.instance }} is down
|
||||
description: Failed to scrape {{ $labels.job }} on {{ $labels.instance }} for more than 3 minutes. Node seems down.
|
||||
- alert: Node down
|
||||
expr: |
|
||||
up{job="node_exporter"} == 0
|
||||
# ^ @promql
|
||||
for: 3m
|
||||
labels:
|
||||
severity: warning
|
||||
Reference in New Issue
Block a user