| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 #include "preparser.h" | 51 #include "preparser.h" |
| 52 #include "runtime.h" | 52 #include "runtime.h" |
| 53 #include "scanner-character-streams.h" | 53 #include "scanner-character-streams.h" |
| 54 #include "scopeinfo.h" | 54 #include "scopeinfo.h" |
| 55 #include "string-stream.h" | 55 #include "string-stream.h" |
| 56 | 56 |
| 57 #include "experimental-scanner.h" | 57 #include "experimental-scanner.h" |
| 58 | 58 |
| 59 using namespace v8::internal; | 59 using namespace v8::internal; |
| 60 | 60 |
| 61 namespace { | |
| 62 | |
| 63 inline int HexValue(uc32 c) { | |
| 64 c -= '0'; | |
| 65 if (static_cast<unsigned>(c) <= 9) return c; | |
| 66 c = (c | 0x20) - ('a' - '0'); // detect 0x11..0x16 and 0x31..0x36. | |
| 67 if (static_cast<unsigned>(c) <= 5) return c + 10; | |
| 68 return -1; | |
| 69 } | |
| 70 | |
| 71 } | |
| 72 | |
| 73 namespace v8 { | 61 namespace v8 { |
| 74 namespace internal { | 62 namespace internal { |
| 75 | 63 |
| 76 EvenMoreExperimentalScanner::EvenMoreExperimentalScanner( | 64 EvenMoreExperimentalScanner::EvenMoreExperimentalScanner( |
| 77 ExperimentalScanner* sink, | 65 ExperimentalScanner* sink, |
| 78 UnicodeCache* unicode_cache) | 66 UnicodeCache* unicode_cache) |
| 79 : unicode_cache_(unicode_cache), | 67 : unicode_cache_(unicode_cache), |
| 80 buffer_(NULL), | 68 buffer_(NULL), |
| 81 buffer_end_(NULL), | 69 buffer_end_(NULL), |
| 82 start_(NULL), | 70 start_(NULL), |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 116 |
| 129 void EvenMoreExperimentalScanner::send(Token::Value token) { | 117 void EvenMoreExperimentalScanner::send(Token::Value token) { |
| 130 int beg = start_ - buffer_; | 118 int beg = start_ - buffer_; |
| 131 int end = cursor_ - buffer_; | 119 int end = cursor_ - buffer_; |
| 132 sink_->Record(token, beg, end); | 120 sink_->Record(token, beg, end); |
| 133 } | 121 } |
| 134 | 122 |
| 135 | 123 |
| 136 } | 124 } |
| 137 } | 125 } |
| OLD | NEW |