aboutsummaryrefslogtreecommitdiff
path: root/guides/rainbow_bracket_queries.html
diff options
context:
space:
mode:
authoromentic2024-05-01 23:29:52 +0000
committeromentic2024-05-01 23:29:52 +0000
commit2244a5d40c83d477839f91cb6d6a4aeb02446a97 (patch)
tree732f056b43a7efbf5b2a75fda060a4cd5b87df66 /guides/rainbow_bracket_queries.html
parent313d5f75a7406da11e5b9424857be19866022e3e (diff)
deploy: 12eec890240a05d1e090114f7f4fdd7c1ee8ff88
Diffstat (limited to 'guides/rainbow_bracket_queries.html')
-rw-r--r--guides/rainbow_bracket_queries.html6
1 files changed, 3 insertions, 3 deletions
diff --git a/guides/rainbow_bracket_queries.html b/guides/rainbow_bracket_queries.html
index 98f11d99..c64d737c 100644
--- a/guides/rainbow_bracket_queries.html
+++ b/guides/rainbow_bracket_queries.html
@@ -196,7 +196,7 @@ language itself. These queries will go into a
<code>runtime/queries/tsq/rainbows.scm</code> file in the repository root.</p>
<p>First we'll add the <code>@rainbow.bracket</code> captures. TSQ only has parentheses and
square brackets:</p>
-<pre><code class="language-tsq">[&quot;(&quot; &quot;)&quot; &quot;[&quot; &quot;]&quot;] @rainbow.bracket
+<pre><code class="language-tsq">["(" ")" "[" "]"] @rainbow.bracket
</code></pre>
<p>The ordering of the nodes within the alternation (square brackets) is not
taken into consideration.</p>
@@ -207,7 +207,7 @@ names of rules in the grammar. Brackets are usually written in tree-sitter
grammars as literal strings, for example:</p>
<pre><code class="language-js">{
// ...
- arguments: seq(&quot;(&quot;, repeat($.argument), &quot;)&quot;),
+ arguments: seq("(", repeat($.argument), ")"),
// ...
}
</code></pre>
@@ -254,7 +254,7 @@ indirect descendants of some node captured with <code>@rainbow.scope</code>.</p>
</code></pre>
<p>If we want to highlight the <code>&lt;</code>, <code>&gt;</code> and <code>&lt;/</code> nodes with rainbow colors, we
capture them as <code>@rainbow.bracket</code>:</p>
-<pre><code class="language-tsq">[&quot;&lt;&quot; &quot;&gt;&quot; &quot;&lt;/&quot;] @rainbow.bracket
+<pre><code class="language-tsq">["&lt;" "&gt;" "&lt;/"] @rainbow.bracket
</code></pre>
<p>And we capture <code>(element)</code> as <code>@rainbow.scope</code> because <code>(element)</code> nodes nest
within each other: they increment the nesting level and switch to the next