Chromium Code Reviews| Index: src/scanner-base.h |
| diff --git a/src/scanner-base.h b/src/scanner-base.h |
| index 1024ad18582e3c078793d2295fe3cb8a92d23b18..96145b9c2dbd4420a0ecfc25a68960823a511385 100644 |
| --- a/src/scanner-base.h |
| +++ b/src/scanner-base.h |
| @@ -271,10 +271,19 @@ class Scanner { |
| struct Location { |
| Location(int b, int e) : beg_pos(b), end_pos(e) { } |
| Location() : beg_pos(0), end_pos(0) { } |
| + |
| + bool IsValid() const { |
| + return beg_pos >= 0 && end_pos >= 0; |
|
Lasse Reichstein
2011/01/25 13:03:55
How about ... && end_pos >= beg_pos;
Seems more "v
Martin Maly
2011/01/25 17:21:25
Done. Using beg_pos >= 0 && end_pos >= beg_pos
be
|
| + } |
| + |
| int beg_pos; |
| int end_pos; |
| }; |
| + static Location NoLocation() { |
| + return Location(-1, -1); |
| + } |
| + |
| // Returns the location information for the current token |
| // (the token returned by Next()). |
| Location location() const { return current_.location; } |