Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/scanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ typedef enum {
#endif

typedef struct {
int16_t row;
int32_t row;
int16_t col;
int16_t blk_imp_row;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
int16_t blk_imp_row;
int32_t blk_imp_row;

int16_t blk_imp_col;
Expand All @@ -153,9 +153,9 @@ typedef struct {
Array(int16_t) ind_len_stk;

// temp
int16_t end_row;
int32_t end_row;
int16_t end_col;
int16_t cur_row;
int32_t cur_row;
int16_t cur_col;
int32_t cur_chr;
int8_t sch_stt;
Expand All @@ -164,8 +164,8 @@ typedef struct {

static unsigned serialize(Scanner *scanner, char *buffer) {
size_t size = 0;
*(int16_t *)&buffer[size] = scanner->row;
size += sizeof(int16_t);
*(int32_t *)&buffer[size] = scanner->row;
size += sizeof(int32_t);
*(int16_t *)&buffer[size] = scanner->col;
size += sizeof(int16_t);
*(int16_t *)&buffer[size] = scanner->blk_imp_row;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
*(int16_t *)&buffer[size] = scanner->blk_imp_row;
*(int32_t *)&buffer[size] = scanner->blk_imp_row;

Expand Down Expand Up @@ -198,8 +198,8 @@ static void deserialize(Scanner *scanner, const char *buffer, unsigned length) {
array_push(&scanner->ind_len_stk, -1);
if (length > 0) {
size_t size = 0;
scanner->row = *(int16_t *)&buffer[size];
size += sizeof(int16_t);
scanner->row = *(int32_t *)&buffer[size];
size += sizeof(int32_t);
scanner->col = *(int16_t *)&buffer[size];
size += sizeof(int16_t);
scanner->blk_imp_row = *(int16_t *)&buffer[size];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
scanner->blk_imp_row = *(int16_t *)&buffer[size];
scanner->blk_imp_row = *(int32_t *)&buffer[size];

Expand Down Expand Up @@ -885,7 +885,7 @@ static bool scan(Scanner *scanner, TSLexer *lexer, const bool *valid_symbols) {
return false;
}

int16_t bgn_row = scanner->cur_row;
int32_t bgn_row = scanner->cur_row;
int16_t bgn_col = scanner->cur_col;
int32_t bgn_chr = lexer->lookahead;

Expand Down