OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 parser; | |
6 | |
7 /** | 5 /** |
8 * Scanner that reads from a byte array and creates tokens that points | 6 * Scanner that reads from a byte array and creates tokens that points |
9 * to the same array. | 7 * to the same array. |
10 */ | 8 */ |
11 class ByteArrayScanner extends ArrayBasedScanner<ByteString> { | 9 class ByteArrayScanner extends ArrayBasedScanner<ByteString> { |
12 final List<int> bytes; | 10 final List<int> bytes; |
13 | 11 |
14 ByteArrayScanner(List<int> this.bytes, [bool includeComments = false]) | 12 ByteArrayScanner(List<int> this.bytes, [bool includeComments = false]) |
15 : super(includeComments); | 13 : super(includeComments); |
16 | 14 |
(...skipping 14 matching lines...) Expand all Loading... |
31 void appendByteStringToken(PrecedenceInfo info, ByteString value) { | 29 void appendByteStringToken(PrecedenceInfo info, ByteString value) { |
32 tail.next = new ByteStringToken(info, value, tokenStart); | 30 tail.next = new ByteStringToken(info, value, tokenStart); |
33 tail = tail.next; | 31 tail = tail.next; |
34 } | 32 } |
35 | 33 |
36 // This method should be equivalent to the one in super. However, | 34 // This method should be equivalent to the one in super. However, |
37 // this is a *HOT* method and Dart VM performs better if it is easy | 35 // this is a *HOT* method and Dart VM performs better if it is easy |
38 // to inline. | 36 // to inline. |
39 int advance() => bytes[++byteOffset]; | 37 int advance() => bytes[++byteOffset]; |
40 } | 38 } |
OLD | NEW |