OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 22 matching lines...) Expand all Loading... |
33 | 33 |
34 #include "isolate.h" | 34 #include "isolate.h" |
35 #include "token.h" | 35 #include "token.h" |
36 #include "scanner.h" | 36 #include "scanner.h" |
37 #include "parser.h" | 37 #include "parser.h" |
38 #include "utils.h" | 38 #include "utils.h" |
39 #include "execution.h" | 39 #include "execution.h" |
40 #include "preparser.h" | 40 #include "preparser.h" |
41 #include "cctest.h" | 41 #include "cctest.h" |
42 | 42 |
43 namespace i = ::v8::internal; | |
44 | |
45 TEST(ScanKeywords) { | 43 TEST(ScanKeywords) { |
46 struct KeywordToken { | 44 struct KeywordToken { |
47 const char* keyword; | 45 const char* keyword; |
48 i::Token::Value token; | 46 i::Token::Value token; |
49 }; | 47 }; |
50 | 48 |
51 static const KeywordToken keywords[] = { | 49 static const KeywordToken keywords[] = { |
52 #define KEYWORD(t, s, d) { s, i::Token::t }, | 50 #define KEYWORD(t, s, d) { s, i::Token::t }, |
53 TOKEN_LIST(IGNORE_TOKEN, KEYWORD) | 51 TOKEN_LIST(IGNORE_TOKEN, KEYWORD) |
54 #undef KEYWORD | 52 #undef KEYWORD |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 TestScanRegExp("/[\\u12]/flipperwald", "[\\u12]"); | 697 TestScanRegExp("/[\\u12]/flipperwald", "[\\u12]"); |
700 TestScanRegExp("/[\\u123]/flipperwald", "[\\u123]"); | 698 TestScanRegExp("/[\\u123]/flipperwald", "[\\u123]"); |
701 // Escaped ']'s wont end the character class. | 699 // Escaped ']'s wont end the character class. |
702 TestScanRegExp("/[\\]/]/flipperwald", "[\\]/]"); | 700 TestScanRegExp("/[\\]/]/flipperwald", "[\\]/]"); |
703 // Escaped slashes are not terminating. | 701 // Escaped slashes are not terminating. |
704 TestScanRegExp("/\\//flipperwald", "\\/"); | 702 TestScanRegExp("/\\//flipperwald", "\\/"); |
705 // Starting with '=' works too. | 703 // Starting with '=' works too. |
706 TestScanRegExp("/=/", "="); | 704 TestScanRegExp("/=/", "="); |
707 TestScanRegExp("/=?/", "=?"); | 705 TestScanRegExp("/=?/", "=?"); |
708 } | 706 } |
OLD | NEW |