Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Unified Diff: tools/gn/parse_tree.h

Issue 591373002: gn: start of format command (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-more-comment-stuff
Patch Set: ignore blockcomment in list eval Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/gn/parse_tree.h
diff --git a/tools/gn/parse_tree.h b/tools/gn/parse_tree.h
index e3d4e7d7f93fb343c65ecea7c631f96451d065a6..2ddd095df2799d80b4acb6eb1589321e05446324 100644
--- a/tools/gn/parse_tree.h
+++ b/tools/gn/parse_tree.h
@@ -24,6 +24,7 @@ class ListNode;
class LiteralNode;
class Scope;
class UnaryOpNode;
+class BlockCommentNode;
class Comments {
public:
@@ -80,6 +81,7 @@ class ParseNode {
virtual const ListNode* AsList() const;
virtual const LiteralNode* AsLiteral() const;
virtual const UnaryOpNode* AsUnaryOp() const;
+ virtual const BlockCommentNode* AsBlockComment() const;
virtual Value Execute(Scope* scope, Err* err) const = 0;
@@ -438,4 +440,33 @@ class UnaryOpNode : public ParseNode {
DISALLOW_COPY_AND_ASSIGN(UnaryOpNode);
};
+// BlockCommentNode ------------------------------------------------------------
+
+// This node type is only used for standalone comments (that is, those not
+// specifically attached to another syntax element. The most common of these
+// is a copyright header block. This node contains only the last line of such
+// a comment block as the anchor, and other lines of the block comment are
+// hung off of it as Before comments, similar to other syntax elements.
+class BlockCommentNode : public ParseNode {
+ public:
+ BlockCommentNode();
+ virtual ~BlockCommentNode();
+
+ virtual const BlockCommentNode* AsBlockComment() const OVERRIDE;
+ virtual Value Execute(Scope* scope, Err* err) const OVERRIDE;
+ virtual LocationRange GetRange() const OVERRIDE;
+ virtual Err MakeErrorDescribing(
+ const std::string& msg,
+ const std::string& help = std::string()) const OVERRIDE;
+ virtual void Print(std::ostream& out, int indent) const OVERRIDE;
+
+ const Token& comment() const { return comment_; }
+ void set_comment(const Token& t) { comment_ = t; }
+
+ private:
+ Token comment_;
+
+ DISALLOW_COPY_AND_ASSIGN(BlockCommentNode);
+};
+
#endif // TOOLS_GN_PARSE_TREE_H_

Powered by Google App Engine
This is Rietveld 408576698