blob: ac81613ab7d49a349f34de712aa0ca76e164243c [file] [log] [blame]
Ben Murdoch014dc512016-03-22 12:00:34 +00001// Copyright 2011 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_PARSING_SCANNER_CHARACTER_STREAMS_H_
6#define V8_PARSING_SCANNER_CHARACTER_STREAMS_H_
7
Ben Murdochf3b273f2017-01-17 12:11:28 +00008#include "include/v8.h" // for v8::ScriptCompiler
Ben Murdoch014dc512016-03-22 12:00:34 +00009#include "src/handles.h"
Ben Murdoch014dc512016-03-22 12:00:34 +000010
11namespace v8 {
12namespace internal {
13
Ben Murdochf3b273f2017-01-17 12:11:28 +000014class Utf16CharacterStream;
Ben Murdoch014dc512016-03-22 12:00:34 +000015
Ben Murdochf3b273f2017-01-17 12:11:28 +000016class ScannerStream {
Ben Murdoch014dc512016-03-22 12:00:34 +000017 public:
Ben Murdochf3b273f2017-01-17 12:11:28 +000018 static Utf16CharacterStream* For(Handle<String> data);
19 static Utf16CharacterStream* For(Handle<String> data, int start_pos,
20 int end_pos);
21 static Utf16CharacterStream* For(
22 ScriptCompiler::ExternalSourceStream* source_stream,
23 ScriptCompiler::StreamedSource::Encoding encoding);
Ben Murdochf91f0612016-11-29 16:50:11 +000024
25 // For testing:
Ben Murdochf3b273f2017-01-17 12:11:28 +000026 static std::unique_ptr<Utf16CharacterStream> ForTesting(const char* data);
27 static std::unique_ptr<Utf16CharacterStream> ForTesting(const char* data,
28 size_t length);
Ben Murdoch014dc512016-03-22 12:00:34 +000029};
30
31} // namespace internal
32} // namespace v8
33
34#endif // V8_PARSING_SCANNER_CHARACTER_STREAMS_H_