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

Side by Side Diff: src/scanner.h

Issue 6606006: [Isolates] Merge 6500:6700 from bleeding_edge to isolates. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 years, 9 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/safepoint-table.cc ('k') | src/scanner.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 143
144 class JsonScanner : public Scanner { 144 class JsonScanner : public Scanner {
145 public: 145 public:
146 explicit JsonScanner(Isolate* isolate); 146 explicit JsonScanner(Isolate* isolate);
147 147
148 void Initialize(UC16CharacterStream* source); 148 void Initialize(UC16CharacterStream* source);
149 149
150 // Returns the next token. 150 // Returns the next token.
151 Token::Value Next(); 151 Token::Value Next();
152 152
153 // Returns the value of a number token.
154 double number() {
155 return number_;
156 }
157
158
153 protected: 159 protected:
154 // Skip past JSON whitespace (only space, tab, newline and carrige-return). 160 // Skip past JSON whitespace (only space, tab, newline and carrige-return).
155 bool SkipJsonWhiteSpace(); 161 bool SkipJsonWhiteSpace();
156 162
157 // Scan a single JSON token. The JSON lexical grammar is specified in the 163 // Scan a single JSON token. The JSON lexical grammar is specified in the
158 // ECMAScript 5 standard, section 15.12.1.1. 164 // ECMAScript 5 standard, section 15.12.1.1.
159 // Recognizes all of the single-character tokens directly, or calls a function 165 // Recognizes all of the single-character tokens directly, or calls a function
160 // to scan a number, string or identifier literal. 166 // to scan a number, string or identifier literal.
161 // The only allowed whitespace characters between tokens are tab, 167 // The only allowed whitespace characters between tokens are tab,
162 // carriage-return, newline and space. 168 // carriage-return, newline and space.
(...skipping 10 matching lines...) Expand all
173 // A JSON string (production JSONString) is subset of valid JavaScript string 179 // A JSON string (production JSONString) is subset of valid JavaScript string
174 // literals. The string must only be double-quoted (not single-quoted), and 180 // literals. The string must only be double-quoted (not single-quoted), and
175 // the only allowed backslash-escapes are ", /, \, b, f, n, r, t and 181 // the only allowed backslash-escapes are ", /, \, b, f, n, r, t and
176 // four-digit hex escapes (uXXXX). Any other use of backslashes is invalid. 182 // four-digit hex escapes (uXXXX). Any other use of backslashes is invalid.
177 Token::Value ScanJsonString(); 183 Token::Value ScanJsonString();
178 184
179 // Used to recognizes one of the literals "true", "false", or "null". These 185 // Used to recognizes one of the literals "true", "false", or "null". These
180 // are the only valid JSON identifiers (productions JSONBooleanLiteral, 186 // are the only valid JSON identifiers (productions JSONBooleanLiteral,
181 // JSONNullLiteral). 187 // JSONNullLiteral).
182 Token::Value ScanJsonIdentifier(const char* text, Token::Value token); 188 Token::Value ScanJsonIdentifier(const char* text, Token::Value token);
189
190 // Holds the value of a scanned number token.
191 double number_;
183 }; 192 };
184 193
185 } } // namespace v8::internal 194 } } // namespace v8::internal
186 195
187 #endif // V8_SCANNER_H_ 196 #endif // V8_SCANNER_H_
OLDNEW
« no previous file with comments | « src/safepoint-table.cc ('k') | src/scanner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698