Functions

antlr3stringstream.c File Reference

Provides implementations of string (or memory) streams as input for ANLTR3 lexers. More...

#include <antlr3.h>
Include dependency graph for antlr3stringstream.c:

Functions

pANTLR3_INPUT_STREAM antlr3NewAsciiStringCopyStream (pANTLR3_UINT8 inString, ANTLR3_UINT32 size, pANTLR3_UINT8 name)
 Create an ASCII string stream as input to ANTLR 3, copying the input string.
ANTLR3_API pANTLR3_INPUT_STREAM antlr3NewAsciiStringInPlaceStream (pANTLR3_UINT8 inString, ANTLR3_UINT32 size, pANTLR3_UINT8 name)
 Create an in-place ASCII string stream as input to ANTLR 3.
ANTLR3_API pANTLR3_INPUT_STREAM antlr3NewUCS2StringInPlaceStream (pANTLR3_UINT16 inString, ANTLR3_UINT32 size, pANTLR3_UINT16 name)
 Create an in-place UCS2 string stream as input to ANTLR 3.

Detailed Description

Provides implementations of string (or memory) streams as input for ANLTR3 lexers.


Function Documentation

pANTLR3_INPUT_STREAM antlr3NewAsciiStringCopyStream ( pANTLR3_UINT8  inString,
ANTLR3_UINT32  size,
pANTLR3_UINT8  name 
)

Create an ASCII string stream as input to ANTLR 3, copying the input string.

This string stream first makes a copy of the string at the supplied pointer

Parameters:
[in]inStringPointer to the string to be copied as the input stream
[in]sizeSize (in 8 bit ASCII characters) of the input string
[in]nameNAme to attach the input stream (can be NULL pointer)
Returns:
  • Pointer to new input stream context upon success
  • One of the ANTLR3_ERR_ defines on error.
Remarks:
  • ANTLR does not alter the input string in any way.
  • String is slightly incorrect in that the passed in pointer can be to any memory in C version of ANTLR3 of course.

References ANTLR3_CHARSTREAM, ANTLR3_MALLOC, ANTLR3_MEMMOVE, ANTLR3_TRUE, antlr3AsciiSetupStream(), ANTLR3_INPUT_STREAM_struct::data, ANTLR3_INPUT_STREAM_struct::fileName, ANTLR3_INPUT_STREAM_struct::isAllocated, ANTLR3_INPUT_STREAM_struct::istream, ANTLR3_STRING_FACTORY_struct::newStr, size(), ANTLR3_INPUT_STREAM_struct::sizeBuf, ANTLR3_INT_STREAM_struct::streamName, and ANTLR3_INPUT_STREAM_struct::strFactory.

Here is the call graph for this function:

ANTLR3_API pANTLR3_INPUT_STREAM antlr3NewAsciiStringInPlaceStream ( pANTLR3_UINT8  inString,
ANTLR3_UINT32  size,
pANTLR3_UINT8  name 
)

Create an in-place ASCII string stream as input to ANTLR 3.

An in-place string steam is the preferred method of supplying strings to ANTLR as input for lexing and compiling. This is because we make no copies of the input string but read from it right where it is.

Parameters:
[in]inStringPointer to the string to be used as the input stream
[in]sizeSize (in 8 bit ASCII characters) of the input string
[in]nameNAme to attach the input stream (can be NULL pointer)
Returns:
  • Pointer to new input stream context upon success
  • One of the ANTLR3_ERR_ defines on error.
Remarks:
  • ANTLR does not alter the input string in any way.
  • String is slightly incorrect in that the passed in pointer can be to any memory in C version of ANTLR3 of course.

References ANTLR3_CHARSTREAM, ANTLR3_FALSE, ANTLR3_MALLOC, antlr3AsciiSetupStream(), ANTLR3_INPUT_STREAM_struct::data, ANTLR3_INPUT_STREAM_struct::fileName, ANTLR3_INPUT_STREAM_struct::isAllocated, ANTLR3_INPUT_STREAM_struct::istream, ANTLR3_STRING_FACTORY_struct::newStr, size(), ANTLR3_INPUT_STREAM_struct::sizeBuf, ANTLR3_INT_STREAM_struct::streamName, and ANTLR3_INPUT_STREAM_struct::strFactory.

Here is the call graph for this function:

ANTLR3_API pANTLR3_INPUT_STREAM antlr3NewUCS2StringInPlaceStream ( pANTLR3_UINT16  inString,
ANTLR3_UINT32  size,
pANTLR3_UINT16  name 
)

Create an in-place UCS2 string stream as input to ANTLR 3.

An in-place string steam is the preferred method of supplying strings to ANTLR as input for lexing and compiling. This is because we make no copies of the input string but read from it right where it is.

Parameters:
[in]inStringPointer to the string to be used as the input stream
[in]sizeSize (in 16 bit ASCII characters) of the input string
[in]nameName to attach the input stream (can be NULL pointer)
Returns:
  • Pointer to new input stream context upon success
  • One of the ANTLR3_ERR_ defines on error.
Remarks:
  • ANTLR does not alter the input string in any way.
  • String is slightly incorrect in that the passed in pointer can be to any memory in C version of ANTLR3 of course.

References ANTLR3_CHARSTREAM, ANTLR3_FALSE, ANTLR3_MALLOC, antlr3UCS2SetupStream(), ANTLR3_INPUT_STREAM_struct::data, ANTLR3_INPUT_STREAM_struct::fileName, ANTLR3_INPUT_STREAM_struct::isAllocated, ANTLR3_INPUT_STREAM_struct::istream, ANTLR3_STRING_FACTORY_struct::newStr, size(), ANTLR3_INPUT_STREAM_struct::sizeBuf, ANTLR3_INT_STREAM_struct::streamName, and ANTLR3_INPUT_STREAM_struct::strFactory.

Here is the call graph for this function: