Functions

antlr3ucs2inputstream.c File Reference

Base functions to initialize and manipulate a UCS2 input stream. More...

#include <antlr3input.h>
Include dependency graph for antlr3ucs2inputstream.c:

Functions

static void antlr3UCS2Consume (pANTLR3_INT_STREAM is)
 Consume the next character in an 8 bit ASCII input stream.
static ANTLR3_MARKER antlr3UCS2Index (pANTLR3_INT_STREAM is)
 Calculate the current index in the output stream.
static ANTLR3_UCHAR antlr3UCS2LA (pANTLR3_INT_STREAM is, ANTLR3_INT32 la)
 Return the input element assuming an 8 bit ascii input.
static void antlr3UCS2Seek (pANTLR3_INT_STREAM is, ANTLR3_MARKER seekPoint)
 Rewind the lexer input to the state specified by the supplied mark.
void antlr3UCS2SetupStream (pANTLR3_INPUT_STREAM input, ANTLR3_UINT32 type)
 Common function to setup function interface for a 16 bit "UCS2" input stream.
static pANTLR3_STRING antlr3UCS2Substr (pANTLR3_INPUT_STREAM input, ANTLR3_MARKER start, ANTLR3_MARKER stop)
 Return a substring of the ucs2 (16 bit) input stream in newly allocated memory.

Detailed Description

Base functions to initialize and manipulate a UCS2 input stream.


Function Documentation

static void antlr3UCS2Consume ( pANTLR3_INT_STREAM  is  )  [static]
static ANTLR3_MARKER antlr3UCS2Index ( pANTLR3_INT_STREAM  is  )  [static]

Calculate the current index in the output stream.

Parameters:
[in] input Input stream context pointer

References ANTLR3_INPUT_STREAM_struct::nextChar, and ANTLR3_INT_STREAM_struct::super.

static ANTLR3_UCHAR antlr3UCS2LA ( pANTLR3_INT_STREAM  is,
ANTLR3_INT32  la 
) [static]

Return the input element assuming an 8 bit ascii input.

Parameters:
[in] input Input stream context pointer
[in] la 1 based offset of next input stream element
Returns:
Next input character in internal ANTLR3 encoding (UTF32)

References ANTLR3_INPUT_STREAM_struct::data, ANTLR3_INPUT_STREAM_struct::nextChar, ANTLR3_INPUT_STREAM_struct::sizeBuf, and ANTLR3_INT_STREAM_struct::super.

static void antlr3UCS2Seek ( pANTLR3_INT_STREAM  is,
ANTLR3_MARKER  seekPoint 
) [static]

Rewind the lexer input to the state specified by the supplied mark.

Parameters:
[in] input Input stream context pointer
Remarks:
Assumes ASCII (or at least, 8 Bit) input stream.

References ANTLR3_INT_STREAM_struct::consume, ANTLR3_INPUT_STREAM_struct::nextChar, and ANTLR3_INT_STREAM_struct::super.

void antlr3UCS2SetupStream ( pANTLR3_INPUT_STREAM  input,
ANTLR3_UINT32  type 
)

Common function to setup function interface for a 16 bit "UCS2" input stream.

Parameters:
input Input stream context pointer
Remarks:
  • Strictly speaking, there is no such thing as a UCS2 input stream as the term tends to confuse the notions of character encoding, unicode and so on. However because there will possibly be a need for a UTF-16 stream, I needed to identify 16 bit streams that do not support surrogate encodings and UCS2 is how it is mostly referred to. For instance Java, Oracle and others use a 16 bit encoding of characters and so this type of stream is very common. Take it to mean, therefore, a straight 16 bit uncomplicated encoding of Unicode code points.

References ANTLR3_INT_STREAM_struct::_LA, antlr3GenericSetupStream(), antlr3UCS2StringFactoryNew(), ANTLR3_INPUT_STREAM_struct::charByteSize, ANTLR3_INT_STREAM_struct::consume, ANTLR3_INT_STREAM_struct::index, ANTLR3_INPUT_STREAM_struct::istream, ANTLR3_INT_STREAM_struct::seek, ANTLR3_INPUT_STREAM_struct::strFactory, and ANTLR3_INPUT_STREAM_struct::substr.

Referenced by antlr3NewUCS2StringInPlaceStream().

Here is the call graph for this function:

Here is the caller graph for this function:

static pANTLR3_STRING antlr3UCS2Substr ( pANTLR3_INPUT_STREAM  input,
ANTLR3_MARKER  start,
ANTLR3_MARKER  stop 
) [static]

Return a substring of the ucs2 (16 bit) input stream in newly allocated memory.

Parameters:
input Input stream context pointer
start Offset in input stream where the string starts
stop Offset in the input stream where the string ends.

References ANTLR3_UINT32_CAST, ANTLR3_STRING_FACTORY_struct::newPtr, and ANTLR3_INPUT_STREAM_struct::strFactory.