Skip to content

Commit b76c32d

Browse files
committed
JS: Support YAML comments.
1 parent e87f7fb commit b76c32d

3 files changed

Lines changed: 34 additions & 1 deletion

File tree

javascript/ql/lib/semmle/javascript/YAML.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ private module YamlSig implements LibYaml::InputSig {
4444
class ParseErrorBase extends LocatableBase, @yaml_error {
4545
string getMessage() { yaml_errors(this, result) }
4646
}
47+
48+
class CommentBase extends LocatableBase, @yaml_comment {
49+
string getText() { yaml_comments(this, result, _) }
50+
51+
override string toString() { yaml_comments(this, _, result) }
52+
}
4753
}
4854

4955
import LibYaml::Make<YamlSig>

javascript/ql/lib/semmlecode.javascript.dbscheme

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1090,13 +1090,17 @@ yaml_scalars (unique int scalar: @yaml_scalar_node ref,
10901090
int style: int ref,
10911091
string value: string ref);
10921092

1093+
yaml_comments (unique int id: @yaml_comment,
1094+
string text: string ref,
1095+
string tostring: string ref);
1096+
10931097
yaml_errors (unique int id: @yaml_error,
10941098
string message: string ref);
10951099

10961100
yaml_locations(unique int locatable: @yaml_locatable ref,
10971101
int location: @location_default ref);
10981102

1099-
@yaml_locatable = @yaml_node | @yaml_error;
1103+
@yaml_locatable = @yaml_node | @yaml_error | @yaml_comment;
11001104

11011105
/*- XML Files -*/
11021106

javascript/ql/lib/semmlecode.javascript.dbscheme.stats

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,6 +1406,10 @@
14061406
<v>1</v>
14071407
</e>
14081408
<e>
1409+
<k>@yaml_comment</k>
1410+
<v>1000</v>
1411+
</e>
1412+
<e>
14091413
<k>@jsx_element</k>
14101414
<v>1090</v>
14111415
</e>
@@ -24077,6 +24081,25 @@
2407724081
</dependencies>
2407824082
</relation>
2407924083
<relation>
24084+
<name>yaml_comments</name>
24085+
<cardinality>1000</cardinality>
24086+
<columnsizes>
24087+
<e>
24088+
<k>id</k>
24089+
<v>1000</v>
24090+
</e>
24091+
<e>
24092+
<k>text</k>
24093+
<v>1000</v>
24094+
</e>
24095+
<e>
24096+
<k>tostring</k>
24097+
<v>1000</v>
24098+
</e>
24099+
</columnsizes>
24100+
<dependencies/>
24101+
</relation>
24102+
<relation>
2408024103
<name>xmlEncoding</name>
2408124104
<cardinality>39724</cardinality>
2408224105
<columnsizes>

0 commit comments

Comments
 (0)