OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 18 matching lines...) Expand all Loading... |
29 | 29 |
30 #include "scanner.h" | 30 #include "scanner.h" |
31 | 31 |
32 #include "../include/v8stdint.h" | 32 #include "../include/v8stdint.h" |
33 #include "char-predicates-inl.h" | 33 #include "char-predicates-inl.h" |
34 | 34 |
35 namespace v8 { | 35 namespace v8 { |
36 namespace internal { | 36 namespace internal { |
37 | 37 |
38 // ---------------------------------------------------------------------------- | 38 // ---------------------------------------------------------------------------- |
| 39 // Scanner::LiteralScope |
| 40 |
| 41 Scanner::LiteralScope::LiteralScope(Scanner* self) |
| 42 : scanner_(self), complete_(false) { |
| 43 self->StartLiteral(); |
| 44 } |
| 45 |
| 46 |
| 47 Scanner::LiteralScope::~LiteralScope() { |
| 48 if (!complete_) scanner_->DropLiteral(); |
| 49 } |
| 50 |
| 51 |
| 52 void Scanner::LiteralScope::Complete() { |
| 53 scanner_->TerminateLiteral(); |
| 54 complete_ = true; |
| 55 } |
| 56 |
| 57 // ---------------------------------------------------------------------------- |
39 // Scanner | 58 // Scanner |
40 | 59 |
41 Scanner::Scanner(UnicodeCache* unicode_cache) | 60 Scanner::Scanner(UnicodeCache* unicode_cache) |
42 : unicode_cache_(unicode_cache) { } | 61 : unicode_cache_(unicode_cache) { } |
43 | 62 |
44 | 63 |
45 uc32 Scanner::ScanHexNumber(int expected_length) { | 64 uc32 Scanner::ScanHexNumber(int expected_length) { |
46 ASSERT(expected_length <= 4); // prevent overflow | 65 ASSERT(expected_length <= 4); // prevent overflow |
47 | 66 |
48 uc32 digits[4] = { 0, 0, 0, 0 }; | 67 uc32 digits[4] = { 0, 0, 0, 0 }; |
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 } | 1101 } |
1083 } | 1102 } |
1084 } | 1103 } |
1085 literal.Complete(); | 1104 literal.Complete(); |
1086 | 1105 |
1087 next_.location.end_pos = source_pos() - 1; | 1106 next_.location.end_pos = source_pos() - 1; |
1088 return true; | 1107 return true; |
1089 } | 1108 } |
1090 | 1109 |
1091 } } // namespace v8::internal | 1110 } } // namespace v8::internal |
OLD | NEW |