JUCE  v6.1.6 (6.0.8-1114)
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::CppTokeniserFunctions Struct Reference

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

#include <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 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. More...
 
static bool isDecimalDigit (const juce_wchar c) noexcept
 
static bool isHexDigit (const juce_wchar c) noexcept
 
static bool isIdentifierBody (const juce_wchar c) noexcept
 
static bool isIdentifierStart (const juce_wchar c) noexcept
 
static bool isOctalDigit (const juce_wchar c) noexcept
 
static bool isReservedKeyword (String::CharPointerType token, const int tokenLength) noexcept
 
template<typename Iterator >
static bool parseDecimalLiteral (Iterator &source) noexcept
 
template<typename Iterator >
static bool parseFloatLiteral (Iterator &source) noexcept
 
template<typename Iterator >
static bool parseHexLiteral (Iterator &source) noexcept
 
template<typename Iterator >
static int parseIdentifier (Iterator &source) noexcept
 
template<typename Iterator >
static int parseNumber (Iterator &source)
 
template<typename Iterator >
static bool parseOctalLiteral (Iterator &source) noexcept
 
template<typename Iterator >
static int readNextToken (Iterator &source)
 
template<typename Iterator >
static void skipComment (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 bool skipNumberSuffix (Iterator &source)
 
template<typename Iterator >
static void skipPreprocessorLine (Iterator &source) noexcept
 
template<typename Iterator >
static void skipQuotedString (Iterator &source) noexcept
 
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. More...
 

Detailed Description

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

@tags{GUI}

Member Function Documentation

◆ addEscapeChars()

static String juce::CppTokeniserFunctions::addEscapeChars ( const String s)
inlinestatic

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::gl::s, juce::MemoryOutputStream::toString(), and writeEscapeChars().

◆ isDecimalDigit()

static bool juce::CppTokeniserFunctions::isDecimalDigit ( const juce_wchar  c)
inlinestaticnoexcept

References juce::gl::c.

Referenced by parseDecimalLiteral(), and parseFloatLiteral().

◆ isHexDigit()

static bool juce::CppTokeniserFunctions::isHexDigit ( const juce_wchar  c)
inlinestaticnoexcept

References juce::gl::c.

Referenced by parseHexLiteral().

◆ isIdentifierBody()

static bool juce::CppTokeniserFunctions::isIdentifierBody ( const juce_wchar  c)
inlinestaticnoexcept

◆ isIdentifierStart()

static bool juce::CppTokeniserFunctions::isIdentifierStart ( const juce_wchar  c)
inlinestaticnoexcept

◆ isOctalDigit()

static bool juce::CppTokeniserFunctions::isOctalDigit ( const juce_wchar  c)
inlinestaticnoexcept

References juce::gl::c.

Referenced by parseOctalLiteral().

◆ isReservedKeyword()

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

Referenced by parseIdentifier().

◆ parseDecimalLiteral()

template<typename Iterator >
static bool juce::CppTokeniserFunctions::parseDecimalLiteral ( Iterator &  source)
inlinestaticnoexcept

◆ parseFloatLiteral()

template<typename Iterator >
static bool juce::CppTokeniserFunctions::parseFloatLiteral ( Iterator &  source)
inlinestaticnoexcept

References juce::gl::c, isDecimalDigit(), and juce::gl::source.

Referenced by parseNumber().

◆ parseHexLiteral()

template<typename Iterator >
static bool juce::CppTokeniserFunctions::parseHexLiteral ( Iterator &  source)
inlinestaticnoexcept

◆ parseIdentifier()

template<typename Iterator >
static int juce::CppTokeniserFunctions::parseIdentifier ( Iterator &  source)
inlinestaticnoexcept

◆ parseNumber()

◆ parseOctalLiteral()

template<typename Iterator >
static bool juce::CppTokeniserFunctions::parseOctalLiteral ( Iterator &  source)
inlinestaticnoexcept

◆ readNextToken()

◆ skipComment()

template<typename Iterator >
static void juce::CppTokeniserFunctions::skipComment ( Iterator &  source)
inlinestaticnoexcept

References juce::gl::c, and juce::gl::source.

Referenced by readNextToken().

◆ skipIfNextCharMatches() [1/2]

template<typename Iterator >
static void juce::CppTokeniserFunctions::skipIfNextCharMatches ( Iterator &  source,
const juce_wchar  c 
)
inlinestaticnoexcept

References juce::gl::c, and juce::gl::source.

Referenced by readNextToken().

◆ skipIfNextCharMatches() [2/2]

template<typename Iterator >
static void juce::CppTokeniserFunctions::skipIfNextCharMatches ( Iterator &  source,
const juce_wchar  c1,
const juce_wchar  c2 
)
inlinestaticnoexcept

References juce::gl::c, and juce::gl::source.

◆ skipNumberSuffix()

template<typename Iterator >
static bool juce::CppTokeniserFunctions::skipNumberSuffix ( Iterator &  source)
inlinestatic

◆ skipPreprocessorLine()

template<typename Iterator >
static void juce::CppTokeniserFunctions::skipPreprocessorLine ( Iterator &  source)
inlinestaticnoexcept

◆ skipQuotedString()

template<typename Iterator >
static void juce::CppTokeniserFunctions::skipQuotedString ( Iterator &  source)
inlinestaticnoexcept

◆ writeEscapeChars()

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

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::gl::c, juce::CharacterFunctions::getHexDigitValue(), JUCE_FALLTHROUGH, juce::newLine, and juce::String::toHexString().

Referenced by addEscapeChars().


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