Luma 0.1.0
A low-level compiled alternative to C, C++, and more!
Loading...
Searching...
No Matches
Functions | Variables
error.c File Reference
#include "../c_libs/error/error.h"
#include "type.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Include dependency graph for error.c:

Functions

void tc_error_init (Token *tokens, int token_count, const char *file_path, ArenaAllocator *arena)
 Set global context for error reporting Call this once at the start of typechecking.
 
void tc_error (AstNode *node, const char *error_type, const char *format,...)
 Simple error reporting - replaces fprintf(stderr, ...) Usage: tc_error(node, "Type Error", "Variable '%s' not found", var_name);.
 
void tc_error_help (AstNode *node, const char *error_type, const char *help, const char *format,...)
 Error with help message.
 
void tc_error_id (AstNode *node, const char *identifier, const char *error_type, const char *format,...)
 Error with identifier highlighting.
 

Variables

Tokeng_tokens = NULL
 
int g_token_count = 0
 
const char * g_file_path = NULL
 
ArenaAllocatorg_arena = NULL
 

Function Documentation

◆ tc_error()

void tc_error ( AstNode node,
const char *  error_type,
const char *  format,
  ... 
)

Simple error reporting - replaces fprintf(stderr, ...) Usage: tc_error(node, "Type Error", "Variable '%s' not found", var_name);.

◆ tc_error_help()

void tc_error_help ( AstNode node,
const char *  error_type,
const char *  help,
const char *  format,
  ... 
)

Error with help message.

◆ tc_error_id()

void tc_error_id ( AstNode node,
const char *  identifier,
const char *  error_type,
const char *  format,
  ... 
)

Error with identifier highlighting.

◆ tc_error_init()

void tc_error_init ( Token tokens,
int  token_count,
const char *  file_path,
ArenaAllocator arena 
)

Set global context for error reporting Call this once at the start of typechecking.

Variable Documentation

◆ g_arena

ArenaAllocator* g_arena = NULL

◆ g_file_path

const char* g_file_path = NULL

◆ g_token_count

int g_token_count = 0

◆ g_tokens

Token* g_tokens = NULL