Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1026)

Unified Diff: src/scanner-base.h

Issue 5188006: Push version 2.5.7 to trunk.... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/scanner.cc ('k') | src/scanner-base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scanner-base.h
===================================================================
--- src/scanner-base.h (revision 5846)
+++ src/scanner-base.h (working copy)
@@ -30,12 +30,56 @@
#ifndef V8_SCANNER_BASE_H_
#define V8_SCANNER_BASE_H_
+#include "globals.h"
+#include "checks.h"
+#include "allocation.h"
#include "token.h"
-#include "unicode.h"
+#include "unicode-inl.h"
+#include "char-predicates.h"
+#include "utils.h"
namespace v8 {
namespace internal {
+// Interface through which the scanner reads characters from the input source.
+class UTF16Buffer {
+ public:
+ UTF16Buffer();
+ virtual ~UTF16Buffer() {}
+
+ virtual void PushBack(uc32 ch) = 0;
+ // Returns a value < 0 when the buffer end is reached.
+ virtual uc32 Advance() = 0;
+ virtual void SeekForward(int pos) = 0;
+
+ int pos() const { return pos_; }
+
+ protected:
+ int pos_; // Current position in the buffer.
+ int end_; // Position where scanning should stop (EOF).
+};
+
+
+class ScannerConstants : AllStatic {
+ public:
+ typedef unibrow::Utf8InputBuffer<1024> Utf8Decoder;
+
+ static StaticResource<Utf8Decoder>* utf8_decoder() {
+ return &utf8_decoder_;
+ }
+
+ static unibrow::Predicate<IdentifierStart, 128> kIsIdentifierStart;
+ static unibrow::Predicate<IdentifierPart, 128> kIsIdentifierPart;
+ static unibrow::Predicate<unibrow::LineTerminator, 128> kIsLineTerminator;
+ static unibrow::Predicate<unibrow::WhiteSpace, 128> kIsWhiteSpace;
+
+ static bool IsIdentifier(unibrow::CharacterStream* buffer);
+
+ private:
+ static StaticResource<Utf8Decoder> utf8_decoder_;
+};
+
+
class KeywordMatcher {
// Incrementally recognize keywords.
//
@@ -45,7 +89,8 @@
// return switch this throw true try typeof var void while with
//
// *: Actually "future reserved keywords". These are the only ones we
-// recognized, the remaining are allowed as identifiers.
+// recognize, the remaining are allowed as identifiers.
+// In ES5 strict mode, we should disallow all reserved keywords.
public:
KeywordMatcher()
: state_(INITIAL),
@@ -156,10 +201,6 @@
};
-
-
-
-
} } // namespace v8::internal
#endif // V8_SCANNER_BASE_H_
« no previous file with comments | « src/scanner.cc ('k') | src/scanner-base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698