Index: src/scanner-base.cc |
diff --git a/src/scanner-base.cc b/src/scanner-base.cc |
index 0567bb9af961812ef4c2d497f65ce980f2f54023..6cde51787f5d50cf0199ce0ab5e5609fac53087d 100644 |
--- a/src/scanner-base.cc |
+++ b/src/scanner-base.cc |
@@ -34,6 +34,33 @@ namespace v8 { |
namespace internal { |
// ---------------------------------------------------------------------------- |
+// Character predicates |
+ |
+unibrow::Predicate<IdentifierStart, 128> ScannerConstants::kIsIdentifierStart; |
+unibrow::Predicate<IdentifierPart, 128> ScannerConstants::kIsIdentifierPart; |
+unibrow::Predicate<unibrow::WhiteSpace, 128> ScannerConstants::kIsWhiteSpace; |
+unibrow::Predicate<unibrow::LineTerminator, 128> |
+ ScannerConstants::kIsLineTerminator; |
+ |
+StaticResource<ScannerConstants::Utf8Decoder> ScannerConstants::utf8_decoder_; |
+ |
+// Compound predicates. |
+ |
+bool ScannerConstants::IsIdentifier(unibrow::CharacterStream* buffer) { |
+ // Checks whether the buffer contains an identifier (no escape). |
+ if (!buffer->has_more()) return false; |
+ if (!kIsIdentifierStart.get(buffer->GetNext())) { |
+ return false; |
+ } |
+ while (buffer->has_more()) { |
+ if (!kIsIdentifierPart.get(buffer->GetNext())) { |
+ return false; |
+ } |
+ } |
+ return true; |
+} |
+ |
+// ---------------------------------------------------------------------------- |
// Keyword Matcher |
KeywordMatcher::FirstState KeywordMatcher::first_states_[] = { |