mirror of
https://github.com/github/codeql.git
synced 2026-06-19 03:41:07 +02:00
Shared: Support YAML comments.
This commit is contained in:
@@ -134,6 +134,23 @@ signature module InputSig {
|
||||
*/
|
||||
string getMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
* A base class for comments.
|
||||
*
|
||||
* Typically `@yaml_comment`.
|
||||
*/
|
||||
class CommentBase extends LocatableBase {
|
||||
/**
|
||||
* Gets the text of this comment, not including delimiters.
|
||||
*/
|
||||
string getText();
|
||||
|
||||
/**
|
||||
* Gets a textual representation of this comment.
|
||||
*/
|
||||
string toString();
|
||||
}
|
||||
}
|
||||
|
||||
/** Provides a class hierarchy for working with YAML files. */
|
||||
@@ -607,6 +624,26 @@ module Make<InputSig Input> {
|
||||
string toString() { result = super.getMessage() }
|
||||
}
|
||||
|
||||
/**
|
||||
* A YAML comment.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```
|
||||
* # here is a comment
|
||||
* ```
|
||||
*/
|
||||
class YamlComment instanceof Input::CommentBase {
|
||||
/** Gets the `Location` of this comment. */
|
||||
Input::Location getLocation() { result = super.getLocation() }
|
||||
|
||||
/** Gets the text of this comment, not including delimiters. */
|
||||
string getText() { result = super.getText() }
|
||||
|
||||
/** Gets a textual representation of this comment. */
|
||||
string toString() { result = super.toString() }
|
||||
}
|
||||
|
||||
/**
|
||||
* A YAML node that may contain sub-nodes that can be identified by a name.
|
||||
* I.e. a mapping, sequence, or scalar.
|
||||
|
||||
Reference in New Issue
Block a user