PIPS
lexer.c File Reference
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <ctype.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "ri-util.h"
#include "misc.h"
#include "splitc.h"
#include "preprocessor.h"
#include <unistd.h>
+ Include dependency graph for lexer.c:

Go to the source code of this file.

Data Structures

struct  yy_buffer_state
 
struct  yy_trans_info
 This struct is not used in this scanner, but its presence is necessary. More...
 

Macros

#define YY_INT_ALIGNED   short int
 
#define yy_create_buffer   splitc__create_buffer
 A lexical scanner generated by flex. More...
 
#define yy_delete_buffer   splitc__delete_buffer
 
#define yy_scan_buffer   splitc__scan_buffer
 
#define yy_scan_string   splitc__scan_string
 
#define yy_scan_bytes   splitc__scan_bytes
 
#define yy_init_buffer   splitc__init_buffer
 
#define yy_flush_buffer   splitc__flush_buffer
 
#define yy_load_buffer_state   splitc__load_buffer_state
 
#define yy_switch_to_buffer   splitc__switch_to_buffer
 
#define yypush_buffer_state   splitc_push_buffer_state
 
#define yypop_buffer_state   splitc_pop_buffer_state
 
#define yyensure_buffer_stack   splitc_ensure_buffer_stack
 
#define yy_flex_debug   splitc__flex_debug
 
#define yyin   splitc_in
 
#define yyleng   splitc_leng
 
#define yylex   splitc_lex
 
#define yylineno   splitc_lineno
 
#define yyout   splitc_out
 
#define yyrestart   splitc_restart
 
#define yytext   splitc_text
 
#define yywrap(void)   splitc_wrap
 Macros after this point can all be overridden by user definitions in section 1. More...
 
#define yyalloc   splitc_alloc
 
#define yyrealloc   splitc_realloc
 
#define yyfree   splitc_free
 
#define FLEX_SCANNER
 
#define YY_FLEX_MAJOR_VERSION   2
 
#define YY_FLEX_MINOR_VERSION   6
 
#define YY_FLEX_SUBMINOR_VERSION   4
 
#define FLEX_BETA
 
#define splitc__create_buffer_ALREADY_DEFINED
 
#define splitc__delete_buffer_ALREADY_DEFINED
 
#define splitc__scan_buffer_ALREADY_DEFINED
 
#define splitc__scan_string_ALREADY_DEFINED
 
#define splitc__scan_bytes_ALREADY_DEFINED
 
#define splitc__init_buffer_ALREADY_DEFINED
 
#define splitc__flush_buffer_ALREADY_DEFINED
 
#define splitc__load_buffer_state_ALREADY_DEFINED
 
#define splitc__switch_to_buffer_ALREADY_DEFINED
 
#define splitc_push_buffer_state_ALREADY_DEFINED
 
#define splitc_pop_buffer_state_ALREADY_DEFINED
 
#define splitc_ensure_buffer_stack_ALREADY_DEFINED
 
#define splitc_lex_ALREADY_DEFINED
 
#define splitc_restart_ALREADY_DEFINED
 
#define yylex_init   splitc_lex_init
 
#define yylex_init_extra   splitc_lex_init_extra
 
#define yylex_destroy(void)   splitc_lex_destroy
 Accessor methods to globals. More...
 
#define yyget_debug   splitc_get_debug
 
#define yyset_debug   splitc_set_debug
 
#define yyget_extra   splitc_get_extra
 
#define yyset_extra   splitc_set_extra
 
#define yyget_in   splitc_get_in
 
#define yyset_in   splitc_set_in
 
#define yyget_out   splitc_get_out
 
#define yyset_out   splitc_set_out
 
#define yyget_leng   splitc_get_leng
 
#define yyget_text   splitc_get_text
 
#define yyget_lineno   splitc_get_lineno
 
#define yyset_lineno   splitc_set_lineno
 
#define splitc_wrap_ALREADY_DEFINED
 
#define splitc_alloc_ALREADY_DEFINED
 
#define splitc_realloc_ALREADY_DEFINED
 
#define splitc_free_ALREADY_DEFINED
 
#define splitc_text_ALREADY_DEFINED
 
#define splitc_leng_ALREADY_DEFINED
 
#define splitc_in_ALREADY_DEFINED
 
#define splitc_out_ALREADY_DEFINED
 
#define splitc__flex_debug_ALREADY_DEFINED
 
#define splitc_lineno_ALREADY_DEFINED
 
#define FLEXINT_H
 First, we deal with platform-specific or compiler-specific issues. More...
 
#define INT8_MIN   (-128)
 Limits of integral types. More...
 
#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 SIZE_MAX   (~(size_t)0)
 
#define yyconst   const
 ! C99 More...
 
#define yynoreturn
 
#define YY_NULL   0
 Returned upon end-of-file. More...
 
#define YY_SC_TO_UI(c)   ((YY_CHAR) (c))
 Promotes a possibly negative, possibly signed char to an integer in range [0..255] for use as an array index. More...
 
#define BEGIN   (yy_start) = 1 + 2 *
 Enter a start condition. More...
 
#define YY_START   (((yy_start) - 1) / 2)
 Translate the current start state into a value that can be later handed to BEGIN to return to the state. More...
 
#define YYSTATE   YY_START
 
#define YY_STATE_EOF(state)   (YY_END_OF_BUFFER + state + 1)
 Action number for EOF rule of a given start state. More...
 
#define YY_NEW_FILE   yyrestart( yyin )
 Special action meaning "start processing a new file". More...
 
#define YY_END_OF_BUFFER_CHAR   0
 
#define YY_BUF_SIZE   16384
 Size of default input buffer. More...
 
#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
 ia64 More...
 
#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)
 Note: We specifically omit the test for yy_rule_can_match_eol because it requires access to the local variable yy_act. More...
 
#define YY_LINENO_REWIND_TO(dst)
 
#define yyless(n)
 Return all but the first "n" matched characters back to the input stream. More...
 
#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
 When an EOF's been seen but there's still some text to process then we mark the buffer as YY_EOF_PENDING, to indicate that we shouldn't try reading from the input source any more. More...
 
#define YY_CURRENT_BUFFER
 We provide macros for accessing buffer states in case in the future we want to put the buffer states in a more general "scanner state". More...
 
#define YY_CURRENT_BUFFER_LVALUE   (yy_buffer_stack)[(yy_buffer_stack_top)]
 Same as previous macro, but useful when we know that the buffer stack is not NULL or when we need an lvalue. More...
 
#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
 Done after the current pattern has been matched and before the corresponding action - sets up yytext. More...
 
#define YY_NUM_RULES   72
 
#define YY_END_OF_BUFFER   73
 
#define REJECT   reject_used_but_not_detected
 The intent behind this definition is that it'll catch any uses of REJECT which flex missed. More...
 
#define yymore()   yymore_used_but_not_detected
 
#define YY_MORE_ADJ   0
 
#define YY_RESTORE_YY_MORE_OFFSET
 
#define YY_NO_INPUT   1
 
#define YY_USER_ACTION   update_csplit_file_offset_information();
 To track current file position: More...
 
#define TOKEN_UNDEFINED   (-1)
 The lexer cannot handle the ambiguity between named types and variables without extra-help. More...
 
#define LEXER_RETURN(t)   return(previous_keyword_token=t)
 This is going to be the previous token because LEXER_RETURN is not used in case the lexer handles either a named type or a variable. More...
 
#define TK_TYPE_P(tk)
 
#define INITIAL   0
 To track file line number automatically: More...
 
#define YY_EXTRA_TYPE   void *
 Special case for "unistd.h", since it is non-ANSI. More...
 
#define YY_READ_BUF_SIZE   8192
 Amount of stuff to slurp up with each read. More...
 
#define ECHO   do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
 ia64 More...
 
#define YY_INPUT(buf, result, max_size)
 Gets input and stuffs it into "buf". More...
 
#define yyterminate()   return YY_NULL
 No semi-colon after return; correct usage is to write "yyterminate();" - we don't want an extra ';' after the "return" because that will cause some compilers to complain about unreachable statements. More...
 
#define YY_START_STACK_INCR   25
 Number of entries by which start-condition stack grows. More...
 
#define YY_FATAL_ERROR(msg)   yy_fatal_error( msg )
 Report a fatal error. More...
 
#define YY_DECL_IS_OURS   1
 end tables serialization structures and prototypes More...
 
#define YY_DECL   int yylex (void)
 
#define YY_BREAK   /**INTED*/break;
 !YY_DECL More...
 
#define YY_RULE_SETUP
 
#define YY_EXIT_FAILURE   2
 
#define yyless(n)
 Return all but the first "n" matched characters back to the input stream. More...
 
#define YYTABLES_NAME   "yytables"
 

Typedefs

typedef signed char flex_int8_t
 C99 systems have <inttypes.h>. More...
 
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 flex_uint8_t YY_CHAR
 Begin user sect3. More...
 
typedef int yy_state_type
 

Enumerations

enum  gather_comment_state_t { PUT_IN_NEXT_TOP_LEVEL_CONSTRUCT , GATHER_SPACES , GATHER_COMMENT }
 A state-machine to gather the trailing comments of a statement with an heuristic to decide if some comments and spaces will go into the previous or next top-level construct: More...
 

Functions

void yyrestart (FILE *input_file)
 
void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer)
 
YY_BUFFER_STATE yy_create_buffer (FILE *file, int size)
 
void yy_delete_buffer (YY_BUFFER_STATE b)
 
void yy_flush_buffer (YY_BUFFER_STATE b)
 
void yypush_buffer_state (YY_BUFFER_STATE new_buffer)
 
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 (const char *yy_str)
 
YY_BUFFER_STATE yy_scan_bytes (const 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 yynoreturn yy_fatal_error (const char *msg)
 
static void gdb_marker ()
 
void reset_csplit_line_number ()
 Reinitialise global position numbers for a new file. More...
 
static void update_csplit_current_beginning ()
 If we encounter a possible function begin, just snapshot the position of the function beginning: More...
 
void reset_csplit_current_beginning ()
 This function is called at the end of any top-level C construct: More...
 
int get_csplit_current_beginning ()
 
int get_user_current_beginning ()
 Get the current line number in the file to split from the user point of view (before preprocessor expansion): More...
 
size_t get_csplit_file_offset_beginning ()
 Get the file position in the file to split where the current function begins: More...
 
size_t get_current_csplit_file_offset ()
 Get the current file position in the file to split: More...
 
void update_csplit_file_offset_information ()
 Function called each time a token is read to trac file position information: More...
 
static int lf_count (string s)
 
static int is_c_preprocessor_keyword_typedef (char *id)
 See if id is a keyword, a typedef or an identifier. More...
 
static int yy_init_globals (void)
 
void yyset_debug (int debug_flag)
 
void yyset_extra (YY_EXTRA_TYPE user_defined)
 
void yyset_in (FILE *_in_str)
 
void yyset_out (FILE *_out_str)
 
void yyset_lineno (int _line_number)
 
 if (!(yy_init))
 

Variables

int yyleng
 number of characters read into yy_ch_buf More...
 
FILE * yyin
 
FILE * yyout
 
static size_t yy_buffer_stack_top = 0
 !YY_STRUCT_YY_BUFFER_STATE More...
 
static size_t yy_buffer_stack_max = 0
 capacity of stack. More...
 
static YY_BUFFER_STATEyy_buffer_stack = NULL
 Stack as an array. More...
 
static char yy_hold_char
 yy_hold_char holds the character lost when yytext is formed. More...
 
static int yy_n_chars
 
static char * yy_c_buf_p = NULL
 Points to current character in buffer. More...
 
static int yy_init = 0
 
static int yy_start = 0
 whether we need to initialize More...
 
static int yy_did_buffer_switch_on_eof
 start state number More...
 
int yylineno = 1
 Begin user sect3. More...
 
char * yytext
 
static const flex_int16_t yy_accept [271]
 
static const YY_CHAR yy_ec [256]
 
static const YY_CHAR yy_meta [65]
 
static const flex_int16_t yy_base [316]
 
static const flex_int16_t yy_def [316]
 
static const flex_int16_t yy_nxt [860]
 
static const flex_int16_t yy_chk [860]
 
static const flex_int32_t yy_rule_can_match_eol [73]
 Table of booleans, true if rule could match eol. More...
 
static yy_state_type yy_last_accepting_state
 
static char * yy_last_accepting_cpos
 
int yy_flex_debug = 0
 
int csplit_line_number = 1
 To be exported to the parser for splitting the preprocessed file. More...
 
int user_line_number = 1
 To be exported to the parser for error messages related to the user file. More...
 
size_t current_csplit_file_offset = 0
 
size_t csplit_file_offset_beginning = 0
 
static int bracket_depth = 0
 To track nesting in brackets. More...
 
enum gather_comment_state_t gather_comment_state_machine = PUT_IN_NEXT_TOP_LEVEL_CONSTRUCT
 Indeed it does not work since csplit_copy() is called from splitc.y when a function definition is found and thus we cannot gather the comment in it... More...
 
static int csplit_current_beginning = 1000000
 
static int user_current_beginning = 1000000
 
static int previous_keyword_token = TOKEN_UNDEFINED
 
 YY_DECL
 The main scanner function which does all the work. More...
 
char * yy_cp
 
char * yy_bp
 
int yy_act
 

Macro Definition Documentation

◆ BEGIN

#define BEGIN   (yy_start) = 1 + 2 *

Enter a start condition.

This macro really ought to take a parameter, but we do it the disgusting crufty way forced on us by the ()-less definition of BEGIN.

Definition at line 376 of file lexer.c.

◆ ECHO

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

ia64

Copy whatever the last rule matched to the standard output. This used to be an fputs(), but since the string might contain NUL's, we now use fwrite().

Definition at line 1402 of file lexer.c.

◆ EOB_ACT_CONTINUE_SCAN

#define EOB_ACT_CONTINUE_SCAN   0

Definition at line 420 of file lexer.c.

◆ EOB_ACT_END_OF_FILE

#define EOB_ACT_END_OF_FILE   1

Definition at line 421 of file lexer.c.

◆ EOB_ACT_LAST_MATCH

#define EOB_ACT_LAST_MATCH   2

Definition at line 422 of file lexer.c.

◆ FLEX_BETA

#define FLEX_BETA

Definition at line 38 of file lexer.c.

◆ FLEX_SCANNER

#define FLEX_SCANNER

Definition at line 33 of file lexer.c.

◆ FLEXINT_H

#define FLEXINT_H

First, we deal with platform-specific or compiler-specific issues.

begin standard C headers. end standard C headers. flex integer type definitions

Definition at line 288 of file lexer.c.

◆ INITIAL

#define INITIAL   0

To track file line number automatically:

From C norm A.1: "

Definition at line 1309 of file lexer.c.

◆ INT16_MAX

#define INT16_MAX   (32767)

Definition at line 330 of file lexer.c.

◆ INT16_MIN

#define INT16_MIN   (-32767-1)

Definition at line 321 of file lexer.c.

◆ INT32_MAX

#define INT32_MAX   (2147483647)

Definition at line 333 of file lexer.c.

◆ INT32_MIN

#define INT32_MIN   (-2147483647-1)

Definition at line 324 of file lexer.c.

◆ INT8_MAX

#define INT8_MAX   (127)

Definition at line 327 of file lexer.c.

◆ INT8_MIN

#define INT8_MIN   (-128)

Limits of integral types.

Definition at line 318 of file lexer.c.

◆ LEXER_RETURN

#define LEXER_RETURN (   t)    return(previous_keyword_token=t)

This is going to be the previous token because LEXER_RETURN is not used in case the lexer handles either a named type or a variable.

Definition at line 1244 of file lexer.c.

◆ REJECT

#define REJECT   reject_used_but_not_detected

The intent behind this definition is that it'll catch any uses of REJECT which flex missed.

Definition at line 1008 of file lexer.c.

◆ SIZE_MAX

#define SIZE_MAX   (~(size_t)0)

Definition at line 346 of file lexer.c.

◆ splitc__create_buffer_ALREADY_DEFINED

#define splitc__create_buffer_ALREADY_DEFINED

Definition at line 42 of file lexer.c.

◆ splitc__delete_buffer_ALREADY_DEFINED

#define splitc__delete_buffer_ALREADY_DEFINED

Definition at line 48 of file lexer.c.

◆ splitc__flex_debug_ALREADY_DEFINED

#define splitc__flex_debug_ALREADY_DEFINED

Definition at line 264 of file lexer.c.

◆ splitc__flush_buffer_ALREADY_DEFINED

#define splitc__flush_buffer_ALREADY_DEFINED

Definition at line 78 of file lexer.c.

◆ splitc__init_buffer_ALREADY_DEFINED

#define splitc__init_buffer_ALREADY_DEFINED

Definition at line 72 of file lexer.c.

◆ splitc__load_buffer_state_ALREADY_DEFINED

#define splitc__load_buffer_state_ALREADY_DEFINED

Definition at line 84 of file lexer.c.

◆ splitc__scan_buffer_ALREADY_DEFINED

#define splitc__scan_buffer_ALREADY_DEFINED

Definition at line 54 of file lexer.c.

◆ splitc__scan_bytes_ALREADY_DEFINED

#define splitc__scan_bytes_ALREADY_DEFINED

Definition at line 66 of file lexer.c.

◆ splitc__scan_string_ALREADY_DEFINED

#define splitc__scan_string_ALREADY_DEFINED

Definition at line 60 of file lexer.c.

◆ splitc__switch_to_buffer_ALREADY_DEFINED

#define splitc__switch_to_buffer_ALREADY_DEFINED

Definition at line 90 of file lexer.c.

◆ splitc_alloc_ALREADY_DEFINED

#define splitc_alloc_ALREADY_DEFINED

Definition at line 222 of file lexer.c.

◆ splitc_ensure_buffer_stack_ALREADY_DEFINED

#define splitc_ensure_buffer_stack_ALREADY_DEFINED

Definition at line 108 of file lexer.c.

◆ splitc_free_ALREADY_DEFINED

#define splitc_free_ALREADY_DEFINED

Definition at line 234 of file lexer.c.

◆ splitc_in_ALREADY_DEFINED

#define splitc_in_ALREADY_DEFINED

Definition at line 252 of file lexer.c.

◆ splitc_leng_ALREADY_DEFINED

#define splitc_leng_ALREADY_DEFINED

Definition at line 246 of file lexer.c.

◆ splitc_lex_ALREADY_DEFINED

#define splitc_lex_ALREADY_DEFINED

Definition at line 114 of file lexer.c.

◆ splitc_lineno_ALREADY_DEFINED

#define splitc_lineno_ALREADY_DEFINED

Definition at line 270 of file lexer.c.

◆ splitc_out_ALREADY_DEFINED

#define splitc_out_ALREADY_DEFINED

Definition at line 258 of file lexer.c.

◆ splitc_pop_buffer_state_ALREADY_DEFINED

#define splitc_pop_buffer_state_ALREADY_DEFINED

Definition at line 102 of file lexer.c.

◆ splitc_push_buffer_state_ALREADY_DEFINED

#define splitc_push_buffer_state_ALREADY_DEFINED

Definition at line 96 of file lexer.c.

◆ splitc_realloc_ALREADY_DEFINED

#define splitc_realloc_ALREADY_DEFINED

Definition at line 228 of file lexer.c.

◆ splitc_restart_ALREADY_DEFINED

#define splitc_restart_ALREADY_DEFINED

Definition at line 120 of file lexer.c.

◆ splitc_text_ALREADY_DEFINED

#define splitc_text_ALREADY_DEFINED

Definition at line 240 of file lexer.c.

◆ splitc_wrap_ALREADY_DEFINED

#define splitc_wrap_ALREADY_DEFINED

Definition at line 216 of file lexer.c.

◆ TK_TYPE_P

#define TK_TYPE_P (   tk)
Value:
((tk)==TK_CHAR || (tk)==TK_INT || \
(tk)==TK_DOUBLE || (tk)==TK_FLOAT || (tk)==TK_COMPLEX || \
(tk)==TK_ENUM || (tk)==TK_STRUCT || (tk)==TK_UNION || \
(tk)==TK_SIGNED|| (tk)==TK_UNSIGNED|| (tk)==TK_LONG|| (tk)==TK_SHORT ||\
(tk)==TK_RETURN)
#define TK_SHORT
Definition: splitc.c:779
#define TK_RETURN
Definition: splitc.c:840
#define TK_COMPLEX
Definition: splitc.c:771
#define TK_STRUCT
Definition: splitc.c:773
#define TK_INT
Definition: splitc.c:765
#define TK_LONG
Definition: splitc.c:778
#define TK_FLOAT
Definition: splitc.c:769
#define TK_SIGNED
Definition: splitc.c:776
#define TK_ENUM
Definition: splitc.c:772
#define TK_CHAR
Definition: splitc.c:764
#define TK_DOUBLE
Definition: splitc.c:768
#define TK_UNSIGNED
Definition: splitc.c:777
#define TK_UNION
Definition: splitc.c:775

◆ TOKEN_UNDEFINED

#define TOKEN_UNDEFINED   (-1)

The lexer cannot handle the ambiguity between named types and variables without extra-help.

Definition at line 1239 of file lexer.c.

◆ UINT16_MAX

#define UINT16_MAX   (65535U)

Definition at line 339 of file lexer.c.

◆ UINT32_MAX

#define UINT32_MAX   (4294967295U)

Definition at line 342 of file lexer.c.

◆ UINT8_MAX

#define UINT8_MAX   (255U)

Definition at line 336 of file lexer.c.

◆ unput

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

Definition at line 459 of file lexer.c.

◆ YY_AT_BOL

#define YY_AT_BOL ( )    (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)

Definition at line 600 of file lexer.c.

◆ YY_BREAK

#define YY_BREAK   /**INTED*/break;

!YY_DECL

Code executed at the beginning of each rule, after yytext and yyleng have been set up. Code executed at the end of each rule.

Definition at line 1481 of file lexer.c.

◆ YY_BUF_SIZE

#define YY_BUF_SIZE   16384

Size of default input buffer.

Definition at line 398 of file lexer.c.

◆ YY_BUFFER_EOF_PENDING

#define YY_BUFFER_EOF_PENDING   2

When an EOF's been seen but there's still some text to process then we mark the buffer as YY_EOF_PENDING, to indicate that we shouldn't try reading from the input source any more.

We might still have a bunch of tokens to match, though, because of possible backing-up.

When we actually see the EOF, we change the status to "new" (via yyrestart()), so that the user can continue scanning by just pointing yyin at a new input file.

Definition at line 521 of file lexer.c.

◆ YY_BUFFER_NEW

#define YY_BUFFER_NEW   0

Definition at line 509 of file lexer.c.

◆ YY_BUFFER_NORMAL

#define YY_BUFFER_NORMAL   1

Definition at line 510 of file lexer.c.

◆ yy_create_buffer

#define yy_create_buffer   splitc__create_buffer

A lexical scanner generated by flex.

Definition at line 8 of file lexer.c.

◆ YY_CURRENT_BUFFER

#define YY_CURRENT_BUFFER
Value:
: NULL)
static YY_BUFFER_STATE * yy_buffer_stack
Stack as an array.
Definition: lexer.c:529
static size_t yy_buffer_stack_top
!YY_STRUCT_YY_BUFFER_STATE
Definition: lexer.c:527

We provide macros for accessing buffer states in case in the future we want to put the buffer states in a more general "scanner state".

Returns the top of the stack, or NULL.

Definition at line 537 of file lexer.c.

◆ YY_CURRENT_BUFFER_LVALUE

#define YY_CURRENT_BUFFER_LVALUE   (yy_buffer_stack)[(yy_buffer_stack_top)]

Same as previous macro, but useful when we know that the buffer stack is not NULL or when we need an lvalue.

For internal use only.

Definition at line 543 of file lexer.c.

◆ YY_DECL

#define YY_DECL   int yylex (void)

Definition at line 1469 of file lexer.c.

◆ YY_DECL_IS_OURS

#define YY_DECL_IS_OURS   1

end tables serialization structures and prototypes

Default declaration of generated scanner - a define so the user can easily add parameters.

Definition at line 1465 of file lexer.c.

◆ yy_delete_buffer

#define yy_delete_buffer   splitc__delete_buffer

Definition at line 9 of file lexer.c.

◆ YY_DO_BEFORE_ACTION

#define YY_DO_BEFORE_ACTION
Value:
yyleng = (int) (yy_cp - yy_bp); \
*yy_cp = '\0'; \
void const char const char const int
char * yy_cp
Definition: lexer.c:976
char * yy_bp
Definition: lexer.c:976
static char yy_hold_char
yy_hold_char holds the character lost when yytext is formed.
Definition: lexer.c:546
#define yytext_ptr
Definition: lexer.c:616
static char * yy_c_buf_p
Points to current character in buffer.
Definition: lexer.c:551

Done after the current pattern has been matched and before the corresponding action - sets up yytext.

Definition at line 626 of file lexer.c.

◆ YY_END_OF_BUFFER

#define YY_END_OF_BUFFER   73

Definition at line 633 of file lexer.c.

◆ YY_END_OF_BUFFER_CHAR

#define YY_END_OF_BUFFER_CHAR   0

Definition at line 387 of file lexer.c.

◆ YY_EXIT_FAILURE

#define YY_EXIT_FAILURE   2

◆ YY_EXTRA_TYPE

#define YY_EXTRA_TYPE   void *

Special case for "unistd.h", since it is non-ANSI.

We include it way down here because we want the user's section 1 to have been scanned first. The user has a chance to override it with an option.

Definition at line 1320 of file lexer.c.

◆ YY_FATAL_ERROR

#define YY_FATAL_ERROR (   msg)    yy_fatal_error( msg )

Report a fatal error.

Definition at line 1456 of file lexer.c.

◆ yy_flex_debug

#define yy_flex_debug   splitc__flex_debug

Definition at line 20 of file lexer.c.

◆ YY_FLEX_MAJOR_VERSION

#define YY_FLEX_MAJOR_VERSION   2

Definition at line 34 of file lexer.c.

◆ YY_FLEX_MINOR_VERSION

#define YY_FLEX_MINOR_VERSION   6

Definition at line 35 of file lexer.c.

◆ YY_FLEX_SUBMINOR_VERSION

#define YY_FLEX_SUBMINOR_VERSION   4

Definition at line 36 of file lexer.c.

◆ yy_flush_buffer

#define yy_flush_buffer   splitc__flush_buffer

Definition at line 14 of file lexer.c.

◆ YY_FLUSH_BUFFER

#define YY_FLUSH_BUFFER   yy_flush_buffer( YY_CURRENT_BUFFER )

Definition at line 571 of file lexer.c.

◆ yy_init_buffer

#define yy_init_buffer   splitc__init_buffer

Definition at line 13 of file lexer.c.

◆ YY_INPUT

#define YY_INPUT (   buf,
  result,
  max_size 
)
Value:
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \
int c = '*'; \
int n; \
for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
if ( c == '\n' ) \
buf[n++] = (char) c; \
if ( c == EOF && ferror( yyin ) ) \
YY_FATAL_ERROR( "input in flex scanner failed" ); \
result = n; \
} \
else \
{ \
errno=0; \
while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
{ \
if( errno != EINTR) \
{ \
YY_FATAL_ERROR( "input in flex scanner failed" ); \
break; \
} \
errno=0; \
clearerr(yyin); \
} \
}\
\
size_t yy_size_t
Definition: genread_lex.c:413
#define YY_CURRENT_BUFFER_LVALUE
Same as previous macro, but useful when we know that the buffer stack is not NULL or when we need an ...
Definition: lexer.c:543
#define yyin
Definition: lexer.c:21
static char buf[BSZ]
Definition: split_file.c:157

Gets input and stuffs it into "buf".

number of characters read, or YY_NULL, is returned in "result".

Definition at line 1409 of file lexer.c.

◆ YY_INT_ALIGNED

#define YY_INT_ALIGNED   short int

Definition at line 4 of file lexer.c.

◆ YY_LESS_LINENO

#define YY_LESS_LINENO (   n)
Value:
do { \
int yyl;\
for ( yyl = n; yyl < yyleng; ++yyl )\
if ( yytext[yyl] == '\n' )\
}while(0)
#define yytext
Definition: lexer.c:27
#define yylineno
Definition: lexer.c:24
#define yyleng
Definition: lexer.c:22

Note: We specifically omit the test for yy_rule_can_match_eol because it requires access to the local variable yy_act.

Since yyless() is a macro, it would break existing scanners that call yyless() from OUTSIDE yylex. One obvious solution it to make yy_act a global. I tried that, and saw a 5% performance hit in a non-yylineno scanner, because yy_act is normally declared as a register variable– so it is not worth it.

Definition at line 431 of file lexer.c.

◆ YY_LINENO_REWIND_TO

#define YY_LINENO_REWIND_TO (   dst)
Value:
do {\
const char *p;\
for ( p = yy_cp-1; p >= (dst); --p)\
if ( *p == '\n' )\
}while(0)

Definition at line 438 of file lexer.c.

◆ yy_load_buffer_state

#define yy_load_buffer_state (   void)    splitc__load_buffer_state

Definition at line 15 of file lexer.c.

Referenced by if().

◆ YY_MORE_ADJ

#define YY_MORE_ADJ   0

Definition at line 1010 of file lexer.c.

◆ yy_new_buffer

#define yy_new_buffer   yy_create_buffer

Definition at line 581 of file lexer.c.

◆ YY_NEW_FILE

#define YY_NEW_FILE   yyrestart( yyin )

Special action meaning "start processing a new file".

Definition at line 386 of file lexer.c.

◆ YY_NO_INPUT

#define YY_NO_INPUT   1
Id
lexer.l 23366 2017-02-03 16:21:23Z coelho

Definition at line 1065 of file lexer.c.

◆ YY_NULL

#define YY_NULL   0

Returned upon end-of-file.

Definition at line 365 of file lexer.c.

◆ YY_NUM_RULES

#define YY_NUM_RULES   72

Definition at line 632 of file lexer.c.

◆ YY_READ_BUF_SIZE

#define YY_READ_BUF_SIZE   8192

Amount of stuff to slurp up with each read.

Definition at line 1393 of file lexer.c.

◆ YY_RESTORE_YY_MORE_OFFSET

#define YY_RESTORE_YY_MORE_OFFSET

Definition at line 1011 of file lexer.c.

◆ YY_RULE_SETUP

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

Definition at line 1484 of file lexer.c.

◆ YY_SC_TO_UI

#define YY_SC_TO_UI (   c)    ((YY_CHAR) (c))

Promotes a possibly negative, possibly signed char to an integer in range [0..255] for use as an array index.

Definition at line 370 of file lexer.c.

◆ yy_scan_buffer

#define yy_scan_buffer   splitc__scan_buffer

Definition at line 10 of file lexer.c.

◆ yy_scan_bytes

#define yy_scan_bytes   splitc__scan_bytes

Definition at line 12 of file lexer.c.

◆ yy_scan_string

#define yy_scan_string   splitc__scan_string

Definition at line 11 of file lexer.c.

◆ yy_set_bol

#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_CURRENT_BUFFER
We provide macros for accessing buffer states in case in the future we want to put the buffer states ...
Definition: lexer.c:537
#define YY_BUF_SIZE
Size of default input buffer.
Definition: lexer.c:398

Definition at line 591 of file lexer.c.

◆ yy_set_interactive

#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; \
}

Definition at line 582 of file lexer.c.

◆ YY_START

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

Translate the current start state into a value that can be later handed to BEGIN to return to the state.

The YYSTATE alias is for lex compatibility.

Definition at line 381 of file lexer.c.

◆ YY_START_STACK_INCR

#define YY_START_STACK_INCR   25

Number of entries by which start-condition stack grows.

Definition at line 1451 of file lexer.c.

◆ YY_STATE_BUF_SIZE

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

ia64

The state buf must be large enough to hold one state per character in the main buffer.

Definition at line 404 of file lexer.c.

◆ YY_STATE_EOF

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

Action number for EOF rule of a given start state.

Definition at line 384 of file lexer.c.

◆ YY_STRUCT_YY_BUFFER_STATE

#define YY_STRUCT_YY_BUFFER_STATE

Definition at line 462 of file lexer.c.

◆ yy_switch_to_buffer

#define yy_switch_to_buffer   splitc__switch_to_buffer

Definition at line 16 of file lexer.c.

◆ YY_TYPEDEF_YY_BUFFER_STATE

#define YY_TYPEDEF_YY_BUFFER_STATE

Definition at line 407 of file lexer.c.

◆ YY_TYPEDEF_YY_SIZE_T

#define YY_TYPEDEF_YY_SIZE_T

Definition at line 412 of file lexer.c.

◆ YY_USER_ACTION

#define YY_USER_ACTION   update_csplit_file_offset_information();

To track current file position:

Definition at line 1091 of file lexer.c.

◆ yyalloc

#define yyalloc   splitc_alloc

Definition at line 29 of file lexer.c.

◆ yyconst

#define yyconst   const

! C99

! FLEXINT_H begin standard C++ headers. TODO: this is always defined, so inline it

Definition at line 356 of file lexer.c.

◆ yyensure_buffer_stack

#define yyensure_buffer_stack (   void)    splitc_ensure_buffer_stack

Definition at line 19 of file lexer.c.

Referenced by if().

◆ yyfree

#define yyfree   splitc_free

Definition at line 31 of file lexer.c.

◆ yyget_debug

#define yyget_debug (   void)    splitc_get_debug

Definition at line 146 of file lexer.c.

◆ yyget_extra

#define yyget_extra (   void)    splitc_get_extra

Definition at line 158 of file lexer.c.

◆ yyget_in

#define yyget_in (   void)    splitc_get_in

Definition at line 170 of file lexer.c.

◆ yyget_leng

#define yyget_leng (   void)    splitc_get_leng

Definition at line 194 of file lexer.c.

◆ yyget_lineno

#define yyget_lineno (   void)    splitc_get_lineno

Definition at line 206 of file lexer.c.

◆ yyget_out

#define yyget_out (   void)    splitc_get_out

Definition at line 182 of file lexer.c.

◆ yyget_text

#define yyget_text (   void)    splitc_get_text

Definition at line 200 of file lexer.c.

◆ yyin

#define yyin   splitc_in

Definition at line 21 of file lexer.c.

◆ yyleng

#define yyleng   splitc_leng

Definition at line 22 of file lexer.c.

◆ yyless [1/2]

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

Return all but the first "n" matched characters back to the input stream.

Definition at line 447 of file lexer.c.

◆ yyless [2/2]

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

Return all but the first "n" matched characters back to the input stream.

Definition at line 447 of file lexer.c.

◆ yylex

#define yylex (   void)    splitc_lex

Definition at line 23 of file lexer.c.

◆ yylex_destroy

#define yylex_destroy (   void)    splitc_lex_destroy

Accessor methods to globals.

These are made visible to non-reentrant scanners for convenience.

Definition at line 140 of file lexer.c.

◆ yylex_init

#define yylex_init   splitc_lex_init

Definition at line 128 of file lexer.c.

◆ yylex_init_extra

#define yylex_init_extra   splitc_lex_init_extra

Definition at line 134 of file lexer.c.

◆ yylineno

#define yylineno   splitc_lineno

Definition at line 24 of file lexer.c.

◆ yymore

#define yymore ( )    yymore_used_but_not_detected

Definition at line 1009 of file lexer.c.

◆ yynoreturn

#define yynoreturn

Definition at line 361 of file lexer.c.

◆ yyout

#define yyout   splitc_out

Definition at line 25 of file lexer.c.

◆ yypop_buffer_state

#define yypop_buffer_state (   void)    splitc_pop_buffer_state

Definition at line 18 of file lexer.c.

◆ yypush_buffer_state

#define yypush_buffer_state   splitc_push_buffer_state

Definition at line 17 of file lexer.c.

◆ yyrealloc

#define yyrealloc   splitc_realloc

Definition at line 30 of file lexer.c.

◆ yyrestart

#define yyrestart   splitc_restart

Definition at line 26 of file lexer.c.

◆ yyset_debug

#define yyset_debug   splitc_set_debug

Definition at line 152 of file lexer.c.

◆ yyset_extra

#define yyset_extra   splitc_set_extra

Definition at line 164 of file lexer.c.

◆ yyset_in

#define yyset_in   splitc_set_in

Definition at line 176 of file lexer.c.

◆ yyset_lineno

#define yyset_lineno   splitc_set_lineno

Definition at line 212 of file lexer.c.

◆ yyset_out

#define yyset_out   splitc_set_out

Definition at line 188 of file lexer.c.

◆ YYSTATE

#define YYSTATE   YY_START

Definition at line 382 of file lexer.c.

◆ YYTABLES_NAME

#define YYTABLES_NAME   "yytables"

◆ yyterminate

#define yyterminate ( )    return YY_NULL

No semi-colon after return; correct usage is to write "yyterminate();" - we don't want an extra ';' after the "return" because that will cause some compilers to complain about unreachable statements.

Definition at line 1446 of file lexer.c.

◆ yytext

#define yytext   splitc_text

Definition at line 27 of file lexer.c.

◆ yytext_ptr

#define yytext_ptr   yytext

Definition at line 616 of file lexer.c.

◆ yywrap

#define yywrap (   void)    splitc_wrap

Macros after this point can all be overridden by user definitions in section 1.

Definition at line 28 of file lexer.c.

Typedef Documentation

◆ flex_int16_t

typedef short int flex_int16_t

Definition at line 310 of file lexer.c.

◆ flex_int32_t

typedef int flex_int32_t

Definition at line 311 of file lexer.c.

◆ flex_int8_t

typedef signed char flex_int8_t

C99 systems have <inttypes.h>.

Non-C99 systems may or may not.

Definition at line 309 of file lexer.c.

◆ flex_uint16_t

typedef unsigned short int flex_uint16_t

Definition at line 313 of file lexer.c.

◆ flex_uint32_t

typedef unsigned int flex_uint32_t

Definition at line 314 of file lexer.c.

◆ flex_uint8_t

typedef unsigned char flex_uint8_t

Definition at line 312 of file lexer.c.

◆ YY_BUFFER_STATE

Definition at line 408 of file lexer.c.

◆ YY_CHAR

Begin user sect3.

Definition at line 603 of file lexer.c.

◆ yy_size_t

typedef size_t yy_size_t

Definition at line 413 of file lexer.c.

◆ yy_state_type

typedef int yy_state_type

Definition at line 607 of file lexer.c.

Enumeration Type Documentation

◆ gather_comment_state_t

A state-machine to gather the trailing comments of a statement with an heuristic to decide if some comments and spaces will go into the previous or next top-level construct:

Enumerator
PUT_IN_NEXT_TOP_LEVEL_CONSTRUCT 

Normal mode: comments and spaces are associated to the top-level construct to encounter:

GATHER_SPACES 

We gather only spaces in the previous top-level construct.

GATHER_COMMENT 

We gather comments in the previous top-level construct.

Definition at line 1101 of file lexer.c.

1101  {
1102  PUT_IN_NEXT_TOP_LEVEL_CONSTRUCT, /**< Normal mode: comments and spaces
1103  are associated to the top-level
1104  construct to encounter: */
1105  GATHER_SPACES, /**< We gather only spaces in the previous top-level
1106  construct */
1107  GATHER_COMMENT, /**< We gather comments in the previous top-level construct */
1108 };
@ GATHER_COMMENT
We gather comments in the previous top-level construct.
Definition: lexer.c:1107
@ GATHER_SPACES
We gather only spaces in the previous top-level construct.
Definition: lexer.c:1105
@ PUT_IN_NEXT_TOP_LEVEL_CONSTRUCT
Normal mode: comments and spaces are associated to the top-level construct to encounter:
Definition: lexer.c:1102

Function Documentation

◆ gdb_marker()

static void gdb_marker ( )
static

Just to be able to set an easy breakpoint

Definition at line 1116 of file lexer.c.

1117 {
1118 /* Just to be able to set an easy breakpoint */
1119 ;
1120 }

◆ get_csplit_current_beginning()

int get_csplit_current_beginning ( void  )

Definition at line 1190 of file lexer.c.

1191 {
1192  return csplit_current_beginning;
1193 }
static int csplit_current_beginning
Definition: lexer.c:1134

References csplit_current_beginning.

◆ get_csplit_file_offset_beginning()

size_t get_csplit_file_offset_beginning ( void  )

Get the file position in the file to split where the current function begins:

Definition at line 1205 of file lexer.c.

1205  {
1207 }
size_t csplit_file_offset_beginning
Definition: lexer.c:1093

References csplit_file_offset_beginning.

◆ get_current_csplit_file_offset()

size_t get_current_csplit_file_offset ( void  )

Get the current file position in the file to split:

Definition at line 1211 of file lexer.c.

1211  {
1213 }
size_t current_csplit_file_offset
Definition: lexer.c:1092

References current_csplit_file_offset.

◆ get_user_current_beginning()

int get_user_current_beginning ( void  )

Get the current line number in the file to split from the user point of view (before preprocessor expansion):

Definition at line 1198 of file lexer.c.

1198  {
1199  return user_current_beginning;
1200 }
static int user_current_beginning
Definition: lexer.c:1135

References user_current_beginning.

◆ if()

if ( yy_init)

first start state

Definition at line 1498 of file lexer.c.

1499  {
1500  (yy_init) = 1;
1501 
1502 #ifdef YY_USER_INIT
1503  YY_USER_INIT;
1504 #endif
1505 
1506  if ( ! (yy_start) )
1507  (yy_start) = 1; /* first start state */
1508 
1509  if ( ! yyin )
1510  yyin = stdin;
1511 
1512  if ( ! yyout )
1513  yyout = stdout;
1514 
1515  if ( ! YY_CURRENT_BUFFER ) {
1519  }
1520 
1522  }
#define yy_load_buffer_state
Definition: lexer.c:15
static int yy_start
whether we need to initialize
Definition: lexer.c:553
#define yyout
Definition: lexer.c:25
#define yyensure_buffer_stack
Definition: lexer.c:19
#define yy_create_buffer
A lexical scanner generated by flex.
Definition: lexer.c:8
static int yy_init
Definition: lexer.c:552

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

◆ is_c_preprocessor_keyword_typedef()

static int is_c_preprocessor_keyword_typedef ( char *  id)
static

See if id is a keyword, a typedef or an identifier.

Returns the token number for keywords and typedefs. Returns 0 for variable identifiers.

No need to bother for scopes when dealing with C keywords, but do not take into account top-level typedefs which may be masked.

Check again for a global typedef

FI: we bet here that "extern foo(t1, t2, t3);" with t1, t2 and t3 named type is not possible:-(

Definition at line 1250 of file lexer.c.

1251 {
1252  /* No need to bother for scopes when dealing with C keywords,
1253  * but do not take into account top-level typedefs which may be masked.
1254  */
1255  int t = is_c_keyword_typedef(id);
1256  if(t==0 || t==TK_NAMED_TYPE) {
1257  // id may be a keyword, but scopes must be used
1258  string sn = get_preprocessor_current_scope();
1259  string scoped_id = strdup(concatenate(id, "%", sn, NULL));
1260  t = is_c_keyword_typedef(scoped_id);
1261  free(scoped_id);
1262  if(t == 0) {
1263  int i, n = preprocessor_scope_number();
1264  for(i=2; i<=n && t==0; i++) {
1266  scoped_id = strdup(concatenate(id, "%", sn, NULL));
1267  t = is_c_keyword_typedef(scoped_id);
1268  ifdebug(1) {
1269  if(t==TK_NAMED_TYPE)
1270  fprintf(stderr, "Token \"%s\" identified as TK_NAMED_TYPE.\n",
1271  scoped_id);
1272  }
1273  free(scoped_id);
1274  }
1275  /* Check again for a global typedef */
1276  t = is_c_keyword_typedef(id);
1277  }
1278  }
1279  /* FI: we *bet* here that "extern foo(t1, t2, t3);"
1280  * with t1, t2 and t3 named type is not possible:-(
1281  */
1282 #define TK_TYPE_P(tk) \
1283  ((tk)==TK_CHAR || (tk)==TK_INT || \
1284  (tk)==TK_DOUBLE || (tk)==TK_FLOAT || (tk)==TK_COMPLEX || \
1285  (tk)==TK_ENUM || (tk)==TK_STRUCT || (tk)==TK_UNION || \
1286  (tk)==TK_SIGNED|| (tk)==TK_UNSIGNED|| (tk)==TK_LONG|| (tk)==TK_SHORT ||\
1287  (tk)==TK_RETURN)
1288  if(t==TK_NAMED_TYPE
1291  // Identifier
1292  t = 0;
1293  pips_debug(1, "Token \"%s\" is in fact assumed to be an identifier.\n",
1294  id);
1295  }
1297  if(t==TK_STATIC && bracket_depth>0)
1298  t = TK_STATIC_DIMENSION;
1299  return t;
1300 }
void free(void *)
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
static int bracket_depth
To track nesting in brackets.
Definition: lexer.c:1096
static int previous_keyword_token
Definition: lexer.c:1240
#define TK_TYPE_P(tk)
string get_preprocessor_nth_scope(int)
Definition: splitc.c:339
int preprocessor_scope_number(void)
Definition: splitc.c:345
string get_preprocessor_current_scope(void)
Definition: splitc.c:327
_int is_c_keyword_typedef(char *)
This function checks if s is a C keyword or typedef name and returns the token number thanks to the h...
Definition: static.c:297
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
char * strdup()
#define ifdebug(n)
Definition: sg.c:47
#define TK_STATIC
Definition: splitc.c:782
#define TK_STATIC_DIMENSION
Definition: splitc.c:788
#define TK_NAMED_TYPE
Definition: splitc.c:760

References bracket_depth, concatenate(), fprintf(), free(), get_preprocessor_current_scope(), get_preprocessor_nth_scope(), ifdebug, is_c_keyword_typedef(), pips_debug, preprocessor_scope_number(), previous_keyword_token, strdup(), TK_NAMED_TYPE, TK_STATIC, TK_STATIC_DIMENSION, and TK_TYPE_P.

+ Here is the call graph for this function:

◆ lf_count()

static int lf_count ( string  s)
static

Definition at line 1223 of file lexer.c.

1224 {
1225  string cs = s;
1226  int count = 0;
1227 
1228  while(*cs) {
1229  if(*cs=='\n') count++;
1230  cs++;
1231  }
1232  return count;
1233 }
static int count
Definition: SDG.c:519

References count.

◆ reset_csplit_current_beginning()

void reset_csplit_current_beginning ( void  )

This function is called at the end of any top-level C construct:

Snapshot the current file position as a potential function begin:

Aggregate following spaces and comments on the sameline to the previous top-level construct:

FI: I'm not ready to abort() here...

Definition at line 1152 of file lexer.c.

1153 {
1154  int leaked = 0;
1155 
1156  csplit_current_beginning = 1000000;
1157  user_current_beginning = 1000000;
1158  csplit_is_static_p = false;
1159 
1160  /* Snapshot the current file position as a potential function begin: */
1162 
1163  /* Aggregate following spaces and comments on the sameline to the
1164  previous top-level construct: */
1166 
1167 
1171 
1175 
1179 
1183 
1184  if((leaked=check_signature_balance())!=0) {
1185  /* FI: I'm not ready to abort() here... */
1186  pips_debug(5, "Likely memory leaks: %d\n", leaked);
1187  }
1188 }
#define string_undefined
Definition: newgen_types.h:40
#define string_undefined_p(s)
Definition: newgen_types.h:41
enum gather_comment_state_t gather_comment_state_machine
Indeed it does not work since csplit_copy() is called from splitc.y when a function definition is fou...
Definition: lexer.c:1113
string csplit_current_function_name
to know if this is the declaration of a function or not, to distinguish between a static variable and...
Definition: splitc.c:123
bool csplit_is_static_p
static int enum_counter = 0;
Definition: splitc.c:143
string csplit_definite_function_signature
Definition: splitc.c:126
string csplit_definite_function_name
Definition: splitc.c:125
int check_signature_balance(void)
Definition: splitc.c:524
string csplit_current_function_name2
Definition: splitc.c:124

References check_signature_balance(), csplit_current_beginning, csplit_current_function_name, csplit_current_function_name2, csplit_definite_function_name, csplit_definite_function_signature, csplit_file_offset_beginning, csplit_is_static_p, current_csplit_file_offset, free(), GATHER_COMMENT, gather_comment_state_machine, pips_debug, string_undefined, string_undefined_p, and user_current_beginning.

+ Here is the call graph for this function:

◆ reset_csplit_line_number()

void reset_csplit_line_number ( void  )

Reinitialise global position numbers for a new file.

Definition at line 1124 of file lexer.c.

1125 {
1126  csplit_line_number = 1;
1127  user_line_number = 1;
1131  bracket_depth = 0;
1132 }
int csplit_line_number
To be exported to the parser for splitting the preprocessed file.
Definition: lexer.c:1085
int user_line_number
To be exported to the parser for error messages related to the user file.
Definition: lexer.c:1087

References bracket_depth, csplit_file_offset_beginning, csplit_line_number, current_csplit_file_offset, gather_comment_state_machine, PUT_IN_NEXT_TOP_LEVEL_CONSTRUCT, and user_line_number.

Referenced by csplit_error_handler(), and csplit_reset().

+ Here is the caller graph for this function:

◆ update_csplit_current_beginning()

static void update_csplit_current_beginning ( )
static

If we encounter a possible function begin, just snapshot the position of the function beginning:

From now, the comments and spaces are associated to the current top-level construct:

Definition at line 1140 of file lexer.c.

1140  {
1145  /* From now, the comments and spaces are associated to the current
1146  top-level construct: */
1148 }

References csplit_current_beginning, csplit_line_number, gather_comment_state_machine, PUT_IN_NEXT_TOP_LEVEL_CONSTRUCT, user_current_beginning, and user_line_number.

◆ update_csplit_file_offset_information()

void update_csplit_file_offset_information ( void  )

Function called each time a token is read to trac file position information:

Definition at line 1218 of file lexer.c.

1218  {
1220 }

References current_csplit_file_offset, and yyleng.

◆ yy_create_buffer()

YY_BUFFER_STATE yy_create_buffer ( FILE *  file,
int  size 
)

◆ yy_delete_buffer()

void yy_delete_buffer ( YY_BUFFER_STATE  b)

◆ yy_fatal_error()

static void yynoreturn yy_fatal_error ( const char *  msg)
static

◆ yy_flush_buffer()

void yy_flush_buffer ( YY_BUFFER_STATE  b)

◆ yy_get_next_buffer()

static int yy_get_next_buffer ( void  )
static

◆ yy_get_previous_state()

static yy_state_type yy_get_previous_state ( void  )
static

◆ yy_init_buffer()

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

◆ yy_init_globals()

static int yy_init_globals ( void  )
static

◆ yy_scan_buffer()

YY_BUFFER_STATE yy_scan_buffer ( char *  base,
yy_size_t  size 
)

◆ yy_scan_bytes()

YY_BUFFER_STATE yy_scan_bytes ( const char *  bytes,
int  len 
)

◆ yy_scan_string()

YY_BUFFER_STATE yy_scan_string ( const char *  yy_str)

◆ yy_switch_to_buffer()

void yy_switch_to_buffer ( YY_BUFFER_STATE  new_buffer)

◆ yy_try_NUL_trans()

static yy_state_type yy_try_NUL_trans ( yy_state_type  current_state)
static

◆ yyalloc()

void* yyalloc ( yy_size_t  )

◆ yyfree()

void yyfree ( void *  )

◆ yypush_buffer_state()

void yypush_buffer_state ( YY_BUFFER_STATE  new_buffer)

◆ yyrealloc()

void* yyrealloc ( void *  ,
yy_size_t   
)

◆ yyrestart()

void yyrestart ( FILE *  input_file)

◆ yyset_debug()

void yyset_debug ( int  debug_flag)

◆ yyset_extra()

void yyset_extra ( YY_EXTRA_TYPE  user_defined)

◆ yyset_in()

void yyset_in ( FILE *  _in_str)

◆ yyset_lineno()

void yyset_lineno ( int  _line_number)

◆ yyset_out()

void yyset_out ( FILE *  _out_str)

Variable Documentation

◆ bracket_depth

int bracket_depth = 0
static

To track nesting in brackets.

Definition at line 1096 of file lexer.c.

Referenced by is_c_preprocessor_keyword_typedef(), and reset_csplit_line_number().

◆ csplit_current_beginning

int csplit_current_beginning = 1000000
static

◆ csplit_file_offset_beginning

size_t csplit_file_offset_beginning = 0

◆ csplit_line_number

int csplit_line_number = 1

To be exported to the parser for splitting the preprocessed file.

Definition at line 1085 of file lexer.c.

Referenced by csplit_parser_warning_alist(), reset_csplit_line_number(), and update_csplit_current_beginning().

◆ current_csplit_file_offset

◆ gather_comment_state_machine

enum gather_comment_state_t gather_comment_state_machine = PUT_IN_NEXT_TOP_LEVEL_CONSTRUCT

Indeed it does not work since csplit_copy() is called from splitc.y when a function definition is found and thus we cannot gather the comment in it...

:-(

Definition at line 1096 of file lexer.c.

Referenced by reset_csplit_current_beginning(), reset_csplit_line_number(), and update_csplit_current_beginning().

◆ previous_keyword_token

int previous_keyword_token = TOKEN_UNDEFINED
static

Definition at line 1240 of file lexer.c.

Referenced by is_c_preprocessor_keyword_typedef().

◆ user_current_beginning

int user_current_beginning = 1000000
static

◆ user_line_number

int user_line_number = 1

To be exported to the parser for error messages related to the user file.

Definition at line 1087 of file lexer.c.

Referenced by c_parser_error(), reset_csplit_line_number(), and update_csplit_current_beginning().

◆ yy_accept

const flex_int16_t yy_accept[271]
static

Definition at line 641 of file lexer.c.

◆ yy_act

int yy_act

Definition at line 1496 of file lexer.c.

◆ yy_base

const flex_int16_t yy_base[316]
static

Definition at line 717 of file lexer.c.

◆ yy_bp

char * yy_bp

Definition at line 1495 of file lexer.c.

◆ yy_buffer_stack

YY_BUFFER_STATE* yy_buffer_stack = NULL
static

Stack as an array.

Definition at line 529 of file lexer.c.

◆ yy_buffer_stack_max

size_t yy_buffer_stack_max = 0
static

capacity of stack.

Definition at line 528 of file lexer.c.

◆ yy_buffer_stack_top

size_t yy_buffer_stack_top = 0
static

!YY_STRUCT_YY_BUFFER_STATE

Stack of input buffers. index of top of stack.

Definition at line 527 of file lexer.c.

◆ yy_c_buf_p

char* yy_c_buf_p = NULL
static

Points to current character in buffer.

Definition at line 551 of file lexer.c.

◆ yy_chk

const flex_int16_t yy_chk[860]
static

Definition at line 893 of file lexer.c.

◆ yy_cp

char* yy_cp

Definition at line 1495 of file lexer.c.

◆ YY_DECL

YY_DECL
Initial value:
{
yy_state_type yy_current_state
int yy_state_type
Definition: genread_lex.c:588

The main scanner function which does all the work.

Definition at line 1492 of file lexer.c.

◆ yy_def

const flex_int16_t yy_def[316]
static

Definition at line 756 of file lexer.c.

◆ yy_did_buffer_switch_on_eof

int yy_did_buffer_switch_on_eof
static

start state number

Flag which is used to allow yywrap()'s to do buffer switches instead of setting up a fresh yyin. A bit of a hack ...

Definition at line 558 of file lexer.c.

◆ yy_ec

const YY_CHAR yy_ec[256]
static

Definition at line 674 of file lexer.c.

◆ yy_flex_debug

int yy_flex_debug = 0

Definition at line 1003 of file lexer.c.

◆ yy_hold_char

char yy_hold_char
static

yy_hold_char holds the character lost when yytext is formed.

Definition at line 546 of file lexer.c.

◆ yy_init

int yy_init = 0
static

Definition at line 552 of file lexer.c.

Referenced by if().

◆ yy_last_accepting_cpos

char* yy_last_accepting_cpos
static

Definition at line 1000 of file lexer.c.

◆ yy_last_accepting_state

yy_state_type yy_last_accepting_state
static

Definition at line 999 of file lexer.c.

◆ yy_meta

const YY_CHAR yy_meta[65]
static
Initial value:
=
{ 0,
1, 1, 2, 1, 3, 1, 1, 1, 4, 1,
1, 1, 1, 1, 1, 5, 1, 6, 6, 7,
1, 1, 1, 1, 1, 3, 7, 7, 7, 8,
9, 9, 10, 8, 1, 3, 1, 1, 8, 6,
6, 7, 7, 6, 8, 8, 8, 9, 8, 11,
8, 9, 8, 11, 8, 11, 10, 11, 11, 8,
1, 1, 1, 1
}

Definition at line 706 of file lexer.c.

◆ yy_n_chars

int yy_n_chars
static

Definition at line 547 of file lexer.c.

◆ yy_nxt

const flex_int16_t yy_nxt[860]
static

Definition at line 795 of file lexer.c.

◆ yy_rule_can_match_eol

const flex_int32_t yy_rule_can_match_eol[73]
static
Initial value:
=
{ 0,
1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }

Table of booleans, true if rule could match eol.

Definition at line 992 of file lexer.c.

◆ yy_start

int yy_start = 0
static

whether we need to initialize

Definition at line 553 of file lexer.c.

Referenced by if().

◆ yyin

FILE* yyin

Definition at line 605 of file lexer.c.

◆ yyleng

int yyleng

number of characters read into yy_ch_buf

Definition at line 548 of file lexer.c.

◆ yylineno

int yylineno = 1

Begin user sect3.

Definition at line 610 of file lexer.c.

◆ yyout

FILE * yyout

Definition at line 418 of file lexer.c.

◆ yytext

char* yytext

Definition at line 1012 of file lexer.c.