Debug

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.
const char * stmt_kind_str Converts a statement kind to a human-readable display string.
void print_stmt Prints a statement tree using ASCII connectors.
int use_color static
void print_token Prints token diagnostics.
const char * datatype_str Converts type kind to display string.
const char * stmt_kind_str Converts a statement kind to a human-readable display string.
void print_tree_prefix static
void print_type_expr static
void print_children Recursively prints a list of child expressions in tree form.
void print_stmt_child static
void print_expr_child static
void print_stmt_node static
void print_stmt Prints a statement 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 is_last, 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.

  • is_last 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.

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

  • sibling Bitmask describing ancestor sibling structure.

Prints an expression tree using ASCII connectors.


stmt_kind_str

const char * stmt_kind_str(StmtKind kind)

Converts a statement kind to a human-readable display string.

Converts a statement kind to a human-readable display string.

Converts a statement kind to a human-readable display string.

Converts a statement kind to a human-readable display string.


void print_stmt(const Stmt * stmt, int depth, int is_last, int sibling)

Prints a statement tree using ASCII connectors.

Prints a statement tree using ASCII connectors.

Parameters

  • stmt Root statement to print. Statements linked through next are also printed.

  • depth Current depth in the recursion.

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

  • sibling Bitmask describing ancestor sibling structure.

Prints a statement tree using ASCII connectors.

Parameters

  • stmt Root statement to print. Statements linked through next are also printed.

  • depth Current depth in the recursion.

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

  • sibling Bitmask describing ancestor sibling structure.

Prints a statement tree using ASCII connectors.


use_color

static

static int use_color(void)

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.


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.


stmt_kind_str

const char * stmt_kind_str(StmtKind kind)

Converts a statement kind to a human-readable display string.

Converts a statement kind to a human-readable display string.

Converts a statement kind to a human-readable display string.

Converts a statement kind to a human-readable display string.


static

static void print_tree_prefix(int depth, int is_last, int sibling)

static

static void print_type_expr(const TypeExpr * type)

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

Recursively prints a list of child expressions in tree form.


static

static void print_stmt_child(const Stmt * stmt, int depth, int is_last, int sibling)

static

static void print_expr_child(const Expr * expr, int depth, int is_last, int sibling)

static

static void print_stmt_node(const Stmt * stmt, int depth, int is_last, int sibling)

void print_stmt(const Stmt * stmt, int depth, int is_last, int sibling)

Prints a statement tree using ASCII connectors.

Prints a statement tree using ASCII connectors.

Parameters

  • stmt Root statement to print. Statements linked through next are also printed.

  • depth Current depth in the recursion.

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

  • sibling Bitmask describing ancestor sibling structure.

Prints a statement tree using ASCII connectors.

Prints a statement tree using ASCII connectors.

Parameters

  • stmt Root statement to print. Statements linked through next are also printed.

  • depth Current depth in the recursion.

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

  • sibling Bitmask describing ancestor sibling structure.