antlr3cyclicdfa.c man page

src/antlr3cyclicdfa.c —

Synopsis

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

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)

From the input stream, predict what alternative will succeed using this DFA (representing the covering regular approximation to the underlying CFL). Return an alternative number 1..n. Throw an exception upon error.

References ANTLR3_INT_STREAM_struct::_LA, ANTLR3_CYCLIC_DFA_struct::accept, ANTLR3_API, ANTLR3_TOKEN_EOF, ANTLR3_TRUE, ANTLR3_INT_STREAM_struct::consume, ANTLR3_CYCLIC_DFA_struct::eof, ANTLR3_CYCLIC_DFA_struct::eot, ANTLR3_RECOGNIZER_SHARED_STATE_struct::error, mark(), ANTLR3_INT_STREAM_struct::mark, ANTLR3_CYCLIC_DFA_struct::min, noViableAlt(), ANTLR3_INT_STREAM_struct::rewind, ANTLR3_CYCLIC_DFA_struct::special, ANTLR3_CYCLIC_DFA_struct::specialStateTransition, ANTLR3_BASE_RECOGNIZER_struct::state, and ANTLR3_CYCLIC_DFA_struct::transition.

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.

References ANTLR3_API.

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_API, 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_BASE_RECOGNIZER_struct::state, ANTLR3_EXCEPTION_struct::state, and ANTLR3_EXCEPTION_struct::type.

Referenced by antlr3dfapredict().

Author

Generated automatically by Doxygen for ANTLR3C from the source code.

Referenced By

antlr3-noViableAlt(3) is an alias of antlr3cyclicdfa.c(3).

Tue Oct 4 2016 Version 3.3.1 ANTLR3C