#include <string.h>
#include <stdbool.h>
#include <stdio.h>
#include <ctype.h>
#include "frontend/lexer/lexer.h"
#include "frontend/lexer/token.h"
#include "util/arena.h"
#include "error/error.h"
#include "util/mtrack.h"
#include "token_type_keyword.h"
#include "token_type_symbols_operators.h"
Go to the source code of this file.
|
| #define | ENUM(type, keyword) {keyword, sizeof(keyword) - 1, type}, |
| |
| #define | ENUM(type, _, token) {token, sizeof(token) - 1, type}, |
| |
◆ ENUM [1/2]
| #define ENUM |
( |
|
type, |
|
|
|
_, |
|
|
|
token |
|
) |
| {token, sizeof(token) - 1, type}, |
◆ ENUM [2/2]
| #define ENUM |
( |
|
type, |
|
|
|
keyword |
|
) |
| {keyword, sizeof(keyword) - 1, type}, |
◆ ps_add_token()
◆ ps_add_token_with_loc()
◆ ps_lex()
| struct ps_token_arr * ps_lex |
( |
const struct ps_file_ctx * |
file_ctx | ) |
|
Lexes the given source code into tokens.
- Parameters
-
| file_ctx | The file contents and filename. |
Definition at line 559 of file lexer.c.
◆ ps_lexer_advance()
| void ps_lexer_advance |
( |
void |
| ) |
|
Advances past one character in the lexer.
Additionally handles internal state updates. For example, encountering a newline causes the lexer to reset its column counter and increment its line counter.
- Precondition
- The lexer is not at the end of file.
Definition at line 230 of file lexer.c.
◆ ps_lexer_advance_n()
| void ps_lexer_advance_n |
( |
usize |
n | ) |
|
|
inline |
Advances past the next n characters in the lexer, updating internal state as necessary.
- See also
- ps_lexer_advance()
Definition at line 272 of file lexer.c.
◆ ps_lexer_is_eof()
| bool ps_lexer_is_eof |
( |
void |
| ) |
|
|
inline |
Checks whether the lexer is at the end of input.
Definition at line 55 of file lexer.c.
◆ lexer