OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of dart.core; | 5 part of dart.core; |
6 | 6 |
7 // Frequently used character codes. | 7 // Frequently used character codes. |
8 const int _SPACE = 0x20; | 8 const int _SPACE = 0x20; |
9 const int _PERCENT = 0x25; | 9 const int _PERCENT = 0x25; |
10 const int _AMPERSAND = 0x26; | 10 const int _AMPERSAND = 0x26; |
(...skipping 4088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4099 setChars(b, "+-.", scheme); | 4099 setChars(b, "+-.", scheme); |
4100 | 4100 |
4101 return tables; | 4101 return tables; |
4102 } | 4102 } |
4103 | 4103 |
4104 // -------------------------------------------------------------------- | 4104 // -------------------------------------------------------------------- |
4105 // Code that uses the URI scanner table. | 4105 // Code that uses the URI scanner table. |
4106 | 4106 |
4107 /// Scan a string using the [_scannerTables] state machine. | 4107 /// Scan a string using the [_scannerTables] state machine. |
4108 /// | 4108 /// |
4109 /// Scans [uri] from [start] to [end], startig in state [state] and | 4109 /// Scans [uri] from [start] to [end], starting in state [state] and |
4110 /// writing output into [indices]. | 4110 /// writing output into [indices]. |
4111 /// | 4111 /// |
4112 /// Returns the final state. | 4112 /// Returns the final state. |
4113 int _scan(String uri, int start, int end, int state, List<int> indices) { | 4113 int _scan(String uri, int start, int end, int state, List<int> indices) { |
4114 var tables = _scannerTables; | 4114 var tables = _scannerTables; |
4115 assert(end <= uri.length); | 4115 assert(end <= uri.length); |
4116 for (int i = start; i < end; i++) { | 4116 for (int i = start; i < end; i++) { |
4117 var table = tables[state]; | 4117 var table = tables[state]; |
4118 // Xor with 0x60 to move range 0x20-0x7f into 0x00-0x5f | 4118 // Xor with 0x60 to move range 0x20-0x7f into 0x00-0x5f |
4119 int char = uri.codeUnitAt(i) ^ 0x60; | 4119 int char = uri.codeUnitAt(i) ^ 0x60; |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4630 int delta = (text.codeUnitAt(start + 4) ^ _COLON) * 3; | 4630 int delta = (text.codeUnitAt(start + 4) ^ _COLON) * 3; |
4631 delta |= text.codeUnitAt(start) ^ 0x64 /*d*/; | 4631 delta |= text.codeUnitAt(start) ^ 0x64 /*d*/; |
4632 delta |= text.codeUnitAt(start + 1) ^ 0x61 /*a*/; | 4632 delta |= text.codeUnitAt(start + 1) ^ 0x61 /*a*/; |
4633 delta |= text.codeUnitAt(start + 2) ^ 0x74 /*t*/; | 4633 delta |= text.codeUnitAt(start + 2) ^ 0x74 /*t*/; |
4634 delta |= text.codeUnitAt(start + 3) ^ 0x61 /*a*/; | 4634 delta |= text.codeUnitAt(start + 3) ^ 0x61 /*a*/; |
4635 return delta; | 4635 return delta; |
4636 } | 4636 } |
4637 | 4637 |
4638 /// Helper function returning the length of a string, or `0` for `null`. | 4638 /// Helper function returning the length of a string, or `0` for `null`. |
4639 int _stringOrNullLength(String s) => (s == null) ? 0 : s.length; | 4639 int _stringOrNullLength(String s) => (s == null) ? 0 : s.length; |
OLD | NEW |