miniRT
By Marcelo Magalhães and Ygor G. Sena, 2023.
s_scanner Struct Reference

Represents a scanner. More...

#include <parser.h>

Data Fields

int line
 
const char * start
 
const char * consume
 
const char * current
 
const char * message
 
const char * sync
 

Detailed Description

Represents a scanner.

The scanner structure is used for scanning and tokenizing input text.

The scanning process is performed using two pointers, consume and current, which need to be kept separate. While current reads from the input and checks if the character sequence is correct, consume remains pointing to the beginning of the portion being verified. This eliminates the need to split the input into pieces and allows for precise identification of the section of input that needs to be converted.

Parameters
lineStores the line number being read.
startA pointer to the first character of the line.
consumeA pointer passed to the number conversion functions.
currentA pointer used for reading character by character.
messageA pointer to the current error message, if any.