libpulsar
A modular compiler for the pulsar programming language
Loading...
Searching...
No Matches
src
frontend
lexer
token.h
Go to the documentation of this file.
1
8
#pragma once
9
10
#include "
def.h
"
11
#include "
enum/make.h
"
12
#include "
loc.h
"
13
#include "
util/dynarr.h
"
14
18
enum
ps_token_type
{
19
// See file for associated comments
20
#define ENUM TO_ENUM
21
#include "
token_type.h
"
22
#undef ENUM
23
PS_TOKEN_TYPES_NUMBER
24
};
25
29
STR
ps_token_type_to_string
(
enum
ps_token_type
type);
30
34
struct
ps_token
{
35
struct
ps_loc
loc
;
36
enum
ps_token_type
type
;
37
STR
start
;
38
usize
length
;
39
};
40
41
PS_PRINT_DECL
(
ps_token
);
42
46
struct
ps_token_arr
ps_dynarr
(struct
ps_token
);
47
#define ps_token_arr_new() ps_dynarr_new(struct ps_token_arr)
48
#define ps_token_arr_free(arr) ps_dynarr_free(arr)
def.h
Base definitions.
STR
#define STR
Definition
def.h:40
usize
#define usize
Definition
def.h:50
dynarr.h
Defines a dynamically-allocated array template.
ps_dynarr
#define ps_dynarr(T)
Definition
dynarr.h:28
loc.h
File location structure.
make.h
Retrieval of associated data from custom enum (see enum.h).
PS_PRINT_DECL
#define PS_PRINT_DECL(T)
Definition
print.h:9
ps_loc
Represents a token location.
Definition
loc.h:16
ps_token
Represents a token.
Definition
token.h:34
ps_token::length
usize length
Definition
token.h:38
ps_token::type
enum ps_token_type type
Definition
token.h:36
ps_token::loc
struct ps_loc loc
Definition
token.h:35
ps_token::start
STR start
Definition
token.h:37
ps_token_type_to_string
STR ps_token_type_to_string(enum ps_token_type type)
Returns: the string representation of the given token type type.
Definition
token.c:13
ps_token_type
ps_token_type
The type of a token.
Definition
token.h:18
PS_TOKEN_TYPES_NUMBER
@ PS_TOKEN_TYPES_NUMBER
Definition
token.h:23
token_type.h
All token types.
Generated by
1.9.8