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

Side by Side Diff: src/char-predicates.h

Issue 626073002: Update identifier syntax to disallow U+2E2F (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed test. Created 6 years, 2 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 | « no previous file | test/mjsunit/var.js » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_CHAR_PREDICATES_H_ 5 #ifndef V8_CHAR_PREDICATES_H_
6 #define V8_CHAR_PREDICATES_H_ 6 #define V8_CHAR_PREDICATES_H_
7 7
8 #include "src/unicode.h" 8 #include "src/unicode.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 12
13 // Unicode character predicates as defined by ECMA-262, 3rd, 13 // Unicode character predicates as defined by ECMA-262, 3rd,
14 // used for lexical analysis. 14 // used for lexical analysis.
15 15
16 inline bool IsCarriageReturn(uc32 c); 16 inline bool IsCarriageReturn(uc32 c);
17 inline bool IsLineFeed(uc32 c); 17 inline bool IsLineFeed(uc32 c);
18 inline bool IsDecimalDigit(uc32 c); 18 inline bool IsDecimalDigit(uc32 c);
19 inline bool IsHexDigit(uc32 c); 19 inline bool IsHexDigit(uc32 c);
20 inline bool IsOctalDigit(uc32 c); 20 inline bool IsOctalDigit(uc32 c);
21 inline bool IsBinaryDigit(uc32 c); 21 inline bool IsBinaryDigit(uc32 c);
22 inline bool IsRegExpWord(uc32 c); 22 inline bool IsRegExpWord(uc32 c);
23 inline bool IsRegExpNewline(uc32 c); 23 inline bool IsRegExpNewline(uc32 c);
24 24
25 struct IdentifierStart { 25 struct IdentifierStart {
26 static inline bool Is(uc32 c) { 26 static inline bool Is(uc32 c) {
27 switch (c) { 27 switch (c) {
28 case '$': case '_': case '\\': return true; 28 case '$': case '_': case '\\': return true;
29 case 0x2e2f:
30 return false; // U+2E2F is Vertical tilde.
29 default: return unibrow::Letter::Is(c); 31 default: return unibrow::Letter::Is(c);
30 } 32 }
31 } 33 }
32 }; 34 };
33 35
34 36
35 struct IdentifierPart { 37 struct IdentifierPart {
36 static inline bool Is(uc32 c) { 38 static inline bool Is(uc32 c) {
39 if (c == 0x2e2f) return false; // U+2E2F is Vertical tilde.
37 return IdentifierStart::Is(c) 40 return IdentifierStart::Is(c)
38 || unibrow::Number::Is(c) 41 || unibrow::Number::Is(c)
39 || c == 0x200C // U+200C is Zero-Width Non-Joiner. 42 || c == 0x200C // U+200C is Zero-Width Non-Joiner.
40 || c == 0x200D // U+200D is Zero-Width Joiner. 43 || c == 0x200D // U+200D is Zero-Width Joiner.
41 || unibrow::CombiningMark::Is(c) 44 || unibrow::CombiningMark::Is(c)
42 || unibrow::ConnectorPunctuation::Is(c); 45 || unibrow::ConnectorPunctuation::Is(c);
43 } 46 }
44 }; 47 };
45 48
46 49
(...skipping 13 matching lines...) Expand all
60 // WhiteSpace and LineTerminator according to ECMA-262 5.1, 7.2 and 7.3. 63 // WhiteSpace and LineTerminator according to ECMA-262 5.1, 7.2 and 7.3.
61 struct WhiteSpaceOrLineTerminator { 64 struct WhiteSpaceOrLineTerminator {
62 static inline bool Is(uc32 c) { 65 static inline bool Is(uc32 c) {
63 return WhiteSpace::Is(c) || unibrow::LineTerminator::Is(c); 66 return WhiteSpace::Is(c) || unibrow::LineTerminator::Is(c);
64 } 67 }
65 }; 68 };
66 69
67 } } // namespace v8::internal 70 } } // namespace v8::internal
68 71
69 #endif // V8_CHAR_PREDICATES_H_ 72 #endif // V8_CHAR_PREDICATES_H_
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/var.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698