antlr3bitset.c File Reference


Detailed Description

Contains the C implementation of ANTLR3 bitsets as adapted from Terence Parr's Java implementation.

#include <antlr3bitset.h>

Include dependency graph for antlr3bitset.c:


Functions

static void antlr3BitsetAdd (pANTLR3_BITSET bitset, ANTLR3_INT32 bit)
static pANTLR3_BITSET antlr3BitsetClone (pANTLR3_BITSET inSet)
ANTLR3_API pANTLR3_BITSET antlr3BitsetCopy (pANTLR3_BITSET_LIST blist)
static ANTLR3_BOOLEAN antlr3BitsetEquals (pANTLR3_BITSET bitset1, pANTLR3_BITSET bitset2)
static void antlr3BitsetFree (pANTLR3_BITSET bitset)
static ANTLR3_BOOLEAN antlr3BitsetIsNil (pANTLR3_BITSET bitset)
ANTLR3_API pANTLR3_BITSET antlr3BitsetList (pANTLR3_HASH_TABLE list)
ANTLR3_API pANTLR3_BITSET antlr3BitsetLoad (pANTLR3_BITSET_LIST inBits)
 Creates a new bitset with at least one 64 bit bset of bits, but as many 64 bit sets as are required.
static ANTLR3_BOOLEAN antlr3BitsetMember (pANTLR3_BITSET bitset, ANTLR3_UINT32 bit)
ANTLR3_API pANTLR3_BITSET antlr3BitsetNew (ANTLR3_UINT32 numBits)
static ANTLR3_UINT32 antlr3BitsetNumBits (pANTLR3_BITSET bitset)
ANTLR3_API pANTLR3_BITSET antlr3BitsetOf (ANTLR3_INT32 bit,...)
 Creates a new bitset with at least one element, but as many elements are required.
static pANTLR3_BITSET antlr3BitsetOR (pANTLR3_BITSET bitset1, pANTLR3_BITSET bitset2)
static void antlr3BitsetORInPlace (pANTLR3_BITSET bitset, pANTLR3_BITSET bitset2)
static void antlr3BitsetRemove (pANTLR3_BITSET bitset, ANTLR3_UINT32 bit)
ANTLR3_API void antlr3BitsetSetAPI (pANTLR3_BITSET bitset)
static ANTLR3_UINT32 antlr3BitsetSize (pANTLR3_BITSET bitset)
static pANTLR3_INT32 antlr3BitsetToIntList (pANTLR3_BITSET bitset)
 Produce an integer list of all the bits that are turned on in this bitset.
static ANTLR3_UINT64 bitMask (ANTLR3_UINT32 bitNumber)
static void grow (pANTLR3_BITSET bitset, ANTLR3_INT32 newSize)
static void growToInclude (pANTLR3_BITSET bitset, ANTLR3_INT32 bit)
static ANTLR3_UINT32 numWordsToHold (ANTLR3_UINT32 bit)
static ANTLR3_UINT32 wordNumber (ANTLR3_UINT32 bit)

Function Documentation

static void antlr3BitsetAdd ( pANTLR3_BITSET  bitset,
ANTLR3_INT32  bit 
) [static]

References bitMask, ANTLR3_BITSET_LIST_struct::bits, ANTLR3_BITSET_struct::blist, growToInclude(), ANTLR3_BITSET_LIST_struct::length, and wordNumber().

Referenced by antlr3BitsetOf(), and antlr3BitsetSetAPI().

Here is the call graph for this function:

Here is the caller graph for this function:

static pANTLR3_BITSET antlr3BitsetClone ( pANTLR3_BITSET  inSet  )  [static]

References ANTLR3_BITSET_BITS, ANTLR3_MEMCPY, antlr3BitsetNew(), ANTLR3_BITSET_LIST_struct::bits, ANTLR3_BITSET_struct::blist, and ANTLR3_BITSET_LIST_struct::length.

Referenced by antlr3BitsetOR(), and antlr3BitsetSetAPI().

Here is the call graph for this function:

Here is the caller graph for this function:

ANTLR3_API pANTLR3_BITSET antlr3BitsetCopy ( pANTLR3_BITSET_LIST  blist  ) 

static ANTLR3_BOOLEAN antlr3BitsetEquals ( pANTLR3_BITSET  bitset1,
pANTLR3_BITSET  bitset2 
) [static]

static void antlr3BitsetFree ( pANTLR3_BITSET  bitset  )  [static]

References ANTLR3_FREE, ANTLR3_BITSET_LIST_struct::bits, and ANTLR3_BITSET_struct::blist.

Referenced by antlr3BitsetSetAPI().

Here is the caller graph for this function:

static ANTLR3_BOOLEAN antlr3BitsetIsNil ( pANTLR3_BITSET  bitset  )  [static]

ANTLR3_API pANTLR3_BITSET antlr3BitsetList ( pANTLR3_HASH_TABLE  list  ) 

References ANTLR3_BITSET_struct::add, ANTLR3_SUCCESS, antlr3BitsetNew(), antlr3EnumNew(), ANTLR3_HASH_ENUM_struct::free, and ANTLR3_HASH_ENUM_struct::next.

Referenced by getTokensList().

Here is the call graph for this function:

Here is the caller graph for this function:

ANTLR3_API pANTLR3_BITSET antlr3BitsetLoad ( pANTLR3_BITSET_LIST  inBits  ) 

Creates a new bitset with at least one 64 bit bset of bits, but as many 64 bit sets as are required.

Parameters:
[in] bset A variable number of bits to add to the set, ending in -1 (impossible bit).
Returns:
A new bit set with all of the specified bitmaps in it and the API initialized.
Call as:
  • pANTLR3_BITSET = antlrBitsetLoad(bset, bset11, ..., -1);
  • pANTLR3_BITSET = antlrBitsetOf(-1); Create empty bitset

Remarks:
Stdargs function - must supply -1 as last paremeter, which is NOT added to the set.

References antlr3BitsetNew(), ANTLR3_BITSET_LIST_struct::bits, ANTLR3_BITSET_struct::blist, ANTLR3_BITSET_struct::grow, and ANTLR3_BITSET_LIST_struct::length.

Referenced by combineFollows(), displayRecognitionError(), mismatchIsMissingToken(), and recoverFromMismatchedElement().

Here is the call graph for this function:

Here is the caller graph for this function:

static ANTLR3_BOOLEAN antlr3BitsetMember ( pANTLR3_BITSET  bitset,
ANTLR3_UINT32  bit 
) [static]

References ANTLR3_FALSE, ANTLR3_TRUE, bitMask, ANTLR3_BITSET_LIST_struct::bits, ANTLR3_BITSET_struct::blist, ANTLR3_BITSET_LIST_struct::length, and wordNumber().

Referenced by antlr3BitsetSetAPI().

Here is the call graph for this function:

Here is the caller graph for this function:

ANTLR3_API pANTLR3_BITSET antlr3BitsetNew ( ANTLR3_UINT32  numBits  ) 

static ANTLR3_UINT32 antlr3BitsetNumBits ( pANTLR3_BITSET  bitset  )  [static]

References ANTLR3_BITSET_LOG_BITS, ANTLR3_BITSET_struct::blist, and ANTLR3_BITSET_LIST_struct::length.

Referenced by antlr3BitsetSetAPI().

Here is the caller graph for this function:

ANTLR3_API pANTLR3_BITSET antlr3BitsetOf ( ANTLR3_INT32  bit,
  ... 
)

Creates a new bitset with at least one element, but as many elements are required.

Parameters:
[in] bit A variable number of bits to add to the set, ending in -1 (impossible bit).
Returns:
A new bit set with all of the specified elements added into it.
Call as:
  • pANTLR3_BITSET = antlrBitsetOf(n, n1, n2, -1);
  • pANTLR3_BITSET = antlrBitsetOf(-1); Create empty bitset

Remarks:
Stdargs function - must supply -1 as last paremeter, which is NOT added to the set.

References antlr3BitsetAdd(), and antlr3BitsetNew().

Referenced by getTokensType().

Here is the call graph for this function:

Here is the caller graph for this function:

static pANTLR3_BITSET antlr3BitsetOR ( pANTLR3_BITSET  bitset1,
pANTLR3_BITSET  bitset2 
) [static]

References antlr3BitsetClone(), and antlr3BitsetORInPlace().

Referenced by antlr3BitsetSetAPI().

Here is the call graph for this function:

Here is the caller graph for this function:

static void antlr3BitsetORInPlace ( pANTLR3_BITSET  bitset,
pANTLR3_BITSET  bitset2 
) [static]

References ANTLR3_BITSET_LIST_struct::bits, ANTLR3_BITSET_struct::blist, growToInclude(), and ANTLR3_BITSET_LIST_struct::length.

Referenced by antlr3BitsetOR(), and antlr3BitsetSetAPI().

Here is the call graph for this function:

Here is the caller graph for this function:

static void antlr3BitsetRemove ( pANTLR3_BITSET  bitset,
ANTLR3_UINT32  bit 
) [static]

References bitMask, ANTLR3_BITSET_LIST_struct::bits, ANTLR3_BITSET_struct::blist, and wordNumber().

Referenced by antlr3BitsetSetAPI().

Here is the call graph for this function:

Here is the caller graph for this function:

ANTLR3_API void antlr3BitsetSetAPI ( pANTLR3_BITSET  bitset  ) 

static ANTLR3_UINT32 antlr3BitsetSize ( pANTLR3_BITSET  bitset  )  [static]

static pANTLR3_INT32 antlr3BitsetToIntList ( pANTLR3_BITSET  bitset  )  [static]

Produce an integer list of all the bits that are turned on in this bitset.

Used for error processing in the main as the bitset reresents a number of integer tokens which we use for follow sets and so on.

The first entry is the number of elements following in the list.

References ANTLR3_MALLOC, ANTLR3_TRUE, ANTLR3_BITSET_struct::isMember, ANTLR3_BITSET_struct::numBits, and ANTLR3_BITSET_struct::size.

Referenced by antlr3BitsetSetAPI().

Here is the caller graph for this function:

static ANTLR3_UINT64 bitMask ( ANTLR3_UINT32  bitNumber  )  [static]

static void grow ( pANTLR3_BITSET  bitset,
ANTLR3_INT32  newSize 
) [static]

static void growToInclude ( pANTLR3_BITSET  bitset,
ANTLR3_INT32  bit 
) [static]

References ANTLR3_BITSET_struct::blist, ANTLR3_BITSET_struct::grow, ANTLR3_BITSET_LIST_struct::length, and numWordsToHold().

Referenced by antlr3BitsetAdd(), and antlr3BitsetORInPlace().

Here is the call graph for this function:

Here is the caller graph for this function:

static ANTLR3_UINT32 numWordsToHold ( ANTLR3_UINT32  bit  )  [static]

References ANTLR3_BITSET_LOG_BITS.

Referenced by growToInclude().

Here is the caller graph for this function:

static ANTLR3_UINT32 wordNumber ( ANTLR3_UINT32  bit  )  [static]

References ANTLR3_BITSET_LOG_BITS.

Referenced by antlr3BitsetAdd(), antlr3BitsetMember(), and antlr3BitsetRemove().

Here is the caller graph for this function:


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