File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -134,6 +134,23 @@ signature module InputSig {
134134 */
135135 string getMessage ( ) ;
136136 }
137+
138+ /**
139+ * A base class for comments.
140+ *
141+ * Typically `@yaml_comment`.
142+ */
143+ class CommentBase extends LocatableBase {
144+ /**
145+ * Gets the text of this comment, not including delimiters.
146+ */
147+ string getText ( ) ;
148+
149+ /**
150+ * Gets a textual representation of this comment.
151+ */
152+ string toString ( ) ;
153+ }
137154}
138155
139156/** Provides a class hierarchy for working with YAML files. */
@@ -607,6 +624,26 @@ module Make<InputSig Input> {
607624 string toString ( ) { result = super .getMessage ( ) }
608625 }
609626
627+ /**
628+ * A YAML comment.
629+ *
630+ * Example:
631+ *
632+ * ```
633+ * # here is a comment
634+ * ```
635+ */
636+ class YamlComment instanceof Input:: CommentBase {
637+ /** Gets the `Location` of this comment. */
638+ Input:: Location getLocation ( ) { result = super .getLocation ( ) }
639+
640+ /** Gets the text of this comment, not including delimiters. */
641+ string getText ( ) { result = super .getText ( ) }
642+
643+ /** Gets a textual representation of this comment. */
644+ string toString ( ) { result = super .toString ( ) }
645+ }
646+
610647 /**
611648 * A YAML node that may contain sub-nodes that can be identified by a name.
612649 * I.e. a mapping, sequence, or scalar.
You can’t perform that action at this time.
0 commit comments