include/antlr3collections.h(3)
π include/antlr3collections.h π
okay so bestie, welcome to the ANTLR3C manual, and specifically this absolute icon of a header: include/antlr3collections.h. this is where all the collections live β hash tables, tries, vectors, stacks, lists, topological sorts β the whole data-structure buffet. grab a snack, we're going in π
β¨ NAME β¨
include/antlr3collections.h β the header that holds all your fave ANTLR3 collections, no cap π
πΈ SYNOPSIS πΈ
#include <antlr3defs.h>
#include <antlr3bitset.h>
π¦ Data Structures π¦
okay so here's the whole friend group, struct by struct:
struct ANTLR3_HASH_BUCKET_structβ Internal structure of a hash table bucket, which tracks all keys that hash to the same bucket.struct ANTLR3_HASH_ENTRY_structβ Internal structure representing an element in a hash bucket.struct ANTLR3_HASH_ENUM_structβ Internal structure representing an enumeration of a table.struct ANTLR3_HASH_KEY_structstruct ANTLR3_HASH_TABLE_structβ Structure that tracks a hash table.struct ANTLR3_INT_TRIE_NODE_structβ Structure that defines an element/node in an ANTLR3_INT_TRIE.struct ANTLR3_INT_TRIE_structβ Structure that defines an ANTLR3_INT_TRIE.struct ANTLR3_LIST_structβ Structure that represents a LIST collection.struct ANTLR3_STACK_structβ Structure that represents a Stack collection.struct ANTLR3_TOPO_structβ A topological sort system that given a set of dependencies of a node m on node n, can sort them in dependency order.struct ANTLR3_TRIE_ENTRY_structβ Structure that holds the payload entry in an ANTLR3_INT_TRIE or ANTLR3_STRING_TRIE.struct ANTLR3_VECTOR_ELEMENT_structstruct ANTLR3_VECTOR_FACTORY_structβ Structure that tracks vectors in a vector and auto deletes the vectors in the vector factory when closed.struct ANTLR3_VECTOR_struct
π Macros π
the little constants that keep everything ticking β¨
#define ANTLR3_FACTORY_VPOOL_SIZE 256β Default vector pool size if otherwise unspecified.#define ANTLR3_HASH_TYPE_INT 0β Indicates the hashed file has integer keys.#define ANTLR3_HASH_TYPE_STR 1β Indicates the hashed file has numeric keys.#define ANTLR3_VECTOR_INTERNAL_SIZE 16
π Typedefs π
the glow-up names for all those structs, so you don't have to type _struct every single time (main character energy, honestly):
typedef struct ANTLR3_HASH_BUCKET_struct ANTLR3_HASH_BUCKETβ Internal structure of a hash table bucket, which tracks all keys that hash to the same bucket.typedef struct ANTLR3_HASH_ENTRY_struct ANTLR3_HASH_ENTRYβ Internal structure representing an element in a hash bucket.typedef struct ANTLR3_HASH_ENUM_struct ANTLR3_HASH_ENUMβ Internal structure representing an enumeration of a table.typedef struct ANTLR3_HASH_KEY_struct ANTLR3_HASH_KEYtypedef struct ANTLR3_HASH_TABLE_struct ANTLR3_HASH_TABLEβ Structure that tracks a hash table.typedef struct ANTLR3_INT_TRIE_struct ANTLR3_INT_TRIEβ Structure that defines an ANTLR3_INT_TRIE.typedef struct ANTLR3_INT_TRIE_NODE_struct ANTLR3_INT_TRIE_NODEβ Structure that defines an element/node in an ANTLR3_INT_TRIE.typedef struct ANTLR3_LIST_struct ANTLR3_LISTβ Structure that represents a LIST collection.typedef struct ANTLR3_STACK_struct ANTLR3_STACKβ Structure that represents a Stack collection.typedef struct ANTLR3_TOPO_struct ANTLR3_TOPOβ A topological sort system that given a set of dependencies of a node m on node n, can sort them in dependency order.typedef struct ANTLR3_TRIE_ENTRY_struct ANTLR3_TRIE_ENTRYβ Structure that holds the payload entry in an ANTLR3_INT_TRIE or ANTLR3_STRING_TRIE.typedef struct ANTLR3_VECTOR_struct ANTLR3_VECTORtypedef struct ANTLR3_VECTOR_ELEMENT_struct ANTLR3_VECTOR_ELEMENTtypedef struct ANTLR3_VECTOR_FACTORY_struct ANTLR3_VECTOR_FACTORYβ Structure that tracks vectors in a vector and auto deletes the vectors in the vector factory when closed.typedef struct ANTLR3_HASH_KEY_struct * pANTLR3_HASH_KEYtypedef struct ANTLR3_INT_TRIE_NODE_struct * pANTLR3_INT_TRIE_NODEtypedef struct ANTLR3_TRIE_ENTRY_struct * pANTLR3_TRIE_ENTRYtypedef struct ANTLR3_VECTOR_ELEMENT_struct * pANTLR3_VECTOR_ELEMENT
π₯ Macro Definition Documentation π₯
#define ANTLR3_FACTORY_VPOOL_SIZE 256
Default vector pool size if otherwise unspecified.
Referenced by closeVectorFactory(), newPool(), and newVector().
#define ANTLR3_HASH_TYPE_INT 0
Indicates the hashed file has integer keys.
Referenced by antlr3HashPutI(), and memoize().
#define ANTLR3_HASH_TYPE_STR 1
Indicates the hashed file has numeric keys.
Referenced by antlr3HashFree(), antlr3HashPut(), freeIntNode(), getRuleMemoization(), and intTrieAdd().
#define ANTLR3_VECTOR_INTERNAL_SIZE 16
Referenced by antlr3SetVectorApi(), antlr3VectorFactoryNew(), antlr3VectorFree(), antlr3VectorResize(), closeVectorFactory(), and newVector().
π Typedef Documentation π
typedef struct ANTLR3_HASH_BUCKET_struct ANTLR3_HASH_BUCKET
Internal structure of a hash table bucket, which tracks all keys that hash to the same bucket.
typedef struct ANTLR3_HASH_ENTRY_struct ANTLR3_HASH_ENTRY
Internal structure representing an element in a hash bucket. Stores the original key so that duplicate keys can be rejected if necessary, and contains function can be supported. If the hash key could be unique I would have invented the perfect compression algorithm ;-)
typedef struct ANTLR3_HASH_ENUM_struct ANTLR3_HASH_ENUM
Internal structure representing an enumeration of a table. This is returned by antlr3Enumeration() Allows the programmer to traverse the table in hash order without knowing what is in the actual table.
Note that it is up to the caller to ensure that the table structure does not change in the hash bucket that is currently being enumerated as this structure just tracks the next pointers in the bucket series.
typedef struct ANTLR3_HASH_KEY_struct ANTLR3_HASH_KEY
typedef struct ANTLR3_HASH_TABLE_struct ANTLR3_HASH_TABLE
Structure that tracks a hash table.
typedef struct ANTLR3_INT_TRIE_struct ANTLR3_INT_TRIE
Structure that defines an ANTLR3_INT_TRIE. For this particular implementation, as you might expect, the key is turned into a "string" by looking at bit(key, depth) of the integer key. Using 64 bit keys gives us a depth limit of 64 (or bit 0..63) and potentially a huge trie. This is the algorithm for a Patricia Trie. Note also that this trie [can] accept multiple entries for the same key and is therefore a kind of elastic bucket patricia trie.
If you find this code useful, please feel free to 'steal' it for any purpose as covered by the BSD license under which ANTLR is issued. You can cut the code but as the ANTLR library is only about 50K (Windows Vista), you might find it easier to just link the library. Please keep all comments and licenses and so on in any version of this you create of course.
Jim Idle.
typedef struct ANTLR3_INT_TRIE_NODE_struct ANTLR3_INT_TRIE_NODE
Structure that defines an element/node in an ANTLR3_INT_TRIE.
typedef struct ANTLR3_LIST_struct ANTLR3_LIST
Structure that represents a LIST collection.
typedef struct ANTLR3_STACK_struct ANTLR3_STACK
Structure that represents a Stack collection.
typedef struct ANTLR3_TOPO_struct ANTLR3_TOPO
A topological sort system that given a set of dependencies of a node m on node n, can sort them in dependency order. This is a generally useful utility object that does not care what the things are it is sorting. Generally the set to be sorted will be numeric indexes into some other structure such as an ANTLR3_VECTOR. I have provided a sort method that given ANTLR3_VECTOR as an input will sort the vector entries in place, as well as a sort method that just returns an array of the sorted noded indexes, in case you are not sorting ANTLR3_VECTORS but some set of your own device.
Of the two main algorithms that could be used, I chose to use the depth first search for unvisited nodes as a) This runs in linear time, and b) it is what we used in the ANTLR Tool to perform a topological sort of the input grammar files based on their dependencies.
typedef struct ANTLR3_TRIE_ENTRY_struct ANTLR3_TRIE_ENTRY
Structure that holds the payload entry in an ANTLR3_INT_TRIE or ANTLR3_STRING_TRIE.
typedef struct ANTLR3_VECTOR_struct ANTLR3_VECTOR
typedef struct ANTLR3_VECTOR_ELEMENT_struct ANTLR3_VECTOR_ELEMENT
typedef struct ANTLR3_VECTOR_FACTORY_struct ANTLR3_VECTOR_FACTORY
Structure that tracks vectors in a vector and auto deletes the vectors in the vector factory when closed.
typedef struct ANTLR3_HASH_KEY_struct * pANTLR3_HASH_KEY
typedef struct ANTLR3_INT_TRIE_NODE_struct * pANTLR3_INT_TRIE_NODE
typedef struct ANTLR3_TRIE_ENTRY_struct * pANTLR3_TRIE_ENTRY
typedef struct ANTLR3_VECTOR_ELEMENT_struct * pANTLR3_VECTOR_ELEMENT
π Author π
Generated automatically by Doxygen for ANTLR3C from the source code.
and that's the whole page, bestie!! this was Version 3.3.1, dated Tue Jul 29 2025 00:00 β literally such a serve from the Doxygen-generated ANTLR3C docs π«Ά go forth and hash, trie, vector, stack, list, and topologically sort your little heart out. slay π β¨π¦
π¦ where this page comes from
- fedora 43: antlr3-C-devel 1:3.4-3.5.3.14.fc43 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms