Skip to content

Commit e2417cc

Browse files
author
Heitor Danilo
committed
chore: renaming lex argument to lexer
1 parent ace7ae3 commit e2417cc

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/lexer/nav.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ void __LEXER_consume_char(struct Lexer* lex) {
3333
++lex->read_position;
3434
}
3535

36-
byte __LEXER_peek_prev_char(struct Lexer *lexer) {
36+
byte __LEXER_peek_prev_char(struct Lexer* lexer) {
3737
if (lexer->read_position >= lexer->input_length) {
3838
return 0;
3939
}
4040

4141
return lexer->input[lexer->read_position - 2];
4242
}
4343

44-
byte __LEXER_peek_next_char(struct Lexer *lexer) {
44+
byte __LEXER_peek_next_char(struct Lexer* lexer) {
4545
if (lexer->read_position >= lexer->input_length) {
4646
return 0;
4747
}
@@ -56,23 +56,23 @@ byte __LEXER_peek_next_char(struct Lexer *lexer) {
5656
*
5757
* @return A dynamically allocated string containing the read sequence, or NULL if there was an error.
5858
*/
59-
char* __LEXER_read_sequence(struct Lexer *lex) {
60-
int position = lex->position;
59+
char* __LEXER_read_sequence(struct Lexer* lexer) {
60+
int position = lexer->position;
6161

62-
while ((is_letter(lex->ch) || is_numeric(lex->ch) || lex->ch == '.') ||
62+
while ((is_letter(lexer->ch) || is_numeric(lexer->ch) || lexer->ch == '.') ||
6363
// signed numbers will match with this condition
64-
((lex->ch == '-' || lex->ch == '+') && is_numeric(__LEXER_peek_next_char(lex)))) {
65-
__LEXER_consume_char(lex);
64+
((lexer->ch == '-' || lexer->ch == '+') && is_numeric(__LEXER_peek_next_char(lexer)))) {
65+
__LEXER_consume_char(lexer);
6666
}
6767

68-
int length = lex->position - position;
68+
int length = lexer->position - position;
6969

7070
char* result = malloc(length + 1);
7171
if (result == NULL) {
7272
return NULL;
7373
}
7474

75-
memcpy(result, lex->input + position, length + 1);
75+
memcpy(result, lexer->input + position, length + 1);
7676

7777
result[length] = '\0';
7878

@@ -90,8 +90,8 @@ char* __LEXER_read_sequence(struct Lexer *lex) {
9090
*
9191
* @return void
9292
*/
93-
void __LEXER_jump_whitespace(struct Lexer* lex) {
94-
while (lex->ch == ' ' || lex->ch == '\t' || lex->ch == '\n' || lex->ch == '\r') {
95-
__LEXER_consume_char(lex);
93+
void __LEXER_jump_whitespace(struct Lexer* lexer) {
94+
while (lexer->ch == ' ' || lexer->ch == '\t' || lexer->ch == '\n' || lexer->ch == '\r') {
95+
__LEXER_consume_char(lexer);
9696
}
9797
}

0 commit comments

Comments
 (0)