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
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
octave_lexer Class Reference

#include "lex.h"

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

Public Member Functions

 octave_lexer (void)
 
 octave_lexer (FILE *file)
 
 octave_lexer (const std::string &eval_string)
 
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)
 
void decrement_promptflag (void)
 
void display_start_state (void) const
 
void display_token (int tok)
 
void enable_fq_identifier (void)
 
void fatal_error (const char *msg)
 
int fill_flex_buffer (char *buf, unsigned int max_size)
 
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)
 
void increment_promptflag (void)
 
void init (void)
 
bool input_from_eval_string (void) const
 
bool input_from_file (void) const
 
bool input_from_terminal (void) const
 
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
 
int promptflag (void) const
 
int promptflag (int n)
 
void push_start_state (int state)
 
void push_token (token *)
 
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
 
octave_input_reader input_reader
 
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_lexer (const octave_lexer &)
 
octave_lexeroperator= (const octave_lexer &)
 

Protected Attributes

std::stack< intstart_state_stack
 

Detailed Description

Definition at line 704 of file lex.h.

Constructor & Destructor Documentation

octave_lexer::octave_lexer ( void  )
inline

Definition at line 709 of file lex.h.

octave_lexer::octave_lexer ( FILE *  file)
inline

Definition at line 713 of file lex.h.

octave_lexer::octave_lexer ( const std::string &  eval_string)
inline

Definition at line 717 of file lex.h.

octave_lexer::octave_lexer ( const octave_lexer )
protected

Member Function Documentation

bool octave_base_lexer::at_end_of_buffer ( void  ) const
inlineinherited

Definition at line 559 of file lex.h.

Referenced by octave_push_parser::run().

bool octave_base_lexer::at_end_of_file ( void  ) const
inlineinherited

Definition at line 561 of file lex.h.

void octave_base_lexer::begin_string ( int  state)
inherited
void octave_base_lexer::clear_start_state ( void  )
inherited
int octave_base_lexer::count_token ( int  tok)
inherited
int octave_base_lexer::count_token_internal ( int  tok)
inherited
token * octave_base_lexer::current_token ( void  )
inherited

Definition at line 5706 of file lex.cc.

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

Referenced by octave_base_lexer::display_token().

void octave_lexer::decrement_promptflag ( void  )
inlinevirtual

Implements octave_base_lexer.

Definition at line 730 of file lex.h.

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

Definition at line 6076 of file lex.cc.

References FQ_IDENT_START, and octave_base_lexer::push_start_state().

void octave_base_lexer::fatal_error ( const char msg)
inherited

Definition at line 5849 of file lex.cc.

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

int octave_lexer::fill_flex_buffer ( char buf,
unsigned int  max_size 
)
virtual
void octave_base_lexer::finish_comment ( octave_comment_elt::comment_type  typ)
inherited
int octave_base_lexer::flex_yyleng ( void  )
inherited
char * octave_base_lexer::flex_yytext ( void  )
inherited
bool octave_base_lexer::fq_identifier_contains_keyword ( const std::string &  s)
inherited
octave_comment_list* octave_base_lexer::get_comment ( void  )
inlineinherited

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)
inherited
void octave_base_lexer::gripe_language_extension_continuation ( void  )
inherited
void octave_base_lexer::gripe_language_extension_operator ( const std::string &  op)
inherited
void octave_base_lexer::gripe_single_quote_string ( void  )
inherited
int octave_base_lexer::handle_assign_op ( const char pattern,
int  tok 
)
inherited
int octave_base_lexer::handle_close_bracket ( int  bracket_type)
inherited
void octave_base_lexer::handle_continuation ( void  )
inherited
int octave_base_lexer::handle_end_of_input ( void  )
inherited
int octave_base_lexer::handle_fq_identifier ( void  )
inherited
int octave_base_lexer::handle_identifier ( void  )
inherited
int octave_base_lexer::handle_language_extension_assign_op ( const char pattern,
int  tok 
)
inherited
int octave_base_lexer::handle_language_extension_op ( const char pattern,
int  tok,
bool  bos = false 
)
inherited
int octave_base_lexer::handle_language_extension_unary_op ( int  tok,
bool  bos = false 
)
inherited
int octave_base_lexer::handle_meta_identifier ( void  )
inherited
void octave_base_lexer::handle_number ( void  )
inherited
int octave_base_lexer::handle_op ( const char pattern,
int  tok,
bool  bos = false 
)
inherited
int octave_base_lexer::handle_op_internal ( int  tok,
bool  bos,
bool  compat 
)
inherited
int octave_base_lexer::handle_superclass_identifier ( void  )
inherited
int octave_base_lexer::handle_token ( const std::string &  name,
int  tok 
)
inherited
int octave_base_lexer::handle_token ( int  tok,
token tok_val = 0 
)
inherited
int octave_base_lexer::handle_unary_op ( int  tok,
bool  bos = false 
)
inherited
void octave_lexer::increment_promptflag ( void  )
inlinevirtual

Implements octave_base_lexer.

Definition at line 728 of file lex.h.

void octave_base_lexer::init ( void  )
inherited
bool octave_lexer::input_from_eval_string ( void  ) const
inlinevirtual

Reimplemented from octave_base_lexer.

Definition at line 751 of file lex.h.

bool octave_lexer::input_from_file ( void  ) const
inlinevirtual

Reimplemented from octave_base_lexer.

Definition at line 746 of file lex.h.

bool octave_lexer::input_from_terminal ( void  ) const
inlinevirtual

Reimplemented from octave_base_lexer.

Definition at line 741 of file lex.h.

std::string octave_lexer::input_source ( void  ) const
inlinevirtual

Reimplemented from octave_base_lexer.

Definition at line 736 of file lex.h.

bool octave_base_lexer::inside_any_object_index ( void  )
inherited

Definition at line 5004 of file lex.cc.

References lexical_feedback::looking_at_object_index.

Referenced by octave_base_lexer::is_keyword_token().

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

Definition at line 5032 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, octave_base_lexer::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(), octave_base_lexer::input_from_file(), lexical_feedback::input_line_number, octave_base_lexer::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, octave_base_lexer::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 octave_base_lexer::fq_identifier_contains_keyword(), octave_base_lexer::handle_identifier(), and octave_base_lexer::handle_superclass_identifier().

virtual bool octave_base_lexer::is_push_lexer ( void  ) const
inlinevirtualinherited

Reimplemented in octave_push_lexer.

Definition at line 549 of file lex.h.

bool octave_base_lexer::is_variable ( const std::string &  name)
inherited
void octave_base_lexer::lexer_debug ( const char pattern)
inherited
bool octave_base_lexer::looking_at_space ( void  )
inherited
bool octave_base_lexer::looks_like_command_arg ( void  )
inherited
void lexical_feedback::mark_as_variable ( const std::string &  nm)
inherited
void lexical_feedback::mark_as_variables ( const std::list< std::string > &  lst)
inherited
void lexical_feedback::mark_previous_token_trailing_space ( void  )
inherited
void octave_base_lexer::maybe_gripe_language_extension_comment ( char  c)
inherited

Definition at line 5675 of file lex.cc.

References octave_base_lexer::gripe_language_extension().

void lexical_feedback::maybe_mark_previous_token_as_variable ( void  )
inherited
bool octave_base_lexer::maybe_unput_comma_before_unary_op ( int  tok)
inherited
void octave_base_lexer::maybe_warn_separator_insert ( char  sep)
inherited
octave_lexer& octave_lexer::operator= ( const octave_lexer )
protected
void octave_base_lexer::pop_start_state ( void  )
inherited
void octave_base_lexer::prep_for_file ( void  )
inherited
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
int octave_lexer::promptflag ( void  ) const
inlinevirtual

Implements octave_base_lexer.

Definition at line 732 of file lex.h.

int octave_lexer::promptflag ( int  n)
inlinevirtual

Implements octave_base_lexer.

Definition at line 734 of file lex.h.

void octave_base_lexer::push_start_state ( int  state)
inherited
void octave_base_lexer::push_token ( token tok)
inherited
void octave_lexer::reset ( void  )
inlinevirtual

Reimplemented from octave_base_lexer.

Definition at line 721 of file lex.h.

References octave_base_lexer::reset().

int octave_base_lexer::show_token ( int  tok)
inherited
bool lexical_feedback::space_follows_previous_token ( void  ) const
inherited
int octave_base_lexer::start_state ( void  ) const
inlineinherited
int octave_base_lexer::text_yyinput ( void  )
inherited
bool octave_base_lexer::whitespace_is_significant ( void  )
inherited
void octave_base_lexer::xunput ( char  c,
char buf 
)
inherited
void octave_base_lexer::xunput ( char  c)
inherited

Definition at line 4988 of file lex.cc.

References octave_base_lexer::flex_yytext(), and octave_base_lexer::xunput().

Member Data Documentation

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

Definition at line 398 of file lex.h.

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

int lexical_feedback::braceflag
inherited

Definition at line 386 of file lex.h.

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

int lexical_feedback::bracketflag
inherited

Definition at line 383 of file lex.h.

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

int lexical_feedback::command_arg_paren_count
inherited

Definition at line 401 of file lex.h.

Referenced by lexical_feedback::reset().

comment_buffer octave_base_lexer::comment_buf
inherited
std::string lexical_feedback::comment_text
inherited
int lexical_feedback::current_input_column
inherited
std::string lexical_feedback::current_input_line
inherited
int lexical_feedback::defining_func
inherited
bool lexical_feedback::end_of_input
inherited

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
inherited
std::string lexical_feedback::fcn_file_name
inherited
bool lexical_feedback::force_script
inherited
std::string lexical_feedback::help_text
inherited
input_buffer octave_base_lexer::input_buf
inherited

Definition at line 633 of file lex.h.

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

int lexical_feedback::input_line_number
inherited
octave_input_reader octave_lexer::input_reader

Definition at line 758 of file lex.h.

bool lexical_feedback::looking_at_anon_fcn_args
inherited

Definition at line 316 of file lex.h.

Referenced by lexical_feedback::reset().

bool lexical_feedback::looking_at_decl_list
inherited

Definition at line 326 of file lex.h.

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

int lexical_feedback::looking_at_function_handle
inherited

Definition at line 395 of file lex.h.

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

bool lexical_feedback::looking_at_indirect_ref
inherited
bool lexical_feedback::looking_at_initializer_expression
inherited

Definition at line 330 of file lex.h.

Referenced by lexical_feedback::reset().

bool lexical_feedback::looking_at_matrix_or_assign_lhs
inherited

Definition at line 334 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
bool lexical_feedback::looking_at_return_list
inherited
bool lexical_feedback::looking_for_object_index
inherited
int lexical_feedback::looping
inherited
bool lexical_feedback::maybe_classdef_get_set_method
inherited

Definition at line 352 of file lex.h.

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

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

Definition at line 347 of file lex.h.

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

bool lexical_feedback::parsing_classdef_get_method
inherited

Definition at line 355 of file lex.h.

Referenced by lexical_feedback::reset().

bool lexical_feedback::parsing_classdef_set_method
inherited

Definition at line 358 of file lex.h.

Referenced by lexical_feedback::reset().

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

Definition at line 361 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
inherited
std::stack<int> octave_base_lexer::start_state_stack
protectedinherited
int lexical_feedback::string_column
inherited

Definition at line 421 of file lex.h.

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

int lexical_feedback::string_line
inherited

Definition at line 420 of file lex.h.

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

std::string lexical_feedback::string_text
inherited

Definition at line 417 of file lex.h.

Referenced by lexical_feedback::reset().

symbol_table_context lexical_feedback::symtab_context
inherited
size_t lexical_feedback::token_count
inherited
token_cache lexical_feedback::tokens
inherited

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