OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // Using zero allows the usage of strlen and similar functions on | 70 // Using zero allows the usage of strlen and similar functions on |
71 // identifiers and numbers (but not strings, since they may contain zero | 71 // identifiers and numbers (but not strings, since they may contain zero |
72 // bytes). | 72 // bytes). |
73 // TODO(lrn): Use '\xff' as end marker, since it cannot occur inside | 73 // TODO(lrn): Use '\xff' as end marker, since it cannot occur inside |
74 // an utf-8 string. This requires changes in all places that uses | 74 // an utf-8 string. This requires changes in all places that uses |
75 // str-functions on the literals, but allows a single pointer to represent | 75 // str-functions on the literals, but allows a single pointer to represent |
76 // the literal, even if it contains embedded zeros. | 76 // the literal, even if it contains embedded zeros. |
77 static const char kEndMarker = '\x00'; | 77 static const char kEndMarker = '\x00'; |
78 private: | 78 private: |
79 static const int kInitialCapacity = 256; | 79 static const int kInitialCapacity = 256; |
80 SequenceCollector<char> buffer_; | 80 SequenceCollector<char, 4> buffer_; |
81 | 81 |
82 void AddCharSlow(uc32 c); | 82 void AddCharSlow(uc32 c); |
83 }; | 83 }; |
84 | 84 |
85 | 85 |
86 // Interface through which the scanner reads characters from the input source. | 86 // Interface through which the scanner reads characters from the input source. |
87 class UTF16Buffer { | 87 class UTF16Buffer { |
88 public: | 88 public: |
89 UTF16Buffer(); | 89 UTF16Buffer(); |
90 virtual ~UTF16Buffer() {} | 90 virtual ~UTF16Buffer() {} |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 bool stack_overflow_; | 512 bool stack_overflow_; |
513 static StaticResource<Utf8Decoder> utf8_decoder_; | 513 static StaticResource<Utf8Decoder> utf8_decoder_; |
514 | 514 |
515 // One Unicode character look-ahead; c0_ < 0 at the end of the input. | 515 // One Unicode character look-ahead; c0_ < 0 at the end of the input. |
516 uc32 c0_; | 516 uc32 c0_; |
517 }; | 517 }; |
518 | 518 |
519 } } // namespace v8::internal | 519 } } // namespace v8::internal |
520 | 520 |
521 #endif // V8_SCANNER_H_ | 521 #endif // V8_SCANNER_H_ |
OLD | NEW |