GnuCOBOL  2.0
A free COBOL compiler
scanner.c File Reference
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include "config.h"
#include <ctype.h>
#include "cobc.h"
#include "tree.h"
#include "parser.h"
Include dependency graph for scanner.c:

Go to the source code of this file.

Data Structures

struct  yy_buffer_state
 
struct  yy_trans_info
 
struct  cb_level_78
 
struct  cb_top_level_78
 

Macros

#define YY_INT_ALIGNED   short int
 
#define FLEX_SCANNER
 
#define YY_FLEX_MAJOR_VERSION   2
 
#define YY_FLEX_MINOR_VERSION   5
 
#define YY_FLEX_SUBMINOR_VERSION   39
 
#define 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   yyrestart(yyin )
 
#define YY_END_OF_BUFFER_CHAR   0
 
#define YY_BUF_SIZE   16384
 
#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
 
#define YY_TYPEDEF_YY_BUFFER_STATE
 
#define YY_TYPEDEF_YY_SIZE_T
 
#define EOB_ACT_CONTINUE_SCAN   0
 
#define EOB_ACT_END_OF_FILE   1
 
#define EOB_ACT_LAST_MATCH   2
 
#define YY_LESS_LINENO(n)
 
#define YY_LINENO_REWIND_TO(ptr)
 
#define yyless(n)
 
#define unput(c)   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   yy_flush_buffer(YY_CURRENT_BUFFER )
 
#define yy_new_buffer   yy_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   yytext
 
#define YY_DO_BEFORE_ACTION
 
#define YY_NUM_RULES   129
 
#define YY_END_OF_BUFFER   130
 
#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 YY_INPUT(buf, result, max_size)
 
#define YY_USER_INIT
 
#define YY_NO_UNISTD_H   1
 
#define COB_IN_SCANNER   1
 
#define YYSTYPE   cb_tree
 
#define INITIAL   0
 
#define DECIMAL_IS_PERIOD   1
 
#define DECIMAL_IS_COMMA   2
 
#define PICTURE_STATE   3
 
#define FUNCTION_STATE   4
 
#define YY_EXTRA_TYPE   void *
 
#define ECHO   do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
 
#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 yylex (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"
 
#define INCREMENT_IF_SIGNED(text, sign)
 

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 yyrestart (FILE *input_file)
 Immediately switch to a different input stream. More...
 
void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer)
 Switch to a different input buffer. More...
 
YY_BUFFER_STATE yy_create_buffer (FILE *file, int size)
 Allocate and initialize an input buffer state. More...
 
void yy_delete_buffer (YY_BUFFER_STATE b)
 Destroy the buffer. More...
 
void yy_flush_buffer (YY_BUFFER_STATE b)
 Discard all buffered characters. More...
 
void yypush_buffer_state (YY_BUFFER_STATE new_buffer)
 Pushes the new state onto the stack. More...
 
void yypop_buffer_state (void)
 Removes and deletes the top of the stack, if present. More...
 
static void yyensure_buffer_stack (void)
 
static void yy_load_buffer_state (void)
 
static void yy_init_buffer (YY_BUFFER_STATE b, FILE *file)
 
YY_BUFFER_STATE yy_scan_buffer (char *base, yy_size_t size)
 
YY_BUFFER_STATE yy_scan_string (char *yy_str)
 
YY_BUFFER_STATE yy_scan_bytes (char *bytes, yy_size_t len)
 
void * yyalloc (yy_size_t)
 
void * yyrealloc (void *, yy_size_t)
 
void yyfree (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 yywrap (void)
 
static void read_literal (const char)
 
static int scan_x (const char *)
 
static int scan_z (const char *, const cob_u32_t)
 
static int scan_h (const char *, const cob_u32_t)
 
static int scan_b (const char *, const cob_u32_t)
 
static int scan_o (const char *)
 
static int scan_numeric (const char *)
 
static int scan_floating_numeric (const char *)
 
static void scan_picture (const char *)
 
static void count_lines (const char *)
 
static void scan_define_options (const char *)
 
static void scan_options (const char *, const unsigned int)
 
static int yy_init_globals (void)
 Get the current token. More...
 
int yylex_destroy (void)
 
static void yyunput (int c, char *buf_ptr)
 
static int input (void)
 
int yylex (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)
 
static void error_literal (const char *type, const char *literal)
 
static int get_sign (const char sign)
 
static int all_zeroes (const char *str)
 
static int significand_is_zero (const char *int_part, const char *dec_part)
 
static int can_replace (const char *src1, const char *src2, const size_t size, const size_t iteration)
 
static const char * check_78_replace (const cb_tree p)
 
static void cb_add_const_var (const char *name, cb_tree value)
 
void ylex_clear_all (void)
 
void ylex_call_destroy (void)
 
void cb_unput_dot (void)
 
void cb_reset_78 (void)
 
void cb_reset_global_78 (void)
 
void cb_add_78 (struct cb_field *f)
 
struct cb_fieldcheck_level_78 (const char *name)
 
struct cb_programcb_find_defined_program_by_name (const char *name)
 
struct cb_programcb_find_defined_program_by_id (const char *orig_id)
 
void cobc_init_scanner (void)
 

Variables

yy_size_t yyleng
 
FILE * yyin = (FILE *) 0
 
FILE * yyout = (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 yylineno = 1
 
char * yytext
 
static flex_int16_t yy_accept [833]
 
static flex_int32_t yy_ec [256]
 
static flex_int32_t yy_meta [75]
 
static flex_int16_t yy_base [865]
 
static flex_int16_t yy_def [865]
 
static flex_int16_t yy_nxt [2719]
 
static flex_int16_t yy_chk [2719]
 
static yy_state_type yy_last_accepting_state
 
static char * yy_last_accepting_cpos
 
int yy_flex_debug = 0
 
static struct cb_level_78top78ptr = ((void*)0)
 
static struct cb_level_78const78ptr = ((void*)0)
 
static struct cb_level_78lev78ptr = ((void*)0)
 
static struct cb_level_78globlev78ptr = ((void*)0)
 
static char * plexbuff = ((void*)0)
 
static char * picbuff1 = ((void*)0)
 
static char * picbuff2 = ((void*)0)
 
static size_t plexsize
 
static size_t pic1size
 
static size_t pic2size
 
static unsigned int last_token_is_dot = 0
 
static unsigned int integer_is_label = 0
 
static unsigned int inside_bracket = 0
 
static unsigned int literal_error
 
static char err_msg [COB_MINI_BUFF]
 
static unsigned char valid_char [256]
 
static const unsigned char pvalid_char []
 

Macro Definition Documentation

#define BEGIN   (yy_start) = 1 + 2 *

Definition at line 127 of file scanner.c.

Referenced by yylex().

#define COB_IN_SCANNER   1

Definition at line 1409 of file scanner.c.

#define DECIMAL_IS_COMMA   2

Definition at line 1545 of file scanner.c.

Referenced by yylex().

#define DECIMAL_IS_PERIOD   1

Definition at line 1544 of file scanner.c.

Referenced by yylex().

#define ECHO   do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)

Definition at line 1615 of file scanner.c.

#define EOB_ACT_CONTINUE_SCAN   0

Definition at line 175 of file scanner.c.

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

#define EOB_ACT_END_OF_FILE   1

Definition at line 176 of file scanner.c.

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

#define EOB_ACT_LAST_MATCH   2

Definition at line 177 of file scanner.c.

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

#define FLEX_BETA

Definition at line 14 of file scanner.c.

#define FLEX_SCANNER

Definition at line 9 of file scanner.c.

#define FLEXINT_H

Definition at line 30 of file scanner.c.

#define FUNCTION_STATE   4

Definition at line 1547 of file scanner.c.

Referenced by yylex().

#define INCREMENT_IF_SIGNED (   text,
  sign 
)
Value:
do { \
if (sign) { \
(text)++; \
} \
if sign
Definition: flag.def:42
#define ONCE_COB
Definition: common.h:530

Definition at line 4236 of file scanner.c.

Referenced by scan_define_options(), scan_floating_numeric(), and scan_numeric().

#define INITIAL   0

Definition at line 1543 of file scanner.c.

Referenced by yylex().

#define INT16_MAX   (32767)

Definition at line 73 of file scanner.c.

#define INT16_MIN   (-32767-1)

Definition at line 64 of file scanner.c.

#define INT32_MAX   (2147483647)

Definition at line 76 of file scanner.c.

#define INT32_MIN   (-2147483647-1)

Definition at line 67 of file scanner.c.

#define INT8_MAX   (127)

Definition at line 70 of file scanner.c.

#define INT8_MIN   (-128)

Definition at line 61 of file scanner.c.

#define PICTURE_STATE   3

Definition at line 1546 of file scanner.c.

Referenced by yylex().

#define REJECT   reject_used_but_not_detected

Definition at line 1336 of file scanner.c.

#define UINT16_MAX   (65535U)

Definition at line 82 of file scanner.c.

#define UINT32_MAX   (4294967295U)

Definition at line 85 of file scanner.c.

#define UINT8_MAX   (255U)

Definition at line 79 of file scanner.c.

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

Definition at line 196 of file scanner.c.

Referenced by cb_unput_dot(), read_literal(), scan_picture(), and yylex().

#define YY_AT_BOL ( )    (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)

Definition at line 342 of file scanner.c.

Referenced by yy_get_previous_state(), and yylex().

#define YY_BREAK   break;

Definition at line 1694 of file scanner.c.

Referenced by yylex().

#define YY_BUF_SIZE   16384

Definition at line 1366 of file scanner.c.

Referenced by yylex(), and yyrestart().

#define YY_BUF_SIZE   32768

Definition at line 1366 of file scanner.c.

#define YY_BUFFER_EOF_PENDING   2

Definition at line 258 of file scanner.c.

Referenced by yy_get_next_buffer().

#define YY_BUFFER_NEW   0

Definition at line 246 of file scanner.c.

Referenced by yy_flush_buffer(), and yylex().

#define YY_BUFFER_NORMAL   1

Definition at line 247 of file scanner.c.

Referenced by yylex().

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

Definition at line 274 of file scanner.c.

Referenced by yy_delete_buffer(), yy_flush_buffer(), yy_init_buffer(), yy_switch_to_buffer(), yylex(), yylex_destroy(), yypop_buffer_state(), yypush_buffer_state(), and yyrestart().

#define YY_DECL   int yylex (void)

Definition at line 1682 of file scanner.c.

#define YY_DECL_IS_OURS   1

Definition at line 1678 of file scanner.c.

#define YY_DO_BEFORE_ACTION
Value:
(yytext_ptr) = yy_bp; \
yyleng = (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: scanner.c:284
#define yytext_ptr
Definition: scanner.c:357
static char * yy_c_buf_p
Definition: scanner.c:289
yy_size_t yyleng
Definition: scanner.c:286

Definition at line 367 of file scanner.c.

Referenced by yylex().

#define YY_END_OF_BUFFER   130

Definition at line 375 of file scanner.c.

Referenced by yylex().

#define YY_END_OF_BUFFER_CHAR   0

Definition at line 142 of file scanner.c.

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

#define YY_EXIT_FAILURE   2

Definition at line 3709 of file scanner.c.

Referenced by yy_fatal_error().

#define YY_EXTRA_TYPE   void *

Definition at line 1558 of file scanner.c.

#define YY_FATAL_ERROR (   msg)    yy_fatal_error( msg )
#define YY_FLEX_MAJOR_VERSION   2

Definition at line 10 of file scanner.c.

#define YY_FLEX_MINOR_VERSION   5

Definition at line 11 of file scanner.c.

#define YY_FLEX_SUBMINOR_VERSION   39

Definition at line 12 of file scanner.c.

#define YY_FLUSH_BUFFER   yy_flush_buffer(YY_CURRENT_BUFFER )

Definition at line 310 of file scanner.c.

#define YY_INPUT (   buf,
  result,
  max_size 
)
Value:
{ \
if (fgets (buf, (int)max_size, yyin) == NULL) { \
result = YY_NULL; \
} else { \
result = strlen (buf); \
} \
}
FILE * yyin
Definition: scanner.c:348
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
#define YY_NULL
Definition: scanner.c:114

Definition at line 1373 of file scanner.c.

Referenced by yy_get_next_buffer().

#define YY_INT_ALIGNED   short int

Definition at line 5 of file scanner.c.

#define YY_LESS_LINENO (   n)

Definition at line 179 of file scanner.c.

#define YY_LINENO_REWIND_TO (   ptr)

Definition at line 180 of file scanner.c.

#define YY_MORE_ADJ   0

Definition at line 1338 of file scanner.c.

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

#define yy_new_buffer   yy_create_buffer

Definition at line 320 of file scanner.c.

#define YY_NEW_FILE   yyrestart(yyin )

Definition at line 140 of file scanner.c.

Referenced by input(), and yylex().

#define YY_NO_UNISTD_H   1

Definition at line 1406 of file scanner.c.

#define YY_NULL   0

Definition at line 114 of file scanner.c.

#define YY_NUM_RULES   129

Definition at line 374 of file scanner.c.

#define YY_READ_BUF_SIZE   32768

Definition at line 1364 of file scanner.c.

Referenced by yy_get_next_buffer().

#define YY_RESTORE_YY_MORE_OFFSET

Definition at line 1339 of file scanner.c.

Referenced by yylex().

#define YY_RULE_SETUP
Value:
if ( yyleng > 0 ) \
(yytext[yyleng - 1] == '\n'); \
#define YY_USER_ACTION
Definition: scanner.c:1689
#define YY_CURRENT_BUFFER_LVALUE
Definition: scanner.c:281
yy_size_t yyleng
Definition: scanner.c:286
char * yytext
Definition: scanner.c:1340

Definition at line 1697 of file scanner.c.

Referenced by yylex().

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

Definition at line 121 of file scanner.c.

Referenced by yy_get_previous_state(), and yylex().

#define yy_set_bol (   at_bol)
Value:
{ \
} \
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
}
YY_BUFFER_STATE yy_create_buffer(FILE *file, int size)
Allocate and initialize an input buffer state.
Definition: scanner.c:3512
#define YY_CURRENT_BUFFER_LVALUE
Definition: scanner.c:281
#define YY_BUF_SIZE
Definition: scanner.c:1366
#define YY_CURRENT_BUFFER
Definition: scanner.c:274
FILE * yyin
Definition: scanner.c:348
static void yyensure_buffer_stack(void)
Definition: scanner.c:3665

Definition at line 332 of file scanner.c.

#define yy_set_interactive (   is_interactive)
Value:
{ \
if ( ! YY_CURRENT_BUFFER ){ \
} \
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
}
YY_BUFFER_STATE yy_create_buffer(FILE *file, int size)
Allocate and initialize an input buffer state.
Definition: scanner.c:3512
#define YY_CURRENT_BUFFER_LVALUE
Definition: scanner.c:281
#define YY_BUF_SIZE
Definition: scanner.c:1366
#define YY_CURRENT_BUFFER
Definition: scanner.c:274
FILE * yyin
Definition: scanner.c:348
static void yyensure_buffer_stack(void)
Definition: scanner.c:3665

Definition at line 322 of file scanner.c.

#define YY_SKIP_YYWRAP

Definition at line 1368 of file scanner.c.

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

Definition at line 133 of file scanner.c.

Referenced by yylex().

#define YY_START_STACK_INCR   25

Definition at line 1664 of file scanner.c.

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

Definition at line 159 of file scanner.c.

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

Definition at line 137 of file scanner.c.

Referenced by yylex().

#define YY_STRUCT_YY_BUFFER_STATE

Definition at line 199 of file scanner.c.

#define YY_TYPEDEF_YY_BUFFER_STATE

Definition at line 162 of file scanner.c.

#define YY_TYPEDEF_YY_SIZE_T

Definition at line 167 of file scanner.c.

#define YY_USER_ACTION

Definition at line 1689 of file scanner.c.

#define YY_USER_INIT
Value:
if (!plexbuff) { \
} \
if (!picbuff1) { \
} \
if (!picbuff2) { \
}
#define COB_MINI_BUFF
Definition: common.h:539
static size_t pic1size
Definition: scanner.c:1444
static size_t pic2size
Definition: scanner.c:1445
static char * picbuff1
Definition: scanner.c:1441
static size_t plexsize
Definition: scanner.c:1443
static char * plexbuff
Definition: scanner.c:1440
void * cobc_malloc(const size_t size)
Definition: cobc.c:643
static char * picbuff2
Definition: scanner.c:1442

Definition at line 1382 of file scanner.c.

Referenced by yylex().

#define yyconst

Definition at line 110 of file scanner.c.

#define yyless (   n)
Value:
do \
{ \
/* Undo effects of setting up yytext. */ \
int yyless_macro_arg = (n); \
YY_LESS_LINENO(yyless_macro_arg);\
*yy_cp = (yy_hold_char); \
(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
YY_DO_BEFORE_ACTION; /* set up yytext again */ \
} \
while ( 0 )
static char yy_hold_char
Definition: scanner.c:284
static char * yy_c_buf_p
Definition: scanner.c:289
#define YY_MORE_ADJ
Definition: scanner.c:1338
#define YY_RESTORE_YY_MORE_OFFSET
Definition: scanner.c:1339
#define YY_DO_BEFORE_ACTION
Definition: scanner.c:367
#define YY_LESS_LINENO(n)
Definition: scanner.c:179

Definition at line 3721 of file scanner.c.

#define yyless (   n)
Value:
do \
{ \
/* Undo effects of setting up yytext. */ \
int yyless_macro_arg = (n); \
YY_LESS_LINENO(yyless_macro_arg);\
(yy_c_buf_p) = yytext + yyless_macro_arg; \
*(yy_c_buf_p) = '\0'; \
yyleng = yyless_macro_arg; \
} \
while ( 0 )
static char yy_hold_char
Definition: scanner.c:284
static char * yy_c_buf_p
Definition: scanner.c:289
yy_size_t yyleng
Definition: scanner.c:286
char * yytext
Definition: scanner.c:1340
#define YY_LESS_LINENO(n)
Definition: scanner.c:179

Definition at line 3721 of file scanner.c.

#define yymore ( )    yymore_used_but_not_detected

Definition at line 1337 of file scanner.c.

#define YYSTATE   YY_START

Definition at line 134 of file scanner.c.

Definition at line 1413 of file scanner.c.

#define YYTABLES_NAME   "yytables"

Definition at line 3837 of file scanner.c.

#define yyterminate ( )    return YY_NULL

Definition at line 1659 of file scanner.c.

Referenced by yylex().

#define yytext_ptr   yytext

Typedef Documentation

typedef short int flex_int16_t

Definition at line 53 of file scanner.c.

typedef int flex_int32_t

Definition at line 54 of file scanner.c.

typedef signed char flex_int8_t

Definition at line 52 of file scanner.c.

typedef unsigned short int flex_uint16_t

Definition at line 56 of file scanner.c.

typedef unsigned int flex_uint32_t

Definition at line 57 of file scanner.c.

typedef unsigned char flex_uint8_t

Definition at line 55 of file scanner.c.

Definition at line 163 of file scanner.c.

typedef unsigned char YY_CHAR

Definition at line 346 of file scanner.c.

typedef size_t yy_size_t

Definition at line 168 of file scanner.c.

typedef int yy_state_type

Definition at line 350 of file scanner.c.

Function Documentation

static int all_zeroes ( const char *  str)
static

Definition at line 4288 of file scanner.c.

Referenced by significand_is_zero().

4289 {
4290  int i;
4291 
4292  for (i = 0; str[i] != '\0'; ++i) {
4293  if (str[i] != '0') {
4294  return 0;
4295  }
4296  }
4297 
4298  return 1;
4299 }

Here is the caller graph for this function:

static int can_replace ( const char *  src1,
const char *  src2,
const size_t  size,
const size_t  iteration 
)
static

Definition at line 4463 of file scanner.c.

Referenced by scan_picture().

4465 {
4466  const unsigned char *p;
4467 
4468  /* Check if we can do a replacement */
4469  if (strncasecmp (src1, src2, size)) {
4470  return 0;
4471  }
4472  p = (const unsigned char *)src1 + size;
4473  if (valid_char[*p]) {
4474  return 0;
4475  }
4476  if (iteration) {
4477  p = (const unsigned char *)src1 - 1;
4478  if (valid_char[*p]) {
4479  return 0;
4480  }
4481  }
4482  return 1;
4483 }
static unsigned char valid_char[256]
Definition: scanner.c:1520

Here is the caller graph for this function:

void cb_add_78 ( struct cb_field f)

Definition at line 4810 of file scanner.c.

References CB_VALUE, check_78_replace(), cb_level_78::chk_const, cob_u32_t, cobc_malloc(), const78ptr, current_program, cb_field::flag_is_global, cb_level_78::fld78, globlev78ptr, cb_level_78::globnext, cb_level_78::last, lev78ptr, cb_field::name, cb_level_78::name_len, cb_level_78::next, cb_level_78::pic_len, cb_level_78::pic_replace, cb_level_78::prog, and cb_field::values.

Referenced by cb_validate_78_item().

4811 {
4812  struct cb_level_78 *p78;
4813 
4814  /* Add a constant (78 level) item */
4815  p78 = cobc_malloc (sizeof(struct cb_level_78));
4816  p78->fld78 = f;
4817  p78->prog = current_program;
4819  if (p78->pic_replace) {
4820  p78->pic_len = (cob_u32_t)strlen (p78->pic_replace);
4821  }
4822  p78->name_len = (cob_u32_t)strlen (f->name);
4823  if (f->flag_is_global) {
4824  if (!globlev78ptr) {
4825  p78->last = p78;
4826  } else {
4827  p78->last = globlev78ptr->last;
4828  }
4829  p78->last->globnext = const78ptr;
4830  p78->next = globlev78ptr;
4831  p78->globnext = globlev78ptr;
4832  p78->chk_const = 1;
4833  globlev78ptr = p78;
4834  if (lev78ptr) {
4836  } else {
4838  }
4839  } else {
4840  if (!lev78ptr) {
4841  p78->last = p78;
4842  } else {
4843  p78->last = lev78ptr->last;
4844  }
4845  if (globlev78ptr) {
4846  p78->last->globnext = globlev78ptr;
4847  } else {
4848  p78->last->globnext = const78ptr;
4849  }
4850  p78->next = lev78ptr;
4851  p78->globnext = lev78ptr;
4852  lev78ptr = p78;
4853  top78ptr = lev78ptr;
4854  }
4855 }
const char * name
Definition: tree.h:645
#define cob_u32_t
Definition: common.h:31
static struct cb_level_78 * globlev78ptr
Definition: scanner.c:1439
struct cb_level_78 * last
Definition: scanner.c:1420
struct cb_level_78 * globnext
Definition: scanner.c:1419
unsigned char flag_is_global
Definition: tree.h:699
struct cb_field * fld78
Definition: scanner.c:1421
#define CB_VALUE(x)
Definition: tree.h:1193
struct cb_level_78 * next
Definition: scanner.c:1418
static struct cb_level_78 * lev78ptr
Definition: scanner.c:1438
struct cb_program * prog
Definition: scanner.c:1422
cob_u32_t name_len
Definition: scanner.c:1424
static const char * check_78_replace(const cb_tree p)
Definition: scanner.c:4486
cob_u32_t pic_len
Definition: scanner.c:1425
static struct cb_level_78 * const78ptr
Definition: scanner.c:1437
struct cb_program * current_program
Definition: parser.c:168
const char * pic_replace
Definition: scanner.c:1423
void * cobc_malloc(const size_t size)
Definition: cobc.c:643
static struct cb_level_78 * top78ptr
Definition: scanner.c:1436
cob_u32_t chk_const
Definition: scanner.c:1427
cb_tree values
Definition: tree.h:648

Here is the call graph for this function:

Here is the caller graph for this function:

static void cb_add_const_var ( const char *  name,
cb_tree  value 
)
static

Definition at line 4583 of file scanner.c.

References cb_build_constant(), cb_build_reference(), CB_FIELD, cb_validate_78_item(), CB_VALUE, check_78_replace(), cb_level_78::chk_const, cob_u32_t, cobc_malloc(), const78ptr, cb_field::flag_is_global, cb_field::flag_item_78, cb_level_78::fld78, cb_level_78::globnext, cb_level_78::last, cb_field::level, cb_field::name, cb_level_78::name_len, cb_level_78::next, NULL, cb_level_78::pic_len, cb_level_78::pic_replace, cb_level_78::prog, and cb_field::values.

Referenced by scan_define_options().

4584 {
4585  cb_tree x;
4586  struct cb_level_78 *p78;
4587  struct cb_field *f;
4588 
4589 
4590  /* Add an inline constant */
4591  x = cb_build_constant (cb_build_reference (name), value);
4592  f = CB_FIELD (x);
4593  f->flag_item_78 = 1;
4594  f->flag_is_global = 1;
4595  f->level = 1;
4596  (void)cb_validate_78_item (f, 1);
4597 
4598  /* Add constant item */
4599  p78 = cobc_malloc (sizeof(struct cb_level_78));
4600  p78->fld78 = f;
4601  p78->prog = NULL;
4603  if (p78->pic_replace) {
4604  p78->pic_len = (cob_u32_t)strlen (p78->pic_replace);
4605  }
4606  p78->name_len = (cob_u32_t)strlen (f->name);
4607  /* RXWRXW - Check this */
4608  p78->chk_const = 0;
4609  if (!const78ptr) {
4610  p78->last = p78;
4611  } else {
4612  p78->last = const78ptr->last;
4613  }
4614  p78->next = const78ptr;
4615  p78->globnext = const78ptr;
4616  const78ptr = p78;
4617  if (globlev78ptr) {
4619  } else if (lev78ptr) {
4621  } else {
4622  top78ptr = const78ptr;
4623  }
4624 }
const char * name
Definition: tree.h:645
#define cob_u32_t
Definition: common.h:31
cb_tree cb_build_constant(cb_tree name, cb_tree value)
Definition: tree.c:2189
static struct cb_level_78 * globlev78ptr
Definition: scanner.c:1439
struct cb_level_78 * last
Definition: scanner.c:1420
struct cb_level_78 * globnext
Definition: scanner.c:1419
int level
Definition: tree.h:673
unsigned char flag_is_global
Definition: tree.h:699
struct cb_field * fld78
Definition: scanner.c:1421
#define CB_VALUE(x)
Definition: tree.h:1193
struct cb_level_78 * next
Definition: scanner.c:1418
unsigned int flag_item_78
Definition: tree.h:711
static struct cb_level_78 * lev78ptr
Definition: scanner.c:1438
struct cb_program * prog
Definition: scanner.c:1422
Definition: tree.h:643
cob_u32_t name_len
Definition: scanner.c:1424
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 const char * check_78_replace(const cb_tree p)
Definition: scanner.c:4486
struct cb_field * cb_validate_78_item(struct cb_field *f, const cob_u32_t no78add)
Definition: field.c:1415
cob_u32_t pic_len
Definition: scanner.c:1425
cb_tree cb_build_reference(const char *name)
Definition: tree.c:2572
static struct cb_level_78 * const78ptr
Definition: scanner.c:1437
const char * pic_replace
Definition: scanner.c:1423
void * cobc_malloc(const size_t size)
Definition: cobc.c:643
static struct cb_level_78 * top78ptr
Definition: scanner.c:1436
cob_u32_t chk_const
Definition: scanner.c:1427
cb_tree values
Definition: tree.h:648
#define CB_FIELD(x)
Definition: tree.h:740

Here is the call graph for this function:

Here is the caller graph for this function:

struct cb_program* cb_find_defined_program_by_id ( const char *  orig_id)

Definition at line 4905 of file scanner.c.

References CB_CHAIN, CB_PROGRAM, CB_VALUE, defined_prog_list, NULL, and cb_program::orig_program_id.

Referenced by check_prototype_seen().

4906 {
4907  cb_tree l;
4908  cb_tree x;
4909 
4910  for (l = defined_prog_list; l; l = CB_CHAIN (l)) {
4911  x = CB_VALUE (l);
4912  if (strcmp (orig_id, CB_PROGRAM (x)->orig_program_id) == 0) {
4913  return CB_PROGRAM (x);
4914  }
4915  }
4916 
4917  return NULL;
4918 }
struct cb_tree_common * defined_prog_list
Definition: parser.c:172
#define CB_VALUE(x)
Definition: tree.h:1193
#define CB_CHAIN(x)
Definition: tree.h:1194
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
#define CB_PROGRAM(x)
Definition: tree.h:1328

Here is the caller graph for this function:

struct cb_program* cb_find_defined_program_by_name ( const char *  name)

Definition at line 4882 of file scanner.c.

References CB_CHAIN, CB_PROGRAM, CB_VALUE, defined_prog_list, NULL, and cb_program::program_name.

Referenced by yylex().

4883 {
4884  int (*cmp_func)(const char *, const char *);
4885  cb_tree l;
4886  cb_tree x;
4887 
4888  if (cb_fold_call) {
4889  cmp_func = &strcasecmp;
4890  } else {
4891  cmp_func = &strcmp;
4892  }
4893 
4894  for (l = defined_prog_list; l; l = CB_CHAIN (l)) {
4895  x = CB_VALUE (l);
4896  if ((*cmp_func)(name, CB_PROGRAM (x)->program_name) == 0) {
4897  return CB_PROGRAM (x);
4898  }
4899  }
4900 
4901  return NULL;
4902 }
const char * name
Definition: tree.h:645
struct cb_tree_common * defined_prog_list
Definition: parser.c:172
#define CB_VALUE(x)
Definition: tree.h:1193
#define CB_CHAIN(x)
Definition: tree.h:1194
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
#define CB_PROGRAM(x)
Definition: tree.h:1328

Here is the caller graph for this function:

void cb_reset_78 ( void  )

Definition at line 4771 of file scanner.c.

References cobc_free(), const78ptr, globlev78ptr, cb_level_78::next, cb_level_78::not_const, and NULL.

Referenced by cb_build_program().

4772 {
4773  struct cb_level_78 *p78;
4774  struct cb_level_78 *p782;
4775 
4776  /* Remove constant (78 level) items for current program */
4777  for (p78 = lev78ptr; p78; ) {
4778  p782 = p78->next;
4779  cobc_free (p78);
4780  p78 = p782;
4781  }
4782  lev78ptr = NULL;
4783  for (p78 = globlev78ptr; p78; p78 = p78->next) {
4784  p78->not_const = 0;
4785  }
4786  if (globlev78ptr) {
4788  } else {
4789  top78ptr = const78ptr;
4790  }
4791 }
static struct cb_level_78 * globlev78ptr
Definition: scanner.c:1439
void cobc_free(void *mptr)
Definition: cobc.c:657
struct cb_level_78 * next
Definition: scanner.c:1418
static struct cb_level_78 * lev78ptr
Definition: scanner.c:1438
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 struct cb_level_78 * const78ptr
Definition: scanner.c:1437
static struct cb_level_78 * top78ptr
Definition: scanner.c:1436
cob_u32_t not_const
Definition: scanner.c:1426

Here is the call graph for this function:

Here is the caller graph for this function:

void cb_reset_global_78 ( void  )

Definition at line 4794 of file scanner.c.

References cobc_free(), const78ptr, cb_level_78::next, and NULL.

Referenced by cb_build_program().

4795 {
4796  struct cb_level_78 *p78;
4797  struct cb_level_78 *p782;
4798 
4799  /* Remove constant (78 level) items for top program */
4800  for (p78 = globlev78ptr; p78; ) {
4801  p782 = p78->next;
4802  cobc_free (p78);
4803  p78 = p782;
4804  }
4805  globlev78ptr = NULL;
4806  top78ptr = const78ptr;
4807 }
static struct cb_level_78 * globlev78ptr
Definition: scanner.c:1439
void cobc_free(void *mptr)
Definition: cobc.c:657
struct cb_level_78 * next
Definition: scanner.c:1418
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 struct cb_level_78 * const78ptr
Definition: scanner.c:1437
static struct cb_level_78 * top78ptr
Definition: scanner.c:1436

Here is the call graph for this function:

Here is the caller graph for this function:

void cb_unput_dot ( void  )

Definition at line 4765 of file scanner.c.

References unput.

Referenced by yyparse().

4766 {
4767  unput ('.');
4768 }
#define unput(c)
Definition: scanner.c:196

Here is the caller graph for this function:

static const char* check_78_replace ( const cb_tree  p)
static

Definition at line 4486 of file scanner.c.

References cb_high, CB_LITERAL, CB_LITERAL_P, cb_low, cb_null, cb_quote, cb_space, cb_zero, and NULL.

Referenced by cb_add_78(), and cb_add_const_var().

4487 {
4488  /* Check if we can do a constant replacement within PICTURE */
4489  if (CB_LITERAL_P (p)) {
4490  if (CB_LITERAL(p)->size > 50) {
4491  return NULL;
4492  }
4493  return (const char *)(CB_LITERAL(p)->data);
4494  }
4495  if (p == cb_low) {
4496  return "LOW-VALUE";
4497  }
4498  if (p == cb_high) {
4499  return "HIGH-VALUE";
4500  }
4501  if (p == cb_space) {
4502  return "SPACE";
4503  }
4504  if (p == cb_zero) {
4505  return "ZERO";
4506  }
4507  if (p == cb_quote) {
4508  return "QUOTE";
4509  }
4510  if (p == cb_null) {
4511  return "NULL";
4512  }
4513  return NULL;
4514 }
#define CB_LITERAL(x)
Definition: tree.h:601
cb_tree cb_zero
Definition: tree.c:125
cb_tree cb_quote
Definition: tree.c:132
cb_tree cb_space
Definition: tree.c:127
#define CB_LITERAL_P(x)
Definition: tree.h:602
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
cb_tree cb_null
Definition: tree.c:124
cb_tree cb_high
Definition: tree.c:129
cb_tree cb_low
Definition: tree.c:128

Here is the caller graph for this function:

struct cb_field* check_level_78 ( const char *  name)

Definition at line 4858 of file scanner.c.

References cb_level_78::fld78, cb_field::name, cb_level_78::next, and NULL.

Referenced by cb_validate_program_data().

4859 {
4860  const struct cb_level_78 *p78;
4861 
4862  /* Check against a current constant (78 level) */
4863  for (p78 = lev78ptr; p78; p78 = p78->next) {
4864  if (strcasecmp (name, p78->fld78->name) == 0) {
4865  return p78->fld78;
4866  }
4867  }
4868  /* Check against a global constant (78 level) */
4869  for (p78 = globlev78ptr; p78; p78 = p78->next) {
4870  if (strcasecmp (name, p78->fld78->name) == 0) {
4871  return p78->fld78;
4872  }
4873  }
4874  return NULL;
4875 }
const char * name
Definition: tree.h:645
static struct cb_level_78 * globlev78ptr
Definition: scanner.c:1439
struct cb_field * fld78
Definition: scanner.c:1421
struct cb_level_78 * next
Definition: scanner.c:1418
static struct cb_level_78 * lev78ptr
Definition: scanner.c:1438
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95

Here is the caller graph for this function:

void cobc_init_scanner ( void  )

Definition at line 4922 of file scanner.c.

Referenced by main().

4923 {
4924  const unsigned char *p;
4925 
4926  memset (valid_char, 0, sizeof(valid_char));
4927  for (p = pvalid_char; *p; ++p) {
4928  valid_char[*p] = 1;
4929  }
4930 }
static const unsigned char pvalid_char[]
Definition: scanner.c:1521
static unsigned char valid_char[256]
Definition: scanner.c:1520

Here is the caller graph for this function:

static void count_lines ( const char *  text)
static

Definition at line 4570 of file scanner.c.

References cb_source_line.

Referenced by yylex().

4571 {
4572  const char *p;
4573 
4574  /* Count newlines in text */
4575  for (p = text; *p; p++) {
4576  if (*p == '\n') {
4577  cb_source_line++;
4578  }
4579  }
4580 }
int cb_source_line
Definition: cobc.c:178

Here is the caller graph for this function:

static void error_literal ( const char *  type,
const char *  literal 
)
static

Definition at line 3844 of file scanner.c.

References _, and cb_error().

Referenced by read_literal(), scan_b(), scan_floating_numeric(), scan_h(), scan_numeric(), scan_o(), scan_x(), and scan_z().

3845 {
3846  char lit_out[39];
3847 
3848  if (!literal_error) {
3849  /* snip literal for output, if too long */
3850  strncpy (lit_out, literal, 38);
3851  if (strlen (literal) > 38) {
3852  strcpy (lit_out + 35, "...");
3853  } else {
3854  lit_out[38] = '\0';
3855  }
3856  if (strcmp (type, "") == 0) {
3857  cb_error (_("Invalid literal: '%s'"), lit_out);
3858  } else if (strcmp (type, "hex") == 0) {
3859  cb_error (_("Invalid hexadecimal literal: '%s'"), lit_out);
3860  } else if (strcmp (type, "num") == 0) {
3861  cb_error (_("Invalid numeric literal: '%s'"), lit_out);
3862  } else if (strcmp (type, "float") == 0) {
3863  cb_error (_("Invalid floating-point literal: '%s'"), lit_out);
3864  } else {
3865  cb_error (_("Invalid %s literal: '%s'"), type, lit_out);
3866  }
3867  }
3868  literal_error++;
3869  cb_error (err_msg);
3870 }
static unsigned int literal_error
Definition: scanner.c:1449
#define _(s)
Definition: cobcrun.c:59
static char err_msg[COB_MINI_BUFF]
Definition: scanner.c:1450
void cb_error(const char *,...) COB_A_FORMAT12
Definition: error.c:98

Here is the call graph for this function:

Here is the caller graph for this function:

static int get_sign ( const char  sign)
static

Definition at line 4225 of file scanner.c.

Referenced by scan_define_options(), scan_floating_numeric(), and scan_numeric().

4226 {
4227  if (sign == '+') {
4228  return 1;
4229  } else if (sign == '-') {
4230  return -1;
4231  } else {
4232  return 0;
4233  }
4234 }
if sign
Definition: flag.def:42

Here is the caller graph for this function:

static int input ( void  )
static

Definition at line 3373 of file scanner.c.

References EOB_ACT_CONTINUE_SCAN, EOB_ACT_END_OF_FILE, EOB_ACT_LAST_MATCH, 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, yyin, yyrestart(), yytext_ptr, and yywrap().

Referenced by read_literal(), and yylex().

3376 {
3377  int c;
3378 
3379  *(yy_c_buf_p) = (yy_hold_char);
3380 
3381  if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
3382  {
3383  /* yy_c_buf_p now points to the character we want to return.
3384  * If this occurs *before* the EOB characters, then it's a
3385  * valid NUL; if not, then we've hit the end of the buffer.
3386  */
3387  if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
3388  /* This was really a NUL. */
3389  *(yy_c_buf_p) = '\0';
3390 
3391  else
3392  { /* need more input */
3393  yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
3394  ++(yy_c_buf_p);
3395 
3396  switch ( yy_get_next_buffer( ) )
3397  {
3398  case EOB_ACT_LAST_MATCH:
3399  /* This happens because yy_g_n_b()
3400  * sees that we've accumulated a
3401  * token and flags that we need to
3402  * try matching the token before
3403  * proceeding. But for input(),
3404  * there's no matching to consider.
3405  * So convert the EOB_ACT_LAST_MATCH
3406  * to EOB_ACT_END_OF_FILE.
3407  */
3408 
3409  /* Reset buffer status. */
3410  yyrestart(yyin );
3411 
3412  /*FALLTHROUGH*/
3413 
3414  case EOB_ACT_END_OF_FILE:
3415  {
3416  if ( yywrap( ) )
3417  return EOF;
3418 
3419  if ( ! (yy_did_buffer_switch_on_eof) )
3420  YY_NEW_FILE;
3421 #ifdef __cplusplus
3422  return yyinput();
3423 #else
3424  return input();
3425 #endif
3426  }
3427 
3428  case EOB_ACT_CONTINUE_SCAN:
3429  (yy_c_buf_p) = (yytext_ptr) + offset;
3430  break;
3431  }
3432  }
3433  }
3434 
3435  c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
3436  *(yy_c_buf_p) = '\0'; /* preserve yytext */
3437  (yy_hold_char) = *++(yy_c_buf_p);
3438 
3439  YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
3440 
3441  return c;
3442 }
static char yy_hold_char
Definition: scanner.c:284
#define EOB_ACT_LAST_MATCH
Definition: scanner.c:177
#define EOB_ACT_END_OF_FILE
Definition: scanner.c:176
#define YY_CURRENT_BUFFER_LVALUE
Definition: scanner.c:281
static yy_size_t yy_n_chars
Definition: scanner.c:285
#define yytext_ptr
Definition: scanner.c:357
static int yy_did_buffer_switch_on_eof
Definition: scanner.c:296
static char * yy_c_buf_p
Definition: scanner.c:289
#define EOB_ACT_CONTINUE_SCAN
Definition: scanner.c:175
FILE * yyin
Definition: scanner.c:348
#define YY_END_OF_BUFFER_CHAR
Definition: scanner.c:142
static int input(void)
Definition: scanner.c:3373
#define YY_NEW_FILE
Definition: scanner.c:140
static int yy_get_next_buffer(void)
Definition: scanner.c:3142
static int yywrap(void)
Definition: scanner.c:1369
size_t yy_size_t
Definition: pplex.c:187
void yyrestart(FILE *input_file)
Immediately switch to a different input stream.
Definition: scanner.c:3450

Here is the call graph for this function:

Here is the caller graph for this function:

static void read_literal ( const char  mark)
static

Definition at line 3873 of file scanner.c.

References _, cb_build_alphanumeric_literal(), cb_warning(), COB_MINI_MAX, cob_u8_t, cobc_realloc(), error_literal(), input(), unlikely, unput, and yylval.

Referenced by yylex().

3874 {
3875  size_t i;
3876  int c;
3877 
3878  literal_error = 0;
3879 
3880  i = 0;
3881  while ((c = input ()) != EOF) {
3882  if (!literal_error) {
3883  if (unlikely(i == plexsize)) {
3884  plexsize *= 2;
3885  if (unlikely (plexsize > (cb_lit_length + 1))) {
3886  plexsize = cb_lit_length + 1;
3887  }
3889  }
3890  plexbuff[i] = (cob_u8_t)c;
3891  }
3892  if (c == mark && (c = input ()) != (int)mark) {
3893  if (c == '-') {
3894  /* Free format continuation ("a"- 'b'- ) */
3895  /* Hack it as concatenation */
3896  unput ('&');
3897  } else {
3898  unput (c);
3899  }
3900  break;
3901  }
3902  /* check literal size here as we have to adjust and check
3903  for (escaped) mark before checking the max length */
3904  if (unlikely (i++ == cb_lit_length)) {
3905  plexbuff[i] = 0;
3906  snprintf (err_msg, COB_MINI_MAX,
3907  _ ("Literal length exceeds %d characters"),
3908  cb_lit_length);
3909  error_literal ("", plexbuff);
3910  }
3911  }
3912  /* fixme: cobol 2014 allows this (and needs it for DYNAMIC LENGTH items),
3913  while other versions do not allow this at all
3914  --> add a compiler support configuration for "OK" => zero length,
3915  "warning" => current implementation, "error" (for example in cobol2002),
3916  "ignore" => assume a space without warning; make sure zero length items
3917  work everywhere (should do as we support zero lengths via ODO items already)
3918  */
3919  if (!i) {
3920  cb_warning (_("Alphanumeric literal has zero length"));
3921  cb_warning (_("A SPACE will be assumed"));
3922  plexbuff[0] = ' ';
3923  i = 1;
3924  }
3925  plexbuff[i] = 0;
3927 }
void * cobc_realloc(void *prevptr, const size_t size)
Definition: cobc.c:687
#define unput(c)
Definition: scanner.c:196
#define cob_u8_t
Definition: common.h:27
cb_tree cb_build_alphanumeric_literal(const void *data, const size_t size)
Definition: tree.c:1716
static unsigned int literal_error
Definition: scanner.c:1449
static void error_literal(const char *type, const char *literal)
Definition: scanner.c:3844
#define _(s)
Definition: cobcrun.c:59
#define unlikely(x)
Definition: common.h:437
static int input(void)
Definition: scanner.c:3373
static char err_msg[COB_MINI_BUFF]
Definition: scanner.c:1450
static size_t plexsize
Definition: scanner.c:1443
static char * plexbuff
Definition: scanner.c:1440
void cb_warning(const char *,...) COB_A_FORMAT12
Definition: error.c:87
#define yylval
Definition: ppparse.c:69
#define COB_MINI_MAX
Definition: common.h:545

Here is the call graph for this function:

Here is the caller graph for this function:

static int scan_b ( const char *  text,
const cob_u32_t  with_mark 
)
static

Definition at line 4112 of file scanner.c.

References _, cb_build_numeric_literal(), cb_error_node, CB_FMT_LLU, cb_verify(), COB_MINI_MAX, cob_u64_t, error_literal(), LITERAL, unlikely, and yylval.

Referenced by yylex().

4113 {
4114  size_t currlen;
4115  char *p;
4116  cob_u64_t val = 0;
4117  int c;
4118 
4119  literal_error = 0;
4120 
4121  if (( with_mark &&
4122  !cb_verify (cb_numeric_boolean, _ ("Numeric boolean literal"))) ||
4123  (!with_mark &&
4124  !cb_verify (cb_acucobol_literals, _ ("ACUCOBOL numeric literal")))) {
4125  goto error;
4126  }
4127 
4128  /* currlen can include the terminating quote */
4129  currlen = strlen (text);
4130  memcpy (plexbuff, text, currlen + 1);
4131  if (with_mark) {
4132  currlen--;
4133  plexbuff[currlen] = 0;
4134  }
4135  if (unlikely(currlen > 64)) {
4136  snprintf (err_msg, COB_MINI_MAX,
4137  _("Literal length %d exceeds %d characters"),
4138  (int) currlen, 64);
4139  error_literal ("B", plexbuff);
4140  goto error;
4141  }
4142 
4143  for (p = plexbuff; *p != 0; p++) {
4144  c = (int) *p;
4145  if (c == '0') {
4146  c = 0;
4147  } else if (c == '1') {
4148  c = 1;
4149  } else {
4150  snprintf (err_msg, COB_MINI_MAX,
4151  _("Literal contains invalid character '%c'"), c);
4152  error_literal ("B", plexbuff);
4153  continue;
4154  }
4155 
4156  val = (val << 1) + c;
4157  }
4158 
4159  if (literal_error) {
4160  goto error;
4161  }
4162 
4163  sprintf ((char *)plexbuff, CB_FMT_LLU, val);
4164  yylval = cb_build_numeric_literal (0, (const void *)plexbuff, 0);
4165 
4166  return LITERAL;
4167 
4168  error:
4170  return LITERAL;
4171 }
#define CB_FMT_LLU
Definition: common.h:57
unsigned int cb_verify(const enum cb_support, const char *)
Definition: error.c:246
cb_tree cb_build_numeric_literal(const int sign, const void *data, const int scale)
Definition: tree.c:1681
static unsigned int literal_error
Definition: scanner.c:1449
static void error_literal(const char *type, const char *literal)
Definition: scanner.c:3844
#define _(s)
Definition: cobcrun.c:59
#define unlikely(x)
Definition: common.h:437
static char err_msg[COB_MINI_BUFF]
Definition: scanner.c:1450
cb_tree cb_error_node
Definition: tree.c:140
static char * plexbuff
Definition: scanner.c:1440
#define yylval
Definition: ppparse.c:69
#define cob_u64_t
Definition: common.h:52
#define COB_MINI_MAX
Definition: common.h:545

Here is the call graph for this function:

Here is the caller graph for this function:

static void scan_define_options ( const char *  text)
static

Definition at line 4634 of file scanner.c.

References _, cb_add_const_var(), cb_build_alphanumeric_literal(), cb_build_numeric_literal(), cb_error(), COB_MAX_DIGITS, cobc_free(), cobc_strdup(), cb_level_78::fld78, get_sign(), cb_level_78::globnext, INCREMENT_IF_SIGNED, cb_field::name, NULL, and sign.

Referenced by yylex().

4635 {
4636  char *p;
4637  char *s;
4638  char *var;
4639  const struct cb_level_78 *p78;
4640  char *q;
4641  unsigned char *t;
4642  cb_tree x;
4643  size_t size;
4644  int scale;
4645  int sign;
4646 
4647  /* Scan a source inline define */
4648  p = cobc_strdup (text);
4649 
4650  /* Ignore first part */
4651  s = strtok (p, " ");
4652 
4653  /* Variable name */
4654  s = strtok (NULL, " \n");
4655  if (!s) {
4656  cobc_free (p);
4657  return;
4658  }
4659 
4660  /* Check for already defined constant */
4661  for (p78 = top78ptr; p78; p78 = p78->globnext) {
4662  if (strcasecmp (s, p78->fld78->name) == 0) {
4663  cobc_free (p);
4664  return;
4665  }
4666  }
4667 
4668  var = cobc_strdup (s);
4669 
4670  /* Value */
4671  s = strtok (NULL, "\n");
4672  if (!s) {
4673  cb_error (_("Invalid CONSTANT - %s"), var);
4674  goto freevar;
4675  }
4676 
4677  if (*s == '"' || *s == '\'') {
4678  /* Alphanumeric literal */
4679  sign = *s;
4680  size = strlen (s);
4681  q = s + size - 1;
4682  if (q == s || *q != sign) {
4683  cb_error (_("Invalid alphanumeric CONSTANT - %s"), s);
4684  goto freevar;
4685  }
4686  if (size < 3) {
4687  cb_error (_("Empty alphanumeric CONSTANT - %s"), s);
4688  goto freevar;
4689  }
4690  *q = 0;
4691  size -= 2;
4692  x = cb_build_alphanumeric_literal (s + 1, size);
4693  } else {
4694  /* Get sign */
4695  sign = get_sign (*s);
4696  INCREMENT_IF_SIGNED (s, sign);
4697 
4698  /* Get decimal point */
4699  scale = 0;
4700  q = strchr (s, '.');
4701  if (q) {
4702  scale = (int)strlen (q) - 1;
4703  if (scale < 1) {
4704  cb_error (_("Invalid numeric CONSTANT - %s"), s);
4705  goto freevar;
4706  }
4707  /* Remove decimal point */
4708  memmove (q, q + 1, (size_t)(scale + 1));
4709  }
4710  for (t = (unsigned char *)s; *t; ++t) {
4711  if (*t < '0' || *t > '9') {
4712  cb_error (_("Invalid numeric CONSTANT - %s"), s);
4713  goto freevar;
4714  }
4715  }
4716  if (strlen (s) > COB_MAX_DIGITS) {
4717  cb_error (_("Invalid numeric CONSTANT - %s"), s);
4718  goto freevar;
4719  }
4720 
4721  x = cb_build_numeric_literal (sign, s, scale);
4722  }
4723  /* Add to constant list */
4724  cb_add_const_var (var, x);
4725 
4726 freevar:
4727  cobc_free (p);
4728  cobc_free (var);
4729 }
const char * name
Definition: tree.h:645
static void cb_add_const_var(const char *name, cb_tree value)
Definition: scanner.c:4583
void cobc_free(void *mptr)
Definition: cobc.c:657
struct cb_level_78 * globnext
Definition: scanner.c:1419
#define INCREMENT_IF_SIGNED(text, sign)
Definition: scanner.c:4236
struct cb_field * fld78
Definition: scanner.c:1421
#define COB_MAX_DIGITS
Definition: common.h:562
cb_tree cb_build_alphanumeric_literal(const void *data, const size_t size)
Definition: tree.c:1716
cb_tree cb_build_numeric_literal(const int sign, const void *data, const int scale)
Definition: tree.c:1681
#define _(s)
Definition: cobcrun.c:59
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
if sign
Definition: flag.def:42
void * cobc_strdup(const char *dupstr)
Definition: cobc.c:669
void cb_error(const char *,...) COB_A_FORMAT12
Definition: error.c:98
static int get_sign(const char sign)
Definition: scanner.c:4225
static struct cb_level_78 * top78ptr
Definition: scanner.c:1436

Here is the call graph for this function:

Here is the caller graph for this function:

static int scan_floating_numeric ( const char *  text)
static

Definition at line 4309 of file scanner.c.

References _, cb_build_numeric_literal(), cb_error_node, COB_MINI_MAX, current_program, cb_program::decimal_point, error_literal(), get_sign(), INCREMENT_IF_SIGNED, LITERAL, significand_is_zero(), and yylval.

Referenced by yylex().

4310 {
4311  size_t sig_int_len;
4312  size_t sig_dec_len;
4313  int sig_sign;
4314  int exp_sign;
4315  int scale;
4316  int exponent;
4317  int n;
4318  char significand_str[37];
4319  char *significand_pos;
4320  char significand_dec[36];
4321  char significand_int[36];
4322  char exponent_str[8];
4323  char *exponent_pos;
4324 
4325  char result[128];
4326 
4327  literal_error = 0;
4328 
4329  /* Separate into significand and exponent */
4330  n = sscanf (text, "%36[0-9.,+-]%*[Ee]%7[0-9.,+-]",
4331  significand_str, exponent_str);
4332  /* We check the return for silencing warnings,
4333  this should never happen as the flex rule ensures this */
4334  if (n == 0) {
4336  return LITERAL;
4337  }
4338 
4339  /* Get signs and adjust string positions accordingly */
4340  significand_pos = &significand_str[0];
4341  sig_sign = get_sign (*significand_pos);
4342  INCREMENT_IF_SIGNED (significand_pos, sig_sign);
4343 
4344  exponent_pos = &exponent_str[0];
4345  exp_sign = get_sign (*exponent_pos);
4346  INCREMENT_IF_SIGNED (exponent_pos, exp_sign);
4347 
4348  /* Separate into integer and decimal */
4349  n = sscanf (significand_pos, "%35[0-9]%*[.,]%35[0-9]",
4350  significand_int, significand_dec);
4351  if (n == 0) { /* no integer part, copy after decimal-point */
4352  significand_int[0] = 0;
4353  strncpy (significand_dec, significand_pos + 1, 35);
4354  significand_dec[35] = 0;
4355  } else {
4356  /* silencing some warnings */
4357  significand_int[35] = significand_dec[35] = 0;
4358  }
4359 
4360  /* Validation */
4361  sig_int_len = strlen (significand_int);
4362  sig_dec_len = strlen (significand_dec);
4363  if (sig_int_len + sig_dec_len > 34U) {
4364  snprintf (err_msg, COB_MINI_MAX,
4365  _("Significand has more than 34 digits"));
4366  error_literal ("float", text);
4367  }
4368  if (strchr (exponent_pos, current_program->decimal_point)) {
4369  snprintf (err_msg, COB_MINI_MAX,
4370  _("Exponent has decimal point"));
4371  error_literal ("float", text);
4372  exponent = 0;
4373  } else {
4374  if (strlen (exponent_pos) > 4) {
4375  snprintf (err_msg, COB_MINI_MAX,
4376  _("Exponent has more than 4 digits"));
4377  error_literal ("float", text);
4378  }
4379  n = sscanf (exponent_pos, "%d", &exponent);
4380  /* We check the return for silencing warnings,
4381  this should never happen as the flex rule ensures this */
4382  if (n == 0) {
4384  return LITERAL;
4385  }
4386 
4387  if (exp_sign == -1) {
4388  exponent = -exponent;
4389  }
4390 
4391  if (!(-78 <= exponent && exponent <= 76)) {
4392  snprintf (err_msg, COB_MINI_MAX,
4393  _("Exponent not between -78 and 76"));
4394  error_literal ("float", text);
4395  }
4396  }
4397 
4398  if (significand_is_zero (significand_int, significand_dec)) {
4399  if (sig_sign == -1) {
4400  snprintf (err_msg, COB_MINI_MAX,
4401  _("Significand of 0 must be positive"));
4402  error_literal ("float", text);
4403  }
4404  if (exponent != 0) {
4405  snprintf (err_msg, COB_MINI_MAX,
4406  _("Exponent of 0 must be 0"));
4407  error_literal ("float", text);
4408  }
4409  if (exp_sign == -1) {
4410  snprintf (err_msg, COB_MINI_MAX,
4411  _("Exponent of 0 must be positive"));
4412  error_literal ("float", text);
4413  }
4414  }
4415 
4416  if (literal_error) {
4418  return LITERAL;
4419  }
4420 
4421  /* Determine scale */
4422  /* Base scale is decimal part of the significant */
4423  scale = (int)sig_dec_len;
4424  /* Adjust according to exponent */
4425  if (exponent < 0) {
4426  /* Decimals; power down by scale difference */
4427  exponent = -exponent;
4428  scale += exponent;
4429  result[0] = 0;
4430  if (exponent > (int)sig_int_len) {
4431  n = exponent - (int)sig_int_len;
4432  for (; n; --n) {
4433  strcat (result, "0");
4434  }
4435  }
4436  strcat (result, significand_int);
4437  strcat (result, significand_dec);
4438  } else if (exponent > 0) {
4439  /* No decimals; power up by scale difference */
4440  strcpy (result, significand_int);
4441  strcat (result, significand_dec);
4442  if (exponent >= scale) {
4443  n = exponent - scale;
4444  for (; n; --n) {
4445  strcat (result, "0");
4446  }
4447  scale = 0;
4448  } else {
4449  scale -= exponent;
4450  }
4451  } else {
4452  /* Exponent is 0; take as is */
4453  strcpy (result, significand_int);
4454  strcat (result, significand_dec);
4455  }
4456 
4457  yylval = cb_build_numeric_literal (sig_sign, result,
4458  scale);
4459  return LITERAL;
4460 }
#define INCREMENT_IF_SIGNED(text, sign)
Definition: scanner.c:4236
cb_tree cb_build_numeric_literal(const int sign, const void *data, const int scale)
Definition: tree.c:1681
static unsigned int literal_error
Definition: scanner.c:1449
static void error_literal(const char *type, const char *literal)
Definition: scanner.c:3844
static int significand_is_zero(const char *int_part, const char *dec_part)
Definition: scanner.c:4302
#define _(s)
Definition: cobcrun.c:59
static char err_msg[COB_MINI_BUFF]
Definition: scanner.c:1450
cb_tree cb_error_node
Definition: tree.c:140
struct cb_program * current_program
Definition: parser.c:168
static int get_sign(const char sign)
Definition: scanner.c:4225
#define yylval
Definition: ppparse.c:69
unsigned char decimal_point
Definition: tree.h:1300
#define COB_MINI_MAX
Definition: common.h:545

Here is the call graph for this function:

Here is the caller graph for this function:

static int scan_h ( const char *  text,
const cob_u32_t  with_mark 
)
static

Definition at line 4048 of file scanner.c.

References _, cb_build_numeric_literal(), cb_error_node, CB_FMT_LLU, cb_verify(), COB_MINI_MAX, cob_u64_t, error_literal(), LITERAL, unlikely, and yylval.

Referenced by yylex().

4049 {
4050  size_t currlen;
4051  char *p;
4052  cob_u64_t val = 0;
4053  int c;
4054 
4055  literal_error = 0;
4056 
4057  if (!with_mark &&
4058  !cb_verify (cb_acucobol_literals, _("ACUCOBOL numeric literal"))) {
4059  goto error;
4060  }
4061 
4062 
4063  /* currlen can include the terminating quote */
4064  currlen = strlen (text);
4065  memcpy (plexbuff, text, currlen + 1);
4066  if (with_mark) {
4067  currlen--;
4068  plexbuff[currlen] = 0;
4069  }
4070  if (unlikely(currlen > 16)) {
4071  snprintf (err_msg, COB_MINI_MAX,
4072  _("Literal length %d exceeds %d characters"),
4073  (int) currlen, 16);
4074  error_literal ("hex", plexbuff);
4075  goto error;
4076  }
4077 
4078  for (p = plexbuff; *p != 0; p++) {
4079  c = (int)*p;
4080  if ('0' <= c && c <= '9') {
4081  c = c - '0';
4082  } else if ('A' <= c && c <= 'F') {
4083  c = c - 'A' + 10;
4084  } else if ('a' <= c && c <= 'f') {
4085  c = c - 'a' + 10;
4086  } else {
4087  snprintf (err_msg, COB_MINI_MAX,
4088  _("Literal contains invalid character '%c'"), c);
4089  error_literal ("hex", plexbuff);
4090  continue;
4091  }
4092 
4093  val = (val << 4) + c;
4094  }
4095 
4096  if (literal_error) {
4097  goto error;
4098  }
4099 
4100  /* Duplication? */
4101  sprintf ((char *)plexbuff, CB_FMT_LLU, val);
4102  yylval = cb_build_numeric_literal (0, (const void *)plexbuff, 0);
4103 
4104  return LITERAL;
4105 
4106 error:
4108  return LITERAL;
4109 }
#define CB_FMT_LLU
Definition: common.h:57
unsigned int cb_verify(const enum cb_support, const char *)
Definition: error.c:246
cb_tree cb_build_numeric_literal(const int sign, const void *data, const int scale)
Definition: tree.c:1681
static unsigned int literal_error
Definition: scanner.c:1449
static void error_literal(const char *type, const char *literal)
Definition: scanner.c:3844
#define _(s)
Definition: cobcrun.c:59
#define unlikely(x)
Definition: common.h:437
static char err_msg[COB_MINI_BUFF]
Definition: scanner.c:1450
cb_tree cb_error_node
Definition: tree.c:140
static char * plexbuff
Definition: scanner.c:1440
#define yylval
Definition: ppparse.c:69
#define cob_u64_t
Definition: common.h:52
#define COB_MINI_MAX
Definition: common.h:545

Here is the call graph for this function:

Here is the caller graph for this function:

static int scan_numeric ( const char *  text)
static

Definition at line 4244 of file scanner.c.

References _, cb_build_numeric_literal(), cb_error_node, COB_MAX_DIGITS, COB_MINI_MAX, current_program, cb_program::decimal_point, error_literal(), get_sign(), INCREMENT_IF_SIGNED, LITERAL, sign, unlikely, and yylval.

Referenced by yylex().

4245 {
4246  char *p = (char *)text;
4247  char *s;
4248  int sign;
4249  int scale;
4250 
4251  /* Get sign */
4252  sign = get_sign (*p);
4253  INCREMENT_IF_SIGNED (p, sign);
4254 
4255  /* Get decimal point */
4256  s = strchr (p, current_program->decimal_point);
4257  if (s) {
4258  scale = (int)strlen (s) - 1;
4259  /* Remove decimal point */
4260  /* Moves trailing null */
4261  memmove (s, s + 1, (size_t)(scale + 1));
4262  } else {
4263  scale = 0;
4264  }
4265 
4266  /* leading zeroes should be removed here, shouldn't they ? */
4267 
4268  if (unlikely(strlen (p) > COB_MAX_DIGITS)) {
4269  /* Absolute limit */
4270  snprintf (err_msg, COB_MINI_MAX,
4271  _("Literal length %d exceeds maximum of %d digits"),
4272  (int) strlen (p), COB_MAX_DIGITS);
4273  error_literal ("num", text);
4275  } else if (unlikely(strlen (p) > cb_numlit_length)) {
4276  snprintf (err_msg, COB_MINI_MAX,
4277  _("Literal length %d exceeds %d digits"),
4278  (int) strlen (p), cb_numlit_length);
4279  error_literal ("num", text);
4281  } else {
4282  yylval = cb_build_numeric_literal (sign, p, scale);
4283  }
4284  return LITERAL;
4285 }
#define INCREMENT_IF_SIGNED(text, sign)
Definition: scanner.c:4236
#define COB_MAX_DIGITS
Definition: common.h:562
cb_tree cb_build_numeric_literal(const int sign, const void *data, const int scale)
Definition: tree.c:1681
static void error_literal(const char *type, const char *literal)
Definition: scanner.c:3844
#define _(s)
Definition: cobcrun.c:59
#define unlikely(x)
Definition: common.h:437
if sign
Definition: flag.def:42
static char err_msg[COB_MINI_BUFF]
Definition: scanner.c:1450
cb_tree cb_error_node
Definition: tree.c:140
struct cb_program * current_program
Definition: parser.c:168
static int get_sign(const char sign)
Definition: scanner.c:4225
#define yylval
Definition: ppparse.c:69
unsigned char decimal_point
Definition: tree.h:1300
#define COB_MINI_MAX
Definition: common.h:545

Here is the call graph for this function:

Here is the caller graph for this function:

static int scan_o ( const char *  text)
static

Definition at line 4174 of file scanner.c.

References _, cb_build_numeric_literal(), cb_error_node, CB_FMT_LLU, cb_verify(), COB_MINI_MAX, cob_u64_t, error_literal(), LITERAL, unlikely, and yylval.

Referenced by yylex().

4175 {
4176  size_t currlen;
4177  char *p;
4178  cob_u64_t val = 0;
4179  int c;
4180 
4181  literal_error = 0;
4182 
4183  if (!cb_verify (cb_acucobol_literals, _("ACUCOBOL numeric literal"))) {
4184  goto error;
4185  }
4186 
4187  currlen = strlen (text);
4188  memcpy (plexbuff, text, currlen + 1);
4189  if (unlikely(currlen > 22)) {
4190  snprintf (err_msg, COB_MINI_MAX,
4191  _("Literal length %d exceeds %d characters"),
4192  (int) currlen, 22);
4193  error_literal ("O", plexbuff);
4194  goto error;
4195  }
4196 
4197  for (p = plexbuff; *p != 0; p++) {
4198  c = (int) *p;
4199  if (!('0' <= c && c <= '7')) {
4200  snprintf (err_msg, COB_MINI_MAX,
4201  _("Literal contains invalid character '%c'"), c);
4202  error_literal ("O", plexbuff);
4203  continue;
4204  }
4205 
4206  c = c - '0';
4207  val = (val << 3) + c;
4208  }
4209 
4210  if (literal_error) {
4211  goto error;
4212  }
4213 
4214  sprintf ((char *)plexbuff, CB_FMT_LLU, val);
4215  yylval = cb_build_numeric_literal (0, (const void *)plexbuff, 0);
4216 
4217  return LITERAL;
4218 
4219  error:
4221  return LITERAL;
4222 }
#define CB_FMT_LLU
Definition: common.h:57
unsigned int cb_verify(const enum cb_support, const char *)
Definition: error.c:246
cb_tree cb_build_numeric_literal(const int sign, const void *data, const int scale)
Definition: tree.c:1681
static unsigned int literal_error
Definition: scanner.c:1449
static void error_literal(const char *type, const char *literal)
Definition: scanner.c:3844
#define _(s)
Definition: cobcrun.c:59
#define unlikely(x)
Definition: common.h:437
static char err_msg[COB_MINI_BUFF]
Definition: scanner.c:1450
cb_tree cb_error_node
Definition: tree.c:140
static char * plexbuff
Definition: scanner.c:1440
#define yylval
Definition: ppparse.c:69
#define cob_u64_t
Definition: common.h:52
#define COB_MINI_MAX
Definition: common.h:545

Here is the call graph for this function:

Here is the caller graph for this function:

static void scan_options ( const char *  text,
const unsigned int  optype 
)
static

Definition at line 4627 of file scanner.c.

References COB_UNUSED.

Referenced by yylex().

4628 {
4629  COB_UNUSED (text);
4630  COB_UNUSED (optype);
4631 }
#define COB_UNUSED(z)
Definition: common.h:535

Here is the caller graph for this function:

static void scan_picture ( const char *  text)
static

Definition at line 4517 of file scanner.c.

References can_replace(), cb_build_picture(), cb_level_78::fld78, cb_level_78::globnext, cb_field::name, cb_level_78::name_len, cb_level_78::pic_len, cb_level_78::pic_replace, unput, and yylval.

Referenced by yylex().

4518 {
4519  unsigned char *p;
4520  const struct cb_level_78 *p78;
4521  size_t n;
4522  size_t i;
4523  size_t size;
4524  size_t sizep;
4525 
4526  /* Scan a PICTURE clause */
4527  /* Normalize the input */
4528  for (p = (unsigned char *)text; *p; p++) {
4529  /* unput trailing '.' or ',' */
4530  if (p[1] == 0 && (*p == '.' || *p == ',')) {
4531  unput (*p);
4532  *p = 0;
4533  break;
4534  }
4535  *p = (unsigned char)toupper (*p);
4536  }
4537 
4538  if (!top78ptr) {
4539  yylval = cb_build_picture (text);
4540  return;
4541  }
4542 
4543  memset (picbuff1, 0, pic1size);
4544  memset (picbuff2, 0, pic2size);
4545  strcpy (picbuff1, text);
4546  for (p78 = top78ptr; p78; p78 = p78->globnext) {
4547  if (!p78->pic_replace) {
4548  strcpy (picbuff2, picbuff1);
4549  continue;
4550  }
4551  size = p78->name_len;
4552  sizep = p78->pic_len;
4553  i = 0;
4554  for (n = 0; n < strlen (picbuff1); n++) {
4555  if (can_replace (&picbuff1[n], p78->fld78->name, size, n)) {
4556  memcpy (&picbuff2[i], p78->pic_replace, sizep);
4557  n += size - 1;
4558  i += sizep;
4559  } else {
4560  picbuff2[i++] = picbuff1[n];
4561  }
4562  }
4563  picbuff2[i] = 0;
4564  strcpy (picbuff1, picbuff2);
4565  }
4567 }
const char * name
Definition: tree.h:645
struct cb_level_78 * globnext
Definition: scanner.c:1419
static size_t pic1size
Definition: scanner.c:1444
#define unput(c)
Definition: scanner.c:196
struct cb_field * fld78
Definition: scanner.c:1421
cb_tree cb_build_picture(const char *str)
Definition: tree.c:1800
static size_t pic2size
Definition: scanner.c:1445
cob_u32_t name_len
Definition: scanner.c:1424
static char * picbuff1
Definition: scanner.c:1441
cob_u32_t pic_len
Definition: scanner.c:1425
const char * pic_replace
Definition: scanner.c:1423
#define yylval
Definition: ppparse.c:69
static struct cb_level_78 * top78ptr
Definition: scanner.c:1436
static int can_replace(const char *src1, const char *src2, const size_t size, const size_t iteration)
Definition: scanner.c:4463
static char * picbuff2
Definition: scanner.c:1442

Here is the call graph for this function:

Here is the caller graph for this function:

static int scan_x ( const char *  text)
static

Definition at line 3930 of file scanner.c.

References _, cb_build_alphanumeric_literal(), cb_error_node, COB_MINI_MAX, cob_u8_t, cobc_realloc(), error_literal(), likely, LITERAL, plexbuff, unlikely, and yylval.

Referenced by yylex().

3931 {
3932  char *p;
3933  char *e;
3934  char *dst;
3935  size_t currlen;
3936  int high = 1;
3937  int c;
3938 
3939  literal_error = 0;
3940 
3941  /* currlen includes the terminating quote */
3942  currlen = strlen (text);
3943  if (unlikely(currlen - 1 > cb_lit_length)) {
3944  currlen--;
3945  snprintf (err_msg, COB_MINI_MAX,
3946  _("Literal length %d exceeds %d characters"),
3947  (int) currlen, cb_lit_length);
3948  error_literal ("X", text);
3949  goto error;
3950  }
3951  if (unlikely(currlen > plexsize)) {
3952  plexsize = currlen;
3954  }
3955  p = (char *)text;
3956  e = (char *)p + currlen - 1;
3957  dst = plexbuff;
3958  for (; *p != *e; p++) {
3959  c = (int)*p;
3960  if ('0' <= c && c <= '9') {
3961  c = c - '0';
3962  } else if ('A' <= c && c <= 'F') {
3963  c = c - 'A' + 10;
3964  } else if ('a' <= c && c <= 'f') {
3965  c = c - 'a' + 10;
3966  } else {
3967  snprintf (err_msg, COB_MINI_MAX,
3968  _("Literal contains invalid character '%c'"), c);
3969  if (likely (literal_error == 0)) {
3970  memcpy (plexbuff, text, currlen);
3971  plexbuff[currlen - 1] = 0;
3972  }
3973  error_literal ("X", plexbuff);
3974  continue;
3975  /* By not breaking immediately, we detect any following
3976  invalid chars
3977  */
3978  }
3979  if (likely (literal_error == 0)) {
3980  if (high) {
3981  *dst = (cob_u8_t)(c << 4);
3982  } else {
3983  *dst++ += (cob_u8_t)c;
3984  }
3985  }
3986  high = 1 - high;
3987  }
3988 
3989  if (!high) {
3990  /* This is non-standard behaviour */
3991  snprintf (err_msg, COB_MINI_MAX,
3992  _("Literal does not have an even number of digits"));
3993  if (likely (literal_error == 0)) {
3994  memcpy (plexbuff, text, currlen);
3995  plexbuff[currlen - 1] = 0;
3996  }
3997  error_literal ("X", plexbuff);
3998  }
3999 
4000  if (unlikely(literal_error != 0)) {
4001  goto error;
4002  }
4003 
4005  return LITERAL;
4006 
4007 error:
4009  return LITERAL;
4010 }
void * cobc_realloc(void *prevptr, const size_t size)
Definition: cobc.c:687
#define cob_u8_t
Definition: common.h:27
cb_tree cb_build_alphanumeric_literal(const void *data, const size_t size)
Definition: tree.c:1716
static unsigned int literal_error
Definition: scanner.c:1449
static void error_literal(const char *type, const char *literal)
Definition: scanner.c:3844
#define _(s)
Definition: cobcrun.c:59
#define unlikely(x)
Definition: common.h:437
static char err_msg[COB_MINI_BUFF]
Definition: scanner.c:1450
cb_tree cb_error_node
Definition: tree.c:140
static size_t plexsize
Definition: scanner.c:1443
static char * plexbuff
Definition: scanner.c:1440
#define yylval
Definition: ppparse.c:69
#define likely(x)
Definition: common.h:436
#define COB_MINI_MAX
Definition: common.h:545

Here is the call graph for this function:

Here is the caller graph for this function:

static int scan_z ( const char *  text,
const cob_u32_t  llit 
)
static

Definition at line 4013 of file scanner.c.

References _, cb_build_alphanumeric_literal(), cb_error_node, CB_LITERAL, COB_MINI_MAX, cobc_realloc(), error_literal(), LITERAL, unlikely, and yylval.

Referenced by yylex().

4014 {
4015  size_t currlen;
4016 
4017  literal_error = 0;
4018 
4019  /* currlen includes the terminating quote */
4020  currlen = strlen (text);
4021  if (unlikely((currlen - 1) > cb_lit_length)) {
4022  currlen--;
4023  snprintf (err_msg, COB_MINI_MAX,
4024  _("Literal length %d exceeds %d characters"),
4025  (int) currlen, cb_lit_length);
4026  if (llit) {
4027  error_literal ("L", text);
4028  } else {
4029  error_literal ("Z", text);
4030  }
4032  return LITERAL;
4033  }
4034  if (unlikely(currlen > plexsize)) {
4035  plexsize = currlen;
4037  }
4038  memcpy (plexbuff, text, currlen);
4039  plexbuff[currlen - 1] = 0;
4040 
4041  /* Count is correct here as the trailing quote is now a null */
4043  CB_LITERAL(yylval)->llit = llit;
4044  return LITERAL;
4045 }
void * cobc_realloc(void *prevptr, const size_t size)
Definition: cobc.c:687
#define CB_LITERAL(x)
Definition: tree.h:601
cb_tree cb_build_alphanumeric_literal(const void *data, const size_t size)
Definition: tree.c:1716
static unsigned int literal_error
Definition: scanner.c:1449
static void error_literal(const char *type, const char *literal)
Definition: scanner.c:3844
#define _(s)
Definition: cobcrun.c:59
#define unlikely(x)
Definition: common.h:437
static char err_msg[COB_MINI_BUFF]
Definition: scanner.c:1450
cb_tree cb_error_node
Definition: tree.c:140
static size_t plexsize
Definition: scanner.c:1443
static char * plexbuff
Definition: scanner.c:1440
#define yylval
Definition: ppparse.c:69
#define COB_MINI_MAX
Definition: common.h:545

Here is the call graph for this function:

Here is the caller graph for this function:

static int significand_is_zero ( const char *  int_part,
const char *  dec_part 
)
static

Definition at line 4302 of file scanner.c.

References all_zeroes().

Referenced by scan_floating_numeric().

4303 {
4304  return all_zeroes (int_part)
4305  && all_zeroes (dec_part);
4306 }
static int all_zeroes(const char *str)
Definition: scanner.c:4288

Here is the call graph for this function:

Here is the caller graph for this function:

void ylex_call_destroy ( void  )

Definition at line 4757 of file scanner.c.

References NULL, and yylex_destroy().

Referenced by process_translate().

4758 {
4759  /* Release flex buffers */
4760  (void)yylex_destroy ();
4761  const78ptr = NULL;
4762 }
int yylex_destroy(void)
Definition: scanner.c:3770
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 struct cb_level_78 * const78ptr
Definition: scanner.c:1437

Here is the call graph for this function:

Here is the caller graph for this function:

void ylex_clear_all ( void  )

Definition at line 4736 of file scanner.c.

References cobc_free(), and NULL.

Referenced by main().

4737 {
4738  /* Clear buffers after parsing all source elements */
4739  if (picbuff2) {
4740  cobc_free (picbuff2);
4741  picbuff2 = NULL;
4742  }
4743  if (picbuff1) {
4744  cobc_free (picbuff1);
4745  picbuff1 = NULL;
4746  }
4747  if (plexbuff) {
4748  cobc_free (plexbuff);
4749  plexbuff = NULL;
4750  }
4751  plexsize = 0;
4752  pic1size = 0;
4753  pic2size = 0;
4754 }
void cobc_free(void *mptr)
Definition: cobc.c:657
static size_t pic1size
Definition: scanner.c:1444
static size_t pic2size
Definition: scanner.c:1445
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 * picbuff1
Definition: scanner.c:1441
static size_t plexsize
Definition: scanner.c:1443
static char * plexbuff
Definition: scanner.c:1440
static char * picbuff2
Definition: scanner.c:1442

Here is the call graph for this function:

Here is the caller graph for this function:

YY_BUFFER_STATE yy_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 3512 of file scanner.c.

References yy_buffer_state::yy_buf_size, yy_buffer_state::yy_ch_buf, YY_FATAL_ERROR, yy_init_buffer(), yy_buffer_state::yy_is_our_buffer, and yyalloc().

Referenced by yylex(), and yyrestart().

3513 {
3514  YY_BUFFER_STATE b;
3515 
3516  b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
3517  if ( ! b )
3518  YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
3519 
3520  b->yy_buf_size = size;
3521 
3522  /* yy_ch_buf has to be 2 characters longer than the size given because
3523  * we need to put in 2 end-of-buffer characters.
3524  */
3525  b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
3526  if ( ! b->yy_ch_buf )
3527  YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
3528 
3529  b->yy_is_our_buffer = 1;
3530 
3531  yy_init_buffer(b,file );
3532 
3533  return b;
3534 }
#define YY_FATAL_ERROR(msg)
Definition: scanner.c:1669
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 yy_init_buffer(YY_BUFFER_STATE b, FILE *file)
Definition: scanner.c:3559
char * yy_ch_buf
Definition: pplex.c:223
int yy_is_our_buffer
Definition: pplex.c:240
void * yyalloc(yy_size_t)
Definition: scanner.c:3815
struct yy_buffer_state * YY_BUFFER_STATE
Definition: scanner.c:163

Here is the call graph for this function:

Here is the caller graph for this function:

void yy_delete_buffer ( YY_BUFFER_STATE  b)

Destroy the buffer.

Parameters
ba buffer created with yy_create_buffer()

Definition at line 3540 of file scanner.c.

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

Referenced by yylex_destroy(), and yypop_buffer_state().

3541 {
3542 
3543  if ( ! b )
3544  return;
3545 
3546  if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
3548 
3549  if ( b->yy_is_our_buffer )
3550  yyfree((void *) b->yy_ch_buf );
3551 
3552  yyfree((void *) b );
3553 }
#define YY_CURRENT_BUFFER_LVALUE
Definition: scanner.c:281
void yyfree(void *)
Definition: scanner.c:3832
#define YY_CURRENT_BUFFER
Definition: scanner.c:274
char * yy_ch_buf
Definition: pplex.c:223
int yy_is_our_buffer
Definition: pplex.c:240
struct yy_buffer_state * YY_BUFFER_STATE
Definition: scanner.c:163

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 3712 of file scanner.c.

References YY_EXIT_FAILURE.

3713 {
3714  (void) fprintf( stderr, "%s\n", msg );
3715  exit( YY_EXIT_FAILURE );
3716 }
#define YY_EXIT_FAILURE
Definition: scanner.c:3709
void yy_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 3587 of file scanner.c.

References 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, yy_load_buffer_state(), and yy_buffer_state::yy_n_chars.

Referenced by yy_init_buffer().

3588 {
3589  if ( ! b )
3590  return;
3591 
3592  b->yy_n_chars = 0;
3593 
3594  /* We always need two end-of-buffer characters. The first causes
3595  * a transition to the end-of-buffer state. The second causes
3596  * a jam in that state.
3597  */
3600 
3601  b->yy_buf_pos = &b->yy_ch_buf[0];
3602 
3603  b->yy_at_bol = 1;
3605 
3606  if ( b == YY_CURRENT_BUFFER )
3608 }
char * yy_buf_pos
Definition: pplex.c:224
yy_size_t yy_n_chars
Definition: pplex.c:234
int yy_at_bol
Definition: pplex.c:253
#define YY_CURRENT_BUFFER
Definition: scanner.c:274
#define YY_END_OF_BUFFER_CHAR
Definition: scanner.c:142
char * yy_ch_buf
Definition: pplex.c:223
int yy_buffer_status
Definition: pplex.c:263
static void yy_load_buffer_state(void)
Definition: scanner.c:3498
#define YY_BUFFER_NEW
Definition: scanner.c:246

Here is the call graph for this function:

Here is the caller graph for this function:

static int yy_get_next_buffer ( void  )
static

Definition at line 3142 of file scanner.c.

References EOB_ACT_CONTINUE_SCAN, EOB_ACT_END_OF_FILE, EOB_ACT_LAST_MATCH, 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, yyin, yyrealloc(), yyrestart(), and yytext_ptr.

Referenced by input(), and yylex().

3143 {
3144  register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
3145  register char *source = (yytext_ptr);
3146  register int number_to_move, i;
3147  int ret_val;
3148 
3149  if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
3151  "fatal flex scanner internal error--end of buffer missed" );
3152 
3153  if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
3154  { /* Don't try to fill the buffer, so this is an EOF. */
3155  if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
3156  {
3157  /* We matched a single character, the EOB, so
3158  * treat this as a final EOF.
3159  */
3160  return EOB_ACT_END_OF_FILE;
3161  }
3162 
3163  else
3164  {
3165  /* We matched some text prior to the EOB, first
3166  * process it.
3167  */
3168  return EOB_ACT_LAST_MATCH;
3169  }
3170  }
3171 
3172  /* Try to read more data. */
3173 
3174  /* First move last chars to start of buffer. */
3175  number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
3176 
3177  for ( i = 0; i < number_to_move; ++i )
3178  *(dest++) = *(source++);
3179 
3180  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
3181  /* don't do the read, it's not guaranteed to return an EOF,
3182  * just force an EOF
3183  */
3184  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
3185 
3186  else
3187  {
3188  yy_size_t num_to_read =
3189  YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
3190 
3191  while ( num_to_read <= 0 )
3192  { /* Not enough room in the buffer - grow it. */
3193 
3194  /* just a shorter name for the current buffer */
3196 
3197  int yy_c_buf_p_offset =
3198  (int) ((yy_c_buf_p) - b->yy_ch_buf);
3199 
3200  if ( b->yy_is_our_buffer )
3201  {
3202  yy_size_t new_size = b->yy_buf_size * 2;
3203 
3204  if ( new_size <= 0 )
3205  b->yy_buf_size += b->yy_buf_size / 8;
3206  else
3207  b->yy_buf_size *= 2;
3208 
3209  b->yy_ch_buf = (char *)
3210  /* Include room in for 2 EOB chars. */
3211  yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
3212  }
3213  else
3214  /* Can't grow it, we don't own it. */
3215  b->yy_ch_buf = 0;
3216 
3217  if ( ! b->yy_ch_buf )
3219  "fatal error - scanner input buffer overflow" );
3220 
3221  (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
3222 
3223  num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
3224  number_to_move - 1;
3225 
3226  }
3227 
3228  if ( num_to_read > YY_READ_BUF_SIZE )
3229  num_to_read = YY_READ_BUF_SIZE;
3230 
3231  /* Read in more data. */
3232  YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
3233  (yy_n_chars), num_to_read );
3234 
3235  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
3236  }
3237 
3238  if ( (yy_n_chars) == 0 )
3239  {
3240  if ( number_to_move == YY_MORE_ADJ )
3241  {
3242  ret_val = EOB_ACT_END_OF_FILE;
3243  yyrestart(yyin );
3244  }
3245 
3246  else
3247  {
3248  ret_val = EOB_ACT_LAST_MATCH;
3249  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
3251  }
3252  }
3253 
3254  else
3255  ret_val = EOB_ACT_CONTINUE_SCAN;
3256 
3257  if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
3258  /* Extend the array by 50%, plus the number we really need. */
3259  yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
3260  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
3261  if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
3262  YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
3263  }
3264 
3265  (yy_n_chars) += number_to_move;
3268 
3269  (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
3270 
3271  return ret_val;
3272 }
void * yyrealloc(void *, yy_size_t)
Definition: scanner.c:3820
#define EOB_ACT_LAST_MATCH
Definition: scanner.c:177
#define EOB_ACT_END_OF_FILE
Definition: scanner.c:176
#define YY_CURRENT_BUFFER_LVALUE
Definition: scanner.c:281
static yy_size_t yy_n_chars
Definition: scanner.c:285
#define yytext_ptr
Definition: scanner.c:357
#define YY_FATAL_ERROR(msg)
Definition: scanner.c:1669
#define YY_BUFFER_EOF_PENDING
Definition: scanner.c:258
static char * yy_c_buf_p
Definition: scanner.c:289
yy_size_t yy_buf_size
Definition: pplex.c:229
#define YY_MORE_ADJ
Definition: scanner.c:1338
#define EOB_ACT_CONTINUE_SCAN
Definition: scanner.c:175
#define YY_INPUT(buf, result, max_size)
Definition: scanner.c:1373
FILE * yyin
Definition: scanner.c:348
#define YY_END_OF_BUFFER_CHAR
Definition: scanner.c:142
char * yy_ch_buf
Definition: pplex.c:223
int yy_is_our_buffer
Definition: pplex.c:240
#define YY_READ_BUF_SIZE
Definition: scanner.c:1364
size_t yy_size_t
Definition: pplex.c:187
void yyrestart(FILE *input_file)
Immediately switch to a different input stream.
Definition: scanner.c:3450

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 3276 of file scanner.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 yylex().

3277 {
3278  register yy_state_type yy_current_state;
3279  register char *yy_cp;
3280 
3281  yy_current_state = (yy_start);
3282  yy_current_state += YY_AT_BOL();
3283 
3284  for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
3285  {
3286  register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
3287  if ( yy_accept[yy_current_state] )
3288  {
3289  (yy_last_accepting_state) = yy_current_state;
3290  (yy_last_accepting_cpos) = yy_cp;
3291  }
3292  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
3293  {
3294  yy_current_state = (int) yy_def[yy_current_state];
3295  if ( yy_current_state >= 833 )
3296  yy_c = yy_meta[(unsigned int) yy_c];
3297  }
3298  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
3299  }
3300 
3301  return yy_current_state;
3302 }
static flex_int16_t yy_accept[833]
Definition: scanner.c:383
#define yytext_ptr
Definition: scanner.c:357
unsigned char YY_CHAR
Definition: pplex.c:365
static flex_int16_t yy_def[865]
Definition: scanner.c:622
static flex_int16_t yy_nxt[2719]
Definition: scanner.c:721
static flex_int16_t yy_chk[2719]
Definition: scanner.c:1024
static char * yy_c_buf_p
Definition: scanner.c:289
static yy_state_type yy_last_accepting_state
Definition: scanner.c:1327
static char * yy_last_accepting_cpos
Definition: scanner.c:1328
#define YY_MORE_ADJ
Definition: scanner.c:1338
#define YY_SC_TO_UI(c)
Definition: scanner.c:121
static flex_int32_t yy_ec[256]
Definition: scanner.c:479
int yy_state_type
Definition: pplex.c:369
#define YY_AT_BOL()
Definition: scanner.c:342
static flex_int16_t yy_base[865]
Definition: scanner.c:523
static int yy_start
Definition: scanner.c:291
static flex_int32_t yy_meta[75]
Definition: scanner.c:511

Here is the caller graph for this function:

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

Definition at line 3559 of file scanner.c.

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

Referenced by yy_create_buffer(), and yyrestart().

3561 {
3562  int oerrno = errno;
3563 
3564  yy_flush_buffer(b );
3565 
3566  b->yy_input_file = file;
3567  b->yy_fill_buffer = 1;
3568 
3569  /* If b is the current buffer, then yy_init_buffer was _probably_
3570  * called from yyrestart() or through yy_get_next_buffer.
3571  * In that case, we don't want to reset the lineno or column.
3572  */
3573  if (b != YY_CURRENT_BUFFER){
3574  b->yy_bs_lineno = 1;
3575  b->yy_bs_column = 0;
3576  }
3577 
3578  b->yy_is_interactive = 0;
3579 
3580  errno = oerrno;
3581 }
void yy_flush_buffer(YY_BUFFER_STATE b)
Discard all buffered characters.
Definition: scanner.c:3587
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
#define YY_CURRENT_BUFFER
Definition: scanner.c:274
int yy_bs_column
The column count.
Definition: pplex.c:256
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 int yy_init_globals ( void  )
static

Get the current token.

Definition at line 3741 of file scanner.c.

References yy_buffer_stack, yy_buffer_stack_max, yy_buffer_stack_top, yy_c_buf_p, yy_init, yy_start, yyin, and yyout.

Referenced by yylex_destroy().

3742 {
3743  /* Initialization is the same as for the non-reentrant scanner.
3744  * This function is called from yylex_destroy(), so don't allocate here.
3745  */
3746 
3747  (yy_buffer_stack) = 0;
3748  (yy_buffer_stack_top) = 0;
3749  (yy_buffer_stack_max) = 0;
3750  (yy_c_buf_p) = (char *) 0;
3751  (yy_init) = 0;
3752  (yy_start) = 0;
3753 
3754 /* Defined in main.c */
3755 #ifdef YY_STDINIT
3756  yyin = stdin;
3757  yyout = stdout;
3758 #else
3759  yyin = (FILE *) 0;
3760  yyout = (FILE *) 0;
3761 #endif
3762 
3763  /* For future reference: Set errno on error, since we are called by
3764  * yylex_init()
3765  */
3766  return 0;
3767 }
static YY_BUFFER_STATE * yy_buffer_stack
Stack as an array.
Definition: scanner.c:266
static char * yy_c_buf_p
Definition: scanner.c:289
static size_t yy_buffer_stack_top
index of top of stack.
Definition: scanner.c:264
static int yy_init
Definition: scanner.c:290
FILE * yyin
Definition: scanner.c:348
FILE * yyout
Definition: scanner.c:348
static int yy_start
Definition: scanner.c:291
static size_t yy_buffer_stack_max
capacity of stack.
Definition: scanner.c:265

Here is the caller graph for this function:

static void yy_load_buffer_state ( void  )
static

Definition at line 3498 of file scanner.c.

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

Referenced by yy_flush_buffer(), yy_switch_to_buffer(), yylex(), yypop_buffer_state(), yypush_buffer_state(), and yyrestart().

3499 {
3500  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
3501  (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
3502  yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
3503  (yy_hold_char) = *(yy_c_buf_p);
3504 }
static char yy_hold_char
Definition: scanner.c:284
#define YY_CURRENT_BUFFER_LVALUE
Definition: scanner.c:281
static yy_size_t yy_n_chars
Definition: scanner.c:285
#define yytext_ptr
Definition: scanner.c:357
static char * yy_c_buf_p
Definition: scanner.c:289
FILE * yyin
Definition: scanner.c:348

Here is the caller graph for this function:

YY_BUFFER_STATE yy_scan_buffer ( char *  base,
yy_size_t  size 
)
YY_BUFFER_STATE yy_scan_bytes ( char *  bytes,
yy_size_t  len 
)
YY_BUFFER_STATE yy_scan_string ( char *  yy_str)
void yy_switch_to_buffer ( YY_BUFFER_STATE  new_buffer)

Switch to a different input buffer.

Parameters
new_bufferThe new input buffer.

Definition at line 3467 of file scanner.c.

References yy_c_buf_p, YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, yy_did_buffer_switch_on_eof, yy_hold_char, yy_load_buffer_state(), yy_n_chars, and yyensure_buffer_stack().

3468 {
3469 
3470  /* TODO. We should be able to replace this entire function body
3471  * with
3472  * yypop_buffer_state();
3473  * yypush_buffer_state(new_buffer);
3474  */
3476  if ( YY_CURRENT_BUFFER == new_buffer )
3477  return;
3478 
3479  if ( YY_CURRENT_BUFFER )
3480  {
3481  /* Flush out information for old buffer. */
3482  *(yy_c_buf_p) = (yy_hold_char);
3483  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
3484  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
3485  }
3486 
3487  YY_CURRENT_BUFFER_LVALUE = new_buffer;
3489 
3490  /* We don't actually know whether we did this switch during
3491  * EOF (yywrap()) processing, but the only time this flag
3492  * is looked at is after yywrap() is called, so it's safe
3493  * to go ahead and always set it.
3494  */
3496 }
static char yy_hold_char
Definition: scanner.c:284
#define YY_CURRENT_BUFFER_LVALUE
Definition: scanner.c:281
static yy_size_t yy_n_chars
Definition: scanner.c:285
static int yy_did_buffer_switch_on_eof
Definition: scanner.c:296
static char * yy_c_buf_p
Definition: scanner.c:289
#define YY_CURRENT_BUFFER
Definition: scanner.c:274
static void yyensure_buffer_stack(void)
Definition: scanner.c:3665
static void yy_load_buffer_state(void)
Definition: scanner.c:3498

Here is the call graph for this function:

static yy_state_type yy_try_NUL_trans ( yy_state_type  current_state)
static

Definition at line 3309 of file scanner.c.

References yy_c_buf_p, yy_last_accepting_cpos, and yy_last_accepting_state.

Referenced by yylex().

3310 {
3311  register int yy_is_jam;
3312  register char *yy_cp = (yy_c_buf_p);
3313 
3314  register YY_CHAR yy_c = 1;
3315  if ( yy_accept[yy_current_state] )
3316  {
3317  (yy_last_accepting_state) = yy_current_state;
3318  (yy_last_accepting_cpos) = yy_cp;
3319  }
3320  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
3321  {
3322  yy_current_state = (int) yy_def[yy_current_state];
3323  if ( yy_current_state >= 833 )
3324  yy_c = yy_meta[(unsigned int) yy_c];
3325  }
3326  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
3327  yy_is_jam = (yy_current_state == 832);
3328 
3329  return yy_is_jam ? 0 : yy_current_state;
3330 }
static flex_int16_t yy_accept[833]
Definition: scanner.c:383
unsigned char YY_CHAR
Definition: pplex.c:365
static flex_int16_t yy_def[865]
Definition: scanner.c:622
static flex_int16_t yy_nxt[2719]
Definition: scanner.c:721
static flex_int16_t yy_chk[2719]
Definition: scanner.c:1024
static char * yy_c_buf_p
Definition: scanner.c:289
static yy_state_type yy_last_accepting_state
Definition: scanner.c:1327
static char * yy_last_accepting_cpos
Definition: scanner.c:1328
static flex_int16_t yy_base[865]
Definition: scanner.c:523
static flex_int32_t yy_meta[75]
Definition: scanner.c:511

Here is the caller graph for this function:

void * yyalloc ( yy_size_t  size)

Definition at line 3815 of file scanner.c.

Referenced by yy_create_buffer(), and yyensure_buffer_stack().

3816 {
3817  return (void *) malloc( size );
3818 }

Here is the caller graph for this function:

static void yyensure_buffer_stack ( void  )
static

Definition at line 3665 of file scanner.c.

References yy_buffer_stack, yy_buffer_stack_max, yy_buffer_stack_top, YY_FATAL_ERROR, yyalloc(), and yyrealloc().

Referenced by yy_switch_to_buffer(), yylex(), yypush_buffer_state(), and yyrestart().

3666 {
3667  yy_size_t num_to_alloc;
3668 
3669  if (!(yy_buffer_stack)) {
3670 
3671  /* First allocation is just for 2 elements, since we don't know if this
3672  * scanner will even need a stack. We use 2 instead of 1 to avoid an
3673  * immediate realloc on the next call.
3674  */
3675  num_to_alloc = 1;
3677  (num_to_alloc * sizeof(struct yy_buffer_state*)
3678  );
3679  if ( ! (yy_buffer_stack) )
3680  YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
3681 
3682  memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
3683 
3684  (yy_buffer_stack_max) = num_to_alloc;
3685  (yy_buffer_stack_top) = 0;
3686  return;
3687  }
3688 
3689  if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
3690 
3691  /* Increase the buffer to prepare for a possible push. */
3692  int grow_size = 8 /* arbitrary grow size */;
3693 
3694  num_to_alloc = (yy_buffer_stack_max) + grow_size;
3696  ((yy_buffer_stack),
3697  num_to_alloc * sizeof(struct yy_buffer_state*)
3698  );
3699  if ( ! (yy_buffer_stack) )
3700  YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
3701 
3702  /* zero only the new slots.*/
3703  memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
3704  (yy_buffer_stack_max) = num_to_alloc;
3705  }
3706 }
void * yyrealloc(void *, yy_size_t)
Definition: scanner.c:3820
static YY_BUFFER_STATE * yy_buffer_stack
Stack as an array.
Definition: scanner.c:266
#define YY_FATAL_ERROR(msg)
Definition: scanner.c:1669
static size_t yy_buffer_stack_top
index of top of stack.
Definition: scanner.c:264
void * yyalloc(yy_size_t)
Definition: scanner.c:3815
static size_t yy_buffer_stack_max
capacity of stack.
Definition: scanner.c:265
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 yyfree ( void *  ptr)

Definition at line 3832 of file scanner.c.

Referenced by yy_delete_buffer(), and yylex_destroy().

3833 {
3834  free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
3835 }

Here is the caller graph for this function:

int yylex ( void  )

The main scanner function which does all the work.

Definition at line 1705 of file scanner.c.

References _, BEGIN, BOTTOM, cb_build_alphanumeric_literal(), cb_build_comment(), cb_build_numeric_literal(), cb_build_reference(), CB_CHAIN, CB_CS_EXIT, cb_error(), cb_error_node, cb_find_defined_program_by_name(), CB_FUNC_PROTOTYPE, CB_FUNCTION_TYPE, cb_intrinsic_list, CB_LITERAL, cb_source_file, cb_source_line, CB_SYSTEM_NAME_P, CB_VALUE, cb_warning(), CB_WORD_COUNT, CB_WORD_ITEMS, cb_level_78::chk_const, COB_MAX_WORDLEN, cobc_cs_check, cobc_force_literal, cobc_free(), cobc_in_procedure, cobc_in_repository, cobc_parse_strdup(), cobc_strdup(), COMMA_DELIM, count_lines(), current_program, DECIMAL_IS_COMMA, DECIMAL_IS_PERIOD, cb_program::decimal_point, EC, END, END_FUNCTION, END_PROGRAM, EOB_ACT_CONTINUE_SCAN, EOB_ACT_END_OF_FILE, EOB_ACT_LAST_MATCH, EOP, EQUAL, ESCAPE, EVENT_STATUS, EXCEPTION, EXCEPTION_CONDITION, EXPONENTIATION, cb_level_78::fld78, FROM_CRT, FUNCTION, FUNCTION_NAME, cb_program::function_spec_list, FUNCTION_STATE, functions_are_all, cb_level_78::globnext, GREATER, GREATER_OR_EQUAL, INITIAL, input(), INVALID_KEY, LENGTH_OF, LESS, LESS_OR_EQUAL, likely, LITERAL, lookup_intrinsic(), lookup_reserved_word(), MNEMONIC_NAME, cb_field::name, cb_intrinsic_table::name, cb_text_list::next, cb_level_78::next, NEXT_PAGE, NO_ADVANCING, cobc_reserved::nodegen, non_const_word, cb_level_78::not_const, NOT_END, NOT_EOP, NOT_EQUAL, NOT_ESCAPE, NOT_EXCEPTION, NOT_INVALID_KEY, NOT_OVERFLOW, NOT_SIZE_ERROR, NULL, cb_program::orig_program_id, PICTURE, PICTURE_STATE, PICTURE_SYMBOL, cb_level_78::prog, cb_program::prog_type, PROGRAM_NAME, read_literal(), READY_TRACE, REPLACING, RESET_TRACE, scan_b(), scan_define_options(), scan_floating_numeric(), scan_h(), scan_numeric(), scan_o(), scan_options(), scan_picture(), scan_x(), scan_z(), SCREEN_CONTROL, SEMI_COLON, SIZE_ERROR, cb_text_list::text, TOK_AMPER, TOK_CLOSE_PAREN, TOK_COLON, TOK_DIV, TOK_DOT, TOK_EQUAL, TOK_GREATER, TOK_LESS, TOK_MINUS, TOK_MUL, TOK_OPEN_PAREN, TOK_OVERFLOW, TOK_PLUS, cobc_reserved::token, cb_intrinsic_table::token, TOP, unlikely, unput, UPON_ARGUMENT_NUMBER, UPON_COMMAND_LINE, UPON_ENVIRONMENT_NAME, UPON_ENVIRONMENT_VALUE, USER_FUNCTION_NAME, cb_program::user_spec_list, cb_field::values, warningopt, WORD, YY_AT_BOL, YY_BREAK, YY_BUF_SIZE, YY_BUFFER_NEW, YY_BUFFER_NORMAL, yy_c_buf_p, yy_create_buffer(), 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_load_buffer_state(), YY_MORE_ADJ, yy_n_chars, YY_NEW_FILE, 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, yyensure_buffer_stack(), yyin, yyleng, yylval, yyout, yyterminate, yytext_ptr, and yywrap().

1706 {
1707  register yy_state_type yy_current_state;
1708  register char *yy_cp, *yy_bp;
1709  register int yy_act;
1710 
1711  if ( !(yy_init) )
1712  {
1713  (yy_init) = 1;
1714 
1715 #ifdef YY_USER_INIT
1716  YY_USER_INIT;
1717 #endif
1718 
1719  if ( ! (yy_start) )
1720  (yy_start) = 1; /* first start state */
1721 
1722  if ( ! yyin )
1723  yyin = stdin;
1724 
1725  if ( ! yyout )
1726  yyout = stdout;
1727 
1728  if ( ! YY_CURRENT_BUFFER ) {
1732  }
1733 
1735  }
1736 
1737  {
1738 #line 229 "scanner.l"
1739 
1740 
1741 
1742  if (likely(current_program)) {
1743  if (current_program->decimal_point == '.') {
1745  } else {
1747  }
1748  }
1749 
1750  /* We treat integer literals immediately after '.' as labels;
1751  that is, they must be level numbers or section names. */
1752  if (last_token_is_dot) {
1753  integer_is_label = 1;
1754  last_token_is_dot = 0;
1755  } else {
1756  integer_is_label = 0;
1757  }
1758 
1759 
1760 
1761 #line 1761 "scanner.c"
1762 
1763  while ( 1 ) /* loops until end-of-file is reached */
1764  {
1765  yy_cp = (yy_c_buf_p);
1766 
1767  /* Support of yytext. */
1768  *yy_cp = (yy_hold_char);
1769 
1770  /* yy_bp points to the position in yy_ch_buf of the start of
1771  * the current run.
1772  */
1773  yy_bp = yy_cp;
1774 
1775  yy_current_state = (yy_start);
1776  yy_current_state += YY_AT_BOL();
1777 yy_match:
1778  do
1779  {
1780  register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
1781  if ( yy_accept[yy_current_state] )
1782  {
1783  (yy_last_accepting_state) = yy_current_state;
1784  (yy_last_accepting_cpos) = yy_cp;
1785  }
1786  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1787  {
1788  yy_current_state = (int) yy_def[yy_current_state];
1789  if ( yy_current_state >= 833 )
1790  yy_c = yy_meta[(unsigned int) yy_c];
1791  }
1792  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1793  ++yy_cp;
1794  }
1795  while ( yy_current_state != 832 );
1796  yy_cp = (yy_last_accepting_cpos);
1797  yy_current_state = (yy_last_accepting_state);
1798 
1799 yy_find_action:
1800  yy_act = yy_accept[yy_current_state];
1801 
1803 
1804 do_action: /* This label is used only to access EOF actions. */
1805 
1806  switch ( yy_act )
1807  { /* beginning of action switch */
1808  case 0: /* must back up */
1809  /* undo the effects of YY_DO_BEFORE_ACTION */
1810  *yy_cp = (yy_hold_char);
1811  yy_cp = (yy_last_accepting_cpos);
1812  yy_current_state = (yy_last_accepting_state);
1813  goto yy_find_action;
1814 
1815 case 1:
1816 /* rule 1 can match eol */
1818 #line 251 "scanner.l"
1819 {
1821 }
1822  YY_BREAK
1823 case 2:
1824 /* rule 2 can match eol */
1826 #line 255 "scanner.l"
1827 {
1828  scan_options (yytext, 1);
1829 }
1830  YY_BREAK
1831 case 3:
1832 /* rule 3 can match eol */
1834 #line 259 "scanner.l"
1835 {
1836  scan_options (yytext, 2);
1837 }
1838  YY_BREAK
1839 case 4:
1840 /* rule 4 can match eol */
1842 #line 263 "scanner.l"
1843 {
1844  scan_options (yytext, 3);
1845 }
1846  YY_BREAK
1847 case 5:
1848 /* rule 5 can match eol */
1850 #line 267 "scanner.l"
1851 {
1852  cb_source_line++;
1853 }
1854  YY_BREAK
1855 case 6:
1857 #line 271 "scanner.l"
1858 {
1859  /* Line directive */
1860  char *p1;
1861  char *p2;
1862 
1863  p1 = strchr (yytext, '"');
1864  if (p1) {
1865  p2 = cobc_strdup (p1 + 1);
1866  p1 = strrchr (p2, '"');
1867  if (p1) {
1868  *p1 = 0;
1870  cb_source_line = (int)strtol (yytext + 5, NULL, 10) - 1;
1871  }
1872  cobc_free (p2);
1873  }
1874 }
1875  YY_BREAK
1876 case 7:
1878 #line 289 "scanner.l"
1879 {
1880  /* Ignore */
1881 }
1882  YY_BREAK
1883 case 8:
1884 #line 294 "scanner.l"
1885 case 9:
1887 #line 294 "scanner.l"
1888 {
1890 }
1891  YY_BREAK
1892 case 10:
1894 #line 298 "scanner.l"
1895 {
1897  yylval = NULL;
1898  return FUNCTION;
1899  }
1901 }
1902  YY_BREAK
1903 case 11:
1905 #line 306 "scanner.l"
1906 {
1907  /* String literal */
1908  cobc_force_literal = 0;
1909  read_literal (yytext[0]);
1910  return LITERAL;
1911 }
1912  YY_BREAK
1913 case 12:
1914 #line 314 "scanner.l"
1915 case 13:
1917 #line 314 "scanner.l"
1918 {
1919  /* X string literal */
1920  cobc_force_literal = 0;
1921  return scan_x (yytext + 2);
1922 }
1923  YY_BREAK
1924 case 14:
1925 #line 321 "scanner.l"
1926 case 15:
1928 #line 321 "scanner.l"
1929 {
1930  /* Z string literal */
1931  cobc_force_literal = 0;
1932  return scan_z (yytext + 2, 0);
1933 }
1934  YY_BREAK
1935 case 16:
1936 #line 328 "scanner.l"
1937 case 17:
1939 #line 328 "scanner.l"
1940 {
1941  /* L string literal */
1942  cobc_force_literal = 0;
1943  return scan_z (yytext + 2, 1);
1944 }
1945  YY_BREAK
1946 case 18:
1947 #line 335 "scanner.l"
1948 case 19:
1950 #line 335 "scanner.l"
1951 {
1952  /* H numeric literal */
1953  cobc_force_literal = 0;
1954  return scan_h (yytext + 2, 1);
1955 }
1956  YY_BREAK
1957 case 20:
1958 #line 342 "scanner.l"
1959 case 21:
1961 #line 342 "scanner.l"
1962 {
1963  /* B boolean/numeric literal */
1964  cobc_force_literal = 0;
1965  return scan_b (yytext + 2, 1);
1966 }
1967  YY_BREAK
1968 case 22:
1970 #line 348 "scanner.l"
1971 {
1972  /*
1973  To avoid subtle silent errors, such as B#021, this rule (and the ones
1974  following) here admit some invalid literals which emit errors when
1975  they are processed.
1976  */
1977  /* ACUCOBOL binary numeric literal */
1978  cobc_force_literal = 0;
1979  return scan_b (yytext + 2, 0);
1980 }
1981  YY_BREAK
1982 case 23:
1984 #line 359 "scanner.l"
1985 {
1986  /* ACUCOBOL octal numeric literal */
1987  cobc_force_literal = 0;
1988  return scan_o (yytext + 2);
1989 }
1990  YY_BREAK
1991 case 24:
1992 #line 366 "scanner.l"
1993 case 25:
1995 #line 366 "scanner.l"
1996 {
1997  /* ACUCOBOL hexadecimal numeric literal */
1998  cobc_force_literal = 0;
1999  return scan_h (yytext + 2, 0);
2000 }
2001  YY_BREAK
2002 case 26:
2004 #line 372 "scanner.l"
2005 {
2006  inside_bracket++;
2007  return TOK_OPEN_PAREN;
2008 }
2009  YY_BREAK
2010 case 27:
2012 #line 377 "scanner.l"
2013 {
2014  if (inside_bracket > 0) {
2015  inside_bracket--;
2016  }
2017  return TOK_CLOSE_PAREN;
2018 }
2019  YY_BREAK
2020 case 28:
2022 #line 384 "scanner.l"
2023 {
2024  cobc_force_literal = 0;
2025  if (integer_is_label) {
2026  /* Integer label or level number */
2028  return WORD;
2029  }
2030  /* Numeric literal or referenced integer label */
2031  /* All transformations/checks are postponed to tree.c */
2033  return LITERAL;
2034 }
2035  YY_BREAK
2036 case 29:
2038 #line 397 "scanner.l"
2039 {
2040  /* Numeric literal (signed) */
2041  return scan_numeric (yytext);
2042 }
2043  YY_BREAK
2044 case 30:
2046 #line 402 "scanner.l"
2047 {
2048  /* Ignore */
2049 }
2050  YY_BREAK
2051 case 31:
2053 #line 406 "scanner.l"
2054 {
2055  if (inside_bracket) {
2056  return SEMI_COLON;
2057  }
2058  /* Ignore */
2059 }
2060  YY_BREAK
2061 case 32:
2063 #line 413 "scanner.l"
2064 {
2065  /* Numeric floating point literal */
2066  return scan_floating_numeric (yytext);
2067 }
2068  YY_BREAK
2069 case 33:
2071 #line 418 "scanner.l"
2072 {
2073  /* Invalid numeric floating point literal */
2074  return scan_floating_numeric (yytext);
2075 }
2076  YY_BREAK
2077 case 34:
2079 #line 423 "scanner.l"
2080 {
2081  /* Numeric literal */
2082  return scan_numeric (yytext);
2083 }
2084  YY_BREAK
2085 case 35:
2087 #line 428 "scanner.l"
2088 {
2089  if (inside_bracket) {
2090  return COMMA_DELIM;
2091  }
2092  /* Ignore */
2093 }
2094  YY_BREAK
2095 case 36:
2097 #line 435 "scanner.l"
2098 {
2099  /* Numeric floating point literal */
2100  return scan_floating_numeric (yytext);
2101 }
2102  YY_BREAK
2103 case 37:
2105 #line 440 "scanner.l"
2106 {
2107  /* Invalid numeric floating point literal */
2108  return scan_floating_numeric (yytext);
2109 }
2110  YY_BREAK
2111 case 38:
2113 #line 445 "scanner.l"
2114 {
2115  /* Numeric literal */
2116  return scan_numeric (yytext);
2117 }
2118  YY_BREAK
2119 case 39:
2121 #line 450 "scanner.l"
2122 {
2123  unput (',');
2124 }
2125  YY_BREAK
2126 case 40:
2128 #line 454 "scanner.l"
2129 {
2130  if (inside_bracket) {
2131  return COMMA_DELIM;
2132  }
2133  /* Ignore */
2134 }
2135  YY_BREAK
2136 case 41:
2137 /* rule 41 can match eol */
2139 #line 461 "scanner.l"
2140 {
2141  cobc_force_literal = 1;
2142  count_lines (yytext);
2143  return END_PROGRAM;
2144 }
2145  YY_BREAK
2146 case 42:
2147 /* rule 42 can match eol */
2149 #line 467 "scanner.l"
2150 {
2151  cobc_force_literal = 1;
2152  count_lines (yytext);
2153  return END_FUNCTION;
2154 }
2155  YY_BREAK
2156 case 43:
2157 /* rule 43 can match eol */
2159 #line 473 "scanner.l"
2160 {
2161  count_lines (yytext);
2162  return PICTURE_SYMBOL;
2163 }
2164  YY_BREAK
2165 case 44:
2166 /* rule 44 can match eol */
2168 #line 478 "scanner.l"
2169 {
2170  count_lines (yytext);
2171  return FROM_CRT;
2172 }
2173  YY_BREAK
2174 case 45:
2175 /* rule 45 can match eol */
2177 #line 483 "scanner.l"
2178 {
2179  count_lines (yytext);
2180  return SCREEN_CONTROL;
2181 }
2182  YY_BREAK
2183 case 46:
2184 /* rule 46 can match eol */
2186 #line 488 "scanner.l"
2187 {
2188  count_lines (yytext);
2189  return EVENT_STATUS;
2190 }
2191  YY_BREAK
2192 case 47:
2193 /* rule 47 can match eol */
2195 #line 493 "scanner.l"
2196 {
2197  count_lines (yytext);
2198  return READY_TRACE;
2199 }
2200  YY_BREAK
2201 case 48:
2202 /* rule 48 can match eol */
2204 #line 498 "scanner.l"
2205 {
2206  count_lines (yytext);
2207  return RESET_TRACE;
2208 }
2209  YY_BREAK
2210 case 49:
2211 /* rule 49 can match eol */
2212 #line 504 "scanner.l"
2213 case 50:
2214 /* rule 50 can match eol */
2215 #line 505 "scanner.l"
2216 case 51:
2217 /* rule 51 can match eol */
2218 #line 506 "scanner.l"
2219 case 52:
2220 /* rule 52 can match eol */
2222 #line 506 "scanner.l"
2223 {
2224  count_lines (yytext);
2225  return GREATER_OR_EQUAL;
2226 }
2227  YY_BREAK
2228 case 53:
2229 /* rule 53 can match eol */
2231 #line 511 "scanner.l"
2232 {
2233  count_lines (yytext);
2234  return GREATER;
2235 }
2236  YY_BREAK
2237 case 54:
2238 /* rule 54 can match eol */
2239 #line 517 "scanner.l"
2240 case 55:
2241 /* rule 55 can match eol */
2242 #line 518 "scanner.l"
2243 case 56:
2244 /* rule 56 can match eol */
2245 #line 519 "scanner.l"
2246 case 57:
2247 /* rule 57 can match eol */
2249 #line 519 "scanner.l"
2250 {
2251  count_lines (yytext);
2252  return LESS_OR_EQUAL;
2253 }
2254  YY_BREAK
2255 case 58:
2256 /* rule 58 can match eol */
2258 #line 524 "scanner.l"
2259 {
2260  count_lines (yytext);
2261  return LESS;
2262 }
2263  YY_BREAK
2264 case 59:
2265 /* rule 59 can match eol */
2267 #line 529 "scanner.l"
2268 {
2269  count_lines (yytext);
2270  return EQUAL;
2271 }
2272  YY_BREAK
2273 case 60:
2274 /* rule 60 can match eol */
2276 #line 534 "scanner.l"
2277 {
2278  count_lines (yytext);
2279  return REPLACING;
2280 }
2281  YY_BREAK
2282 case 61:
2283 /* rule 61 can match eol */
2284 #line 540 "scanner.l"
2285 case 62:
2286 /* rule 62 can match eol */
2287 #line 541 "scanner.l"
2288 case 63:
2289 /* rule 63 can match eol */
2291 #line 541 "scanner.l"
2292 {
2293  count_lines (yytext);
2294  return TOP;
2295 }
2296  YY_BREAK
2297 case 64:
2298 /* rule 64 can match eol */
2299 #line 547 "scanner.l"
2300 case 65:
2301 /* rule 65 can match eol */
2302 #line 548 "scanner.l"
2303 case 66:
2304 /* rule 66 can match eol */
2306 #line 548 "scanner.l"
2307 {
2308  count_lines (yytext);
2309  return BOTTOM;
2310 }
2311  YY_BREAK
2312 case 67:
2313 /* rule 67 can match eol */
2314 #line 554 "scanner.l"
2315 case 68:
2316 /* rule 68 can match eol */
2318 #line 554 "scanner.l"
2319 {
2320  count_lines (yytext);
2321  return NO_ADVANCING;
2322 }
2323  YY_BREAK
2324 case 69:
2325 /* rule 69 can match eol */
2326 #line 560 "scanner.l"
2327 case 70:
2328 /* rule 70 can match eol */
2330 #line 560 "scanner.l"
2331 {
2332  count_lines (yytext);
2333  return NEXT_PAGE;
2334 }
2335  YY_BREAK
2336 case 71:
2337 /* rule 71 can match eol */
2338 #line 566 "scanner.l"
2339 case 72:
2340 /* rule 72 can match eol */
2342 #line 566 "scanner.l"
2343 {
2344  count_lines (yytext);
2345  return NOT_SIZE_ERROR;
2346 }
2347  YY_BREAK
2348 case 73:
2349 /* rule 73 can match eol */
2350 #line 572 "scanner.l"
2351 case 74:
2352 /* rule 74 can match eol */
2354 #line 572 "scanner.l"
2355 {
2356  count_lines (yytext);
2357  return SIZE_ERROR;
2358 }
2359  YY_BREAK
2360 case 75:
2361 /* rule 75 can match eol */
2362 #line 578 "scanner.l"
2363 case 76:
2364 /* rule 76 can match eol */
2366 #line 578 "scanner.l"
2367 {
2368  count_lines (yytext);
2369  return NOT_ESCAPE;
2370 }
2371  YY_BREAK
2372 case 77:
2373 /* rule 77 can match eol */
2374 #line 584 "scanner.l"
2375 case 78:
2376 /* rule 78 can match eol */
2378 #line 584 "scanner.l"
2379 {
2380  count_lines (yytext);
2381  return NOT_EXCEPTION;
2382 }
2383  YY_BREAK
2384 case 79:
2385 /* rule 79 can match eol */
2387 #line 589 "scanner.l"
2388 {
2389  count_lines (yytext);
2390  return ESCAPE;
2391 }
2392  YY_BREAK
2393 case 80:
2394 /* rule 80 can match eol */
2396 #line 594 "scanner.l"
2397 {
2398  count_lines (yytext);
2399  return EXCEPTION;
2400 }
2401  YY_BREAK
2402 case 81:
2403 /* rule 81 can match eol */
2404 #line 600 "scanner.l"
2405 case 82:
2406 /* rule 82 can match eol */
2408 #line 600 "scanner.l"
2409 {
2410  count_lines (yytext);
2411  return NOT_OVERFLOW;
2412 }
2413  YY_BREAK
2414 case 83:
2415 /* rule 83 can match eol */
2416 #line 606 "scanner.l"
2417 case 84:
2418 /* rule 84 can match eol */
2420 #line 606 "scanner.l"
2421 {
2422  count_lines (yytext);
2423  return NOT_END;
2424 }
2425  YY_BREAK
2426 case 85:
2427 /* rule 85 can match eol */
2429 #line 611 "scanner.l"
2430 {
2431  count_lines (yytext);
2432  return END;
2433 }
2434  YY_BREAK
2435 case 86:
2436 /* rule 86 can match eol */
2437 #line 617 "scanner.l"
2438 case 87:
2439 /* rule 87 can match eol */
2441 #line 617 "scanner.l"
2442 {
2443  count_lines (yytext);
2444  return TOK_OVERFLOW;
2445 }
2446  YY_BREAK
2447 case 88:
2448 /* rule 88 can match eol */
2449 #line 623 "scanner.l"
2450 case 89:
2451 /* rule 89 can match eol */
2452 #line 624 "scanner.l"
2453 case 90:
2454 /* rule 90 can match eol */
2455 #line 625 "scanner.l"
2456 case 91:
2457 /* rule 91 can match eol */
2459 #line 625 "scanner.l"
2460 {
2461  count_lines (yytext);
2462  return NOT_EOP;
2463 }
2464  YY_BREAK
2465 case 92:
2466 /* rule 92 can match eol */
2467 #line 631 "scanner.l"
2468 case 93:
2469 /* rule 93 can match eol */
2470 #line 632 "scanner.l"
2471 case 94:
2472 /* rule 94 can match eol */
2473 #line 633 "scanner.l"
2474 case 95:
2475 /* rule 95 can match eol */
2477 #line 633 "scanner.l"
2478 {
2479  count_lines (yytext);
2480  return EOP;
2481 }
2482  YY_BREAK
2483 case 96:
2484 /* rule 96 can match eol */
2486 #line 638 "scanner.l"
2487 {
2488  count_lines (yytext);
2489  return NOT_INVALID_KEY;
2490 }
2491  YY_BREAK
2492 case 97:
2493 /* rule 97 can match eol */
2495 #line 643 "scanner.l"
2496 {
2497  count_lines (yytext);
2498  return NOT_INVALID_KEY;
2499 }
2500  YY_BREAK
2501 case 98:
2502 /* rule 98 can match eol */
2504 #line 648 "scanner.l"
2505 {
2506  count_lines (yytext);
2507  return INVALID_KEY;
2508 }
2509  YY_BREAK
2510 case 99:
2511 /* rule 99 can match eol */
2513 #line 653 "scanner.l"
2514 {
2515  count_lines (yytext);
2516  return INVALID_KEY;
2517 }
2518  YY_BREAK
2519 case 100:
2520 /* rule 100 can match eol */
2522 #line 658 "scanner.l"
2523 {
2524  count_lines (yytext);
2525  return UPON_ENVIRONMENT_NAME;
2526 }
2527  YY_BREAK
2528 case 101:
2529 /* rule 101 can match eol */
2531 #line 663 "scanner.l"
2532 {
2533  count_lines (yytext);
2534  return UPON_ENVIRONMENT_VALUE;
2535 }
2536  YY_BREAK
2537 case 102:
2538 /* rule 102 can match eol */
2540 #line 668 "scanner.l"
2541 {
2542  count_lines (yytext);
2543  return UPON_ARGUMENT_NUMBER;
2544 }
2545  YY_BREAK
2546 case 103:
2547 /* rule 103 can match eol */
2549 #line 673 "scanner.l"
2550 {
2551  count_lines (yytext);
2552  return UPON_COMMAND_LINE;
2553 }
2554  YY_BREAK
2555 case 104:
2556 /* rule 104 can match eol */
2558 #line 678 "scanner.l"
2559 {
2560  count_lines (yytext);
2561  return EXCEPTION_CONDITION;
2562 }
2563  YY_BREAK
2564 case 105:
2565 /* rule 105 can match eol */
2567 #line 683 "scanner.l"
2568 {
2569  count_lines (yytext);
2570  return EXCEPTION_CONDITION;
2571 }
2572  YY_BREAK
2573 case 106:
2574 /* rule 106 can match eol */
2576 #line 688 "scanner.l"
2577 {
2578  count_lines (yytext);
2579  return EC;
2580 }
2581  YY_BREAK
2582 case 107:
2583 /* rule 107 can match eol */
2585 #line 693 "scanner.l"
2586 {
2587  count_lines (yytext);
2588  return LENGTH_OF;
2589 }
2590  YY_BREAK
2591 case 108:
2592 /* rule 108 can match eol */
2594 #line 698 "scanner.l"
2595 {
2596  /* ACUCOBOL extension: switch-names with space and with letter */
2597  char suffix[3] = "";
2598  char name[10] = "";
2599 
2600  unput (yytext[yyleng-1]); /* unput seperator */
2601  if (cobc_in_procedure) {
2602  /* unput characters */
2603  yylval = cb_build_reference ("SWITCH");
2604  if (isdigit((unsigned char)yytext[yyleng-3])) {
2605  unput (yytext[yyleng-2]);
2606  unput (yytext[yyleng-3]);
2607  } else {
2608  unput (yytext[yyleng-2]);
2609  }
2610  } else {
2611  /* we need to return a single word, reverted later in parser.y */
2612  if (yytext[yyleng-3] == ' ' && isdigit((unsigned char)yytext[yyleng-2])) {
2613  /* SWITCH 0 to SWITCH 9 */
2614  suffix[0] = yytext[yyleng-2];
2615  } else if (isdigit((unsigned char)yytext[yyleng-3])) {
2616  /* SWITCH 00 to SWITCH 99 */
2617  suffix[0] = yytext[yyleng-3];
2618  suffix[1] = yytext[yyleng-2];
2619  } else {
2620  suffix[0] = yytext[yyleng-2];
2621  }
2622  strncpy(name, yytext, 6);
2623  strcat(name, "_");
2624  strcat(name, suffix);
2625  yylval = cb_build_reference (name);
2626  }
2627  return WORD;
2628 }
2629  YY_BREAK
2630 case 109:
2632 #line 733 "scanner.l"
2633 {
2634  struct cb_level_78 *p78;
2635  struct cb_intrinsic_table *cbp;
2636  struct cobc_reserved *resptr;
2637  struct cb_text_list *tlp;
2638  cb_tree x;
2639  cb_tree l;
2640  struct cb_program *program;
2641 
2642  /* Check word length */
2643  if (unlikely(yyleng > cb_word_length)) {
2644  if (yyleng > COB_MAX_WORDLEN) {
2645  /* Absolute limit */
2646  cb_error (_("Word length exceeds maximum of %d characters - '%s'"),
2648  } else if (!cb_relaxed_syntax_check) {
2649  cb_error (_("Word length exceeds %d characters - '%s'"),
2650  cb_word_length, yytext);
2651  } else if (warningopt) {
2652  cb_warning (_("Word length exceeds %d characters - '%s'"),
2653  cb_word_length, yytext);
2654  }
2655  }
2656 
2657  /* Check Intrinsic FUNCTION name without keyword */
2660  cbp = lookup_intrinsic (yytext, 1, 0);
2661  if (cbp) {
2662  if (cobc_in_repository) {
2664  return FUNCTION_NAME;
2665  }
2666  if (functions_are_all) {
2668  return (enum yytokentype)(cbp->token);
2669  }
2670  for (tlp = cb_intrinsic_list; tlp; tlp = tlp->next) {
2671  if (!strcasecmp (yytext, tlp->text)) {
2673  return (enum yytokentype)(cbp->token);
2674  }
2675  }
2677  for (; l; l = CB_CHAIN(l)) {
2678  x = CB_VALUE (l);
2679  if (!strcasecmp (yytext,
2680  (char *)(CB_LITERAL(x)->data))) {
2682  return (enum yytokentype)(cbp->token);
2683  }
2684  }
2685  }
2686  }
2687 
2688  /* Bail early for (END) PROGRAM-ID when not a literal */
2690  /* Force PROGRAM-ID / END PROGRAM */
2691  cobc_force_literal = 0;
2692  if (cb_fold_call) {
2694  return PROGRAM_NAME;
2695  } else {
2697  return LITERAL;
2698  }
2699  }
2700 
2701  /* Check reserved word */
2702  resptr = lookup_reserved_word (yytext);
2703  if (resptr != NULL) {
2704  if (resptr->nodegen) {
2705  /* Save location for terminator checking */
2706  /* Misuse comment tree to mark statement */
2708  } else {
2709  yylval = NULL;
2710  }
2711  return resptr->token;
2712  }
2713 
2714  /* Check user function */
2715  if (cobc_in_repository) {
2717  return WORD;
2718  } else {
2720  !functions_are_all &&
2721  !strcasecmp (yytext, current_program->orig_program_id)) {
2722  /* Direct recursive reference */
2724  return USER_FUNCTION_NAME;
2725  }
2726  for (l = current_program->user_spec_list; l; l = CB_CHAIN(l)) {
2727  x = CB_VALUE (l);
2728  if (!strcasecmp (yytext, CB_FUNC_PROTOTYPE (x)->name)) {
2730  return USER_FUNCTION_NAME;
2731  }
2732  }
2733  }
2734 
2735  /* Check user programs */
2737  if (program) {
2739  return PROGRAM_NAME;
2740  }
2741 
2742  /* User word */
2743 
2744  /* Check local, global and source global CONSTANT (78) items */
2745 
2746  for (p78 = top78ptr; p78; p78 = p78->globnext) {
2747  if (strcasecmp (yytext, p78->fld78->name) == 0) {
2748  if (unlikely(non_const_word)) {
2749  if (p78->prog == current_program) {
2750  cb_error (_("A constant may not be used here - '%s'"), yytext);
2752  return WORD;
2753  }
2754  if (p78->chk_const) {
2755  p78->not_const = 1;
2756  }
2757  break;
2758  }
2759  if (p78->chk_const && p78->not_const) {
2760  break;
2761  }
2762  yylval = CB_VALUE (p78->fld78->values);
2763  return LITERAL;
2764  }
2765  }
2766 
2768 
2769  /* Special name handling */
2770  if (CB_WORD_COUNT (yylval) > 0 && CB_WORD_ITEMS (yylval)) {
2771  x = CB_VALUE (CB_WORD_ITEMS (yylval));
2772  if (CB_SYSTEM_NAME_P (x)) {
2773  return MNEMONIC_NAME;
2774  }
2775  }
2776 
2777  return WORD;
2778 }
2779  YY_BREAK
2780 case 110:
2782 #line 880 "scanner.l"
2783 {
2784  yylval = NULL;
2785  return LESS_OR_EQUAL;
2786 }
2787  YY_BREAK
2788 case 111:
2790 #line 885 "scanner.l"
2791 {
2792  yylval = NULL;
2793  return GREATER_OR_EQUAL;
2794 }
2795  YY_BREAK
2796 case 112:
2798 #line 890 "scanner.l"
2799 {
2800  yylval = NULL;
2801  return NOT_EQUAL;
2802 }
2803  YY_BREAK
2804 case 113:
2806 #line 895 "scanner.l"
2807 {
2808  yylval = NULL;
2809  return EXPONENTIATION;
2810 }
2811  YY_BREAK
2812 case 114:
2814 #line 900 "scanner.l"
2815 {
2816  last_token_is_dot = 1;
2817  yylval = NULL;
2818  return TOK_DOT;
2819 }
2820  YY_BREAK
2821 case 115:
2823 #line 906 "scanner.l"
2824 {
2825  yylval = NULL;
2826  return TOK_AMPER;
2827 }
2828  YY_BREAK
2829 case 116:
2831 #line 911 "scanner.l"
2832 {
2833  yylval = NULL;
2834  return TOK_COLON;
2835 }
2836  YY_BREAK
2837 case 117:
2839 #line 916 "scanner.l"
2840 {
2841  yylval = NULL;
2842  return TOK_EQUAL;
2843 }
2844  YY_BREAK
2845 case 118:
2847 #line 921 "scanner.l"
2848 {
2849  yylval = NULL;
2850  return TOK_DIV;
2851 }
2852  YY_BREAK
2853 case 119:
2855 #line 926 "scanner.l"
2856 {
2857  yylval = NULL;
2858  return TOK_MUL;
2859 }
2860  YY_BREAK
2861 case 120:
2863 #line 931 "scanner.l"
2864 {
2865  yylval = NULL;
2866  return TOK_PLUS;
2867 }
2868  YY_BREAK
2869 case 121:
2871 #line 936 "scanner.l"
2872 {
2873  yylval = NULL;
2874  return TOK_MINUS;
2875 }
2876  YY_BREAK
2877 case 122:
2879 #line 941 "scanner.l"
2880 {
2881  yylval = NULL;
2882  return TOK_LESS;
2883 }
2884  YY_BREAK
2885 case 123:
2887 #line 946 "scanner.l"
2888 {
2889  yylval = NULL;
2890  return TOK_GREATER;
2891 }
2892  YY_BREAK
2893 case 124:
2895 #line 951 "scanner.l"
2896 {
2897  int c;
2898 
2899  cb_error (_("Invalid symbol: %s - Skipping word"), yytext);
2900  while ((c = input ()) != EOF) {
2901  if (c == '\n' || c == ' ') {
2902  break;
2903  }
2904  }
2905  if (c != EOF) {
2906  unput (c);
2907  }
2908 }
2909  YY_BREAK
2910 
2911 case 125:
2913 #line 967 "scanner.l"
2914 {
2915  /* Ignore */
2916  }
2917  YY_BREAK
2918 case 126:
2920 #line 970 "scanner.l"
2921 {
2922  BEGIN INITIAL;
2923  scan_picture (yytext);
2924  return PICTURE;
2925  }
2926  YY_BREAK
2927 
2928 
2929 case 127:
2931 #line 978 "scanner.l"
2932 {
2933  struct cb_intrinsic_table *cbp;
2934  cb_tree l;
2935  cb_tree x;
2936 
2937  BEGIN INITIAL;
2939  for (l = current_program->user_spec_list; l; l = CB_CHAIN(l)) {
2940  x = CB_VALUE (l);
2941  if (!strcasecmp (yytext, CB_FUNC_PROTOTYPE (x)->name)) {
2942  return USER_FUNCTION_NAME;
2943  }
2944  }
2945  cbp = lookup_intrinsic (yytext, 1, 0);
2946  if (cbp) {
2947  return (enum yytokentype)(cbp->token);
2948  }
2949  return FUNCTION_NAME;
2950  }
2951  YY_BREAK
2952 case 128:
2954 #line 997 "scanner.l"
2955 {
2956  yylval = NULL;
2957  return yytext[0];
2958  }
2959  YY_BREAK
2960 
2961 case YY_STATE_EOF(INITIAL):
2962 case YY_STATE_EOF(DECIMAL_IS_PERIOD):
2963 case YY_STATE_EOF(DECIMAL_IS_COMMA):
2964 case YY_STATE_EOF(PICTURE_STATE):
2965 case YY_STATE_EOF(FUNCTION_STATE):
2966 #line 1003 "scanner.l"
2967 {
2968  struct cb_level_78 *p78;
2969  struct cb_level_78 *p782;
2970 
2971  /* At EOF - Clear variables */
2972  for (p78 = lev78ptr; p78; ) {
2973  p782 = p78->next;
2974  cobc_free (p78);
2975  p78 = p782;
2976  }
2977  for (p78 = globlev78ptr; p78; ) {
2978  p782 = p78->next;
2979  cobc_free (p78);
2980  p78 = p782;
2981  }
2982  for (p78 = const78ptr; p78; ) {
2983  p782 = p78->next;
2984  cobc_free (p78);
2985  p78 = p782;
2986  }
2987  top78ptr = NULL;
2988  last_token_is_dot = 0;
2989  integer_is_label = 0;
2990  inside_bracket = 0;
2991  lev78ptr = NULL;
2992  globlev78ptr = NULL;
2993  cobc_force_literal = 0;
2994  yyterminate ();
2995 }
2996  YY_BREAK
2997 case 129:
2999 #line 1033 "scanner.l"
3000 YY_FATAL_ERROR( "flex scanner jammed" );
3001  YY_BREAK
3002 #line 3002 "scanner.c"
3003 
3004  case YY_END_OF_BUFFER:
3005  {
3006  /* Amount of text matched not including the EOB char. */
3007  int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
3008 
3009  /* Undo the effects of YY_DO_BEFORE_ACTION. */
3010  *yy_cp = (yy_hold_char);
3012 
3013  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
3014  {
3015  /* We're scanning a new file or input source. It's
3016  * possible that this happened because the user
3017  * just pointed yyin at a new source and called
3018  * yylex(). If so, then we have to assure
3019  * consistency between YY_CURRENT_BUFFER and our
3020  * globals. Here is the right place to do so, because
3021  * this is the first action (other than possibly a
3022  * back-up) that will match for the new input source.
3023  */
3024  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
3025  YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
3026  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
3027  }
3028 
3029  /* Note that here we test for yy_c_buf_p "<=" to the position
3030  * of the first EOB in the buffer, since yy_c_buf_p will
3031  * already have been incremented past the NUL character
3032  * (since all states make transitions on EOB to the
3033  * end-of-buffer state). Contrast this with the test
3034  * in input().
3035  */
3036  if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
3037  { /* This was really a NUL. */
3038  yy_state_type yy_next_state;
3039 
3040  (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
3041 
3042  yy_current_state = yy_get_previous_state( );
3043 
3044  /* Okay, we're now positioned to make the NUL
3045  * transition. We couldn't have
3046  * yy_get_previous_state() go ahead and do it
3047  * for us because it doesn't know how to deal
3048  * with the possibility of jamming (and we don't
3049  * want to build jamming into it because then it
3050  * will run more slowly).
3051  */
3052 
3053  yy_next_state = yy_try_NUL_trans( yy_current_state );
3054 
3055  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
3056 
3057  if ( yy_next_state )
3058  {
3059  /* Consume the NUL. */
3060  yy_cp = ++(yy_c_buf_p);
3061  yy_current_state = yy_next_state;
3062  goto yy_match;
3063  }
3064 
3065  else
3066  {
3067  yy_cp = (yy_last_accepting_cpos);
3068  yy_current_state = (yy_last_accepting_state);
3069  goto yy_find_action;
3070  }
3071  }
3072 
3073  else switch ( yy_get_next_buffer( ) )
3074  {
3075  case EOB_ACT_END_OF_FILE:
3076  {
3078 
3079  if ( yywrap( ) )
3080  {
3081  /* Note: because we've taken care in
3082  * yy_get_next_buffer() to have set up
3083  * yytext, we can now set up
3084  * yy_c_buf_p so that if some total
3085  * hoser (like flex itself) wants to
3086  * call the scanner after we return the
3087  * YY_NULL, it'll still work - another
3088  * YY_NULL will get returned.
3089  */
3091 
3092  yy_act = YY_STATE_EOF(YY_START);
3093  goto do_action;
3094  }
3095 
3096  else
3097  {
3098  if ( ! (yy_did_buffer_switch_on_eof) )
3099  YY_NEW_FILE;
3100  }
3101  break;
3102  }
3103 
3104  case EOB_ACT_CONTINUE_SCAN:
3105  (yy_c_buf_p) =
3106  (yytext_ptr) + yy_amount_of_matched_text;
3107 
3108  yy_current_state = yy_get_previous_state( );
3109 
3110  yy_cp = (yy_c_buf_p);
3111  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
3112  goto yy_match;
3113 
3114  case EOB_ACT_LAST_MATCH:
3115  (yy_c_buf_p) =
3116  &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
3117 
3118  yy_current_state = yy_get_previous_state( );
3119 
3120  yy_cp = (yy_c_buf_p);
3121  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
3122  goto yy_find_action;
3123  }
3124  break;
3125  }
3126 
3127  default:
3129  "fatal flex scanner internal error--no action found" );
3130  } /* end of action switch */
3131  } /* end of scanning one token */
3132  } /* end of user's declarations */
3133 } /* end of yylex */
static flex_int16_t yy_accept[833]
Definition: scanner.c:383
const char * name
Definition: tree.h:645
struct cb_text_list * next
Definition: cobc.h:160
static void scan_define_options(const char *)
Definition: scanner.c:4634
static char yy_hold_char
Definition: scanner.c:284
YY_BUFFER_STATE yy_create_buffer(FILE *file, int size)
Allocate and initialize an input buffer state.
Definition: scanner.c:3512
static int scan_o(const char *)
Definition: scanner.c:4174
unsigned int cobc_force_literal
Definition: parser.c:181
cb_tree cb_build_comment(const char *str)
Definition: tree.c:1540
const char * cb_source_file
Definition: cobc.c:145
static void read_literal(const char)
Definition: scanner.c:3873
struct cb_text_list * cb_intrinsic_list
Definition: cobc.c:150
#define EOB_ACT_LAST_MATCH
Definition: scanner.c:177
static struct cb_level_78 * globlev78ptr
Definition: scanner.c:1439
const char * text
Definition: cobc.h:162
#define EOB_ACT_END_OF_FILE
Definition: scanner.c:176
#define YY_END_OF_BUFFER
Definition: scanner.c:375
#define CB_LITERAL(x)
Definition: tree.h:601
#define YY_CURRENT_BUFFER_LVALUE
Definition: scanner.c:281
static yy_size_t yy_n_chars
Definition: scanner.c:285
#define yytext_ptr
Definition: scanner.c:357
#define YY_BREAK
Definition: scanner.c:1694
const int token
Definition: tree.h:982
int warningopt
Definition: cobc.c:176
unsigned char YY_CHAR
Definition: pplex.c:365
static int yy_did_buffer_switch_on_eof
Definition: scanner.c:296
void cobc_free(void *mptr)
Definition: cobc.c:657
#define YY_FATAL_ERROR(msg)
Definition: scanner.c:1669
struct cb_level_78 * globnext
Definition: scanner.c:1419
struct cb_intrinsic_table * lookup_intrinsic(const char *name, const int checkres, const int checkimpl)
Definition: reserved.c:2976
static flex_int16_t yy_def[865]
Definition: scanner.c:622
static flex_int16_t yy_nxt[2719]
Definition: scanner.c:721
#define YY_BUFFER_NORMAL
Definition: scanner.c:247
#define YY_RULE_SETUP
Definition: scanner.c:1697
static void scan_options(const char *, const unsigned int)
Definition: scanner.c:4627
void * cobc_parse_strdup(const char *dupstr)
Definition: cobc.c:827
#define unput(c)
Definition: scanner.c:196
#define CB_WORD_ITEMS(x)
Definition: tree.h:906
static flex_int16_t yy_chk[2719]
Definition: scanner.c:1024
static char * yy_c_buf_p
Definition: scanner.c:289
#define CB_CS_EXIT
Definition: cobc.h:112
#define YY_STATE_EOF(state)
Definition: scanner.c:137
static yy_state_type yy_last_accepting_state
Definition: scanner.c:1327
static char * yy_last_accepting_cpos
Definition: scanner.c:1328
struct cb_field * fld78
Definition: scanner.c:1421
static void count_lines(const char *)
Definition: scanner.c:4570
static unsigned int inside_bracket
Definition: scanner.c:1448
#define CB_VALUE(x)
Definition: tree.h:1193
Definition: parser.c:1815
struct cb_level_78 * next
Definition: scanner.c:1418
Definition: parser.c:1471
static int scan_numeric(const char *)
Definition: scanner.c:4244
#define COB_MAX_WORDLEN
Definition: common.h:574
#define PICTURE_STATE
Definition: scanner.c:1546
static struct cb_level_78 * lev78ptr
Definition: scanner.c:1438
cb_tree cb_build_alphanumeric_literal(const void *data, const size_t size)
Definition: tree.c:1716
static int scan_floating_numeric(const char *)
Definition: scanner.c:4309
#define YY_MORE_ADJ
Definition: scanner.c:1338
#define YY_USER_INIT
Definition: scanner.c:1382
#define YY_SC_TO_UI(c)
Definition: scanner.c:121
#define YY_BUF_SIZE
Definition: scanner.c:1366
static void scan_picture(const char *)
Definition: scanner.c:4517
#define EOB_ACT_CONTINUE_SCAN
Definition: scanner.c:175
static flex_int32_t yy_ec[256]
Definition: scanner.c:479
cb_tree cb_build_numeric_literal(const int sign, const void *data, const int scale)
Definition: tree.c:1681
static int yy_init
Definition: scanner.c:290
#define YY_START
Definition: scanner.c:133
#define YY_CURRENT_BUFFER
Definition: scanner.c:274
static int scan_x(const char *)
Definition: scanner.c:3930
cb_tree function_spec_list
Definition: tree.h:1271
unsigned int cobc_in_repository
Definition: parser.c:180
FILE * yyin
Definition: scanner.c:348
#define _(s)
Definition: cobcrun.c:59
struct cb_program * prog
Definition: scanner.c:1422
static int scan_b(const char *, const cob_u32_t)
Definition: scanner.c:4112
#define unlikely(x)
Definition: common.h:437
#define BEGIN
Definition: scanner.c:127
#define CB_CHAIN(x)
Definition: tree.h:1194
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
#define INITIAL
Definition: scanner.c:1543
Definition: parser.c:1590
#define DECIMAL_IS_COMMA
Definition: scanner.c:1545
struct cobc_reserved * lookup_reserved_word(const char *name)
Definition: reserved.c:2910
int yy_state_type
Definition: pplex.c:369
unsigned char prog_type
Definition: tree.h:1303
static int input(void)
Definition: scanner.c:3373
#define CB_FUNC_PROTOTYPE(x)
Definition: tree.h:1339
#define YY_NEW_FILE
Definition: scanner.c:140
Definition: parser.c:1473
static int scan_h(const char *, const cob_u32_t)
Definition: scanner.c:4048
static void yyensure_buffer_stack(void)
Definition: scanner.c:3665
int non_const_word
Definition: parser.c:178
cb_tree cb_build_reference(const char *name)
Definition: tree.c:2572
#define yyterminate()
Definition: scanner.c:1659
unsigned short nodegen
Definition: tree.h:419
cb_tree cb_error_node
Definition: tree.c:140
static yy_state_type yy_try_NUL_trans(yy_state_type current_state)
Definition: scanner.c:3309
Definition: parser.c:1503
static int scan_z(const char *, const cob_u32_t)
Definition: scanner.c:4013
void * cobc_strdup(const char *dupstr)
Definition: cobc.c:669
void cb_error(const char *,...) COB_A_FORMAT12
Definition: error.c:98
static struct cb_level_78 * const78ptr
Definition: scanner.c:1437
int functions_are_all
Definition: parser.c:177
#define YY_RESTORE_YY_MORE_OFFSET
Definition: scanner.c:1339
#define CB_FUNCTION_TYPE
Definition: tree.h:42
if fold fold static computed alternate extra correct stack on syntax debugging line
Definition: flag.def:90
struct cb_program * current_program
Definition: parser.c:168
unsigned int cobc_in_procedure
Definition: parser.c:179
static unsigned int integer_is_label
Definition: scanner.c:1447
#define FUNCTION_STATE
Definition: scanner.c:1547
yytokentype
Definition: parser.c:1343
#define CB_WORD_COUNT(x)
Definition: tree.h:905
void cb_warning(const char *,...) COB_A_FORMAT12
Definition: error.c:87
yy_size_t yyleng
Definition: scanner.c:286
#define yylval
Definition: ppparse.c:69
static int yy_get_next_buffer(void)
Definition: scanner.c:3142
int token
Definition: tree.h:421
static struct cb_level_78 * top78ptr
Definition: scanner.c:1436
int cb_source_line
Definition: cobc.c:178
cob_u32_t not_const
Definition: scanner.c:1426
static int yywrap(void)
Definition: scanner.c:1369
struct cb_program * cb_find_defined_program_by_name(const char *name)
Definition: scanner.c:4882
static unsigned int last_token_is_dot
Definition: scanner.c:1446
cob_u32_t chk_const
Definition: scanner.c:1427
FILE * yyout
Definition: scanner.c:348
#define CB_SYSTEM_NAME_P(x)
Definition: tree.h:587
#define YY_AT_BOL()
Definition: scanner.c:342
Definition: parser.c:1501
unsigned int cobc_cs_check
Definition: parser.c:182
cb_tree user_spec_list
Definition: tree.h:1272
cb_tree values
Definition: tree.h:648
static flex_int16_t yy_base[865]
Definition: scanner.c:523
char * yytext
Definition: scanner.c:1340
#define DECIMAL_IS_PERIOD
Definition: scanner.c:1544
static int yy_start
Definition: scanner.c:291
Definition: parser.c:1853
static void yy_load_buffer_state(void)
Definition: scanner.c:3498
#define likely(x)
Definition: common.h:436
static flex_int32_t yy_meta[75]
Definition: scanner.c:511
static yy_state_type yy_get_previous_state(void)
Definition: scanner.c:3276
unsigned char decimal_point
Definition: tree.h:1300
#define YY_BUFFER_NEW
Definition: scanner.c:246
char * orig_program_id
Definition: tree.h:1246
#define YY_DO_BEFORE_ACTION
Definition: scanner.c:367

Here is the call graph for this function:

int yylex_destroy ( void  )

Definition at line 3770 of file scanner.c.

References NULL, yy_buffer_stack, YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, yy_delete_buffer(), yy_init_globals(), yyfree(), and yypop_buffer_state().

Referenced by ylex_call_destroy().

3771 {
3772 
3773  /* Pop the buffer stack, destroying each element. */
3774  while(YY_CURRENT_BUFFER){
3778  }
3779 
3780  /* Destroy the stack itself. */
3781  yyfree((yy_buffer_stack) );
3782  (yy_buffer_stack) = NULL;
3783 
3784  /* Reset the globals. This is important in a non-reentrant scanner so the next time
3785  * yylex() is called, initialization will occur. */
3786  yy_init_globals( );
3787 
3788  return 0;
3789 }
void yypop_buffer_state(void)
Removes and deletes the top of the stack, if present.
Definition: scanner.c:3646
static YY_BUFFER_STATE * yy_buffer_stack
Stack as an array.
Definition: scanner.c:266
#define YY_CURRENT_BUFFER_LVALUE
Definition: scanner.c:281
void yy_delete_buffer(YY_BUFFER_STATE b)
Destroy the buffer.
Definition: scanner.c:3540
void yyfree(void *)
Definition: scanner.c:3832
#define YY_CURRENT_BUFFER
Definition: scanner.c:274
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 int yy_init_globals(void)
Get the current token.
Definition: scanner.c:3741

Here is the call graph for this function:

Here is the caller graph for this function:

void yypop_buffer_state ( void  )

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

The next element becomes the new top.

Definition at line 3646 of file scanner.c.

References NULL, yy_buffer_stack_top, YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, yy_delete_buffer(), yy_did_buffer_switch_on_eof, and yy_load_buffer_state().

Referenced by yylex_destroy().

3647 {
3648  if (!YY_CURRENT_BUFFER)
3649  return;
3650 
3653  if ((yy_buffer_stack_top) > 0)
3654  --(yy_buffer_stack_top);
3655 
3656  if (YY_CURRENT_BUFFER) {
3659  }
3660 }
#define YY_CURRENT_BUFFER_LVALUE
Definition: scanner.c:281
void yy_delete_buffer(YY_BUFFER_STATE b)
Destroy the buffer.
Definition: scanner.c:3540
static int yy_did_buffer_switch_on_eof
Definition: scanner.c:296
static size_t yy_buffer_stack_top
index of top of stack.
Definition: scanner.c:264
#define YY_CURRENT_BUFFER
Definition: scanner.c:274
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 yy_load_buffer_state(void)
Definition: scanner.c:3498

Here is the call graph for this function:

Here is the caller graph for this function:

void yypush_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 3616 of file scanner.c.

References NULL, yy_buffer_stack_top, yy_c_buf_p, YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, yy_did_buffer_switch_on_eof, yy_hold_char, yy_load_buffer_state(), yy_n_chars, and yyensure_buffer_stack().

3617 {
3618  if (new_buffer == NULL)
3619  return;
3620 
3622 
3623  /* This block is copied from yy_switch_to_buffer. */
3624  if ( YY_CURRENT_BUFFER )
3625  {
3626  /* Flush out information for old buffer. */
3627  *(yy_c_buf_p) = (yy_hold_char);
3628  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
3629  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
3630  }
3631 
3632  /* Only push if top exists. Otherwise, replace top. */
3633  if (YY_CURRENT_BUFFER)
3634  (yy_buffer_stack_top)++;
3635  YY_CURRENT_BUFFER_LVALUE = new_buffer;
3636 
3637  /* copied from yy_switch_to_buffer. */
3640 }
static char yy_hold_char
Definition: scanner.c:284
#define YY_CURRENT_BUFFER_LVALUE
Definition: scanner.c:281
static yy_size_t yy_n_chars
Definition: scanner.c:285
static int yy_did_buffer_switch_on_eof
Definition: scanner.c:296
static char * yy_c_buf_p
Definition: scanner.c:289
static size_t yy_buffer_stack_top
index of top of stack.
Definition: scanner.c:264
#define YY_CURRENT_BUFFER
Definition: scanner.c:274
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 yyensure_buffer_stack(void)
Definition: scanner.c:3665
static void yy_load_buffer_state(void)
Definition: scanner.c:3498

Here is the call graph for this function:

void * yyrealloc ( void *  ptr,
yy_size_t  size 
)

Definition at line 3820 of file scanner.c.

Referenced by yy_get_next_buffer(), and yyensure_buffer_stack().

3821 {
3822  /* The cast to (char *) in the following accommodates both
3823  * implementations that use char* generic pointers, and those
3824  * that use void* generic pointers. It works with the latter
3825  * because both ANSI C and C++ allow castless assignment from
3826  * any pointer type to void*, and deal with argument conversions
3827  * as though doing an assignment.
3828  */
3829  return (void *) realloc( (char *) ptr, size );
3830 }

Here is the caller graph for this function:

void yyrestart ( 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 3450 of file scanner.c.

References YY_BUF_SIZE, yy_create_buffer(), YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, yy_init_buffer(), yy_load_buffer_state(), yyensure_buffer_stack(), and yyin.

Referenced by input(), and yy_get_next_buffer().

3451 {
3452 
3453  if ( ! YY_CURRENT_BUFFER ){
3457  }
3458 
3459  yy_init_buffer(YY_CURRENT_BUFFER,input_file );
3461 }
YY_BUFFER_STATE yy_create_buffer(FILE *file, int size)
Allocate and initialize an input buffer state.
Definition: scanner.c:3512
#define YY_CURRENT_BUFFER_LVALUE
Definition: scanner.c:281
#define YY_BUF_SIZE
Definition: scanner.c:1366
#define YY_CURRENT_BUFFER
Definition: scanner.c:274
static void yy_init_buffer(YY_BUFFER_STATE b, FILE *file)
Definition: scanner.c:3559
FILE * yyin
Definition: scanner.c:348
static void yyensure_buffer_stack(void)
Definition: scanner.c:3665
static void yy_load_buffer_state(void)
Definition: scanner.c:3498

Here is the call graph for this function:

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 3332 of file scanner.c.

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

3333 {
3334  register char *yy_cp;
3335 
3336  yy_cp = (yy_c_buf_p);
3337 
3338  /* undo effects of setting up yytext */
3339  *yy_cp = (yy_hold_char);
3340 
3341  if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
3342  { /* need to shift things up to make room */
3343  /* +2 for EOB chars. */
3344  register yy_size_t number_to_move = (yy_n_chars) + 2;
3345  register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
3346  YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
3347  register char *source =
3348  &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
3349 
3350  while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
3351  *--dest = *--source;
3352 
3353  yy_cp += (int) (dest - source);
3354  yy_bp += (int) (dest - source);
3355  YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
3356  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
3357 
3358  if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
3359  YY_FATAL_ERROR( "flex scanner push-back overflow" );
3360  }
3361 
3362  *--yy_cp = (char) c;
3363 
3364  (yytext_ptr) = yy_bp;
3365  (yy_hold_char) = *yy_cp;
3366  (yy_c_buf_p) = yy_cp;
3367 }
static char yy_hold_char
Definition: scanner.c:284
#define YY_CURRENT_BUFFER_LVALUE
Definition: scanner.c:281
static yy_size_t yy_n_chars
Definition: scanner.c:285
#define yytext_ptr
Definition: scanner.c:357
#define YY_FATAL_ERROR(msg)
Definition: scanner.c:1669
static char * yy_c_buf_p
Definition: scanner.c:289
size_t yy_size_t
Definition: pplex.c:187
static int yywrap ( void  )
static

Definition at line 1369 of file scanner.c.

Referenced by input(), and yylex().

1369  {
1370  return 1;
1371 }

Here is the caller graph for this function:

Variable Documentation

struct cb_level_78* const78ptr = ((void*)0)
static

Definition at line 1437 of file scanner.c.

Referenced by cb_add_78(), cb_add_const_var(), cb_reset_78(), and cb_reset_global_78().

char err_msg[COB_MINI_BUFF]
static

Definition at line 1450 of file scanner.c.

struct cb_level_78* globlev78ptr = ((void*)0)
static

Definition at line 1439 of file scanner.c.

Referenced by cb_add_78(), and cb_reset_78().

unsigned int inside_bracket = 0
static

Definition at line 1448 of file scanner.c.

unsigned int integer_is_label = 0
static

Definition at line 1447 of file scanner.c.

unsigned int last_token_is_dot = 0
static

Definition at line 1446 of file scanner.c.

struct cb_level_78* lev78ptr = ((void*)0)
static

Definition at line 1438 of file scanner.c.

Referenced by cb_add_78().

unsigned int literal_error
static

Definition at line 1449 of file scanner.c.

size_t pic1size
static

Definition at line 1444 of file scanner.c.

size_t pic2size
static

Definition at line 1445 of file scanner.c.

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

Definition at line 1441 of file scanner.c.

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

Definition at line 1442 of file scanner.c.

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

Definition at line 1440 of file scanner.c.

Referenced by scan_x().

size_t plexsize
static

Definition at line 1443 of file scanner.c.

const unsigned char pvalid_char[]
static
Initial value:
=
"-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz"

Definition at line 1521 of file scanner.c.

struct cb_level_78* top78ptr = ((void*)0)
static

Definition at line 1436 of file scanner.c.

unsigned char valid_char[256]
static

Definition at line 1520 of file scanner.c.

flex_int16_t yy_accept[833]
static

Definition at line 383 of file scanner.c.

flex_int16_t yy_base[865]
static

Definition at line 523 of file scanner.c.

YY_BUFFER_STATE* yy_buffer_stack = 0
static

Stack as an array.

Definition at line 266 of file scanner.c.

Referenced by yy_init_globals(), yyensure_buffer_stack(), and yylex_destroy().

size_t yy_buffer_stack_max = 0
static

capacity of stack.

Definition at line 265 of file scanner.c.

Referenced by yy_init_globals(), and yyensure_buffer_stack().

size_t yy_buffer_stack_top = 0
static

index of top of stack.

Definition at line 264 of file scanner.c.

Referenced by yy_init_globals(), yyensure_buffer_stack(), yypop_buffer_state(), and yypush_buffer_state().

flex_int16_t yy_chk[2719]
static

Definition at line 1024 of file scanner.c.

flex_int16_t yy_def[865]
static

Definition at line 622 of file scanner.c.

int yy_did_buffer_switch_on_eof
static

Definition at line 296 of file scanner.c.

Referenced by input(), yy_switch_to_buffer(), yylex(), yypop_buffer_state(), and yypush_buffer_state().

flex_int32_t yy_ec[256]
static

Definition at line 479 of file scanner.c.

int yy_flex_debug = 0

Definition at line 1331 of file scanner.c.

char yy_hold_char
static
int yy_init = 0
static

Definition at line 290 of file scanner.c.

Referenced by yy_init_globals(), and yylex().

char* yy_last_accepting_cpos
static

Definition at line 1328 of file scanner.c.

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

yy_state_type yy_last_accepting_state
static

Definition at line 1327 of file scanner.c.

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

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

Definition at line 511 of file scanner.c.

flex_int16_t yy_nxt[2719]
static

Definition at line 721 of file scanner.c.

int yy_start = 0
static

Definition at line 291 of file scanner.c.

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

FILE* yyin = (FILE *) 0
yy_size_t yyleng

Definition at line 286 of file scanner.c.

Referenced by yylex().

int yylineno = 1

Definition at line 354 of file scanner.c.

FILE * yyout = (FILE *) 0

Definition at line 348 of file scanner.c.

Referenced by yy_init_globals(), and yylex().

char* yytext

Definition at line 1340 of file scanner.c.