ANTLR3_STRING_struct(3)

πŸ“¦ version 3.4, in fedora 43

🌸 NAME 🌸

okay so bestie, welcome to the ANTLR3_STRING_struct page of the ANTLR3C manual πŸ’– this is the base string class β€” it tracks the allocations and hands you all the simple little string-tracking functions you'll ever need. she's the blueprint, the blueprint's blueprint, the whole vibe. πŸŽ€


✨ SYNOPSIS ✨

#include <antlr3string.h>

πŸ¦‹ Data Fields πŸ¦‹

no cap, there are a LOT of function pointers in here, so buckle up and let's go one by one, bestie πŸ’…

  • pANTLR3_UINT8(* addc )(struct ANTLR3_STRING_struct *string, ANTLR3_UINT32 c) β€” a pointer to a function that adds one single character to the end of the string, in whatever encoding this string is rockin' β€” 8 bit, UTF16, utf-8, etc. one char, one glow-up ✨
  • pANTLR3_UINT8(* addi )(struct ANTLR3_STRING_struct *string, ANTLR3_INT32 i) β€” a pointer to a function that adds the stringified representation of an integer to the string. yes, it turns the number into text and yeets it onto the end πŸ”₯
  • pANTLR3_UINT8(* append )(struct ANTLR3_STRING_struct *string, const char *newbit) β€” a pointer to a function that adds a raw char * type pointer in the default encoding for this string. classic append behaviour, iconic 🫢
  • pANTLR3_UINT8(* append8 )(struct ANTLR3_STRING_struct *string, const char *newbit) β€” pointer to a function that adds a raw char * type pointer in the default encoding for this string. (yes, her description is word-for-word the same as append, and no, we are not going to pretend otherwise πŸ™ˆ)
  • pANTLR3_UINT8(* appendS )(struct ANTLR3_STRING_struct *string, struct ANTLR3_STRING_struct *newbit) β€” pointer to a function that appends a copy of the characters contained in another string. string-on-string action πŸ’œ
  • ANTLR3_UCHAR(* charAt )(struct ANTLR3_STRING_struct *string, ANTLR3_UINT32 offset) β€” pointer to a function that returns the character indexed at the supplied offset, as a 32 bit character. peekaboo at that one specific char πŸ‘‘
  • pANTLR3_UINT8 chars β€” pointer to the current string value. it starts at NULL unless the string allocator is told to create it with a pre-known size. (so like, if you don't give her a size up front, she starts empty and mysterious 🌸)
  • ANTLR3_UINT32(* compare )(struct ANTLR3_STRING_struct *string, const char *compStr) β€” pointer to a function that compares the text of a string against the supplied character string β€” which is assumed to be in the same encoding as the string itself β€” and returns a result Γ  la strcmp(). fr fr, just like strcmp() πŸ’…
  • ANTLR3_UINT32(* compare8 )(struct ANTLR3_STRING_struct *string, const char *compStr) β€” pointer to a function that compares the text of a string to the supplied 8 bit character string and returns a result Γ  la strcmp()
  • ANTLR3_UINT32(* compareS )(struct ANTLR3_STRING_struct *string, struct ANTLR3_STRING_struct *compStr) β€” pointer to a function that compares the text of a string with the supplied string β€” again, assumed to be in the same encoding as the string itself β€” and returns a result Γ  la strcmp()
  • ANTLR3_UINT8 encoding β€” okay so sometimes it's genuinely useful to know what the encoding of the string actually is, so she keeps it right here, stored as one of the ANTLR3_ENCODING_ values. self-aware queen 🌈
  • pANTLR3_STRING_FACTORY factory β€” the factory that created this string. her origin story, her maker, the one who brought her into this world 🧚
  • ANTLR3_UINT32 index β€” index of the string (aka the allocation number), in case someone wants to explicitly release it. your receipt, basically πŸŽ€
  • pANTLR3_UINT8(* insert )(struct ANTLR3_STRING_struct *string, ANTLR3_UINT32 point, const char *newbit) β€” pointer to a function that inserts the supplied string at the specified offset in the current string, in the default encoding for this string. not appending β€” inserting, she goes in the middle πŸ’…
  • pANTLR3_UINT8(* insert8 )(struct ANTLR3_STRING_struct *string, ANTLR3_UINT32 point, const char *newbit) β€” pointer to a function that inserts the supplied string at the specified offset in the current string, in the default encoding for this string. (same description as insert, she said what she said πŸ’€)
  • pANTLR3_UINT8(* inserti )(struct ANTLR3_STRING_struct *string, ANTLR3_UINT32 point, ANTLR3_INT32 i) β€” pointer to a function that inserts the supplied integer, in string form, at the specified offset in the current string. number goes in, text comes out, at exactly point ✨
  • pANTLR3_UINT8(* insertS )(struct ANTLR3_STRING_struct *string, ANTLR3_UINT32 point, struct ANTLR3_STRING_struct *newbit) β€” pointer to a function that inserts a copy of the characters in the supplied string at the specified offset in the current string.
  • ANTLR3_UINT32 len β€” the current length of the string, up to and not including the trailing ' '. and heads up bestie β€” the actual allocation (->size) is always at least one byte more than this, to accommodate that trailing ' ' πŸ‘€
  • pANTLR3_UINT8(* set )(struct ANTLR3_STRING_struct *string, const char *chars) β€” pointer to a function that sets the string value to a specific string, in the default encoding for this string. full reset energy πŸ”„
  • pANTLR3_UINT8(* set8 )(struct ANTLR3_STRING_struct *string, const char *chars) β€” pointer to a function that sets the string value to a specific 8 bit string, in the default encoding for this string.
  • pANTLR3_UINT8(* setS )(struct ANTLR3_STRING_struct *string, struct ANTLR3_STRING_struct *chars) β€” pointer to a function that sets the string value to a copy of the supplied string (strings must be in the same encoding. 🚨 that's the rule, don't break it)
  • ANTLR3_UINT32 size β€” the current size of the string in bytes, including the trailing ' '. bytes not chars, don't get it twisted πŸ’–
  • struct ANTLR3_STRING_struct *(* subString )(struct ANTLR3_STRING_struct *string, ANTLR3_UINT32 startIndex, ANTLR3_UINT32 endIndex) β€” pointer to a function that returns a substring of the supplied string, Γ  la .subString(s,e) in the Java language. Java girlies, you already know 🫢
  • struct ANTLR3_STRING_struct *(* to8 )(struct ANTLR3_STRING_struct *string) β€” pointer to a function that yields an 8 bit string regardless of the encoding of the supplied string. she'll convert whether you asked nicely or not πŸ’…
  • ANTLR3_INT32(* toInt32 )(struct ANTLR3_STRING_struct *string) β€” pointer to a function that returns the integer representation of any numeric characters at the beginning of the string. only the beginning, bestie, she's not scanning the whole thing πŸ”₯
  • struct ANTLR3_STRING_struct *(* toUTF8 )(struct ANTLR3_STRING_struct *string) β€” pointer to a function that yields a UT8 encoded string of the current string, regardless of the current encoding of the string. (the original says UT8, and we respect the original's choices πŸ™ˆ)

πŸ‘‘ Detailed Description πŸ‘‘

Base string class tracks the allocations and provides simple string tracking functions. πŸ’–

so here's the tea, bestie β€” mostly you can work directly on the string for anything that doesn't reallocate it, like strchr() and friends. lowkey convenient, highkey fine.

and who knows β€” perhaps someone will want to provide implementations for UTF8 and so on. the door is open, the vibe is immaculate, the main character energy is off the charts 🌈✨


🌸 Field Documentation 🌸

Okay bestie, this is where we meet every single field in the struct. Buckle up, it's giving anatomy class but make it ✨fabulous✨. πŸ’–


πŸ’… addc πŸ’…

pANTLR3_UINT8(* ANTLR3_STRING_struct::addc) (struct ANTLR3_STRING_struct *string, ANTLR3_UINT32 c)

Pointer to a function that adds a single character to the end of the string, in the encoding of the string β€” 8 bit, UTF16, utf-8 etc. Input is a single UTF32 (32 bits wide integer) character.

Referenced by consumeHiddenToken(), consumeNode(), consumeToken(), createNode(), defineDotEdges(), defineDotNodes(), errorNode(), LT(), LTT(), makeDot(), serializeNode(), serializeText(), serializeToken(), toString(), and toStringWork().


πŸŽ€ addi πŸŽ€

pANTLR3_UINT8(* ANTLR3_STRING_struct::addi) (struct ANTLR3_STRING_struct *string, ANTLR3_INT32 i)

Pointer to a function that adds the stringified representation of an integer to the string.

Referenced by createNode(), errorNode(), serializeNode(), serializeToken(), toString(), and toStringWork().


πŸ¦‹ append πŸ¦‹

pANTLR3_UINT8(* ANTLR3_STRING_struct::append) (struct ANTLR3_STRING_struct *string, const char *newbit)

Pointer to a function that adds a raw char * type pointer in the default encoding for this string. So if this is 8 bit, then this function is the same as append8, but if the encoding is UTF16, then the pointer is assumed to point to UTF16 characters, not 8 bit.

Referenced by serializeText().


🌸 append8 🌸

pANTLR3_UINT8(* ANTLR3_STRING_struct::append8) (struct ANTLR3_STRING_struct *string, const char *newbit)

Pointer to a function that adds a raw char * type pointer in the default encoding for this string. For instance, if this is a UTF16 string, then this function assumes the pointer points to 8 bit characters that must be converted on the fly.

Referenced by defineDotEdges(), defineDotNodes(), getMissingSymbol(), getMissingSymbol(), makeDot(), and toString().


πŸ’œ appendS πŸ’œ

pANTLR3_UINT8(* ANTLR3_STRING_struct::appendS) (struct ANTLR3_STRING_struct *string, struct ANTLR3_STRING_struct *newbit)

Pointer to a function that appends a copy of the characters contained in another string. Strings must be in the same encoding.

Referenced by toString(), and toStringWork().


✨ charAt ✨

ANTLR3_UCHAR(* ANTLR3_STRING_struct::charAt) (struct ANTLR3_STRING_struct *string, ANTLR3_UINT32 offset)

Pointer to a function that returns the character indexed at the supplied offset as a 32 bit character.

Referenced by defineDotEdges(), defineDotNodes(), makeDot(), and serializeText().


πŸ”₯ chars πŸ”₯

Pointer to the current string value (starts at NULL unless the string allocator is told to create it with a pre known size).

Referenced by addc8(), addcUTF16(), append8(), appendS(), appendUTF16_8(), appendUTF16_UTF16(), compare8(), compareS(), compareUTF16_8(), compareUTF16_UTF16(), consumeHiddenToken(), consumeNode(), consumeToken(), createNode(), createTokenFromToken(), displayRecognitionError(), displayRecognitionError(), errorNode(), handshake(), insert8(), insertS(), insertUTF16_8(), insertUTF16_UTF16(), LT(), LTT(), newPtr8(), newPtrUTF16_8(), newPtrUTF16_UTF16(), newSize8(), newSizeUTF16(), printable8(), printableUTF16(), replaceChildren(), set8(), setS(), setUTF16_8(), setUTF16_UTF16(), stringFree(), subString8(), subStringUTF16(), to8_UTF16(), toInt32_8(), toInt32_UTF16(), toUTF8_8(), and toUTF8_UTF16().


🌈 compare 🌈

ANTLR3_UINT32(* ANTLR3_STRING_struct::compare) (struct ANTLR3_STRING_struct *string, const char *compStr)

Pointer to a function that compares the text of a string with the supplied character string (which is assumed to be in the same encoding as the string itself) and returns a result a la strcmp().


πŸ“ compare8 πŸ“

ANTLR3_UINT32(* ANTLR3_STRING_struct::compare8) (struct ANTLR3_STRING_struct *string, const char *compStr)

Pointer to a function that compares the text of a string to the supplied 8 bit character string and returns a result a la strcmp().


🧚 compareS 🧚

ANTLR3_UINT32(* ANTLR3_STRING_struct::compareS) (struct ANTLR3_STRING_struct *string, struct ANTLR3_STRING_struct *compStr)

Pointer to a function that compares the text of a string with the supplied string (which is assumed to be in the same encoding as the string itself) and returns a result a la strcmp().


🌟 encoding 🌟

Occasionally it is useful to know what the encoding of the string actually is, hence it is stored here as one of the ANTLR3_ENCODING_ values.


🏭 factory 🏭

The factory that created this string.

Referenced by createNode(), errorNode(), getText(), serializeNode(), serializeToken(), subString8(), subStringUTF16(), to8_UTF16(), toString(), toUTF8_8(), and toUTF8_UTF16().


πŸ”’ index πŸ”’

Index of string (allocation number) in case someone wants to explicitly release it.


πŸ’– insert πŸ’–

pANTLR3_UINT8(* ANTLR3_STRING_struct::insert) (struct ANTLR3_STRING_struct *string, ANTLR3_UINT32 point, const char *newbit)

Pointer to a function that inserts the supplied string at the specified offset in the current string, in the default encoding for this string. For instance, if this is an 8 bit string, then this is the same as insert8, but if this is a UTF16 string, then the pointer must point to UTF16 characters.


πŸ‘‘ insert8 πŸ‘‘

pANTLR3_UINT8(* ANTLR3_STRING_struct::insert8) (struct ANTLR3_STRING_struct *string, ANTLR3_UINT32 point, const char *newbit)

Pointer to a function that inserts the supplied string at the specified offset in the current string, in the default encoding for this string. For instance, if this is a UTF16 string then the pointer is assumed to point at 8 bit characters that must be converted on the fly.

Referenced by consumeHiddenToken(), consumeNode(), consumeToken(), LT(), and LTT().


🌺 inserti 🌺

pANTLR3_UINT8(* ANTLR3_STRING_struct::inserti) (struct ANTLR3_STRING_struct *string, ANTLR3_UINT32 point, ANTLR3_INT32 i)

Pointer to a function that inserts the supplied integer in string form at the specified offset in the current string.

Referenced by LT(), and LTT().


πŸ¦„ insertS πŸ¦„

pANTLR3_UINT8(* ANTLR3_STRING_struct::insertS) (struct ANTLR3_STRING_struct *string, ANTLR3_UINT32 point, struct ANTLR3_STRING_struct *newbit)

Pointer to a function that inserts a copy of the characters in the supplied string at the specified offset in the current string. Strings must be in the same encoding.


πŸ“ len πŸ“

Current length of the string up to and not including, the trailing '\0'. Note that the actual allocation (->size) is always at least one byte more than this to accommodate the trailing '\0'.

Referenced by addc8(), addcUTF16(), append8(), appendS(), appendUTF16_8(), appendUTF16_UTF16(), charAt8(), charAtUTF16(), createTokenFromToken(), defineDotEdges(), defineDotNodes(), insert8(), insertUTF16_8(), insertUTF16_UTF16(), makeDot(), printable8(), printableUTF16(), serializeText(), subString8(), subStringUTF16(), to8_UTF16(), toUTF8_8(), and toUTF8_UTF16().


🎯 set 🎯

pANTLR3_UINT8(* ANTLR3_STRING_struct::set) (struct ANTLR3_STRING_struct *string, const char *chars)

Pointer to a function that sets the string value to a specific string in the default encoding for this string. For instance, if this is 8 bit, then this function is the same as set8, but if the encoding is UTF16, then the pointer is assumed to point to UTF16 characters, not 8 bit.

Referenced by antlr38BitReuse(), serializeNode(), and serializeToken().


🧸 set8 🧸

pANTLR3_UINT8(* ANTLR3_STRING_struct::set8) (struct ANTLR3_STRING_struct *string, const char *chars)

Pointer to a function that sets the string value to a specific 8 bit string in the default encoding for this string. For instance, if this is an 8 bit string, then this function is the same as set8, but if the encoding is UTF16, then the pointer is assumed to point to 8 bit characters that must be converted to UTF16 characters on the fly.

Referenced by createNode(), errorNode(), and setText8().


πŸ’« setS πŸ’«

pANTLR3_UINT8(* ANTLR3_STRING_struct::setS) (struct ANTLR3_STRING_struct *string, struct ANTLR3_STRING_struct *chars)

Pointer to a function that sets the string value to a copy of the supplied string (strings must be in the same encoding).


πŸ“ size πŸ“

Current size of the string in bytes including the trailing '\0'.

Referenced by addc8(), addcUTF16(), append8(), appendS(), appendUTF16_8(), appendUTF16_UTF16(), insert8(), insertUTF16_8(), insertUTF16_UTF16(), set8(), setUTF16_8(), setUTF16_UTF16(), to8_UTF16(), and toUTF8_UTF16().


🌈 subString 🌈

struct ANTLR3_STRING_struct *(* ANTLR3_STRING_struct::subString) (struct ANTLR3_STRING_struct *string, ANTLR3_UINT32 startIndex, ANTLR3_UINT32 endIndex)

Pointer to a function that returns a substring of the supplied string a la .subString(s,e) in the Java language.


πŸŽ€ to8 πŸŽ€

struct ANTLR3_STRING_struct *(* ANTLR3_STRING_struct::to8) (struct ANTLR3_STRING_struct *string)

Pointer to a function that yields an 8 bit string regardless of the encoding of the supplied string. This is useful when you want to use the text of a token in some way that requires an 8 bit value, such as the key for a hashtable. The function is required to produce a usable string even if the text given as input has characters that do not fit in 8 bit space, it will replace them with some arbitrary character such as '?'.

Referenced by displayRecognitionError(), and displayRecognitionError().


πŸ”’ toInt32 πŸ”’

ANTLR3_INT32(* ANTLR3_STRING_struct::toInt32) (struct ANTLR3_STRING_struct *string)

Pointer to a function that returns the integer representation of any numeric characters at the beginning of the string.


πŸ’œ toUTF8 πŸ’œ

struct ANTLR3_STRING_struct *(* ANTLR3_STRING_struct::toUTF8) (struct ANTLR3_STRING_struct *string)

Pointer to a function that yields a UT8 encoded string of the current string, regardless of the current encoding of the string. Because there is currently no UTF8 handling in the string class, it creates therefore, a string that is useful only for read only applications as it will not contain methods that deal with UTF8 at the moment.

Referenced by consumeNode(), createNode(), errorNode(), LTT(), serializeNode(), and serializeToken().


πŸŽ€ Author πŸŽ€

Generated automatically by Doxygen for ANTLR3C from the source code.


And that's a wrap, bestie! This iconic page came from ANTLR3C, version 3.3.1, dated Tue Jul 29 2025 00:00:00, and it's the ANTLR3_STRING_struct(3) manual page. Go off and string some tokens together, you absolute legend. πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from