antlr3intstream.h man page

include/antlr3intstream.h — Defines the the class interface for an antlr3 INTSTREAM.

Synopsis

#include <antlr3defs.h>
#include <antlr3commontoken.h>

Data Structures

struct ANTLR3_INT_STREAM_struct

Macros

#define ANTLR3_CHARSTREAM 0x0001
Type indicator for a character stream.
#define ANTLR3_COMMONTREENODE 0x0004
Type indicator for a common tree node stream.
#define ANTLR3_INPUT_MASK 0x0007
Type mask for input stream so we can switch in the above types.
#define ANTLR3_TOKENSTREAM 0x0002
Type indicator for a Token stream.

Typedefs

typedef struct ANTLR3_INT_STREAM_struct ANTLR3_INT_STREAM

Detailed Description

Defines the the class interface for an antlr3 INTSTREAM.

Certain functionality (such as DFAs for instance) abstract the stream of tokens or characters in to a steam of integers. Hence this structure should be included in any stream that is able to provide the output as a stream of integers (which is anything basically.

There are no specific implementations of the methods in this interface in general. Though for purposes of casting and so on, it may be necesssary to implement a function with the signature in this interface which abstracts the base immplementation. In essence though the base stream provides a pointer to this interface, within which it installs its normal match() functions and so on. Interaces such as DFA are then passed the pANTLR3_INT_STREAM and can treat any input as an int stream.

For instance, a lexer implements a pANTLR3_BASE_RECOGNIZER, within which there is a pANTLR3_INT_STREAM. However, a pANTLR3_INPUT_STREAM also provides a pANTLR3_INT_STREAM, which it has constructed from it's normal interface when it was created. This is then pointed at by the pANTLR_BASE_RECOGNIZER when it is intialized with a pANTLR3_INPUT_STREAM.

Similarly if a pANTLR3_BASE_RECOGNIZER is initialized with a pANTLR3_TOKEN_STREAM, then the pANTLR3_INT_STREAM is taken from the pANTLR3_TOKEN_STREAM.

If a pANTLR3_BASE_RECOGNIZER is initialized with a pANTLR3_TREENODE_STREAM, then guess where the pANTLR3_INT_STREAM comes from?

Note that because the context pointer points to the actual interface structure that is providing the ANTLR3_INT_STREAM it is defined as a (void *) in this interface. There is no direct implementation of an ANTLR3_INT_STREAM (unless someone did not understand what I was doing here =;?P

Macro Definition Documentation

#define ANTLR3_CHARSTREAM 0x0001

Type indicator for a character stream.

Remarks:

if a custom stream is created but it can be treated as a char stream, then you may OR in this value to your type indicator

Referenced by antlr3GenericSetupStream(), and antlr3RecognitionExceptionNew().

#define ANTLR3_COMMONTREENODE 0x0004

Type indicator for a common tree node stream.

Remarks:

if a custom stream is created but it can be treated as a common tree node stream, then you may OR in this value to your type indicator

Referenced by antlr3CommonTreeNodeStreamNew(), antlr3CommonTreeNodeStreamNewStream(), and antlr3RecognitionExceptionNew().

#define ANTLR3_INPUT_MASK 0x0007

Type mask for input stream so we can switch in the above types.

Remarks:

DO NOT USE 0x0000 as a stream type!

Referenced by antlr3RecognitionExceptionNew().

#define ANTLR3_TOKENSTREAM 0x0002

Type indicator for a Token stream.

Remarks:

if a custom stream is created but it can be treated as a token stream, then you may OR in this value to your type indicator

Referenced by antlr3CommonTokenStreamNew(), and antlr3RecognitionExceptionNew().

Typedef Documentation

typedef struct ANTLR3_INT_STREAM_struct

ANTLR3_INT_STREAM"

Author

Generated automatically by Doxygen for ANTLR3C from the source code.

Referenced By

ANTLR3_CHARSTREAM(3), ANTLR3_COMMONTREENODE(3), ANTLR3_INPUT_MASK(3), ANTLR3_INT_STREAM(3) and ANTLR3_TOKENSTREAM(3) are aliases of antlr3intstream.h(3).

Tue Oct 4 2016 Version 3.3.1 ANTLR3C