GNU Octave  3.8.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 Reference

#include "lex.h"

Inheritance diagram for octave_base_lexer:
Inheritance graph
[legend]
Collaboration diagram for octave_base_lexer:
Collaboration graph
[legend]

Classes

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 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)
octave_comment_listget_comment (void)
void gripe_matlab_incompatible (const std::string &msg)
void gripe_matlab_incompatible_continuation (void)
void gripe_matlab_incompatible_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_identifier (void)
int handle_incompatible_assign_op (const char *pattern, int tok)
int handle_incompatible_op (const char *pattern, int tok, bool bos=false)
int handle_incompatible_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_matlab_incompatible_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
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
std::set< std::string > pending_local_variables
bool quote_is_transpose
bool reading_classdef_file
bool reading_fcn_file
bool reading_script_file
voidscanner
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 454 of file lex.h.

Constructor & Destructor Documentation

octave_base_lexer::octave_base_lexer ( void  )
inline

Definition at line 528 of file lex.h.

octave_base_lexer::~octave_base_lexer ( void  )
virtual

Definition at line 4730 of file lex.cc.

References octave_lex_destroy(), and scanner.

octave_base_lexer::octave_base_lexer ( const octave_base_lexer )
protected

Member Function Documentation

bool octave_base_lexer::at_end_of_buffer ( void  ) const
inline

Definition at line 548 of file lex.h.

bool octave_base_lexer::at_end_of_file ( void  ) const
inline

Definition at line 550 of file lex.h.

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

Definition at line 5768 of file lex.cc.

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 5923 of file lex.cc.

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 5581 of file lex.cc.

References octave_get_lval(), scanner, and YYSTYPE::tok_val.

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::fatal_error ( const char msg)
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  )
octave_comment_list* octave_base_lexer::get_comment ( void  )
inline

Definition at line 580 of file lex.h.

void octave_base_lexer::gripe_matlab_incompatible ( const std::string &  msg)
void octave_base_lexer::gripe_matlab_incompatible_continuation ( void  )

Definition at line 5557 of file lex.cc.

References gripe_matlab_incompatible().

Referenced by handle_continuation().

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

Definition at line 5563 of file lex.cc.

References gripe_matlab_incompatible().

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_identifier ( void  )
int octave_base_lexer::handle_incompatible_assign_op ( const char pattern,
int  tok 
)
int octave_base_lexer::handle_incompatible_op ( const char pattern,
int  tok,
bool  bos = false 
)

Definition at line 5830 of file lex.cc.

References handle_op_internal(), and lexer_debug().

int octave_base_lexer::handle_incompatible_unary_op ( int  tok,
bool  bos = false 
)

Definition at line 5869 of file lex.cc.

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 5822 of file lex.cc.

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 5862 of file lex.cc.

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  )

Reimplemented from lexical_feedback.

Definition at line 4736 of file lex.cc.

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

virtual bool octave_base_lexer::input_from_eval_string ( void  ) const
inlinevirtual

Reimplemented in octave_lexer.

Definition at line 637 of file lex.h.

Referenced by reset().

virtual bool octave_base_lexer::input_from_file ( void  ) const
inlinevirtual

Reimplemented in octave_lexer.

Definition at line 635 of file lex.h.

Referenced by is_keyword_token().

virtual bool octave_base_lexer::input_from_terminal ( void  ) const
inlinevirtual

Reimplemented in octave_lexer.

Definition at line 633 of file lex.h.

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

Reimplemented in octave_push_lexer, and octave_lexer.

Definition at line 631 of file lex.h.

bool octave_base_lexer::inside_any_object_index ( void  )

Definition at line 4898 of file lex.cc.

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 4926 of file lex.cc.

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, static_kw, 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, warning_with_id(), token::while_end, and while_kw.

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

virtual bool octave_base_lexer::is_push_lexer ( void  ) const
inlinevirtual

Reimplemented in octave_push_lexer.

Definition at line 538 of file lex.h.

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

Definition at line 4916 of file lex.cc.

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 4890 of file lex.cc.

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)
inherited
void lexical_feedback::mark_as_variables ( const std::list< std::string > &  lst)
inherited

Definition at line 4662 of file lex.cc.

References lexical_feedback::pending_local_variables.

void lexical_feedback::mark_previous_token_trailing_space ( void  )
inherited
void octave_base_lexer::maybe_gripe_matlab_incompatible_comment ( char  c)

Definition at line 5550 of file lex.cc.

References gripe_matlab_incompatible().

void lexical_feedback::maybe_mark_previous_token_as_variable ( void  )
inherited
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 )
protected
void octave_base_lexer::pop_start_state ( void  )

Definition at line 5758 of file lex.cc.

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

Referenced by handle_close_bracket().

void octave_base_lexer::prep_for_file ( void  )
bool lexical_feedback::previous_token_is_binop ( void  ) const
inherited
bool lexical_feedback::previous_token_is_keyword ( void  ) const
inherited
bool lexical_feedback::previous_token_may_be_command ( void  ) const
inherited
int lexical_feedback::previous_token_value ( void  ) const
inherited
bool lexical_feedback::previous_token_value_is ( int  tok_val) const
inherited
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)

Definition at line 5748 of file lex.cc.

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

Referenced by begin_string(), clear_start_state(), and prep_for_file().

void octave_base_lexer::push_token ( token tok)
void octave_base_lexer::reset ( void  )
virtual
int octave_base_lexer::show_token ( int  tok)

Definition at line 5935 of file lex.cc.

References display_token(), lexer_debug_flag, and Vdisplay_tokens.

Referenced by count_token_internal().

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

Definition at line 645 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 4831 of file lex.cc.

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 4882 of file lex.cc.

References flex_yytext(), and xunput().

Member Data Documentation

bool lexical_feedback::at_beginning_of_statement
inherited
int lexical_feedback::block_comment_nesting_level
inherited

Definition at line 390 of file lex.h.

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

int lexical_feedback::braceflag
inherited

Definition at line 378 of file lex.h.

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

int lexical_feedback::bracketflag
inherited

Definition at line 375 of file lex.h.

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

comment_buffer octave_base_lexer::comment_buf

Definition at line 621 of file lex.h.

Referenced by finish_comment(), and reset().

std::string lexical_feedback::comment_text
inherited

Definition at line 400 of file lex.h.

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

int lexical_feedback::current_input_column
inherited
std::string lexical_feedback::current_input_line
inherited

Definition at line 397 of file lex.h.

Referenced by octave_lexer::fill_flex_buffer(), and lexical_feedback::reset().

int lexical_feedback::defining_func
inherited

Definition at line 384 of file lex.h.

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

bool lexical_feedback::end_of_input
inherited

Definition at line 307 of file lex.h.

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

std::string lexical_feedback::fcn_file_full_name
inherited
std::string lexical_feedback::fcn_file_name
inherited

Definition at line 413 of file lex.h.

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

bool lexical_feedback::force_script
inherited

Definition at line 357 of file lex.h.

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

std::string lexical_feedback::help_text
inherited

Definition at line 403 of file lex.h.

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

input_buffer octave_base_lexer::input_buf

Definition at line 618 of file lex.h.

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

int lexical_feedback::input_line_number
inherited
bool lexical_feedback::looking_at_anon_fcn_args
inherited

Definition at line 314 of file lex.h.

Referenced by lexical_feedback::reset().

bool lexical_feedback::looking_at_decl_list
inherited

Definition at line 324 of file lex.h.

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

int lexical_feedback::looking_at_function_handle
inherited

Definition at line 387 of file lex.h.

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

bool lexical_feedback::looking_at_indirect_ref
inherited

Definition at line 339 of file lex.h.

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

bool lexical_feedback::looking_at_initializer_expression
inherited

Definition at line 328 of file lex.h.

Referenced by lexical_feedback::reset().

bool lexical_feedback::looking_at_matrix_or_assign_lhs
inherited

Definition at line 332 of file lex.h.

Referenced by lexical_feedback::reset().

std::list<bool> lexical_feedback::looking_at_object_index
inherited
bool lexical_feedback::looking_at_parameter_list
inherited

Definition at line 320 of file lex.h.

Referenced by lexical_feedback::reset().

bool lexical_feedback::looking_at_return_list
inherited

Definition at line 317 of file lex.h.

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

bool lexical_feedback::looking_for_object_index
inherited
int lexical_feedback::looping
inherited

Definition at line 381 of file lex.h.

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

bool lexical_feedback::maybe_classdef_get_set_method
inherited

Definition at line 347 of file lex.h.

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

bbp_nesting_level lexical_feedback::nesting_level
inherited
std::stack<bool> lexical_feedback::parsed_function_name
inherited

Definition at line 425 of file lex.h.

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

bool lexical_feedback::parsing_class_method
inherited

Definition at line 342 of file lex.h.

Referenced by lexical_feedback::reset().

bool lexical_feedback::parsing_classdef
inherited

Definition at line 350 of file lex.h.

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

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

Definition at line 353 of file lex.h.

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

Definition at line 677 of file lex.h.

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

int lexical_feedback::string_column
inherited

Definition at line 410 of file lex.h.

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

int lexical_feedback::string_line
inherited

Definition at line 409 of file lex.h.

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

std::string lexical_feedback::string_text
inherited

Definition at line 406 of file lex.h.

Referenced by lexical_feedback::reset().

symbol_table_context lexical_feedback::symtab_context
inherited
size_t lexical_feedback::token_count
inherited

Definition at line 394 of file lex.h.

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

token_cache lexical_feedback::tokens
inherited

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