GNU Octave  4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
octave_base_lexer Class Referenceabstract

#include "lex.h"

Inheritance diagram for octave_base_lexer:
Inheritance graph
Collaboration diagram for octave_base_lexer:
Collaboration graph


class  comment_buffer
class  input_buffer

Public Member Functions

 octave_base_lexer (void)
virtual ~octave_base_lexer (void)
bool at_end_of_buffer (void) const
bool at_end_of_file (void) const
void begin_string (int state)
void clear_start_state (void)
int count_token (int tok)
int count_token_internal (int tok)
tokencurrent_token (void)
virtual void decrement_promptflag (void)=0
void display_start_state (void) const
void display_token (int tok)
void enable_fq_identifier (void)
void fatal_error (const char *msg)
virtual int fill_flex_buffer (char *buf, unsigned int max_size)=0
void finish_comment (octave_comment_elt::comment_type typ)
int flex_yyleng (void)
charflex_yytext (void)
bool fq_identifier_contains_keyword (const std::string &s)
octave_comment_listget_comment (void)
void gripe_language_extension (const std::string &msg)
void gripe_language_extension_continuation (void)
void gripe_language_extension_operator (const std::string &op)
void gripe_single_quote_string (void)
int handle_assign_op (const char *pattern, int tok)
int handle_close_bracket (int bracket_type)
void handle_continuation (void)
int handle_end_of_input (void)
int handle_fq_identifier (void)
int handle_identifier (void)
int handle_language_extension_assign_op (const char *pattern, int tok)
int handle_language_extension_op (const char *pattern, int tok, bool bos=false)
int handle_language_extension_unary_op (int tok, bool bos=false)
int handle_meta_identifier (void)
void handle_number (void)
int handle_op (const char *pattern, int tok, bool bos=false)
int handle_op_internal (int tok, bool bos, bool compat)
int handle_superclass_identifier (void)
int handle_token (const std::string &name, int tok)
int handle_token (int tok, token *tok_val=0)
int handle_unary_op (int tok, bool bos=false)
virtual void increment_promptflag (void)=0
void init (void)
virtual bool input_from_eval_string (void) const
virtual bool input_from_file (void) const
virtual bool input_from_terminal (void) const
virtual std::string input_source (void) const
bool inside_any_object_index (void)
int is_keyword_token (const std::string &s)
virtual bool is_push_lexer (void) const
bool is_variable (const std::string &name)
void lexer_debug (const char *pattern)
bool looking_at_space (void)
bool looks_like_command_arg (void)
void mark_as_variable (const std::string &nm)
void mark_as_variables (const std::list< std::string > &lst)
void mark_previous_token_trailing_space (void)
void maybe_gripe_language_extension_comment (char c)
void maybe_mark_previous_token_as_variable (void)
bool maybe_unput_comma_before_unary_op (int tok)
void maybe_warn_separator_insert (char sep)
void pop_start_state (void)
void prep_for_file (void)
bool previous_token_is_binop (void) const
bool previous_token_is_keyword (void) const
bool previous_token_may_be_command (void) const
int previous_token_value (void) const
bool previous_token_value_is (int tok_val) const
virtual int promptflag (void) const =0
virtual int promptflag (int)=0
void push_start_state (int state)
void push_token (token *)
virtual void reset (void)
int show_token (int tok)
bool space_follows_previous_token (void) const
int start_state (void) const
int text_yyinput (void)
bool whitespace_is_significant (void)
void xunput (char c, char *buf)
void xunput (char c)

Public Attributes

bool at_beginning_of_statement
int block_comment_nesting_level
int braceflag
int bracketflag
int command_arg_paren_count
comment_buffer comment_buf
std::string comment_text
int current_input_column
std::string current_input_line
int defining_func
bool end_of_input
std::string fcn_file_full_name
std::string fcn_file_name
bool force_script
std::string help_text
input_buffer input_buf
int input_line_number
bool looking_at_anon_fcn_args
bool looking_at_decl_list
int looking_at_function_handle
bool looking_at_indirect_ref
bool looking_at_initializer_expression
bool looking_at_matrix_or_assign_lhs
std::list< boollooking_at_object_index
bool looking_at_parameter_list
bool looking_at_return_list
bool looking_for_object_index
int looping
bool maybe_classdef_get_set_method
bbp_nesting_level nesting_level
std::stack< boolparsed_function_name
bool parsing_class_method
bool parsing_classdef
bool parsing_classdef_get_method
bool parsing_classdef_set_method
std::set< std::string > pending_local_variables
bool quote_is_transpose
bool reading_classdef_file
bool reading_fcn_file
bool reading_script_file
void * scanner
int string_column
int string_line
std::string string_text
symbol_table_context symtab_context
size_t token_count
token_cache tokens

Protected Member Functions

 octave_base_lexer (const octave_base_lexer &)
octave_base_lexeroperator= (const octave_base_lexer &)

Protected Attributes

std::stack< intstart_state_stack

Detailed Description

Definition at line 465 of file lex.h.

Constructor & Destructor Documentation

octave_base_lexer::octave_base_lexer ( void  )

Definition at line 539 of file lex.h.

octave_base_lexer::~octave_base_lexer ( void  )

Definition at line 4836 of file

References octave_lex_destroy(), and scanner.

octave_base_lexer::octave_base_lexer ( const octave_base_lexer )

Member Function Documentation

bool octave_base_lexer::at_end_of_buffer ( void  ) const

Definition at line 559 of file lex.h.

Referenced by octave_push_parser::run().

bool octave_base_lexer::at_end_of_file ( void  ) const

Definition at line 561 of file lex.h.

void octave_base_lexer::begin_string ( int  state)
void octave_base_lexer::clear_start_state ( void  )

Definition at line 5893 of file

References INITIAL, push_start_state(), and start_state_stack.

Referenced by init(), and reset().

int octave_base_lexer::count_token ( int  tok)
int octave_base_lexer::count_token_internal ( int  tok)

Definition at line 6048 of file

References show_token(), lexical_feedback::token_count, and Vtoken_count.

Referenced by count_token(), handle_op_internal(), and handle_token().

token * octave_base_lexer::current_token ( void  )

Definition at line 5706 of file

References octave_get_lval(), scanner, and YYSTYPE.

Referenced by display_token().

virtual void octave_base_lexer::decrement_promptflag ( void  )
pure virtual

Implemented in octave_push_lexer, and octave_lexer.

Referenced by handle_continuation(), and is_keyword_token().

void octave_base_lexer::display_start_state ( void  ) const
void octave_base_lexer::display_token ( int  tok)
void octave_base_lexer::enable_fq_identifier ( void  )

Definition at line 6076 of file

References FQ_IDENT_START, and push_start_state().

void octave_base_lexer::fatal_error ( const char msg)

Definition at line 5849 of file

References error(), OCTAVE_QUIT, scanner, and yy_fatal_error().

virtual int octave_base_lexer::fill_flex_buffer ( char buf,
unsigned int  max_size 
pure virtual

Implemented in octave_push_lexer, and octave_lexer.

void octave_base_lexer::finish_comment ( octave_comment_elt::comment_type  typ)
int octave_base_lexer::flex_yyleng ( void  )
char * octave_base_lexer::flex_yytext ( void  )
bool octave_base_lexer::fq_identifier_contains_keyword ( const std::string &  s)
octave_comment_list* octave_base_lexer::get_comment ( void  )

Definition at line 593 of file lex.h.

Referenced by octave_base_parser::make_statement().

void octave_base_lexer::gripe_language_extension ( const std::string &  msg)
void octave_base_lexer::gripe_language_extension_continuation ( void  )

Definition at line 5682 of file

References gripe_language_extension().

Referenced by handle_continuation().

void octave_base_lexer::gripe_language_extension_operator ( const std::string &  op)

Definition at line 5688 of file

References gripe_language_extension().

Referenced by handle_op_internal().

void octave_base_lexer::gripe_single_quote_string ( void  )
int octave_base_lexer::handle_assign_op ( const char pattern,
int  tok 
int octave_base_lexer::handle_close_bracket ( int  bracket_type)
void octave_base_lexer::handle_continuation ( void  )
int octave_base_lexer::handle_end_of_input ( void  )
int octave_base_lexer::handle_fq_identifier ( void  )
int octave_base_lexer::handle_identifier ( void  )
int octave_base_lexer::handle_language_extension_assign_op ( const char pattern,
int  tok 
int octave_base_lexer::handle_language_extension_op ( const char pattern,
int  tok,
bool  bos = false 

Definition at line 5955 of file

References handle_op_internal(), and lexer_debug().

int octave_base_lexer::handle_language_extension_unary_op ( int  tok,
bool  bos = false 

Definition at line 5994 of file

References handle_op_internal(), and maybe_unput_comma_before_unary_op().

int octave_base_lexer::handle_meta_identifier ( void  )
void octave_base_lexer::handle_number ( void  )
int octave_base_lexer::handle_op ( const char pattern,
int  tok,
bool  bos = false 

Definition at line 5947 of file

References handle_op_internal(), and lexer_debug().

int octave_base_lexer::handle_op_internal ( int  tok,
bool  bos,
bool  compat 
int octave_base_lexer::handle_superclass_identifier ( void  )
int octave_base_lexer::handle_token ( const std::string &  name,
int  tok 
int octave_base_lexer::handle_token ( int  tok,
token tok_val = 0 
int octave_base_lexer::handle_unary_op ( int  tok,
bool  bos = false 

Definition at line 5987 of file

References handle_op_internal(), and maybe_unput_comma_before_unary_op().

virtual void octave_base_lexer::increment_promptflag ( void  )
pure virtual

Implemented in octave_push_lexer, and octave_lexer.

void octave_base_lexer::init ( void  )

Definition at line 4842 of file

References clear_start_state(), octave_lex_init(), octave_set_extra(), and scanner.

virtual bool octave_base_lexer::input_from_eval_string ( void  ) const

Reimplemented in octave_lexer.

Definition at line 652 of file lex.h.

Referenced by reset().

virtual bool octave_base_lexer::input_from_file ( void  ) const

Reimplemented in octave_lexer.

Definition at line 650 of file lex.h.

Referenced by is_keyword_token().

virtual bool octave_base_lexer::input_from_terminal ( void  ) const

Reimplemented in octave_lexer.

Definition at line 648 of file lex.h.

virtual std::string octave_base_lexer::input_source ( void  ) const

Reimplemented in octave_push_lexer, and octave_lexer.

Definition at line 646 of file lex.h.

bool octave_base_lexer::inside_any_object_index ( void  )

Definition at line 5004 of file

References lexical_feedback::looking_at_object_index.

Referenced by is_keyword_token().

int octave_base_lexer::is_keyword_token ( const std::string &  s)

Definition at line 5032 of file

References lexical_feedback::at_beginning_of_statement, break_kw, case_kw, catch_kw, token::classdef_end, classdef_kw, continue_kw, lexical_feedback::current_input_column, decrement_promptflag(), lexical_feedback::defining_func, do_kw, else_kw, elseif_kw, end_kw, end_try_catch_kw, end_unwind_protect_kw, endclassdef_kw, endenumeration_kw, endevents_kw, endfor_kw, endfunction_kw, endif_kw, endmethods_kw, endparfor_kw, endproperties_kw, endswitch_kw, endwhile_kw, token::enumeration_end, enumeration_kw, token::events_end, events_kw, lexical_feedback::fcn_file_full_name, token::for_end, for_kw, lexical_feedback::force_script, token::function_end, function_kw, get_kw, global_kw, token::if_end, if_kw, octave_kw_hash::in_word_set(), input_from_file(), lexical_feedback::input_line_number, inside_any_object_index(), octave_kw::kw_id, lexical_feedback::looking_at_decl_list, lexical_feedback::looking_at_return_list, lexical_feedback::looping, magic_file_kw, magic_line_kw, lexical_feedback::maybe_classdef_get_set_method, token::methods_end, methods_kw, otherwise_kw, panic_impossible, token::parfor_end, parfor_kw, lexical_feedback::parsed_function_name, lexical_feedback::parsing_classdef, persistent_kw, token::properties_end, properties_kw, push_token(), lexical_feedback::reading_classdef_file, lexical_feedback::reading_fcn_file, lexical_feedback::reading_script_file, return_kw, set_kw, token::simple_end, token::switch_end, switch_kw, octave_kw::tok, lexical_feedback::token_count, token::try_catch_end, try_kw, until_kw, unwind_protect_cleanup_kw, token::unwind_protect_end, unwind_protect_kw, token::while_end, and while_kw.

Referenced by fq_identifier_contains_keyword(), handle_identifier(), and handle_superclass_identifier().

virtual bool octave_base_lexer::is_push_lexer ( void  ) const

Reimplemented in octave_push_lexer.

Definition at line 549 of file lex.h.

bool octave_base_lexer::is_variable ( const std::string &  name)

Definition at line 5022 of file

References symbol_table::is_variable(), and lexical_feedback::pending_local_variables.

Referenced by handle_identifier().

void octave_base_lexer::lexer_debug ( const char pattern)
bool octave_base_lexer::looking_at_space ( void  )

Definition at line 4996 of file

References text_yyinput(), and xunput().

Referenced by looks_like_command_arg().

bool octave_base_lexer::looks_like_command_arg ( void  )
void lexical_feedback::mark_as_variable ( const std::string &  nm)
void lexical_feedback::mark_as_variables ( const std::list< std::string > &  lst)
void lexical_feedback::mark_previous_token_trailing_space ( void  )
void octave_base_lexer::maybe_gripe_language_extension_comment ( char  c)

Definition at line 5675 of file

References gripe_language_extension().

void lexical_feedback::maybe_mark_previous_token_as_variable ( void  )
bool octave_base_lexer::maybe_unput_comma_before_unary_op ( int  tok)
void octave_base_lexer::maybe_warn_separator_insert ( char  sep)
octave_base_lexer& octave_base_lexer::operator= ( const octave_base_lexer )
void octave_base_lexer::pop_start_state ( void  )

Definition at line 5883 of file

References BEGIN, OCTAVE_YYG, start_state(), and start_state_stack.

Referenced by handle_close_bracket().

void octave_base_lexer::prep_for_file ( void  )

Definition at line 4890 of file

References INPUT_FILE_START, push_start_state(), and lexical_feedback::reading_script_file.

Referenced by parse_fcn_file().

bool lexical_feedback::previous_token_is_binop ( void  ) const
bool lexical_feedback::previous_token_is_keyword ( void  ) const
bool lexical_feedback::previous_token_may_be_command ( void  ) const
int lexical_feedback::previous_token_value ( void  ) const
bool lexical_feedback::previous_token_value_is ( int  tok_val) const
virtual int octave_base_lexer::promptflag ( void  ) const
pure virtual

Implemented in octave_push_lexer, and octave_lexer.

Referenced by reset().

virtual int octave_base_lexer::promptflag ( int  )
pure virtual

Implemented in octave_push_lexer, and octave_lexer.

void octave_base_lexer::push_start_state ( int  state)
void octave_base_lexer::push_token ( token tok)
void octave_base_lexer::reset ( void  )
int octave_base_lexer::show_token ( int  tok)

Definition at line 6060 of file

References display_token(), lexer_debug_flag, and Vdisplay_tokens.

Referenced by count_token_internal().

bool lexical_feedback::space_follows_previous_token ( void  ) const
int octave_base_lexer::start_state ( void  ) const

Definition at line 660 of file lex.h.

Referenced by display_start_state(), pop_start_state(), and push_start_state().

int octave_base_lexer::text_yyinput ( void  )

Definition at line 4937 of file

References display_character(), lexer_debug_flag, scanner, and xunput().

Referenced by looking_at_space(), and maybe_unput_comma_before_unary_op().

bool octave_base_lexer::whitespace_is_significant ( void  )
void octave_base_lexer::xunput ( char  c,
char buf 
void octave_base_lexer::xunput ( char  c)

Definition at line 4988 of file

References flex_yytext(), and xunput().

Member Data Documentation

bool lexical_feedback::at_beginning_of_statement
int lexical_feedback::block_comment_nesting_level

Definition at line 398 of file lex.h.

Referenced by handle_end_of_input(), and lexical_feedback::reset().

int lexical_feedback::braceflag

Definition at line 386 of file lex.h.

Referenced by handle_close_bracket(), and lexical_feedback::reset().

int lexical_feedback::bracketflag

Definition at line 383 of file lex.h.

Referenced by handle_close_bracket(), and lexical_feedback::reset().

int lexical_feedback::command_arg_paren_count

Definition at line 401 of file lex.h.

Referenced by lexical_feedback::reset().

comment_buffer octave_base_lexer::comment_buf
std::string lexical_feedback::comment_text

Definition at line 411 of file lex.h.

Referenced by finish_comment(), handle_continuation(), and lexical_feedback::reset().

int lexical_feedback::current_input_column
std::string lexical_feedback::current_input_line
int lexical_feedback::defining_func
bool lexical_feedback::end_of_input

Definition at line 309 of file lex.h.

Referenced by eval_string(), main_loop(), and lexical_feedback::reset().

std::string lexical_feedback::fcn_file_full_name
std::string lexical_feedback::fcn_file_name
bool lexical_feedback::force_script
std::string lexical_feedback::help_text
input_buffer octave_base_lexer::input_buf

Definition at line 633 of file lex.h.

Referenced by octave_lexer::fill_flex_buffer(), and octave_push_lexer::fill_flex_buffer().

int lexical_feedback::input_line_number
bool lexical_feedback::looking_at_anon_fcn_args

Definition at line 316 of file lex.h.

Referenced by lexical_feedback::reset().

bool lexical_feedback::looking_at_decl_list

Definition at line 326 of file lex.h.

Referenced by is_keyword_token(), and lexical_feedback::reset().

int lexical_feedback::looking_at_function_handle

Definition at line 395 of file lex.h.

Referenced by handle_identifier(), and lexical_feedback::reset().

bool lexical_feedback::looking_at_indirect_ref
bool lexical_feedback::looking_at_initializer_expression

Definition at line 330 of file lex.h.

Referenced by lexical_feedback::reset().

bool lexical_feedback::looking_at_matrix_or_assign_lhs

Definition at line 334 of file lex.h.

Referenced by lexical_feedback::reset().

std::list<bool> lexical_feedback::looking_at_object_index
bool lexical_feedback::looking_at_parameter_list
bool lexical_feedback::looking_at_return_list
bool lexical_feedback::looking_for_object_index
int lexical_feedback::looping
bool lexical_feedback::maybe_classdef_get_set_method

Definition at line 352 of file lex.h.

Referenced by is_keyword_token(), and lexical_feedback::reset().

bbp_nesting_level lexical_feedback::nesting_level
std::stack<bool> lexical_feedback::parsed_function_name
bool lexical_feedback::parsing_class_method
bool lexical_feedback::parsing_classdef

Definition at line 347 of file lex.h.

Referenced by is_keyword_token(), and lexical_feedback::reset().

bool lexical_feedback::parsing_classdef_get_method

Definition at line 355 of file lex.h.

Referenced by lexical_feedback::reset().

bool lexical_feedback::parsing_classdef_set_method

Definition at line 358 of file lex.h.

Referenced by lexical_feedback::reset().

std::set<std::string> lexical_feedback::pending_local_variables
bool lexical_feedback::quote_is_transpose

Definition at line 361 of file lex.h.

bool lexical_feedback::reading_classdef_file
bool lexical_feedback::reading_fcn_file
bool lexical_feedback::reading_script_file
void* octave_base_lexer::scanner
std::stack<int> octave_base_lexer::start_state_stack

Definition at line 695 of file lex.h.

Referenced by clear_start_state(), pop_start_state(), and push_start_state().

int lexical_feedback::string_column

Definition at line 421 of file lex.h.

Referenced by begin_string(), and lexical_feedback::reset().

int lexical_feedback::string_line

Definition at line 420 of file lex.h.

Referenced by begin_string(), and lexical_feedback::reset().

std::string lexical_feedback::string_text

Definition at line 417 of file lex.h.

Referenced by lexical_feedback::reset().

symbol_table_context lexical_feedback::symtab_context
size_t lexical_feedback::token_count

Definition at line 405 of file lex.h.

Referenced by count_token_internal(), is_keyword_token(), and lexical_feedback::reset().

token_cache lexical_feedback::tokens

The documentation for this class was generated from the following files: