| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef TOOLS_GN_PARSE_TREE_H_ | 5 #ifndef TOOLS_GN_PARSE_TREE_H_ |
| 6 #define TOOLS_GN_PARSE_TREE_H_ | 6 #define TOOLS_GN_PARSE_TREE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 scoped_ptr<BlockNode> block_; // May be null. | 324 scoped_ptr<BlockNode> block_; // May be null. |
| 325 | 325 |
| 326 DISALLOW_COPY_AND_ASSIGN(FunctionCallNode); | 326 DISALLOW_COPY_AND_ASSIGN(FunctionCallNode); |
| 327 }; | 327 }; |
| 328 | 328 |
| 329 // IdentifierNode -------------------------------------------------------------- | 329 // IdentifierNode -------------------------------------------------------------- |
| 330 | 330 |
| 331 class IdentifierNode : public ParseNode { | 331 class IdentifierNode : public ParseNode { |
| 332 public: | 332 public: |
| 333 IdentifierNode(); | 333 IdentifierNode(); |
| 334 IdentifierNode(const Token& token); | 334 explicit IdentifierNode(const Token& token); |
| 335 ~IdentifierNode() override; | 335 ~IdentifierNode() override; |
| 336 | 336 |
| 337 const IdentifierNode* AsIdentifier() const override; | 337 const IdentifierNode* AsIdentifier() const override; |
| 338 Value Execute(Scope* scope, Err* err) const override; | 338 Value Execute(Scope* scope, Err* err) const override; |
| 339 LocationRange GetRange() const override; | 339 LocationRange GetRange() const override; |
| 340 Err MakeErrorDescribing( | 340 Err MakeErrorDescribing( |
| 341 const std::string& msg, | 341 const std::string& msg, |
| 342 const std::string& help = std::string()) const override; | 342 const std::string& help = std::string()) const override; |
| 343 void Print(std::ostream& out, int indent) const override; | 343 void Print(std::ostream& out, int indent) const override; |
| 344 | 344 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 std::vector<const ParseNode*> contents_; | 406 std::vector<const ParseNode*> contents_; |
| 407 | 407 |
| 408 DISALLOW_COPY_AND_ASSIGN(ListNode); | 408 DISALLOW_COPY_AND_ASSIGN(ListNode); |
| 409 }; | 409 }; |
| 410 | 410 |
| 411 // LiteralNode ----------------------------------------------------------------- | 411 // LiteralNode ----------------------------------------------------------------- |
| 412 | 412 |
| 413 class LiteralNode : public ParseNode { | 413 class LiteralNode : public ParseNode { |
| 414 public: | 414 public: |
| 415 LiteralNode(); | 415 LiteralNode(); |
| 416 LiteralNode(const Token& token); | 416 explicit LiteralNode(const Token& token); |
| 417 ~LiteralNode() override; | 417 ~LiteralNode() override; |
| 418 | 418 |
| 419 const LiteralNode* AsLiteral() const override; | 419 const LiteralNode* AsLiteral() const override; |
| 420 Value Execute(Scope* scope, Err* err) const override; | 420 Value Execute(Scope* scope, Err* err) const override; |
| 421 LocationRange GetRange() const override; | 421 LocationRange GetRange() const override; |
| 422 Err MakeErrorDescribing( | 422 Err MakeErrorDescribing( |
| 423 const std::string& msg, | 423 const std::string& msg, |
| 424 const std::string& help = std::string()) const override; | 424 const std::string& help = std::string()) const override; |
| 425 void Print(std::ostream& out, int indent) const override; | 425 void Print(std::ostream& out, int indent) const override; |
| 426 | 426 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 }; | 495 }; |
| 496 | 496 |
| 497 // EndNode --------------------------------------------------------------------- | 497 // EndNode --------------------------------------------------------------------- |
| 498 | 498 |
| 499 // This node type is used as the end_ object for lists and blocks (rather than | 499 // This node type is used as the end_ object for lists and blocks (rather than |
| 500 // just the end ']', '}', or ')' token). This is so that during formatting | 500 // just the end ']', '}', or ')' token). This is so that during formatting |
| 501 // traversal there is a node that appears at the end of the block to which | 501 // traversal there is a node that appears at the end of the block to which |
| 502 // comments can be attached. | 502 // comments can be attached. |
| 503 class EndNode : public ParseNode { | 503 class EndNode : public ParseNode { |
| 504 public: | 504 public: |
| 505 EndNode(const Token& token); | 505 explicit EndNode(const Token& token); |
| 506 ~EndNode() override; | 506 ~EndNode() override; |
| 507 | 507 |
| 508 const EndNode* AsEnd() const override; | 508 const EndNode* AsEnd() const override; |
| 509 Value Execute(Scope* scope, Err* err) const override; | 509 Value Execute(Scope* scope, Err* err) const override; |
| 510 LocationRange GetRange() const override; | 510 LocationRange GetRange() const override; |
| 511 Err MakeErrorDescribing( | 511 Err MakeErrorDescribing( |
| 512 const std::string& msg, | 512 const std::string& msg, |
| 513 const std::string& help = std::string()) const override; | 513 const std::string& help = std::string()) const override; |
| 514 void Print(std::ostream& out, int indent) const override; | 514 void Print(std::ostream& out, int indent) const override; |
| 515 | 515 |
| 516 const Token& value() const { return value_; } | 516 const Token& value() const { return value_; } |
| 517 void set_value(const Token& t) { value_ = t; } | 517 void set_value(const Token& t) { value_ = t; } |
| 518 | 518 |
| 519 private: | 519 private: |
| 520 Token value_; | 520 Token value_; |
| 521 | 521 |
| 522 DISALLOW_COPY_AND_ASSIGN(EndNode); | 522 DISALLOW_COPY_AND_ASSIGN(EndNode); |
| 523 }; | 523 }; |
| 524 | 524 |
| 525 #endif // TOOLS_GN_PARSE_TREE_H_ | 525 #endif // TOOLS_GN_PARSE_TREE_H_ |
| OLD | NEW |