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 23 matching lines...) Expand all Loading... |
34 #include "char-predicates.h" | 34 #include "char-predicates.h" |
35 #include "checks.h" | 35 #include "checks.h" |
36 #include "globals.h" | 36 #include "globals.h" |
37 #include "token.h" | 37 #include "token.h" |
38 #include "unicode-inl.h" | 38 #include "unicode-inl.h" |
39 #include "utils.h" | 39 #include "utils.h" |
40 | 40 |
41 namespace v8 { | 41 namespace v8 { |
42 namespace internal { | 42 namespace internal { |
43 | 43 |
| 44 |
| 45 // General collection of bit-flags that can be passed to scanners and |
| 46 // parsers to signify their (initial) mode of operation. |
| 47 enum ParsingFlags { |
| 48 kNoParsingFlags = 0, |
| 49 kAllowLazy = 1, |
| 50 kAllowNativesSyntax = 2, |
| 51 kHarmonyScoping = 4 |
| 52 }; |
| 53 |
| 54 |
44 // Returns the value (0 .. 15) of a hexadecimal character c. | 55 // Returns the value (0 .. 15) of a hexadecimal character c. |
45 // If c is not a legal hexadecimal character, returns a value < 0. | 56 // If c is not a legal hexadecimal character, returns a value < 0. |
46 inline int HexValue(uc32 c) { | 57 inline int HexValue(uc32 c) { |
47 c -= '0'; | 58 c -= '0'; |
48 if (static_cast<unsigned>(c) <= 9) return c; | 59 if (static_cast<unsigned>(c) <= 9) return c; |
49 c = (c | 0x20) - ('a' - '0'); // detect 0x11..0x16 and 0x31..0x36. | 60 c = (c | 0x20) - ('a' - '0'); // detect 0x11..0x16 and 0x31..0x36. |
50 if (static_cast<unsigned>(c) <= 5) return c + 10; | 61 if (static_cast<unsigned>(c) <= 5) return c + 10; |
51 return -1; | 62 return -1; |
52 } | 63 } |
53 | 64 |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 // line-terminator after the current token, and before the next. | 566 // line-terminator after the current token, and before the next. |
556 bool has_multiline_comment_before_next_; | 567 bool has_multiline_comment_before_next_; |
557 // Whether we scan 'let' as a keyword for harmony block scoped | 568 // Whether we scan 'let' as a keyword for harmony block scoped |
558 // let bindings. | 569 // let bindings. |
559 bool harmony_scoping_; | 570 bool harmony_scoping_; |
560 }; | 571 }; |
561 | 572 |
562 } } // namespace v8::internal | 573 } } // namespace v8::internal |
563 | 574 |
564 #endif // V8_SCANNER_H_ | 575 #endif // V8_SCANNER_H_ |
OLD | NEW |