Aprepro 5.0x
apr_scanner.cc File Reference
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <errno.h>
#include <iostream>
#include <FlexLexer.h>
#include <assert.h>
#include <fcntl.h>
#include <fstream>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "apr_getline.h"
#include "apr_scanner.h"
#include "apr_tokenize.h"
#include "apr_util.h"
#include "aprepro.h"
#include "fmt/format.h"
#include "fmt/ostream.h"
#include "fmt/ranges.h"

Classes

struct  yy_buffer_state
struct  yy_trans_info

Namespaces

namespace  SEAMS
namespace  anonymous_namespace{apr_scanner.cc}

Macros

#define YY_INT_ALIGNED   short int
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION   2
#define YY_FLEX_MINOR_VERSION   5
#define YY_FLEX_SUBMINOR_VERSION   39
#define yyFlexLexer   SEAMSFlexLexer
#define FLEXINT_H
#define INT8_MIN   (-128)
#define INT16_MIN   (-32767 - 1)
#define INT32_MIN   (-2147483647 - 1)
#define INT8_MAX   (127)
#define INT16_MAX   (32767)
#define INT32_MAX   (2147483647)
#define UINT8_MAX   (255U)
#define UINT16_MAX   (65535U)
#define UINT32_MAX   (4294967295U)
#define yyconst
#define YY_NULL   0
#define YY_SC_TO_UI(c)
#define BEGIN   (yy_start) = 1 + 2 *
#define YY_START   (((yy_start) - 1) / 2)
#define YYSTATE   YY_START
#define YY_STATE_EOF(state)
#define YY_NEW_FILE   yyrestart(yyin)
#define YY_END_OF_BUFFER_CHAR   0
#define YY_BUF_SIZE   16384
#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
#define YY_TYPEDEF_YY_BUFFER_STATE
#define YY_TYPEDEF_YY_SIZE_T
#define EOB_ACT_CONTINUE_SCAN   0
#define EOB_ACT_END_OF_FILE   1
#define EOB_ACT_LAST_MATCH   2
#define YY_LESS_LINENO(n)
#define YY_LINENO_REWIND_TO(ptr)
#define yyless(n)
#define unput(c)
#define YY_STRUCT_YY_BUFFER_STATE
#define YY_BUFFER_NEW   0
#define YY_BUFFER_NORMAL   1
#define YY_BUFFER_EOF_PENDING   2
#define YY_CURRENT_BUFFER   ((yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)] : NULL)
#define YY_CURRENT_BUFFER_LVALUE   (yy_buffer_stack)[(yy_buffer_stack_top)]
#define yy_new_buffer   yy_create_buffer
#define yy_set_interactive(is_interactive)
#define yy_set_bol(at_bol)
#define YY_AT_BOL()
#define FLEX_DEBUG
#define yytext_ptr   yytext
#define YY_INTERACTIVE
#define YY_DO_BEFORE_ACTION
#define YY_NUM_RULES   105
#define YY_END_OF_BUFFER   106
#define REJECT   reject_used_but_not_detected
#define yymore()
#define YY_MORE_ADJ   0
#define YY_RESTORE_YY_MORE_OFFSET
#define YY_NO_UNISTD_H
#define yyterminate()
#define MAX_IF_NESTING   1024
#define YY_USER_ACTION   curr_index += yyleng;
#define INITIAL   0
#define PARSING   1
#define GET_FILENAME   2
#define IF_SKIP   3
#define GET_VAR   4
#define VERBATIM   5
#define IF_WHILE_SKIP   6
#define GET_LOOP_VAR   7
#define LOOP   8
#define LOOP_SKIP   9
#define END_CASE_SKIP   10
#define YY_EXTRA_TYPE   void *
#define YY_READ_BUF_SIZE   8192
#define ECHO   LexerOutput(yytext, yyleng)
#define YY_INPUT(buf, result, max_size)
#define YY_START_STACK_INCR   25
#define YY_FATAL_ERROR(msg)
#define YY_BREAK   break;
#define YY_RULE_SETUP   YY_USER_ACTION
#define YY_EXIT_FAILURE   2
#define yyless(n)
#define YYTABLES_NAME   "yytables"

Typedefs

typedef signed char flex_int8_t
typedef short int flex_int16_t
typedef int flex_int32_t
typedef unsigned char flex_uint8_t
typedef unsigned short int flex_uint16_t
typedef unsigned int flex_uint32_t
typedef struct yy_buffer_stateYY_BUFFER_STATE
typedef size_t yy_size_t
typedef unsigned char YY_CHAR
typedef SEAMS::Parser::token token
typedef SEAMS::Parser::token_type token_type

Functions

void * SEAMSalloc (yy_size_t)
void * SEAMSrealloc (void *, yy_size_t)
void SEAMSfree (void *)
void SEAMS::yyerror (const char *s)
bool anonymous_namespace{apr_scanner.cc}::string_is_ascii (const char *line, size_t len)
 if (!(yy_init))

Variables

yy_size_t yyleng
static yyconst flex_int16_t yy_accept [750]
static yyconst flex_int32_t yy_ec [256]
static yyconst flex_int32_t yy_meta [75]
static yyconst flex_int16_t yy_base [800]
static yyconst flex_int16_t yy_def [800]
static yyconst flex_int16_t yy_nxt [3019]
static yyconst flex_int16_t yy_chk [3019]
static yyconst flex_int16_t yy_rule_linenum [105]
bool anonymous_namespace{apr_scanner.cc}::begin_double_brace = false
bool anonymous_namespace{apr_scanner.cc}::end_double_brace = false
int file_must_exist = 0
SEAMS::file_recouter_file = nullptr
int loop_lvl = 0
std::fstream * tmp_file
const char * temp_f
int if_state [MAX_IF_NESTING] = {0}
int if_case_run [MAX_IF_NESTING] = {false}
int if_lvl = 0
int if_skip_level = 0
bool suppress_nl = false
bool switch_active = false
bool switch_case_run = false
bool switch_skip_to_endcase = false
double switch_condition = 0.0
int curr_index = 0
std::string history_string
size_t hist_start = 0
 YY_DECL
char * yy_cp
char * yy_bp
int yy_act

Macro Definition Documentation

◆ BEGIN

#define BEGIN   (yy_start) = 1 + 2 *

◆ ECHO

#define ECHO   LexerOutput(yytext, yyleng)

◆ END_CASE_SKIP

#define END_CASE_SKIP   10

◆ EOB_ACT_CONTINUE_SCAN

#define EOB_ACT_CONTINUE_SCAN   0

◆ EOB_ACT_END_OF_FILE

#define EOB_ACT_END_OF_FILE   1

◆ EOB_ACT_LAST_MATCH

#define EOB_ACT_LAST_MATCH   2

◆ FLEX_DEBUG

#define FLEX_DEBUG

◆ FLEX_SCANNER

#define FLEX_SCANNER

◆ FLEXINT_H

#define FLEXINT_H

◆ GET_FILENAME

#define GET_FILENAME   2

◆ GET_LOOP_VAR

#define GET_LOOP_VAR   7

◆ GET_VAR

#define GET_VAR   4

◆ IF_SKIP

#define IF_SKIP   3

◆ IF_WHILE_SKIP

#define IF_WHILE_SKIP   6

◆ INITIAL

#define INITIAL   0

◆ INT16_MAX

#define INT16_MAX   (32767)

◆ INT16_MIN

#define INT16_MIN   (-32767 - 1)

◆ INT32_MAX

#define INT32_MAX   (2147483647)

◆ INT32_MIN

#define INT32_MIN   (-2147483647 - 1)

◆ INT8_MAX

#define INT8_MAX   (127)

◆ INT8_MIN

#define INT8_MIN   (-128)

◆ LOOP

#define LOOP   8

◆ LOOP_SKIP

#define LOOP_SKIP   9

◆ MAX_IF_NESTING

#define MAX_IF_NESTING   1024

◆ PARSING

#define PARSING   1

◆ REJECT

#define REJECT   reject_used_but_not_detected

◆ UINT16_MAX

#define UINT16_MAX   (65535U)

◆ UINT32_MAX

#define UINT32_MAX   (4294967295U)

◆ UINT8_MAX

#define UINT8_MAX   (255U)

◆ unput

#define unput ( c)
Value:
yyunput(c, (yytext_ptr))
#define yytext_ptr
Definition apr_scanner.cc:370

◆ VERBATIM

#define VERBATIM   5

◆ YY_AT_BOL

#define YY_AT_BOL ( )
Value:
#define YY_CURRENT_BUFFER_LVALUE
Definition apr_scanner.cc:326

◆ YY_BREAK

#define YY_BREAK   break;

◆ YY_BUF_SIZE

#define YY_BUF_SIZE   16384

◆ YY_BUFFER_EOF_PENDING

#define YY_BUFFER_EOF_PENDING   2

◆ YY_BUFFER_NEW

#define YY_BUFFER_NEW   0

◆ YY_BUFFER_NORMAL

#define YY_BUFFER_NORMAL   1

◆ YY_CURRENT_BUFFER

#define YY_CURRENT_BUFFER   ((yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)] : NULL)

◆ YY_CURRENT_BUFFER_LVALUE

#define YY_CURRENT_BUFFER_LVALUE   (yy_buffer_stack)[(yy_buffer_stack_top)]

◆ YY_DO_BEFORE_ACTION

#define YY_DO_BEFORE_ACTION
Value:
/* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */ \
yyleng = (size_t)(yy_cp - yy_bp); \
(yy_hold_char) = *yy_cp; \
*yy_cp = '\0'; \
/* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */ \
(yy_c_buf_p) = yy_cp;
yy_size_t yyleng
char * yy_cp
Definition apr_scanner.cc:1301
char * yy_bp
Definition apr_scanner.cc:1301

◆ YY_END_OF_BUFFER

#define YY_END_OF_BUFFER   106

◆ YY_END_OF_BUFFER_CHAR

#define YY_END_OF_BUFFER_CHAR   0

◆ YY_EXIT_FAILURE

#define YY_EXIT_FAILURE   2

◆ YY_EXTRA_TYPE

#define YY_EXTRA_TYPE   void *

◆ YY_FATAL_ERROR

#define YY_FATAL_ERROR ( msg)
Value:
LexerError(msg)

◆ YY_FLEX_MAJOR_VERSION

#define YY_FLEX_MAJOR_VERSION   2

◆ YY_FLEX_MINOR_VERSION

#define YY_FLEX_MINOR_VERSION   5

◆ YY_FLEX_SUBMINOR_VERSION

#define YY_FLEX_SUBMINOR_VERSION   39

◆ YY_INPUT

#define YY_INPUT ( buf,
result,
max_size )
Value:
/* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */ \
\
/* %if-c++-only C++ definition \ */ \
if ((result = LexerInput((char *)buf, max_size)) < 0) \
YY_FATAL_ERROR("input in flex scanner failed");

◆ YY_INT_ALIGNED

#define YY_INT_ALIGNED   short int

◆ YY_INTERACTIVE

#define YY_INTERACTIVE

◆ YY_LESS_LINENO

#define YY_LESS_LINENO ( n)

◆ YY_LINENO_REWIND_TO

#define YY_LINENO_REWIND_TO ( ptr)

◆ YY_MORE_ADJ

#define YY_MORE_ADJ   0

◆ yy_new_buffer

#define yy_new_buffer   yy_create_buffer

◆ YY_NEW_FILE

#define YY_NEW_FILE   yyrestart(yyin)

◆ YY_NO_UNISTD_H

#define YY_NO_UNISTD_H

◆ YY_NULL

#define YY_NULL   0

◆ YY_NUM_RULES

#define YY_NUM_RULES   105

◆ YY_READ_BUF_SIZE

#define YY_READ_BUF_SIZE   8192

◆ YY_RESTORE_YY_MORE_OFFSET

#define YY_RESTORE_YY_MORE_OFFSET

◆ YY_RULE_SETUP

#define YY_RULE_SETUP   YY_USER_ACTION

◆ YY_SC_TO_UI

#define YY_SC_TO_UI ( c)
Value:
((unsigned int)(unsigned char)c)

◆ yy_set_bol

#define yy_set_bol ( at_bol)
Value:
{ \
yyensure_buffer_stack(); \
YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE); \
} \
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
}
#define YY_CURRENT_BUFFER
Definition apr_scanner.cc:321
#define YY_BUF_SIZE
Definition apr_scanner.cc:191

◆ yy_set_interactive

#define yy_set_interactive ( is_interactive)
Value:
{ \
yyensure_buffer_stack(); \
YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE); \
} \
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
}

◆ YY_START

#define YY_START   (((yy_start) - 1) / 2)

◆ YY_START_STACK_INCR

#define YY_START_STACK_INCR   25

◆ YY_STATE_BUF_SIZE

#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))

◆ YY_STATE_EOF

#define YY_STATE_EOF ( state)
Value:
(YY_END_OF_BUFFER + state + 1)
#define YY_END_OF_BUFFER
Definition apr_scanner.cc:394

◆ YY_STRUCT_YY_BUFFER_STATE

#define YY_STRUCT_YY_BUFFER_STATE

◆ YY_TYPEDEF_YY_BUFFER_STATE

#define YY_TYPEDEF_YY_BUFFER_STATE

◆ YY_TYPEDEF_YY_SIZE_T

#define YY_TYPEDEF_YY_SIZE_T

◆ YY_USER_ACTION

#define YY_USER_ACTION   curr_index += yyleng;

◆ yyconst

#define yyconst

◆ yyFlexLexer

#define yyFlexLexer   SEAMSFlexLexer

◆ yyless [1/2]

#define yyless ( n)
Value:
do { \
/* Undo effects of setting up yytext. */ \
int yyless_macro_arg = (n); \
YY_LESS_LINENO(yyless_macro_arg); \
*yy_cp = (yy_hold_char); \
YY_RESTORE_YY_MORE_OFFSET(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
YY_DO_BEFORE_ACTION; /* set up yytext again */ \
} while (0)
#define YY_MORE_ADJ
Definition apr_scanner.cc:1045
#define YY_DO_BEFORE_ACTION
Definition apr_scanner.cc:383

◆ yyless [2/2]

#define yyless ( n)
Value:
do { \
/* Undo effects of setting up yytext. */ \
int yyless_macro_arg = (n); \
YY_LESS_LINENO(yyless_macro_arg); \
yytext[yyleng] = (yy_hold_char); \
(yy_c_buf_p) = yytext + yyless_macro_arg; \
(yy_hold_char) = *(yy_c_buf_p); \
*(yy_c_buf_p) = '\0'; \
yyleng = yyless_macro_arg; \
} while (0)

◆ yymore

#define yymore ( )
Value:
yymore_used_but_not_detected

◆ YYSTATE

#define YYSTATE   YY_START

◆ YYTABLES_NAME

#define YYTABLES_NAME   "yytables"

◆ yyterminate

#define yyterminate ( )
Value:
return token::END
@ END
Definition aprepro_parser.h:218

◆ yytext_ptr

#define yytext_ptr   yytext

Typedef Documentation

◆ flex_int16_t

typedef short int flex_int16_t

◆ flex_int32_t

typedef int flex_int32_t

◆ flex_int8_t

typedef signed char flex_int8_t

◆ flex_uint16_t

typedef unsigned short int flex_uint16_t

◆ flex_uint32_t

typedef unsigned int flex_uint32_t

◆ flex_uint8_t

typedef unsigned char flex_uint8_t

◆ token

◆ token_type

◆ YY_BUFFER_STATE

◆ YY_CHAR

typedef unsigned char YY_CHAR

◆ yy_size_t

typedef size_t yy_size_t

Function Documentation

◆ if()

if ( ! yy_init)

◆ SEAMSalloc()

void * SEAMSalloc ( yy_size_t )

◆ SEAMSfree()

void SEAMSfree ( void * )

◆ SEAMSrealloc()

void * SEAMSrealloc ( void * ,
yy_size_t  )

Variable Documentation

◆ curr_index

int curr_index = 0

◆ file_must_exist

int file_must_exist = 0

◆ hist_start

size_t hist_start = 0

◆ history_string

std::string history_string

◆ if_case_run

int if_case_run[MAX_IF_NESTING] = {false}

◆ if_lvl

int if_lvl = 0

◆ if_skip_level

int if_skip_level = 0

◆ if_state

int if_state[MAX_IF_NESTING] = {0}

◆ loop_lvl

int loop_lvl = 0

◆ outer_file

SEAMS::file_rec* outer_file = nullptr

◆ suppress_nl

bool suppress_nl = false

◆ switch_active

bool switch_active = false

◆ switch_case_run

bool switch_case_run = false

◆ switch_condition

double switch_condition = 0.0

◆ switch_skip_to_endcase

bool switch_skip_to_endcase = false

◆ temp_f

const char* temp_f

◆ tmp_file

std::fstream* tmp_file

◆ yy_accept

yyconst flex_int16_t yy_accept[750]
static

◆ yy_act

int yy_act

◆ yy_base

yyconst flex_int16_t yy_base[800]
static

◆ yy_bp

char * yy_bp

◆ yy_chk

yyconst flex_int16_t yy_chk[3019]
static

◆ yy_cp

char* yy_cp

◆ YY_DECL

YY_DECL
Initial value:
{
yy_state_type yy_current_state
int yy_state_type
Definition FlexLexer.h:56

The main scanner function which does all the work.

◆ yy_def

yyconst flex_int16_t yy_def[800]
static

◆ yy_ec

yyconst flex_int32_t yy_ec[256]
static
Initial value:
= {
0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16, 17, 18, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 22, 23, 24, 25,
26, 1, 27, 28, 29, 30, 31, 32, 33, 34, 35, 33, 33, 36, 37, 38, 39, 40, 41, 42, 43,
44, 45, 46, 33, 47, 33, 33, 48, 49, 50, 51, 33, 1, 52, 53, 54, 55,
56, 57, 33, 58, 59, 33, 33, 60, 33, 61, 62, 63, 64, 65, 66, 67, 68, 33, 69, 70, 33,
33, 71, 72, 73, 74, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}

◆ yy_meta

yyconst flex_int32_t yy_meta[75]
static
Initial value:
= {0, 1, 2, 3, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 5, 6, 1, 1, 1, 1, 1, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1, 1, 1, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2, 1, 1, 1}

◆ yy_nxt

yyconst flex_int16_t yy_nxt[3019]
static

◆ yy_rule_linenum

yyconst flex_int16_t yy_rule_linenum[105]
static
Initial value:
= {
0, 124, 125, 126, 127, 132, 134, 135, 136, 137, 138, 140, 141, 143, 149, 240, 264,
270, 291, 298, 309, 314, 328, 333, 340, 363, 374, 376, 390, 404, 419, 429, 454, 460,
465, 470, 475, 485, 493, 501, 510, 538, 559, 560, 561, 562, 564, 569, 594, 596, 598,
637, 638, 641, 643, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663,
664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680,
681, 682, 683, 684, 685, 686, 687, 693, 699, 711, 737, 739, 741, 758, 774, 775,
785, 788, 789, 791}

◆ yyleng

yy_size_t yyleng
extern