Interface for the lexer.
More...
#include "def.h"
#include "loc.h"
#include "util/io.h"
#include <stdbool.h>
#include "token.h"
#include "util/dynarrs.h"
Go to the source code of this file.
|
| #define | PS_LEXER_MAX_ERRORS 5 |
| | The lexer will stop in its tracks after it encounters this many errors.
|
| |
| #define | ps_lexer_next_are(next, n) _ps_lexer_next_are(next, n) |
| | Whether the next n characters in the lexer stream, starting from the current character, match next.
|
| |
| #define | ps_lexer_next_are_lit(next) _ps_lexer_next_are(next, sizeof(next) - 1) |
| | Whether the next characters in the lexer stream, starting from the current character, match next, which is provided as a string literal.
|
| |
|
| struct ps_token_arr * | ps_lex (const struct ps_file_ctx *file_ctx) |
| | Lexes the given source code into tokens.
|
| |
Interface for the lexer.
- Copyright
- Copyright (C) 2023 Ethan Uppal. All rights reserved.
- Author
- Ethan Uppal
Definition in file lexer.h.
◆ PS_LEXER_MAX_ERRORS
| #define PS_LEXER_MAX_ERRORS 5 |
The lexer will stop in its tracks after it encounters this many errors.
Definition at line 22 of file lexer.h.
◆ ps_lexer_next_are
| #define ps_lexer_next_are |
( |
|
next, |
|
|
|
n |
|
) |
| _ps_lexer_next_are(next, n) |
Whether the next n characters in the lexer stream, starting from the current character, match next.
Definition at line 51 of file lexer.h.
◆ ps_lexer_next_are_lit
| #define ps_lexer_next_are_lit |
( |
|
next | ) |
_ps_lexer_next_are(next, sizeof(next) - 1) |
Whether the next characters in the lexer stream, starting from the current character, match next, which is provided as a string literal.
Definition at line 56 of file lexer.h.
◆ 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.
◆ length
◆ loc