#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <cctype>
#include <cstring>
#include <iostream>
#include <set>
#include <sstream>
#include <string>
#include <stack>
#include "cmd-edit.h"
#include "quit.h"
#include "lo-mappers.h"
#include "Cell.h"
#include "comment-list.h"
#include "defun.h"
#include "error.h"
#include "gripes.h"
#include "input.h"
#include "lex.h"
#include "ov.h"
#include "parse.h"
#include "pt-all.h"
#include "symtab.h"
#include "token.h"
#include "toplev.h"
#include "utils.h"
#include "variables.h"
#include <y.tab.h>
#include <oct-gperf.h>
#include <unistd.h>
Classes | |
struct | yy_buffer_state |
struct | yy_trans_info |
class | bracket_brace_paren_nesting_level |
class | flex_stream_reader |
Defines | |
#define | YY_INT_ALIGNED short int |
#define | yy_create_buffer octave__create_buffer |
#define | yy_delete_buffer octave__delete_buffer |
#define | yy_flex_debug octave__flex_debug |
#define | yy_init_buffer octave__init_buffer |
#define | yy_flush_buffer octave__flush_buffer |
#define | yy_load_buffer_state octave__load_buffer_state |
#define | yy_switch_to_buffer octave__switch_to_buffer |
#define | yyin octave_in |
#define | yyleng octave_leng |
#define | yylex octave_lex |
#define | yylineno octave_lineno |
#define | yyout octave_out |
#define | yyrestart octave_restart |
#define | yytext octave_text |
#define | yywrap octave_wrap |
#define | yyalloc octave_alloc |
#define | yyrealloc octave_realloc |
#define | yyfree octave_free |
#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 | 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 octave_restart(octave_in ) |
#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 | 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 octave__flush_buffer(YY_CURRENT_BUFFER ) |
#define | yy_new_buffer octave__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 octave_text |
#define | YY_DO_BEFORE_ACTION |
#define | YY_NUM_RULES 90 |
#define | YY_END_OF_BUFFER 91 |
#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 | yylval octave_lval |
#define | YY_INPUT(buf, result, max_size) |
#define | YY_FATAL_ERROR(msg) |
#define | DISPLAY_TOK_AND_RETURN(tok) |
#define | COUNT_TOK_AND_RETURN(tok) |
#define | TOK_RETURN(tok) |
#define | TOK_PUSH_AND_RETURN(name, tok) |
#define | BIN_OP_RETURN(tok, convert, bos) |
#define | XBIN_OP_RETURN(tok, convert, bos) |
#define | LEXER_DEBUG(pattern) |
#define | INITIAL 0 |
#define | COMMAND_START 1 |
#define | MATRIX_START 2 |
#define | SCRIPT_FILE_BEGIN 3 |
#define | FUNCTION_FILE_BEGIN 4 |
#define | YY_EXTRA_TYPE void * |
#define | YY_READ_BUF_SIZE 8192 |
#define | ECHO do { if (fwrite( octave_text, octave_leng, 1, octave_out )) {} } while (0) |
#define | yyterminate() return YY_NULL |
#define | YY_START_STACK_INCR 25 |
#define | YY_DECL_IS_OURS 1 |
#define | YY_DECL int octave_lex (void) |
#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_state * | YY_BUFFER_STATE |
typedef size_t | yy_size_t |
typedef unsigned char | YY_CHAR |
typedef int | yy_state_type |
typedef int | yum_yum |
Functions | |
void | octave_restart (FILE *input_file) |
void | octave__switch_to_buffer (YY_BUFFER_STATE new_buffer) |
YY_BUFFER_STATE | octave__create_buffer (FILE *file, int size) |
void | octave__delete_buffer (YY_BUFFER_STATE b) |
void | octave__flush_buffer (YY_BUFFER_STATE b) |
void | octave_push_buffer_state (YY_BUFFER_STATE new_buffer) |
void | octave_pop_buffer_state (void) |
YY_BUFFER_STATE | octave__scan_buffer (char *base, yy_size_t size) |
YY_BUFFER_STATE | octave__scan_string (yyconst char *yy_str) |
YY_BUFFER_STATE | octave__scan_bytes (yyconst char *bytes, int len) |
void * | octave_alloc (yy_size_t) |
void * | octave_realloc (void *, yy_size_t) |
void | octave_free (void *) |
int | octave_lex_destroy (void) |
int | octave_get_debug (void) |
void | octave_set_debug (int debug_flag) |
YY_EXTRA_TYPE | octave_get_extra (void) |
void | octave_set_extra (YY_EXTRA_TYPE user_defined) |
FILE * | octave_get_in (void) |
void | octave_set_in (FILE *in_str) |
FILE * | octave_get_out (void) |
void | octave_set_out (FILE *out_str) |
int | octave_get_leng (void) |
char * | octave_get_text (void) |
int | octave_get_lineno (void) |
void | octave_set_lineno (int line_number) |
int | octave_wrap (void) |
int | octave_lex (void) |
if (!(yy_init)) | |
while (1) | |
int | isatty (int) |
void | reset_parser (void) |
YY_BUFFER_STATE | current_buffer (void) |
YY_BUFFER_STATE | create_buffer (FILE *f) |
void | switch_to_buffer (YY_BUFFER_STATE buf) |
void | delete_buffer (YY_BUFFER_STATE buf) |
void | restore_input_buffer (void *buf) |
void | delete_input_buffer (void *buf) |
std::string | grab_comment_block (stream_reader &reader, bool at_bol, bool &eof) |
bool | is_keyword (const std::string &s) |
DEFUN (iskeyword, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} iskeyword (@var{name})\n\ Return true if @var{name} is an Octave keyword. If @var{name}\n\ is omitted, return a list of keywords.\n\ @end deftypefn") | |
void | prep_lexer_for_script_file (void) |
void | prep_lexer_for_function_file (void) |
DEFUN (__display_tokens__, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} __display_tokens__ ()\n\ Query or set the internal variable that determines whether Octave's\n\ lexer displays tokens as they are read.\n\ @end deftypefn") | |
DEFUN (__token_count__,,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} __token_count__ ()\n\ Number of language tokens processed since Octave startup.\n\ @end deftypefn") | |
DEFUN (__lexer_debug_flag__, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {@var{old_val} =} __lexer_debug_flag__ (@var{new_val}))\n\ Undocumented internal function.\n\ @end deftypefn") | |
Variables | |
int | octave_leng |
FILE * | octave_in = (FILE *) 0 |
FILE * | octave_out = (FILE *) 0 |
int | octave_lineno = 1 |
char * | octave_text |
int | octave__flex_debug = 0 |
bool | parser_end_of_input = false |
lexical_feedback | lexer_flags |
std::stack< token * > | token_stack |
const yum_yum | ATE_NOTHING = 0 |
const yum_yum | ATE_SPACE_OR_TAB = 1 |
const yum_yum | ATE_NEWLINE = 2 |
YY_DECL register yy_state_type | yy_current_state |
register char * | yy_cp |
register char * | yy_bp |
register int | yy_act |
#define BEGIN (yy_start) = 1 + 2 * |
#define BIN_OP_RETURN | ( | tok, | |||
convert, | |||||
bos | ) |
Value:
do \ { \ yylval.tok_val = new token (input_line_number, current_input_column); \ token_stack.push (yylval.tok_val); \ current_input_column += octave_leng; \ lexer_flags.quote_is_transpose = false; \ lexer_flags.convert_spaces_to_comma = convert; \ lexer_flags.looking_for_object_index = false; \ lexer_flags.at_beginning_of_statement = bos; \ COUNT_TOK_AND_RETURN (tok); \ } \ while (0)
#define COMMAND_START 1 |
#define COUNT_TOK_AND_RETURN | ( | tok | ) |
Value:
do \ { \ Vtoken_count++; \ DISPLAY_TOK_AND_RETURN (tok); \ } \ while (0)
#define DISPLAY_TOK_AND_RETURN | ( | tok | ) |
Value:
do \ { \ int tok_val = tok; \ if (Vdisplay_tokens) \ display_token (tok_val); \ if (lexer_debug_flag) \ { \ std::cerr << "R: "; \ display_token (tok_val); \ std::cerr << std::endl; \ } \ return tok_val; \ } \ while (0)
#define ECHO do { if (fwrite( octave_text, octave_leng, 1, octave_out )) {} } while (0) |
#define EOB_ACT_CONTINUE_SCAN 0 |
#define EOB_ACT_END_OF_FILE 1 |
#define EOB_ACT_LAST_MATCH 2 |
#define FLEX_BETA |
#define FLEX_SCANNER |
#define FUNCTION_FILE_BEGIN 4 |
#define INITIAL 0 |
#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 LEXER_DEBUG | ( | pattern | ) |
Value:
do \ { \ if (lexer_debug_flag) \ lexer_debug (pattern, octave_text); \ } \ while (0)
#define MATRIX_START 2 |
#define REJECT reject_used_but_not_detected |
#define SCRIPT_FILE_BEGIN 3 |
Value:
do \ { \ yylval.tok_val = new token (name, input_line_number, \ current_input_column); \ token_stack.push (yylval.tok_val); \ TOK_RETURN (tok); \ } \ while (0)
#define TOK_RETURN | ( | tok | ) |
Value:
do \ { \ current_input_column += octave_leng; \ lexer_flags.quote_is_transpose = false; \ lexer_flags.convert_spaces_to_comma = true; \ COUNT_TOK_AND_RETURN (tok); \ } \ while (0)
#define UINT16_MAX (65535U) |
#define UINT32_MAX (4294967295U) |
#define UINT8_MAX (255U) |
#define unput | ( | c | ) | yyunput( c, (yytext_ptr) ) |
#define XBIN_OP_RETURN | ( | tok, | |||
convert, | |||||
bos | ) |
Value:
do \ { \ gripe_matlab_incompatible_operator (octave_text); \ BIN_OP_RETURN (tok, convert, bos); \ } \ while (0)
#define YY_AT_BOL | ( | ) | (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) |
#define YY_BREAK break; |
#define YY_BUF_SIZE 16384 |
#define YY_BUFFER_EOF_PENDING 2 |
#define YY_BUFFER_NEW 0 |
#define YY_BUFFER_NORMAL 1 |
#define yy_create_buffer octave__create_buffer |
#define YY_CURRENT_BUFFER |
Value:
( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL)
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] |
#define YY_DECL int octave_lex (void) |
#define YY_DECL_IS_OURS 1 |
#define yy_delete_buffer octave__delete_buffer |
#define YY_DO_BEFORE_ACTION |
Value:
(yytext_ptr) = yy_bp; \ octave_leng = (size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp;
#define YY_END_OF_BUFFER 91 |
#define YY_END_OF_BUFFER_CHAR 0 |
#define YY_EXIT_FAILURE 2 |
#define YY_EXTRA_TYPE void * |
#define YY_FATAL_ERROR | ( | msg | ) |
Value:
do \ { \ error (msg); \ OCTAVE_QUIT; \ yy_fatal_error (msg); \ } \ while (0)
#define yy_flex_debug octave__flex_debug |
#define YY_FLEX_MAJOR_VERSION 2 |
#define YY_FLEX_MINOR_VERSION 5 |
#define YY_FLEX_SUBMINOR_VERSION 35 |
#define YY_FLUSH_BUFFER octave__flush_buffer(YY_CURRENT_BUFFER ) |
#define yy_flush_buffer octave__flush_buffer |
#define yy_init_buffer octave__init_buffer |
#define YY_INPUT | ( | buf, | |||
result, | |||||
max_size | ) |
Value:
if ((result = octave_read (buf, max_size)) < 0) \ YY_FATAL_ERROR ("octave_read () in flex scanner failed");
#define YY_INT_ALIGNED short int |
#define YY_LESS_LINENO | ( | n | ) |
#define yy_load_buffer_state octave__load_buffer_state |
#define YY_MORE_ADJ 0 |
#define yy_new_buffer octave__create_buffer |
#define YY_NEW_FILE octave_restart(octave_in ) |
#define YY_NULL 0 |
#define YY_NUM_RULES 90 |
#define YY_READ_BUF_SIZE 8192 |
#define YY_RESTORE_YY_MORE_OFFSET |
#define YY_RULE_SETUP |
Value:
if ( octave_leng > 0 ) \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ (octave_text[octave_leng - 1] == '\n'); \ YY_USER_ACTION
#define YY_SC_TO_UI | ( | c | ) | ((unsigned int) (unsigned char) c) |
#define yy_set_bol | ( | at_bol | ) |
Value:
{ \ if ( ! YY_CURRENT_BUFFER ){\ octave_ensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ octave__create_buffer(octave_in,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ }
#define yy_set_interactive | ( | is_interactive | ) |
Value:
{ \ if ( ! YY_CURRENT_BUFFER ){ \ octave_ensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ octave__create_buffer(octave_in,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ }
#define YY_START (((yy_start) - 1) / 2) |
#define YY_START_STACK_INCR 25 |
#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) |
#define yy_switch_to_buffer octave__switch_to_buffer |
#define yyalloc octave_alloc |
#define yyconst |
#define yyfree octave_free |
#define yyin octave_in |
#define yyleng octave_leng |
#define yyless | ( | n | ) |
Value:
do \ { \ /* Undo effects of setting up octave_text. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ octave_text[octave_leng] = (yy_hold_char); \ (yy_c_buf_p) = octave_text + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ octave_leng = yyless_macro_arg; \ } \ while ( 0 )
#define yyless | ( | n | ) |
Value:
do \ { \ /* Undo effects of setting up octave_text. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ 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 octave_text again */ \ } \ while ( 0 )
#define yylex octave_lex |
#define yylineno octave_lineno |
#define yylval octave_lval |
#define yymore | ( | ) | yymore_used_but_not_detected |
#define yyout octave_out |
#define yyrealloc octave_realloc |
#define yyrestart octave_restart |
#define YYSTATE YY_START |
#define YYTABLES_NAME "yytables" |
#define yyterminate | ( | ) | return YY_NULL |
#define yytext octave_text |
#define yytext_ptr octave_text |
#define yywrap octave_wrap |
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 struct yy_buffer_state* YY_BUFFER_STATE |
typedef unsigned char YY_CHAR |
typedef size_t yy_size_t |
typedef int yy_state_type |
YY_BUFFER_STATE create_buffer | ( | FILE * | f | ) |
YY_BUFFER_STATE current_buffer | ( | void | ) |
DEFUN | ( | __lexer_debug_flag__ | , | |
args | , | |||
nargout | ||||
) |
DEFUN | ( | __token_count__ | ) |
DEFUN | ( | __display_tokens__ | , | |
args | , | |||
nargout | ||||
) |
DEFUN | ( | iskeyword | , | |
args | ||||
) |
void delete_buffer | ( | YY_BUFFER_STATE | buf | ) |
void delete_input_buffer | ( | void * | buf | ) |
std::string grab_comment_block | ( | stream_reader & | reader, | |
bool | at_bol, | |||
bool & | eof | |||
) |
if | ( | ! | yy_init | ) |
bool is_keyword | ( | const std::string & | s | ) |
YY_BUFFER_STATE octave__create_buffer | ( | FILE * | file, | |
int | size | |||
) |
Allocate and initialize an input buffer state.
file | A readable stream. | |
size | The character buffer size in bytes. When in doubt, use YY_BUF_SIZE . |
void octave__delete_buffer | ( | YY_BUFFER_STATE | b | ) |
Destroy the buffer.
b | a buffer created with octave__create_buffer() |
void octave__flush_buffer | ( | YY_BUFFER_STATE | b | ) |
Discard all buffered characters. On the next scan, YY_INPUT will be called.
b | the buffer state to be flushed, usually YY_CURRENT_BUFFER . |
YY_BUFFER_STATE octave__scan_buffer | ( | char * | base, | |
yy_size_t | size | |||
) |
Setup the input buffer state to scan directly from a user-specified character buffer.
base | the character buffer | |
size | the size in bytes of the character buffer |
YY_BUFFER_STATE octave__scan_bytes | ( | yyconst char * | yybytes, | |
int | _yybytes_len | |||
) |
Setup the input buffer state to scan the given bytes. The next call to octave_lex() will scan from a copy of bytes.
yybytes | the byte buffer to scan | |
_yybytes_len | the number of bytes in the buffer pointed to by bytes. |
YY_BUFFER_STATE octave__scan_string | ( | yyconst char * | yystr | ) |
Setup the input buffer state to scan a string. The next call to octave_lex() will scan from a copy of str.
yystr | a NUL-terminated string to scan |
void octave__switch_to_buffer | ( | YY_BUFFER_STATE | new_buffer | ) |
Switch to a different input buffer.
new_buffer | The new input buffer. |
void * octave_alloc | ( | yy_size_t | size | ) |
void octave_free | ( | void * | ptr | ) |
int octave_get_debug | ( | void | ) |
YY_EXTRA_TYPE octave_get_extra | ( | void | ) |
FILE * octave_get_in | ( | void | ) |
Get the input stream.
FILE * octave_get_out | ( | void | ) |
Get the output stream.
char * octave_get_text | ( | void | ) |
Get the current token.
int octave_lex | ( | void | ) |
int octave_lex_destroy | ( | void | ) |
void octave_pop_buffer_state | ( | void | ) |
Removes and deletes the top of the stack, if present. The next element becomes the new top.
void octave_push_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.
new_buffer | The new state. |
void * octave_realloc | ( | void * | ptr, | |
yy_size_t | size | |||
) |
void octave_restart | ( | FILE * | input_file | ) |
Immediately switch to a different input stream.
input_file | A readable stream. |
INITIAL
. void octave_set_debug | ( | int | debug_flag | ) |
void octave_set_extra | ( | YY_EXTRA_TYPE | user_defined | ) |
void octave_set_in | ( | FILE * | in_str | ) |
Set the input stream. This does not discard the current input buffer.
in_str | A readable stream. |
void octave_set_out | ( | FILE * | out_str | ) |
int octave_wrap | ( | void | ) |
void prep_lexer_for_function_file | ( | void | ) |
void prep_lexer_for_script_file | ( | void | ) |
void reset_parser | ( | void | ) |
void restore_input_buffer | ( | void * | buf | ) |
void switch_to_buffer | ( | YY_BUFFER_STATE | buf | ) |
while | ( | 1 | ) |
const yum_yum ATE_NEWLINE = 2 |
const yum_yum ATE_NOTHING = 0 |
FILE * octave_in = (FILE *) 0 |
int octave_lineno = 1 |
FILE * octave_out = (FILE *) 0 |
char * octave_text |
bool parser_end_of_input = false |
std::stack<token*> token_stack |
register char * yy_bp |
register char* yy_cp |
YY_DECL register yy_state_type yy_current_state |
The main scanner function which does all the work.