sic

The sic programming language, compiler and tools (WIP)
Log | Files | Refs

common.h (561B)


      1 #pragma once
      2 
      3 #include <stdbool.h>
      4 #include <stddef.h>
      5 #include <stdio.h>
      6 #include <stdlib.h>
      7 
      8 #include "token.h"
      9 
     10 /////////////////////////////////////////////////
     11 
     12 typedef struct Lexer_State {
     13     size_t pos;
     14     size_t line;
     15     size_t col;
     16 } Lexer_State;
     17 
     18 typedef struct Lexer {
     19     const char* code;
     20     size_t code_len;
     21     const char* path;
     22     const char* filename;
     23     Lexer_State state;
     24     Token* tokens;
     25     size_t len;
     26     size_t cap;
     27 } Lexer;
     28 
     29 /////////////////////////////////////////////////
     30 
     31 // void check(bool condition, const char* message);