antlr3cyclicdfa.c File Reference

#include <antlr3defs.h>
#include <antlr3cyclicdfa.h>

Include dependency graph for antlr3cyclicdfa.c:


Functions

ANTLR3_API ANTLR3_INT32 antlr3dfapredict (void *ctx, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_INT_STREAM is, pANTLR3_CYCLIC_DFA cdfa)
 From the input stream, predict what alternative will succeed using this DFA (representing the covering regular approximation to the underlying CFL).
ANTLR3_API ANTLR3_INT32 antlr3dfaspecialStateTransition (void *ctx, pANTLR3_BASE_RECOGNIZER recognizer, pANTLR3_INT_STREAM is, pANTLR3_CYCLIC_DFA dfa, ANTLR3_INT32 s)
 Default special state implementation.
ANTLR3_API ANTLR3_INT32 antlr3dfaspecialTransition (void *ctx, pANTLR3_BASE_RECOGNIZER recognizer, pANTLR3_INT_STREAM is, pANTLR3_CYCLIC_DFA dfa, ANTLR3_INT32 s)
static void noViableAlt (pANTLR3_BASE_RECOGNIZER rec, pANTLR3_CYCLIC_DFA cdfa, ANTLR3_UINT32 s)
 Support functions for traversing cyclic DFA states as laid out in static initialized structures by the code generator.

Function Documentation

ANTLR3_API ANTLR3_INT32 antlr3dfapredict ( void *  ctx,
pANTLR3_BASE_RECOGNIZER  rec,
pANTLR3_INT_STREAM  is,
pANTLR3_CYCLIC_DFA  cdfa 
)

ANTLR3_API ANTLR3_INT32 antlr3dfaspecialStateTransition ( void *  ctx,
pANTLR3_BASE_RECOGNIZER  recognizer,
pANTLR3_INT_STREAM  is,
pANTLR3_CYCLIC_DFA  dfa,
ANTLR3_INT32  s 
)

Default special state implementation.

ANTLR3_API ANTLR3_INT32 antlr3dfaspecialTransition ( void *  ctx,
pANTLR3_BASE_RECOGNIZER  recognizer,
pANTLR3_INT_STREAM  is,
pANTLR3_CYCLIC_DFA  dfa,
ANTLR3_INT32  s 
)

static void noViableAlt ( pANTLR3_BASE_RECOGNIZER  rec,
pANTLR3_CYCLIC_DFA  cdfa,
ANTLR3_UINT32  s 
) [static]

Support functions for traversing cyclic DFA states as laid out in static initialized structures by the code generator.

A DFA implemented as a set of transition tables.

Any state that has a semantic predicate edge is special; those states are generated with if-then-else structures in a ->specialStateTransition() which is generated by cyclicDFA template.

There are at most 32767 states (16-bit signed short). Could get away with byte sometimes but would have to generate different types and the simulation code too. For a point of reference, the Java lexer's Tokens rule DFA has 326 states roughly.

References ANTLR3_NO_VIABLE_ALT_EXCEPTION, ANTLR3_TRUE, ANTLR3_RECOGNIZER_SHARED_STATE_struct::backtracking, ANTLR3_EXCEPTION_struct::decisionNum, ANTLR3_CYCLIC_DFA_struct::decisionNumber, ANTLR3_CYCLIC_DFA_struct::description, ANTLR3_RECOGNIZER_SHARED_STATE_struct::exception, ANTLR3_BASE_RECOGNIZER_struct::exConstruct, ANTLR3_RECOGNIZER_SHARED_STATE_struct::failed, ANTLR3_EXCEPTION_struct::message, ANTLR3_EXCEPTION_struct::state, ANTLR3_BASE_RECOGNIZER_struct::state, and ANTLR3_EXCEPTION_struct::type.

Referenced by antlr3dfapredict().

Here is the caller graph for this function:


Generated on Mon Nov 29 17:23:37 2010 for ANTLR3C by  doxygen 1.5.5