V8 Project
v8::internal::Utf16CharacterStream Class Referenceabstract

#include <scanner.h>

+ Inheritance diagram for v8::internal::Utf16CharacterStream:
+ Collaboration diagram for v8::internal::Utf16CharacterStream:

Public Member Functions

 Utf16CharacterStream ()
 
virtual ~Utf16CharacterStream ()
 
uc32 Advance ()
 
unsigned pos () const
 
unsigned SeekForward (unsigned code_unit_count)
 
virtual void PushBack (int32_t code_unit)=0
 

Protected Member Functions

virtual bool ReadBlock ()=0
 
virtual unsigned SlowSeekForward (unsigned code_unit_count)=0
 

Protected Attributes

const uint16_t * buffer_cursor_
 
const uint16_t * buffer_end_
 
unsigned pos_
 

Static Protected Attributes

static const uc32 kEndOfInput = -1
 

Detailed Description

Definition at line 45 of file scanner.h.

Constructor & Destructor Documentation

◆ Utf16CharacterStream()

v8::internal::Utf16CharacterStream::Utf16CharacterStream ( )
inline

Definition at line 47 of file scanner.h.

47 : pos_(0) { }

◆ ~Utf16CharacterStream()

virtual v8::internal::Utf16CharacterStream::~Utf16CharacterStream ( )
inlinevirtual

Definition at line 48 of file scanner.h.

48 { }

Member Function Documentation

◆ Advance()

uc32 v8::internal::Utf16CharacterStream::Advance ( )
inline

Definition at line 53 of file scanner.h.

53  {
55  pos_++;
56  return static_cast<uc32>(*(buffer_cursor_++));
57  }
58  // Note: currently the following increment is necessary to avoid a
59  // parser problem! The scanner treats the final kEndOfInput as
60  // a code unit with a position, and does math relative to that
61  // position.
62  pos_++;
63 
64  return kEndOfInput;
65  }
const uint16_t * buffer_end_
Definition: scanner.h:103
static const uc32 kEndOfInput
Definition: scanner.h:93
const uint16_t * buffer_cursor_
Definition: scanner.h:102
int32_t uc32
Definition: globals.h:185

References buffer_cursor_, buffer_end_, kEndOfInput, pos_, and ReadBlock().

Referenced by v8::internal::Scanner::Advance().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pos()

unsigned v8::internal::Utf16CharacterStream::pos ( ) const
inline

Definition at line 69 of file scanner.h.

69 { return pos_; }

References pos_.

Referenced by v8::internal::Scanner::SeekForward(), and v8::internal::Scanner::source_pos().

+ Here is the caller graph for this function:

◆ PushBack()

virtual void v8::internal::Utf16CharacterStream::PushBack ( int32_t  code_unit)
pure virtual

Implemented in v8::internal::ExternalTwoByteStringUtf16CharacterStream, and v8::internal::BufferedUtf16CharacterStream.

Referenced by v8::internal::Scanner::PushBack().

+ Here is the caller graph for this function:

◆ ReadBlock()

virtual bool v8::internal::Utf16CharacterStream::ReadBlock ( )
protectedpure virtual

Implemented in v8::internal::ExternalTwoByteStringUtf16CharacterStream, and v8::internal::BufferedUtf16CharacterStream.

Referenced by Advance().

+ Here is the caller graph for this function:

◆ SeekForward()

unsigned v8::internal::Utf16CharacterStream::SeekForward ( unsigned  code_unit_count)
inline

Definition at line 75 of file scanner.h.

75  {
76  unsigned buffered_chars =
77  static_cast<unsigned>(buffer_end_ - buffer_cursor_);
78  if (code_unit_count <= buffered_chars) {
79  buffer_cursor_ += code_unit_count;
80  pos_ += code_unit_count;
81  return code_unit_count;
82  }
83  return SlowSeekForward(code_unit_count);
84  }
virtual unsigned SlowSeekForward(unsigned code_unit_count)=0

References buffer_cursor_, buffer_end_, pos_, and SlowSeekForward().

Referenced by v8::internal::Scanner::SeekForward().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SlowSeekForward()

virtual unsigned v8::internal::Utf16CharacterStream::SlowSeekForward ( unsigned  code_unit_count)
protectedpure virtual

Implemented in v8::internal::ExternalTwoByteStringUtf16CharacterStream, and v8::internal::BufferedUtf16CharacterStream.

Referenced by SeekForward().

+ Here is the caller graph for this function:

Member Data Documentation

◆ buffer_cursor_

◆ buffer_end_

◆ kEndOfInput

const uc32 v8::internal::Utf16CharacterStream::kEndOfInput = -1
staticprotected

Definition at line 93 of file scanner.h.

Referenced by Advance(), and v8::internal::BufferedUtf16CharacterStream::PushBack().

◆ pos_


The documentation for this class was generated from the following file: