|
scanner.cc File Reference
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <mycc/c/scanner.hh>
#include <ylmm/lexmm.hh>
#include <unistd.h>
Include dependency graph for scanner.cc:
Go to the source code of this file.
|
Classes |
struct | yy_buffer_state |
struct | yy_trans_info |
Defines |
#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 31 |
#define | FLEX_BETA |
#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 | 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_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 93 |
#define | YY_END_OF_BUFFER 94 |
#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 | YLMM_SCANNER_CLASS mycc::c::scanner |
#define | INITIAL 0 |
#define | COMMENT 1 |
#define | YY_EXTRA_TYPE void * |
#define | YY_READ_BUF_SIZE 8192 |
#define | ECHO (void) fwrite( yytext, yyleng, 1, yyout ) |
#define | YY_INPUT(buf, result, max_size) |
#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_BREAK break; |
#define | YY_RULE_SETUP YY_USER_ACTION |
#define | YY_EXIT_FAILURE 2 |
#define | yyless(n) |
#define | YYTABLES_NAME "yytables" |
Typedefs |
typedef signed char | flex_int8_t |
typedef short int | flex_int16_t |
typedef int | flex_int32_t |
typedef unsigned char | flex_uint8_t |
typedef unsigned short int | flex_uint16_t |
typedef unsigned int | flex_uint32_t |
typedef yy_buffer_state * | YY_BUFFER_STATE |
typedef unsigned int | yy_size_t |
typedef unsigned char | YY_CHAR |
typedef int | yy_state_type |
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) |
void | yypop_buffer_state (void) |
void | yyensure_buffer_stack (void) |
void | yy_load_buffer_state (void) |
void | yy_init_buffer (YY_BUFFER_STATE b, FILE *file) |
YY_BUFFER_STATE | yy_scan_buffer (char *base, yy_size_t size) |
YY_BUFFER_STATE | yy_scan_string (char *yy_str) |
YY_BUFFER_STATE | yy_scan_bytes (char *bytes, int len) |
void * | yyalloc (yy_size_t) |
void * | yyrealloc (void *, yy_size_t) |
void | yyfree (void *) |
yy_state_type | yy_get_previous_state (void) |
yy_state_type | yy_try_NUL_trans (yy_state_type current_state) |
int | yy_get_next_buffer (void) |
void | yy_fatal_error (char msg[]) |
int | yywrap (void) |
void | yyunput (int c, char *buf_ptr) |
int | input (void) |
int | yylex (void) |
void | yyunput (int c, register char *yy_bp) |
int | isatty (int) |
void | yy_fatal_error (char *msg) |
int | yyget_lineno (void) |
FILE * | yyget_in (void) |
FILE * | yyget_out (void) |
int | yyget_leng (void) |
char * | yyget_text (void) |
void | yyset_lineno (int line_number) |
void | yyset_in (FILE *in_str) |
void | yyset_out (FILE *out_str) |
int | yyget_debug (void) |
void | yyset_debug (int bdebug) |
int | yylex_destroy (void) |
Variables |
int | yyleng |
FILE * | yyin = (FILE *) 0 *yyout = (FILE *) 0 |
FILE * | yyout |
size_t | yy_buffer_stack_top = 0 |
size_t | yy_buffer_stack_max = 0 |
YY_BUFFER_STATE * | yy_buffer_stack = 0 |
char | yy_hold_char |
int | yy_n_chars |
char * | yy_c_buf_p = (char *) 0 |
int | yy_init = 1 |
int | yy_start = 0 |
int | yy_did_buffer_switch_on_eof |
int | yylineno = 1 |
char * | yytext |
flex_int16_t | yy_accept [248] |
flex_int32_t | yy_ec [256] |
flex_int32_t | yy_meta [64] |
flex_int16_t | yy_base [253] |
flex_int16_t | yy_def [253] |
flex_int16_t | yy_nxt [445] |
flex_int16_t | yy_chk [445] |
yy_state_type | yy_last_accepting_state |
char * | yy_last_accepting_cpos |
int | yy_flex_debug = 0 |
Define Documentation
#define EOB_ACT_CONTINUE_SCAN 0
|
|
#define EOB_ACT_END_OF_FILE 1
|
|
#define EOB_ACT_LAST_MATCH 2
|
|
#define INT16_MAX (32767)
|
|
#define INT16_MIN (-32767-1)
|
|
#define INT32_MAX (2147483647)
|
|
#define INT32_MIN (-2147483647-1)
|
|
#define REJECT reject_used_but_not_detected
|
|
#define UINT16_MAX (65535U)
|
|
#define UINT32_MAX (4294967295U)
|
|
#define unput |
( |
c |
|
) |
yyunput( c, (yytext_ptr) )
|
|
#define YY_AT_BOL |
( |
|
) |
(YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
|
|
#define YY_BUF_SIZE 16384
|
|
#define YY_BUFFER_EOF_PENDING 2
|
|
#define YY_BUFFER_NORMAL 1
|
|
#define YY_CURRENT_BUFFER
|
|
|
Definition at line 261 of file scanner.cc.
Referenced by input(), yy_delete_buffer(), yy_get_next_buffer(), yy_load_buffer_state(), yy_switch_to_buffer(), yylex(), yylex_destroy(), yypop_buffer_state(), yypush_buffer_state(), yyrestart(), and yyunput(). |
#define YY_DECL int yylex (void)
|
|
#define YY_DECL_IS_OURS 1
|
|
#define YY_DO_BEFORE_ACTION
|
|
|
Value: (yytext_ptr) = yy_bp; \
yyleng = (size_t) (yy_cp - yy_bp); \
(yy_hold_char) = *yy_cp; \
*yy_cp = '\0'; \
(yy_c_buf_p) = yy_cp;
Definition at line 347 of file scanner.cc.
Referenced by yylex(). |
#define YY_END_OF_BUFFER 94
|
|
#define YY_END_OF_BUFFER_CHAR 0
|
|
#define YY_EXIT_FAILURE 2
|
|
#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 31
|
|
#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
|
|
#define YY_INPUT |
( |
buf, |
|
|
result, |
|
|
max_size |
|
) |
|
|
|
Value: if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \
int c = '*'; \
size_t 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 = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
{ \
if( errno != EINTR) \
{ \
YY_FATAL_ERROR( "input in flex scanner failed" ); \
break; \
} \
errno=0; \
clearerr(yyin); \
} \
}\
\
Definition at line 714 of file scanner.cc.
Referenced by yy_get_next_buffer(). |
#define YY_INT_ALIGNED short int
|
|
#define YY_LESS_LINENO |
( |
n |
|
) |
|
|
#define yy_new_buffer yy_create_buffer
|
|
#define YY_NEW_FILE yyrestart(yyin )
|
|
#define YY_READ_BUF_SIZE 8192
|
|
#define YY_RESTORE_YY_MORE_OFFSET
|
|
#define YY_RULE_SETUP YY_USER_ACTION
|
|
#define YY_SC_TO_UI |
( |
c |
|
) |
((unsigned int) (unsigned char) c)
|
|
#define yy_set_bol |
( |
at_bol |
|
) |
|
|
#define yy_set_interactive |
( |
is_interactive |
|
) |
|
|
#define YY_START_STACK_INCR 25
|
|
#define YY_STATE_EOF |
( |
state |
|
) |
(YY_END_OF_BUFFER + state + 1)
|
|
|
Value: do \
{ \
\
int yyless_macro_arg = (n); \
YY_LESS_LINENO(yyless_macro_arg);\
yytext[yyleng] = (yy_hold_char); \
(yy_c_buf_p) = yytext + yyless_macro_arg; \
(yy_hold_char) = *(yy_c_buf_p); \
*(yy_c_buf_p) = '\0'; \
yyleng = yyless_macro_arg; \
} \
while ( 0 )
Definition at line 2150 of file scanner.cc. |
#define yymore |
( |
|
) |
yymore_used_but_not_detected
|
|
#define YYTABLES_NAME "yytables"
|
|
#define yyterminate |
( |
|
) |
return YY_NULL
|
|
Typedef Documentation
Function Documentation
int input |
( |
void |
|
) |
[static] |
|
|
Definition at line 1718 of file scanner.cc.
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(). |
Here is the call graph for this function:
Here is the call graph for this function:
Here is the call graph for this function:
void yy_fatal_error |
( |
char * |
msg |
) |
[static] |
|
void yy_fatal_error |
( |
char |
msg[] |
) |
[static] |
|
|
Discard all buffered characters.
On the next scan, YY_INPUT will be called. - Parameters:
-
b | the buffer state to be flushed, usually YY_CURRENT_BUFFER . |
Definition at line 1934 of file scanner.cc.
References yy_buffer_state::yy_at_bol, yy_buffer_state::yy_buf_pos, YY_BUFFER_NEW, YY_BUFFER_STATE, 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(). |
Here is the call graph for this function:
int yy_get_next_buffer |
( |
void |
|
) |
[static] |
|
|
Definition at line 1496 of file scanner.cc.
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_BUFFER_STATE, 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 yylex(). |
Here is the call graph for this function:
|
Definition at line 1622 of file scanner.cc.
References yy_accept, yy_base, yy_c_buf_p, YY_CHAR, yy_chk, yy_def, yy_ec, yy_last_accepting_cpos, yy_last_accepting_state, yy_meta, YY_MORE_ADJ, yy_nxt, YY_SC_TO_UI, yy_start, yy_state_type, and yytext_ptr.
Referenced by yylex(). |
Here is the call graph for this function:
void yy_load_buffer_state |
( |
void |
|
) |
[static] |
|
|
Definition at line 1841 of file scanner.cc.
References yy_c_buf_p, YY_CURRENT_BUFFER_LVALUE, yy_hold_char, yy_n_chars, yyin, and yytext_ptr.
Referenced by yy_flush_buffer(), yy_switch_to_buffer(), yylex(), yypop_buffer_state(), yypush_buffer_state(), and yyrestart(). |
|
Setup the input buffer state to scan directly from a user-specified character buffer.
- Parameters:
-
base | the character buffer |
size | the size in bytes of the character buffer |
- Returns:
- the newly allocated buffer state object.
Definition at line 2057 of file scanner.cc.
References yy_buffer_state::yy_at_bol, yy_buffer_state::yy_buf_pos, yy_buffer_state::yy_buf_size, YY_BUFFER_NEW, YY_BUFFER_STATE, yy_buffer_state::yy_buffer_status, yy_buffer_state::yy_ch_buf, YY_END_OF_BUFFER_CHAR, YY_FATAL_ERROR, yy_buffer_state::yy_fill_buffer, yy_buffer_state::yy_input_file, yy_buffer_state::yy_is_interactive, yy_buffer_state::yy_is_our_buffer, yy_buffer_state::yy_n_chars, yy_switch_to_buffer(), and yyalloc().
Referenced by yy_scan_bytes(). |
Here is the call graph for this function:
Here is the call graph for this function:
|
Setup the input buffer state to scan a string.
The next call to yylex() will scan from a copy of str. - Parameters:
-
str | a NUL-terminated string to scan |
- Returns:
- the newly allocated buffer state object.
- Note:
- If you want to scan bytes that may contain NUL values, then use yy_scan_bytes() instead.
Definition at line 2094 of file scanner.cc.
References YY_BUFFER_STATE, and yy_scan_bytes(). |
Here is the call graph for this function:
Here is the call graph for this function:
|
Definition at line 1654 of file scanner.cc.
References yy_accept, yy_base, yy_c_buf_p, YY_CHAR, yy_chk, yy_def, yy_last_accepting_cpos, yy_last_accepting_state, yy_meta, yy_nxt, and yy_state_type.
Referenced by yylex(). |
void yyensure_buffer_stack |
( |
void |
|
) |
[static] |
|
Here is the call graph for this function:
int yyget_lineno |
( |
void |
|
) |
|
|
char* yyget_text |
( |
void |
|
) |
|
|
|
The main scanner function which does all the work.
Definition at line 794 of file scanner.cc.
References BEGIN, COMMENT, ECHO, EOB_ACT_CONTINUE_SCAN, EOB_ACT_END_OF_FILE, EOB_ACT_LAST_MATCH, INITIAL, yy_accept, yy_base, YY_BREAK, YY_BUF_SIZE, YY_BUFFER_NEW, YY_BUFFER_NORMAL, yy_c_buf_p, YY_CHAR, yy_chk, yy_create_buffer(), YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, YY_DECL, yy_def, yy_did_buffer_switch_on_eof, YY_DO_BEFORE_ACTION, yy_ec, YY_END_OF_BUFFER, YY_FATAL_ERROR, yy_get_next_buffer(), yy_get_previous_state(), yy_hold_char, yy_init, yy_last_accepting_cpos, yy_last_accepting_state, yy_load_buffer_state(), yy_meta, YY_MORE_ADJ, yy_n_chars, YY_NEW_FILE, yy_nxt, YY_RESTORE_YY_MORE_OFFSET, YY_RULE_SETUP, YY_SC_TO_UI, YY_START, yy_start, YY_STATE_EOF, yy_state_type, yy_try_NUL_trans(), yyensure_buffer_stack(), yyin, yyleng, yyout, yyterminate, yytext, yytext_ptr, and yywrap(). |
Here is the call graph for this function:
int yylex_destroy |
( |
void |
|
) |
|
|
Here is the call graph for this function:
void yypop_buffer_state |
( |
void |
|
) |
|
|
Here is the call graph for this function:
Here is the call graph for this function:
void yyrestart |
( |
FILE * |
input_file |
) |
|
|
Here is the call graph for this function:
void yyset_debug |
( |
int |
bdebug |
) |
|
|
void yyset_in |
( |
FILE * |
in_str |
) |
|
|
|
Set the input stream.
This does not discard the current input buffer. - Parameters:
-
in_str | A readable stream. |
- See also:
- yy_switch_to_buffer
Definition at line 2224 of file scanner.cc.
References yyin. |
void yyset_lineno |
( |
int |
line_number |
) |
|
|
void yyset_out |
( |
FILE * |
out_str |
) |
|
|
void yyunput |
( |
int |
c, |
|
|
register char * |
yy_bp |
|
) |
[static] |
|
void yyunput |
( |
int |
c, |
|
|
char * |
buf_ptr |
|
) |
[static] |
|
Variable Documentation
|
Initial value:
{ 0,
0, 0, 0, 0, 94, 92, 91, 91, 79, 92,
85, 78, 92, 73, 74, 83, 82, 70, 81, 77,
84, 39, 39, 71, 67, 86, 72, 87, 90, 36,
36, 75, 76, 88, 36, 36, 36, 36, 36, 36,
36, 36, 36, 36, 36, 36, 36, 36, 36, 68,
89, 69, 80, 3, 93, 3, 66, 0, 44, 0,
52, 69, 61, 53, 0, 0, 50, 58, 48, 59,
49, 60, 0, 42, 1, 51, 43, 38, 0, 39,
0, 39, 76, 68, 75, 57, 63, 65, 64, 56,
36, 0, 0, 54, 36, 36, 36, 36, 36, 36,
11, 36, 36, 36, 36, 36, 36, 19, 36, 36,
36, 36, 36, 36, 36, 36, 36, 36, 36, 55,
62, 2, 40, 45, 0, 42, 42, 0, 43, 38,
0, 41, 37, 47, 46, 36, 36, 36, 36, 36,
36, 36, 36, 36, 36, 36, 17, 36, 20, 36,
36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
36, 36, 36, 36, 0, 42, 0, 42, 0, 43,
41, 37, 4, 36, 6, 7, 36, 36, 36, 36,
13, 14, 36, 36, 18, 21, 36, 36, 36, 36,
36, 36, 36, 36, 36, 36, 36, 33, 36, 36,
0, 42, 5, 8, 36, 36, 36, 36, 16, 36,
36, 24, 36, 36, 36, 36, 36, 36, 31, 36,
36, 35, 36, 36, 12, 15, 36, 23, 25, 26,
27, 28, 29, 36, 36, 36, 36, 10, 36, 30,
36, 36, 9, 22, 32, 34, 0
}
Definition at line 363 of file scanner.cc.
Referenced by yy_get_previous_state(), yy_try_NUL_trans(), and yylex(). |
|
Initial value:
{ 0,
1, 1, 1, 1, 1, 1, 1, 2, 1, 1,
1, 1, 1, 1, 1, 1, 3, 3, 1, 1,
1, 1, 1, 1, 3, 3, 3, 4, 4, 4,
4, 1, 1, 1, 1, 3, 3, 3, 3, 3,
3, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
1, 1, 1
}
Definition at line 426 of file scanner.cc.
Referenced by yy_get_previous_state(), yy_try_NUL_trans(), and yylex(). |
Top of page
Christian Holm
(home page)
Last update Fri Dec 12 14:35:50 2003
Created by DoxyGen 1.3.4
|