Debug

Diagnostic and debug output utilities.

Enumerations

Name Description
TokenPrintFlags Bitmask controlling which token fields are printed.

TokenPrintFlags

enum TokenPrintFlags

Bitmask controlling which token fields are printed.

Value Description
TOK_PRINT_FLAG_KIND
TOK_PRINT_FLAG_LEXEME
TOK_PRINT_FLAG_LINE
TOK_PRINT_FLAG_COL
TOK_PRINT_ALL

Functions

Return Name Description
const char * token_type_str Converts token kind to display string.
const char * unary_op_str Converts unary operator to display string.
const char * datatype_str Converts type kind to display string.
const char * binary_op_str Converts binary operator to display string.
void print_token Prints token diagnostics.
void print_expr Prints an expression tree using ASCII connectors.
int use_color static
const char * token_type_str Converts token kind to display string.
void print_token Prints token diagnostics.
const char * unary_op_str Converts unary operator to display string.
const char * datatype_str Converts type kind to display string.
const char * binary_op_str Converts binary operator to display string.
void print_children Recursively prints a list of child expressions in tree form.
void print_expr Prints an expression tree using ASCII connectors.

token_type_str

const char * token_type_str(TokenKind type)

Converts token kind to display string.

Converts token kind to display string.

Converts token kind to display string.

Converts token kind to display string.


unary_op_str

const char * unary_op_str(UnaryOp op)

Converts unary operator to display string.

Converts unary operator to display string.

Converts unary operator to display string.

Converts unary operator to display string.


datatype_str

const char * datatype_str(TypeKind t)

Converts type kind to display string.

Converts type kind to display string.

Converts type kind to display string.

Converts type kind to display string.


binary_op_str

const char * binary_op_str(BinaryOp op)

Converts binary operator to display string.

Converts binary operator to display string.

Converts binary operator to display string.

Converts binary operator to display string.


void print_token(Token * token, TokenPrintFlags flags)

Prints token diagnostics.

Prints token diagnostics.

Parameters

  • token Token to print.

  • flags Print-field bitmask.

Prints token diagnostics.

Parameters

  • token Token to print.

  • flags Print-field bitmask.

Prints token diagnostics.


void print_expr(const Expr * expr, int depth, int isLast, int sibling)

Prints an expression tree using ASCII connectors.

Prints an expression tree using ASCII connectors.

Parameters

  • expr Root expression to print.

  • depth Current depth in the recursion.

  • isLast Non-zero if node is last child at its level.

  • sibling Bitmask describing ancestor sibling structure.

Prints an expression tree using ASCII connectors.

Parameters

  • expr Root expression to print.

  • depth Current depth in the recursion.

  • isLast Non-zero if node is last child at its level.

  • sibling Bitmask describing ancestor sibling structure.

Prints an expression tree using ASCII connectors.


use_color

static

static int use_color(void)

token_type_str

const char * token_type_str(TokenKind type)

Converts token kind to display string.

Converts token kind to display string.

Converts token kind to display string.

Converts token kind to display string.


void print_token(Token * token, TokenPrintFlags flags)

Prints token diagnostics.

Prints token diagnostics.

Parameters

  • token Token to print.

  • flags Print-field bitmask.

Prints token diagnostics.

Prints token diagnostics.

Parameters

  • token Token to print.

  • flags Print-field bitmask.


unary_op_str

const char * unary_op_str(UnaryOp op)

Converts unary operator to display string.

Converts unary operator to display string.

Converts unary operator to display string.

Converts unary operator to display string.


datatype_str

const char * datatype_str(TypeKind t)

Converts type kind to display string.

Converts type kind to display string.

Converts type kind to display string.

Converts type kind to display string.


binary_op_str

const char * binary_op_str(BinaryOp op)

Converts binary operator to display string.

Converts binary operator to display string.

Converts binary operator to display string.

Converts binary operator to display string.


void print_children(const Expr ** children, int count, int depth, int sibling)

Recursively prints a list of child expressions in tree form.


void print_expr(const Expr * expr, int depth, int isLast, int sibling)

Prints an expression tree using ASCII connectors.

Prints an expression tree using ASCII connectors.

Parameters

  • expr Root expression to print.

  • depth Current depth in the recursion.

  • isLast Non-zero if node is last child at its level.

  • sibling Bitmask describing ancestor sibling structure.

Prints an expression tree using ASCII connectors.

Prints an expression tree using ASCII connectors.

Parameters

  • expr Root expression to print.

  • depth Current depth in the recursion.

  • isLast Non-zero if node is last child at its level.

  • sibling Bitmask describing ancestor sibling structure.