scanner-character-streams.h 1.38 KB
Newer Older
1
// Copyright 2011 the V8 project authors. All rights reserved.
2 3
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
4

5 6
#ifndef V8_PARSING_SCANNER_CHARACTER_STREAMS_H_
#define V8_PARSING_SCANNER_CHARACTER_STREAMS_H_
7

8 9
#include <memory>

10
#include "include/v8-script.h"  // for v8::ScriptCompiler
11
#include "src/common/globals.h"
12 13 14 15

namespace v8 {
namespace internal {

marja's avatar
marja committed
16 17
template <typename T>
class Handle;
18
class Utf16CharacterStream;
19
class RuntimeCallStats;
marja's avatar
marja committed
20
class String;
21

22
class V8_EXPORT_PRIVATE ScannerStream {
23
 public:
24 25 26 27 28
  static Utf16CharacterStream* For(Isolate* isolate, Handle<String> data);
  static Utf16CharacterStream* For(Isolate* isolate, Handle<String> data,
                                   int start_pos, int end_pos);
  static Utf16CharacterStream* For(
      ScriptCompiler::ExternalSourceStream* source_stream,
29
      ScriptCompiler::StreamedSource::Encoding encoding);
30 31 32 33

  static std::unique_ptr<Utf16CharacterStream> ForTesting(const char* data);
  static std::unique_ptr<Utf16CharacterStream> ForTesting(const char* data,
                                                          size_t length);
34 35
  static std::unique_ptr<Utf16CharacterStream> ForTesting(const uint16_t* data,
                                                          size_t length);
36 37
};

38 39
}  // namespace internal
}  // namespace v8
40

41
#endif  // V8_PARSING_SCANNER_CHARACTER_STREAMS_H_