GnuCOBOL  2.0
A free COBOL compiler
pplex.c File Reference
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include "config.h"
#include <ctype.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "cobc.h"
#include "ppparse.h"
Include dependency graph for pplex.c:

Go to the source code of this file.

Data Structures

struct  yy_buffer_state
 
struct  yy_trans_info
 
struct  copy_info
 
struct  plex_stack
 

Macros

#define YY_INT_ALIGNED   short int
 
#define yy_create_buffer   pp_create_buffer
 
#define yy_delete_buffer   pp_delete_buffer
 
#define yy_flex_debug   pp_flex_debug
 
#define yy_init_buffer   pp_init_buffer
 
#define yy_flush_buffer   pp_flush_buffer
 
#define yy_load_buffer_state   pp_load_buffer_state
 
#define yy_switch_to_buffer   pp_switch_to_buffer
 
#define yyin   ppin
 
#define yyleng   ppleng
 
#define yylex   pplex
 
#define yylineno   pplineno
 
#define yyout   ppout
 
#define yyrestart   pprestart
 
#define yytext   pptext
 
#define yywrap   ppwrap
 
#define yyalloc   ppalloc
 
#define yyrealloc   pprealloc
 
#define yyfree   ppfree
 
#define FLEX_SCANNER
 
#define YY_FLEX_MAJOR_VERSION   2
 
#define YY_FLEX_MINOR_VERSION   5
 
#define YY_FLEX_SUBMINOR_VERSION   39
 
#define FLEX_BETA
 
#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)   ((unsigned int) (unsigned char) c)
 
#define BEGIN   (yy_start) = 1 + 2 *
 
#define YY_START   (((yy_start) - 1) / 2)
 
#define YYSTATE   YY_START
 
#define YY_STATE_EOF(state)   (YY_END_OF_BUFFER + state + 1)
 
#define YY_NEW_FILE   pprestart(ppin )
 
#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)   yyunput( c, (yytext_ptr) )
 
#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
 
#define YY_CURRENT_BUFFER_LVALUE   (yy_buffer_stack)[(yy_buffer_stack_top)]
 
#define YY_FLUSH_BUFFER   pp_flush_buffer(YY_CURRENT_BUFFER )
 
#define yy_new_buffer   pp_create_buffer
 
#define yy_set_interactive(is_interactive)
 
#define yy_set_bol(at_bol)
 
#define YY_AT_BOL()   (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
 
#define yytext_ptr   pptext
 
#define YY_DO_BEFORE_ACTION
 
#define YY_NUM_RULES   156
 
#define YY_END_OF_BUFFER   157
 
#define REJECT   reject_used_but_not_detected
 
#define yymore()   yymore_used_but_not_detected
 
#define YY_MORE_ADJ   0
 
#define YY_RESTORE_YY_MORE_OFFSET
 
#define YY_READ_BUF_SIZE   32768
 
#define YY_BUF_SIZE   32768
 
#define YY_SKIP_YYWRAP
 
#define PPLEX_BUFF_LEN   512
 
#define YY_INPUT(buf, result, max_size)   result = ppinput (buf, max_size);
 
#define ECHO   fputs (pptext, ppout)
 
#define YY_USER_INIT
 
#define YY_NO_UNISTD_H   1
 
#define COB_IN_PPLEX   1
 
#define PLEX_COND_DEPTH   16
 
#define INITIAL   0
 
#define COPY_STATE   1
 
#define PSEUDO_STATE   2
 
#define SOURCE_DIRECTIVE_STATE   3
 
#define DEFINE_DIRECTIVE_STATE   4
 
#define SET_DIRECTIVE_STATE   5
 
#define TURN_DIRECTIVE_STATE   6
 
#define IF_DIRECTIVE_STATE   7
 
#define ELSE_DIRECTIVE_STATE   8
 
#define ENDIF_DIRECTIVE_STATE   9
 
#define YY_EXTRA_TYPE   void *
 
#define yyterminate()   return YY_NULL
 
#define YY_START_STACK_INCR   25
 
#define YY_FATAL_ERROR(msg)   yy_fatal_error( msg )
 
#define YY_DECL_IS_OURS   1
 
#define YY_DECL   int pplex (void)
 
#define YY_USER_ACTION
 
#define YY_BREAK   break;
 
#define YY_RULE_SETUP
 
#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 int yy_state_type
 

Functions

void pprestart (FILE *input_file)
 Immediately switch to a different input stream. More...
 
void pp_switch_to_buffer (YY_BUFFER_STATE new_buffer)
 Switch to a different input buffer. More...
 
YY_BUFFER_STATE pp_create_buffer (FILE *file, int size)
 Allocate and initialize an input buffer state. More...
 
void pp_delete_buffer (YY_BUFFER_STATE b)
 Destroy the buffer. More...
 
void pp_flush_buffer (YY_BUFFER_STATE b)
 Discard all buffered characters. More...
 
void pppush_buffer_state (YY_BUFFER_STATE new_buffer)
 Pushes the new state onto the stack. More...
 
void pppop_buffer_state (void)
 Removes and deletes the top of the stack, if present. More...
 
static void ppensure_buffer_stack (void)
 
static void pp_load_buffer_state (void)
 
static void pp_init_buffer (YY_BUFFER_STATE b, FILE *file)
 
YY_BUFFER_STATE pp_scan_buffer (char *base, yy_size_t size)
 
YY_BUFFER_STATE pp_scan_string (char *yy_str)
 
YY_BUFFER_STATE pp_scan_bytes (char *bytes, yy_size_t len)
 
void * ppalloc (yy_size_t)
 
void * pprealloc (void *, yy_size_t)
 
void ppfree (void *)
 
static yy_state_type yy_get_previous_state (void)
 
static yy_state_type yy_try_NUL_trans (yy_state_type current_state)
 
static int yy_get_next_buffer (void)
 
static void yy_fatal_error (char msg[])
 
static int ppwrap (void)
 
static int ppinput (char *, const size_t)
 
static void ppecho (const char *, const cob_u32_t, const int)
 
static void switch_to_buffer (const int, const char *, const YY_BUFFER_STATE)
 
static void check_listing (const char *, const unsigned int)
 
static void skip_to_eol (void)
 
static void display_to_eol (void)
 
static void check_comments (const char *, const char *)
 
static int yy_init_globals (void)
 Get the current token. More...
 
int pplex_destroy (void)
 
static void yyunput (int c, char *buf_ptr)
 
static int input (void)
 
static void yy_push_state (int new_state)
 
static void yy_pop_state (void)
 
int pplex (void)
 The main scanner function which does all the work. More...
 
static void yyunput (int c, register char *yy_bp)
 
static void yy_fatal_error (char *msg)
 
void pp_set_replace_list (struct cb_replace_list *list, const cob_u32_t is_pushpop)
 
int ppopen (const char *name, struct cb_replace_list *replacing_list)
 
int ppcopy (const char *name, const char *lib, struct cb_replace_list *replace_list)
 
void ppparse_error (const char *msg)
 
void plex_clear_vars (void)
 
void plex_clear_all (void)
 
void plex_call_destroy (void)
 
void plex_action_directive (const unsigned int cmdtype, const unsigned int is_true)
 
static struct cb_text_listpp_text_list_add (struct cb_text_list *list, const char *text, const size_t size)
 

Variables

yy_size_t ppleng
 
FILE * ppin = (FILE *) 0
 
FILE * ppout = (FILE *) 0
 
static size_t yy_buffer_stack_top = 0
 index of top of stack. More...
 
static size_t yy_buffer_stack_max = 0
 capacity of stack. More...
 
static YY_BUFFER_STATEyy_buffer_stack = 0
 Stack as an array. More...
 
static char yy_hold_char
 
static yy_size_t yy_n_chars
 
static char * yy_c_buf_p = (char *) 0
 
static int yy_init = 0
 
static int yy_start = 0
 
static int yy_did_buffer_switch_on_eof
 
int pplineno = 1
 
char * pptext
 
static flex_int16_t yy_accept [1082]
 
static flex_int32_t yy_ec [256]
 
static flex_int32_t yy_meta [74]
 
static flex_int16_t yy_base [1183]
 
static flex_int16_t yy_def [1183]
 
static flex_int16_t yy_nxt [5374]
 
static flex_int16_t yy_chk [5374]
 
static yy_state_type yy_last_accepting_state
 
static char * yy_last_accepting_cpos
 
int pp_flex_debug = 0
 
static char * plexbuff1 = ((void*)0)
 
static char * plexbuff2 = ((void*)0)
 
static size_t newline_count = 0
 
static size_t within_comment = 0
 
static size_t inside_bracket = 0
 
static size_t consecutive_quotation = 0
 
static size_t need_continuation = 0
 
static size_t buffer_overflow = 0
 
static size_t comment_allowed
 
static unsigned int plex_skip_input = 0
 
static unsigned int plex_nest_depth = 0
 
static int quotation_mark = 0
 
static int listing_line = 0
 
static int requires_listing_line
 
static int requires_new_line = 0
 
static struct cb_replace_listcurrent_replace_list = ((void*)0)
 
static struct cb_replace_listsave_current_replace = ((void*)0)
 
static struct cb_replace_listbase_replace_list = ((void*)0)
 
static struct cb_text_listtext_queue = ((void*)0)
 
static struct copy_infocopy_stack = ((void*)0)
 
static struct plex_stack plex_cond_stack [16]
 
static int yy_start_stack_ptr = 0
 
static int yy_start_stack_depth = 0
 
static int * yy_start_stack = ((void*)0)
 

Macro Definition Documentation

#define BEGIN   (yy_start) = 1 + 2 *

Definition at line 146 of file pplex.c.

Referenced by pplex(), yy_pop_state(), and yy_push_state().

#define COB_IN_PPLEX   1

Definition at line 2101 of file pplex.c.

#define COPY_STATE   1

Definition at line 2178 of file pplex.c.

Referenced by pplex().

#define DEFINE_DIRECTIVE_STATE   4

Definition at line 2181 of file pplex.c.

Referenced by pplex().

#define ECHO   fputs (pptext, ppout)

Definition at line 2074 of file pplex.c.

Referenced by pplex().

#define ELSE_DIRECTIVE_STATE   8

Definition at line 2185 of file pplex.c.

Referenced by pplex().

#define ENDIF_DIRECTIVE_STATE   9

Definition at line 2186 of file pplex.c.

Referenced by pplex().

#define EOB_ACT_CONTINUE_SCAN   0

Definition at line 194 of file pplex.c.

Referenced by input(), pplex(), and yy_get_next_buffer().

#define EOB_ACT_END_OF_FILE   1

Definition at line 195 of file pplex.c.

Referenced by input(), pplex(), and yy_get_next_buffer().

#define EOB_ACT_LAST_MATCH   2

Definition at line 196 of file pplex.c.

Referenced by input(), pplex(), and yy_get_next_buffer().

#define FLEX_BETA

Definition at line 33 of file pplex.c.

#define FLEX_SCANNER

Definition at line 28 of file pplex.c.

#define FLEXINT_H

Definition at line 49 of file pplex.c.

#define IF_DIRECTIVE_STATE   7

Definition at line 2184 of file pplex.c.

Referenced by pplex().

#define INITIAL   0

Definition at line 2177 of file pplex.c.

Referenced by pplex().

#define INT16_MAX   (32767)

Definition at line 92 of file pplex.c.

#define INT16_MIN   (-32767-1)

Definition at line 83 of file pplex.c.

#define INT32_MAX   (2147483647)

Definition at line 95 of file pplex.c.

#define INT32_MIN   (-2147483647-1)

Definition at line 86 of file pplex.c.

#define INT8_MAX   (127)

Definition at line 89 of file pplex.c.

#define INT8_MIN   (-128)

Definition at line 80 of file pplex.c.

#define PLEX_COND_DEPTH   16

Definition at line 2105 of file pplex.c.

Referenced by plex_action_directive().

#define PPLEX_BUFF_LEN   512

Definition at line 2072 of file pplex.c.

Referenced by ppinput().

#define PSEUDO_STATE   2

Definition at line 2179 of file pplex.c.

Referenced by pplex().

#define REJECT   reject_used_but_not_detected

Definition at line 2036 of file pplex.c.

#define SET_DIRECTIVE_STATE   5

Definition at line 2182 of file pplex.c.

Referenced by pplex().

#define SOURCE_DIRECTIVE_STATE   3

Definition at line 2180 of file pplex.c.

Referenced by pplex().

#define TURN_DIRECTIVE_STATE   6

Definition at line 2183 of file pplex.c.

Referenced by pplex().

#define UINT16_MAX   (65535U)

Definition at line 101 of file pplex.c.

#define UINT32_MAX   (4294967295U)

Definition at line 104 of file pplex.c.

#define UINT8_MAX   (255U)

Definition at line 98 of file pplex.c.

#define unput (   c)    yyunput( c, (yytext_ptr) )

Definition at line 215 of file pplex.c.

Referenced by display_to_eol(), pplex(), and skip_to_eol().

#define YY_AT_BOL ( )    (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)

Definition at line 361 of file pplex.c.

Referenced by pplex(), and yy_get_previous_state().

#define YY_BREAK   break;

Definition at line 2341 of file pplex.c.

Referenced by pplex().

#define YY_BUF_SIZE   16384

Definition at line 2065 of file pplex.c.

Referenced by pplex(), ppopen(), and pprestart().

#define YY_BUF_SIZE   32768

Definition at line 2065 of file pplex.c.

#define YY_BUFFER_EOF_PENDING   2

Definition at line 277 of file pplex.c.

Referenced by yy_get_next_buffer().

#define YY_BUFFER_NEW   0

Definition at line 265 of file pplex.c.

Referenced by pp_flush_buffer(), and pplex().

#define YY_BUFFER_NORMAL   1

Definition at line 266 of file pplex.c.

Referenced by pplex().

#define yy_create_buffer   pp_create_buffer

Definition at line 9 of file pplex.c.

#define YY_CURRENT_BUFFER
Value:
: NULL)
static YY_BUFFER_STATE * yy_buffer_stack
Stack as an array.
Definition: pplex.c:285
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
static size_t yy_buffer_stack_top
index of top of stack.
Definition: pplex.c:283

Definition at line 293 of file pplex.c.

Referenced by pp_delete_buffer(), pp_flush_buffer(), pp_init_buffer(), pp_switch_to_buffer(), pplex(), pplex_destroy(), ppopen(), pppop_buffer_state(), pppush_buffer_state(), and pprestart().

#define YY_DECL   int pplex (void)

Definition at line 2329 of file pplex.c.

#define YY_DECL_IS_OURS   1

Definition at line 2325 of file pplex.c.

#define yy_delete_buffer   pp_delete_buffer

Definition at line 10 of file pplex.c.

#define YY_DO_BEFORE_ACTION
Value:
(yytext_ptr) = yy_bp; \
ppleng = (size_t) (yy_cp - yy_bp); \
(yy_hold_char) = *yy_cp; \
*yy_cp = '\0'; \
(yy_c_buf_p) = yy_cp;
static char yy_hold_char
Definition: pplex.c:303
yy_size_t ppleng
Definition: pplex.c:305
#define yytext_ptr
Definition: pplex.c:376
static char * yy_c_buf_p
Definition: pplex.c:308

Definition at line 386 of file pplex.c.

Referenced by pplex().

#define YY_END_OF_BUFFER   157

Definition at line 394 of file pplex.c.

Referenced by pplex().

#define YY_END_OF_BUFFER_CHAR   0

Definition at line 161 of file pplex.c.

Referenced by input(), pp_flush_buffer(), and yy_get_next_buffer().

#define YY_EXIT_FAILURE   2

Definition at line 4249 of file pplex.c.

Referenced by yy_fatal_error().

#define YY_EXTRA_TYPE   void *

Definition at line 2197 of file pplex.c.

#define YY_FATAL_ERROR (   msg)    yy_fatal_error( msg )
int yy_flex_debug   pp_flex_debug

Definition at line 11 of file pplex.c.

#define YY_FLEX_MAJOR_VERSION   2

Definition at line 29 of file pplex.c.

#define YY_FLEX_MINOR_VERSION   5

Definition at line 30 of file pplex.c.

#define YY_FLEX_SUBMINOR_VERSION   39

Definition at line 31 of file pplex.c.

#define yy_flush_buffer   pp_flush_buffer

Definition at line 13 of file pplex.c.

#define YY_FLUSH_BUFFER   pp_flush_buffer(YY_CURRENT_BUFFER )

Definition at line 329 of file pplex.c.

#define yy_init_buffer   pp_init_buffer

Definition at line 12 of file pplex.c.

#define YY_INPUT (   buf,
  result,
  max_size 
)    result = ppinput (buf, max_size);

Definition at line 2073 of file pplex.c.

Referenced by yy_get_next_buffer().

#define YY_INT_ALIGNED   short int

Definition at line 5 of file pplex.c.

#define YY_LESS_LINENO (   n)

Definition at line 198 of file pplex.c.

#define YY_LINENO_REWIND_TO (   ptr)

Definition at line 199 of file pplex.c.

#define yy_load_buffer_state   pp_load_buffer_state

Definition at line 14 of file pplex.c.

#define YY_MORE_ADJ   0

Definition at line 2038 of file pplex.c.

Referenced by pplex(), yy_get_next_buffer(), and yy_get_previous_state().

#define yy_new_buffer   pp_create_buffer

Definition at line 339 of file pplex.c.

#define YY_NEW_FILE   pprestart(ppin )

Definition at line 159 of file pplex.c.

Referenced by input(), and pplex().

#define YY_NO_UNISTD_H   1

Definition at line 2094 of file pplex.c.

#define YY_NULL   0

Definition at line 133 of file pplex.c.

Referenced by ppinput().

#define YY_NUM_RULES   156

Definition at line 393 of file pplex.c.

#define YY_READ_BUF_SIZE   32768

Definition at line 2063 of file pplex.c.

Referenced by yy_get_next_buffer().

#define YY_RESTORE_YY_MORE_OFFSET

Definition at line 2039 of file pplex.c.

Referenced by pplex().

#define YY_RULE_SETUP
Value:
if ( ppleng > 0 ) \
(pptext[ppleng - 1] == '\n'); \
#define YY_USER_ACTION
Definition: pplex.c:2336
#define YY_CURRENT_BUFFER_LVALUE
Definition: pplex.c:300
yy_size_t ppleng
Definition: pplex.c:305
char * pptext
Definition: pplex.c:2040

Definition at line 2344 of file pplex.c.

Referenced by pplex().

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

Definition at line 140 of file pplex.c.

Referenced by pplex(), and yy_get_previous_state().

#define yy_set_bol (   at_bol)
Value:
{ \
} \
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
}
#define YY_CURRENT_BUFFER_LVALUE
Definition: pplex.c:300
YY_BUFFER_STATE pp_create_buffer(FILE *file, int size)
Allocate and initialize an input buffer state.
Definition: pplex.c:4020
#define YY_CURRENT_BUFFER
Definition: pplex.c:293
FILE * ppin
Definition: pplex.c:367
#define YY_BUF_SIZE
Definition: pplex.c:2065
static void ppensure_buffer_stack(void)
Definition: pplex.c:4173

Definition at line 351 of file pplex.c.

#define yy_set_interactive (   is_interactive)
Value:
{ \
if ( ! YY_CURRENT_BUFFER ){ \
} \
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
}
#define YY_CURRENT_BUFFER_LVALUE
Definition: pplex.c:300
YY_BUFFER_STATE pp_create_buffer(FILE *file, int size)
Allocate and initialize an input buffer state.
Definition: pplex.c:4020
#define YY_CURRENT_BUFFER
Definition: pplex.c:293
FILE * ppin
Definition: pplex.c:367
#define YY_BUF_SIZE
Definition: pplex.c:2065
static void ppensure_buffer_stack(void)
Definition: pplex.c:4173

Definition at line 341 of file pplex.c.

#define YY_SKIP_YYWRAP

Definition at line 2067 of file pplex.c.

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

Definition at line 152 of file pplex.c.

Referenced by pplex(), and yy_push_state().

#define YY_START_STACK_INCR   25

Definition at line 2311 of file pplex.c.

Referenced by yy_push_state().

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

Definition at line 178 of file pplex.c.

#define YY_STATE_EOF (   state)    (YY_END_OF_BUFFER + state + 1)

Definition at line 156 of file pplex.c.

Referenced by pplex().

#define YY_STRUCT_YY_BUFFER_STATE

Definition at line 218 of file pplex.c.

#define yy_switch_to_buffer   pp_switch_to_buffer

Definition at line 15 of file pplex.c.

#define YY_TYPEDEF_YY_BUFFER_STATE

Definition at line 181 of file pplex.c.

#define YY_TYPEDEF_YY_SIZE_T

Definition at line 186 of file pplex.c.

#define YY_USER_ACTION

Definition at line 2336 of file pplex.c.

#define YY_USER_INIT
Value:
if (!plexbuff1) { \
} \
if (!plexbuff2) { \
} \
#define COB_SMALL_BUFF
Definition: common.h:540
static int requires_listing_line
Definition: pplex.c:2142
static char * plexbuff2
Definition: pplex.c:2130
static char * plexbuff1
Definition: pplex.c:2129
void * cobc_malloc(const size_t size)
Definition: cobc.c:643
static size_t comment_allowed
Definition: pplex.c:2137

Definition at line 2076 of file pplex.c.

Referenced by pplex().

Definition at line 24 of file pplex.c.

#define yyconst

Definition at line 129 of file pplex.c.

#define yyfree   ppfree

Definition at line 26 of file pplex.c.

FILE * yyin   ppin

Definition at line 16 of file pplex.c.

Referenced by cobc_clean_up(), main(), and process_translate().

yy_size_t yyleng   ppleng

Definition at line 17 of file pplex.c.

#define yyless (   n)
Value:
do \
{ \
/* Undo effects of setting up pptext. */ \
int yyless_macro_arg = (n); \
YY_LESS_LINENO(yyless_macro_arg);\
*yy_cp = (yy_hold_char); \
(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
YY_DO_BEFORE_ACTION; /* set up pptext again */ \
} \
while ( 0 )
#define YY_DO_BEFORE_ACTION
Definition: pplex.c:386
static char yy_hold_char
Definition: pplex.c:303
#define YY_LESS_LINENO(n)
Definition: pplex.c:198
static char * yy_c_buf_p
Definition: pplex.c:308
#define YY_MORE_ADJ
Definition: pplex.c:2038
#define YY_RESTORE_YY_MORE_OFFSET
Definition: pplex.c:2039

Definition at line 4261 of file pplex.c.

#define yyless (   n)
Value:
do \
{ \
/* Undo effects of setting up pptext. */ \
int yyless_macro_arg = (n); \
YY_LESS_LINENO(yyless_macro_arg);\
(yy_c_buf_p) = pptext + yyless_macro_arg; \
*(yy_c_buf_p) = '\0'; \
ppleng = yyless_macro_arg; \
} \
while ( 0 )
static char yy_hold_char
Definition: pplex.c:303
yy_size_t ppleng
Definition: pplex.c:305
char * pptext
Definition: pplex.c:2040
#define YY_LESS_LINENO(n)
Definition: pplex.c:198
static char * yy_c_buf_p
Definition: pplex.c:308

Definition at line 4261 of file pplex.c.

#define yylex   pplex

Definition at line 18 of file pplex.c.

Referenced by yyparse().

int yylineno   pplineno

Definition at line 19 of file pplex.c.

#define yymore ( )    yymore_used_but_not_detected

Definition at line 2037 of file pplex.c.

FILE * yyout   ppout

Definition at line 20 of file pplex.c.

Referenced by cobc_clean_up(), codegen(), main(), and process_translate().

#define yyrealloc   pprealloc

Definition at line 25 of file pplex.c.

#define yyrestart   pprestart

Definition at line 21 of file pplex.c.

#define YYSTATE   YY_START

Definition at line 153 of file pplex.c.

#define YYTABLES_NAME   "yytables"

Definition at line 4385 of file pplex.c.

#define yyterminate ( )    return YY_NULL

Definition at line 2306 of file pplex.c.

Referenced by pplex().

char * yytext   pptext

Definition at line 22 of file pplex.c.

#define yytext_ptr   pptext
#define yywrap   ppwrap

Definition at line 23 of file pplex.c.

Typedef Documentation

typedef short int flex_int16_t

Definition at line 72 of file pplex.c.

typedef int flex_int32_t

Definition at line 73 of file pplex.c.

typedef signed char flex_int8_t

Definition at line 71 of file pplex.c.

typedef unsigned short int flex_uint16_t

Definition at line 75 of file pplex.c.

typedef unsigned int flex_uint32_t

Definition at line 76 of file pplex.c.

typedef unsigned char flex_uint8_t

Definition at line 74 of file pplex.c.

Definition at line 182 of file pplex.c.

typedef unsigned char YY_CHAR

Definition at line 365 of file pplex.c.

typedef size_t yy_size_t

Definition at line 187 of file pplex.c.

typedef int yy_state_type

Definition at line 369 of file pplex.c.

Function Documentation

static void check_comments ( const char *  keyword,
const char *  text 
)
static

Definition at line 5305 of file pplex.c.

References cb_verify(), ppecho(), ppleng, and skip_to_eol().

Referenced by pplex().

5306 {
5307  /* Treated as comments when in Identification Division */
5308  if (comment_allowed) {
5309  cb_verify (cb_comment_paragraphs, keyword);
5310  /* Skip comments until the end of line. */
5311  within_comment = 1;
5312  skip_to_eol ();
5313  } else {
5314  ppecho (text, 0, ppleng);
5315  }
5316 }
static void ppecho(const char *, const cob_u32_t, const int)
Definition: pplex.c:5117
unsigned int cb_verify(const enum cb_support, const char *)
Definition: error.c:246
yy_size_t ppleng
Definition: pplex.c:305
static size_t within_comment
Definition: pplex.c:2132
static void skip_to_eol(void)
Definition: pplex.c:5268
static size_t comment_allowed
Definition: pplex.c:2137

Here is the call graph for this function:

Here is the caller graph for this function:

static void check_listing ( const char *  text,
const unsigned int  comment 
)
static

Definition at line 5319 of file pplex.c.

References CB_FORMAT_FIXED, cb_listing_file, cb_source_format, cobc_gen_listing, and cb_text_list::text.

Referenced by ppecho(), and pplex().

5320 {
5321  const char *s;
5322  char c;
5323 
5324  /* Check for listing */
5325  if (!cb_listing_file) {
5326  /* Nothing to do */
5327  return;
5328  }
5329  if (!text) {
5330  return;
5331  }
5332  if (cobc_gen_listing > 1) {
5333  /* Passed to cobxref */
5334  fputs (text, cb_listing_file);
5335  return;
5336  }
5337  if (comment) {
5338  c = '*';
5339  } else {
5340  c = ' ';
5341  }
5342 
5343  if (requires_listing_line) {
5344  if (requires_new_line) {
5345  requires_new_line = 0;
5346  putc ('\n', cb_listing_file);
5347  }
5348  fprintf (cb_listing_file, "%6d%c", ++listing_line, c);
5349  }
5350 
5352  strlen (text) > 6) {
5353  s = &text[6];
5354  } else {
5355  s = text;
5356  }
5357  fputs (s, cb_listing_file);
5358  if (strchr (text, '\n')) {
5360  } else {
5362  }
5363 }
FILE * cb_listing_file
Definition: cobc.c:157
int cb_source_format
Definition: cobc.c:162
static int requires_listing_line
Definition: pplex.c:2142
static int listing_line
Definition: pplex.c:2141
unsigned int cobc_gen_listing
Definition: cobc.c:180
#define CB_FORMAT_FIXED
Definition: cobc.h:65
static int requires_new_line
Definition: pplex.c:2143

Here is the caller graph for this function:

static void display_to_eol ( void  )
static

Definition at line 5284 of file pplex.c.

References input(), and unput.

Referenced by pplex().

5285 {
5286  int c;
5287 
5288  while ((c = input ()) != EOF) {
5289  if (c == '\n') {
5290  break;
5291  }
5292  if (!plex_skip_input) {
5293  putchar (c);
5294  }
5295  }
5296  if (!plex_skip_input) {
5297  putchar ('\n');
5298  }
5299  if (c != EOF) {
5300  unput (c);
5301  }
5302 }
static int input(void)
Definition: pplex.c:3881
#define unput(c)
Definition: pplex.c:215
static unsigned int plex_skip_input
Definition: pplex.c:2138

Here is the call graph for this function:

Here is the caller graph for this function:

static int input ( void  )
static

Definition at line 3881 of file pplex.c.

References EOB_ACT_CONTINUE_SCAN, EOB_ACT_END_OF_FILE, EOB_ACT_LAST_MATCH, ppin, pprestart(), ppwrap(), yy_c_buf_p, YY_CURRENT_BUFFER_LVALUE, yy_did_buffer_switch_on_eof, YY_END_OF_BUFFER_CHAR, yy_get_next_buffer(), yy_hold_char, yy_n_chars, YY_NEW_FILE, and yytext_ptr.

Referenced by display_to_eol(), and skip_to_eol().

3884 {
3885  int c;
3886 
3887  *(yy_c_buf_p) = (yy_hold_char);
3888 
3889  if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
3890  {
3891  /* yy_c_buf_p now points to the character we want to return.
3892  * If this occurs *before* the EOB characters, then it's a
3893  * valid NUL; if not, then we've hit the end of the buffer.
3894  */
3895  if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
3896  /* This was really a NUL. */
3897  *(yy_c_buf_p) = '\0';
3898 
3899  else
3900  { /* need more input */
3901  yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
3902  ++(yy_c_buf_p);
3903 
3904  switch ( yy_get_next_buffer( ) )
3905  {
3906  case EOB_ACT_LAST_MATCH:
3907  /* This happens because yy_g_n_b()
3908  * sees that we've accumulated a
3909  * token and flags that we need to
3910  * try matching the token before
3911  * proceeding. But for input(),
3912  * there's no matching to consider.
3913  * So convert the EOB_ACT_LAST_MATCH
3914  * to EOB_ACT_END_OF_FILE.
3915  */
3916 
3917  /* Reset buffer status. */
3918  pprestart(ppin );
3919 
3920  /*FALLTHROUGH*/
3921 
3922  case EOB_ACT_END_OF_FILE:
3923  {
3924  if ( ppwrap( ) )
3925  return EOF;
3926 
3927  if ( ! (yy_did_buffer_switch_on_eof) )
3928  YY_NEW_FILE;
3929 #ifdef __cplusplus
3930  return yyinput();
3931 #else
3932  return input();
3933 #endif
3934  }
3935 
3936  case EOB_ACT_CONTINUE_SCAN:
3937  (yy_c_buf_p) = (yytext_ptr) + offset;
3938  break;
3939  }
3940  }
3941  }
3942 
3943  c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
3944  *(yy_c_buf_p) = '\0'; /* preserve pptext */
3945  (yy_hold_char) = *++(yy_c_buf_p);
3946 
3947  YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
3948 
3949  return c;
3950 }
void pprestart(FILE *input_file)
Immediately switch to a different input stream.
Definition: pplex.c:3958
static int input(void)
Definition: pplex.c:3881
static int ppwrap(void)
Definition: pplex.c:2068
static char yy_hold_char
Definition: pplex.c:303
#define YY_END_OF_BUFFER_CHAR
Definition: pplex.c:161
static int yy_get_next_buffer(void)
Definition: pplex.c:3650
#define EOB_ACT_END_OF_FILE
Definition: pplex.c:195
#define EOB_ACT_CONTINUE_SCAN
Definition: pplex.c:194
#define YY_CURRENT_BUFFER_LVALUE
Definition: pplex.c:300
static yy_size_t yy_n_chars
Definition: pplex.c:304
#define yytext_ptr
Definition: pplex.c:376
static char * yy_c_buf_p
Definition: pplex.c:308
FILE * ppin
Definition: pplex.c:367
#define EOB_ACT_LAST_MATCH
Definition: pplex.c:196
#define YY_NEW_FILE
Definition: pplex.c:159
static int yy_did_buffer_switch_on_eof
Definition: pplex.c:315
size_t yy_size_t
Definition: pplex.c:187

Here is the call graph for this function:

Here is the caller graph for this function:

void plex_action_directive ( const unsigned int  cmdtype,
const unsigned int  is_true 
)

Definition at line 4589 of file pplex.c.

References _, cb_plex_error(), cb_source_line, plex_stack::cmd, COBC_ABORT, cobc_abort_pr(), plex_stack::cond, plex_stack::line, PLEX_ACT_ELIF, PLEX_ACT_ELSE, PLEX_ACT_END, PLEX_ACT_IF, PLEX_COND_DEPTH, plex_cond_stack, plex_nest_depth, and plex_stack::skip.

Referenced by ppparse().

4590 {
4591  unsigned int n;
4592 
4593  /* Action IF/ELSE/END-IF/ELIF */
4594  switch (cmdtype) {
4595  case PLEX_ACT_IF:
4596  /* Push stack - First occurrence is dummy */
4597  if (++plex_nest_depth >= PLEX_COND_DEPTH) {
4598  cobc_abort_pr (_("Directive nest depth exceeded - %d"),
4599  PLEX_COND_DEPTH);
4600  COBC_ABORT ();
4601  }
4603  /* Intersection with previous - first is always 0 */
4604  n = plex_cond_stack[plex_nest_depth - 1].skip | !is_true;
4608  plex_skip_input = n;
4609  return;
4610  case PLEX_ACT_ELSE:
4611  /* Must have an associated IF/ELIF */
4612  if (!plex_nest_depth ||
4613  plex_cond_stack[plex_nest_depth].cmd != 1) {
4615  _("ELSE directive without matching IF/ELIF"));
4616  return;
4617  }
4619  /* Reverse any IF/ELIF condition */
4623  /* Intersection with previous */
4625  return;
4626  case PLEX_ACT_END:
4627  /* Must have an associated IF/ELIF/ELSE */
4628  if (!plex_nest_depth ||
4631  _("END-IF directive without matching IF/ELIF/ELSE"));
4632  return;
4633  }
4638  /* Pop stack - set skip to previous */
4639  plex_nest_depth--;
4641  return;
4642  case PLEX_ACT_ELIF:
4643  /* Must have an associated IF/ELIF */
4644  if (!plex_nest_depth ||
4645  plex_cond_stack[plex_nest_depth].cmd != 1) {
4647  _("ELIF directive without matching IF/ELIF"));
4648  return;
4649  }
4651  if (plex_cond_stack[plex_nest_depth].cond) {
4652  /* Previous IF or one of previous ELIF was true */
4653  /* Set to skip */
4654  n = 1U;
4655  } else if (is_true) {
4656  /* Condition is true */
4658  n = 0;
4659  } else {
4660  /* Set to skip */
4661  n = 1U;
4662  }
4664  /* Intersection with previous */
4666  return;
4667  default:
4668  cobc_abort_pr (_("Invalid internal case - %u"),
4669  cmdtype);
4670  COBC_ABORT ();
4671  }
4672 }
static unsigned int plex_nest_depth
Definition: pplex.c:2139
void cobc_abort_pr(const char *fmt,...)
Definition: cobc.c:587
#define PLEX_ACT_ELIF
Definition: cobc.h:94
unsigned int skip
Definition: pplex.c:2120
#define PLEX_ACT_END
Definition: cobc.h:93
static size_t newline_count
Definition: pplex.c:2131
#define _(s)
Definition: cobcrun.c:59
#define COBC_ABORT()
Definition: cobc.h:61
unsigned int cmd
Definition: pplex.c:2119
#define PLEX_COND_DEPTH
Definition: pplex.c:2105
unsigned int cond
Definition: pplex.c:2121
int line
Definition: pplex.c:2122
int cb_source_line
Definition: cobc.c:178
#define PLEX_ACT_IF
Definition: cobc.h:91
void cb_plex_error(const size_t, const char *,...) COB_A_FORMAT23
Definition: error.c:130
static struct plex_stack plex_cond_stack[16]
Definition: pplex.c:2153
#define PLEX_ACT_ELSE
Definition: cobc.h:92
static unsigned int plex_skip_input
Definition: pplex.c:2138

Here is the call graph for this function:

Here is the caller graph for this function:

void plex_call_destroy ( void  )

Definition at line 4583 of file pplex.c.

References pplex_destroy().

Referenced by preprocess().

4584 {
4585  (void)pplex_destroy ();
4586 }
int pplex_destroy(void)
Definition: pplex.c:4314

Here is the call graph for this function:

Here is the caller graph for this function:

void plex_clear_all ( void  )

Definition at line 4570 of file pplex.c.

References cobc_free(), and NULL.

Referenced by main().

4571 {
4572  if (plexbuff1) {
4573  cobc_free (plexbuff1);
4574  plexbuff1 = NULL;
4575  }
4576  if (plexbuff2) {
4577  cobc_free (plexbuff2);
4578  plexbuff2 = NULL;
4579  }
4580 }
void cobc_free(void *mptr)
Definition: cobc.c:657
static char * plexbuff2
Definition: pplex.c:2130
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
static char * plexbuff1
Definition: pplex.c:2129

Here is the call graph for this function:

Here is the caller graph for this function:

void plex_clear_vars ( void  )

Definition at line 4559 of file pplex.c.

References plex_cond_stack.

Referenced by preprocess().

4560 {
4561  /* Reset variables */
4562  plex_skip_input = 0;
4563  plex_nest_depth = 0;
4564  memset (plex_cond_stack, 0, sizeof(plex_cond_stack));
4566  comment_allowed = 1;
4567 }
static unsigned int plex_nest_depth
Definition: pplex.c:2139
static int requires_listing_line
Definition: pplex.c:2142
static struct plex_stack plex_cond_stack[16]
Definition: pplex.c:2153
static unsigned int plex_skip_input
Definition: pplex.c:2138
static size_t comment_allowed
Definition: pplex.c:2137

Here is the caller graph for this function:

YY_BUFFER_STATE pp_create_buffer ( FILE *  file,
int  size 
)

Allocate and initialize an input buffer state.

Parameters
fileA readable stream.
sizeThe character buffer size in bytes. When in doubt, use YY_BUF_SIZE.
Returns
the allocated buffer state.

Definition at line 4020 of file pplex.c.

References pp_init_buffer(), ppalloc(), yy_buffer_state::yy_buf_size, yy_buffer_state::yy_ch_buf, YY_FATAL_ERROR, and yy_buffer_state::yy_is_our_buffer.

Referenced by pplex(), ppopen(), and pprestart().

4021 {
4022  YY_BUFFER_STATE b;
4023 
4024  b = (YY_BUFFER_STATE) ppalloc(sizeof( struct yy_buffer_state ) );
4025  if ( ! b )
4026  YY_FATAL_ERROR( "out of dynamic memory in pp_create_buffer()" );
4027 
4028  b->yy_buf_size = size;
4029 
4030  /* yy_ch_buf has to be 2 characters longer than the size given because
4031  * we need to put in 2 end-of-buffer characters.
4032  */
4033  b->yy_ch_buf = (char *) ppalloc(b->yy_buf_size + 2 );
4034  if ( ! b->yy_ch_buf )
4035  YY_FATAL_ERROR( "out of dynamic memory in pp_create_buffer()" );
4036 
4037  b->yy_is_our_buffer = 1;
4038 
4039  pp_init_buffer(b,file );
4040 
4041  return b;
4042 }
struct yy_buffer_state * YY_BUFFER_STATE
Definition: pplex.c:182
void * ppalloc(yy_size_t)
Definition: pplex.c:4363
yy_size_t yy_buf_size
Definition: pplex.c:229
if fold fold static computed alternate extra correct stack on syntax debugging source implicit stack syntax write single recursive relax optional file
Definition: flag.def:129
static void pp_init_buffer(YY_BUFFER_STATE b, FILE *file)
Definition: pplex.c:4067
char * yy_ch_buf
Definition: pplex.c:223
int yy_is_our_buffer
Definition: pplex.c:240
#define YY_FATAL_ERROR(msg)
Definition: pplex.c:2316
cob_u32_t size
Definition: tree.h:594

Here is the call graph for this function:

Here is the caller graph for this function:

void pp_delete_buffer ( YY_BUFFER_STATE  b)

Destroy the buffer.

Parameters
ba buffer created with pp_create_buffer()

Definition at line 4048 of file pplex.c.

References ppfree(), yy_buffer_state::yy_ch_buf, YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, and yy_buffer_state::yy_is_our_buffer.

Referenced by pplex(), pplex_destroy(), and pppop_buffer_state().

4049 {
4050 
4051  if ( ! b )
4052  return;
4053 
4054  if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
4056 
4057  if ( b->yy_is_our_buffer )
4058  ppfree((void *) b->yy_ch_buf );
4059 
4060  ppfree((void *) b );
4061 }
struct yy_buffer_state * YY_BUFFER_STATE
Definition: pplex.c:182
#define YY_CURRENT_BUFFER_LVALUE
Definition: pplex.c:300
void ppfree(void *)
Definition: pplex.c:4380
#define YY_CURRENT_BUFFER
Definition: pplex.c:293
char * yy_ch_buf
Definition: pplex.c:223
int yy_is_our_buffer
Definition: pplex.c:240

Here is the call graph for this function:

Here is the caller graph for this function:

void pp_flush_buffer ( YY_BUFFER_STATE  b)

Discard all buffered characters.

On the next scan, YY_INPUT will be called.

Parameters
bthe buffer state to be flushed, usually YY_CURRENT_BUFFER.

Definition at line 4095 of file pplex.c.

References pp_load_buffer_state(), yy_buffer_state::yy_at_bol, yy_buffer_state::yy_buf_pos, YY_BUFFER_NEW, yy_buffer_state::yy_buffer_status, yy_buffer_state::yy_ch_buf, YY_CURRENT_BUFFER, YY_END_OF_BUFFER_CHAR, and yy_buffer_state::yy_n_chars.

Referenced by pp_init_buffer().

4096 {
4097  if ( ! b )
4098  return;
4099 
4100  b->yy_n_chars = 0;
4101 
4102  /* We always need two end-of-buffer characters. The first causes
4103  * a transition to the end-of-buffer state. The second causes
4104  * a jam in that state.
4105  */
4108 
4109  b->yy_buf_pos = &b->yy_ch_buf[0];
4110 
4111  b->yy_at_bol = 1;
4113 
4114  if ( b == YY_CURRENT_BUFFER )
4116 }
char * yy_buf_pos
Definition: pplex.c:224
#define YY_END_OF_BUFFER_CHAR
Definition: pplex.c:161
#define YY_BUFFER_NEW
Definition: pplex.c:265
yy_size_t yy_n_chars
Definition: pplex.c:234
int yy_at_bol
Definition: pplex.c:253
#define YY_CURRENT_BUFFER
Definition: pplex.c:293
char * yy_ch_buf
Definition: pplex.c:223
static void pp_load_buffer_state(void)
Definition: pplex.c:4006
int yy_buffer_status
Definition: pplex.c:263

Here is the call graph for this function:

Here is the caller graph for this function:

static void pp_init_buffer ( YY_BUFFER_STATE  b,
FILE *  file 
)
static

Definition at line 4067 of file pplex.c.

References file, pp_flush_buffer(), yy_buffer_state::yy_bs_column, yy_buffer_state::yy_bs_lineno, YY_CURRENT_BUFFER, yy_buffer_state::yy_fill_buffer, yy_buffer_state::yy_input_file, and yy_buffer_state::yy_is_interactive.

Referenced by pp_create_buffer(), and pprestart().

4069 {
4070  int oerrno = errno;
4071 
4072  pp_flush_buffer(b );
4073 
4074  b->yy_input_file = file;
4075  b->yy_fill_buffer = 1;
4076 
4077  /* If b is the current buffer, then pp_init_buffer was _probably_
4078  * called from pprestart() or through yy_get_next_buffer.
4079  * In that case, we don't want to reset the lineno or column.
4080  */
4081  if (b != YY_CURRENT_BUFFER){
4082  b->yy_bs_lineno = 1;
4083  b->yy_bs_column = 0;
4084  }
4085 
4086  b->yy_is_interactive = 0;
4087 
4088  errno = oerrno;
4089 }
FILE * yy_input_file
Definition: pplex.c:221
int yy_fill_buffer
Definition: pplex.c:261
int yy_bs_lineno
The line count.
Definition: pplex.c:255
if fold fold static computed alternate extra correct stack on syntax debugging source implicit stack syntax write single recursive relax optional file
Definition: flag.def:129
int yy_bs_column
The column count.
Definition: pplex.c:256
void pp_flush_buffer(YY_BUFFER_STATE b)
Discard all buffered characters.
Definition: pplex.c:4095
#define YY_CURRENT_BUFFER
Definition: pplex.c:293
int yy_is_interactive
Definition: pplex.c:247

Here is the call graph for this function:

Here is the caller graph for this function:

static void pp_load_buffer_state ( void  )
static

Definition at line 4006 of file pplex.c.

References ppin, yy_c_buf_p, YY_CURRENT_BUFFER_LVALUE, yy_hold_char, yy_n_chars, and yytext_ptr.

Referenced by pp_flush_buffer(), pp_switch_to_buffer(), pplex(), pppop_buffer_state(), pppush_buffer_state(), and pprestart().

4007 {
4008  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
4009  (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
4010  ppin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
4011  (yy_hold_char) = *(yy_c_buf_p);
4012 }
static char yy_hold_char
Definition: pplex.c:303
#define YY_CURRENT_BUFFER_LVALUE
Definition: pplex.c:300
static yy_size_t yy_n_chars
Definition: pplex.c:304
#define yytext_ptr
Definition: pplex.c:376
static char * yy_c_buf_p
Definition: pplex.c:308
FILE * ppin
Definition: pplex.c:367

Here is the caller graph for this function:

YY_BUFFER_STATE pp_scan_buffer ( char *  base,
yy_size_t  size 
)
YY_BUFFER_STATE pp_scan_bytes ( char *  bytes,
yy_size_t  len 
)
YY_BUFFER_STATE pp_scan_string ( char *  yy_str)
void pp_set_replace_list ( struct cb_replace_list list,
const cob_u32_t  is_pushpop 
)

Definition at line 4394 of file pplex.c.

References base_replace_list, cb_replace_list::last, cb_replace_list::next, NULL, and cb_replace_list::prev.

Referenced by ppparse().

4395 {
4396  /* Handle REPLACE verb */
4397  if (!list) {
4398  /* REPLACE [LAST] OFF */
4399  if (!is_pushpop) {
4401  return;
4402  }
4403  if (!base_replace_list) {
4404  return;
4405  }
4407  return;
4408  }
4409  /* REPLACE [ALSO] ... */
4410  if (base_replace_list && is_pushpop) {
4411  list->last->next = base_replace_list;
4412  list->prev = base_replace_list;
4413  } else {
4414  list->prev = NULL;
4415  }
4416  base_replace_list = list;
4417 }
struct cb_replace_list * last
Definition: cobc.h:168
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
struct cb_replace_list * next
Definition: cobc.h:167
static struct cb_replace_list * base_replace_list
Definition: pplex.c:2147
struct cb_replace_list * prev
Definition: cobc.h:169

Here is the caller graph for this function:

void pp_switch_to_buffer ( YY_BUFFER_STATE  new_buffer)

Switch to a different input buffer.

Parameters
new_bufferThe new input buffer.

Definition at line 3975 of file pplex.c.

References pp_load_buffer_state(), ppensure_buffer_stack(), yy_c_buf_p, YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, yy_did_buffer_switch_on_eof, yy_hold_char, and yy_n_chars.

Referenced by switch_to_buffer().

3976 {
3977 
3978  /* TODO. We should be able to replace this entire function body
3979  * with
3980  * pppop_buffer_state();
3981  * pppush_buffer_state(new_buffer);
3982  */
3984  if ( YY_CURRENT_BUFFER == new_buffer )
3985  return;
3986 
3987  if ( YY_CURRENT_BUFFER )
3988  {
3989  /* Flush out information for old buffer. */
3990  *(yy_c_buf_p) = (yy_hold_char);
3991  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
3992  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
3993  }
3994 
3995  YY_CURRENT_BUFFER_LVALUE = new_buffer;
3997 
3998  /* We don't actually know whether we did this switch during
3999  * EOF (ppwrap()) processing, but the only time this flag
4000  * is looked at is after ppwrap() is called, so it's safe
4001  * to go ahead and always set it.
4002  */
4004 }
static char yy_hold_char
Definition: pplex.c:303
#define YY_CURRENT_BUFFER_LVALUE
Definition: pplex.c:300
static yy_size_t yy_n_chars
Definition: pplex.c:304
#define YY_CURRENT_BUFFER
Definition: pplex.c:293
static void pp_load_buffer_state(void)
Definition: pplex.c:4006
static char * yy_c_buf_p
Definition: pplex.c:308
static void ppensure_buffer_stack(void)
Definition: pplex.c:4173
static int yy_did_buffer_switch_on_eof
Definition: pplex.c:315

Here is the call graph for this function:

Here is the caller graph for this function:

static struct cb_text_list* pp_text_list_add ( struct cb_text_list list,
const char *  text,
const size_t  size 
)
static

Definition at line 5097 of file pplex.c.

References cobc_plex_malloc(), cb_text_list::last, cb_text_list::next, and cb_text_list::text.

Referenced by ppecho().

5099 {
5100  struct cb_text_list *p;
5101  void *tp;
5102 
5103  p = cobc_plex_malloc (sizeof (struct cb_text_list));
5104  tp = cobc_plex_malloc (size + 1);
5105  memcpy (tp, text, size);
5106  p->text = tp;
5107  if (!list) {
5108  p->last = p;
5109  return p;
5110  }
5111  list->last->next = p;
5112  list->last = p;
5113  return list;
5114 }
struct cb_text_list * next
Definition: cobc.h:160
const char * text
Definition: cobc.h:162
struct cb_text_list * last
Definition: cobc.h:161
void * cobc_plex_malloc(const size_t size)
Definition: cobc.c:916

Here is the call graph for this function:

Here is the caller graph for this function:

void * ppalloc ( yy_size_t  size)

Definition at line 4363 of file pplex.c.

Referenced by pp_create_buffer(), ppensure_buffer_stack(), and yy_push_state().

4364 {
4365  return (void *) malloc( size );
4366 }

Here is the caller graph for this function:

int ppcopy ( const char *  name,
const char *  lib,
struct cb_replace_list replace_list 
)

Definition at line 4508 of file pplex.c.

References _, cb_error(), cb_extension_list, cb_include_list, COB_SMALL_MAX, cb_text_list::next, plexbuff1, ppopen(), R_OK, and cb_text_list::text.

Referenced by ppparse().

4509 {
4510  struct cb_text_list *il;
4511  struct cb_text_list *el;
4512  const char *s;
4513 
4514  /* Locate and open COPY file */
4515  if (lib) {
4516  snprintf (plexbuff1, (size_t)COB_SMALL_MAX, "%s/%s", lib, name);
4517  plexbuff1[COB_SMALL_MAX] = 0;
4518  s = plexbuff1;
4519  } else {
4520  s = name;
4521  }
4522 
4523  /* Find the file */
4524  if (access (s, R_OK) == 0) {
4525  return ppopen (s, replace_list);
4526  }
4527 
4528  for (el = cb_extension_list; el; el = el->next) {
4529  snprintf (plexbuff2, (size_t)COB_SMALL_MAX, "%s%s", s, el->text);
4530  plexbuff2[COB_SMALL_MAX] = 0;
4531  if (access (plexbuff2, R_OK) == 0) {
4532  return ppopen (plexbuff2, replace_list);
4533  }
4534  }
4535 
4536  if (*s != '/') {
4537  for (il = cb_include_list; il; il = il->next) {
4538  for (el = cb_extension_list; el; el = el->next) {
4539  snprintf (plexbuff2, (size_t)COB_SMALL_MAX,
4540  "%s/%s%s", il->text, name, el->text);
4541  plexbuff2[COB_SMALL_MAX] = 0;
4542  if (access (plexbuff2, R_OK) == 0) {
4543  return ppopen (plexbuff2, replace_list);
4544  }
4545  }
4546  }
4547  }
4548  cb_error ("%s: %s", name, _("No such file or directory"));
4549  return -1;
4550 }
struct cb_text_list * next
Definition: cobc.h:160
struct cb_text_list * cb_extension_list
Definition: cobc.c:151
struct cb_text_list * cb_include_list
Definition: cobc.c:149
const char * text
Definition: cobc.h:162
static char * plexbuff2
Definition: pplex.c:2130
#define COB_SMALL_MAX
Definition: common.h:546
#define _(s)
Definition: cobcrun.c:59
void cb_error(const char *,...) COB_A_FORMAT12
Definition: error.c:98
int ppopen(const char *name, struct cb_replace_list *replacing_list)
Definition: pplex.c:4420
static char * plexbuff1
Definition: pplex.c:2129
#define R_OK
Definition: cobc.h:58

Here is the call graph for this function:

Here is the caller graph for this function:

static void ppecho ( const char *  text,
const cob_u32_t  alt_space,
const int  textlen 
)
static

Definition at line 5117 of file pplex.c.

References base_replace_list, cb_listing_file, CB_REPLACE_LEADING, CB_REPLACE_TRAILING, check_listing(), cobc_free(), cobc_strdup(), cb_replace_list::last, cb_replace_list::lead_trail, cb_replace_list::new_text, cb_text_list::next, cb_replace_list::next, NULL, cb_replace_list::old_text, pp_text_list_add(), ppout, pptext, cb_text_list::text, and text_queue.

Referenced by check_comments(), and pplex().

5118 {
5119  struct cb_replace_list *r;
5120  struct cb_replace_list *save_ptr;
5121  const struct cb_text_list *lno;
5122  struct cb_text_list *queue;
5123  struct cb_text_list *save_queue;
5124  const char *s;
5125  char *temp_ptr;
5126  size_t size;
5127  size_t size2;
5128 
5129  /* Check for replacement text before outputting */
5130  if (alt_space) {
5131  s = pptext;
5132  } else {
5133  s = text;
5134  }
5135 
5136  if (text_queue == NULL && (text[0] == ' ' || text[0] == '\n')) {
5137  /* No replacement */
5138  fwrite (text, (size_t)textlen, (size_t)1, ppout);
5139  if (cb_listing_file) {
5140  check_listing (s, 0);
5141  }
5142  return;
5143  }
5145  /* Ouput queue */
5146  for (; text_queue; text_queue = text_queue->next) {
5147  fputs (text_queue->text, ppout);
5148  }
5149  fwrite (text, (size_t)textlen, (size_t)1, ppout);
5150  if (cb_listing_file) {
5151  check_listing (s, 0);
5152  }
5153  return;
5154  }
5155  if (!current_replace_list) {
5157  save_ptr = NULL;
5158  } else {
5160  save_ptr = current_replace_list->last;
5161  }
5162 
5163  /* Do replacement */
5164  text_queue = pp_text_list_add (text_queue, text, (size_t)textlen);
5165 
5166  save_queue = NULL;
5167  size = 0;
5168  size2 = 0;
5169  for (r = current_replace_list; r; r = r->next) {
5170  queue = text_queue;
5171  /* The LEADING/TRAILING code looks peculiar as we use */
5172  /* variables after breaking out of the loop BUT */
5173  /* ppparse.y guarantees that we have only one token */
5174  /* and therefore only one iteration of this loop */
5175  for (lno = r->old_text; lno; lno = lno->next) {
5176  if (lno->text[0] == ' ' || lno->text[0] == '\n') {
5177  continue;
5178  }
5179  while (queue && (queue->text[0] == ' ' ||
5180  queue->text[0] == '\n')) {
5181  queue = queue->next;
5182  }
5183  if (queue == NULL) {
5184  /* Partial match */
5185  if (!save_ptr) {
5187  } else {
5188  save_ptr->next = NULL;
5189  }
5190  return;
5191  }
5192  if (r->lead_trail == CB_REPLACE_LEADING) {
5193  /* Check leading text */
5194  size = strlen (lno->text);
5195  if (strncasecmp (lno->text, queue->text, size)) {
5196  /* No match */
5197  break;
5198  }
5199  save_queue = queue;
5200  } else if (r->lead_trail == CB_REPLACE_TRAILING) {
5201  /* Check trailing text */
5202  size = strlen (lno->text);
5203  size2 = strlen (queue->text);
5204  if (size2 < size) {
5205  /* No match */
5206  break;
5207  }
5208  size2 -= size;
5209  if (strncasecmp (lno->text, queue->text + size2, size)) {
5210  /* No match */
5211  break;
5212  }
5213  save_queue = queue;
5214  } else if (strcasecmp (lno->text, queue->text)) {
5215  /* No match */
5216  break;
5217  }
5218  queue = queue->next;
5219  }
5220  if (lno == NULL) {
5221  /* Match */
5223  && save_queue /* <- silence warnings */) {
5224  /* Non-matched part of original text */
5225  fprintf (ppout, "%*.*s", (int)size2, (int)size2,
5226  save_queue->text);
5227  if (cb_listing_file) {
5228  temp_ptr = cobc_strdup (save_queue->text);
5229  *(temp_ptr + size2) = 0;
5230  check_listing (temp_ptr, 0);
5231  cobc_free (temp_ptr);
5232  }
5233  }
5234  for (lno = r->new_text; lno; lno = lno->next) {
5235  fputs (lno->text, ppout);
5236  if (cb_listing_file) {
5237  check_listing (lno->text, 0);
5238  }
5239  }
5240  if (r->lead_trail == CB_REPLACE_LEADING
5241  && save_queue /* <- silence warnings */) {
5242  /* Non-matched part of original text */
5243  fputs (save_queue->text + size, ppout);
5244  if (cb_listing_file) {
5245  check_listing (save_queue->text + size, 0);
5246  }
5247  }
5248  text_queue = queue;
5249  continue;
5250  }
5251  }
5252 
5253  /* No match */
5254  for (; text_queue; text_queue = text_queue->next) {
5255  fputs (text_queue->text, ppout);
5256  if (cb_listing_file) {
5258  }
5259  }
5260  if (!save_ptr) {
5262  } else {
5263  save_ptr->next = NULL;
5264  }
5265 }
struct cb_text_list * next
Definition: cobc.h:160
const char * text
Definition: cobc.h:162
FILE * ppout
Definition: pplex.c:367
void cobc_free(void *mptr)
Definition: cobc.c:657
FILE * cb_listing_file
Definition: cobc.c:157
#define CB_REPLACE_TRAILING
Definition: cobc.h:70
#define CB_REPLACE_LEADING
Definition: cobc.h:69
struct cb_replace_list * last
Definition: cobc.h:168
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
char * pptext
Definition: pplex.c:2040
static struct cb_text_list * text_queue
Definition: pplex.c:2149
unsigned int lead_trail
Definition: cobc.h:172
static struct cb_replace_list * current_replace_list
Definition: pplex.c:2145
void * cobc_strdup(const char *dupstr)
Definition: cobc.c:669
struct cb_replace_list * next
Definition: cobc.h:167
static struct cb_replace_list * base_replace_list
Definition: pplex.c:2147
const struct cb_text_list * old_text
Definition: cobc.h:170
const struct cb_text_list * new_text
Definition: cobc.h:171
static void check_listing(const char *, const unsigned int)
Definition: pplex.c:5319
static struct cb_text_list * pp_text_list_add(struct cb_text_list *list, const char *text, const size_t size)
Definition: pplex.c:5097

Here is the call graph for this function:

Here is the caller graph for this function:

static void ppensure_buffer_stack ( void  )
static

Definition at line 4173 of file pplex.c.

References ppalloc(), pprealloc(), yy_buffer_stack, yy_buffer_stack_max, yy_buffer_stack_top, and YY_FATAL_ERROR.

Referenced by pp_switch_to_buffer(), pplex(), pppush_buffer_state(), and pprestart().

4174 {
4175  yy_size_t num_to_alloc;
4176 
4177  if (!(yy_buffer_stack)) {
4178 
4179  /* First allocation is just for 2 elements, since we don't know if this
4180  * scanner will even need a stack. We use 2 instead of 1 to avoid an
4181  * immediate realloc on the next call.
4182  */
4183  num_to_alloc = 1;
4185  (num_to_alloc * sizeof(struct yy_buffer_state*)
4186  );
4187  if ( ! (yy_buffer_stack) )
4188  YY_FATAL_ERROR( "out of dynamic memory in ppensure_buffer_stack()" );
4189 
4190  memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
4191 
4192  (yy_buffer_stack_max) = num_to_alloc;
4193  (yy_buffer_stack_top) = 0;
4194  return;
4195  }
4196 
4197  if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
4198 
4199  /* Increase the buffer to prepare for a possible push. */
4200  int grow_size = 8 /* arbitrary grow size */;
4201 
4202  num_to_alloc = (yy_buffer_stack_max) + grow_size;
4204  ((yy_buffer_stack),
4205  num_to_alloc * sizeof(struct yy_buffer_state*)
4206  );
4207  if ( ! (yy_buffer_stack) )
4208  YY_FATAL_ERROR( "out of dynamic memory in ppensure_buffer_stack()" );
4209 
4210  /* zero only the new slots.*/
4211  memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
4212  (yy_buffer_stack_max) = num_to_alloc;
4213  }
4214 }
void * ppalloc(yy_size_t)
Definition: pplex.c:4363
static YY_BUFFER_STATE * yy_buffer_stack
Stack as an array.
Definition: pplex.c:285
static size_t yy_buffer_stack_top
index of top of stack.
Definition: pplex.c:283
static size_t yy_buffer_stack_max
capacity of stack.
Definition: pplex.c:284
#define YY_FATAL_ERROR(msg)
Definition: pplex.c:2316
void * pprealloc(void *, yy_size_t)
Definition: pplex.c:4368
size_t yy_size_t
Definition: pplex.c:187

Here is the call graph for this function:

Here is the caller graph for this function:

void ppfree ( void *  ptr)

Definition at line 4380 of file pplex.c.

Referenced by pp_delete_buffer(), and pplex_destroy().

4381 {
4382  free( (char *) ptr ); /* see pprealloc() for (char *) cast */
4383 }

Here is the caller graph for this function:

static int ppinput ( char *  buff,
const size_t  max_size 
)
static

Definition at line 4688 of file pplex.c.

References _, CB_FORMAT_FIXED, CB_FORMAT_FREE, cb_plex_error(), cb_plex_warning(), cb_source_format, cb_verify(), likely, newline_count, ppin, PPLEX_BUFF_LEN, unlikely, and YY_NULL.

4689 {
4690  char *bp;
4691  size_t gotcr;
4692  size_t line_overflow;
4693  size_t continuation;
4694  int ipchar;
4695  int i;
4696  int n;
4697  int coln;
4698 
4699  /* Read line(s) */
4700 
4701  continuation = 0;
4702 start:
4703  if (unlikely(buffer_overflow ||
4704  (newline_count + PPLEX_BUFF_LEN) >= max_size)) {
4705  if (need_continuation || continuation) {
4707  _("Buffer overrun - Too many continuation lines"));
4708  return YY_NULL;
4709  }
4710  if (newline_count < max_size) {
4711  memset (buff, '\n', newline_count);
4712  buff[newline_count] = 0;
4713  ipchar = (int)newline_count;
4714  newline_count = 0;
4715  buffer_overflow = 0;
4716  return ipchar;
4717  }
4718  buffer_overflow = 1;
4719  ipchar = max_size - 1;
4720  memset (buff, '\n', (size_t)ipchar);
4721  buff[ipchar] = 0;
4722  newline_count -= ipchar;
4723  return ipchar;
4724  }
4725  gotcr = 0;
4726  line_overflow = 0;
4727  ipchar = 0;
4728  for (n = 0; ipchar != '\n';) {
4729  if (unlikely(n == PPLEX_BUFF_LEN)) {
4730  if (line_overflow != 2) {
4731  line_overflow = 1;
4732  }
4733  }
4734  ipchar = getc (ppin);
4735  if (unlikely(ipchar == EOF)) {
4736  if (n > 0) {
4737  /* No end of line at end of file */
4738  break;
4739  }
4740  if (newline_count == 0) {
4741  return YY_NULL;
4742  }
4743  memset (buff, '\n', newline_count);
4744  buff[newline_count] = 0;
4745  ipchar = (int)newline_count;
4746  newline_count = 0;
4747  return ipchar;
4748  }
4749 #ifndef COB_EBCDIC_MACHINE
4750  if (unlikely(ipchar == 0x1A && !n)) {
4751  continue;
4752  }
4753 #endif
4754  if (unlikely(gotcr)) {
4755  gotcr = 0;
4756  if (ipchar != '\n') {
4757  if (likely(line_overflow == 0)) {
4758  buff[n++] = '\r';
4759  } else {
4760  line_overflow = 2;
4761  }
4762  }
4763  }
4764  if (unlikely(ipchar == '\r')) {
4765  gotcr = 1;
4766  continue;
4767  }
4768  if (unlikely(ipchar == '\t')) {
4769  if (likely(line_overflow == 0)) {
4770  buff[n++] = ' ';
4771  while (n % cb_tab_width != 0) {
4772  buff[n++] = ' ';
4773  }
4774  if (unlikely(n > PPLEX_BUFF_LEN)) {
4775  n = PPLEX_BUFF_LEN;
4776  }
4777  }
4778  continue;
4779  }
4780  if (likely(line_overflow == 0)) {
4781  buff[n++] = (char)ipchar;
4782  } else if ((char)ipchar != ' ' && (char)ipchar != '\n') {
4783  line_overflow = 2;
4784  }
4785  }
4786 
4787  if (buff[n - 1] != '\n') {
4788  /* FIXME: cb_source_line is one too low when CB_FORMAT_FREE is used
4789  [but only during ppinput() in pplex.l ?] - Workaround for now:
4790  Temporary newline_count + 1
4791  */
4793  if (line_overflow == 0) {
4795  _("Line not terminated by a newline"));
4796  } else if (line_overflow == 2) {
4798  _("Source text exceeds %d bytes, will be truncated"), PPLEX_BUFF_LEN);
4799  }
4800  } else {
4801  if (line_overflow == 0) {
4803  _("Line not terminated by a newline"));
4804  } else if (line_overflow == 2) {
4806  _("Source text exceeds %d bytes, will be truncated"), PPLEX_BUFF_LEN);
4807  }
4808  }
4809  buff[n++] = '\n';
4810  }
4811  buff[n] = 0;
4812 
4814  if (n < 8) {
4815  /* Line too short */
4816  newline_count++;
4817  goto start;
4818  }
4819 
4820  if (cb_flag_mfcomment) {
4821  if (buff[0] == '*' || buff[0] == '/') {
4822  newline_count++;
4823  goto start;
4824  }
4825  }
4826 
4827  /* Check if text is longer than cb_text_column */
4828  if (n > cb_text_column + 1) {
4829  /* Show warning if it is not whitespace
4830  (postponed after checking for comments by setting
4831  line_overflow to first column that leads to
4832  "source text too long")
4833  */
4834  if (cb_warn_column_overflow && line_overflow == 0) {
4835  for (coln = cb_text_column; coln < n; ++coln) {
4836  if (buff[coln] != ' ' && buff[coln] != '\n') {
4837  line_overflow = coln;
4838  break;
4839  }
4840  }
4841  } else {
4842  line_overflow = 0;
4843  }
4844  /* Remove it */
4845  buff[cb_text_column] = '\n';
4846  buff[cb_text_column + 1] = 0;
4847  n = cb_text_column + 1;
4848  } else {
4849  line_overflow = 0;
4850  }
4851 
4852  memset (buff, ' ', (size_t)6);
4853  /* Note we allow directive lines to start at column 7 */
4854  bp = &buff[6];
4855  } else {
4856  bp = buff;
4857  }
4858 
4859  /* Check for directives/floating comment at first non-space of line */
4860  ipchar = 0;
4861  i = 0;
4862  for (; *bp; bp++) {
4863  if (*bp != ' ') {
4864  if ((*bp == '$' && !(cb_source_format == CB_FORMAT_FIXED && i == 0)) ||
4865  (*bp == '>' && bp[1] == '>' ) ) {
4866  /* Directive */
4867  ipchar = 1;
4868  } else if ((*bp == '*' && bp[1] == '>' ) ||
4869  (cb_flag_acucomment && *bp == '|') ) {
4870  /* Float comment */
4871  newline_count++;
4872  goto start;
4873  }
4874  break;
4875  }
4876  i = 1;
4877  }
4878  if (ipchar) {
4879  /* Directive - pass complete line with NL to ppparse */
4880  if (newline_count) {
4881  /* Move including NL and NULL byte */
4882  memmove (buff + newline_count, buff, (size_t)(n + 1));
4883  memset (buff, '\n', newline_count);
4884  n += newline_count;
4885  newline_count = 0;
4886  }
4887  return n;
4888  }
4889 
4890  if (plex_skip_input) {
4891  /* Skipping input */
4892  newline_count++;
4893  goto start;
4894  }
4895 
4896  /* Return when free format (no floating comments removed!) */
4898  within_comment = 0;
4899  if (newline_count) {
4900  memmove (buff + newline_count, buff, (size_t)(n + 1));
4901  memset (buff, '\n', newline_count);
4902  n += newline_count;
4903  newline_count = 0;
4904  }
4905  return n;
4906  }
4907 
4908  /* Fixed format */
4909 
4910  /* Check the indicator (column 7) */
4911  if (cb_flag_acucomment && buff[6] == '$') {
4912  buff[6] = '*';
4913  }
4914  switch (buff[6]) {
4915  case ' ':
4916  break;
4917  case '-':
4918  if (unlikely(within_comment)) {
4920  _("Invalid continuation in comment entry"));
4921  newline_count++;
4922  goto start;
4923  } else if (!need_continuation) {
4924  cb_verify (cb_word_continuation, _("Continuation of COBOL words"));
4925  }
4926  continuation = 1;
4927  break;
4928  case 'd':
4929  case 'D':
4930  /* Debugging line */
4931  if (cb_flag_debugging_line) {
4932  break;
4933  }
4934  newline_count++;
4935  goto start;
4936  case '*':
4937  case '/':
4938  /* Comment line */
4939  newline_count++;
4940  goto start;
4941  default:
4942  /* Invalid indicator */
4944  _("Invalid indicator '%c' at column 7"), buff[6]);
4945  newline_count++;
4946  return YY_NULL;
4947  }
4948 
4949  /* Skip comments that follow after AUTHORS, etc. */
4950  if (unlikely(within_comment)) {
4951  /* Check all of "Area A" */
4952  for (ipchar = 7; ipchar < (n - 1) && ipchar < 11; ++ipchar) {
4953  if (buff[ipchar] != ' ') {
4954  ipchar = 0;
4955  break;
4956  }
4957  }
4958  if (ipchar) {
4959  newline_count++;
4960  goto start;
4961  }
4962  within_comment = 0;
4963  }
4964 
4965  /* Skip blank lines */
4966  for (i = 7; buff[i] == ' '; ++i) {
4967  ;
4968  }
4969 
4970  if (buff[i] == '\n') {
4971  newline_count++;
4972  goto start;
4973  }
4974 
4975  buff[6] = ' ';
4976  bp = buff + 7;
4977 
4978  if (unlikely(continuation)) {
4979  /* Line continuation */
4980  need_continuation = 0;
4981  for (; *bp == ' '; ++bp) {
4982  ;
4983  }
4984  /* Validate concatenation */
4985  if (consecutive_quotation) {
4986  if (bp[0] == quotation_mark && bp[1] == quotation_mark) {
4987  bp++;
4988  } else {
4990  _("Invalid line continuation"));
4991  return YY_NULL;
4992  }
4993  quotation_mark = 0;
4995  } else if (quotation_mark) {
4996  /* Literal concatenation */
4997  if (*bp == quotation_mark) {
4998  bp++;
4999  } else {
5001  _("Invalid line continuation"));
5002  return YY_NULL;
5003  }
5004  }
5005  } else {
5006  /* Normal line */
5007  if (need_continuation) {
5009  _("Continuation character expected"));
5010  need_continuation = 0;
5011  }
5012  quotation_mark = 0;
5014  }
5015 
5016  /* Check if string literal is to be continued */
5017  for (i = bp - buff; buff[i] != '\n'; ++i) {
5018  /* Pick up floating comment and force loop exit */
5019  if (!quotation_mark && ((buff[i] == '*' && buff[i + 1] == '>') ||
5020  (cb_flag_acucomment && buff[i] == '|') ) ) {
5021  /* remove indicator "source text too long" if the column
5022  leading to the indicator comes after the floating comment
5023  */
5024  if (i < cb_text_column) {
5025  line_overflow = 0;
5026  }
5027  /* Set to null, 'i' is predecremented further below */
5028  buff[i] = 0;
5029  break;
5030  } else if (buff[i] == '\'' || buff[i] == '"') {
5031  if (quotation_mark == 0) {
5032  /* Literal start */
5033  quotation_mark = buff[i];
5034  } else if (quotation_mark == buff[i]) {
5035  if (i == cb_text_column - 1) {
5036  /* Consecutive quotation */
5038  } else {
5039  /* Literal end */
5040  quotation_mark = 0;
5041  }
5042  }
5043  }
5044  }
5045 
5046  if (unlikely(quotation_mark)) {
5047  /* Expecting continuation */
5048  if (!consecutive_quotation) {
5049  need_continuation = 1;
5050  }
5051  for (; i < cb_text_column;) {
5052  buff[i++] = ' ';
5053  }
5054  buff[i] = 0;
5055  } else {
5056  /* Truncate trailing spaces, including the newline */
5057  for (i--; i >= 0 && buff[i] == ' '; i--) {
5058  ;
5059  }
5060  if (i < 0) {
5061  /* Empty line after removing floating comment */
5062  newline_count++;
5063  goto start;
5064  }
5065  if (buff[i] == '\'' || buff[i] == '\"') {
5066  buff[++i] = ' ';
5067  }
5068  buff[i + 1] = 0;
5069  }
5070 
5071  /* Show warning if text is longer than cb_text_column
5072  and not whitespace (postponed here) */
5073  if (line_overflow != 0) {
5075  _("Source text after program-text area (column %d)"),
5076  cb_text_column);
5077  }
5078 
5079  if (unlikely(continuation)) {
5080  gotcr = strlen (bp);
5081  memmove (buff, bp, gotcr + 1);
5082  newline_count++;
5083  } else {
5084  /* Insert newlines at the start of the buffer */
5085  gotcr = strlen (buff);
5086  if (newline_count != 0) {
5087  memmove (buff + newline_count, buff, gotcr + 1);
5088  memset (buff, '\n', newline_count);
5089  gotcr += newline_count;
5090  }
5091  newline_count = 1;
5092  }
5093  return (int)gotcr;
5094 }
#define PPLEX_BUFF_LEN
Definition: pplex.c:2072
void cb_plex_warning(const size_t, const char *,...) COB_A_FORMAT23
Definition: error.c:119
unsigned int cb_verify(const enum cb_support, const char *)
Definition: error.c:246
static int quotation_mark
Definition: pplex.c:2140
int cb_source_format
Definition: cobc.c:162
static size_t buffer_overflow
Definition: pplex.c:2136
static size_t newline_count
Definition: pplex.c:2131
#define _(s)
Definition: cobcrun.c:59
#define unlikely(x)
Definition: common.h:437
static size_t need_continuation
Definition: pplex.c:2135
static size_t consecutive_quotation
Definition: pplex.c:2134
static size_t within_comment
Definition: pplex.c:2132
#define CB_FORMAT_FIXED
Definition: cobc.h:65
FILE * ppin
Definition: pplex.c:367
#define YY_NULL
Definition: pplex.c:133
#define CB_FORMAT_FREE
Definition: cobc.h:66
void cb_plex_error(const size_t, const char *,...) COB_A_FORMAT23
Definition: error.c:130
#define likely(x)
Definition: common.h:436
static unsigned int plex_skip_input
Definition: pplex.c:2138

Here is the call graph for this function:

int pplex ( void  )

The main scanner function which does all the work.

Definition at line 2352 of file pplex.c.

References _, ALSO, AS, BEGIN, copy_info::buffer, BY, cb_error(), CB_FORMAT_FREE, cb_plex_warning(), cb_source_format, cb_source_line, cb_verify(), check_comments(), check_listing(), CHECKING, cobc_free(), cobc_plex_strdup(), CONSTANT, COPY, copy_stack, COPY_STATE, DEFINE_DIRECTIVE, DEFINE_DIRECTIVE_STATE, DEFINED, display_to_eol(), copy_info::dname, DOT, ECHO, ELIF_DIRECTIVE, ELSE_DIRECTIVE, ELSE_DIRECTIVE_STATE, ENDIF_DIRECTIVE, ENDIF_DIRECTIVE_STATE, EOB_ACT_CONTINUE_SCAN, EOB_ACT_END_OF_FILE, EOB_ACT_LAST_MATCH, EQ, EQEQ, EQUAL, copy_info::file, FIXED, FOLDCOPYNAME, FORMAT, FREE, GE, GREATER, GT, IF_DIRECTIVE, IF_DIRECTIVE_STATE, IN, INITIAL, IS, LAST, LE, LEADING, LESS, copy_info::line, plex_stack::line, LITERAL, LOCATION, LT, NE, copy_info::next, NOFOLDCOPYNAME, NOT, NULL, OF, OFF, ON, OR, OVERRIDE, PARAMETER, plex_cond_stack, plex_nest_depth, pp_create_buffer(), pp_delete_buffer(), pp_load_buffer_state(), ppecho(), ppensure_buffer_stack(), ppin, ppleng, pplval, ppout, ppwrap(), PRINTING, PSEUDO_STATE, copy_info::quotation_mark, REPLACE, REPLACING, copy_info::replacing, YYSTYPE::s, SET, SET_DIRECTIVE, SET_DIRECTIVE_STATE, skip_to_eol(), SOURCE_DIRECTIVE, SOURCE_DIRECTIVE_STATE, copy_info::source_format, SOURCEFORMAT, SUPPRESS, switch_to_buffer(), TERMINATOR, THAN, TO, TOKEN, TRAILING, TURN_DIRECTIVE, TURN_DIRECTIVE_STATE, unput, VARIABLE, warningopt, WITH, YY_AT_BOL, YY_BREAK, YY_BUF_SIZE, YY_BUFFER_NEW, YY_BUFFER_NORMAL, yy_c_buf_p, YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, yy_did_buffer_switch_on_eof, YY_DO_BEFORE_ACTION, YY_END_OF_BUFFER, YY_FATAL_ERROR, yy_get_next_buffer(), yy_get_previous_state(), yy_hold_char, yy_init, yy_last_accepting_cpos, yy_last_accepting_state, YY_MORE_ADJ, yy_n_chars, YY_NEW_FILE, yy_pop_state(), yy_push_state(), YY_RESTORE_YY_MORE_OFFSET, YY_RULE_SETUP, YY_SC_TO_UI, YY_START, yy_start, YY_STATE_EOF, yy_try_NUL_trans(), YY_USER_INIT, yyterminate, and yytext_ptr.

2353 {
2354  register yy_state_type yy_current_state;
2355  register char *yy_cp, *yy_bp;
2356  register int yy_act;
2357 
2358  if ( !(yy_init) )
2359  {
2360  (yy_init) = 1;
2361 
2362 #ifdef YY_USER_INIT
2363  YY_USER_INIT;
2364 #endif
2365 
2366  if ( ! (yy_start) )
2367  (yy_start) = 1; /* first start state */
2368 
2369  if ( ! ppin )
2370  ppin = stdin;
2371 
2372  if ( ! ppout )
2373  ppout = stdout;
2374 
2375  if ( ! YY_CURRENT_BUFFER ) {
2379  }
2380 
2382  }
2383 
2384  {
2385 #line 174 "pplex.l"
2386 
2387 
2388 
2389 
2390 
2391 #line 2391 "pplex.c"
2392 
2393  while ( 1 ) /* loops until end-of-file is reached */
2394  {
2395  yy_cp = (yy_c_buf_p);
2396 
2397  /* Support of pptext. */
2398  *yy_cp = (yy_hold_char);
2399 
2400  /* yy_bp points to the position in yy_ch_buf of the start of
2401  * the current run.
2402  */
2403  yy_bp = yy_cp;
2404 
2405  yy_current_state = (yy_start);
2406  yy_current_state += YY_AT_BOL();
2407 yy_match:
2408  do
2409  {
2410  register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
2411  if ( yy_accept[yy_current_state] )
2412  {
2413  (yy_last_accepting_state) = yy_current_state;
2414  (yy_last_accepting_cpos) = yy_cp;
2415  }
2416  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2417  {
2418  yy_current_state = (int) yy_def[yy_current_state];
2419  if ( yy_current_state >= 1082 )
2420  yy_c = yy_meta[(unsigned int) yy_c];
2421  }
2422  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2423  ++yy_cp;
2424  }
2425  while ( yy_current_state != 1081 );
2426  yy_cp = (yy_last_accepting_cpos);
2427  yy_current_state = (yy_last_accepting_state);
2428 
2429 yy_find_action:
2430  yy_act = yy_accept[yy_current_state];
2431 
2433 
2434 do_action: /* This label is used only to access EOF actions. */
2435 
2436  switch ( yy_act )
2437  { /* beginning of action switch */
2438  case 0: /* must back up */
2439  /* undo the effects of YY_DO_BEFORE_ACTION */
2440  *yy_cp = (yy_hold_char);
2441  yy_cp = (yy_last_accepting_cpos);
2442  yy_current_state = (yy_last_accepting_state);
2443  goto yy_find_action;
2444 
2445 case 1:
2447 #line 179 "pplex.l"
2448 {
2449  #if 0 /* RXWRXW - Directive state */
2450  if (YY_START != DIRECTIVE_STATE && YY_START != SET_DIRECTIVE_STATE) {
2451  ppecho (" ", 0, 1);
2452  }
2453  #endif
2454 }
2455  YY_BREAK
2456 case 2:
2458 #line 187 "pplex.l"
2459 {
2460  /* Define here to preempt next debug rule below */
2462  return DEFINE_DIRECTIVE;
2463 }
2464  YY_BREAK
2465 case 3:
2467 #line 193 "pplex.l"
2468 {
2469  /* Define here to preempt next debug rule below */
2470  display_to_eol ();
2471 }
2472  YY_BREAK
2473 case 4:
2475 #line 198 "pplex.l"
2476 {
2477  /* OC extension for floating debug line */
2478  /* Remove line if debugging lines not activated */
2479  /* Otherwise ignore the directive part of the line */
2480  if (!cb_flag_debugging_line) {
2481  skip_to_eol ();
2482  }
2483 }
2484  YY_BREAK
2485 case 5:
2487 #line 207 "pplex.l"
2488 {
2490  return SOURCE_DIRECTIVE;
2491 }
2492  YY_BREAK
2493 case 6:
2495 #line 212 "pplex.l"
2496 {
2497  /* OC extension */
2499  return SET_DIRECTIVE;
2500 }
2501  YY_BREAK
2502 case 7:
2504 #line 218 "pplex.l"
2505 {
2507  return TURN_DIRECTIVE;
2508 }
2509  YY_BREAK
2510 case 8:
2512 #line 223 "pplex.l"
2513 {
2515  return IF_DIRECTIVE;
2516 }
2517  YY_BREAK
2518 case 9:
2519 #line 229 "pplex.l"
2520 case 10:
2522 #line 229 "pplex.l"
2523 {
2525  return ELIF_DIRECTIVE;
2526 }
2527  YY_BREAK
2528 case 11:
2530 #line 234 "pplex.l"
2531 {
2533  return ELSE_DIRECTIVE;
2534 }
2535  YY_BREAK
2536 case 12:
2538 #line 239 "pplex.l"
2539 {
2541  return ENDIF_DIRECTIVE;
2542 }
2543  YY_BREAK
2544 case 13:
2546 #line 244 "pplex.l"
2547 {
2548  if (warningopt) {
2549  cb_plex_warning (newline_count, _("Ignoring LEAP-SECOND directive"));
2550  }
2551  skip_to_eol ();
2552 }
2553  YY_BREAK
2554 case 14:
2555 /* rule 14 can match eol */
2557 #line 251 "pplex.l"
2558 {
2559  cb_plex_warning (newline_count, _("Ignoring empty directive"));
2560  unput ('\n');
2561 }
2562  YY_BREAK
2563 case 15:
2565 #line 256 "pplex.l"
2566 {
2567  char *s;
2568 
2569  s = strchr (pptext, '>');
2570  cb_plex_warning (newline_count, _("Ignoring invalid directive - '%s'"), s);
2571  skip_to_eol ();
2572 }
2573  YY_BREAK
2574 case 16:
2576 #line 264 "pplex.l"
2577 {
2578  cb_plex_warning (newline_count, _("Ignoring invalid directive"));
2579  skip_to_eol ();
2580 }
2581  YY_BREAK
2582 case 17:
2584 #line 269 "pplex.l"
2585 {
2586  display_to_eol ();
2587 }
2588  YY_BREAK
2589 case 18:
2591 #line 273 "pplex.l"
2592 {
2594  return SET_DIRECTIVE;
2595 }
2596  YY_BREAK
2597 case 19:
2599 #line 278 "pplex.l"
2600 {
2602  return IF_DIRECTIVE;
2603 }
2604  YY_BREAK
2605 case 20:
2606 #line 284 "pplex.l"
2607 case 21:
2609 #line 284 "pplex.l"
2610 {
2612  return ELIF_DIRECTIVE;
2613 }
2614  YY_BREAK
2615 case 22:
2617 #line 289 "pplex.l"
2618 {
2620  return ELSE_DIRECTIVE;
2621 }
2622  YY_BREAK
2623 case 23:
2625 #line 294 "pplex.l"
2626 {
2628  return ENDIF_DIRECTIVE;
2629 }
2630  YY_BREAK
2631 case 24:
2633 #line 299 "pplex.l"
2634 {
2635  char *s;
2636 
2637  s = strchr (pptext, '$');
2638  cb_plex_warning (newline_count, _("Ignoring invalid directive - '%s'"), s);
2639  skip_to_eol ();
2640 }
2641  YY_BREAK
2642 case 25:
2644 #line 307 "pplex.l"
2645 {
2646  /* Allow $ in column 7 for acucomment in fixed format */
2648  cb_plex_warning (newline_count, _("Spurious '$' detected - ignoring"));
2649  skip_to_eol ();
2650  }
2651 }
2652  YY_BREAK
2653 case 26:
2655 #line 315 "pplex.l"
2656 {
2657  cb_plex_warning (newline_count, _("Spurious '$' detected - ignoring"));
2658  skip_to_eol ();
2659 }
2660  YY_BREAK
2661 case 27:
2663 #line 320 "pplex.l"
2664 {
2665  cb_plex_warning (newline_count, _("PROCESS statement ignored"));
2666  skip_to_eol ();
2667 }
2668  YY_BREAK
2669 case 28:
2671 #line 325 "pplex.l"
2672 {
2674  return COPY;
2675 }
2676  YY_BREAK
2677 case 29:
2679 #line 330 "pplex.l"
2680 {
2682  return COPY;
2683 }
2684  YY_BREAK
2685 case 30:
2687 #line 335 "pplex.l"
2688 {
2690  return REPLACE;
2691 }
2692  YY_BREAK
2693 case 31:
2694 #line 341 "pplex.l"
2695 case 32:
2697 #line 341 "pplex.l"
2698 {
2699  /* Allow comment sentences/paragraphs */
2700  comment_allowed = 1;
2701  ppecho (pptext, 0, ppleng);
2702 }
2703  YY_BREAK
2704 case 33:
2706 #line 347 "pplex.l"
2707 {
2708  /* Allow comment sentences/paragraphs */
2709  comment_allowed = 1;
2710  ppecho (pptext, 0, ppleng);
2711 }
2712  YY_BREAK
2713 case 34:
2715 #line 353 "pplex.l"
2716 {
2717  /* Disallow comment sentences/paragraphs */
2718  comment_allowed = 0;
2719  ppecho (pptext, 0, ppleng);
2720 }
2721  YY_BREAK
2722 case 35:
2724 #line 359 "pplex.l"
2725 {
2726  /* Disallow comment sentences/paragraphs */
2727  comment_allowed = 0;
2728  ppecho (pptext, 0, ppleng);
2729 }
2730  YY_BREAK
2731 case 36:
2733 #line 365 "pplex.l"
2734 { check_comments ("AUTHOR", pptext); }
2735  YY_BREAK
2736 case 37:
2738 #line 366 "pplex.l"
2739 { check_comments ("DATE-WRITTEN", pptext); }
2740  YY_BREAK
2741 case 38:
2743 #line 367 "pplex.l"
2744 { check_comments ("DATE-MODIFIED", pptext); }
2745  YY_BREAK
2746 case 39:
2748 #line 368 "pplex.l"
2749 { check_comments ("DATE-COMPILED", pptext); }
2750  YY_BREAK
2751 case 40:
2753 #line 369 "pplex.l"
2754 { check_comments ("INSTALLATION", pptext); }
2755  YY_BREAK
2756 case 41:
2758 #line 370 "pplex.l"
2759 { check_comments ("REMARKS", pptext); }
2760  YY_BREAK
2761 case 42:
2763 #line 371 "pplex.l"
2764 { check_comments ("SECURITY", pptext); }
2765  YY_BREAK
2766 case 43:
2767 #line 374 "pplex.l"
2768 case 44:
2769 #line 375 "pplex.l"
2770 case 45:
2771 #line 376 "pplex.l"
2772 case 46:
2774 #line 376 "pplex.l"
2775 {
2776  /* These words are comments in various COBOL dialects */
2777  if (cb_verify (cb_eject_statement, pptext)) {
2778  /* Ignore */
2779  } else {
2780  ECHO;
2781  check_listing (pptext, 0);
2782  }
2783 }
2784  YY_BREAK
2785 case 47:
2786 #line 387 "pplex.l"
2787 case 48:
2789 #line 387 "pplex.l"
2790 {
2791  /* Pick up early - Also activates debugging lines */
2792  cb_flag_debugging_line = 1;
2793  ppecho (pptext, 0, ppleng);
2794 }
2795  YY_BREAK
2796 case 49:
2797 /* rule 49 can match eol */
2799 #line 393 "pplex.l"
2800 {
2801  ppecho ("\n", 0, 1);
2802  cb_source_line++;
2803 }
2804  YY_BREAK
2805 case 50:
2807 #line 398 "pplex.l"
2808 {
2809  ppecho (" ", 1U, 1);
2810 }
2811  YY_BREAK
2812 case 51:
2814 #line 402 "pplex.l"
2815 {
2816  if (inside_bracket) {
2817  ppecho (", ", 0, 2);
2818  } else {
2819  ppecho (" ", 1U, 1);
2820  }
2821 }
2822  YY_BREAK
2823 case 52:
2825 #line 410 "pplex.l"
2826 {
2827  inside_bracket++;
2828  ppecho ("(", 0, 1);
2829 }
2830  YY_BREAK
2831 case 53:
2833 #line 415 "pplex.l"
2834 {
2835  if (inside_bracket) {
2836  inside_bracket--;
2837  }
2838  ppecho (")", 0, 1);
2839 }
2840  YY_BREAK
2841 case 54:
2842 #line 423 "pplex.l"
2843 case 55:
2844 #line 424 "pplex.l"
2845 case 56:
2846 #line 425 "pplex.l"
2847 case 57:
2849 #line 425 "pplex.l"
2850 {
2851  ppecho (pptext, 0, ppleng);
2852 }
2853  YY_BREAK
2854 
2855 case 58:
2856 /* rule 58 can match eol */
2858 #line 430 "pplex.l"
2859 {
2860  BEGIN INITIAL;
2861  unput ('\n');
2862  return TERMINATOR;
2863  }
2864  YY_BREAK
2865 case 59:
2867 #line 435 "pplex.l"
2868 { return FORMAT; }
2869  YY_BREAK
2870 case 60:
2872 #line 436 "pplex.l"
2873 { return IS; }
2874  YY_BREAK
2875 case 61:
2877 #line 437 "pplex.l"
2878 { return FIXED; }
2879  YY_BREAK
2880 case 62:
2882 #line 438 "pplex.l"
2883 { return FREE; }
2884  YY_BREAK
2885 case 63:
2887 #line 439 "pplex.l"
2888 { /* ignore */ }
2889  YY_BREAK
2890 case 64:
2892 #line 440 "pplex.l"
2893 { }
2894  YY_BREAK
2895 
2896 
2897 case 65:
2898 /* rule 65 can match eol */
2900 #line 444 "pplex.l"
2901 {
2902  BEGIN INITIAL;
2903  unput ('\n');
2904  return TERMINATOR;
2905  }
2906  YY_BREAK
2907 case 66:
2909 #line 449 "pplex.l"
2910 {
2911  return CONSTANT;
2912  }
2913  YY_BREAK
2914 case 67:
2916 #line 452 "pplex.l"
2917 {
2918  return AS;
2919  }
2920  YY_BREAK
2921 case 68:
2923 #line 455 "pplex.l"
2924 {
2925  return OFF;
2926  }
2927  YY_BREAK
2928 case 69:
2930 #line 458 "pplex.l"
2931 {
2932  return OVERRIDE;
2933  }
2934  YY_BREAK
2935 case 70:
2937 #line 461 "pplex.l"
2938 {
2939  return PARAMETER;
2940  }
2941  YY_BREAK
2942 case 71:
2943 #line 465 "pplex.l"
2944 case 72:
2946 #line 465 "pplex.l"
2947 {
2949  return LITERAL;
2950  }
2951  YY_BREAK
2952 case 73:
2954 #line 469 "pplex.l"
2955 {
2957  return VARIABLE;
2958  }
2959  YY_BREAK
2960 case 74:
2962 #line 473 "pplex.l"
2963 { /* ignore */ }
2964  YY_BREAK
2965 case 75:
2967 #line 474 "pplex.l"
2968 { }
2969  YY_BREAK
2970 
2971 
2972 case 76:
2973 /* rule 76 can match eol */
2975 #line 478 "pplex.l"
2976 {
2977  BEGIN INITIAL;
2978  unput ('\n');
2979  return TERMINATOR;
2980  }
2981  YY_BREAK
2982 case 77:
2984 #line 483 "pplex.l"
2985 {
2986  return CONSTANT;
2987  }
2988  YY_BREAK
2989 case 78:
2991 #line 486 "pplex.l"
2992 {
2993  return SOURCEFORMAT;
2994  }
2995  YY_BREAK
2996 case 79:
2997 #line 490 "pplex.l"
2998 case 80:
3000 #line 490 "pplex.l"
3001 {
3002  return FOLDCOPYNAME;
3003  }
3004  YY_BREAK
3005 case 81:
3006 #line 494 "pplex.l"
3007 case 82:
3009 #line 494 "pplex.l"
3010 {
3011  return NOFOLDCOPYNAME;
3012  }
3013  YY_BREAK
3014 case 83:
3016 #line 497 "pplex.l"
3017 {
3018  return AS;
3019  }
3020  YY_BREAK
3021 case 84:
3022 #line 501 "pplex.l"
3023 case 85:
3025 #line 501 "pplex.l"
3026 {
3028  return LITERAL;
3029  }
3030  YY_BREAK
3031 case 86:
3033 #line 505 "pplex.l"
3034 {
3035  pptext[strlen (pptext) - 1] = 0;
3036  pplval.s = cobc_plex_strdup (pptext + 1);
3037  return LITERAL;
3038  }
3039  YY_BREAK
3040 case 87:
3042 #line 510 "pplex.l"
3043 {
3045  return VARIABLE;
3046  }
3047  YY_BREAK
3048 case 88:
3050 #line 514 "pplex.l"
3051 { /* ignore */ }
3052  YY_BREAK
3053 case 89:
3055 #line 515 "pplex.l"
3056 { }
3057  YY_BREAK
3058 
3059 
3060 case 90:
3061 /* rule 90 can match eol */
3063 #line 519 "pplex.l"
3064 {
3065  BEGIN INITIAL;
3066  unput ('\n');
3067  return TERMINATOR;
3068  }
3069  YY_BREAK
3070 case 91:
3072 #line 524 "pplex.l"
3073 {
3074  return ON;
3075  }
3076  YY_BREAK
3077 case 92:
3079 #line 527 "pplex.l"
3080 {
3081  return OFF;
3082  }
3083  YY_BREAK
3084 case 93:
3086 #line 530 "pplex.l"
3087 {
3088  return WITH;
3089  }
3090  YY_BREAK
3091 case 94:
3093 #line 533 "pplex.l"
3094 {
3095  return LOCATION;
3096  }
3097  YY_BREAK
3098 case 95:
3100 #line 536 "pplex.l"
3101 {
3102  return CHECKING;
3103  }
3104  YY_BREAK
3105 case 96:
3106 #line 540 "pplex.l"
3107 case 97:
3109 #line 540 "pplex.l"
3110 {
3112  return LITERAL;
3113  }
3114  YY_BREAK
3115 case 98:
3117 #line 544 "pplex.l"
3118 {
3119  pptext[strlen (pptext) - 1] = 0;
3120  pplval.s = cobc_plex_strdup (pptext + 1);
3121  return LITERAL;
3122  }
3123  YY_BREAK
3124 case 99:
3126 #line 549 "pplex.l"
3127 {
3129  return VARIABLE;
3130  }
3131  YY_BREAK
3132 case 100:
3134 #line 553 "pplex.l"
3135 { /* ignore */ }
3136  YY_BREAK
3137 case 101:
3139 #line 554 "pplex.l"
3140 { }
3141  YY_BREAK
3142 
3143 
3144 case 102:
3145 /* rule 102 can match eol */
3147 #line 558 "pplex.l"
3148 {
3149  BEGIN INITIAL;
3150  unput ('\n');
3151  return TERMINATOR;
3152  }
3153  YY_BREAK
3154 case 103:
3156 #line 563 "pplex.l"
3157 { /* ignore */ }
3158  YY_BREAK
3159 case 104:
3161 #line 564 "pplex.l"
3162 { return IS; }
3163  YY_BREAK
3164 case 105:
3166 #line 565 "pplex.l"
3167 { return NOT; }
3168  YY_BREAK
3169 case 106:
3171 #line 566 "pplex.l"
3172 { return EQUAL; }
3173  YY_BREAK
3174 case 107:
3176 #line 567 "pplex.l"
3177 { return TO; }
3178  YY_BREAK
3179 case 108:
3181 #line 568 "pplex.l"
3182 { return OR; }
3183  YY_BREAK
3184 case 109:
3186 #line 569 "pplex.l"
3187 { return GREATER; }
3188  YY_BREAK
3189 case 110:
3191 #line 570 "pplex.l"
3192 { return LESS; }
3193  YY_BREAK
3194 case 111:
3196 #line 571 "pplex.l"
3197 { return THAN; }
3198  YY_BREAK
3199 case 112:
3201 #line 572 "pplex.l"
3202 { return DEFINED; }
3203  YY_BREAK
3204 case 113:
3206 #line 573 "pplex.l"
3207 { return SET; }
3208  YY_BREAK
3209 case 114:
3211 #line 574 "pplex.l"
3212 { return GE; }
3213  YY_BREAK
3214 case 115:
3216 #line 575 "pplex.l"
3217 { return GT; }
3218  YY_BREAK
3219 case 116:
3221 #line 576 "pplex.l"
3222 { return LE; }
3223  YY_BREAK
3224 case 117:
3226 #line 577 "pplex.l"
3227 { return NE; }
3228  YY_BREAK
3229 case 118:
3231 #line 578 "pplex.l"
3232 { return LT; }
3233  YY_BREAK
3234 case 119:
3236 #line 579 "pplex.l"
3237 { return EQ; }
3238  YY_BREAK
3239 case 120:
3240 #line 581 "pplex.l"
3241 case 121:
3243 #line 581 "pplex.l"
3244 {
3246  return LITERAL;
3247  }
3248  YY_BREAK
3249 case 122:
3251 #line 585 "pplex.l"
3252 {
3254  return VARIABLE;
3255  }
3256  YY_BREAK
3257 case 123:
3259 #line 589 "pplex.l"
3260 { }
3261  YY_BREAK
3262 
3263 
3264 case 124:
3265 /* rule 124 can match eol */
3267 #line 593 "pplex.l"
3268 {
3269  BEGIN INITIAL;
3270  unput ('\n');
3271  return TERMINATOR;
3272  }
3273  YY_BREAK
3274 case 125:
3276 #line 598 "pplex.l"
3277 { /* ignore */ }
3278  YY_BREAK
3279 
3280 
3281 case 126:
3282 /* rule 126 can match eol */
3284 #line 602 "pplex.l"
3285 {
3286  BEGIN INITIAL;
3287  unput ('\n');
3288  return TERMINATOR;
3289  }
3290  YY_BREAK
3291 case 127:
3293 #line 607 "pplex.l"
3294 { /* ignore */ }
3295  YY_BREAK
3296 
3297 
3298 case 128:
3299 /* rule 128 can match eol */
3301 #line 611 "pplex.l"
3302 {
3303  ECHO;
3304  check_listing (pptext, 0);
3305  cb_source_line++;
3306  }
3307  YY_BREAK
3308 case 129:
3310 #line 616 "pplex.l"
3311 { /* ignore */ }
3312  YY_BREAK
3313 case 130:
3315 #line 617 "pplex.l"
3316 { yy_pop_state (); return DOT; }
3317  YY_BREAK
3318 case 131:
3320 #line 618 "pplex.l"
3321 { yy_push_state (PSEUDO_STATE); return EQEQ; }
3322  YY_BREAK
3323 case 132:
3325 #line 619 "pplex.l"
3326 { return '('; }
3327  YY_BREAK
3328 case 133:
3330 #line 620 "pplex.l"
3331 { return ')'; }
3332  YY_BREAK
3333 case 134:
3335 #line 621 "pplex.l"
3336 { return BY; }
3337  YY_BREAK
3338 case 135:
3340 #line 622 "pplex.l"
3341 { return IN; }
3342  YY_BREAK
3343 case 136:
3345 #line 623 "pplex.l"
3346 { return OF; }
3347  YY_BREAK
3348 case 137:
3350 #line 624 "pplex.l"
3351 { return OFF; }
3352  YY_BREAK
3353 case 138:
3355 #line 625 "pplex.l"
3356 { return SUPPRESS; }
3357  YY_BREAK
3358 case 139:
3360 #line 626 "pplex.l"
3361 { return PRINTING; }
3362  YY_BREAK
3363 case 140:
3365 #line 627 "pplex.l"
3366 { return REPLACING; }
3367  YY_BREAK
3368 case 141:
3370 #line 628 "pplex.l"
3371 { return LEADING; }
3372  YY_BREAK
3373 case 142:
3375 #line 629 "pplex.l"
3376 { return TRAILING; }
3377  YY_BREAK
3378 case 143:
3380 #line 630 "pplex.l"
3381 { return ALSO; }
3382  YY_BREAK
3383 case 144:
3385 #line 631 "pplex.l"
3386 { return LAST; }
3387  YY_BREAK
3388 case 145:
3389 #line 633 "pplex.l"
3390 case 146:
3391 #line 634 "pplex.l"
3392 case 147:
3393 #line 635 "pplex.l"
3394 case 148:
3396 #line 635 "pplex.l"
3397 { pplval.s = cobc_plex_strdup (pptext); return TOKEN; }
3398  YY_BREAK
3399 
3400 
3401 case 149:
3402 /* rule 149 can match eol */
3404 #line 639 "pplex.l"
3405 {
3406  ECHO;
3407  check_listing (pptext, 0);
3408  cb_source_line++;
3409  }
3410  YY_BREAK
3411 case 150:
3413 #line 645 "pplex.l"
3414 {
3415  pplval.s = cobc_plex_strdup (" ");
3416  return TOKEN;
3417  }
3418  YY_BREAK
3419 case 151:
3421 #line 650 "pplex.l"
3422 {
3423  yy_pop_state ();
3424  return EQEQ;
3425  }
3426  YY_BREAK
3427 case 152:
3428 #line 656 "pplex.l"
3429 case 153:
3430 #line 657 "pplex.l"
3431 case 154:
3432 #line 658 "pplex.l"
3433 case 155:
3435 #line 658 "pplex.l"
3436 {
3438  return TOKEN;
3439  }
3440  YY_BREAK
3441 
3442 case YY_STATE_EOF(INITIAL):
3443 case YY_STATE_EOF(COPY_STATE):
3444 case YY_STATE_EOF(PSEUDO_STATE):
3445 case YY_STATE_EOF(SOURCE_DIRECTIVE_STATE):
3446 case YY_STATE_EOF(DEFINE_DIRECTIVE_STATE):
3447 case YY_STATE_EOF(SET_DIRECTIVE_STATE):
3448 case YY_STATE_EOF(TURN_DIRECTIVE_STATE):
3449 case YY_STATE_EOF(IF_DIRECTIVE_STATE):
3450 case YY_STATE_EOF(ELSE_DIRECTIVE_STATE):
3451 case YY_STATE_EOF(ENDIF_DIRECTIVE_STATE):
3452 #line 665 "pplex.l"
3453 {
3454  struct copy_info *p;
3455 
3456  p = copy_stack;
3457 
3459 
3460  /* Terminate at the end of all input */
3461  if (p->next == NULL) {
3462  /* Check dangling IF/ELSE */
3463  for (; plex_nest_depth > 0; --plex_nest_depth) {
3465  cb_error (_("Dangling IF/ELSE directive"));
3466  }
3467  plex_nest_depth = 0;
3468  cobc_free (p->dname);
3469  cobc_free (p);
3470  listing_line = 0;
3472  requires_new_line = 0;
3473  need_continuation = 0;
3474  buffer_overflow = 0;
3475  within_comment = 0;
3476  newline_count = 0;
3477  inside_bracket = 0;
3478  comment_allowed = 1;
3482  text_queue = NULL;
3483  copy_stack = NULL;
3484  quotation_mark = 0;
3486  yyterminate ();
3487  }
3488 
3489  /* Close the current file */
3490  fclose (ppin);
3491 
3492  /* Switch to previous buffer */
3493  switch_to_buffer (p->line, p->file, p->buffer);
3494 
3495  /* Restore variables */
3499 
3500  copy_stack = p->next;
3501  cobc_free (p->dname);
3502  cobc_free (p);
3503 }
3504  YY_BREAK
3505 case 156:
3507 #line 717 "pplex.l"
3508 YY_FATAL_ERROR( "flex scanner jammed" );
3509  YY_BREAK
3510 #line 3510 "pplex.c"
3511 
3512  case YY_END_OF_BUFFER:
3513  {
3514  /* Amount of text matched not including the EOB char. */
3515  int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
3516 
3517  /* Undo the effects of YY_DO_BEFORE_ACTION. */
3518  *yy_cp = (yy_hold_char);
3520 
3521  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
3522  {
3523  /* We're scanning a new file or input source. It's
3524  * possible that this happened because the user
3525  * just pointed ppin at a new source and called
3526  * pplex(). If so, then we have to assure
3527  * consistency between YY_CURRENT_BUFFER and our
3528  * globals. Here is the right place to do so, because
3529  * this is the first action (other than possibly a
3530  * back-up) that will match for the new input source.
3531  */
3532  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
3533  YY_CURRENT_BUFFER_LVALUE->yy_input_file = ppin;
3534  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
3535  }
3536 
3537  /* Note that here we test for yy_c_buf_p "<=" to the position
3538  * of the first EOB in the buffer, since yy_c_buf_p will
3539  * already have been incremented past the NUL character
3540  * (since all states make transitions on EOB to the
3541  * end-of-buffer state). Contrast this with the test
3542  * in input().
3543  */
3544  if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
3545  { /* This was really a NUL. */
3546  yy_state_type yy_next_state;
3547 
3548  (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
3549 
3550  yy_current_state = yy_get_previous_state( );
3551 
3552  /* Okay, we're now positioned to make the NUL
3553  * transition. We couldn't have
3554  * yy_get_previous_state() go ahead and do it
3555  * for us because it doesn't know how to deal
3556  * with the possibility of jamming (and we don't
3557  * want to build jamming into it because then it
3558  * will run more slowly).
3559  */
3560 
3561  yy_next_state = yy_try_NUL_trans( yy_current_state );
3562 
3563  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
3564 
3565  if ( yy_next_state )
3566  {
3567  /* Consume the NUL. */
3568  yy_cp = ++(yy_c_buf_p);
3569  yy_current_state = yy_next_state;
3570  goto yy_match;
3571  }
3572 
3573  else
3574  {
3575  yy_cp = (yy_last_accepting_cpos);
3576  yy_current_state = (yy_last_accepting_state);
3577  goto yy_find_action;
3578  }
3579  }
3580 
3581  else switch ( yy_get_next_buffer( ) )
3582  {
3583  case EOB_ACT_END_OF_FILE:
3584  {
3586 
3587  if ( ppwrap( ) )
3588  {
3589  /* Note: because we've taken care in
3590  * yy_get_next_buffer() to have set up
3591  * pptext, we can now set up
3592  * yy_c_buf_p so that if some total
3593  * hoser (like flex itself) wants to
3594  * call the scanner after we return the
3595  * YY_NULL, it'll still work - another
3596  * YY_NULL will get returned.
3597  */
3599 
3600  yy_act = YY_STATE_EOF(YY_START);
3601  goto do_action;
3602  }
3603 
3604  else
3605  {
3606  if ( ! (yy_did_buffer_switch_on_eof) )
3607  YY_NEW_FILE;
3608  }
3609  break;
3610  }
3611 
3612  case EOB_ACT_CONTINUE_SCAN:
3613  (yy_c_buf_p) =
3614  (yytext_ptr) + yy_amount_of_matched_text;
3615 
3616  yy_current_state = yy_get_previous_state( );
3617 
3618  yy_cp = (yy_c_buf_p);
3619  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
3620  goto yy_match;
3621 
3622  case EOB_ACT_LAST_MATCH:
3623  (yy_c_buf_p) =
3624  &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
3625 
3626  yy_current_state = yy_get_previous_state( );
3627 
3628  yy_cp = (yy_c_buf_p);
3629  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
3630  goto yy_find_action;
3631  }
3632  break;
3633  }
3634 
3635  default:
3637  "fatal flex scanner internal error--no action found" );
3638  } /* end of action switch */
3639  } /* end of scanning one token */
3640  } /* end of user's declarations */
3641 } /* end of pplex */
Definition: parser.c:1852
#define INITIAL
Definition: pplex.c:2177
#define YY_BREAK
Definition: pplex.c:2341
Definition: parser.c:1437
#define YY_END_OF_BUFFER
Definition: pplex.c:394
#define SET_DIRECTIVE_STATE
Definition: pplex.c:2182
static unsigned int plex_nest_depth
Definition: pplex.c:2139
Definition: ppparse.c:615
Definition: ppparse.c:616
#define ENDIF_DIRECTIVE_STATE
Definition: pplex.c:2186
#define YY_DO_BEFORE_ACTION
Definition: pplex.c:386
#define YY_STATE_EOF(state)
Definition: pplex.c:156
static char * yy_last_accepting_cpos
Definition: pplex.c:2028
static int ppwrap(void)
Definition: pplex.c:2068
static flex_int16_t yy_base[1183]
Definition: pplex.c:569
Definition: parser.c:1653
#define ECHO
Definition: pplex.c:2074
Definition: ppparse.c:617
Definition: parser.c:1562
Definition: parser.c:1392
Definition: ppparse.c:600
YYSTYPE pplval
Definition: ppparse.c:1646
void cb_plex_warning(const size_t, const char *,...) COB_A_FORMAT23
Definition: error.c:119
static void ppecho(const char *, const cob_u32_t, const int)
Definition: pplex.c:5117
#define COPY_STATE
Definition: pplex.c:2178
FILE * ppout
Definition: pplex.c:367
Definition: ppparse.c:618
int warningopt
Definition: cobc.c:176
unsigned int cb_verify(const enum cb_support, const char *)
Definition: error.c:246
unsigned char YY_CHAR
Definition: pplex.c:365
void cobc_free(void *mptr)
Definition: cobc.c:657
void * cobc_plex_strdup(const char *dupstr)
Definition: cobc.c:933
static char yy_hold_char
Definition: pplex.c:303
Definition: ppparse.c:620
static int quotation_mark
Definition: pplex.c:2140
static int yy_init
Definition: pplex.c:309
#define YY_START
Definition: pplex.c:152
int cb_source_format
Definition: cobc.c:162
int quotation_mark
Definition: pplex.c:2114
Definition: parser.c:1659
static int requires_listing_line
Definition: pplex.c:2142
#define PSEUDO_STATE
Definition: pplex.c:2179
Definition: parser.c:1655
#define YY_BUFFER_NEW
Definition: pplex.c:265
Definition: parser.c:1796
static flex_int16_t yy_accept[1082]
Definition: pplex.c:402
static struct copy_info * copy_stack
Definition: pplex.c:2151
#define YY_BUFFER_NORMAL
Definition: pplex.c:266
static int yy_get_next_buffer(void)
Definition: pplex.c:3650
#define EOB_ACT_END_OF_FILE
Definition: pplex.c:195
#define TOKEN(offset)
Definition: typeck.c:70
static void switch_to_buffer(const int, const char *, const YY_BUFFER_STATE)
Definition: pplex.c:4677
static int listing_line
Definition: pplex.c:2141
struct copy_info * next
Definition: pplex.c:2108
#define EOB_ACT_CONTINUE_SCAN
Definition: pplex.c:194
static int yy_start
Definition: pplex.c:310
#define yyterminate()
Definition: pplex.c:2306
static size_t buffer_overflow
Definition: pplex.c:2136
#define IF_DIRECTIVE_STATE
Definition: pplex.c:2184
static void yy_push_state(int new_state)
Definition: pplex.c:4216
#define YY_CURRENT_BUFFER_LVALUE
Definition: pplex.c:300
static flex_int32_t yy_meta[74]
Definition: pplex.c:557
char * s
Definition: ppparse.c:649
static flex_int16_t yy_nxt[5374]
Definition: pplex.c:837
static size_t newline_count
Definition: pplex.c:2131
Definition: parser.c:1584
#define SOURCE_DIRECTIVE_STATE
Definition: pplex.c:2180
#define _(s)
Definition: cobcrun.c:59
yy_size_t ppleng
Definition: pplex.c:305
#define ELSE_DIRECTIVE_STATE
Definition: pplex.c:2185
#define YY_AT_BOL()
Definition: pplex.c:361
struct cb_replace_list * replacing
Definition: pplex.c:2111
int line
Definition: pplex.c:2113
static size_t need_continuation
Definition: pplex.c:2135
static yy_size_t yy_n_chars
Definition: pplex.c:304
int source_format
Definition: pplex.c:2115
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
static void display_to_eol(void)
Definition: pplex.c:5284
static yy_state_type yy_get_previous_state(void)
Definition: pplex.c:3784
Definition: parser.c:1590
Definition: parser.c:1652
YY_BUFFER_STATE pp_create_buffer(FILE *file, int size)
Allocate and initialize an input buffer state.
Definition: pplex.c:4020
#define YY_USER_INIT
Definition: pplex.c:2076
int yy_state_type
Definition: pplex.c:369
static size_t consecutive_quotation
Definition: pplex.c:2134
Definition: parser.c:1751
char * pptext
Definition: pplex.c:2040
static struct cb_text_list * text_queue
Definition: pplex.c:2149
#define BEGIN
Definition: pplex.c:146
#define YY_CURRENT_BUFFER
Definition: pplex.c:293
static size_t within_comment
Definition: pplex.c:2132
static void pp_load_buffer_state(void)
Definition: pplex.c:4006
#define YY_SC_TO_UI(c)
Definition: pplex.c:140
#define yytext_ptr
Definition: pplex.c:376
static struct cb_replace_list * save_current_replace
Definition: pplex.c:2146
#define TURN_DIRECTIVE_STATE
Definition: pplex.c:2183
Definition: parser.c:1503
static struct cb_replace_list * current_replace_list
Definition: pplex.c:2145
void cb_error(const char *,...) COB_A_FORMAT12
Definition: error.c:98
static flex_int16_t yy_chk[5374]
Definition: pplex.c:1432
if fold fold static computed alternate extra correct stack on syntax debugging line
Definition: flag.def:90
#define YY_RULE_SETUP
Definition: pplex.c:2344
Definition: ppparse.c:584
static char * yy_c_buf_p
Definition: pplex.c:308
static yy_state_type yy_last_accepting_state
Definition: pplex.c:2027
FILE * ppin
Definition: pplex.c:367
static size_t inside_bracket
Definition: pplex.c:2133
YY_BUFFER_STATE buffer
Definition: pplex.c:2112
Definition: parser.c:1538
#define unput(c)
Definition: pplex.c:215
#define YY_FATAL_ERROR(msg)
Definition: pplex.c:2316
Definition: parser.c:1790
static int requires_new_line
Definition: pplex.c:2143
int line
Definition: pplex.c:2122
Definition: parser.c:1634
static void check_comments(const char *, const char *)
Definition: pplex.c:5305
#define CB_FORMAT_FREE
Definition: cobc.h:66
#define YY_MORE_ADJ
Definition: pplex.c:2038
int cb_source_line
Definition: cobc.c:178
Definition: ppparse.c:619
Definition: parser.c:1360
static void yy_pop_state(void)
Definition: pplex.c:4240
#define EOB_ACT_LAST_MATCH
Definition: pplex.c:196
static struct cb_replace_list * base_replace_list
Definition: pplex.c:2147
static flex_int16_t yy_def[1183]
Definition: pplex.c:703
#define YY_NEW_FILE
Definition: pplex.c:159
#define YY_BUF_SIZE
Definition: pplex.c:2065
Definition: parser.c:1369
Definition: ppparse.c:595
static void check_listing(const char *, const unsigned int)
Definition: pplex.c:5319
static void ppensure_buffer_stack(void)
Definition: pplex.c:4173
#define DEFINE_DIRECTIVE_STATE
Definition: pplex.c:2181
static int yy_did_buffer_switch_on_eof
Definition: pplex.c:315
const char * file
Definition: pplex.c:2109
#define YY_RESTORE_YY_MORE_OFFSET
Definition: pplex.c:2039
static yy_state_type yy_try_NUL_trans(yy_state_type current_state)
Definition: pplex.c:3817
char * dname
Definition: pplex.c:2110
static struct plex_stack plex_cond_stack[16]
Definition: pplex.c:2153
void pp_delete_buffer(YY_BUFFER_STATE b)
Destroy the buffer.
Definition: pplex.c:4048
Definition: parser.c:1576
static flex_int32_t yy_ec[256]
Definition: pplex.c:525
static void skip_to_eol(void)
Definition: pplex.c:5268
static size_t comment_allowed
Definition: pplex.c:2137

Here is the call graph for this function:

int pplex_destroy ( void  )

Definition at line 4314 of file pplex.c.

References NULL, pp_delete_buffer(), ppfree(), pppop_buffer_state(), yy_buffer_stack, YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, yy_init_globals(), and yy_start_stack.

Referenced by plex_call_destroy().

4315 {
4316 
4317  /* Pop the buffer stack, destroying each element. */
4318  while(YY_CURRENT_BUFFER){
4322  }
4323 
4324  /* Destroy the stack itself. */
4325  ppfree((yy_buffer_stack) );
4326  (yy_buffer_stack) = NULL;
4327 
4328  /* Destroy the start condition stack. */
4329  ppfree((yy_start_stack) );
4330  (yy_start_stack) = NULL;
4331 
4332  /* Reset the globals. This is important in a non-reentrant scanner so the next time
4333  * pplex() is called, initialization will occur. */
4334  yy_init_globals( );
4335 
4336  return 0;
4337 }
static YY_BUFFER_STATE * yy_buffer_stack
Stack as an array.
Definition: pplex.c:285
#define YY_CURRENT_BUFFER_LVALUE
Definition: pplex.c:300
static int * yy_start_stack
Definition: pplex.c:2241
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
void ppfree(void *)
Definition: pplex.c:4380
#define YY_CURRENT_BUFFER
Definition: pplex.c:293
void pppop_buffer_state(void)
Removes and deletes the top of the stack, if present.
Definition: pplex.c:4154
static int yy_init_globals(void)
Get the current token.
Definition: pplex.c:4281
void pp_delete_buffer(YY_BUFFER_STATE b)
Destroy the buffer.
Definition: pplex.c:4048

Here is the call graph for this function:

Here is the caller graph for this function:

int ppopen ( const char *  name,
struct cb_replace_list replacing_list 
)

Definition at line 4420 of file pplex.c.

References _, copy_info::buffer, cb_error(), cb_source_file, cb_source_format, cb_source_line, COB_DASH, cobc_malloc(), cobc_strdup(), copy_stack, current_replace_list, copy_info::dname, errorcount, copy_info::file, cb_replace_list::last, copy_info::line, cb_replace_list::next, copy_info::next, pp_create_buffer(), ppin, copy_info::quotation_mark, quotation_mark, copy_info::replacing, copy_info::source_format, switch_to_buffer(), YY_BUF_SIZE, and YY_CURRENT_BUFFER.

Referenced by ppcopy(), and preprocess().

4421 {
4422  struct copy_info *p;
4423  char *s;
4424  char *dname;
4425 
4426  unsigned char bom[4];
4427 
4428  if (ppin) {
4429  for (; newline_count > 0; newline_count--) {
4430  ungetc ('\n', ppin);
4431  }
4432  }
4433 
4434  /* Open copy/source file, or use stdin */
4435  if (strcmp(name, COB_DASH) == 0) {
4436  ppin = stdin;
4437  } else {
4438 #ifdef __OS400__
4439  ppin = fopen (name, "r");
4440 #else
4441  ppin = fopen (name, "rb");
4442 #endif
4443  }
4444 
4445  if (!ppin) {
4446  if (cb_source_file) {
4447  cb_error ("%s: %s", name,
4448  _("No such file or directory"));
4449  } else {
4450  fflush (stderr);
4451  fprintf (stderr, "%s: %s", name,
4452  _("No such file or directory"));
4453  fflush (stderr);
4454  errorcount++;
4455  }
4456  return -1;
4457  }
4458 
4459  /* Check for BOM - *not* for input from stdin as rewind() clears the input
4460  buffer if used on stdin and output in console has normally no BOM at all */
4461  if (strcmp(name, COB_DASH) != 0) {
4462  if (fread (bom, 3, 1, ppin) == 1) {
4463  if (bom[0] != 0xEF || bom[1] != 0xBB || bom[2] != 0xBF) {
4464  rewind (ppin);
4465  }
4466  } else {
4467  rewind (ppin);
4468  }
4469  }
4470 
4471  /* Preserve the current buffer */
4472  p = cobc_malloc (sizeof (struct copy_info));
4473  p->file = cb_source_file;
4475 
4476  /* Save variables */
4478  p->line = cb_source_line;
4481 
4482  p->next = copy_stack;
4483  copy_stack = p;
4484 
4485  /* Set replacing list */
4486  if (replacing_list) {
4487  if (current_replace_list) {
4488  replacing_list->last->next = current_replace_list;
4489  replacing_list->last = current_replace_list->last;
4490  }
4491  current_replace_list = replacing_list;
4492  }
4493 
4494  dname = cobc_strdup (name);
4495  p->dname = dname;
4496  for (s = dname; *s; ++s) {
4497  if (*s == '\\') {
4498  *s = '/';
4499  }
4500  }
4501 
4502  /* Switch to new buffer */
4504  return 0;
4505 }
const char * cb_source_file
Definition: cobc.c:145
static int quotation_mark
Definition: pplex.c:2140
int cb_source_format
Definition: cobc.c:162
int quotation_mark
Definition: pplex.c:2114
static struct copy_info * copy_stack
Definition: pplex.c:2151
static void switch_to_buffer(const int, const char *, const YY_BUFFER_STATE)
Definition: pplex.c:4677
struct copy_info * next
Definition: pplex.c:2108
static size_t newline_count
Definition: pplex.c:2131
#define _(s)
Definition: cobcrun.c:59
#define COB_DASH
Definition: cobc.h:121
struct cb_replace_list * replacing
Definition: pplex.c:2111
int line
Definition: pplex.c:2113
struct cb_replace_list * last
Definition: cobc.h:168
int source_format
Definition: pplex.c:2115
YY_BUFFER_STATE pp_create_buffer(FILE *file, int size)
Allocate and initialize an input buffer state.
Definition: pplex.c:4020
#define YY_CURRENT_BUFFER
Definition: pplex.c:293
static struct cb_replace_list * current_replace_list
Definition: pplex.c:2145
void * cobc_strdup(const char *dupstr)
Definition: cobc.c:669
void cb_error(const char *,...) COB_A_FORMAT12
Definition: error.c:98
struct cb_replace_list * next
Definition: cobc.h:167
FILE * ppin
Definition: pplex.c:367
YY_BUFFER_STATE buffer
Definition: pplex.c:2112
void * cobc_malloc(const size_t size)
Definition: cobc.c:643
int cb_source_line
Definition: cobc.c:178
#define YY_BUF_SIZE
Definition: pplex.c:2065
const char * file
Definition: pplex.c:2109
char * dname
Definition: pplex.c:2110
int errorcount
Definition: cobc.c:173

Here is the call graph for this function:

Here is the caller graph for this function:

void ppparse_error ( const char *  msg)

Definition at line 4553 of file pplex.c.

References cb_plex_error().

4554 {
4556 }
static size_t newline_count
Definition: pplex.c:2131
void cb_plex_error(const size_t, const char *,...) COB_A_FORMAT23
Definition: error.c:130

Here is the call graph for this function:

void pppop_buffer_state ( void  )

Removes and deletes the top of the stack, if present.

The next element becomes the new top.

Definition at line 4154 of file pplex.c.

References NULL, pp_delete_buffer(), pp_load_buffer_state(), yy_buffer_stack_top, YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, and yy_did_buffer_switch_on_eof.

Referenced by pplex_destroy().

4155 {
4156  if (!YY_CURRENT_BUFFER)
4157  return;
4158 
4161  if ((yy_buffer_stack_top) > 0)
4162  --(yy_buffer_stack_top);
4163 
4164  if (YY_CURRENT_BUFFER) {
4167  }
4168 }
#define YY_CURRENT_BUFFER_LVALUE
Definition: pplex.c:300
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
static size_t yy_buffer_stack_top
index of top of stack.
Definition: pplex.c:283
#define YY_CURRENT_BUFFER
Definition: pplex.c:293
static void pp_load_buffer_state(void)
Definition: pplex.c:4006
static int yy_did_buffer_switch_on_eof
Definition: pplex.c:315
void pp_delete_buffer(YY_BUFFER_STATE b)
Destroy the buffer.
Definition: pplex.c:4048

Here is the call graph for this function:

Here is the caller graph for this function:

void pppush_buffer_state ( YY_BUFFER_STATE  new_buffer)

Pushes the new state onto the stack.

The new state becomes the current state. This function will allocate the stack if necessary.

Parameters
new_bufferThe new state.

Definition at line 4124 of file pplex.c.

References NULL, pp_load_buffer_state(), ppensure_buffer_stack(), yy_buffer_stack_top, yy_c_buf_p, YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, yy_did_buffer_switch_on_eof, yy_hold_char, and yy_n_chars.

4125 {
4126  if (new_buffer == NULL)
4127  return;
4128 
4130 
4131  /* This block is copied from pp_switch_to_buffer. */
4132  if ( YY_CURRENT_BUFFER )
4133  {
4134  /* Flush out information for old buffer. */
4135  *(yy_c_buf_p) = (yy_hold_char);
4136  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
4137  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
4138  }
4139 
4140  /* Only push if top exists. Otherwise, replace top. */
4141  if (YY_CURRENT_BUFFER)
4142  (yy_buffer_stack_top)++;
4143  YY_CURRENT_BUFFER_LVALUE = new_buffer;
4144 
4145  /* copied from pp_switch_to_buffer. */
4148 }
static char yy_hold_char
Definition: pplex.c:303
#define YY_CURRENT_BUFFER_LVALUE
Definition: pplex.c:300
static yy_size_t yy_n_chars
Definition: pplex.c:304
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
static size_t yy_buffer_stack_top
index of top of stack.
Definition: pplex.c:283
#define YY_CURRENT_BUFFER
Definition: pplex.c:293
static void pp_load_buffer_state(void)
Definition: pplex.c:4006
static char * yy_c_buf_p
Definition: pplex.c:308
static void ppensure_buffer_stack(void)
Definition: pplex.c:4173
static int yy_did_buffer_switch_on_eof
Definition: pplex.c:315

Here is the call graph for this function:

void * pprealloc ( void *  ptr,
yy_size_t  size 
)

Definition at line 4368 of file pplex.c.

Referenced by ppensure_buffer_stack(), yy_get_next_buffer(), and yy_push_state().

4369 {
4370  /* The cast to (char *) in the following accommodates both
4371  * implementations that use char* generic pointers, and those
4372  * that use void* generic pointers. It works with the latter
4373  * because both ANSI C and C++ allow castless assignment from
4374  * any pointer type to void*, and deal with argument conversions
4375  * as though doing an assignment.
4376  */
4377  return (void *) realloc( (char *) ptr, size );
4378 }

Here is the caller graph for this function:

void pprestart ( FILE *  input_file)

Immediately switch to a different input stream.

Parameters
input_fileA readable stream.
Note
This function does not reset the start condition to INITIAL .

Definition at line 3958 of file pplex.c.

References pp_create_buffer(), pp_init_buffer(), pp_load_buffer_state(), ppensure_buffer_stack(), ppin, YY_BUF_SIZE, YY_CURRENT_BUFFER, and YY_CURRENT_BUFFER_LVALUE.

Referenced by input(), and yy_get_next_buffer().

3959 {
3960 
3961  if ( ! YY_CURRENT_BUFFER ){
3965  }
3966 
3967  pp_init_buffer(YY_CURRENT_BUFFER,input_file );
3969 }
static void pp_init_buffer(YY_BUFFER_STATE b, FILE *file)
Definition: pplex.c:4067
#define YY_CURRENT_BUFFER_LVALUE
Definition: pplex.c:300
YY_BUFFER_STATE pp_create_buffer(FILE *file, int size)
Allocate and initialize an input buffer state.
Definition: pplex.c:4020
#define YY_CURRENT_BUFFER
Definition: pplex.c:293
static void pp_load_buffer_state(void)
Definition: pplex.c:4006
FILE * ppin
Definition: pplex.c:367
#define YY_BUF_SIZE
Definition: pplex.c:2065
static void ppensure_buffer_stack(void)
Definition: pplex.c:4173

Here is the call graph for this function:

Here is the caller graph for this function:

static int ppwrap ( void  )
static

Definition at line 2068 of file pplex.c.

Referenced by input(), and pplex().

2068  {
2069  return 1;
2070 }

Here is the caller graph for this function:

static void skip_to_eol ( void  )
static

Definition at line 5268 of file pplex.c.

References input(), and unput.

Referenced by check_comments(), and pplex().

5269 {
5270  int c;
5271 
5272  /* Skip bytes to end of line */
5273  while ((c = input ()) != EOF) {
5274  if (c == '\n') {
5275  break;
5276  }
5277  }
5278  if (c != EOF) {
5279  unput (c);
5280  }
5281 }
static int input(void)
Definition: pplex.c:3881
#define unput(c)
Definition: pplex.c:215

Here is the call graph for this function:

Here is the caller graph for this function:

static void switch_to_buffer ( const int  line,
const char *  file,
const YY_BUFFER_STATE  buffer 
)
static

Definition at line 4677 of file pplex.c.

References cb_source_file, cb_source_line, cobc_plex_strdup(), line, pp_switch_to_buffer(), and ppout.

Referenced by pplex(), and ppopen().

4678 {
4679  /* Reset file/line */
4680  cb_source_line = line;
4682  fprintf (ppout, "#line %d \"%s\"\n", line, file);
4683  /* Switch buffer */
4684  pp_switch_to_buffer (buffer);
4685 }
const char * cb_source_file
Definition: cobc.c:145
FILE * ppout
Definition: pplex.c:367
void pp_switch_to_buffer(YY_BUFFER_STATE new_buffer)
Switch to a different input buffer.
Definition: pplex.c:3975
void * cobc_plex_strdup(const char *dupstr)
Definition: cobc.c:933
if fold fold static computed alternate extra correct stack on syntax debugging source implicit stack syntax write single recursive relax optional file
Definition: flag.def:129
if fold fold static computed alternate extra correct stack on syntax debugging line
Definition: flag.def:90
int cb_source_line
Definition: cobc.c:178

Here is the call graph for this function:

Here is the caller graph for this function:

static void yy_fatal_error ( char  msg[])
static
static void yy_fatal_error ( char *  msg)
static

Definition at line 4252 of file pplex.c.

References YY_EXIT_FAILURE.

4253 {
4254  (void) fprintf( stderr, "%s\n", msg );
4255  exit( YY_EXIT_FAILURE );
4256 }
#define YY_EXIT_FAILURE
Definition: pplex.c:4249
static int yy_get_next_buffer ( void  )
static

Definition at line 3650 of file pplex.c.

References EOB_ACT_CONTINUE_SCAN, EOB_ACT_END_OF_FILE, EOB_ACT_LAST_MATCH, ppin, pprealloc(), pprestart(), yy_buffer_state::yy_buf_size, YY_BUFFER_EOF_PENDING, yy_c_buf_p, yy_buffer_state::yy_ch_buf, YY_CURRENT_BUFFER_LVALUE, YY_END_OF_BUFFER_CHAR, YY_FATAL_ERROR, YY_INPUT, yy_buffer_state::yy_is_our_buffer, YY_MORE_ADJ, yy_n_chars, YY_READ_BUF_SIZE, and yytext_ptr.

Referenced by input(), and pplex().

3651 {
3652  register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
3653  register char *source = (yytext_ptr);
3654  register int number_to_move, i;
3655  int ret_val;
3656 
3657  if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
3659  "fatal flex scanner internal error--end of buffer missed" );
3660 
3661  if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
3662  { /* Don't try to fill the buffer, so this is an EOF. */
3663  if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
3664  {
3665  /* We matched a single character, the EOB, so
3666  * treat this as a final EOF.
3667  */
3668  return EOB_ACT_END_OF_FILE;
3669  }
3670 
3671  else
3672  {
3673  /* We matched some text prior to the EOB, first
3674  * process it.
3675  */
3676  return EOB_ACT_LAST_MATCH;
3677  }
3678  }
3679 
3680  /* Try to read more data. */
3681 
3682  /* First move last chars to start of buffer. */
3683  number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
3684 
3685  for ( i = 0; i < number_to_move; ++i )
3686  *(dest++) = *(source++);
3687 
3688  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
3689  /* don't do the read, it's not guaranteed to return an EOF,
3690  * just force an EOF
3691  */
3692  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
3693 
3694  else
3695  {
3696  yy_size_t num_to_read =
3697  YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
3698 
3699  while ( num_to_read <= 0 )
3700  { /* Not enough room in the buffer - grow it. */
3701 
3702  /* just a shorter name for the current buffer */
3704 
3705  int yy_c_buf_p_offset =
3706  (int) ((yy_c_buf_p) - b->yy_ch_buf);
3707 
3708  if ( b->yy_is_our_buffer )
3709  {
3710  yy_size_t new_size = b->yy_buf_size * 2;
3711 
3712  if ( new_size <= 0 )
3713  b->yy_buf_size += b->yy_buf_size / 8;
3714  else
3715  b->yy_buf_size *= 2;
3716 
3717  b->yy_ch_buf = (char *)
3718  /* Include room in for 2 EOB chars. */
3719  pprealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
3720  }
3721  else
3722  /* Can't grow it, we don't own it. */
3723  b->yy_ch_buf = 0;
3724 
3725  if ( ! b->yy_ch_buf )
3727  "fatal error - scanner input buffer overflow" );
3728 
3729  (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
3730 
3731  num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
3732  number_to_move - 1;
3733 
3734  }
3735 
3736  if ( num_to_read > YY_READ_BUF_SIZE )
3737  num_to_read = YY_READ_BUF_SIZE;
3738 
3739  /* Read in more data. */
3740  YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
3741  (yy_n_chars), num_to_read );
3742 
3743  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
3744  }
3745 
3746  if ( (yy_n_chars) == 0 )
3747  {
3748  if ( number_to_move == YY_MORE_ADJ )
3749  {
3750  ret_val = EOB_ACT_END_OF_FILE;
3751  pprestart(ppin );
3752  }
3753 
3754  else
3755  {
3756  ret_val = EOB_ACT_LAST_MATCH;
3757  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
3759  }
3760  }
3761 
3762  else
3763  ret_val = EOB_ACT_CONTINUE_SCAN;
3764 
3765  if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
3766  /* Extend the array by 50%, plus the number we really need. */
3767  yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
3768  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) pprealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
3769  if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
3770  YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
3771  }
3772 
3773  (yy_n_chars) += number_to_move;
3776 
3777  (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
3778 
3779  return ret_val;
3780 }
#define YY_INPUT(buf, result, max_size)
Definition: pplex.c:2073
void pprestart(FILE *input_file)
Immediately switch to a different input stream.
Definition: pplex.c:3958
#define YY_END_OF_BUFFER_CHAR
Definition: pplex.c:161
yy_size_t yy_buf_size
Definition: pplex.c:229
#define EOB_ACT_END_OF_FILE
Definition: pplex.c:195
#define EOB_ACT_CONTINUE_SCAN
Definition: pplex.c:194
#define YY_CURRENT_BUFFER_LVALUE
Definition: pplex.c:300
#define YY_BUFFER_EOF_PENDING
Definition: pplex.c:277
#define YY_READ_BUF_SIZE
Definition: pplex.c:2063
static yy_size_t yy_n_chars
Definition: pplex.c:304
char * yy_ch_buf
Definition: pplex.c:223
#define yytext_ptr
Definition: pplex.c:376
int yy_is_our_buffer
Definition: pplex.c:240
static char * yy_c_buf_p
Definition: pplex.c:308
FILE * ppin
Definition: pplex.c:367
#define YY_FATAL_ERROR(msg)
Definition: pplex.c:2316
#define YY_MORE_ADJ
Definition: pplex.c:2038
void * pprealloc(void *, yy_size_t)
Definition: pplex.c:4368
#define EOB_ACT_LAST_MATCH
Definition: pplex.c:196
size_t yy_size_t
Definition: pplex.c:187

Here is the call graph for this function:

Here is the caller graph for this function:

static yy_state_type yy_get_previous_state ( void  )
static

Definition at line 3784 of file pplex.c.

References YY_AT_BOL, yy_c_buf_p, yy_last_accepting_cpos, yy_last_accepting_state, YY_MORE_ADJ, YY_SC_TO_UI, yy_start, and yytext_ptr.

Referenced by pplex().

3785 {
3786  register yy_state_type yy_current_state;
3787  register char *yy_cp;
3788 
3789  yy_current_state = (yy_start);
3790  yy_current_state += YY_AT_BOL();
3791 
3792  for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
3793  {
3794  register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
3795  if ( yy_accept[yy_current_state] )
3796  {
3797  (yy_last_accepting_state) = yy_current_state;
3798  (yy_last_accepting_cpos) = yy_cp;
3799  }
3800  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
3801  {
3802  yy_current_state = (int) yy_def[yy_current_state];
3803  if ( yy_current_state >= 1082 )
3804  yy_c = yy_meta[(unsigned int) yy_c];
3805  }
3806  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
3807  }
3808 
3809  return yy_current_state;
3810 }
static char * yy_last_accepting_cpos
Definition: pplex.c:2028
static flex_int16_t yy_base[1183]
Definition: pplex.c:569
unsigned char YY_CHAR
Definition: pplex.c:365
static flex_int16_t yy_accept[1082]
Definition: pplex.c:402
static int yy_start
Definition: pplex.c:310
static flex_int32_t yy_meta[74]
Definition: pplex.c:557
static flex_int16_t yy_nxt[5374]
Definition: pplex.c:837
#define YY_AT_BOL()
Definition: pplex.c:361
int yy_state_type
Definition: pplex.c:369
#define YY_SC_TO_UI(c)
Definition: pplex.c:140
#define yytext_ptr
Definition: pplex.c:376
static flex_int16_t yy_chk[5374]
Definition: pplex.c:1432
static char * yy_c_buf_p
Definition: pplex.c:308
static yy_state_type yy_last_accepting_state
Definition: pplex.c:2027
#define YY_MORE_ADJ
Definition: pplex.c:2038
static flex_int16_t yy_def[1183]
Definition: pplex.c:703
static flex_int32_t yy_ec[256]
Definition: pplex.c:525

Here is the caller graph for this function:

static int yy_init_globals ( void  )
static

Get the current token.

Definition at line 4281 of file pplex.c.

References NULL, ppin, ppout, yy_buffer_stack, yy_buffer_stack_max, yy_buffer_stack_top, yy_c_buf_p, yy_init, yy_start, yy_start_stack, yy_start_stack_depth, and yy_start_stack_ptr.

Referenced by pplex_destroy().

4282 {
4283  /* Initialization is the same as for the non-reentrant scanner.
4284  * This function is called from pplex_destroy(), so don't allocate here.
4285  */
4286 
4287  (yy_buffer_stack) = 0;
4288  (yy_buffer_stack_top) = 0;
4289  (yy_buffer_stack_max) = 0;
4290  (yy_c_buf_p) = (char *) 0;
4291  (yy_init) = 0;
4292  (yy_start) = 0;
4293 
4294  (yy_start_stack_ptr) = 0;
4295  (yy_start_stack_depth) = 0;
4296  (yy_start_stack) = NULL;
4297 
4298 /* Defined in main.c */
4299 #ifdef YY_STDINIT
4300  ppin = stdin;
4301  ppout = stdout;
4302 #else
4303  ppin = (FILE *) 0;
4304  ppout = (FILE *) 0;
4305 #endif
4306 
4307  /* For future reference: Set errno on error, since we are called by
4308  * pplex_init()
4309  */
4310  return 0;
4311 }
FILE * ppout
Definition: pplex.c:367
static int yy_init
Definition: pplex.c:309
static int yy_start_stack_ptr
Definition: pplex.c:2239
static YY_BUFFER_STATE * yy_buffer_stack
Stack as an array.
Definition: pplex.c:285
static int yy_start
Definition: pplex.c:310
static int * yy_start_stack
Definition: pplex.c:2241
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
static size_t yy_buffer_stack_top
index of top of stack.
Definition: pplex.c:283
static size_t yy_buffer_stack_max
capacity of stack.
Definition: pplex.c:284
static char * yy_c_buf_p
Definition: pplex.c:308
FILE * ppin
Definition: pplex.c:367
static int yy_start_stack_depth
Definition: pplex.c:2240

Here is the caller graph for this function:

static void yy_pop_state ( void  )
static

Definition at line 4240 of file pplex.c.

References BEGIN, and YY_FATAL_ERROR.

Referenced by pplex().

4241 {
4242  if ( --(yy_start_stack_ptr) < 0 )
4243  YY_FATAL_ERROR( "start-condition stack underflow" );
4244 
4246 }
static int yy_start_stack_ptr
Definition: pplex.c:2239
static int * yy_start_stack
Definition: pplex.c:2241
#define BEGIN
Definition: pplex.c:146
#define YY_FATAL_ERROR(msg)
Definition: pplex.c:2316

Here is the caller graph for this function:

static void yy_push_state ( int  new_state)
static

Definition at line 4216 of file pplex.c.

References BEGIN, ppalloc(), pprealloc(), YY_FATAL_ERROR, YY_START, yy_start_stack, yy_start_stack_depth, and YY_START_STACK_INCR.

Referenced by pplex().

4217 {
4219  {
4220  yy_size_t new_size;
4221 
4223  new_size = (yy_start_stack_depth) * sizeof( int );
4224 
4225  if ( ! (yy_start_stack) )
4226  (yy_start_stack) = (int *) ppalloc(new_size );
4227 
4228  else
4229  (yy_start_stack) = (int *) pprealloc((void *) (yy_start_stack),new_size );
4230 
4231  if ( ! (yy_start_stack) )
4232  YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
4233  }
4234 
4236 
4237  BEGIN(new_state);
4238 }
#define YY_START
Definition: pplex.c:152
static int yy_start_stack_ptr
Definition: pplex.c:2239
void * ppalloc(yy_size_t)
Definition: pplex.c:4363
#define YY_START_STACK_INCR
Definition: pplex.c:2311
static int * yy_start_stack
Definition: pplex.c:2241
#define BEGIN
Definition: pplex.c:146
#define YY_FATAL_ERROR(msg)
Definition: pplex.c:2316
static int yy_start_stack_depth
Definition: pplex.c:2240
void * pprealloc(void *, yy_size_t)
Definition: pplex.c:4368
size_t yy_size_t
Definition: pplex.c:187

Here is the call graph for this function:

Here is the caller graph for this function:

static yy_state_type yy_try_NUL_trans ( yy_state_type  current_state)
static

Definition at line 3817 of file pplex.c.

References yy_c_buf_p, yy_last_accepting_cpos, and yy_last_accepting_state.

Referenced by pplex().

3818 {
3819  register int yy_is_jam;
3820  register char *yy_cp = (yy_c_buf_p);
3821 
3822  register YY_CHAR yy_c = 1;
3823  if ( yy_accept[yy_current_state] )
3824  {
3825  (yy_last_accepting_state) = yy_current_state;
3826  (yy_last_accepting_cpos) = yy_cp;
3827  }
3828  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
3829  {
3830  yy_current_state = (int) yy_def[yy_current_state];
3831  if ( yy_current_state >= 1082 )
3832  yy_c = yy_meta[(unsigned int) yy_c];
3833  }
3834  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
3835  yy_is_jam = (yy_current_state == 1081);
3836 
3837  return yy_is_jam ? 0 : yy_current_state;
3838 }
static char * yy_last_accepting_cpos
Definition: pplex.c:2028
static flex_int16_t yy_base[1183]
Definition: pplex.c:569
unsigned char YY_CHAR
Definition: pplex.c:365
static flex_int16_t yy_accept[1082]
Definition: pplex.c:402
static flex_int32_t yy_meta[74]
Definition: pplex.c:557
static flex_int16_t yy_nxt[5374]
Definition: pplex.c:837
static flex_int16_t yy_chk[5374]
Definition: pplex.c:1432
static char * yy_c_buf_p
Definition: pplex.c:308
static yy_state_type yy_last_accepting_state
Definition: pplex.c:2027
static flex_int16_t yy_def[1183]
Definition: pplex.c:703

Here is the caller graph for this function:

static void yyunput ( int  c,
char *  buf_ptr 
)
static
static void yyunput ( int  c,
register char *  yy_bp 
)
static

Definition at line 3840 of file pplex.c.

References yy_c_buf_p, YY_CURRENT_BUFFER_LVALUE, YY_FATAL_ERROR, yy_hold_char, yy_n_chars, and yytext_ptr.

3841 {
3842  register char *yy_cp;
3843 
3844  yy_cp = (yy_c_buf_p);
3845 
3846  /* undo effects of setting up pptext */
3847  *yy_cp = (yy_hold_char);
3848 
3849  if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
3850  { /* need to shift things up to make room */
3851  /* +2 for EOB chars. */
3852  register yy_size_t number_to_move = (yy_n_chars) + 2;
3853  register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
3854  YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
3855  register char *source =
3856  &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
3857 
3858  while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
3859  *--dest = *--source;
3860 
3861  yy_cp += (int) (dest - source);
3862  yy_bp += (int) (dest - source);
3863  YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
3864  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
3865 
3866  if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
3867  YY_FATAL_ERROR( "flex scanner push-back overflow" );
3868  }
3869 
3870  *--yy_cp = (char) c;
3871 
3872  (yytext_ptr) = yy_bp;
3873  (yy_hold_char) = *yy_cp;
3874  (yy_c_buf_p) = yy_cp;
3875 }
static char yy_hold_char
Definition: pplex.c:303
#define YY_CURRENT_BUFFER_LVALUE
Definition: pplex.c:300
static yy_size_t yy_n_chars
Definition: pplex.c:304
#define yytext_ptr
Definition: pplex.c:376
static char * yy_c_buf_p
Definition: pplex.c:308
#define YY_FATAL_ERROR(msg)
Definition: pplex.c:2316
size_t yy_size_t
Definition: pplex.c:187

Variable Documentation

struct cb_replace_list* base_replace_list = ((void*)0)
static

Definition at line 2147 of file pplex.c.

Referenced by pp_set_replace_list(), and ppecho().

size_t buffer_overflow = 0
static

Definition at line 2136 of file pplex.c.

size_t comment_allowed
static

Definition at line 2137 of file pplex.c.

size_t consecutive_quotation = 0
static

Definition at line 2134 of file pplex.c.

struct copy_info* copy_stack = ((void*)0)
static

Definition at line 2151 of file pplex.c.

Referenced by pplex(), and ppopen().

struct cb_replace_list* current_replace_list = ((void*)0)
static

Definition at line 2145 of file pplex.c.

Referenced by ppopen().

size_t inside_bracket = 0
static

Definition at line 2133 of file pplex.c.

int listing_line = 0
static

Definition at line 2141 of file pplex.c.

size_t need_continuation = 0
static

Definition at line 2135 of file pplex.c.

size_t newline_count = 0
static

Definition at line 2131 of file pplex.c.

Referenced by ppinput().

struct plex_stack plex_cond_stack[16]
static

Definition at line 2153 of file pplex.c.

Referenced by plex_action_directive(), plex_clear_vars(), and pplex().

unsigned int plex_nest_depth = 0
static

Definition at line 2139 of file pplex.c.

Referenced by plex_action_directive(), and pplex().

unsigned int plex_skip_input = 0
static

Definition at line 2138 of file pplex.c.

char* plexbuff1 = ((void*)0)
static

Definition at line 2129 of file pplex.c.

Referenced by ppcopy().

char* plexbuff2 = ((void*)0)
static

Definition at line 2130 of file pplex.c.

int pp_flex_debug = 0

Definition at line 2031 of file pplex.c.

FILE* ppin = (FILE *) 0
yy_size_t ppleng

Definition at line 305 of file pplex.c.

Referenced by check_comments(), and pplex().

int pplineno = 1

Definition at line 373 of file pplex.c.

FILE * ppout = (FILE *) 0

Definition at line 367 of file pplex.c.

Referenced by ppecho(), pplex(), switch_to_buffer(), and yy_init_globals().

char * pptext

Definition at line 2040 of file pplex.c.

Referenced by ppecho().

int quotation_mark = 0
static

Definition at line 2140 of file pplex.c.

Referenced by ppopen().

int requires_listing_line
static

Definition at line 2142 of file pplex.c.

int requires_new_line = 0
static

Definition at line 2143 of file pplex.c.

struct cb_replace_list* save_current_replace = ((void*)0)
static

Definition at line 2146 of file pplex.c.

struct cb_text_list* text_queue = ((void*)0)
static

Definition at line 2149 of file pplex.c.

Referenced by ppecho().

size_t within_comment = 0
static

Definition at line 2132 of file pplex.c.

flex_int16_t yy_accept[1082]
static

Definition at line 402 of file pplex.c.

flex_int16_t yy_base[1183]
static

Definition at line 569 of file pplex.c.

YY_BUFFER_STATE* yy_buffer_stack = 0
static

Stack as an array.

Definition at line 285 of file pplex.c.

Referenced by ppensure_buffer_stack(), pplex_destroy(), and yy_init_globals().

size_t yy_buffer_stack_max = 0
static

capacity of stack.

Definition at line 284 of file pplex.c.

Referenced by ppensure_buffer_stack(), and yy_init_globals().

size_t yy_buffer_stack_top = 0
static

index of top of stack.

Definition at line 283 of file pplex.c.

Referenced by ppensure_buffer_stack(), pppop_buffer_state(), pppush_buffer_state(), and yy_init_globals().

flex_int16_t yy_chk[5374]
static

Definition at line 1432 of file pplex.c.

flex_int16_t yy_def[1183]
static

Definition at line 703 of file pplex.c.

int yy_did_buffer_switch_on_eof
static

Definition at line 315 of file pplex.c.

Referenced by input(), pp_switch_to_buffer(), pplex(), pppop_buffer_state(), and pppush_buffer_state().

flex_int32_t yy_ec[256]
static

Definition at line 525 of file pplex.c.

char yy_hold_char
static
int yy_init = 0
static

Definition at line 309 of file pplex.c.

Referenced by pplex(), and yy_init_globals().

char* yy_last_accepting_cpos
static

Definition at line 2028 of file pplex.c.

Referenced by pplex(), yy_get_previous_state(), and yy_try_NUL_trans().

yy_state_type yy_last_accepting_state
static

Definition at line 2027 of file pplex.c.

Referenced by pplex(), yy_get_previous_state(), and yy_try_NUL_trans().

flex_int32_t yy_meta[74]
static
Initial value:
=
{ 0,
1, 2, 3, 1, 4, 1, 5, 1, 1, 1,
6, 7, 8, 7, 7, 7, 7, 1, 1, 1,
1, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 9
}

Definition at line 557 of file pplex.c.

flex_int16_t yy_nxt[5374]
static

Definition at line 837 of file pplex.c.

int yy_start = 0
static

Definition at line 310 of file pplex.c.

Referenced by pplex(), yy_get_previous_state(), and yy_init_globals().

int* yy_start_stack = ((void*)0)
static

Definition at line 2241 of file pplex.c.

Referenced by pplex_destroy(), yy_init_globals(), and yy_push_state().

int yy_start_stack_depth = 0
static

Definition at line 2240 of file pplex.c.

Referenced by yy_init_globals(), and yy_push_state().

int yy_start_stack_ptr = 0
static

Definition at line 2239 of file pplex.c.

Referenced by yy_init_globals().