Loading...
Searching...
No Matches
juce::CppTokeniserFunctions Struct Reference

## Detailed Description

Class containing some basic functions for simple tokenising of C++ code.

The documentation for this struct was generated from the following file:

- juce_gui_extra/code_editor/juce_CPlusPlusCodeTokeniserFunctions.h

## Classes

struct | StringIterator
| A class that can be passed to the CppTokeniserFunctions functions in order to parse a String. More...

## Static Public Member Functions

static bool | isIdentifierStart (const juce_wchar c) noexcept
static bool | isIdentifierBody (const juce_wchar c) noexcept
static bool | isReservedKeyword (String::CharPointerType token, const int tokenLength) noexcept
template<typename Iterator>
static int | parseIdentifier (Iterator &source) noexcept
template<typename Iterator>
static bool | skipNumberSuffix (Iterator &source)
static bool | isHexDigit (const juce_wchar c) noexcept
template<typename Iterator>
static bool | parseHexLiteral (Iterator &source) noexcept
static bool | isOctalDigit (const juce_wchar c) noexcept
template<typename Iterator>
static bool | parseOctalLiteral (Iterator &source) noexcept
static bool | isDecimalDigit (const juce_wchar c) noexcept
template<typename Iterator>
static bool | parseDecimalLiteral (Iterator &source) noexcept
template<typename Iterator>
static bool | parseFloatLiteral (Iterator &source) noexcept
template<typename Iterator>
static int | parseNumber (Iterator &source)
template<typename Iterator>
static void | skipQuotedString (Iterator &source) noexcept
template<typename Iterator>
static void | skipComment (Iterator &source) noexcept
template<typename Iterator>
static void | skipPreprocessorLine (Iterator &source) noexcept
template<typename Iterator>
static void | skipIfNextCharMatches (Iterator &source, const juce_wchar c) noexcept
template<typename Iterator>
static void | skipIfNextCharMatches (Iterator &source, const juce_wchar c1, const juce_wchar c2) noexcept
template<typename Iterator>
static int | readNextToken (Iterator &source)
static void | writeEscapeChars (OutputStream &out, const char *utf8, const int numBytesToRead, const int maxCharsOnLine, const bool breakAtNewLines, const bool replaceSingleQuotes, const bool allowStringBreaks)
| Takes a UTF8 string and writes it to a stream using standard C++ escape sequences for any non-ascii bytes.
static String | addEscapeChars (const String &s)
| Takes a string and returns a version of it where standard C++ escape sequences have been used to replace any non-ascii bytes.

## Member Functions

## isIdentifierStart()

bool juce::CppTokeniserFunctions::isIdentifierStart | ( | const juce_wchar | c | ) |

inline static noexcept

References juce::CharacterFunctions::isLetter().

Referenced by readNextToken().

## isIdentifierBody()

bool juce::CppTokeniserFunctions::isIdentifierBody | ( | const juce_wchar | c | ) |

inline static noexcept

References juce::CharacterFunctions::isLetterOrDigit().

Referenced by parseIdentifier().

## isReservedKeyword()

bool juce::CppTokeniserFunctions::isReservedKeyword | ( | String::CharPointerType | token,
|  | const int | tokenLength )

inline static noexcept

Referenced by parseIdentifier().

## parseIdentifier()

template<typename Iterator>

int juce::CppTokeniserFunctions::parseIdentifier | ( | Iterator & | source | ) |

inline static noexcept

References isIdentifierBody(), isReservedKeyword(), juce::CPlusPlusCodeTokeniser::tokenType_identifier, juce::CPlusPlusCodeTokeniser::tokenType_keyword, juce::CharPointer_UTF8::write(), and juce::CharPointer_UTF8::writeNull().

Referenced by readNextToken().

## skipNumberSuffix()

template<typename Iterator>

bool juce::CppTokeniserFunctions::skipNumberSuffix | ( | Iterator & | source | ) |

inline static

References juce::CharacterFunctions::isLetterOrDigit().

Referenced by parseDecimalLiteral(), parseHexLiteral(), and parseOctalLiteral().

## isHexDigit()

bool juce::CppTokeniserFunctions::isHexDigit | ( | const juce_wchar | c | ) |

inline static noexcept

Referenced by parseHexLiteral().

## parseHexLiteral()

template<typename Iterator>

bool juce::CppTokeniserFunctions::parseHexLiteral | ( | Iterator & | source | ) |

inline static noexcept

References isHexDigit(), and skipNumberSuffix().

Referenced by parseNumber().

## isOctalDigit()

bool juce::CppTokeniserFunctions::isOctalDigit | ( | const juce_wchar | c | ) |

inline static noexcept

Referenced by parseOctalLiteral().

## parseOctalLiteral()

template<typename Iterator>

bool juce::CppTokeniserFunctions::parseOctalLiteral | ( | Iterator & | source | ) |

inline static noexcept

References isOctalDigit(), and skipNumberSuffix().

Referenced by parseNumber().

## isDecimalDigit()

bool juce::CppTokeniserFunctions::isDecimalDigit | ( | const juce_wchar | c | ) |

inline static noexcept

Referenced by parseDecimalLiteral(), and parseFloatLiteral().

## parseDecimalLiteral()

template<typename Iterator>

bool juce::CppTokeniserFunctions::parseDecimalLiteral | ( | Iterator & | source | ) |

inline static noexcept

References isDecimalDigit(), and skipNumberSuffix().

Referenced by parseNumber().

## parseFloatLiteral()

template<typename Iterator>

bool juce::CppTokeniserFunctions::parseFloatLiteral | ( | Iterator & | source | ) |

inline static noexcept

References isDecimalDigit().

Referenced by parseNumber().

## parseNumber()

template<typename Iterator>

int juce::CppTokeniserFunctions::parseNumber | ( | Iterator & | source | ) |

inline static

References parseDecimalLiteral(), parseFloatLiteral(), parseHexLiteral(), parseOctalLiteral(), juce::CPlusPlusCodeTokeniser::tokenType_error, juce::CPlusPlusCodeTokeniser::tokenType_float, and juce::CPlusPlusCodeTokeniser::tokenType_integer.

Referenced by readNextToken().

## skipQuotedString()

template<typename Iterator>

void juce::CppTokeniserFunctions::skipQuotedString | ( | Iterator & | source | ) |

inline static noexcept

Referenced by readNextToken(), and skipPreprocessorLine().

## skipComment()

template<typename Iterator>

void juce::CppTokeniserFunctions::skipComment | ( | Iterator & | source | ) |

inline static noexcept

Referenced by readNextToken().

## skipPreprocessorLine()

template<typename Iterator>

void juce::CppTokeniserFunctions::skipPreprocessorLine | ( | Iterator & | source | ) |

inline static noexcept

References skipPreprocessorLine(), and skipQuotedString().

Referenced by readNextToken(), and skipPreprocessorLine().

## skipIfNextCharMatches() [1/2]

template<typename Iterator>

void juce::CppTokeniserFunctions::skipIfNextCharMatches | ( | Iterator & | source,
|  | const juce_wchar | c )

inline static noexcept

Referenced by readNextToken().

## skipIfNextCharMatches() [2/2]

template<typename Iterator>

void juce::CppTokeniserFunctions::skipIfNextCharMatches | ( | Iterator & | source,
|  | const juce_wchar | c1,
|  | const juce_wchar | c2 )

inline static noexcept

## readNextToken()

template<typename Iterator>

int juce::CppTokeniserFunctions::readNextToken | ( | Iterator & | source | ) |

inline static

References isIdentifierStart(), parseIdentifier(), parseNumber(), skipComment(), skipIfNextCharMatches(), skipPreprocessorLine(), skipQuotedString(), juce::CPlusPlusCodeTokeniser::tokenType_bracket, juce::CPlusPlusCodeTokeniser::tokenType_comment, juce::CPlusPlusCodeTokeniser::tokenType_error, juce::CPlusPlusCodeTokeniser::tokenType_operator, juce::CPlusPlusCodeTokeniser::tokenType_preprocessor, juce::CPlusPlusCodeTokeniser::tokenType_punctuation, and juce::CPlusPlusCodeTokeniser::tokenType_string.

## writeEscapeChars()

void juce::CppTokeniserFunctions::writeEscapeChars | ( | OutputStream & | out,
|  | const char * | utf8,
|  | const int | numBytesToRead,
|  | const int | maxCharsOnLine,
|  | const bool | breakAtNewLines,
|  | const bool | replaceSingleQuotes,
|  | const bool | allowStringBreaks )

inline static

Takes a UTF8 string and writes it to a stream using standard C++ escape sequences for any non-ascii bytes.

Although not strictly a tokenising function, this is still a function that often comes in handy when working with C++ code!

Note that addEscapeChars() is easier to use than this function if you're working with Strings.

See also
  addEscapeChars

References juce::CharacterFunctions::getHexDigitValue(), JUCE_FALLTHROUGH, juce::newLine, and juce::String::toHexString().

Referenced by addEscapeChars().

## addEscapeChars()

String juce::CppTokeniserFunctions::addEscapeChars | ( | const String & | s | ) |

inline static

Takes a string and returns a version of it where standard C++ escape sequences have been used to replace any non-ascii bytes.

Although not strictly a tokenising function, this is still a function that often comes in handy when working with C++ code!

See also
  writeEscapeChars

References juce::String::toRawUTF8(), juce::MemoryOutputStream::toString(), and writeEscapeChars().

### Purchase

Get JUCE

### Discover

What's New in JUCE Features

### Learn

Documentaion Tutorials Made with JUCE Resources

### Support

JUCE Forum Newsletter Archive

### About

Contact Us JUCE Legal JUCE Licensing FAQ

### Events

Audio Developer Conference
© Raw Material Software Limited