| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 Advance(); | 90 Advance(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 return x; | 93 return x; |
| 94 } | 94 } |
| 95 | 95 |
| 96 | 96 |
| 97 // Octal escapes of the forms '\0xx' and '\xxx' are not a part of | 97 // Octal escapes of the forms '\0xx' and '\xxx' are not a part of |
| 98 // ECMA-262. Other JS VMs support them. | 98 // ECMA-262. Other JS VMs support them. |
| 99 uc32 Scanner::ScanOctalEscape(uc32 c, int length) { | 99 uc32 Scanner::ScanOctalEscape(uc32 c, int length) { |
| 100 octal_pos_ = source_pos() - 1; // Already advanced | |
| 101 uc32 x = c - '0'; | 100 uc32 x = c - '0'; |
| 102 for (int i = 0; i < length; i++) { | 101 int i = 0; |
| 102 for (; i < length; i++) { |
| 103 int d = c0_ - '0'; | 103 int d = c0_ - '0'; |
| 104 if (d < 0 || d > 7) break; | 104 if (d < 0 || d > 7) break; |
| 105 int nx = x * 8 + d; | 105 int nx = x * 8 + d; |
| 106 if (nx >= 256) break; | 106 if (nx >= 256) break; |
| 107 x = nx; | 107 x = nx; |
| 108 Advance(); | 108 Advance(); |
| 109 } | 109 } |
| 110 // Anything excelt '\0' is an octal escape sequence, illegal in strict mode. |
| 111 // Remember the position of octal escape sequences so that better error |
| 112 // can be reported later (in strict mode). |
| 113 if (c != '0' || i > 0) { |
| 114 octal_pos_ = source_pos() - i - 1; // Already advanced |
| 115 } |
| 110 return x; | 116 return x; |
| 111 } | 117 } |
| 112 | 118 |
| 113 | 119 |
| 114 // ---------------------------------------------------------------------------- | 120 // ---------------------------------------------------------------------------- |
| 115 // JavaScriptScanner | 121 // JavaScriptScanner |
| 116 | 122 |
| 117 JavaScriptScanner::JavaScriptScanner(Isolate* isolate) : Scanner(isolate) {} | 123 JavaScriptScanner::JavaScriptScanner(Isolate* isolate) : Scanner(isolate) {} |
| 118 | 124 |
| 119 | 125 |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 905 if (MatchKeywordStart(input, "with", 1, Token::WITH)) return; | 911 if (MatchKeywordStart(input, "with", 1, Token::WITH)) return; |
| 906 break; | 912 break; |
| 907 case UNMATCHABLE: | 913 case UNMATCHABLE: |
| 908 break; | 914 break; |
| 909 } | 915 } |
| 910 // On fallthrough, it's a failure. | 916 // On fallthrough, it's a failure. |
| 911 state_ = UNMATCHABLE; | 917 state_ = UNMATCHABLE; |
| 912 } | 918 } |
| 913 | 919 |
| 914 } } // namespace v8::internal | 920 } } // namespace v8::internal |
| OLD | NEW |