mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-10 23:40:04 -04:00
chore(tests): consistent captures
This commit is contained in:
parent
17fae3f4a3
commit
10dd49958c
60 changed files with 872 additions and 873 deletions
|
|
@ -1,6 +1,6 @@
|
|||
foreach (($array as vec[]) as $item) {}
|
||||
// ^ repeat
|
||||
// ^ type
|
||||
// ^ @repeat
|
||||
// ^ @type
|
||||
|
||||
# Our expectation test for the code below intentionally includes an ERROR.
|
||||
foreach ($array as vec[] as $item) {}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
async function func0(): void {}
|
||||
// ^ type.builtin
|
||||
// ^ @type.builtin
|
||||
async function func1<T1 as int>() {}
|
||||
// ^ type.builtin
|
||||
// ^ keyword.operator
|
||||
// ^ @type.builtin
|
||||
// ^ @keyword.operator
|
||||
|
||||
|
||||
async ($x) ==> $x + 1;
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
newtype T1 = ?shape(
|
||||
// TODO: ?operator (? not captureable at the moment)
|
||||
?'int' => int
|
||||
// ^ operator
|
||||
// ^ @operator
|
||||
);
|
||||
|
||||
<<A3(1), A2(2,3,)>>
|
||||
// ^ attribute
|
||||
// ^ @attribute
|
||||
type T2 = (function(T1): string);
|
||||
// ^ type
|
||||
// ^ @type
|
||||
// TODO: keyword.function (currently not in AST)
|
||||
|
||||
<<A4(1), A5, A6(1,3,4)>>
|
||||
|
|
|
|||
|
|
@ -1,24 +1,24 @@
|
|||
class Box<T> {
|
||||
// ^ type
|
||||
// ^ type
|
||||
// ^ @type
|
||||
// ^ @type
|
||||
protected T $data;
|
||||
// ^ type.qualifier
|
||||
// ^ type
|
||||
// ^ @type.qualifier
|
||||
// ^ @type
|
||||
|
||||
public function __construct(T $data) {
|
||||
// ^ type
|
||||
// ^ parameter
|
||||
// ^ keyword.function
|
||||
// ^ type.qualifier
|
||||
// ^ method
|
||||
// ^ @type
|
||||
// ^ @parameter
|
||||
// ^ @keyword.function
|
||||
// ^ @type.qualifier
|
||||
// ^ @method
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function getData(): T {
|
||||
// ^ method
|
||||
// ^ type.qualifier
|
||||
// ^ @method
|
||||
// ^ @type.qualifier
|
||||
return $this->data;
|
||||
// ^ operator
|
||||
// ^ variable.builtin
|
||||
// ^ @operator
|
||||
// ^ @variable.builtin
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<<<EOT
|
||||
$('a') abc $(function{return;})
|
||||
EOT;
|
||||
// <- comment ^ comment
|
||||
// <- @comment ^ @comment
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
class C extends Superclass implements Iface {
|
||||
// ^ keyword ^ keyword
|
||||
// ^ @keyword ^ @keyword
|
||||
use Trait;
|
||||
// < include
|
||||
// <- @include
|
||||
const type X = shape(
|
||||
// <- keyword ^ type.builtin
|
||||
// <- @keyword ^ @type.builtin
|
||||
"a" => int,
|
||||
// ^ string
|
||||
// ^ @string
|
||||
"b" => string,
|
||||
// ^ type.builtin
|
||||
// ^ @type.builtin
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,28 @@
|
|||
use const Space\Const\C;
|
||||
// ^ keyword
|
||||
// ^ constant
|
||||
// ^ @keyword
|
||||
// ^ @constant
|
||||
use function Space\Func\F as E;
|
||||
// ^ function
|
||||
// ^ function
|
||||
// ^ @function
|
||||
// ^ @function
|
||||
use type Space\Type\T;
|
||||
// ^ keyword
|
||||
// ^ @keyword
|
||||
use namespace Space\Name\N as M;
|
||||
// ^ keyword
|
||||
// ^ namespace
|
||||
// ^ @keyword
|
||||
// ^ @namespace
|
||||
|
||||
use namespace Space\Name2\N2, Space\Nothing\N3 as N8, type Space\Type2\N4,;
|
||||
// ^ namespace
|
||||
// ^ type
|
||||
// ^ @namespace
|
||||
// ^ @type
|
||||
use namespace Space\Name\N10\{A as A2, B\};
|
||||
// ^ namespace
|
||||
// ^ namespace
|
||||
// ^ namespace
|
||||
// ^ @namespace
|
||||
// ^ @namespace
|
||||
// ^ @namespace
|
||||
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
|
||||
// ^ @namespace
|
||||
use type Q\B\{kind3,};
|
||||
// <- include
|
||||
// <- @include
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
using ($new = new Object(), $file = new File('using', '+using')) {}
|
||||
// <- keyword
|
||||
// ^ type
|
||||
// <- @keyword
|
||||
// ^ @type
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ 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
|
||||
// ^ @tag
|
||||
// ^ @tag
|
||||
// ^ @string
|
||||
echo await $xhp->toStringAsync();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue