Cthulhu  0.2.10
Cthulhu compiler collection
scan.c File Reference
#include "scan/scan.h"
#include "core/text.h"
#include "base/panic.h"
#include "base/util.h"
#include "arena/arena.h"
#include "io/io.h"
Include dependency graph for scan.c:

Go to the source code of this file.

Functions

STA_DECL scan_tscan_builtin (const char *language, arena_t *arena)
 create a builtin scanner More...
 
STA_DECL bool scan_is_builtin (const scan_t *scan)
 check if a scanner is the builtin scanner More...
 
STA_DECL const char * scan_language (const scan_t *scan)
 get the source language of a scanner More...
 
STA_DECL const char * scan_path (const scan_t *scan)
 get the path of a scanner More...
 
STA_DECL void scan_set (scan_t *scan, void *value)
 set the compiled object of a scanner More...
 
STA_DECL void * scan_get (scan_t *scan)
 get the compiled object from a scanner More...
 
STA_DECL void scan_set_context (scan_t *scan, void *value)
 get the context of a scanner More...
 
STA_DECL void * scan_get_context (const scan_t *scan)
 get the context of a scanner More...
 
STA_DECL text_view_t scan_source (const scan_t *scan)
 get a text span of the scanners contents More...
 
STA_DECL CT_NOALIAS size_t scan_read (scan_t *scan, void *dst, size_t size)
 
STA_DECL arena_tscan_get_arena (const scan_t *scan)
 get the arena of a scanner More...
 
STA_DECL scan_tscan_io (const char *language, io_t *io, arena_t *arena)
 create a scanner from an io source More...
 

Function Documentation

◆ scan_builtin()

STA_DECL scan_t* scan_builtin ( const char *  language,
arena_t arena 
)

create a builtin scanner

Parameters
languagethe language of the scanner
arenathe allocator to use
Returns
the builtin scanner

Definition at line 33 of file scan.c.

◆ scan_get()

STA_DECL void* scan_get ( scan_t scan)

get the compiled object from a scanner

Parameters
scanthe scanner to get the user data of
Returns
the user data of scan

Definition at line 72 of file scan.c.

◆ scan_get_arena()

STA_DECL arena_t* scan_get_arena ( const scan_t scan)

get the arena of a scanner

Parameters
scanthe scanner to get the arena of
Returns
the arena of scan

Definition at line 113 of file scan.c.

◆ scan_get_context()

STA_DECL void* scan_get_context ( const scan_t scan)

get the context of a scanner

Parameters
scanthe scanner to get the context of
Returns
the context of scan

Definition at line 88 of file scan.c.

◆ scan_io()

STA_DECL scan_t* scan_io ( const char *  language,
io_t io,
arena_t arena 
)

create a scanner from an io source

Parameters
languagethe language of the source
iothe io source to use
arenathe allocator to use
Returns
the created scanner

Definition at line 121 of file scan.c.

◆ scan_is_builtin()

STA_DECL bool scan_is_builtin ( const scan_t scan)

check if a scanner is the builtin scanner

Parameters
scanthe scanner to check
Returns
true if scan is the builtin scanner

Definition at line 41 of file scan.c.

◆ scan_language()

STA_DECL const char* scan_language ( const scan_t scan)

get the source language of a scanner

Parameters
scanthe scanner to get the language of
Returns
the language of scan

Definition at line 48 of file scan.c.

◆ scan_path()

STA_DECL const char* scan_path ( const scan_t scan)

get the path of a scanner

Parameters
scanthe scanner to get the path of
Returns
the path of scan

Definition at line 56 of file scan.c.

◆ scan_read()

STA_DECL CT_NOALIAS size_t scan_read ( scan_t scan,
void *  dst,
size_t  size 
)

Definition at line 104 of file scan.c.

◆ scan_set()

STA_DECL void scan_set ( scan_t scan,
void *  value 
)

set the compiled object of a scanner

Parameters
scanthe scanner to set the user data of
valuethe new user data

Definition at line 64 of file scan.c.

◆ scan_set_context()

STA_DECL void scan_set_context ( scan_t scan,
void *  value 
)

get the context of a scanner

Parameters
scanthe scanner to get the context of
valuethe new context

Definition at line 80 of file scan.c.

◆ scan_source()

STA_DECL text_view_t scan_source ( const scan_t scan)

get a text span of the scanners contents

Parameters
scanthe scanner to get the text of
Returns
the text of scan

Definition at line 96 of file scan.c.