| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "checks.h" | 34 #include "checks.h" |
| 35 #include "allocation.h" | 35 #include "allocation.h" |
| 36 #include "token.h" | 36 #include "token.h" |
| 37 #include "unicode-inl.h" | 37 #include "unicode-inl.h" |
| 38 #include "char-predicates.h" | 38 #include "char-predicates.h" |
| 39 #include "utils.h" | 39 #include "utils.h" |
| 40 | 40 |
| 41 namespace v8 { | 41 namespace v8 { |
| 42 namespace internal { | 42 namespace internal { |
| 43 | 43 |
| 44 // Interface through which the scanner reads characters from the input source. |
| 45 class UTF16Buffer { |
| 46 public: |
| 47 UTF16Buffer(); |
| 48 virtual ~UTF16Buffer() {} |
| 49 |
| 50 virtual void PushBack(uc32 ch) = 0; |
| 51 // Returns a value < 0 when the buffer end is reached. |
| 52 virtual uc32 Advance() = 0; |
| 53 virtual void SeekForward(int pos) = 0; |
| 54 |
| 55 int pos() const { return pos_; } |
| 56 |
| 57 protected: |
| 58 int pos_; // Current position in the buffer. |
| 59 int end_; // Position where scanning should stop (EOF). |
| 60 }; |
| 61 |
| 62 |
| 44 class ScannerConstants : AllStatic { | 63 class ScannerConstants : AllStatic { |
| 45 public: | 64 public: |
| 46 typedef unibrow::Utf8InputBuffer<1024> Utf8Decoder; | 65 typedef unibrow::Utf8InputBuffer<1024> Utf8Decoder; |
| 47 | 66 |
| 48 static StaticResource<Utf8Decoder>* utf8_decoder() { | 67 static StaticResource<Utf8Decoder>* utf8_decoder() { |
| 49 return &utf8_decoder_; | 68 return &utf8_decoder_; |
| 50 } | 69 } |
| 51 | 70 |
| 52 static unibrow::Predicate<IdentifierStart, 128> kIsIdentifierStart; | 71 static unibrow::Predicate<IdentifierStart, 128> kIsIdentifierStart; |
| 53 static unibrow::Predicate<IdentifierPart, 128> kIsIdentifierPart; | 72 static unibrow::Predicate<IdentifierPart, 128> kIsIdentifierPart; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 // keyword with the current prefix). | 197 // keyword with the current prefix). |
| 179 const char* keyword_; | 198 const char* keyword_; |
| 180 int counter_; | 199 int counter_; |
| 181 Token::Value keyword_token_; | 200 Token::Value keyword_token_; |
| 182 }; | 201 }; |
| 183 | 202 |
| 184 | 203 |
| 185 } } // namespace v8::internal | 204 } } // namespace v8::internal |
| 186 | 205 |
| 187 #endif // V8_SCANNER_BASE_H_ | 206 #endif // V8_SCANNER_BASE_H_ |
| OLD | NEW |