Normed lexer
This commit is contained in:
parent
5ebadce4f8
commit
4a8fb259dc
7 changed files with 191 additions and 158 deletions
|
|
@ -13,20 +13,20 @@
|
|||
#include "me/types.h"
|
||||
#include "parser/lexer.h"
|
||||
|
||||
bool ts_lexer__eof(const TSLexer *_self);
|
||||
t_u32 ts_lexer__get_column(TSLexer *_self);
|
||||
void ts_lexer__advance(TSLexer *_self, bool skip);
|
||||
void ts_lexer__do_advance(Lexer *self, bool skip);
|
||||
void ts_lexer__clear_chunk(Lexer *self);
|
||||
void ts_lexer__get_chunk(Lexer *self);
|
||||
void ts_lexer__get_lookahead(Lexer *self);
|
||||
void ts_lexer__mark_end(TSLexer *_self);
|
||||
void ts_lexer_advance_to_end(Lexer *self);
|
||||
void ts_lexer_goto(Lexer *self, Length position);
|
||||
bool ts_lexer__eof(const TSLexer *_self);
|
||||
t_u32 ts_lexer__get_column(TSLexer *_self);
|
||||
void ts_lexer__advance(TSLexer *_self, bool skip);
|
||||
void ts_lexer__do_advance(Lexer *self, bool skip);
|
||||
void ts_lexer__clear_chunk(Lexer *self);
|
||||
void ts_lexer__get_chunk(Lexer *self);
|
||||
void ts_lexer__get_lookahead(Lexer *self);
|
||||
void ts_lexer__mark_end(TSLexer *_self);
|
||||
void ts_lexer_advance_to_end(Lexer *self);
|
||||
void ts_lexer_goto(Lexer *self, Length position);
|
||||
|
||||
// Clear the currently stored chunk of source code, because the lexer's
|
||||
// position has changed.
|
||||
void ts_lexer__clear_chunk(Lexer *self)
|
||||
void ts_lexer__clear_chunk(Lexer *self)
|
||||
{
|
||||
self->chunk = NULL;
|
||||
self->chunk_size = 0;
|
||||
|
|
@ -35,10 +35,12 @@ void ts_lexer__clear_chunk(Lexer *self)
|
|||
|
||||
// Call the lexer's input callback to obtain a new chunk of source code
|
||||
// for the current position.
|
||||
void ts_lexer__get_chunk(Lexer *self)
|
||||
void ts_lexer__get_chunk(Lexer *self)
|
||||
{
|
||||
self->chunk_start = self->current_position.bytes;
|
||||
self->chunk = self->input.read(self->input.payload, self->current_position.bytes, self->current_position.extent, &self->chunk_size);
|
||||
self->chunk = self->input.read(self->input.payload,
|
||||
self->current_position.bytes, self->current_position.extent,
|
||||
&self->chunk_size);
|
||||
if (!self->chunk_size)
|
||||
{
|
||||
self->current_included_range_index = self->included_range_count;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue