feat!: align standard captures with upstream

Problem: Sharing highlight queries with upstream tree-sitter and
Helix is difficult.

Solution: Where reasonable, use capture names in tree-sitter's standard
list or Helix's Atom-style hierarchy.

Specifically:

* tree-sitter "standard capture names"
  (3f44b89685/highlight/src/lib.rs (L20-L72)):

  - `@parameter` -> `@variable.parameter`
  - `@field` -> `@variable.member`
  - `@namespace` -> `@module`
  - `@float` -> `@number.float`
  - `@symbol` -> `@string.special.symbol`
  - `@string.regex` -> `@string.regexp`
  - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below)
  - `@text.title` -> `@markup.heading`
  - `@text.literal` -> `@markup.raw`
  - `@text.reference` -> `@markup.link`
  - `@text.uri` -> `@markup.link.url` (in markup links)
  - `@string.special` -> `@markup.link.label` (non-url links)
  - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`)

* Helix captures
  (https://docs.helix-editor.com/master/themes.html#syntax-highlighting):

  - `@method` -> `@function.method`
  - `@method.call` -> `@function.method.call`
  - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}`
  - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}`
  - `@text.uri` -> `@string.special.url` (outside markup)
  - `@preproc` -> `@keyword.directive`
  - `@define` -> `@keyword.directive`(`.define`?)
  - `@storageclass` -> `@keyword.storage`
  - `@conditional` -> `@keyword.conditional`
  - `@debug` -> `@keyword.debug`
  - `@exception` -> `@keyword.exception`
  - `@include` -> `@keyword.import`
  - `@repeat` -> `@keyword.repeat`

* cleanup

  - remove some redundant `@conceal` (but still allow it for conceal-only patterns)
  - remove obsolete `@error` (syntax linting is out of scope for this repo)
  - sort, cleanup capture list in `CONTRIBUTING.md`
This commit is contained in:
Christian Clason 2023-12-24 10:00:20 +01:00
parent 10dd49958c
commit 1ae9b0e455
263 changed files with 2356 additions and 2337 deletions

View file

@ -20,15 +20,15 @@
# THE SOFTWARE.
@0xd508eebdc2dc42b8;
# <- @preproc
# <- @keyword.directive
# ^ @punctuation.delimiter
using Cxx = import "c++.capnp";
# <- @include
# <- @keyword.import
# ^^^ @type
# ^ @operator
# ^^^^^^ @include
# ^^^^^^^^^^^ @string
# ^^^^^^ @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.
@ -53,7 +53,7 @@ enum TestEnum {
struct TestAllTypes {
# <- @keyword
voidField @0 : Void;
# ^^^^^^^^^ @field
# ^^^^^^^^^ @variable.member
# ^ @punctuation.special
# ^^^^ @type.builtin
boolField @1 : Bool;
@ -150,7 +150,7 @@ struct TestUnionDefaults {
struct TestUsing {
using OuterNestedEnum = TestNestedTypes.NestedEnum;
# ^^^^^ @include
# ^^^^^ @keyword.import
using TestNestedTypes.NestedStruct.NestedEnum;
outerNestedEnum @1 :OuterNestedEnum = bar;
@ -179,7 +179,7 @@ struct TestWholeFloatDefault {
bigField @1 :Float32 = 2e30;
const constant :Float32 = 456;
const bigConstant :Float32 = 4e30;
# ^^^^ @float
# ^^^^ @number.float
}
struct TestGenerics(Foo, Bar) {
@ -217,7 +217,7 @@ struct TestGenerics(Foo, Bar) {
# ^^^^^^^^^ @keyword
# At one time this failed to compile.
call @0 () -> ();
# ^^^^ @method
# ^^^^ @function.method
# ^^ @punctuation.delimiter
}
}
@ -225,14 +225,14 @@ struct TestGenerics(Foo, Bar) {
interface Interface(Qux) {
call @0 Inner2(Text) -> (qux :Qux, gen :TestGenerics(TestAllTypes, TestAnyPointer));
# ^^^ @parameter
# ^^^ @parameter
# ^^^ @variable.parameter
# ^^^ @variable.parameter
}
annotation ann(struct) :Foo;
# ^^^^^^^^^^ @keyword
# ^^^ @method
# ^^^^^^ @parameter.builtin
# ^^^ @function.method
# ^^^^^^ @variable.parameter.builtin
using AliasFoo = Foo;
using AliasInner = Inner;
@ -423,7 +423,7 @@ const genericConstant :TestGenerics(TestAllTypes, Text) =
(foo = (int16Field = 123), rev = (foo = "text", rev = (foo = (int16Field = 321))));
const embeddedData :Data = embed "testdata/packed";
# ^^^^^ @include
# ^^^^^ @keyword.import
const embeddedText :Text = embed "testdata/short.txt";
const embeddedStruct :TestAllTypes = embed "testdata/binary";
@ -452,7 +452,7 @@ const anyPointerConstants :TestAnyPointerConstants = (
interface TestInterface {
foo @0 (i :UInt32, j :Bool) -> (x :Text);
# ^ @parameter
# ^ @variable.parameter
bar @1 () -> ();
baz @2 (s: TestAllTypes);
}

View file

@ -1,7 +1,7 @@
(ns test {:clj-kondo/ignore true})
; <- @punctuation.bracket
; ^ @include
; ^ @namespace
; ^ @keyword.import
; ^ @module
; asdf
;^^^^^^ @comment
@ -19,7 +19,7 @@
; ^ ^^ ^^ @variable.builtin
&
;^ @parameter
;^ @variable.parameter
->abc
;^^^^^ @constructor
@ -31,16 +31,16 @@
;^^ ^^ ^^ ^^ @variable.builtin
(.method)
;^^^^^^^ @method
;^^^^^^^ @function.method
(.-field)
;^^^^^^^ @field
;^^^^^^^ @variable.member
Abc/method
;^^^^^^^^^^ @field
;^^^^^^^^^^ @variable.member
(Abc/method)
;^^^^^^^^^^ @method
;^^^^^^^^^^ @function.method
Abc
;^^^ @type

View file

@ -7,7 +7,7 @@ concept Derived = std::is_base_of<U, T>::value;
template<typename T>
concept Hashable = requires(T a) {
// ^ @keyword
// ^ @parameter
// ^ @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

View file

@ -11,7 +11,7 @@ void foo(Foo f){
switch ( f ) {
case Foo::a:
// ^ @type
// ^ @namespace
// ^ @module
// ^ @constant
break;
case Foo::aa:

View file

@ -1,11 +1,11 @@
#include <iostream>
#include <cstdlib>
// ^ @include
// ^ @keyword.import
// ^ @string
auto main( int argc, char** argv ) -> int
// ^ @type.builtin
// ^ @parameter
// ^ @variable.parameter
// ^ @type.builtin
// ^ @type.builtin
// ^ @operator

View file

@ -6,21 +6,21 @@ class H {
// ^ @property
#private_method() {
// ^ @method
// ^ @function.method
return `${this.pub_field} -- ${this.#priv_field}`;
// ^ @property
// ^ @property
}
public_method() {
// ^ @method
// ^ @function.method
return this.#private_method();
// ^ @method.call
// ^ @function.method.call
}
ok() {
return this.public_method();
// ^ @method.call
// ^ @function.method.call
}
}

View file

@ -1,12 +1,12 @@
include: SomeFile.fusion
//<- @include
// ^ @text.uri
//<- @keyword.import
// ^ @string.special.url
namespace: ns = Neos.Fusion.Space
//<- @keyword
// ^ @namespace
// ^ @module
// ^ @operator
// ^ @namespace
// ^ @module
prototype(MyType) < prototype(ns:SuperType) {
//<-keyword
@ -14,7 +14,7 @@ prototype(MyType) < prototype(ns:SuperType) {
// ^ @type
// ^ @punctuation.bracket
// ^ @operator
// ^ @namespace
// ^ @module
// ^ @type
deleteProp >
@ -48,12 +48,12 @@ prototype(MyType) < prototype(ns:SuperType) {
property.aliasedType = ns:SomeType
//<- @property
// ^ @namespace
// ^ @module
// ^ @type
property.fullQualifiedType = SomeNamespace:SomeType
//<- @property
// ^ @namespace
// ^ @module
// ^ @type
}

View file

@ -76,7 +76,7 @@ logic = ${!foo && !(bar || baz) and not 'string'}
// ^operator
ternary = ${ check ? true : false}
// ^@conditional.ternary
// ^@conditional.ternary
// ^@keyword.conditional.ternary
// ^@keyword.conditional.ternary

View file

@ -1,5 +1,5 @@
[attr]nodiff -diff -merge
# <- @preproc
# <- @keyword.directive
# ^^^^^^ @property
# ^ @operator
# ^^^^ @variable.builtin
@ -9,7 +9,7 @@
vendor/** linguist-vendored=true
# ^ @punctuation.delimiter
# ^^ @character.special
# ^^^^^^^^^^^^^^^^^ @parameter
# ^^^^^^^^^^^^^^^^^ @variable.parameter
# ^ @operator
# ^^^^ @boolean
@ -22,7 +22,7 @@ vendor/** linguist-vendored=true
# ^^^^^^^^^ @constant
# ^ @punctuation.bracket
# ^ @operator
# ^^^^^^^^^^ @parameter
# ^^^^^^^^^^ @variable.parameter
"_\u4E00\t\56txt" encoding=UTF-16
# <- @punctuation.special

View file

@ -1,6 +1,6 @@
pub fn main() {
assert Ok(i) = parse_int("123")
// <- @exception
// <- @keyword.exception
// ^^ @constructor
// ^ @punctuation.bracket
// ^ @variable

View file

@ -3,11 +3,11 @@ pub fn add(x: Int, y: Int) -> Int {
// ^^ @keyword.function
// ^^^ @function
// ^ @punctuation.bracket
// ^ @parameter
// ^ @variable.parameter
// ^ @punctuation.delimiter
// ^^^ @type.builtin
// ^ @punctuation.delimiter
// ^ @parameter
// ^ @variable.parameter
// ^ @punctuation.delimiter
// ^^^ @type.builtin
// ^ @punctuation.bracket
@ -22,7 +22,7 @@ pub fn twice(f: fn(t) -> t, x: t) -> t {
// ^ @keyword.function
// ^^^^^ @function
// ^ @punctuation.bracket
// ^ @parameter
// ^ @variable.parameter
// ^ @punctuation.delimiter
// ^^ @keyword.function
// ^ @punctuation.bracket
@ -31,7 +31,7 @@ pub fn twice(f: fn(t) -> t, x: t) -> t {
// ^^ @punctuation.delimiter
// ^ @type
// ^ @punctuation.delimiter
// ^ @parameter
// ^ @variable.parameter
// ^ @punctuation.delimiter
// ^ @type
// ^ @punctuation.bracket
@ -45,7 +45,7 @@ fn list_of_two(my_value: a) -> List(a) {
// <- @keyword.function
// ^ @function
// ^ @punctuation.bracket
// ^ @parameter
// ^ @variable.parameter
// ^ @punctuation.delimiter
// ^ @type
// ^ @punctuation.bracket
@ -64,19 +64,19 @@ fn replace(
// ^ @punctuation.bracket
in string: String,
// <- @label
// ^^^^^^ @parameter
// ^^^^^^ @variable.parameter
// ^ @punctuation.delimiter
// ^^^^^^ @type.builtin
// ^ @punctuation.delimiter
each pattern: String,
// <- @label
// ^^^^^^^ @parameter
// ^^^^^^^ @variable.parameter
// ^ @punctuation.delimiter
// ^^^^^^ @type.builtin
// ^ @punctuation.delimiter
with replacement: String,
// <- @label
// ^^^^^^^^^^^ @parameter
// ^^^^^^^^^^^ @variable.parameter
// ^ @punctuation.delimiter
// ^^^^^^ @type.builtin
// ^ @punctuation.delimiter
@ -109,7 +109,7 @@ pub external fn random_float() -> Float = "rand" "uniform"
// ^^ @punctuation.delimiter
// ^^^^^ @type.builtin
// ^ @operator
// ^^^^^^ @namespace
// ^^^^^^ @module
// ^^^^^^^^^ @function
pub external fn inspect(a) -> a = "Elixir.IO" "inspect"
@ -123,5 +123,5 @@ pub external fn inspect(a) -> a = "Elixir.IO" "inspect"
// ^^ @punctuation.delimiter
// ^ @type
// ^ @operator
// ^^^^^^^^^^^ @namespace
// ^^^^^^^^^^^ @module
// ^^^^^^^^^ @function

View file

@ -1,18 +1,18 @@
import gleam/io
// <- @include
// ^ @namespace
// <- @keyword.import
// ^ @module
// ^ @operator
// ^ @namespace
// ^ @module
import cat as kitten
// <- @include
// ^ @namespace
// <- @keyword.import
// ^ @module
// ^ @keyword
// ^ @namespace
// ^ @module
import animal/cat.{Cat, stroke}
// <- @include
// ^ @namespace
// <- @keyword.import
// ^ @module
// ^ @operator
// ^ @punctuation.delimiter
// ^ @punctuation.bracket

View file

@ -1,5 +1,5 @@
foreach (($array as vec[]) as $item) {}
// ^ @repeat
// ^ @keyword.repeat
// ^ @type
# Our expectation test for the code below intentionally includes an ERROR.

View file

@ -7,15 +7,15 @@ class Box<T> {
public function __construct(T $data) {
// ^ @type
// ^ @parameter
// ^ @variable.parameter
// ^ @keyword.function
// ^ @type.qualifier
// ^ @method
// ^ @function.method
$this->data = $data;
}
public function getData(): T {
// ^ @method
// ^ @function.method
// ^ @type.qualifier
return $this->data;
// ^ @operator

View file

@ -1,7 +1,7 @@
class C extends Superclass implements Iface {
// ^ @keyword ^ @keyword
use Trait;
// <- @include
// <- @keyword.import
const type X = shape(
// <- @keyword ^ @type.builtin
"a" => int,

View file

@ -8,21 +8,21 @@ use type Space\Type\T;
// ^ @keyword
use namespace Space\Name\N as M;
// ^ @keyword
// ^ @namespace
// ^ @module
use namespace Space\Name2\N2, Space\Nothing\N3 as N8, type Space\Type2\N4,;
// ^ @namespace
// ^ @module
// ^ @type
use namespace Space\Name\N10\{A as A2, B\};
// ^ @namespace
// ^ @namespace
// ^ @namespace
// ^ @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,};
// ^ @namespace
// ^ @module
use type Q\B\{kind3,};
// <- @include
// <- @keyword.import

View file

@ -1,33 +1,33 @@
{-# LANGUAGE QuasiQuotes #-}
-- ^ @preproc
-- ^ @keyword.directive
module Main
-- ^ @include
-- ^ @namespace
-- ^ @keyword.import
-- ^ @module
( main
) where
-- ^ @keyword
import Prelude hiding (show)
-- ^ @include
-- ^ @namespace
-- ^ @keyword.import
-- ^ @module
-- ^ @keyword
-- ^ @variable
import Data.Map (fromList)
-- ^ @namespace
-- ^ @module
import qualified Data.Map as Map
-- ^ @constructor
-- ^ @namespace
-- ^ @module
import qualified Chronos
-- ^ @namespace
-- ^ @module
import qualified Chronos as C
-- ^ @constructor
-- ^ @namespace
-- ^ @module
import FooMod (BarTy (barField))
-- ^ @field
-- ^ @variable.member
x = mempty { field = 5 }
-- ^ @field
-- ^ @variable.member
data ADT
-- ^ @keyword
@ -62,31 +62,31 @@ newtype Rec
-- ^ @constructor
{ field :: Double
-- ^ @punctuation.bracket
-- ^ @field
-- ^ @variable.member
-- ^ @type
}
-- ^ @punctuation.bracket
deriving Eq
-- ^ @type
recordWildCard Rec { field } = field
-- ^ @field
-- ^ @variable.member
recordDotSyntax rec = rec.field
-- ^ @field
-- ^ @variable.member
main :: IO ()
-- ^ @function
-- ^ @operator
-- ^ @type
-- ^ @symbol
-- ^ @string.special.symbol
main = undefined
-- ^ @function
-- ^ @exception
-- ^ @keyword.exception
someFunc0 :: Int -> Int
-- ^ @operator
someFunc0 x = someFunc1 x
-- ^ @parameter
-- ^ @variable.parameter
-- ^ @function.call
where
-- ^ @keyword
@ -94,9 +94,9 @@ someFunc0 x = someFunc1 x
-- ^ @function
-- ^ @number
scopedTypeParam (x :: Int) = someFunc x
-- ^ @parameter
-- ^ @variable.parameter
scopedTypeParam (Just x :: Int) = someFunc x
-- ^ @parameter
-- ^ @variable.parameter
someInfix :: Integral a => a -> Double
-- ^ @type
@ -118,7 +118,7 @@ someInfix x = fromIntegral x `myAdd` floatVal
-- ^ @variable
floatVal = 5.5
-- ^ @variable
-- ^ @float
-- ^ @number.float
intVal :: Int
-- ^ @variable
intVal = getInt 5
@ -138,12 +138,12 @@ someInfix x = fromIntegral x `myAdd` floatVal
isInt :: Either Double Int -> Bool
-- ^ @function
isInt eith@Left{} = False
-- ^ @parameter
-- ^ @variable.parameter
isInt eith@(Left x) = False
-- ^ @function
-- ^ @parameter
-- ^ @variable.parameter
isInt (Left x) = False
-- ^ @parameter
-- ^ @variable.parameter
isInt (Right _) = True
-- ^ @function
@ -153,19 +153,19 @@ someIOaction = do
-- ^ @keyword
foo <- SomeModule.someFun <$> getArgs
-- ^ @variable
-- ^ @namespace
-- ^ @module
-- ^ @function.call
-- ^ @operator
_ <- someFunc0 =<< someIOAction
-- ^ @function.call
let bar = SomeModule.doSomething $ "a" "b"
-- ^ @variable
-- ^ @namespace
-- ^ @module
-- ^ @function.call
-- ^ @operator
func x y = x + y - 7
-- ^ @function
-- ^ @parameter
-- ^ @variable.parameter
-- ^ @variable
-- ^ @variable
gunc x y = func x $ y + 7
@ -216,26 +216,26 @@ condVal = if otherwise
else True
getLambda x = \y -> x `SomeModule.someInfix` y
-- ^ @parameter
-- ^ @namespace
-- ^ @variable.parameter
-- ^ @module
-- ^ @operator
lambdaTyped = \(y :: Int) -> x
-- ^ @parameter
-- ^ @variable.parameter
lambdaPattern = \(Just x) -> x
-- ^ @parameter
-- ^ @variable.parameter
lambdaPatternTyped = \(Just x :: Int) -> x
-- ^ @parameter
-- ^ @variable.parameter
isVowel = (`elem` "AEIOU")
-- ^ @operator
isVowelQualified = (`SomeModule.elem` "AEIOU")
-- ^ @namespace
-- ^ @module
-- ^ @operator
hasVowels = ("AEIOU" `elem`)
-- ^ @operator
hasVowelsQualified = ("AEIOU" `SomeModule.elem`)
-- ^ @namespace
-- ^ @module
-- ^ @operator
quasiQuotedString = [qq|Some string|]
@ -243,7 +243,7 @@ quasiQuotedString = [qq|Some string|]
-- ^ @function.call
-- ^ @string
quasiQuotedString2 = [SomeModule.qq|Some string|]
-- ^ @namespace
-- ^ @module
-- ^ @function.call
composition f g = f . g
@ -270,42 +270,42 @@ appliedComposition f g var = (NS.f . NS.g) var
-- ^ @function.call
-- ^ @function.call
param1 |*| param2 = Qu $ param1 * param2
-- ^ @parameter
-- ^ @parameter
-- ^ @variable.parameter
-- ^ @variable.parameter
(param1 :: Int) |*| (param2 :: Int) = Qu $ param1 * param2
-- ^ @parameter
-- ^ @parameter
-- ^ @variable.parameter
-- ^ @variable.parameter
(Qu a) |/| (SomeModule.Qu b) = a / b
-- ^ @parameter
-- ^ @parameter
-- ^ @variable.parameter
-- ^ @variable.parameter
(Qu a :: Int) |/| (SomeModule.Qu b :: Int) = a / b
-- ^ @parameter
-- ^ @parameter
-- ^ @variable.parameter
-- ^ @variable.parameter
(Qu a, b, c :: Int) |/| x = undefined
-- ^ @parameter
-- ^ @parameter
-- ^ @parameter
-- ^ @variable.parameter
-- ^ @variable.parameter
-- ^ @variable.parameter
[Qu a, b, c :: Int] >< x = undefined
-- ^ @parameter
-- ^ @parameter
-- ^ @parameter
-- ^ @variable.parameter
-- ^ @variable.parameter
-- ^ @variable.parameter
listParam [a, b :: Int, Just c] = undefined
-- ^ @parameter
-- ^ @parameter
-- ^ @parameter
-- ^ @variable.parameter
-- ^ @variable.parameter
-- ^ @variable.parameter
tupleParam (a :: Int, b, Just c) = undefined
-- ^ @parameter
-- ^ @parameter
-- ^ @parameter
-- ^ @variable.parameter
-- ^ @variable.parameter
-- ^ @variable.parameter
listLambda = \[a, a :: Int, Just c] -> undefined
-- ^ @parameter
-- ^ @parameter
-- ^ @parameter
-- ^ @variable.parameter
-- ^ @variable.parameter
-- ^ @variable.parameter
tupleLambda = \(a, b :: Int, Just c) -> undefined
-- ^ @parameter
-- ^ @parameter
-- ^ @variable.parameter
-- ^ @variable.parameter
nestedDestructure (Left (Just a)) = undefined
-- ^ @parameter
-- ^ @variable.parameter
typeApplication x y = someFun @ty x y
-- ^ @variable
-- ^ @variable
@ -317,9 +317,9 @@ recordUpdate x y rec = someFun rec {field = 5} (x, x) y
-- ^ @variable
viewPattern (func -> var) = 5
-- ^ @function.call
-- ^ @parameter
-- ^ @variable.parameter
g (func :: a -> b) x = func y
-- ^ @parameter
-- ^ @variable.parameter
-- ^ @function
lambdaAlias :: LambdaAlias
lambdaAlias _ _ _ = undefined

View file

@ -1,5 +1,5 @@
HOCON = Human-Optimized Config Object Notation
// ^ @field
// ^ @variable.member
// ^ @string
// ^ @string
// ^ @string
@ -31,7 +31,7 @@ specs url: "https://github.com/lightbend/config/blob/master/HOCON.md"
includes: {
include required(file("~/prog/tree-sitter-hocon/grammar.js"))
// ^ @keyword
//^ @include
//^ @keyword.import
// ^ @punctuation.bracket
// ^ @punctuation.bracket
override = true

View file

@ -1,28 +1,28 @@
# H1
<!-- <- @text.title.1.marker -->
<!-- <- @markup.heading.1.marker -->
## H2
<!-- <- @text.title.2.marker -->
<!-- <- @markup.heading.2.marker -->
- Item 1
- Item 2
<!-- <- @punctuation.special -->
<!-- <- @markup.list -->
1. Item 1
2. Item 2
<!-- <- @punctuation.special -->
<!-- <- @markup.list -->
----![image_description](https://example.com/image.jpg "awesome image title")
<!-- ^ @text.reference -->
<!-- ^ @text.uri -->
<!-- ^ @text.literal -->
<!--^ @punctuation.special -->
<!-- ^ @punctuation.bracket -->
<!-- ^ @punctuation.bracket -->
<!-- ^ @markup.link.label -->
<!-- ^ @markup.link.url -->
<!-- ^ @markup.link.label -->
<!--^ @markup.link -->
<!-- ^ @markup.link -->
<!-- ^ @markup.link -->
[link_text](#local_reference "link go brr...")
<!-- ^ @text.reference -->
<!-- ^ @text.uri -->
<!-- ^ @text.literal -->
<!-- <- @punctuation.bracket -->
<!-- ^ @punctuation.bracket -->
<!-- ^ @markup.link.label -->
<!-- ^ @markup.link.url -->
<!-- ^ @markup.link.label -->
<!-- <- @markup.link -->
<!-- ^ @markup.link -->

View file

@ -1,16 +1,16 @@
{
func1 = param: builtins.readFile param;
# ^ @function
# ^ @parameter
# ^ @variable.parameter
# ^ @constant.builtin
# ^ @function.builtin
func2 = { p1, p2 }: p2;
# ^ @function
# ^ @parameter
# ^ @variable.parameter
readFile' = readFile;
# ^ @function.builtin
x = func1 ./path/to/file.nix;
# ^ @field
# ^ @variable.member
# ^ @function.call
# ^ @string.special
# ^ @string.special.path
}

View file

@ -3,10 +3,10 @@ class Fields:
# ^^^ @type.builtin
# ^^^^ @constant.builtin
self.fields = fields
# ^^^^^^ @field
# ^^^^^^ @variable.member
self.__dunderfield__ = None
# ^^^^^^^^^^^^^^^ @field
# ^^^^^^^^^^^^^^^ @variable.member
self._FunKyFielD = 0
# ^^^^^^^^^^^ @field
# ^^^^^^^^^^^ @variable.member
self.NOT_A_FIELD = "IM NOT A FIELD"
# ^^^^^^^^^^^ @constant

View file

@ -1,4 +1,4 @@
from __future__ import print_function
# ^ @include
# ^ @keyword.import
# ^ @constant.builtin
# ^ @include
# ^ @keyword.import

View file

@ -1,29 +1,29 @@
match command.split():
# ^ @conditional
# ^ @keyword.conditional
case ["quit"]:
# ^ @conditional
# ^ @keyword.conditional
print("Goodbye!")
quit_game()
case ["look"]:
# ^ @conditional
# ^ @keyword.conditional
current_room.describe()
case ["get", obj]:
# ^ @conditional
# ^ @keyword.conditional
character.get(obj, current_room)
case ["go", direction]:
# ^ @conditional
# ^ @keyword.conditional
current_room = current_room.neighbor(direction)
# The rest of your commands go here
match command.split():
# ^ @conditional
# ^ @keyword.conditional
case ["drop", *objects]:
# ^ @conditional
# ^ @keyword.conditional
for obj in objects:
character.drop(obj, current_room)
match command.split():
# ^ @conditional
# ^ @keyword.conditional
case ["quit"]: ... # Code omitted for brevity
case ["go", direction]: pass
case ["drop", *objects]: pass
@ -32,12 +32,12 @@ match command.split():
# ^^ @@function.macro
match command.split():
# ^ @conditional
# ^ @keyword.conditional
case ["north"] | ["go", "north"]:
# ^ @conditional
# ^ @keyword.conditional
current_room = current_room.neighbor("north")
case ["get", obj] | ["pick", "up", obj] | ["pick", obj, "up"]:
# ^ @conditional
# ^ @keyword.conditional
pass
match = 2

View file

@ -2,5 +2,5 @@ try:
print(1 / 0)
except Exception:
raise RuntimeError from None
# ^ @exception
# ^ @exception
# ^ @keyword.exception
# ^ @keyword.exception

View file

@ -1,6 +1,6 @@
from foo import bar
# ^ @include
# ^ @include
# ^ @keyword.import
# ^ @keyword.import
def generator():
yield from bar(42)
# ^ @keyword.return

View file

@ -1,7 +1,7 @@
init <- 1
# ^ @variable
# ^ @operator
# ^ @float
# ^ @number.float
r"{(\1\2)}" -> `%r%`
# ^ @string
@ -21,27 +21,27 @@ b <- list(TRUE, FALSE, NA, Inf)
# ^ @constant.builtin
b <- list(name = "r", version = R.version$major)
# ^ @parameter
# ^ @variable.parameter
# ^ @string
# ^ @operator
# ^ @field
# ^ @variable.member
Lang$new(name = "r")$print()
# ^ @method.call
# ^ @function.method.call
for(i in 1:10) {
# <- @repeat
# ^ @repeat
# <- @keyword.repeat
# ^ @keyword.repeat
}
add <- function(a, b = 1, ...) {
# ^ @keyword.function
# ^ @parameter
# ^ @parameter
# ^ @variable.parameter
# ^ @variable.parameter
# ^ @keyword
return(a + b)
}
base::letters
# ^ @namespace
# ^ @module
# ^ @variable

View file

@ -9,7 +9,7 @@ impl Drop for Foo {
fn main() {
for i in 0..128 {
// <- @repeat
// <- @keyword.repeat
println!("{i}");
}
}

View file

@ -1,12 +1,12 @@
use crate::a;
// ^ @namespace
// ^ @module
// ^ !keyword
use crate::{b, c};
// ^ @namespace
// ^ @module
// ^ !keyword
use super::a;
// ^ @namespace
// ^ @module
// ^ !keyword
use super::{b, c};
// ^ @namespace
// ^ @module
// ^ !keyword

View file

@ -7,18 +7,18 @@
# ^ @punctuation.delimiter
.source "baksmali_test_class.smali"
# <- @include
# <- @keyword.import
.implements Lsome/interface;
.implements Lsome/other/interface;
.annotation build Lsome/annotation;
# ^^^^^ @storageclass
# ^^^^^ @keyword.storage
# ^^^^ @type
# ^ @punctuation.delimiter
value1 = "test"
# ^^^^^^ @field
# ^^^^^^ @variable.member
# ^ @operator
# ^^^^^^ @string
value2 = .subannotation Lsome/annotation;
@ -50,7 +50,7 @@
.field public static byteNegStaticField:B = 0xAAt
.field public static floatStaticField:F = 3.1415926f
# ^^^^^^^^^^ @float
# ^^^^^^^^^^ @number.float
.field public static doubleStaticField:D = 3.141592653589793
@ -73,7 +73,7 @@
.field public static methodStaticField:Ljava/lang/reflect/Method; = Lbaksmali/test/class;->testMethod(ILjava/lang/String;)Ljava/lang/String;
# ^^ @punctuation.delimiter
# ^^^^^^^^^^ @method.call
# ^^^^^^^^^^ @function.method.call
.field public static arrayStaticField:[I = {1, 2, 3, {1, 2, 3, 4}}
# ^ @punctuation.special
@ -81,7 +81,7 @@
# ^ @punctuation.delimiter
.field public static enumStaticField:Lsome/enum; = .enum Lsome/enum;->someEnumValue:Lsome/enum;
# ^^^^^^^^^^^^^ @field
# ^^^^^^^^^^^^^ @variable.member
.field public static annotationStaticField:Lsome/annotation; = .subannotation Lsome/annotation;
value1 = "test"
@ -93,7 +93,7 @@
.field public static staticFieldWithAnnotation:I
.annotation runtime La/field/annotation;
# ^^^^^^^ @storageclass
# ^^^^^^^ @keyword.storage
this = "is"
a = "test"
.end annotation
@ -112,13 +112,13 @@
.registers 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
# ^^^^^^^^^^^^^ @keyword.operator
# ^^ @parameter.builtin
# ^^ @variable.parameter.builtin
return-void
# ^^^^^^^^^^^ @keyword.return
.end method
.method public testMethod(ILjava/lang/String;)Ljava/lang/String;
# ^^^^^^^^^^ @method
# ^^^^^^^^^^ @function.method
.registers 3
.annotation runtime Lorg/junit/Test;
.end annotation
@ -144,9 +144,9 @@
nop
try_end:
.catch Ljava/lang/Exception; {try_start: .. try_end:} handler:
# ^^^^^^ @exception
# ^^^^^^ @keyword.exception
.catchall {try_start: .. try_end:} handler2:
# ^^^^^^^^^ @exception
# ^^^^^^^^^ @keyword.exception
# ^^ @operator
handler:
@ -232,9 +232,9 @@
nop
.source "somefile.java"
# ^^^^^^^ @include
# ^^^^^^^ @keyword.import
.line 101
# ^^^ @text.literal
# ^^^ @string.special
nop

View file

@ -3,11 +3,11 @@
// SPDX-License-Identifier: GPL-3.0
// ^ @comment
pragma solidity >=0.7.0 <0.9.0;
// ^ @preproc
// ^ @preproc
// ^ @keyword.directive
// ^ @keyword.directive
import * as something from "anotherFile";
// ^ ^ ^ @include
// ^ ^ ^ @keyword.import
/// @title Voting with delegation.
// <- @comment
@ -21,7 +21,7 @@ contract Ballot {
// ^ @type
uint weight; // weight is accumulated by delegation
// ^ @type.builtin
// ^ @field
// ^ @variable.member
bool voted; // if true, that person already voted
address delegate; // person delegated to
uint vote; // index of the voted proposal
@ -63,7 +63,7 @@ contract Ballot {
// appends it to the end of `proposals`.
proposals.push(Proposal({
name: proposalNames[i],
// ^ @field
// ^ @variable.member
voteCount: 0
}));
}
@ -74,7 +74,7 @@ contract Ballot {
function giveRightToVote(address voter) external {
// ^ @keyword.function
// ^ @function
// ^ @parameter
// ^ @variable.parameter
// If the first argument of `require` evaluates
// to `false`, execution terminates and all
// changes to the state and to Ether balances

View file

@ -3,15 +3,15 @@ PRIVATE &password
; ^ @variable.builtin
ENTRY &password
; <- @keyword
; ^ @parameter
; ^ @variable.parameter
ENTRY %LINE &salt
; <- @keyword
; ^ @constant.builtin
; ^ @parameter
; ^ @variable.parameter
IF "&password"==""
; <- @conditional
; <- @keyword.conditional
; ^ @string
; ^ @variable.builtin
; ^ @operator
@ -21,7 +21,7 @@ IF "&password"==""
; ^ @keyword.return
)
ELSE
; <- @conditional
; <- @keyword.conditional
(
PRIVATE &pass
@ -33,9 +33,9 @@ ELSE
GOSUB verify_password "&password"
; ^ @function.call
RETURNVALUES &pass
; ^ @parameter
; ^ @variable.parameter
WAIT 10.ms
; ^ @float
; ^ @number.float
)
IF !&pass
@ -63,7 +63,7 @@ FramePOS ,,,,Maximized
; ^ @punctuation.delimiter
; ^ @constant.builtin
WinPOS 0% 50% 100% 35%
; ^ @float
; ^ @number.float
COVerage.ListFunc
ENDDO
@ -80,11 +80,11 @@ verify_password:
; <- @function
(
PARAMETERS &password
; ^ @parameter
; ^ @variable.parameter
SYStem.Option.KEYCODE "&password"
SYStem.JtagClock 1kHz
; ^ @float
; ^ @number.float
SYStem.Mode.Attach
Data.Set N: EAXI:0x34000000 %Long 0x34000100 0x34000021 /verify
@ -107,7 +107,7 @@ SUBROUTINE start_debug
COVerage.ListModule %MULTI.OBC \sieve
; ^ @keyword
; ^ @constant.builtin
; ^ @symbol
; ^ @string.special.symbol
Var.DRAW flags[0..16] /Alternate 3
; ^ @keyword

View file

@ -8,19 +8,19 @@ sYmbol.NEW _InitialSP 0x34000100
; ^ @number
DO ~~~~/test.cmm
; ^ @string.special
; ^ @string.special.path
WAIT 1.ns
; ^ @float
; ^ @number.float
SYStem.JtagClock 100.GHZ
; ^ @float
; ^ @number.float
DATA.SET P:&HEAD+0x4 %LONG DATA.LONG(EA:&HEAD+0x4)&0xFFFFFF
; ^ @constant.builtin
List `main`
; ^ @symbol
; ^ @string.special.symbol
&range = 'a'--'z'||'0'--'9'
; ^ @character
@ -34,6 +34,6 @@ Data.Set N: 0xffff800000 0y0011xx01xx&&a
; ^ @operator
WinPOS 0% 85% 100% 15%
; ^ @float
; ^ @number.float
// vim: set ft=t32:

View file

@ -34,7 +34,7 @@ Var.Assign (*ap)[2..4] = &a
Var.Assign sp = &s.n+offset
; ^ @variable
; ^ @variable
; ^ @field
; ^ @variable.member
; ^ @variable
Var.Assign padd = (CAddition const * volatile)&d
; ^ @variable

View file

@ -1,9 +1,9 @@
primitive print(s: string)
/* ^ @function */
/* ^ @parameter */
/* ^ @variable.parameter */
function func(a: int) : int = (print("Hello World!"); a)
/* ^ @function */
/* ^ @parameter */
/* ^ @variable.parameter */
/* ^ @function.builtin */
/* vim: set ft=tiger: */

View file

@ -22,9 +22,9 @@ var array := int_array[12] of 27;
/* ^ @type */
primitive func(a: int, b: string) : array
/* ^ @parameter */
/* ^ @variable.parameter */
/* ^ @type.builtin */
/* ^ @parameter */
/* ^ @variable.parameter */
/* ^ @type.builtin */
/* ^ @type */
/* vim: set ft=tiger: */

View file

@ -1,4 +1,4 @@
import "lib.tih"
/* <- @include */
/* ^ @string.special */
/* <- @keyword.import */
/* ^ @string.special.path */
/* vim: set ft=tiger: */

View file

@ -10,7 +10,7 @@ let
/* <- @keyword.function */
import "lib.tih"
/* <- @include */
/* <- @keyword.import */
type array_of_int = array of int
/* <- @keyword */
@ -28,13 +28,13 @@ in
/* ^ @keyword */
for i := 12 to 27 do 42;
/* <- @repeat */
/* ^ @repeat */
/* ^ @repeat */
/* <- @keyword.repeat */
/* ^ @keyword.repeat */
/* ^ @keyword.repeat */
while 12 do break
/* <- @repeat */
/* ^ @repeat */
/* <- @keyword.repeat */
/* ^ @keyword.repeat */
/* ^ @keyword */
end

View file

@ -13,7 +13,7 @@ let
method meth() : int = self.a
/* <- @keyword.function */
/* ^ @method */
/* ^ @function.method */
/* ^ @variable.builtin */
}
@ -24,6 +24,6 @@ in
/* ^ @property */
object.meth()
/* ^ @method */
/* ^ @function.method */
end
/* vim: set ft=tiger: */

View file

@ -1,8 +1,8 @@
import * as foo from 'foo';
// ^ @include
// ^ @keyword.import
export { foo as bar };
// ^ @include
// ^ @keyword.import
const n = 5 as number;
// ^ @keyword.operator

View file

@ -4,8 +4,8 @@ def Xform "cube" (
asset[] payloadAssetDependencies = [@fizz.usd@, @buzz.usd@]
# <- @type
# ^ @keyword
# ^ @text.uri
# ^ @text.uri
# ^ @string.special.url
# ^ @string.special.url
}
)
{
@ -13,13 +13,13 @@ def Xform "cube" (
def "root" (
add references = @foo.usda@</Model> (offset = 1; scale = 2.0)
# <- @text.uri
# <- @string.special.url
# ^ @string.special
# ^ @keyword
# ^ @number
# ^ @punctuation.delimiter
# ^ @keyword
# ^ @float
# ^ @number.float
)
{
}
@ -93,7 +93,7 @@ over "Parent" (
# <- @function.call
# ^ @keyword
# ^ @string.special
# ^ @text.uri
# ^ @string.special.url
# ^ @string.special
)
{
@ -107,12 +107,12 @@ def "foo"
# ^ @property
-414: 14.4
# <- @number
# ^ @float
# ^ @number.float
10: 201.0,
# <- @number
# ^ @float
# ^ @number.float
10.123: 201.0123,
# <- @float
# ^ @float
# <- @number.float
# ^ @number.float
}
}

View file

@ -11,11 +11,11 @@ token[] purpose = ["default", "render"]
rel material:binding:collection:Erasers = None
# <- @type
# ^ @namespace
# ^ @module
# ^ @punctuation.delimiter
# ^ @namespace
# ^ @module
# ^ @punctuation.delimiter
# ^ @namespace
# ^ @module
# ^ @punctuation.delimiter
# ^ @variable
# ^ @constant.builtin

View file

@ -3,7 +3,7 @@
subLayers = [
# <- @keyword
@./model_sub.usda@ (offset = 1)
# <- @text.uri
# <- @string.special.url
# ^ @keyword
]
)

View file

@ -6,7 +6,7 @@ class Foo {
// ^ @variable
// ^ @punctuation.bracket
name: str;
//^ @field
//^ @variable.member
// ^ @type.builtin
// ^ @punctuation.delimiter
new(name: str) {

View file

@ -1,4 +1,4 @@
test1.test2.test3();
// <- @variable
// ^ @property
// ^ @method.call
// ^ @function.method.call

View file

@ -38,7 +38,7 @@ final xhp class a_post extends x\element {
'document.getElementById("'.$id.'").submit(); return false;',
);
$anchor->setAttribute('href', '#');
// ^ @method.call
// ^ @function.method.call
return $form;
}