| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "tools/gn/tokenizer.h" | 5 #include "tools/gn/tokenizer.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "tools/gn/input_file.h" | 8 #include "tools/gn/input_file.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 if (value == "<") | 57 if (value == "<") |
| 58 return Token::LESS_THAN; | 58 return Token::LESS_THAN; |
| 59 if (value == ">") | 59 if (value == ">") |
| 60 return Token::GREATER_THAN; | 60 return Token::GREATER_THAN; |
| 61 if (value == "&&") | 61 if (value == "&&") |
| 62 return Token::BOOLEAN_AND; | 62 return Token::BOOLEAN_AND; |
| 63 if (value == "||") | 63 if (value == "||") |
| 64 return Token::BOOLEAN_OR; | 64 return Token::BOOLEAN_OR; |
| 65 if (value == "!") | 65 if (value == "!") |
| 66 return Token::BANG; | 66 return Token::BANG; |
| 67 NOTREACHED(); | |
| 68 return Token::INVALID; | 67 return Token::INVALID; |
| 69 } | 68 } |
| 70 | 69 |
| 71 } // namespace | 70 } // namespace |
| 72 | 71 |
| 73 Tokenizer::Tokenizer(const InputFile* input_file, Err* err) | 72 Tokenizer::Tokenizer(const InputFile* input_file, Err* err) |
| 74 : input_file_(input_file), | 73 : input_file_(input_file), |
| 75 input_(input_file->contents()), | 74 input_(input_file->contents()), |
| 76 err_(err), | 75 err_(err), |
| 77 cur_(0), | 76 cur_(0), |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 } else if (cur_char() == '/' && cur_ + 1 < input_.size() && | 356 } else if (cur_char() == '/' && cur_ + 1 < input_.size() && |
| 358 (input_[cur_ + 1] == '/' || input_[cur_ + 1] == '*')) { | 357 (input_[cur_ + 1] == '/' || input_[cur_ + 1] == '*')) { |
| 359 // Different types of comments. | 358 // Different types of comments. |
| 360 help = "Comments should start with # instead"; | 359 help = "Comments should start with # instead"; |
| 361 } else { | 360 } else { |
| 362 help = "I have no idea what this is."; | 361 help = "I have no idea what this is."; |
| 363 } | 362 } |
| 364 | 363 |
| 365 return Err(location, "Invalid token.", help); | 364 return Err(location, "Invalid token.", help); |
| 366 } | 365 } |
| OLD | NEW |