GnuCOBOL  2.0
A free COBOL compiler
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
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:

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   35
 
#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 EOB_ACT_CONTINUE_SCAN   0
 
#define EOB_ACT_END_OF_FILE   1
 
#define EOB_ACT_LAST_MATCH   2
 
#define YY_LESS_LINENO(n)
 
#define yyless(n)
 
#define unput(c)   yyunput( c, (yytext_ptr) )
 
#define YY_TYPEDEF_YY_SIZE_T
 
#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 yywrap()   1
 
#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 SET_LOCATION(x)
 
#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"
 

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 (yyconst char *yy_str)
 
YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes, int 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 (yyconst char msg[])
 
static void read_literal (const int)
 
static int scan_x (char *, const int)
 
static int scan_z (char *, const int, const cob_u32_t)
 
static int scan_h (char *, const int)
 
static int scan_numeric (char *)
 
static int scan_floating_numeric (const char *)
 
static void scan_picture (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)
 
 if (likely(current_program))
 
 if (last_token_is_dot)
 
 if (!(yy_init))
 
 while (1)
 
static void yyunput (int c, register char *yy_bp)
 
static void yy_fatal_error (yyconst char *msg)
 
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)
 
void cobc_init_scanner (void)
 

Variables

int 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 int 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 yyconst flex_int16_t yy_accept [841]
 
static yyconst flex_int32_t yy_ec [256]
 
static yyconst flex_int32_t yy_meta [84]
 
static yyconst flex_int16_t yy_base [869]
 
static yyconst flex_int16_t yy_def [869]
 
static yyconst flex_int16_t yy_nxt [3140]
 
static yyconst flex_int16_t yy_chk [3140]
 
static yy_state_type yy_last_accepting_state
 
static char * yy_last_accepting_cpos
 
int yy_flex_debug = 0
 
static struct cb_level_78top78ptr = NULL
 
static struct cb_level_78const78ptr = NULL
 
static struct cb_level_78lev78ptr = NULL
 
static struct cb_level_78globlev78ptr = NULL
 
static unsigned char * plexbuff = NULL
 
static char * picbuff1 = NULL
 
static char * picbuff2 = NULL
 
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 char valid_char [256]
 
static const unsigned char pvalid_char []
 
 YY_DECL
 The main scanner function which does all the work. More...
 
register char * yy_cp
 
register char * yy_bp
 
register int yy_act
 
 else
 

Macro Definition Documentation

#define BEGIN   (yy_start) = 1 + 2 *

Referenced by if(), and while().

#define COB_IN_SCANNER   1
#define DECIMAL_IS_COMMA   2

Referenced by if(), and while().

#define DECIMAL_IS_PERIOD   1

Referenced by if(), and while().

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

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

#define EOB_ACT_END_OF_FILE   1

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

#define EOB_ACT_LAST_MATCH   2

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

#define FLEX_BETA
#define FLEX_SCANNER
#define FLEXINT_H
#define FUNCTION_STATE   4

Referenced by while().

#define INITIAL   0

Referenced by while().

#define INT16_MAX   (32767)
#define INT16_MIN   (-32767-1)
#define INT32_MAX   (2147483647)
#define INT32_MIN   (-2147483647-1)
#define INT8_MAX   (127)
#define INT8_MIN   (-128)
#define PICTURE_STATE   3

Referenced by while().

#define REJECT   reject_used_but_not_detected
#define SET_LOCATION (   x)
Value:
do { \
(x)->source_file = cb_source_file; \
(x)->source_line = cb_source_line; \
} while (0)

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

#define UINT16_MAX   (65535U)
#define UINT32_MAX   (4294967295U)
#define UINT8_MAX   (255U)
#define unput (   c)    yyunput( c, (yytext_ptr) )
#define YY_AT_BOL ( )    (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)

Referenced by while(), and yy_get_previous_state().

#define YY_BREAK   break;

Referenced by while().

#define YY_BUF_SIZE   16384
#define YY_BUF_SIZE   32768
#define YY_BUFFER_EOF_PENDING   2

Referenced by yy_get_next_buffer().

#define YY_BUFFER_NEW   0

Referenced by while(), and yy_flush_buffer().

#define YY_BUFFER_NORMAL   1

Referenced by while().

#define YY_DECL   int yylex (void)
#define YY_DECL_IS_OURS   1
#define YY_DO_BEFORE_ACTION
Value:
yyleng = (size_t) (yy_cp - yy_bp); \
*yy_cp = '\0'; \

Referenced by while().

#define YY_END_OF_BUFFER   130

Referenced by while().

#define YY_END_OF_BUFFER_CHAR   0
#define YY_EXIT_FAILURE   2

Referenced by yy_fatal_error().

#define YY_EXTRA_TYPE   void *
#define YY_FATAL_ERROR (   msg)    yy_fatal_error( msg )
#define YY_FLEX_MAJOR_VERSION   2
#define YY_FLEX_MINOR_VERSION   5
#define YY_FLEX_SUBMINOR_VERSION   35
#define YY_FLUSH_BUFFER   yy_flush_buffer(YY_CURRENT_BUFFER )
#define YY_INPUT (   buf,
  result,
  max_size 
)
Value:
{ \
if (fgets (buf, (int)max_size, yyin) == NULL) { \
result = YY_NULL; \
} else { \
result = strlen (buf); \
} \
}

Referenced by yy_get_next_buffer().

#define YY_INT_ALIGNED   short int
#define YY_LESS_LINENO (   n)
#define YY_MORE_ADJ   0
#define yy_new_buffer   yy_create_buffer
#define YY_NEW_FILE   yyrestart(yyin )

Referenced by input(), and while().

#define YY_NO_UNISTD_H   1
#define YY_NULL   0
#define YY_NUM_RULES   129
#define YY_READ_BUF_SIZE   32768

Referenced by yy_get_next_buffer().

#define YY_RESTORE_YY_MORE_OFFSET

Referenced by while().

#define YY_RULE_SETUP
Value:
if ( yyleng > 0 ) \
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
(yytext[yyleng - 1] == '\n'); \
YY_USER_ACTION

Referenced by while().

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

Referenced by while(), and yy_get_previous_state().

#define yy_set_bol (   at_bol)
Value:
{ \
if ( ! YY_CURRENT_BUFFER ){\
yyensure_buffer_stack (); \
YY_CURRENT_BUFFER_LVALUE = \
yy_create_buffer(yyin,YY_BUF_SIZE ); \
} \
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
}
#define yy_set_interactive (   is_interactive)
Value:
{ \
if ( ! YY_CURRENT_BUFFER ){ \
yyensure_buffer_stack (); \
YY_CURRENT_BUFFER_LVALUE = \
yy_create_buffer(yyin,YY_BUF_SIZE ); \
} \
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
}
#define YY_SKIP_YYWRAP
#define YY_START   (((yy_start) - 1) / 2)

Referenced by while().

#define YY_START_STACK_INCR   25
#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
#define YY_STATE_EOF (   state)    (YY_END_OF_BUFFER + state + 1)

Referenced by while().

#define YY_STRUCT_YY_BUFFER_STATE
#define YY_TYPEDEF_YY_BUFFER_STATE
#define YY_TYPEDEF_YY_SIZE_T
#define YY_USER_ACTION
#define YY_USER_INIT
Value:
if (!plexbuff) { \
plexbuff = cobc_malloc ((size_t)COB_MINI_BUFF); \
plexsize = COB_MINI_BUFF; \
} \
if (!picbuff1) { \
picbuff1 = cobc_malloc ((size_t)COB_MINI_BUFF); \
pic1size = COB_MINI_BUFF; \
} \
if (!picbuff2) { \
picbuff2 = cobc_malloc ((size_t)COB_MINI_BUFF); \
pic2size = COB_MINI_BUFF; \
}

Referenced by if().

#define yyconst
#define yyless (   n)
Value:
do \
{ \
/* Undo effects of setting up yytext. */ \
int yyless_macro_arg = (n); \
YY_LESS_LINENO(yyless_macro_arg);\
YY_RESTORE_YY_MORE_OFFSET \
(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
YY_DO_BEFORE_ACTION; /* set up yytext again */ \
} \
while ( 0 )
#define yyless (   n)
Value:
do \
{ \
/* Undo effects of setting up yytext. */ \
int yyless_macro_arg = (n); \
YY_LESS_LINENO(yyless_macro_arg);\
yytext[yyleng] = (yy_hold_char); \
(yy_c_buf_p) = yytext + yyless_macro_arg; \
*(yy_c_buf_p) = '\0'; \
yyleng = yyless_macro_arg; \
} \
while ( 0 )
#define yymore ( )    yymore_used_but_not_detected
#define YYSTATE   YY_START
#define YYTABLES_NAME   "yytables"
#define yyterminate ( )    return YY_NULL

Referenced by while().

#define yywrap ( )    1

Referenced by input(), and while().

Typedef Documentation

typedef short int flex_int16_t
typedef int flex_int32_t
typedef signed char flex_int8_t
typedef unsigned short int flex_uint16_t
typedef unsigned int flex_uint32_t
typedef unsigned char flex_uint8_t
typedef unsigned char YY_CHAR
typedef size_t yy_size_t
typedef int yy_state_type

Function Documentation

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

References p.

Referenced by scan_picture().

4244 {
4245  const unsigned char *p;
4246 
4247  /* Check if we can do a replacement */
4248  if (strncasecmp (src1, src2, size)) {
4249  return 0;
4250  }
4251  p = (const unsigned char *)src1 + size;
4252  if (valid_char[*p]) {
4253  return 0;
4254  }
4255  if (iteration) {
4256  p = (const unsigned char *)src1 - 1;
4257  if (valid_char[*p]) {
4258  return 0;
4259  }
4260  }
4261  return 1;
4262 }
void cb_add_78 ( struct cb_field f)
4590 {
4591  struct cb_level_78 *p78;
4592 
4593  /* Add a constant (78 level) item */
4594  p78 = cobc_malloc (sizeof(struct cb_level_78));
4595  p78->fld78 = f;
4596  p78->prog = current_program;
4598  if (p78->pic_replace) {
4599  p78->pic_len = (cob_u32_t)strlen (p78->pic_replace);
4600  }
4601  p78->name_len = (cob_u32_t)strlen (f->name);
4602  if (f->flag_is_global) {
4603  if (!globlev78ptr) {
4604  p78->last = p78;
4605  } else {
4606  p78->last = globlev78ptr->last;
4607  }
4608  p78->last->globnext = const78ptr;
4609  p78->next = globlev78ptr;
4610  p78->globnext = globlev78ptr;
4611  p78->chk_const = 1;
4612  globlev78ptr = p78;
4613  if (lev78ptr) {
4615  } else {
4617  }
4618  } else {
4619  if (!lev78ptr) {
4620  p78->last = p78;
4621  } else {
4622  p78->last = lev78ptr->last;
4623  }
4624  if (globlev78ptr) {
4625  p78->last->globnext = globlev78ptr;
4626  } else {
4627  p78->last->globnext = const78ptr;
4628  }
4629  p78->next = lev78ptr;
4630  p78->globnext = lev78ptr;
4631  lev78ptr = p78;
4632  top78ptr = lev78ptr;
4633  }
4634 }
static void cb_add_const_var ( const char *  name,
cb_tree  value 
)
static

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().

4363 {
4364  cb_tree x;
4365  struct cb_level_78 *p78;
4366  struct cb_field *f;
4367 
4368 
4369  /* Add an inline constant */
4370  x = cb_build_constant (cb_build_reference (name), value);
4371  f = CB_FIELD (x);
4372  f->flag_item_78 = 1;
4373  f->flag_is_global = 1;
4374  f->level = 1;
4375  (void)cb_validate_78_item (f, 1);
4376 
4377  /* Add constant item */
4378  p78 = cobc_malloc (sizeof(struct cb_level_78));
4379  p78->fld78 = f;
4380  p78->prog = NULL;
4382  if (p78->pic_replace) {
4383  p78->pic_len = (cob_u32_t)strlen (p78->pic_replace);
4384  }
4385  p78->name_len = (cob_u32_t)strlen (f->name);
4386  /* RXWRXW - Check this */
4387  p78->chk_const = 0;
4388  if (!const78ptr) {
4389  p78->last = p78;
4390  } else {
4391  p78->last = const78ptr->last;
4392  }
4393  p78->next = const78ptr;
4394  p78->globnext = const78ptr;
4395  const78ptr = p78;
4396  if (globlev78ptr) {
4398  } else if (lev78ptr) {
4400  } else {
4401  top78ptr = const78ptr;
4402  }
4403 }
void cb_reset_78 ( void  )
4551 {
4552  struct cb_level_78 *p78;
4553  struct cb_level_78 *p782;
4554 
4555  /* Remove constant (78 level) items for current program */
4556  for (p78 = lev78ptr; p78; ) {
4557  p782 = p78->next;
4558  cobc_free (p78);
4559  p78 = p782;
4560  }
4561  lev78ptr = NULL;
4562  for (p78 = globlev78ptr; p78; p78 = p78->next) {
4563  p78->not_const = 0;
4564  }
4565  if (globlev78ptr) {
4567  } else {
4568  top78ptr = const78ptr;
4569  }
4570 }
void cb_reset_global_78 ( void  )
4574 {
4575  struct cb_level_78 *p78;
4576  struct cb_level_78 *p782;
4577 
4578  /* Remove constant (78 level) items for top program */
4579  for (p78 = globlev78ptr; p78; ) {
4580  p782 = p78->next;
4581  cobc_free (p78);
4582  p78 = p782;
4583  }
4584  globlev78ptr = NULL;
4585  top78ptr = const78ptr;
4586 }
void cb_unput_dot ( void  )
4545 {
4546  unput ('.');
4547 }
static const char* check_78_replace ( const cb_tree  p)
static

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().

4266 {
4267  /* Check if we can do a constant replacement within PICTURE */
4268  if (CB_LITERAL_P (p)) {
4269  if (CB_LITERAL(p)->size > 50) {
4270  return NULL;
4271  }
4272  return (const char *)(CB_LITERAL(p)->data);
4273  }
4274  if (p == cb_low) {
4275  return "LOW-VALUE";
4276  }
4277  if (p == cb_high) {
4278  return "HIGH-VALUE";
4279  }
4280  if (p == cb_space) {
4281  return "SPACE";
4282  }
4283  if (p == cb_zero) {
4284  return "ZERO";
4285  }
4286  if (p == cb_quote) {
4287  return "QUOTE";
4288  }
4289  if (p == cb_null) {
4290  return "NULL";
4291  }
4292  return NULL;
4293 }
struct cb_field* check_level_78 ( const char *  name)
read
4638 {
4639  const struct cb_level_78 *p78;
4640 
4641  /* Check against a current constant (78 level) */
4642  for (p78 = lev78ptr; p78; p78 = p78->next) {
4643  if (strcasecmp (name, p78->fld78->name) == 0) {
4644  return p78->fld78;
4645  }
4646  }
4647  /* Check against a global constant (78 level) */
4648  for (p78 = globlev78ptr; p78; p78 = p78->next) {
4649  if (strcasecmp (name, p78->fld78->name) == 0) {
4650  return p78->fld78;
4651  }
4652  }
4653  return NULL;
4654 }
void cobc_init_scanner ( void  )

References p.

Referenced by main().

4659 {
4660  const unsigned char *p;
4661 
4662  memset (valid_char, 0, sizeof(valid_char));
4663  for (p = pvalid_char; *p; ++p) {
4664  valid_char[*p] = 1;
4665  }
4666 }
static void count_lines ( const char *  text)
static

References cb_source_line, and p.

Referenced by while().

4350 {
4351  const char *p;
4352 
4353  /* Count newlines in text */
4354  for (p = text; *p; p++) {
4355  if (*p == '\n') {
4356  cb_source_line++;
4357  }
4358  }
4359 }

References BEGIN, current_program, DECIMAL_IS_COMMA, DECIMAL_IS_PERIOD, cb_program::decimal_point, and likely.

1806  {
1807  if (current_program->decimal_point == '.') {
1809  } else {
1811  }
1812  }
1816  {
1817  integer_is_label = 1;
1818  last_token_is_dot = 0;
1819  } else {
if ( yy_init)

References YY_BUF_SIZE, yy_create_buffer(), YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, yy_init, yy_load_buffer_state(), yy_start, YY_USER_INIT, yyensure_buffer_stack(), yyin, and yyout.

1828  {
1829  (yy_init) = 1;
1830 
1831 #ifdef YY_USER_INIT
1832  YY_USER_INIT;
1833 #endif
1834 
1835  if ( ! (yy_start) )
1836  (yy_start) = 1; /* first start state */
1837 
1838  if ( ! yyin )
1839  yyin = stdin;
1840 
1841  if ( ! yyout )
1842  yyout = stdout;
1843 
1844  if ( ! YY_CURRENT_BUFFER ) {
1848  }
1849 
1851  }
static int input ( void  )
static

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 while().

3480 {
3481  int c;
3482 
3483  *(yy_c_buf_p) = (yy_hold_char);
3484 
3485  if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
3486  {
3487  /* yy_c_buf_p now points to the character we want to return.
3488  * If this occurs *before* the EOB characters, then it's a
3489  * valid NUL; if not, then we've hit the end of the buffer.
3490  */
3491  if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
3492  /* This was really a NUL. */
3493  *(yy_c_buf_p) = '\0';
3494 
3495  else
3496  { /* need more input */
3497  int offset = (yy_c_buf_p) - (yytext_ptr);
3498  ++(yy_c_buf_p);
3499 
3500  switch ( yy_get_next_buffer( ) )
3501  {
3502  case EOB_ACT_LAST_MATCH:
3503  /* This happens because yy_g_n_b()
3504  * sees that we've accumulated a
3505  * token and flags that we need to
3506  * try matching the token before
3507  * proceeding. But for input(),
3508  * there's no matching to consider.
3509  * So convert the EOB_ACT_LAST_MATCH
3510  * to EOB_ACT_END_OF_FILE.
3511  */
3512 
3513  /* Reset buffer status. */
3514  yyrestart(yyin );
3515 
3516  /*FALLTHROUGH*/
3517 
3518  case EOB_ACT_END_OF_FILE:
3519  {
3520  if ( yywrap( ) )
3521  return EOF;
3522 
3523  if ( ! (yy_did_buffer_switch_on_eof) )
3524  YY_NEW_FILE;
3525 #ifdef __cplusplus
3526  return yyinput();
3527 #else
3528  return input();
3529 #endif
3530  }
3531 
3532  case EOB_ACT_CONTINUE_SCAN:
3533  (yy_c_buf_p) = (yytext_ptr) + offset;
3534  break;
3535  }
3536  }
3537  }
3538 
3539  c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
3540  *(yy_c_buf_p) = '\0'; /* preserve yytext */
3541  (yy_hold_char) = *++(yy_c_buf_p);
3542 
3543  YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
3544 
3545  return c;
3546 }
static void read_literal ( const int  mark)
static

References _, cb_build_alphanumeric_literal(), cb_warning(), cob_u8_t, cobc_realloc(), input(), SET_LOCATION, unput, and yylval.

Referenced by while().

3949 {
3950  size_t i;
3951  int c;
3952 
3953  i = 0;
3954  while ((c = input ()) != EOF) {
3955  plexbuff[i++] = (cob_u8_t)c;
3956  if (c == mark && (c = input ()) != mark) {
3957  i--;
3958  if (c == '-') {
3959  /* Free format continuation */
3960  /* Hack it as concatenation */
3961  unput ('&');
3962  } else {
3963  unput (c);
3964  }
3965  break;
3966  }
3967  if (i >= plexsize) {
3968  plexsize *= 2;
3970  }
3971  }
3972  if (!i) {
3973  cb_warning (_("Alphanumeric literal has zero length"));
3974  cb_warning (_("A SPACE will be assumed"));
3975  i = 1;
3976  plexbuff[0] = ' ';
3977  }
3978  plexbuff[i] = 0;
3980  SET_LOCATION (yylval);
3981 }
static void scan_define_options ( const char *  text)
static

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, cb_level_78::globnext, cb_field::name, NULL, p, and sign.

Referenced by while().

4414 {
4415  char *p;
4416  char *s;
4417  char *var;
4418  const struct cb_level_78 *p78;
4419  char *q;
4420  unsigned char *t;
4421  cb_tree x;
4422  size_t size;
4423  int scale;
4424  int sign;
4425 
4426  /* Scan a source inline define */
4427  p = cobc_strdup (text);
4428 
4429  /* Ignore first part */
4430  s = strtok (p, " ");
4431 
4432  /* Variable name */
4433  s = strtok (NULL, " \n");
4434  if (!s) {
4435  cobc_free (p);
4436  return;
4437  }
4438 
4439  /* Check for already defined constant */
4440  for (p78 = top78ptr; p78; p78 = p78->globnext) {
4441  if (strcasecmp (s, p78->fld78->name) == 0) {
4442  cobc_free (p);
4443  return;
4444  }
4445  }
4446 
4447  var = cobc_strdup (s);
4448 
4449  /* Value */
4450  s = strtok (NULL, "\n");
4451  if (!s) {
4452  cb_error (_("Invalid CONSTANT - %s"), var);
4453  goto freevar;
4454  }
4455 
4456  if (*s == '"' || *s == '\'') {
4457  /* Alphanumeric literal */
4458  sign = *s;
4459  size = strlen (s);
4460  q = s + size - 1;
4461  if (q == s || *q != sign) {
4462  cb_error (_("Invalid alphanumeric CONSTANT - %s"), s);
4463  goto freevar;
4464  }
4465  if (size < 3) {
4466  cb_error (_("Empty alphanumeric CONSTANT - %s"), s);
4467  goto freevar;
4468  }
4469  *q = 0;
4470  size -= 2;
4471  x = cb_build_alphanumeric_literal (s + 1, size);
4472  } else {
4473  /* Get sign */
4474  sign = (*s == '+') ? 1 : (*s == '-') ? -1 : 0;
4475  if (sign) {
4476  s++;
4477  }
4478 
4479  /* Get decimal point */
4480  scale = 0;
4481  q = strchr (s, '.');
4482  if (q) {
4483  scale = (int)strlen (q) - 1;
4484  if (scale < 1) {
4485  cb_error (_("Invalid numeric CONSTANT - %s"), s);
4486  goto freevar;
4487  }
4488  /* Remove decimal point */
4489  memmove (q, q + 1, (size_t)(scale + 1));
4490  }
4491  for (t = (unsigned char *)s; *t; ++t) {
4492  if (*t < '0' || *t > '9') {
4493  cb_error (_("Invalid numeric CONSTANT - %s"), s);
4494  goto freevar;
4495  }
4496  }
4497  if (strlen (s) > COB_MAX_DIGITS) {
4498  cb_error (_("Invalid numeric CONSTANT - %s"), s);
4499  goto freevar;
4500  }
4501 
4502  x = cb_build_numeric_literal (sign, s, scale);
4503  }
4504  /* Add to constant list */
4505  cb_add_const_var (var, x);
4506 
4507 freevar:
4508  cobc_free (p);
4509  cobc_free (var);
4510 }
static int scan_floating_numeric ( const char *  text)
static

References _, cb_build_numeric_literal(), cb_error(), LITERAL, SET_LOCATION, sign, and yylval.

Referenced by while().

4142 {
4143  size_t size1;
4144  size_t size2;
4145  int sign;
4146  int scale;
4147  int exponent;
4148  int n;
4149  char significand_int[40];
4150  char significand_dec[40];
4151  char result[128];
4152  char decpoint[4];
4153  char junk[4];
4154 
4155  /* Get sign */
4156  sign = (*text == '+') ? 1 : (*text == '-') ? -1 : 0;
4157  if (sign) {
4158  text++;
4159  }
4160 
4161  exponent = 0;
4162  significand_dec[0] = '0';
4163  significand_dec[1] = 0;
4164 
4165  /* Separate components */
4166  n = sscanf (text, "%[^.,]%[,.]%[^Ee]%[Ee]%d", significand_int, decpoint,
4167  significand_dec, junk, &exponent);
4168  if (n != 5) {
4169  /* No decimals in significand */
4170  n = sscanf (text, "%[^.,]%[,.]%[Ee]%d", significand_int,
4171  decpoint, junk, &exponent);
4172  }
4173 
4174  /* Validation */
4175  size1 = strlen (significand_int);
4176  if (size1 > 17U) {
4177  size1 = 17;
4178  significand_int[17] = 0;
4179  cb_error (_("Invalid floating-point literal"));
4180  }
4181  size2 = strlen (significand_dec);
4182  if (size2 > 17U) {
4183  size2 = 17;
4184  significand_dec[17] = 0;
4185  cb_error (_("Invalid floating-point literal"));
4186  }
4187  if ((size1 + size2) > 18U) {
4188  cb_error (_("Invalid floating-point literal"));
4189  }
4190  if (exponent > 76) {
4191  exponent = 76;
4192  cb_error (_("Invalid floating-point literal"));
4193  }
4194  if (exponent < -78) {
4195  exponent = -78;
4196  cb_error (_("Invalid floating-point literal"));
4197  }
4198 
4199  /* Determine scale */
4200  /* Base scale is decimal part of the significand */
4201  scale = (int)size2;
4202  /* Adjust according to exponent */
4203  if (exponent < 0) {
4204  /* Decimals; power down by scale difference */
4205  exponent = -exponent;
4206  scale += exponent;
4207  result[0] = 0;
4208  if (exponent > (int)size1) {
4209  n = exponent - (int)size1;
4210  for (; n; --n) {
4211  strcat (result, "0");
4212  }
4213  }
4214  strcat (result, significand_int);
4215  strcat (result, significand_dec);
4216  } else if (exponent > 0) {
4217  /* No decimals; power up by scale difference */
4218  strcpy (result, significand_int);
4219  strcat (result, significand_dec);
4220  if (exponent >= scale) {
4221  n = exponent - scale;
4222  for (; n; --n) {
4223  strcat (result, "0");
4224  }
4225  scale = 0;
4226  } else {
4227  scale -= exponent;
4228  }
4229  } else {
4230  /* Exponent is 0; take as is */
4231  strcpy (result, significand_int);
4232  strcat (result, significand_dec);
4233  }
4234 
4235  yylval = cb_build_numeric_literal (sign, result,
4236  scale);
4237  SET_LOCATION (yylval);
4238  return LITERAL;
4239 }
static int scan_h ( char *  text,
const int  mark 
)
static

References _, cb_build_numeric_literal(), cb_error(), cb_error_node, CB_FMT_LLU, cob_u64_t, LITERAL, p, SET_LOCATION, and yylval.

Referenced by while().

4060 {
4061  unsigned char *p;
4062  cob_u64_t val;
4063  size_t size;
4064  int c;
4065 
4066  p = (unsigned char *)text;
4067  val = 0;
4068  size = 0;
4069  for (; (int)*p != mark; p++, size++) {
4070  if (size > 15) {
4071  goto error;
4072  }
4073  c = (int)*p;
4074  if ('0' <= c && c <= '9') {
4075  c = c - '0';
4076  } else if ('A' <= c && c <= 'F') {
4077  c = c - 'A' + 10;
4078  } else if ('a' <= c && c <= 'f') {
4079  c = c - 'a' + 10;
4080  } else {
4081  goto error;
4082  }
4083  val = (val << 4) + c;
4084  }
4085 
4086  sprintf ((char *)plexbuff, CB_FMT_LLU, val);
4087  yylval = cb_build_numeric_literal (0, (const void *)plexbuff, 0);
4088  SET_LOCATION (yylval);
4089  return LITERAL;
4090 
4091 error:
4092  cb_error (_("Invalid H literal: %s"), text);
4094  return LITERAL;
4095 }
static int scan_numeric ( char *  text)
static

References _, cb_build_numeric_literal(), cb_error(), COB_MAX_DIGITS, current_program, cb_program::decimal_point, LITERAL, SET_LOCATION, sign, unlikely, and yylval.

Referenced by while().

4099 {
4100  char *s;
4101  int sign;
4102  int scale;
4103 
4104  /* Get sign */
4105  sign = (*text == '+') ? 1 : (*text == '-') ? -1 : 0;
4106  if (sign) {
4107  text++;
4108  }
4109 
4110  /* Get decimal point */
4111  scale = 0;
4112  s = strchr (text, current_program->decimal_point);
4113  if (s) {
4114  scale = (int)strlen (s) - 1;
4115  /* Remove decimal point */
4116  /* Moves trailing null */
4117  memmove (s, s + 1, (size_t)(scale + 1));
4118  }
4119  if (unlikely(strchr (text, '.'))) {
4120  cb_error (_("Invalid numeric literal"));
4121  goto num_zero;
4122  }
4123  if (unlikely(strchr (text, ','))) {
4124  cb_error (_("Invalid numeric literal"));
4125  goto num_zero;
4126  }
4127  if (unlikely(strlen (text) > COB_MAX_DIGITS)) {
4128  cb_error (_("Invalid numeric literal"));
4129  goto num_zero;
4130  }
4131  yylval = cb_build_numeric_literal (sign, text, scale);
4132  SET_LOCATION (yylval);
4133  return LITERAL;
4134 num_zero:
4135  yylval = cb_build_numeric_literal (0, "0", 0);
4136  SET_LOCATION (yylval);
4137  return LITERAL;
4138 }
static void scan_options ( const char *  text,
const unsigned int  optype 
)
static

References COB_UNUSED.

Referenced by while().

4407 {
4408  COB_UNUSED (text);
4409  COB_UNUSED (optype);
4410 }
static void scan_picture ( char *  text)
static

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

Referenced by while().

4297 {
4298  unsigned char *p;
4299  const struct cb_level_78 *p78;
4300  size_t n;
4301  size_t i;
4302  size_t size;
4303  size_t sizep;
4304 
4305  /* Scan a PICTURE clause */
4306  /* Normalize the input */
4307  for (p = (unsigned char *)text; *p; p++) {
4308  /* unput trailing '.' or ',' */
4309  if (p[1] == 0 && (*p == '.' || *p == ',')) {
4310  unput (*p);
4311  *p = 0;
4312  break;
4313  }
4314  *p = (unsigned char)toupper (*p);
4315  }
4316 
4317  if (!top78ptr) {
4318  yylval = cb_build_picture (text);
4319  return;
4320  }
4321 
4322  memset (picbuff1, 0, pic1size);
4323  memset (picbuff2, 0, pic2size);
4324  strcpy (picbuff1, text);
4325  for (p78 = top78ptr; p78; p78 = p78->globnext) {
4326  if (!p78->pic_replace) {
4327  strcpy (picbuff2, picbuff1);
4328  continue;
4329  }
4330  size = p78->name_len;
4331  sizep = p78->pic_len;
4332  i = 0;
4333  for (n = 0; n < strlen (picbuff1); n++) {
4334  if (can_replace (&picbuff1[n], p78->fld78->name, size, n)) {
4335  memcpy (&picbuff2[i], p78->pic_replace, sizep);
4336  n += size - 1;
4337  i += sizep;
4338  } else {
4339  picbuff2[i++] = picbuff1[n];
4340  }
4341  }
4342  picbuff2[i] = 0;
4343  strcpy (picbuff1, picbuff2);
4344  }
4346 }
static int scan_x ( char *  text,
const int  mark 
)
static

References _, cb_build_alphanumeric_literal(), cb_error(), cb_error_node, cob_u8_t, cobc_realloc(), LITERAL, plexbuff, SET_LOCATION, and yylval.

Referenced by while().

3985 {
3986  unsigned char *src;
3987  unsigned char *dst;
3988  size_t currlen;
3989  int high;
3990  int c;
3991 
3992  currlen = strlen (text);
3993  if (currlen > plexsize) {
3994  plexsize = currlen;
3996  }
3997  src = (unsigned char *)text;
3998  dst = plexbuff;
3999  high = 1;
4000  for (; (int)*src != mark; src++) {
4001  c = (int)*src;
4002  if ('0' <= c && c <= '9') {
4003  c = c - '0';
4004  } else if ('A' <= c && c <= 'F') {
4005  c = c - 'A' + 10;
4006  } else if ('a' <= c && c <= 'f') {
4007  c = c - 'a' + 10;
4008  } else {
4009  goto error;
4010  }
4011  if (high) {
4012  *dst = (cob_u8_t)(c << 4);
4013  } else {
4014  *dst++ += (cob_u8_t)c;
4015  }
4016  high = 1 - high;
4017  }
4018 
4019  if (high) {
4021  SET_LOCATION (yylval);
4022  return LITERAL;
4023  }
4024  /* Fall through */
4025 error:
4026  cb_error (_("Invalid X literal: %s"), text);
4028  return LITERAL;
4029 }
static int scan_z ( char *  text,
const int  mark,
const cob_u32_t  llit 
)
static

References cb_build_alphanumeric_literal(), CB_LITERAL, cobc_realloc(), LITERAL, plexbuff, SET_LOCATION, and yylval.

Referenced by while().

4033 {
4034  unsigned char *src;
4035  unsigned char *dst;
4036  size_t currlen;
4037 
4038  /* currlen includes the terminating quote */
4039  currlen = strlen (text);
4040  if (currlen > plexsize) {
4041  plexsize = currlen;
4043  }
4044  src = (unsigned char *)text;
4045  dst = plexbuff;
4046  for (; (int)*src != mark; ++src, ++dst) {
4047  *dst = *src;
4048  }
4049  *dst = 0;
4050 
4051  /* Count is correct here as the trailing quote is now a null */
4053  CB_LITERAL(yylval)->llit = llit;
4054  SET_LOCATION (yylval);
4055  return LITERAL;
4056 }
while ( )

References _, BEGIN, BOTTOM, cb_build_alphanumeric_literal(), cb_build_comment(), cb_build_reference(), CB_CHAIN, CB_CS_EXIT, cb_error(), cb_error_node, CB_FUNCTION_TYPE, cb_intrinsic_list, CB_LITERAL, cb_source_file, cb_source_line, CB_SYSTEM_NAME_P, CB_VALUE, 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, EC, END, END_FUNCTION, END_PROGRAM, EOB_ACT_CONTINUE_SCAN, EOB_ACT_END_OF_FILE, EOB_ACT_LAST_MATCH, EOP, EQUAL, 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, LITERAL, lookup_intrinsic(), lookup_reserved_word(), MNEMONIC_NAME, cb_field::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_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, REPO_FUNCTION, RESET_TRACE, scan_define_options(), scan_floating_numeric(), scan_h(), scan_numeric(), scan_options(), scan_picture(), scan_x(), scan_z(), SCREEN_CONTROL, SEMI_COLON, SET_LOCATION, 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, USER_REPO_FUNCTION, cb_program::user_spec_list, cb_field::values, warningopt, WORD, YY_AT_BOL, YY_BREAK, YY_BUFFER_NEW, YY_BUFFER_NORMAL, yy_c_buf_p, yy_cp, 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_last_accepting_cpos, yy_last_accepting_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(), yyin, yyleng, yylval, yyterminate, yytext_ptr, and yywrap.

1854  {
1855  yy_cp = (yy_c_buf_p);
1856 
1857  /* Support of yytext. */
1858  *yy_cp = (yy_hold_char);
1859 
1860  /* yy_bp points to the position in yy_ch_buf of the start of
1861  * the current run.
1862  */
1863  yy_bp = yy_cp;
1864 
1865  yy_current_state = (yy_start);
1866  yy_current_state += YY_AT_BOL();
1867 yy_match:
1868  do
1869  {
1870  register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
1871  if ( yy_accept[yy_current_state] )
1872  {
1873  (yy_last_accepting_state) = yy_current_state;
1875  }
1876  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1877  {
1878  yy_current_state = (int) yy_def[yy_current_state];
1879  if ( yy_current_state >= 841 )
1880  yy_c = yy_meta[(unsigned int) yy_c];
1881  }
1882  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1883  ++yy_cp;
1884  }
1885  while ( yy_current_state != 840 );
1887  yy_current_state = (yy_last_accepting_state);
1888 
1889 yy_find_action:
1890  yy_act = yy_accept[yy_current_state];
1891 
1893 
1894 do_action: /* This label is used only to access EOF actions. */
1895 
1896  switch ( yy_act )
1897  { /* beginning of action switch */
1898  case 0: /* must back up */
1899  /* undo the effects of YY_DO_BEFORE_ACTION */
1900  *yy_cp = (yy_hold_char);
1902  yy_current_state = (yy_last_accepting_state);
1903  goto yy_find_action;
1904 
1905 case 1:
1906 /* rule 1 can match eol */
1908 #line 251 "scanner.l"
1909 {
1911 }
1912  YY_BREAK
1913 case 2:
1914 /* rule 2 can match eol */
1916 #line 255 "scanner.l"
1917 {
1918  scan_options (yytext, 1);
1919 }
1920  YY_BREAK
1921 case 3:
1922 /* rule 3 can match eol */
1924 #line 259 "scanner.l"
1925 {
1926  scan_options (yytext, 2);
1927 }
1928  YY_BREAK
1929 case 4:
1930 /* rule 4 can match eol */
1932 #line 263 "scanner.l"
1933 {
1934  scan_options (yytext, 3);
1935 }
1936  YY_BREAK
1937 case 5:
1938 /* rule 5 can match eol */
1940 #line 267 "scanner.l"
1941 {
1942  cb_source_line++;
1943 }
1944  YY_BREAK
1945 case 6:
1947 #line 271 "scanner.l"
1948 {
1949  /* Line directive */
1950  char *p1;
1951  char *p2;
1952 
1953  p1 = strchr (yytext, '"');
1954  if (p1) {
1955  p2 = cobc_strdup (p1 + 1);
1956  p1 = strrchr (p2, '"');
1957  if (p1) {
1958  *p1 = 0;
1960  cb_source_line = (int)strtol (yytext + 5, NULL, 10) - 1;
1961  }
1962  cobc_free (p2);
1963  }
1964 }
1965  YY_BREAK
1966 case 7:
1968 #line 289 "scanner.l"
1969 {
1970  /* Ignore */
1971 }
1972  YY_BREAK
1973 case 8:
1974 #line 294 "scanner.l"
1975 case 9:
1977 #line 294 "scanner.l"
1978 {
1980 }
1981  YY_BREAK
1982 case 10:
1984 #line 298 "scanner.l"
1985 {
1987  yylval = NULL;
1988  return FUNCTION;
1989  }
1991 }
1992  YY_BREAK
1993 case 11:
1995 #line 306 "scanner.l"
1996 {
1997  /* String literal */
1998  cobc_force_literal = 0;
1999  read_literal (yytext[0]);
2000  return LITERAL;
2001 }
2002  YY_BREAK
2003 case 12:
2004 #line 314 "scanner.l"
2005 case 13:
2007 #line 314 "scanner.l"
2008 {
2009  /* X string literal */
2010  cobc_force_literal = 0;
2011  return scan_x (yytext + 2, yytext[1]);
2012 }
2013  YY_BREAK
2014 case 14:
2015 #line 321 "scanner.l"
2016 case 15:
2018 #line 321 "scanner.l"
2019 {
2020  /* Z string literal */
2021  cobc_force_literal = 0;
2022  return scan_z (yytext + 2, yytext[1], 0);
2023 }
2024  YY_BREAK
2025 case 16:
2026 #line 328 "scanner.l"
2027 case 17:
2029 #line 328 "scanner.l"
2030 {
2031  /* L string literal */
2032  cobc_force_literal = 0;
2033  return scan_z (yytext + 2, yytext[1], 1);
2034 }
2035  YY_BREAK
2036 case 18:
2037 #line 335 "scanner.l"
2038 case 19:
2040 #line 335 "scanner.l"
2041 {
2042  /* H numeric literal */
2043  cobc_force_literal = 0;
2044  return scan_h (yytext + 2, yytext[1]);
2045 }
2046  YY_BREAK
2047 case 20:
2049 #line 341 "scanner.l"
2050 {
2051  inside_bracket++;
2052  return TOK_OPEN_PAREN;
2053 }
2054  YY_BREAK
2055 case 21:
2057 #line 346 "scanner.l"
2058 {
2059  if (inside_bracket > 0) {
2060  inside_bracket--;
2061  }
2062  return TOK_CLOSE_PAREN;
2063 }
2064  YY_BREAK
2065 case 22:
2067 #line 353 "scanner.l"
2068 {
2069  cobc_force_literal = 0;
2070  if (integer_is_label) {
2071  /* Integer label or level number */
2073  SET_LOCATION (yylval);
2074  return WORD;
2075  }
2076  /* Numeric literal */
2077  return scan_numeric (yytext);
2078 }
2079  YY_BREAK
2080 case 23:
2082 #line 365 "scanner.l"
2083 {
2084  /* Ignore */
2085 }
2086  YY_BREAK
2087 case 24:
2089 #line 369 "scanner.l"
2090 {
2091  if (inside_bracket) {
2092  return SEMI_COLON;
2093  }
2094  /* Ignore */
2095 }
2096  YY_BREAK
2097 case 25:
2099 #line 376 "scanner.l"
2100 {
2101  /* Numeric floating point literal */
2102  return scan_floating_numeric (yytext);
2103 }
2104  YY_BREAK
2105 case 26:
2107 #line 381 "scanner.l"
2108 {
2109  /* Numeric literal */
2110  return scan_numeric (yytext);
2111 }
2112  YY_BREAK
2113 case 27:
2115 #line 386 "scanner.l"
2116 {
2117  if (inside_bracket) {
2118  return COMMA_DELIM;
2119  }
2120  /* Ignore */
2121 }
2122  YY_BREAK
2123 case 28:
2125 #line 393 "scanner.l"
2126 {
2127  /* Numeric floating point literal */
2128  return scan_floating_numeric (yytext);
2129 }
2130  YY_BREAK
2131 case 29:
2133 #line 398 "scanner.l"
2134 {
2135  /* Numeric literal */
2136  return scan_numeric (yytext);
2137 }
2138  YY_BREAK
2139 case 30:
2141 #line 403 "scanner.l"
2142 {
2143  /* Numeric literal */
2144  return scan_numeric (yytext);
2145 }
2146  YY_BREAK
2147 case 31:
2149 #line 408 "scanner.l"
2150 {
2151  /* Numeric literal */
2152  return scan_numeric (yytext);
2153 }
2154  YY_BREAK
2155 case 32:
2157 #line 413 "scanner.l"
2158 {
2159  unput (',');
2160 }
2161  YY_BREAK
2162 case 33:
2164 #line 417 "scanner.l"
2165 {
2166  if (inside_bracket) {
2167  return COMMA_DELIM;
2168  }
2169  /* Ignore */
2170 }
2171  YY_BREAK
2172 case 34:
2173 /* rule 34 can match eol */
2175 #line 424 "scanner.l"
2176 {
2177  cobc_force_literal = 1;
2178  count_lines (yytext);
2179  return END_PROGRAM;
2180 }
2181  YY_BREAK
2182 case 35:
2183 /* rule 35 can match eol */
2185 #line 430 "scanner.l"
2186 {
2187  cobc_force_literal = 1;
2188  count_lines (yytext);
2189  return END_FUNCTION;
2190 }
2191  YY_BREAK
2192 case 36:
2193 /* rule 36 can match eol */
2195 #line 436 "scanner.l"
2196 {
2197  count_lines (yytext);
2198  return PICTURE_SYMBOL;
2199 }
2200  YY_BREAK
2201 case 37:
2202 /* rule 37 can match eol */
2204 #line 441 "scanner.l"
2205 {
2206  count_lines (yytext);
2207  return FROM_CRT;
2208 }
2209  YY_BREAK
2210 case 38:
2211 /* rule 38 can match eol */
2213 #line 446 "scanner.l"
2214 {
2215  count_lines (yytext);
2216  return SCREEN_CONTROL;
2217 }
2218  YY_BREAK
2219 case 39:
2220 /* rule 39 can match eol */
2222 #line 451 "scanner.l"
2223 {
2224  count_lines (yytext);
2225  return EVENT_STATUS;
2226 }
2227  YY_BREAK
2228 case 40:
2229 /* rule 40 can match eol */
2231 #line 456 "scanner.l"
2232 {
2233  count_lines (yytext);
2234  return READY_TRACE;
2235 }
2236  YY_BREAK
2237 case 41:
2238 /* rule 41 can match eol */
2240 #line 461 "scanner.l"
2241 {
2242  count_lines (yytext);
2243  return RESET_TRACE;
2244 }
2245  YY_BREAK
2246 case 42:
2247 /* rule 42 can match eol */
2248 #line 467 "scanner.l"
2249 case 43:
2250 /* rule 43 can match eol */
2251 #line 468 "scanner.l"
2252 case 44:
2253 /* rule 44 can match eol */
2254 #line 469 "scanner.l"
2255 case 45:
2256 /* rule 45 can match eol */
2258 #line 469 "scanner.l"
2259 {
2260  count_lines (yytext);
2261  return GREATER_OR_EQUAL;
2262 }
2263  YY_BREAK
2264 case 46:
2265 /* rule 46 can match eol */
2267 #line 474 "scanner.l"
2268 {
2269  count_lines (yytext);
2270  return GREATER;
2271 }
2272  YY_BREAK
2273 case 47:
2274 /* rule 47 can match eol */
2275 #line 480 "scanner.l"
2276 case 48:
2277 /* rule 48 can match eol */
2278 #line 481 "scanner.l"
2279 case 49:
2280 /* rule 49 can match eol */
2281 #line 482 "scanner.l"
2282 case 50:
2283 /* rule 50 can match eol */
2285 #line 482 "scanner.l"
2286 {
2287  count_lines (yytext);
2288  return LESS_OR_EQUAL;
2289 }
2290  YY_BREAK
2291 case 51:
2292 /* rule 51 can match eol */
2294 #line 487 "scanner.l"
2295 {
2296  count_lines (yytext);
2297  return LESS;
2298 }
2299  YY_BREAK
2300 case 52:
2301 /* rule 52 can match eol */
2303 #line 492 "scanner.l"
2304 {
2305  count_lines (yytext);
2306  return EQUAL;
2307 }
2308  YY_BREAK
2309 case 53:
2310 /* rule 53 can match eol */
2312 #line 497 "scanner.l"
2313 {
2314  count_lines (yytext);
2315  return REPLACING;
2316 }
2317  YY_BREAK
2318 case 54:
2319 /* rule 54 can match eol */
2320 #line 503 "scanner.l"
2321 case 55:
2322 /* rule 55 can match eol */
2323 #line 504 "scanner.l"
2324 case 56:
2325 /* rule 56 can match eol */
2327 #line 504 "scanner.l"
2328 {
2329  count_lines (yytext);
2330  return TOP;
2331 }
2332  YY_BREAK
2333 case 57:
2334 /* rule 57 can match eol */
2335 #line 510 "scanner.l"
2336 case 58:
2337 /* rule 58 can match eol */
2338 #line 511 "scanner.l"
2339 case 59:
2340 /* rule 59 can match eol */
2342 #line 511 "scanner.l"
2343 {
2344  count_lines (yytext);
2345  return BOTTOM;
2346 }
2347  YY_BREAK
2348 case 60:
2349 /* rule 60 can match eol */
2350 #line 517 "scanner.l"
2351 case 61:
2352 /* rule 61 can match eol */
2354 #line 517 "scanner.l"
2355 {
2356  count_lines (yytext);
2357  return NO_ADVANCING;
2358 }
2359  YY_BREAK
2360 case 62:
2361 /* rule 62 can match eol */
2362 #line 523 "scanner.l"
2363 case 63:
2364 /* rule 63 can match eol */
2366 #line 523 "scanner.l"
2367 {
2368  count_lines (yytext);
2369  return NEXT_PAGE;
2370 }
2371  YY_BREAK
2372 case 64:
2373 /* rule 64 can match eol */
2374 #line 529 "scanner.l"
2375 case 65:
2376 /* rule 65 can match eol */
2378 #line 529 "scanner.l"
2379 {
2380  count_lines (yytext);
2381  return NOT_SIZE_ERROR;
2382 }
2383  YY_BREAK
2384 case 66:
2385 /* rule 66 can match eol */
2386 #line 535 "scanner.l"
2387 case 67:
2388 /* rule 67 can match eol */
2390 #line 535 "scanner.l"
2391 {
2392  count_lines (yytext);
2393  return SIZE_ERROR;
2394 }
2395  YY_BREAK
2396 case 68:
2397 /* rule 68 can match eol */
2398 #line 541 "scanner.l"
2399 case 69:
2400 /* rule 69 can match eol */
2402 #line 541 "scanner.l"
2403 {
2404  count_lines (yytext);
2405  return NOT_EXCEPTION;
2406 }
2407  YY_BREAK
2408 case 70:
2409 /* rule 70 can match eol */
2411 #line 546 "scanner.l"
2412 {
2413  count_lines (yytext);
2414  return EXCEPTION;
2415 }
2416  YY_BREAK
2417 case 71:
2418 /* rule 71 can match eol */
2419 #line 552 "scanner.l"
2420 case 72:
2421 /* rule 72 can match eol */
2423 #line 552 "scanner.l"
2424 {
2425  count_lines (yytext);
2426  return NOT_OVERFLOW;
2427 }
2428  YY_BREAK
2429 case 73:
2430 /* rule 73 can match eol */
2431 #line 558 "scanner.l"
2432 case 74:
2433 /* rule 74 can match eol */
2435 #line 558 "scanner.l"
2436 {
2437  count_lines (yytext);
2438  return NOT_END;
2439 }
2440  YY_BREAK
2441 case 75:
2442 /* rule 75 can match eol */
2444 #line 563 "scanner.l"
2445 {
2446  count_lines (yytext);
2447  return END;
2448 }
2449  YY_BREAK
2450 case 76:
2451 /* rule 76 can match eol */
2452 #line 569 "scanner.l"
2453 case 77:
2454 /* rule 77 can match eol */
2456 #line 569 "scanner.l"
2457 {
2458  count_lines (yytext);
2459  return TOK_OVERFLOW;
2460 }
2461  YY_BREAK
2462 case 78:
2463 /* rule 78 can match eol */
2464 #line 575 "scanner.l"
2465 case 79:
2466 /* rule 79 can match eol */
2467 #line 576 "scanner.l"
2468 case 80:
2469 /* rule 80 can match eol */
2470 #line 577 "scanner.l"
2471 case 81:
2472 /* rule 81 can match eol */
2474 #line 577 "scanner.l"
2475 {
2476  count_lines (yytext);
2477  return NOT_EOP;
2478 }
2479  YY_BREAK
2480 case 82:
2481 /* rule 82 can match eol */
2482 #line 583 "scanner.l"
2483 case 83:
2484 /* rule 83 can match eol */
2485 #line 584 "scanner.l"
2486 case 84:
2487 /* rule 84 can match eol */
2488 #line 585 "scanner.l"
2489 case 85:
2490 /* rule 85 can match eol */
2492 #line 585 "scanner.l"
2493 {
2494  count_lines (yytext);
2495  return EOP;
2496 }
2497  YY_BREAK
2498 case 86:
2499 /* rule 86 can match eol */
2501 #line 590 "scanner.l"
2502 {
2503  count_lines (yytext);
2504  return NOT_INVALID_KEY;
2505 }
2506  YY_BREAK
2507 case 87:
2508 /* rule 87 can match eol */
2510 #line 595 "scanner.l"
2511 {
2512  count_lines (yytext);
2513  return NOT_INVALID_KEY;
2514 }
2515  YY_BREAK
2516 case 88:
2517 /* rule 88 can match eol */
2519 #line 600 "scanner.l"
2520 {
2521  count_lines (yytext);
2522  return INVALID_KEY;
2523 }
2524  YY_BREAK
2525 case 89:
2526 /* rule 89 can match eol */
2528 #line 605 "scanner.l"
2529 {
2530  count_lines (yytext);
2531  return INVALID_KEY;
2532 }
2533  YY_BREAK
2534 case 90:
2535 /* rule 90 can match eol */
2537 #line 610 "scanner.l"
2538 {
2539  count_lines (yytext);
2540  return UPON_ENVIRONMENT_NAME;
2541 }
2542  YY_BREAK
2543 case 91:
2544 /* rule 91 can match eol */
2546 #line 615 "scanner.l"
2547 {
2548  count_lines (yytext);
2549  return UPON_ENVIRONMENT_VALUE;
2550 }
2551  YY_BREAK
2552 case 92:
2553 /* rule 92 can match eol */
2555 #line 620 "scanner.l"
2556 {
2557  count_lines (yytext);
2558  return UPON_ARGUMENT_NUMBER;
2559 }
2560  YY_BREAK
2561 case 93:
2562 /* rule 93 can match eol */
2564 #line 625 "scanner.l"
2565 {
2566  count_lines (yytext);
2567  return UPON_COMMAND_LINE;
2568 }
2569  YY_BREAK
2570 case 94:
2571 /* rule 94 can match eol */
2573 #line 630 "scanner.l"
2574 {
2575  count_lines (yytext);
2576  return EXCEPTION_CONDITION;
2577 }
2578  YY_BREAK
2579 case 95:
2580 /* rule 95 can match eol */
2582 #line 635 "scanner.l"
2583 {
2584  count_lines (yytext);
2585  return EXCEPTION_CONDITION;
2586 }
2587  YY_BREAK
2588 case 96:
2589 /* rule 96 can match eol */
2591 #line 640 "scanner.l"
2592 {
2593  count_lines (yytext);
2594  return EC;
2595 }
2596  YY_BREAK
2597 case 97:
2598 /* rule 97 can match eol */
2600 #line 645 "scanner.l"
2601 {
2602  count_lines (yytext);
2603  return LENGTH_OF;
2604 }
2605  YY_BREAK
2606 case 98:
2607 #line 651 "scanner.l"
2608 case 99:
2610 #line 651 "scanner.l"
2611 {
2612  /* Ignore */
2613 }
2614  YY_BREAK
2615 case 100:
2617 #line 655 "scanner.l"
2618 {
2619  if (cobc_in_procedure) {
2620  yylval = cb_build_reference ("SWITCH");
2621  unput ('0');
2622  } else {
2623  yylval = cb_build_reference ("SWITCH-0");
2624  }
2625  SET_LOCATION (yylval);
2626  return WORD;
2627 }
2628  YY_BREAK
2629 case 101:
2631 #line 666 "scanner.l"
2632 {
2633  if (cobc_in_procedure) {
2634  yylval = cb_build_reference ("SWITCH");
2635  unput ('1');
2636  } else {
2637  yylval = cb_build_reference ("SWITCH-1");
2638  }
2639  SET_LOCATION (yylval);
2640  return WORD;
2641 }
2642  YY_BREAK
2643 case 102:
2645 #line 677 "scanner.l"
2646 {
2647  if (cobc_in_procedure) {
2648  yylval = cb_build_reference ("SWITCH");
2649  unput ('2');
2650  } else {
2651  yylval = cb_build_reference ("SWITCH-2");
2652  }
2653  SET_LOCATION (yylval);
2654  return WORD;
2655 }
2656  YY_BREAK
2657 case 103:
2659 #line 688 "scanner.l"
2660 {
2661  if (cobc_in_procedure) {
2662  yylval = cb_build_reference ("SWITCH");
2663  unput ('3');
2664  } else {
2665  yylval = cb_build_reference ("SWITCH-3");
2666  }
2667  SET_LOCATION (yylval);
2668  return WORD;
2669 }
2670  YY_BREAK
2671 case 104:
2673 #line 699 "scanner.l"
2674 {
2675  if (cobc_in_procedure) {
2676  yylval = cb_build_reference ("SWITCH");
2677  unput ('4');
2678  } else {
2679  yylval = cb_build_reference ("SWITCH-4");
2680  }
2681  SET_LOCATION (yylval);
2682  return WORD;
2683 }
2684  YY_BREAK
2685 case 105:
2687 #line 710 "scanner.l"
2688 {
2689  if (cobc_in_procedure) {
2690  yylval = cb_build_reference ("SWITCH");
2691  unput ('5');
2692  } else {
2693  yylval = cb_build_reference ("SWITCH-5");
2694  }
2695  SET_LOCATION (yylval);
2696  return WORD;
2697 }
2698  YY_BREAK
2699 case 106:
2701 #line 721 "scanner.l"
2702 {
2703  if (cobc_in_procedure) {
2704  yylval = cb_build_reference ("SWITCH");
2705  unput ('6');
2706  } else {
2707  yylval = cb_build_reference ("SWITCH-6");
2708  }
2709  SET_LOCATION (yylval);
2710  return WORD;
2711 }
2712  YY_BREAK
2713 case 107:
2715 #line 732 "scanner.l"
2716 {
2717  if (cobc_in_procedure) {
2718  yylval = cb_build_reference ("SWITCH");
2719  unput ('7');
2720  } else {
2721  yylval = cb_build_reference ("SWITCH-7");
2722  }
2723  SET_LOCATION (yylval);
2724  return WORD;
2725 }
2726  YY_BREAK
2727 case 108:
2729 #line 743 "scanner.l"
2730 {
2731  if (cobc_in_procedure) {
2732  yylval = cb_build_reference ("SWITCH");
2733  unput ('8');
2734  } else {
2735  yylval = cb_build_reference ("SWITCH-8");
2736  }
2737  SET_LOCATION (yylval);
2738  return WORD;
2739 }
2740  YY_BREAK
2741 case 109:
2743 #line 754 "scanner.l"
2744 {
2745  struct cb_level_78 *p78;
2746  struct cb_intrinsic_table *cbp;
2747  struct cobc_reserved *resptr;
2748  struct cb_text_list *tlp;
2749  cb_tree x;
2750  cb_tree l;
2751 
2752  /* Check word length */
2753  if (unlikely(yyleng > cb_word_length)) {
2754  if (yyleng > COB_MAX_WORDLEN) {
2755  /* Absolute limit */
2756  cb_error (_("Word length exceeds maximum of %d characters - '%s'"),
2757  COB_MAX_WORDLEN, yytext);
2758  } else if (!cb_relaxed_syntax_check || warningopt) {
2759  cb_error (_("Word length exceeds %d characters - '%s'"),
2760  cb_word_length, yytext);
2761  }
2762  }
2763 
2764  /* Check Intrinsic FUNCTION name without keyword */
2767  cbp = lookup_intrinsic (yytext, 1, 0);
2768  if (cbp) {
2769  if (cobc_in_repository) {
2771  SET_LOCATION (yylval);
2772  return REPO_FUNCTION;
2773  }
2774  if (functions_are_all) {
2776  SET_LOCATION (yylval);
2777  return (enum yytokentype)(cbp->token);
2778  }
2779  for (tlp = cb_intrinsic_list; tlp; tlp = tlp->next) {
2780  if (!strcasecmp (yytext, tlp->text)) {
2782  SET_LOCATION (yylval);
2783  return (enum yytokentype)(cbp->token);
2784  }
2785  }
2787  for (; l; l = CB_CHAIN(l)) {
2788  x = CB_VALUE (l);
2789  if (!strcasecmp (yytext,
2790  (char *)(CB_LITERAL(x)->data))) {
2792  SET_LOCATION (yylval);
2793  return (enum yytokentype)(cbp->token);
2794  }
2795  }
2796  }
2797  }
2798 
2799  /* Bail early for (END) PROGRAM-ID when not a literal */
2801  /* Force PROGRAM-ID / END PROGRAM */
2802  cobc_force_literal = 0;
2804  SET_LOCATION (yylval);
2805  return PROGRAM_NAME;
2806  }
2807 
2808  /* Check reserved word */
2809  resptr = lookup_reserved_word (yytext);
2810  if (resptr != NULL) {
2811  if (resptr->nodegen) {
2812  /* Save location for terminator checking */
2813  /* Misuse comment tree to mark statement */
2815  } else {
2816  yylval = NULL;
2817  }
2818  return resptr->token;
2819  }
2820 
2821  /* Check user function */
2822  if (cobc_in_repository) {
2824  SET_LOCATION (yylval);
2825  return USER_REPO_FUNCTION;
2826  } else if (cobc_in_procedure) {
2827  if (current_program->prog_type == CB_FUNCTION_TYPE &&
2828  !functions_are_all &&
2829  !strcasecmp (yytext, current_program->orig_program_id)) {
2830  /* Direct recursive reference */
2832  SET_LOCATION (yylval);
2833  return USER_FUNCTION_NAME;
2834  }
2835  for (l = current_program->user_spec_list; l; l = CB_CHAIN(l)) {
2836  x = CB_VALUE (l);
2837  if (!strcasecmp (yytext, (char *)(CB_LITERAL(x)->data))) {
2839  SET_LOCATION (yylval);
2840  return USER_FUNCTION_NAME;
2841  }
2842  }
2843  }
2844 
2845  /* User word */
2846 
2847  /* Check local, global and source global CONSTANT (78) items */
2848 
2849  for (p78 = top78ptr; p78; p78 = p78->globnext) {
2850  if (strcasecmp (yytext, p78->fld78->name) == 0) {
2851  if (unlikely(non_const_word)) {
2852  if (p78->prog == current_program) {
2853  cb_error (_("A constant may not be used here - '%s'"), yytext);
2855  return WORD;
2856  }
2857  if (p78->chk_const) {
2858  p78->not_const = 1;
2859  }
2860  break;
2861  }
2862  if (p78->chk_const && p78->not_const) {
2863  break;
2864  }
2865  yylval = CB_VALUE (p78->fld78->values);
2866  return LITERAL;
2867  }
2868  }
2869 
2871  SET_LOCATION (yylval);
2872 
2873  /* Special name handling */
2874  if (CB_WORD_COUNT (yylval) > 0 && CB_WORD_ITEMS (yylval)) {
2875  x = CB_VALUE (CB_WORD_ITEMS (yylval));
2876  if (CB_SYSTEM_NAME_P (x)) {
2877  return MNEMONIC_NAME;
2878  }
2879  }
2880 
2881  return WORD;
2882 }
2883  YY_BREAK
2884 case 110:
2886 #line 894 "scanner.l"
2887 {
2888  yylval = NULL;
2889  return LESS_OR_EQUAL;
2890 }
2891  YY_BREAK
2892 case 111:
2894 #line 899 "scanner.l"
2895 {
2896  yylval = NULL;
2897  return GREATER_OR_EQUAL;
2898 }
2899  YY_BREAK
2900 case 112:
2902 #line 904 "scanner.l"
2903 {
2904  yylval = NULL;
2905  return NOT_EQUAL;
2906 }
2907  YY_BREAK
2908 case 113:
2910 #line 909 "scanner.l"
2911 {
2912  yylval = NULL;
2913  return EXPONENTIATION;
2914 }
2915  YY_BREAK
2916 case 114:
2918 #line 914 "scanner.l"
2919 {
2920  last_token_is_dot = 1;
2921  yylval = NULL;
2922  return TOK_DOT;
2923 }
2924  YY_BREAK
2925 case 115:
2927 #line 920 "scanner.l"
2928 {
2929  yylval = NULL;
2930  return TOK_AMPER;
2931 }
2932  YY_BREAK
2933 case 116:
2935 #line 925 "scanner.l"
2936 {
2937  yylval = NULL;
2938  return TOK_COLON;
2939 }
2940  YY_BREAK
2941 case 117:
2943 #line 930 "scanner.l"
2944 {
2945  yylval = NULL;
2946  return TOK_EQUAL;
2947 }
2948  YY_BREAK
2949 case 118:
2951 #line 935 "scanner.l"
2952 {
2953  yylval = NULL;
2954  return TOK_DIV;
2955 }
2956  YY_BREAK
2957 case 119:
2959 #line 940 "scanner.l"
2960 {
2961  yylval = NULL;
2962  return TOK_MUL;
2963 }
2964  YY_BREAK
2965 case 120:
2967 #line 945 "scanner.l"
2968 {
2969  yylval = NULL;
2970  return TOK_PLUS;
2971 }
2972  YY_BREAK
2973 case 121:
2975 #line 950 "scanner.l"
2976 {
2977  yylval = NULL;
2978  return TOK_MINUS;
2979 }
2980  YY_BREAK
2981 case 122:
2983 #line 955 "scanner.l"
2984 {
2985  yylval = NULL;
2986  return TOK_LESS;
2987 }
2988  YY_BREAK
2989 case 123:
2991 #line 960 "scanner.l"
2992 {
2993  yylval = NULL;
2994  return TOK_GREATER;
2995 }
2996  YY_BREAK
2997 case 124:
2999 #line 965 "scanner.l"
3000 {
3001  int c;
3002 
3003  cb_error (_("Invalid symbol: %s - Skipping word"), yytext);
3004  while ((c = input ()) != EOF) {
3005  if (c == '\n' || c == ' ') {
3006  break;
3007  }
3008  }
3009  if (c != EOF) {
3010  unput (c);
3011  }
3012 }
3013  YY_BREAK
3014 
3015 case 125:
3017 #line 981 "scanner.l"
3018 {
3019  /* Ignore */
3020  }
3021  YY_BREAK
3022 case 126:
3024 #line 984 "scanner.l"
3025 {
3026  BEGIN INITIAL;
3027  scan_picture (yytext);
3028  return PICTURE;
3029  }
3030  YY_BREAK
3031 
3032 
3033 case 127:
3035 #line 992 "scanner.l"
3036 {
3037  struct cb_intrinsic_table *cbp;
3038  cb_tree l;
3039  cb_tree x;
3040 
3041  BEGIN INITIAL;
3043  SET_LOCATION (yylval);
3044  for (l = current_program->user_spec_list; l; l = CB_CHAIN(l)) {
3045  x = CB_VALUE (l);
3046  if (!strcasecmp (yytext, (char *)(CB_LITERAL(x)->data))) {
3047  return USER_FUNCTION_NAME;
3048  }
3049  }
3050  cbp = lookup_intrinsic (yytext, 1, 0);
3051  if (cbp) {
3052  return (enum yytokentype)(cbp->token);
3053  }
3054  return FUNCTION_NAME;
3055  }
3056  YY_BREAK
3057 case 128:
3059 #line 1012 "scanner.l"
3060 {
3061  yylval = NULL;
3062  return yytext[0];
3063  }
3064  YY_BREAK
3065 
3066 case YY_STATE_EOF(INITIAL):
3067 case YY_STATE_EOF(DECIMAL_IS_PERIOD):
3068 case YY_STATE_EOF(DECIMAL_IS_COMMA):
3069 case YY_STATE_EOF(PICTURE_STATE):
3070 case YY_STATE_EOF(FUNCTION_STATE):
3071 #line 1018 "scanner.l"
3072 {
3073  struct cb_level_78 *p78;
3074  struct cb_level_78 *p782;
3075 
3076  /* At EOF - Clear variables */
3077  for (p78 = lev78ptr; p78; ) {
3078  p782 = p78->next;
3079  cobc_free (p78);
3080  p78 = p782;
3081  }
3082  for (p78 = globlev78ptr; p78; ) {
3083  p782 = p78->next;
3084  cobc_free (p78);
3085  p78 = p782;
3086  }
3087  for (p78 = const78ptr; p78; ) {
3088  p782 = p78->next;
3089  cobc_free (p78);
3090  p78 = p782;
3091  }
3092  top78ptr = NULL;
3093  last_token_is_dot = 0;
3094  integer_is_label = 0;
3095  inside_bracket = 0;
3096  lev78ptr = NULL;
3097  globlev78ptr = NULL;
3098  cobc_force_literal = 0;
3099  yyterminate ();
3100 }
3101  YY_BREAK
3102 case 129:
3104 #line 1048 "scanner.l"
3105 YY_FATAL_ERROR( "flex scanner jammed" );
3106  YY_BREAK
3107 #line 3094 "scanner.c"
3108 
3109  case YY_END_OF_BUFFER:
3110  {
3111  /* Amount of text matched not including the EOB char. */
3112  int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
3113 
3114  /* Undo the effects of YY_DO_BEFORE_ACTION. */
3115  *yy_cp = (yy_hold_char);
3117 
3118  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
3119  {
3120  /* We're scanning a new file or input source. It's
3121  * possible that this happened because the user
3122  * just pointed yyin at a new source and called
3123  * yylex(). If so, then we have to assure
3124  * consistency between YY_CURRENT_BUFFER and our
3125  * globals. Here is the right place to do so, because
3126  * this is the first action (other than possibly a
3127  * back-up) that will match for the new input source.
3128  */
3129  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
3130  YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
3131  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
3132  }
3133 
3134  /* Note that here we test for yy_c_buf_p "<=" to the position
3135  * of the first EOB in the buffer, since yy_c_buf_p will
3136  * already have been incremented past the NUL character
3137  * (since all states make transitions on EOB to the
3138  * end-of-buffer state). Contrast this with the test
3139  * in input().
3140  */
3141  if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
3142  { /* This was really a NUL. */
3143  yy_state_type yy_next_state;
3144 
3145  (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
3146 
3147  yy_current_state = yy_get_previous_state( );
3148 
3149  /* Okay, we're now positioned to make the NUL
3150  * transition. We couldn't have
3151  * yy_get_previous_state() go ahead and do it
3152  * for us because it doesn't know how to deal
3153  * with the possibility of jamming (and we don't
3154  * want to build jamming into it because then it
3155  * will run more slowly).
3156  */
3157 
3158  yy_next_state = yy_try_NUL_trans( yy_current_state );
3159 
3161 
3162  if ( yy_next_state )
3163  {
3164  /* Consume the NUL. */
3165  yy_cp = ++(yy_c_buf_p);
3166  yy_current_state = yy_next_state;
3167  goto yy_match;
3168  }
3169 
3170  else
3171  {
3173  yy_current_state = (yy_last_accepting_state);
3174  goto yy_find_action;
3175  }
3176  }
3177 
3178  else switch ( yy_get_next_buffer( ) )
3179  {
3180  case EOB_ACT_END_OF_FILE:
3181  {
3183 
3184  if ( yywrap( ) )
3185  {
3186  /* Note: because we've taken care in
3187  * yy_get_next_buffer() to have set up
3188  * yytext, we can now set up
3189  * yy_c_buf_p so that if some total
3190  * hoser (like flex itself) wants to
3191  * call the scanner after we return the
3192  * YY_NULL, it'll still work - another
3193  * YY_NULL will get returned.
3194  */
3196 
3198  goto do_action;
3199  }
3200 
3201  else
3202  {
3203  if ( ! (yy_did_buffer_switch_on_eof) )
3204  YY_NEW_FILE;
3205  }
3206  break;
3207  }
3208 
3209  case EOB_ACT_CONTINUE_SCAN:
3210  (yy_c_buf_p) =
3211  (yytext_ptr) + yy_amount_of_matched_text;
3212 
3213  yy_current_state = yy_get_previous_state( );
3214 
3215  yy_cp = (yy_c_buf_p);
3217  goto yy_match;
3218 
3219  case EOB_ACT_LAST_MATCH:
3220  (yy_c_buf_p) =
3221  &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
3222 
3223  yy_current_state = yy_get_previous_state( );
3224 
3225  yy_cp = (yy_c_buf_p);
3227  goto yy_find_action;
3228  }
3229  break;
3230  }
3231 
3232  default:
3234  "fatal flex scanner internal error--no action found" );
3235  } /* end of action switch */
3236  } /* end of scanning one token */
void ylex_call_destroy ( void  )

References NULL, and yylex_destroy().

4537 {
4538  /* Release flex buffers */
4539  (void)yylex_destroy ();
4540  const78ptr = NULL;
4541 }
void ylex_clear_all ( void  )

References cobc_free(), and NULL.

4516 {
4517  /* Clear buffers after parsing all source elements */
4518  if (picbuff2) {
4519  cobc_free (picbuff2);
4520  picbuff2 = NULL;
4521  }
4522  if (picbuff1) {
4523  cobc_free (picbuff1);
4524  picbuff1 = NULL;
4525  }
4526  if (plexbuff) {
4527  cobc_free (plexbuff);
4528  plexbuff = NULL;
4529  }
4530  plexsize = 0;
4531  pic1size = 0;
4532  pic2size = 0;
4533 }
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.

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 if(), and yyrestart().

3617 {
3618  YY_BUFFER_STATE b;
3619 
3620  b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
3621  if ( ! b )
3622  YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
3623 
3624  b->yy_buf_size = size;
3625 
3626  /* yy_ch_buf has to be 2 characters longer than the size given because
3627  * we need to put in 2 end-of-buffer characters.
3628  */
3629  b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
3630  if ( ! b->yy_ch_buf )
3631  YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
3632 
3633  b->yy_is_our_buffer = 1;
3634 
3635  yy_init_buffer(b,file );
3636 
3637  return b;
3638 }
void yy_delete_buffer ( YY_BUFFER_STATE  b)

Destroy the buffer.

Parameters
ba buffer created with yy_create_buffer()

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().

3645 {
3646 
3647  if ( ! b )
3648  return;
3649 
3650  if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
3652 
3653  if ( b->yy_is_our_buffer )
3654  yyfree((void *) b->yy_ch_buf );
3655 
3656  yyfree((void *) b );
3657 }
static void yy_fatal_error ( yyconst char  msg[])
static
static void yy_fatal_error ( yyconst char *  msg)
static

References YY_EXIT_FAILURE.

3817 {
3818  (void) fprintf( stderr, "%s\n", msg );
3819  exit( YY_EXIT_FAILURE );
3820 }
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.

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().

3692 {
3693  if ( ! b )
3694  return;
3695 
3696  b->yy_n_chars = 0;
3697 
3698  /* We always need two end-of-buffer characters. The first causes
3699  * a transition to the end-of-buffer state. The second causes
3700  * a jam in that state.
3701  */
3704 
3705  b->yy_buf_pos = &b->yy_ch_buf[0];
3706 
3707  b->yy_at_bol = 1;
3709 
3710  if ( b == YY_CURRENT_BUFFER )
3712 }
static int yy_get_next_buffer ( void  )
static

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, 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 while().

3247 {
3248  register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
3249  register char *source = (yytext_ptr);
3250  register int number_to_move, i;
3251  int ret_val;
3252 
3253  if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
3255  "fatal flex scanner internal error--end of buffer missed" );
3256 
3257  if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
3258  { /* Don't try to fill the buffer, so this is an EOF. */
3259  if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
3260  {
3261  /* We matched a single character, the EOB, so
3262  * treat this as a final EOF.
3263  */
3264  return EOB_ACT_END_OF_FILE;
3265  }
3266 
3267  else
3268  {
3269  /* We matched some text prior to the EOB, first
3270  * process it.
3271  */
3272  return EOB_ACT_LAST_MATCH;
3273  }
3274  }
3275 
3276  /* Try to read more data. */
3277 
3278  /* First move last chars to start of buffer. */
3279  number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
3280 
3281  for ( i = 0; i < number_to_move; ++i )
3282  *(dest++) = *(source++);
3283 
3284  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
3285  /* don't do the read, it's not guaranteed to return an EOF,
3286  * just force an EOF
3287  */
3288  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
3289 
3290  else
3291  {
3292  int num_to_read =
3293  YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
3294 
3295  while ( num_to_read <= 0 )
3296  { /* Not enough room in the buffer - grow it. */
3297 
3298  /* just a shorter name for the current buffer */
3300 
3301  int yy_c_buf_p_offset =
3302  (int) ((yy_c_buf_p) - b->yy_ch_buf);
3303 
3304  if ( b->yy_is_our_buffer )
3305  {
3306  int new_size = b->yy_buf_size * 2;
3307 
3308  if ( new_size <= 0 )
3309  b->yy_buf_size += b->yy_buf_size / 8;
3310  else
3311  b->yy_buf_size *= 2;
3312 
3313  b->yy_ch_buf = (char *)
3314  /* Include room in for 2 EOB chars. */
3315  yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
3316  }
3317  else
3318  /* Can't grow it, we don't own it. */
3319  b->yy_ch_buf = 0;
3320 
3321  if ( ! b->yy_ch_buf )
3323  "fatal error - scanner input buffer overflow" );
3324 
3325  (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
3326 
3327  num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
3328  number_to_move - 1;
3329 
3330  }
3331 
3332  if ( num_to_read > YY_READ_BUF_SIZE )
3333  num_to_read = YY_READ_BUF_SIZE;
3334 
3335  /* Read in more data. */
3336  YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
3337  (yy_n_chars), (size_t) num_to_read );
3338 
3339  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
3340  }
3341 
3342  if ( (yy_n_chars) == 0 )
3343  {
3344  if ( number_to_move == YY_MORE_ADJ )
3345  {
3346  ret_val = EOB_ACT_END_OF_FILE;
3347  yyrestart(yyin );
3348  }
3349 
3350  else
3351  {
3352  ret_val = EOB_ACT_LAST_MATCH;
3353  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
3355  }
3356  }
3357 
3358  else
3359  ret_val = EOB_ACT_CONTINUE_SCAN;
3360 
3361  if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
3362  /* Extend the array by 50%, plus the number we really need. */
3363  yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
3364  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
3365  if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
3366  YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
3367  }
3368 
3369  (yy_n_chars) += number_to_move;
3372 
3373  (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
3374 
3375  return ret_val;
3376 }
static yy_state_type yy_get_previous_state ( void  )
static

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

Referenced by while().

3381 {
3382  register yy_state_type yy_current_state;
3383  register char *yy_cp;
3384 
3385  yy_current_state = (yy_start);
3386  yy_current_state += YY_AT_BOL();
3387 
3388  for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
3389  {
3390  register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
3391  if ( yy_accept[yy_current_state] )
3392  {
3393  (yy_last_accepting_state) = yy_current_state;
3394  (yy_last_accepting_cpos) = yy_cp;
3395  }
3396  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
3397  {
3398  yy_current_state = (int) yy_def[yy_current_state];
3399  if ( yy_current_state >= 841 )
3400  yy_c = yy_meta[(unsigned int) yy_c];
3401  }
3402  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
3403  }
3404 
3405  return yy_current_state;
3406 }
static void yy_init_buffer ( YY_BUFFER_STATE  b,
FILE *  file 
)
static

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().

3665 {
3666  int oerrno = errno;
3667 
3668  yy_flush_buffer(b );
3669 
3670  b->yy_input_file = file;
3671  b->yy_fill_buffer = 1;
3672 
3673  /* If b is the current buffer, then yy_init_buffer was _probably_
3674  * called from yyrestart() or through yy_get_next_buffer.
3675  * In that case, we don't want to reset the lineno or column.
3676  */
3677  if (b != YY_CURRENT_BUFFER){
3678  b->yy_bs_lineno = 1;
3679  b->yy_bs_column = 0;
3680  }
3681 
3682  b->yy_is_interactive = 0;
3683 
3684  errno = oerrno;
3685 }
static int yy_init_globals ( void  )
static

Get the current token.

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().

3846 {
3847  /* Initialization is the same as for the non-reentrant scanner.
3848  * This function is called from yylex_destroy(), so don't allocate here.
3849  */
3850 
3851  (yy_buffer_stack) = 0;
3852  (yy_buffer_stack_top) = 0;
3853  (yy_buffer_stack_max) = 0;
3854  (yy_c_buf_p) = (char *) 0;
3855  (yy_init) = 0;
3856  (yy_start) = 0;
3857 
3858 /* Defined in main.c */
3859 #ifdef YY_STDINIT
3860  yyin = stdin;
3861  yyout = stdout;
3862 #else
3863  yyin = (FILE *) 0;
3864  yyout = (FILE *) 0;
3865 #endif
3866 
3867  /* For future reference: Set errno on error, since we are called by
3868  * yylex_init()
3869  */
3870  return 0;
3871 }
static void yy_load_buffer_state ( void  )
static
YY_BUFFER_STATE yy_scan_buffer ( char *  base,
yy_size_t  size 
)
YY_BUFFER_STATE yy_scan_bytes ( yyconst char *  bytes,
int  len 
)
YY_BUFFER_STATE yy_scan_string ( yyconst 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.

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().

3572 {
3573 
3574  /* TODO. We should be able to replace this entire function body
3575  * with
3576  * yypop_buffer_state();
3577  * yypush_buffer_state(new_buffer);
3578  */
3580  if ( YY_CURRENT_BUFFER == new_buffer )
3581  return;
3582 
3583  if ( YY_CURRENT_BUFFER )
3584  {
3585  /* Flush out information for old buffer. */
3586  *(yy_c_buf_p) = (yy_hold_char);
3587  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
3588  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
3589  }
3590 
3591  YY_CURRENT_BUFFER_LVALUE = new_buffer;
3593 
3594  /* We don't actually know whether we did this switch during
3595  * EOF (yywrap()) processing, but the only time this flag
3596  * is looked at is after yywrap() is called, so it's safe
3597  * to go ahead and always set it.
3598  */
3600 }
static yy_state_type yy_try_NUL_trans ( yy_state_type  current_state)
static

References yy_c_buf_p, yy_last_accepting_cpos, and yy_last_accepting_state.

Referenced by while().

3414 {
3415  register int yy_is_jam;
3416  register char *yy_cp = (yy_c_buf_p);
3417 
3418  register YY_CHAR yy_c = 1;
3419  if ( yy_accept[yy_current_state] )
3420  {
3421  (yy_last_accepting_state) = yy_current_state;
3422  (yy_last_accepting_cpos) = yy_cp;
3423  }
3424  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
3425  {
3426  yy_current_state = (int) yy_def[yy_current_state];
3427  if ( yy_current_state >= 841 )
3428  yy_c = yy_meta[(unsigned int) yy_c];
3429  }
3430  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
3431  yy_is_jam = (yy_current_state == 840);
3432 
3433  return yy_is_jam ? 0 : yy_current_state;
3434 }
void * yyalloc ( yy_size_t  size)

Referenced by yy_create_buffer(), and yyensure_buffer_stack().

3920 {
3921  return (void *) malloc( size );
3922 }
static void yyensure_buffer_stack ( void  )
static

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

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

3770 {
3771  int num_to_alloc;
3772 
3773  if (!(yy_buffer_stack)) {
3774 
3775  /* First allocation is just for 2 elements, since we don't know if this
3776  * scanner will even need a stack. We use 2 instead of 1 to avoid an
3777  * immediate realloc on the next call.
3778  */
3779  num_to_alloc = 1;
3781  (num_to_alloc * sizeof(struct yy_buffer_state*)
3782  );
3783  if ( ! (yy_buffer_stack) )
3784  YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
3785 
3786  memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
3787 
3788  (yy_buffer_stack_max) = num_to_alloc;
3789  (yy_buffer_stack_top) = 0;
3790  return;
3791  }
3792 
3793  if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
3794 
3795  /* Increase the buffer to prepare for a possible push. */
3796  int grow_size = 8 /* arbitrary grow size */;
3797 
3798  num_to_alloc = (yy_buffer_stack_max) + grow_size;
3800  ((yy_buffer_stack),
3801  num_to_alloc * sizeof(struct yy_buffer_state*)
3802  );
3803  if ( ! (yy_buffer_stack) )
3804  YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
3805 
3806  /* zero only the new slots.*/
3807  memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
3808  (yy_buffer_stack_max) = num_to_alloc;
3809  }
3810 }
void yyfree ( void *  ptr)

Referenced by yy_delete_buffer(), and yylex_destroy().

3937 {
3938  free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
3939 }
int yylex ( void  )
int yylex_destroy ( void  )

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().

3875 {
3876 
3877  /* Pop the buffer stack, destroying each element. */
3878  while(YY_CURRENT_BUFFER){
3882  }
3883 
3884  /* Destroy the stack itself. */
3885  yyfree((yy_buffer_stack) );
3886  (yy_buffer_stack) = NULL;
3887 
3888  /* Reset the globals. This is important in a non-reentrant scanner so the next time
3889  * yylex() is called, initialization will occur. */
3890  yy_init_globals( );
3891 
3892  return 0;
3893 }
void yypop_buffer_state ( void  )

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

The next element becomes the new top.

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().

3751 {
3752  if (!YY_CURRENT_BUFFER)
3753  return;
3754 
3757  if ((yy_buffer_stack_top) > 0)
3758  --(yy_buffer_stack_top);
3759 
3760  if (YY_CURRENT_BUFFER) {
3763  }
3764 }
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.

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().

3721 {
3722  if (new_buffer == NULL)
3723  return;
3724 
3726 
3727  /* This block is copied from yy_switch_to_buffer. */
3728  if ( YY_CURRENT_BUFFER )
3729  {
3730  /* Flush out information for old buffer. */
3731  *(yy_c_buf_p) = (yy_hold_char);
3732  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
3733  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
3734  }
3735 
3736  /* Only push if top exists. Otherwise, replace top. */
3737  if (YY_CURRENT_BUFFER)
3738  (yy_buffer_stack_top)++;
3739  YY_CURRENT_BUFFER_LVALUE = new_buffer;
3740 
3741  /* copied from yy_switch_to_buffer. */
3744 }
void * yyrealloc ( void *  ptr,
yy_size_t  size 
)

Referenced by yy_get_next_buffer(), and yyensure_buffer_stack().

3925 {
3926  /* The cast to (char *) in the following accommodates both
3927  * implementations that use char* generic pointers, and those
3928  * that use void* generic pointers. It works with the latter
3929  * because both ANSI C and C++ allow castless assignment from
3930  * any pointer type to void*, and deal with argument conversions
3931  * as though doing an assignment.
3932  */
3933  return (void *) realloc( (char *) ptr, size );
3934 }
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 .

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().

3555 {
3556 
3557  if ( ! YY_CURRENT_BUFFER ){
3561  }
3562 
3563  yy_init_buffer(YY_CURRENT_BUFFER,input_file );
3565 }
static void yyunput ( int  c,
char *  buf_ptr 
)
static
static void yyunput ( int  c,
register char *  yy_bp 
)
static

References if(), yy_c_buf_p, yy_cp, YY_CURRENT_BUFFER_LVALUE, YY_FATAL_ERROR, yy_hold_char, yy_n_chars, and yytext_ptr.

3437 {
3438  register char *yy_cp;
3439 
3440  yy_cp = (yy_c_buf_p);
3441 
3442  /* undo effects of setting up yytext */
3443  *yy_cp = (yy_hold_char);
3444 
3445  if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
3446  { /* need to shift things up to make room */
3447  /* +2 for EOB chars. */
3448  register int number_to_move = (yy_n_chars) + 2;
3449  register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
3450  YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
3451  register char *source =
3452  &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
3453 
3454  while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
3455  *--dest = *--source;
3456 
3457  yy_cp += (int) (dest - source);
3458  yy_bp += (int) (dest - source);
3459  YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
3460  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
3461 
3462  if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
3463  YY_FATAL_ERROR( "flex scanner push-back overflow" );
3464  }
3465 
3466  *--yy_cp = (char) c;
3467 
3468  (yytext_ptr) = yy_bp;
3469  (yy_hold_char) = *yy_cp;
3470  (yy_c_buf_p) = yy_cp;
3471 }

Variable Documentation

struct cb_level_78* const78ptr = NULL
static
else
Initial value:
struct cb_level_78* globlev78ptr = NULL
static

Referenced by cb_add_78(), and cb_reset_78().

unsigned int inside_bracket = 0
static
unsigned int integer_is_label = 0
static
unsigned int last_token_is_dot = 0
static
struct cb_level_78* lev78ptr = NULL
static

Referenced by cb_add_78().

size_t pic1size
static
size_t pic2size
static
char* picbuff1 = NULL
static
char* picbuff2 = NULL
static
unsigned char* plexbuff = NULL
static

Referenced by scan_x(), and scan_z().

size_t plexsize
static
const unsigned char pvalid_char[]
static
Initial value:
=
"-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz"
struct cb_level_78* top78ptr = NULL
static
unsigned char valid_char[256]
static
yyconst flex_int16_t yy_accept[841]
static
register int yy_act
yyconst flex_int16_t yy_base[869]
static
register char * yy_bp
YY_BUFFER_STATE* yy_buffer_stack = 0
static

Stack as an array.

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

size_t yy_buffer_stack_max = 0
static

capacity of stack.

Referenced by yy_init_globals(), and yyensure_buffer_stack().

size_t yy_buffer_stack_top = 0
static
yyconst flex_int16_t yy_chk[3140]
static
register char* yy_cp
YY_DECL
Initial value:
{
register yy_state_type yy_current_state

The main scanner function which does all the work.

yyconst flex_int16_t yy_def[869]
static
int yy_did_buffer_switch_on_eof
static
yyconst flex_int32_t yy_ec[256]
static
int yy_flex_debug = 0
int yy_init = 0
static

Referenced by if(), and yy_init_globals().

char* yy_last_accepting_cpos
static
yy_state_type yy_last_accepting_state
static
yyconst flex_int32_t yy_meta[84]
static
Initial value:
=
{ 0,
1, 2, 3, 1, 1, 1, 1, 1, 1, 1,
1, 1, 4, 5, 1, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 1, 3, 1, 1, 1,
4, 4, 4, 4, 6, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 7, 4, 4, 4,
4, 6, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 7
}
yyconst flex_int16_t yy_nxt[3140]
static
int yy_start = 0
static
FILE* yyin = (FILE *) 0
int yyleng

Referenced by check_comments(), and while().

int yylineno = 1
FILE * yyout = (FILE *) 0
char* yytext

Referenced by ppecho().