| 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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 unibrow::CharacterStream* stream, | 290 unibrow::CharacterStream* stream, |
| 291 ParserLanguage language); | 291 ParserLanguage language); |
| 292 void Initialize(Handle<String> source, | 292 void Initialize(Handle<String> source, |
| 293 int start_position, int end_position, | 293 int start_position, int end_position, |
| 294 ParserLanguage language); | 294 ParserLanguage language); |
| 295 | 295 |
| 296 // Returns the next token. | 296 // Returns the next token. |
| 297 Token::Value Next(); | 297 Token::Value Next(); |
| 298 | 298 |
| 299 // One token look-ahead (past the token returned by Next()). | 299 // One token look-ahead (past the token returned by Next()). |
| 300 Token::Value peek() const { return next_.token; } | 300 Token::Value peek() const { return next_.token; } |
| 301 | 301 |
| 302 // Returns true if there was a line terminator before the peek'ed token. | 302 // Returns true if there was a line terminator before the peek'ed token. |
| 303 bool has_line_terminator_before_next() const { | 303 bool has_line_terminator_before_next() const { |
| 304 return has_line_terminator_before_next_; | 304 return has_line_terminator_before_next_; |
| 305 } | 305 } |
| 306 | 306 |
| 307 struct Location { | 307 struct Location { |
| 308 Location(int b, int e) : beg_pos(b), end_pos(e) { } | 308 Location(int b, int e) : beg_pos(b), end_pos(e) { } |
| 309 Location() : beg_pos(0), end_pos(0) { } | 309 Location() : beg_pos(0), end_pos(0) { } |
| 310 int beg_pos; | 310 int beg_pos; |
| 311 int end_pos; | 311 int end_pos; |
| 312 }; | 312 }; |
| 313 | 313 |
| 314 // Returns the location information for the current token | 314 // Returns the location information for the current token |
| 315 // (the token returned by Next()). | 315 // (the token returned by Next()). |
| 316 Location location() const { return current_.location; } | 316 Location location() const { return current_.location; } |
| 317 Location peek_location() const { return next_.location; } | 317 Location peek_location() const { return next_.location; } |
| 318 | 318 |
| 319 // Returns the literal string, if any, for the current token (the | 319 // Returns the literal string, if any, for the current token (the |
| 320 // token returned by Next()). The string is 0-terminated and in | 320 // token returned by Next()). The string is 0-terminated and in |
| 321 // UTF-8 format; they may contain 0-characters. Literal strings are | 321 // UTF-8 format; they may contain 0-characters. Literal strings are |
| 322 // collected for identifiers, strings, and numbers. | 322 // collected for identifiers, strings, and numbers. |
| 323 // These functions only give the correct result if the literal | 323 // These functions only give the correct result if the literal |
| 324 // was scanned between calls to StartLiteral() and TerminateLiteral(). | 324 // was scanned between calls to StartLiteral() and TerminateLiteral(). |
| 325 const char* literal_string() const { | 325 const char* literal_string() const { |
| 326 return current_.literal_chars.start(); | 326 return current_.literal_chars.start(); |
| 327 } | 327 } |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 bool stack_overflow_; | 510 bool stack_overflow_; |
| 511 static StaticResource<Utf8Decoder> utf8_decoder_; | 511 static StaticResource<Utf8Decoder> utf8_decoder_; |
| 512 | 512 |
| 513 // One Unicode character look-ahead; c0_ < 0 at the end of the input. | 513 // One Unicode character look-ahead; c0_ < 0 at the end of the input. |
| 514 uc32 c0_; | 514 uc32 c0_; |
| 515 }; | 515 }; |
| 516 | 516 |
| 517 } } // namespace v8::internal | 517 } } // namespace v8::internal |
| 518 | 518 |
| 519 #endif // V8_SCANNER_H_ | 519 #endif // V8_SCANNER_H_ |
| OLD | NEW |