JS: Support YAML comments.

This commit is contained in:
Mathias Vorreiter Pedersen
2026-06-04 13:57:41 +01:00
parent e87f7fb3f7
commit 58b1a05985
3 changed files with 131 additions and 1 deletions

View File

@@ -44,6 +44,12 @@ private module YamlSig implements LibYaml::InputSig {
class ParseErrorBase extends LocatableBase, @yaml_error {
string getMessage() { yaml_errors(this, result) }
}
class CommentBase extends LocatableBase, @yaml_comment {
string getText() { yaml_comments(this, result, _) }
override string toString() { yaml_comments(this, _, result) }
}
}
import LibYaml::Make<YamlSig>

View File

@@ -1090,13 +1090,17 @@ yaml_scalars (unique int scalar: @yaml_scalar_node ref,
int style: int ref,
string value: string ref);
yaml_comments (unique int id: @yaml_comment,
string text: string ref,
string tostring: string ref);
yaml_errors (unique int id: @yaml_error,
string message: string ref);
yaml_locations(unique int locatable: @yaml_locatable ref,
int location: @location_default ref);
@yaml_locatable = @yaml_node | @yaml_error;
@yaml_locatable = @yaml_node | @yaml_error | @yaml_comment;
/*- XML Files -*/

View File

@@ -1406,6 +1406,10 @@
<v>1</v>
</e>
<e>
<k>@yaml_comment</k>
<v>1000</v>
</e>
<e>
<k>@jsx_element</k>
<v>1090</v>
</e>
@@ -24077,6 +24081,122 @@
</dependencies>
</relation>
<relation>
<name>yaml_comments</name>
<cardinality>1000</cardinality>
<columnsizes>
<e>
<k>id</k>
<v>1000</v>
</e>
<e>
<k>text</k>
<v>1000</v>
</e>
<e>
<k>tostring</k>
<v>1000</v>
</e>
</columnsizes>
<dependencies>
<dep>
<src>id</src>
<trg>text</trg>
<val>
<hist>
<budget>12</budget>
<bs>
<b>
<a>1</a>
<b>2</b>
<v>1000</v>
</b>
</bs>
</hist>
</val>
</dep>
<dep>
<src>id</src>
<trg>tostring</trg>
<val>
<hist>
<budget>12</budget>
<bs>
<b>
<a>1</a>
<b>2</b>
<v>1000</v>
</b>
</bs>
</hist>
</val>
</dep>
<dep>
<src>text</src>
<trg>id</trg>
<val>
<hist>
<budget>12</budget>
<bs>
<b>
<a>1</a>
<b>2</b>
<v>1000</v>
</b>
</bs>
</hist>
</val>
</dep>
<dep>
<src>text</src>
<trg>tostring</trg>
<val>
<hist>
<budget>12</budget>
<bs>
<b>
<a>1</a>
<b>2</b>
<v>1000</v>
</b>
</bs>
</hist>
</val>
</dep>
<dep>
<src>tostring</src>
<trg>id</trg>
<val>
<hist>
<budget>12</budget>
<bs>
<b>
<a>1</a>
<b>2</b>
<v>1000</v>
</b>
</bs>
</hist>
</val>
</dep>
<dep>
<src>tostring</src>
<trg>text</trg>
<val>
<hist>
<budget>12</budget>
<bs>
<b>
<a>1</a>
<b>2</b>
<v>1000</v>
</b>
</bs>
</hist>
</val>
</dep>
</dependencies>
</relation>
<relation>
<name>xmlEncoding</name>
<cardinality>39724</cardinality>
<columnsizes>