Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
revert leading underscore deletion for template_args
  • Loading branch information
benbaarber committed Nov 28, 2025
commit 06ae81b5b2391d9243ea328401f7245585faa127
18 changes: 12 additions & 6 deletions wgsl/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1535,8 +1535,8 @@ Note: For example, the phrase `var<storage,read_write>` modifies the general `va
</div>

The `'<'` (U+003C) and `'>'` (U+003E) code points that delimit a template list are also used when spelling:
* A comparison operator in a [=syntax/relational_expression=].
* A shift operator in a [=syntax/shift_expression=].
* A [=syntax/comparison_operator=] in a [=syntax/relational_expression=].
* A [=syntax/shift_operator=] in a [=syntax/shift_expression=].
* A [=syntax/compound_assignment_operator=] for performing a shift operation followed by an assignment.

The syntactic ambiguity is resolved in favour of template lists:
Expand Down Expand Up @@ -1603,7 +1603,7 @@ Let |TemplateList| be a record type containing:
* Advance |CurrentPosition| past this code point, and start the next iteration of the loop.
* If `'='` (U+003D) appears at |CurrentPosition|, then:
* Note: From assumption 1, no template parameter starts with `'='` (U+003C), so the previous code point cannot be the start of a template list.
Assume the current and previous code point form a <a for=syntax_sym lt=less_than_equal>`'<='`</a> comparison operator.
Assume the current and previous code point form a <a for=syntax_sym lt=less_than_equal>`'<='`</a> [=syntax/comparison_operator=].
Skip over the `'='` (U+003D) code point so a later step does not mistake it for an assignment.
* Pop the top entry from the |Pending| stack.
* Advance |CurrentPosition| past this code point, and start the next iteration of the loop.
Expand All @@ -1618,7 +1618,7 @@ Let |TemplateList| be a record type containing:
* Otherwise, this code point does not end a template list:
* Advance |CurrentPosition| past this code point.
* If `'='` (U+003D) appears at |CurrentPosition| then:
* Note: Assume the current and previous code points form a <a for=syntax_sym lt=greater_than_equal>`'>='`</a> comparison operator.
* Note: Assume the current and previous code points form a <a for=syntax_sym lt=greater_than_equal>`'>='`</a> [=syntax/comparison_operator=].
Skip over the `'='` (U+003D) code point so a later step does not mistake it for an assignment.
* Advance |CurrentPosition| past this code point.
* Start the next iteration of the loop.
Expand All @@ -1634,14 +1634,14 @@ Let |TemplateList| be a record type containing:
* If `'!'` (U+0021) appears at |CurrentPosition| then:
* Advance |CurrentPosition| past this code point.
* If `'='` (U+003D) appears at |CurrentPosition| then:
* Note: Assume the current and previous code points form a <a for=syntax_sym lt=not_equal>`'!='`</a> comparison operator.
* Note: Assume the current and previous code points form a <a for=syntax_sym lt=not_equal>`'!='`</a> [=syntax/comparison_operator=].
Skip over the `'='` (U+003D) code point so a later step does not mistake it for an assignment.
* Advance |CurrentPosition| past this code point.
* Start the next iteration of the loop.
* If `'='` (U+003D) appears at |CurrentPosition| then:
* Advance |CurrentPosition| past this code point.
* If `'='` (U+003D) appears at |CurrentPosition| then:
* Note: Assume the current and previous code points form a <a for=syntax_sym lt=equal_equal>`'=='`</a> comparison operator.
* Note: Assume the current and previous code points form a <a for=syntax_sym lt=equal_equal>`'=='`</a> [=syntax/comparison_operator=].
Skip over the `'='` (U+003D) code point so a later step does not mistake it for an assignment.
* Advance |CurrentPosition| past this code point, and start the next iteration of the loop.
* Note: Assume this code point is part of an assignment, which cannot appear as part of an expression, and therefore cannot appear in a template list.
Expand Down Expand Up @@ -6815,9 +6815,15 @@ path: syntax/additive_operator.syntax.bs.include
path: syntax/shift_expression.syntax.bs.include
</pre>
<pre class=include>
path: syntax/shift_operator.syntax.bs.include
</pre>
<pre class=include>
path: syntax/relational_expression.syntax.bs.include
</pre>
<pre class=include>
path: syntax/comparison_operator.syntax.bs.include
</pre>
<pre class=include>
path: syntax/short_circuit_and_expression.syntax.bs.include
</pre>
<pre class=include>
Expand Down
2 changes: 1 addition & 1 deletion wgsl/syntax.bnf
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ diagnostic_rule_name :
;

template_list :
template_args_start template_arg_comma_list template_args_end
_template_args_start template_arg_comma_list _template_args_end
;

template_arg_comma_list :
Expand Down
2 changes: 1 addition & 1 deletion wgsl/syntax/template_list.syntax.bs.include
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class='syntax' noexport='true'>
<dfn for=syntax>template_list</dfn> :

<span class="choice"></span> [=syntax/template_args_start=] [=syntax/template_arg_comma_list=] [=syntax/template_args_end=]
<span class="choice"></span> [=syntax_sym/_template_args_start=] [=syntax/template_arg_comma_list=] [=syntax_sym/_template_args_end=]
</div>
8 changes: 4 additions & 4 deletions wgsl/tools/extract-grammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -986,10 +986,10 @@ def flow_extract(options, scan_result):
name: 'wgsl',

externals: $ => [
$.block_comment,
$._block_comment,
$._disambiguate_template,
$.template_args_start,
$.template_args_end,
$._template_args_start,
$._template_args_end,
$._less_than,
$._less_than_equal,
$._shift_left,
Expand All @@ -1003,7 +1003,7 @@ def flow_extract(options, scan_result):

extras: $ => [
$.line_comment,
$.block_comment,
$._block_comment,
$._blankspace,
],

Expand Down