Skip to content

Parsing

Demonstration and test of some parsing capabilities, including basics such as variables, functions, operators and types, and more complex forms such as elaborate templates and SFINAE.

Types

Name Description
Class Test class.
ClassTemplate Test class template.
ClassTemplateWithMembers Class template with members.
ClassWithMembers Class with members.
Enum Test enumeration.
EnumAfter Test enumeration with values documented after.
EnumClass Test scoped enumeration.
EnumStruct Test scoped enumeration.
ForwardClass Forward class declaration.
Struct Test struct.
StructTemplate Test struct template.
Union Test union.
UnionTemplate Test union template.

Type Aliases

Name Description
TypeAlias Test type alias.
TypeAliasFunctionPointer Test type alias of function pointer type.
TypeAliasTemplate Test type alias template.
TypeDef Test typedef.
TypeDefFunctionPointer Test typedef of function pointer type.

Concepts

Name Description
Concept Test concept.
TrivialConcept Test trivial concept.

Macros

Name Description
MACRO Test macro.
MACRO_AFTER Test macro, documented after entity with /// comment
MACRO_WITH_ARGS Test macro with arguments.
MACRO_WITH_ARGS_AFTER Test macro with arguments, documented after entity with /// comment

Variables

Name Description
a Documented with /** ... */ style preceding comment.
arr1 Test variable of array type.
arr2 Test variable of array type with initializer.
b Documented with /// style preceding comment.
c Documented with /// style preceding comment that wraps across multiple lines and has multiple paragraphs.
d Documented after entity with /// comment
e Documentation comment with * and / characters.
fp Test variable of function pointer type.
ptr1 Test variable of pointer type.
ptr2 Test variable of pointer type with initializer.
ref1 Test variable of reference type.
ref2 Test variable of reference type with initializer.
w Test variable.
whitespace1 Comment where leading whitespace is important, using /** ... */ style preceding comment.
whitespace2 Comment where leading whitespace is important, using /// style preceding comment.
x Test variable with initializer.
y Test variable with parenthetical initializer.
z Test variable with brace initializer.
λ Test variable with unicode character.

Operators

Name Description
operator+ Test operator.
operator+ Test operator template.
operator+ Test operator template with SFINAE.
operator+ Test inline operator.
operator+ Test inline operator template.
operator+ Test inline operator template with SFINAE.

Functions

Name Description
f Test function.
f Test function that returns a reference.
f Test function that returns a pointer.
f Test function that returns a function pointer.
f Test function template.
f Test function template with SFINAE.
f Test inline function.
f Test inline function template.
f Test inline function template with SFINAE.

Type Alias Details

TypeAlias

using TypeAlias = int

Test type alias.

TypeAliasFunctionPointer

using TypeAliasFunctionPointer = int (*)(int, int)

Test type alias of function pointer type.

TypeAliasTemplate

template<class T> using TypeAliasTemplate = int

Test type alias template.

TypeDef

typedef int TypeDef

Test typedef.

TypeDefFunctionPointer

typedef int (*TypeDefFunctionPointer)(int, int)

Test typedef of function pointer type.

Concept Details

Concept

template<class T> concept Concept = std::is_arithmetic_v<T>

Test concept.

TrivialConcept

template<class T> concept TrivialConcept = true

Test trivial concept.

Macro Details

MACRO

#define MACRO

Test macro.

MACRO_AFTER

#define MACRO_AFTER

Test macro, documented after entity with /// comment

MACRO_WITH_ARGS

#define MACRO_WITH_ARGS(x, y)

Test macro with arguments.

MACRO_WITH_ARGS_AFTER

#define MACRO_WITH_ARGS_AFTER(x, y)

Test macro with arguments, documented after entity with /// comment

Variable Details

a

int a

Documented with /** ... */ style preceding comment.

arr1

int arr1[10]

Test variable of array type.

arr2

int arr2[10]

Test variable of array type with initializer.

b

int b

Documented with /// style preceding comment.

c

int c

Documented with /// style preceding comment that wraps across multiple lines and has multiple paragraphs.

This is the second paragraph.

This is the third paragraph.

d

int d

Documented after entity with /// comment

e

int e

Documentation comment with * and / characters.

fp

int (*fp)(int, int)

Test variable of function pointer type.

ptr1

int* ptr1

Test variable of pointer type.

ptr2

int* ptr2

Test variable of pointer type with initializer.

ref1

int& ref1

Test variable of reference type.

ref2

int& ref2

Test variable of reference type with initializer.

w

int w

Test variable.

whitespace1

int whitespace1

Comment where leading whitespace is important, using /** ... */ style preceding comment. Details should show code if indenting is correctly preserved.

int main();

whitespace2

int whitespace2

Comment where leading whitespace is important, using /// style preceding comment. Details should show code if indenting is correctly preserved.

int main();

x

int x

Test variable with initializer.

y

int y

Test variable with parenthetical initializer.

z

int z

Test variable with brace initializer.

λ

int λ

Test variable with unicode character.

Operator Details

operator+

int operator+(int x, int y)

Test operator.

template<class T> T operator+(T x, T y)

Test operator template.

template<class T, std::enable_if_t<std::is_integral_v<T>, int> = 0> T operator+(T x, T y)

Test operator template with SFINAE.

inline int operator+(int x, int y)

Test inline operator.

template<class T> T operator+(T x, T y)

Test inline operator template.

template<class T, std::enable_if_t<std::is_integral_v<T>, int> = 0> T operator+(T x, T y)

Test inline operator template with SFINAE.

Function Details

f

int f(int x, int y)

Test function.

int& f(int x, int y)

Test function that returns a reference.

int* f(int x, int y)

Test function that returns a pointer.

int (*f(int x, int y))(int, int)

Test function that returns a function pointer.

template<class T> T f(T x, T y)

Test function template.

template<class T, std::enable_if_t<std::is_integral_v<T>, int> = 0> T f(T x, T y)

Test function template with SFINAE.

inline int f(int x, int y)

Test inline function.

template<class T> T f(T x, T y)

Test inline function template.

template<class T, std::enable_if_t<std::is_integral_v<T>, int> = 0> T f(T x, T y)

Test inline function template with SFINAE.