OLD | NEW |
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 30 matching lines...) Expand all Loading... |
41 | 41 |
42 namespace v8 { | 42 namespace v8 { |
43 namespace internal { | 43 namespace internal { |
44 | 44 |
45 // Returns the value (0 .. 15) of a hexadecimal character c. | 45 // Returns the value (0 .. 15) of a hexadecimal character c. |
46 // If c is not a legal hexadecimal character, returns a value < 0. | 46 // If c is not a legal hexadecimal character, returns a value < 0. |
47 inline int HexValue(uc32 c) { | 47 inline int HexValue(uc32 c) { |
48 c -= '0'; | 48 c -= '0'; |
49 if (static_cast<unsigned>(c) <= 9) return c; | 49 if (static_cast<unsigned>(c) <= 9) return c; |
50 c = (c | 0x20) - ('a' - '0'); // detect 0x11..0x16 and 0x31..0x36. | 50 c = (c | 0x20) - ('a' - '0'); // detect 0x11..0x16 and 0x31..0x36. |
51 if (static_cast<unsigned>(c) <= 6) return c + 10; | 51 if (static_cast<unsigned>(c) <= 5) return c + 10; |
52 return -1; | 52 return -1; |
53 } | 53 } |
54 | 54 |
55 // ---------------------------------------------------------------------------- | 55 // ---------------------------------------------------------------------------- |
56 // UTF16Buffer - scanner input source with pushback. | 56 // UTF16Buffer - scanner input source with pushback. |
57 | 57 |
58 class UTF16Buffer { | 58 class UTF16Buffer { |
59 public: | 59 public: |
60 UTF16Buffer(); | 60 UTF16Buffer(); |
61 virtual ~UTF16Buffer() {} | 61 virtual ~UTF16Buffer() {} |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 // keyword with the current prefix). | 500 // keyword with the current prefix). |
501 const char* keyword_; | 501 const char* keyword_; |
502 int counter_; | 502 int counter_; |
503 Token::Value keyword_token_; | 503 Token::Value keyword_token_; |
504 }; | 504 }; |
505 | 505 |
506 | 506 |
507 } } // namespace v8::internal | 507 } } // namespace v8::internal |
508 | 508 |
509 #endif // V8_SCANNER_BASE_H_ | 509 #endif // V8_SCANNER_BASE_H_ |
OLD | NEW |