Skip to content

Commit 58b1a05

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

3 files changed

Lines changed: 131 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: 120 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,122 @@
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+
<dep>
24102+
<src>id</src>
24103+
<trg>text</trg>
24104+
<val>
24105+
<hist>
24106+
<budget>12</budget>
24107+
<bs>
24108+
<b>
24109+
<a>1</a>
24110+
<b>2</b>
24111+
<v>1000</v>
24112+
</b>
24113+
</bs>
24114+
</hist>
24115+
</val>
24116+
</dep>
24117+
<dep>
24118+
<src>id</src>
24119+
<trg>tostring</trg>
24120+
<val>
24121+
<hist>
24122+
<budget>12</budget>
24123+
<bs>
24124+
<b>
24125+
<a>1</a>
24126+
<b>2</b>
24127+
<v>1000</v>
24128+
</b>
24129+
</bs>
24130+
</hist>
24131+
</val>
24132+
</dep>
24133+
<dep>
24134+
<src>text</src>
24135+
<trg>id</trg>
24136+
<val>
24137+
<hist>
24138+
<budget>12</budget>
24139+
<bs>
24140+
<b>
24141+
<a>1</a>
24142+
<b>2</b>
24143+
<v>1000</v>
24144+
</b>
24145+
</bs>
24146+
</hist>
24147+
</val>
24148+
</dep>
24149+
<dep>
24150+
<src>text</src>
24151+
<trg>tostring</trg>
24152+
<val>
24153+
<hist>
24154+
<budget>12</budget>
24155+
<bs>
24156+
<b>
24157+
<a>1</a>
24158+
<b>2</b>
24159+
<v>1000</v>
24160+
</b>
24161+
</bs>
24162+
</hist>
24163+
</val>
24164+
</dep>
24165+
<dep>
24166+
<src>tostring</src>
24167+
<trg>id</trg>
24168+
<val>
24169+
<hist>
24170+
<budget>12</budget>
24171+
<bs>
24172+
<b>
24173+
<a>1</a>
24174+
<b>2</b>
24175+
<v>1000</v>
24176+
</b>
24177+
</bs>
24178+
</hist>
24179+
</val>
24180+
</dep>
24181+
<dep>
24182+
<src>tostring</src>
24183+
<trg>text</trg>
24184+
<val>
24185+
<hist>
24186+
<budget>12</budget>
24187+
<bs>
24188+
<b>
24189+
<a>1</a>
24190+
<b>2</b>
24191+
<v>1000</v>
24192+
</b>
24193+
</bs>
24194+
</hist>
24195+
</val>
24196+
</dep>
24197+
</dependencies>
24198+
</relation>
24199+
<relation>
2408024200
<name>xmlEncoding</name>
2408124201
<cardinality>39724</cardinality>
2408224202
<columnsizes>

0 commit comments

Comments
 (0)