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

Side by Side Diff: tools/gn/parse_tree.h

Issue 742003002: gn format: penalty-based line breaking WIP XXX Base URL: https://chromium.googlesource.com/chromium/src.git@gn-more-disabled
Patch Set: futzing Created 6 years 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 unified diff | Download patch
« no previous file with comments | « tools/gn/line_breaker_unittest.cc ('k') | tools/gn/parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 220
221 const BlockNode* AsBlock() const override; 221 const BlockNode* AsBlock() const override;
222 Value Execute(Scope* scope, Err* err) const override; 222 Value Execute(Scope* scope, Err* err) const override;
223 LocationRange GetRange() const override; 223 LocationRange GetRange() const override;
224 Err MakeErrorDescribing( 224 Err MakeErrorDescribing(
225 const std::string& msg, 225 const std::string& msg,
226 const std::string& help = std::string()) const override; 226 const std::string& help = std::string()) const override;
227 void Print(std::ostream& out, int indent) const override; 227 void Print(std::ostream& out, int indent) const override;
228 228
229 void set_begin_token(const Token& t) { begin_token_ = t; } 229 void set_begin_token(const Token& t) { begin_token_ = t; }
230 const Token& begin_token() const { return begin_token_; }
230 void set_end(scoped_ptr<EndNode> e) { end_ = e.Pass(); } 231 void set_end(scoped_ptr<EndNode> e) { end_ = e.Pass(); }
231 const EndNode* End() const { return end_.get(); } 232 const EndNode* End() const { return end_.get(); }
232 233
233 const std::vector<ParseNode*>& statements() const { return statements_; } 234 const std::vector<ParseNode*>& statements() const { return statements_; }
234 void append_statement(scoped_ptr<ParseNode> s) { 235 void append_statement(scoped_ptr<ParseNode> s) {
235 statements_.push_back(s.release()); 236 statements_.push_back(s.release());
236 } 237 }
237 238
238 // Doesn't create a nested scope. 239 // Doesn't create a nested scope.
239 Value ExecuteBlockInScope(Scope* our_scope, Err* err) const; 240 Value ExecuteBlockInScope(Scope* our_scope, Err* err) const;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 364
364 const ListNode* AsList() const override; 365 const ListNode* AsList() const override;
365 Value Execute(Scope* scope, Err* err) const override; 366 Value Execute(Scope* scope, Err* err) const override;
366 LocationRange GetRange() const override; 367 LocationRange GetRange() const override;
367 Err MakeErrorDescribing( 368 Err MakeErrorDescribing(
368 const std::string& msg, 369 const std::string& msg,
369 const std::string& help = std::string()) const override; 370 const std::string& help = std::string()) const override;
370 void Print(std::ostream& out, int indent) const override; 371 void Print(std::ostream& out, int indent) const override;
371 372
372 void set_begin_token(const Token& t) { begin_token_ = t; } 373 void set_begin_token(const Token& t) { begin_token_ = t; }
374 const Token& begin_token() const { return begin_token_; }
373 void set_end(scoped_ptr<EndNode> e) { end_ = e.Pass(); } 375 void set_end(scoped_ptr<EndNode> e) { end_ = e.Pass(); }
374 const EndNode* End() const { return end_.get(); } 376 const EndNode* End() const { return end_.get(); }
375 377
376 void append_item(scoped_ptr<ParseNode> s) { 378 void append_item(scoped_ptr<ParseNode> s) {
377 contents_.push_back(s.release()); 379 contents_.push_back(s.release());
378 } 380 }
379 const std::vector<const ParseNode*>& contents() const { return contents_; } 381 const std::vector<const ParseNode*>& contents() const { return contents_; }
380 382
381 private: 383 private:
382 // Tokens corresponding to the [ and ]. The end token is stored in inside an 384 // Tokens corresponding to the [ and ]. The end token is stored in inside an
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 const Token& value() const { return value_; } 498 const Token& value() const { return value_; }
497 void set_value(const Token& t) { value_ = t; } 499 void set_value(const Token& t) { value_ = t; }
498 500
499 private: 501 private:
500 Token value_; 502 Token value_;
501 503
502 DISALLOW_COPY_AND_ASSIGN(EndNode); 504 DISALLOW_COPY_AND_ASSIGN(EndNode);
503 }; 505 };
504 506
505 #endif // TOOLS_GN_PARSE_TREE_H_ 507 #endif // TOOLS_GN_PARSE_TREE_H_
OLDNEW
« no previous file with comments | « tools/gn/line_breaker_unittest.cc ('k') | tools/gn/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698