| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 start_ = buffer_ + start_offset; | 266 start_ = buffer_ + start_offset; |
| 267 cursor_ = buffer_ + cursor_offset; | 267 cursor_ = buffer_ + cursor_offset; |
| 268 marker_ = buffer_ + marker_offset; | 268 marker_ = buffer_ + marker_offset; |
| 269 } | 269 } |
| 270 } | 270 } |
| 271 | 271 |
| 272 const YYCTYPE* GetNewBufferBasedOnHandle() const; | 272 const YYCTYPE* GetNewBufferBasedOnHandle() const; |
| 273 | 273 |
| 274 private: | 274 private: |
| 275 Handle<String> source_handle_; | 275 Handle<String> source_handle_; |
| 276 YYCTYPE yych; | |
| 277 const YYCTYPE* buffer_; | 276 const YYCTYPE* buffer_; |
| 278 const YYCTYPE* buffer_end_; | 277 const YYCTYPE* buffer_end_; |
| 279 const YYCTYPE* start_; | 278 const YYCTYPE* start_; |
| 280 const YYCTYPE* cursor_; | 279 const YYCTYPE* cursor_; |
| 281 const YYCTYPE* marker_; | 280 const YYCTYPE* marker_; |
| 282 }; | 281 }; |
| 283 | 282 |
| 284 | 283 |
| 285 template<> | |
| 286 void ExperimentalScanner<uint8_t>::Scan(); | |
| 287 | |
| 288 template<> | |
| 289 void ExperimentalScanner<uint16_t>::Scan(); | |
| 290 | |
| 291 template<> | |
| 292 void ExperimentalScanner<int8_t>::Scan(); | |
| 293 | |
| 294 | |
| 295 template<typename YYCTYPE> | 284 template<typename YYCTYPE> |
| 296 uc32 ExperimentalScanner<YYCTYPE>::ScanHexNumber(int length) { | 285 uc32 ExperimentalScanner<YYCTYPE>::ScanHexNumber(int length) { |
| 297 // We have seen \uXXXX, let's see what it is. | 286 // We have seen \uXXXX, let's see what it is. |
| 298 // FIXME: we never end up in here if only a subset of the 4 chars are valid | 287 // FIXME: we never end up in here if only a subset of the 4 chars are valid |
| 299 // hex digits -> handle the case where they're not. | 288 // hex digits -> handle the case where they're not. |
| 300 uc32 x = 0; | 289 uc32 x = 0; |
| 301 for (const YYCTYPE* s = cursor_ - length; s != cursor_; ++s) { | 290 for (const YYCTYPE* s = cursor_ - length; s != cursor_; ++s) { |
| 302 int d = HexValue(*s); | 291 int d = HexValue(*s); |
| 303 if (d < 0) { | 292 if (d < 0) { |
| 304 return -1; | 293 return -1; |
| 305 } | 294 } |
| 306 x = x * 16 + d; | 295 x = x * 16 + d; |
| 307 } | 296 } |
| 308 return x; | 297 return x; |
| 309 } | 298 } |
| 310 | 299 |
| 311 | 300 |
| 312 } } | 301 } } |
| 313 | 302 |
| 314 #endif // V8_LEXER_EXPERIMENTAL_SCANNER_H | 303 #endif // V8_LEXER_EXPERIMENTAL_SCANNER_H |
| OLD | NEW |