From 58b1a059858a65e757cafb3e9c095624d95fb2f9 Mon Sep 17 00:00:00 2001 From: Mathias Vorreiter Pedersen Date: Thu, 4 Jun 2026 13:57:41 +0100 Subject: [PATCH] JS: Support YAML comments. --- javascript/ql/lib/semmle/javascript/YAML.qll | 6 + .../ql/lib/semmlecode.javascript.dbscheme | 6 +- .../lib/semmlecode.javascript.dbscheme.stats | 120 ++++++++++++++++++ 3 files changed, 131 insertions(+), 1 deletion(-) diff --git a/javascript/ql/lib/semmle/javascript/YAML.qll b/javascript/ql/lib/semmle/javascript/YAML.qll index 21b0825c861..29c23654f4b 100644 --- a/javascript/ql/lib/semmle/javascript/YAML.qll +++ b/javascript/ql/lib/semmle/javascript/YAML.qll @@ -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 diff --git a/javascript/ql/lib/semmlecode.javascript.dbscheme b/javascript/ql/lib/semmlecode.javascript.dbscheme index 26a123164be..ce4a5f401c0 100644 --- a/javascript/ql/lib/semmlecode.javascript.dbscheme +++ b/javascript/ql/lib/semmlecode.javascript.dbscheme @@ -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 -*/ diff --git a/javascript/ql/lib/semmlecode.javascript.dbscheme.stats b/javascript/ql/lib/semmlecode.javascript.dbscheme.stats index dd86c7346ef..0f4e256f77c 100644 --- a/javascript/ql/lib/semmlecode.javascript.dbscheme.stats +++ b/javascript/ql/lib/semmlecode.javascript.dbscheme.stats @@ -1406,6 +1406,10 @@ 1 +@yaml_comment +1000 + + @jsx_element 1090 @@ -24077,6 +24081,122 @@ +yaml_comments +1000 + + +id +1000 + + +text +1000 + + +tostring +1000 + + + + +id +text + + +12 + + +1 +2 +1000 + + + + + + +id +tostring + + +12 + + +1 +2 +1000 + + + + + + +text +id + + +12 + + +1 +2 +1000 + + + + + + +text +tostring + + +12 + + +1 +2 +1000 + + + + + + +tostring +id + + +12 + + +1 +2 +1000 + + + + + + +tostring +text + + +12 + + +1 +2 +1000 + + + + + + + + xmlEncoding 39724