Index: tools/gn/parse_tree.h |
diff --git a/tools/gn/parse_tree.h b/tools/gn/parse_tree.h |
index e3d4e7d7f93fb343c65ecea7c631f96451d065a6..73ac0e5196f7fd3fce9b7552041730a6ce8cf4df 100644 |
--- a/tools/gn/parse_tree.h |
+++ b/tools/gn/parse_tree.h |
@@ -1,4 +1,4 @@ |
-// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
@@ -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 standard 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_ |