Leonardus
Loading...
Searching...
No Matches
Macros | Functions | Variables
parser.l File Reference

The interpreter pass 1 in a single flex file. More...

#include <stdio.h>
#include <string.h>
#include <libgen.h>
#include <errno.h>
#include <quadmath.h>
#include "dry.h"
+ Include dependency graph for parser.l:

Macros

#define MAXSTRINGLEN   100000
 Maximum length of strings accepted and written to leon-format output.
 
#define MAXNAMELEN   1000
 Maximum length of names accepted and written to leon-format output.
 
#define MAXVOCNESTING   16
 Maximum nesting of vocabularies.
 

Functions

static void unbackslash (char *p_str)
 String Cleaning.
 
static char * norm_check_int (char *p_str)
 Normalization and range check for a string representation of an 128 bit integer.
 
static int check_real (char *p_str)
 Range check for a string representation of an 128 bit float.
 
int yylex (void)
 The generated scanner.
 
static enum ExitCode commandline (int argc, char **argv)
 Command line parsing.
 
int main (int argc, char *argv[])
 main().
 
int yywrap (void)
 yywrap().
 

Variables

static int g_verbose = 0
 Global option "verbose".
 
static int g_linebuffer = 0
 Global option "line buffering".
 
static int g_helpprinted = 0
 Global status help printed

 
static char INT128_MAGNITUDE [] = "170141183460469231731687303715884105728"
 The absolute value of the smallest negative 128 bit integer.
 
static char * g_basename = NULL
 My program file name.
 
static char * g_dirname = NULL
 My program path name.
 
static char * g_vocdir1 = NULL
 The path to the vocabularies.
 
static char * g_vocdir2 = NULL
 The path to the vocabularies.
 
static YY_BUFFER_STATE g_buffer_stack [MAXVOCNESTING]
 A stack of buffers for the vocabulary nesting.
 
static FILE * g_file_stack [MAXVOCNESTING]
 A stack of FILE * for the vocabulary nesting.
 
static int g_buffer_stack_top = -1
 Index into the stacks of buffers and FILE * for the vocabulary nesting.
 

Detailed Description

The interpreter pass 1 in a single flex file.

Function Documentation

◆ check_real()

static int check_real ( char *  p_str)
static

Range check for a string representation of an 128 bit float.

Parameters
[in]p_str... String to check
Returns
0 for a valid string ERANGE for overflows, underflows and general errors.

◆ norm_check_int()

static char * norm_check_int ( char *  p_str)
static

Normalization and range check for a string representation of an 128 bit integer.

Format of p_str is: [-]?[0-9]+

Parameters
[in]p_str... String to check
Returns
Points somewhere into the normalized p_str buffer.
Is NULL if the range check fails.

◆ unbackslash()

static void unbackslash ( char *  p_str)
static

String Cleaning.

Removes all single backslashes from the string p_str, preserving double backslashes (\) and newline sequences (
). These are the only escape sequences recognized in the leon-format format.

Variable Documentation

◆ g_vocdir1

char* g_vocdir1 = NULL
static

The path to the vocabularies.

Version 1.

◆ g_vocdir2

char* g_vocdir2 = NULL
static

The path to the vocabularies.

Version 2.