diff options
| author | Stephan Seitz <stephan.seitz@fau.de> | 2021-11-23 18:23:57 +0100 |
|---|---|---|
| committer | Stephan Seitz <stephan.seitz@fau.de> | 2022-01-17 10:53:35 +0100 |
| commit | cc0bdabe5f9a9705bf2992831dd45e95d116fe0c (patch) | |
| tree | ed755e7e9dc1122d52b1431271fbe3c814347c93 /tests/query/highlights/xhp-intro.hack | |
| parent | Add ftdect for hack (diff) | |
| download | nvim-treesitter-cc0bdabe5f9a9705bf2992831dd45e95d116fe0c.tar nvim-treesitter-cc0bdabe5f9a9705bf2992831dd45e95d116fe0c.tar.gz nvim-treesitter-cc0bdabe5f9a9705bf2992831dd45e95d116fe0c.tar.bz2 nvim-treesitter-cc0bdabe5f9a9705bf2992831dd45e95d116fe0c.tar.lz nvim-treesitter-cc0bdabe5f9a9705bf2992831dd45e95d116fe0c.tar.xz nvim-treesitter-cc0bdabe5f9a9705bf2992831dd45e95d116fe0c.tar.zst nvim-treesitter-cc0bdabe5f9a9705bf2992831dd45e95d116fe0c.zip | |
highlights(hack): extend queries add tests
Diffstat (limited to 'tests/query/highlights/xhp-intro.hack')
| -rw-r--r-- | tests/query/highlights/xhp-intro.hack | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/query/highlights/xhp-intro.hack b/tests/query/highlights/xhp-intro.hack new file mode 100644 index 000000000..cc25f5843 --- /dev/null +++ b/tests/query/highlights/xhp-intro.hack @@ -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 +// ^ keyword +// ^ 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', '#'); + // ^ method + + return $form; + } +} + |
