OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 193 |
194 | 194 |
195 template <typename StringType, typename CharType> | 195 template <typename StringType, typename CharType> |
196 void ExternalStringUTF16Buffer<StringType, CharType>::SeekForward(int pos) { | 196 void ExternalStringUTF16Buffer<StringType, CharType>::SeekForward(int pos) { |
197 pos_ = pos; | 197 pos_ = pos; |
198 } | 198 } |
199 | 199 |
200 | 200 |
201 // ---------------------------------------------------------------------------- | 201 // ---------------------------------------------------------------------------- |
202 // Keyword Matcher | 202 // Keyword Matcher |
| 203 |
203 KeywordMatcher::FirstState KeywordMatcher::first_states_[] = { | 204 KeywordMatcher::FirstState KeywordMatcher::first_states_[] = { |
204 { "break", KEYWORD_PREFIX, Token::BREAK }, | 205 { "break", KEYWORD_PREFIX, Token::BREAK }, |
205 { NULL, C, Token::ILLEGAL }, | 206 { NULL, C, Token::ILLEGAL }, |
206 { NULL, D, Token::ILLEGAL }, | 207 { NULL, D, Token::ILLEGAL }, |
207 { "else", KEYWORD_PREFIX, Token::ELSE }, | 208 { "else", KEYWORD_PREFIX, Token::ELSE }, |
208 { NULL, F, Token::ILLEGAL }, | 209 { NULL, F, Token::ILLEGAL }, |
209 { NULL, UNMATCHABLE, Token::ILLEGAL }, | 210 { NULL, UNMATCHABLE, Token::ILLEGAL }, |
210 { NULL, UNMATCHABLE, Token::ILLEGAL }, | 211 { NULL, UNMATCHABLE, Token::ILLEGAL }, |
211 { NULL, I, Token::ILLEGAL }, | 212 { NULL, I, Token::ILLEGAL }, |
212 { NULL, UNMATCHABLE, Token::ILLEGAL }, | 213 { NULL, UNMATCHABLE, Token::ILLEGAL }, |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 } | 329 } |
329 // On fallthrough, it's a failure. | 330 // On fallthrough, it's a failure. |
330 state_ = UNMATCHABLE; | 331 state_ = UNMATCHABLE; |
331 } | 332 } |
332 | 333 |
333 | 334 |
334 // ---------------------------------------------------------------------------- | 335 // ---------------------------------------------------------------------------- |
335 // Scanner | 336 // Scanner |
336 | 337 |
337 Scanner::Scanner(ParserMode pre) | 338 Scanner::Scanner(ParserMode pre) |
338 : stack_overflow_(false), is_pre_parsing_(pre == PREPARSE) { } | 339 : is_pre_parsing_(pre == PREPARSE), stack_overflow_(false) { } |
339 | 340 |
340 | 341 |
341 void Scanner::Initialize(Handle<String> source, | 342 void Scanner::Initialize(Handle<String> source, |
342 ParserLanguage language) { | 343 ParserLanguage language) { |
343 safe_string_input_buffer_.Reset(source.location()); | 344 safe_string_input_buffer_.Reset(source.location()); |
344 Init(source, &safe_string_input_buffer_, 0, source->length(), language); | 345 Init(source, &safe_string_input_buffer_, 0, source->length(), language); |
345 } | 346 } |
346 | 347 |
347 | 348 |
348 void Scanner::Initialize(Handle<String> source, | 349 void Scanner::Initialize(Handle<String> source, |
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1331 } | 1332 } |
1332 AddCharAdvance(); | 1333 AddCharAdvance(); |
1333 } | 1334 } |
1334 TerminateLiteral(); | 1335 TerminateLiteral(); |
1335 | 1336 |
1336 next_.location.end_pos = source_pos() - 1; | 1337 next_.location.end_pos = source_pos() - 1; |
1337 return true; | 1338 return true; |
1338 } | 1339 } |
1339 | 1340 |
1340 } } // namespace v8::internal | 1341 } } // namespace v8::internal |
OLD | NEW |