libsapling  0.8.0
Typedefs | Functions
terminal.h File Reference

Terminal implementation. More...

Go to the source code of this file.

Typedefs

typedef struct terminal * terminal_t
 

Functions

terminal_t new_terminal (int id, const char *lexeme)
 Allocates a new terminal on the heap. More...
 
void delete_terminal (terminal_t ref)
 Frees the memory previously allocated on the heap for a terminal with new_terminal.
 
int terminal__id (terminal_t ref)
 Returns the terminal's grammar symbol identifier. More...
 
const char * terminal__lexeme (terminal_t ref)
 Returns the terminal's associated lexeme. More...
 

Detailed Description

Terminal implementation.

Function Documentation

◆ new_terminal()

terminal_t new_terminal ( int  id,
const char *  lexeme 
)

Allocates a new terminal on the heap.

Parameters
idThe terminal's grammar symbol identifier.
lexemeThe terminal's associated lexeme.
Returns
pointer to the allocated terminal.

◆ terminal__id()

int terminal__id ( terminal_t  ref)

Returns the terminal's grammar symbol identifier.

Returns
the terminal's grammar symbol identifier.

◆ terminal__lexeme()

const char* terminal__lexeme ( terminal_t  ref)

Returns the terminal's associated lexeme.

Returns
the terminal's associated lexeme.