GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
octave::lexer Class Reference

#include "lex.h"

Inheritance diagram for octave::lexer:
Collaboration diagram for octave::lexer:

Public Member Functions

 lexer (interpreter *interp=nullptr)
 
 lexer (FILE *file, interpreter *interp=nullptr)
 
 lexer (const std::string &eval_string, interpreter *interp=nullptr)
 
 lexer (const lexer &)=delete
 
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 (comment_elt::comment_type typ)
 
int flex_yyleng (void)
 
char * flex_yytext (void)
 
bool fq_identifier_contains_keyword (const std::string &s)
 
comment_listget_comment (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=nullptr)
 
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, const symbol_scope &scope)
 
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_mark_previous_token_as_variable (void)
 
bool maybe_unput_comma_before_unary_op (int tok)
 
void maybe_warn_language_extension_comment (char c)
 
void maybe_warn_separator_insert (char sep)
 
lexeroperator= (const lexer &)=delete
 
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)
 
void warn_language_extension (const std::string &msg)
 
void warn_language_extension_continuation (void)
 
void warn_language_extension_operator (const std::string &op)
 
void warn_single_quote_string (void)
 
bool whitespace_is_significant (void)
 
void xunput (char c, char *buf)
 
void xunput (char c)
 

Public Attributes

bool m_at_beginning_of_statement
 
int m_block_comment_nesting_level
 
int m_braceflag
 
int m_bracketflag
 
bool m_buffer_function_text
 
int m_command_arg_paren_count
 
comment_buffer m_comment_buf
 
std::string m_comment_text
 
int m_current_input_column
 
std::string m_current_input_line
 
int m_defining_func
 
std::string m_dir_name
 
bool m_end_of_input
 
std::string m_fcn_file_full_name
 
std::string m_fcn_file_name
 
bool m_force_script
 
std::string m_function_text
 
std::string m_help_text
 
input_buffer m_input_buf
 
int m_input_line_number
 
interpreterm_interpreter
 
bool m_looking_at_anon_fcn_args
 
bool m_looking_at_decl_list
 
int m_looking_at_function_handle
 
bool m_looking_at_indirect_ref
 
bool m_looking_at_initializer_expression
 
bool m_looking_at_matrix_or_assign_lhs
 
std::list< boolm_looking_at_object_index
 
bool m_looking_at_parameter_list
 
bool m_looking_at_return_list
 
bool m_looking_for_object_index
 
int m_looping
 
bool m_maybe_classdef_get_set_method
 
bbp_nesting_level m_nesting_level
 
std::string m_package_name
 
std::stack< boolm_parsed_function_name
 
bool m_parsing_class_method
 
bool m_parsing_classdef
 
bool m_parsing_classdef_get_method
 
bool m_parsing_classdef_set_method
 
std::set< std::stringm_pending_local_variables
 
bool m_quote_is_transpose
 
input_reader m_reader
 
bool m_reading_classdef_file
 
bool m_reading_fcn_file
 
bool m_reading_script_file
 
void * m_scanner
 
int m_string_column
 
int m_string_line
 
std::string m_string_text
 
symbol_table_context m_symtab_context
 
size_t m_token_count
 
token_cache m_tokens
 

Protected Attributes

std::stack< int > start_state_stack
 

Detailed Description

Definition at line 753 of file lex.h.

Constructor & Destructor Documentation

◆ lexer() [1/4]

◆ lexer() [2/4]

octave::lexer::lexer ( FILE *  file,
interpreter interp = nullptr 
)
inline

Definition at line 762 of file lex.h.

◆ lexer() [3/4]

octave::lexer::lexer ( const std::string eval_string,
interpreter interp = nullptr 
)
inline

Definition at line 766 of file lex.h.

◆ lexer() [4/4]

octave::lexer::lexer ( const lexer )
delete

Member Function Documentation

◆ at_end_of_buffer()

bool octave::base_lexer::at_end_of_buffer ( void  ) const
inlineinherited

Definition at line 611 of file lex.h.

◆ at_end_of_file()

bool octave::base_lexer::at_end_of_file ( void  ) const
inlineinherited

Definition at line 613 of file lex.h.

◆ begin_string()

void octave::base_lexer::begin_string ( int  state)
inherited

◆ clear_start_state()

void octave::base_lexer::clear_start_state ( void  )
inherited

◆ count_token()

int octave::base_lexer::count_token ( int  tok)
inherited

◆ count_token_internal()

int octave::base_lexer::count_token_internal ( int  tok)
inherited

◆ current_token()

token* octave::base_lexer::current_token ( void  )
inherited

◆ decrement_promptflag()

void octave::lexer::decrement_promptflag ( void  )
inlinevirtual

Implements octave::base_lexer.

Definition at line 785 of file lex.h.

◆ display_start_state()

void octave::base_lexer::display_start_state ( void  ) const
inherited

◆ display_token()

void octave::base_lexer::display_token ( int  tok)
inherited

◆ enable_fq_identifier()

void octave::base_lexer::enable_fq_identifier ( void  )
inherited

◆ fatal_error()

void octave::base_lexer::fatal_error ( const char *  msg)
inherited

◆ fill_flex_buffer()

int octave::lexer::fill_flex_buffer ( char *  buf,
unsigned int  max_size 
)
virtual

Implements octave::base_lexer.

◆ finish_comment()

void octave::base_lexer::finish_comment ( comment_elt::comment_type  typ)
inherited

◆ flex_yyleng()

int octave::base_lexer::flex_yyleng ( void  )
inherited

◆ flex_yytext()

char* octave::base_lexer::flex_yytext ( void  )
inherited

◆ fq_identifier_contains_keyword()

bool octave::base_lexer::fq_identifier_contains_keyword ( const std::string s)
inherited

◆ get_comment()

comment_list* octave::base_lexer::get_comment ( void  )
inlineinherited

Definition at line 645 of file lex.h.

◆ handle_assign_op()

int octave::base_lexer::handle_assign_op ( const char *  pattern,
int  tok 
)
inherited

◆ handle_close_bracket()

int octave::base_lexer::handle_close_bracket ( int  bracket_type)
inherited

◆ handle_continuation()

void octave::base_lexer::handle_continuation ( void  )
inherited

◆ handle_end_of_input()

int octave::base_lexer::handle_end_of_input ( void  )
inherited

◆ handle_fq_identifier()

int octave::base_lexer::handle_fq_identifier ( void  )
inherited

◆ handle_identifier()

int octave::base_lexer::handle_identifier ( void  )
inherited

◆ handle_language_extension_assign_op()

int octave::base_lexer::handle_language_extension_assign_op ( const char *  pattern,
int  tok 
)
inherited

◆ handle_language_extension_op()

int octave::base_lexer::handle_language_extension_op ( const char *  pattern,
int  tok,
bool  bos = false 
)
inherited

◆ handle_language_extension_unary_op()

int octave::base_lexer::handle_language_extension_unary_op ( int  tok,
bool  bos = false 
)
inherited

◆ handle_meta_identifier()

int octave::base_lexer::handle_meta_identifier ( void  )
inherited

◆ handle_number()

void octave::base_lexer::handle_number ( void  )
inherited

◆ handle_op()

int octave::base_lexer::handle_op ( const char *  pattern,
int  tok,
bool  bos = false 
)
inherited

◆ handle_op_internal()

int octave::base_lexer::handle_op_internal ( int  tok,
bool  bos,
bool  compat 
)
inherited

◆ handle_superclass_identifier()

int octave::base_lexer::handle_superclass_identifier ( void  )
inherited

◆ handle_token() [1/2]

int octave::base_lexer::handle_token ( const std::string name,
int  tok 
)
inherited

◆ handle_token() [2/2]

int octave::base_lexer::handle_token ( int  tok,
token tok_val = nullptr 
)
inherited

◆ handle_unary_op()

int octave::base_lexer::handle_unary_op ( int  tok,
bool  bos = false 
)
inherited

◆ increment_promptflag()

void octave::lexer::increment_promptflag ( void  )
inlinevirtual

Implements octave::base_lexer.

Definition at line 783 of file lex.h.

◆ init()

void octave::base_lexer::init ( void  )
inherited

◆ input_from_eval_string()

bool octave::lexer::input_from_eval_string ( void  ) const
inlinevirtual

Reimplemented from octave::base_lexer.

Definition at line 806 of file lex.h.

◆ input_from_file()

bool octave::lexer::input_from_file ( void  ) const
inlinevirtual

Reimplemented from octave::base_lexer.

Definition at line 801 of file lex.h.

◆ input_from_terminal()

bool octave::lexer::input_from_terminal ( void  ) const
inlinevirtual

Reimplemented from octave::base_lexer.

Definition at line 796 of file lex.h.

◆ input_source()

std::string octave::lexer::input_source ( void  ) const
inlinevirtual

Reimplemented from octave::base_lexer.

Definition at line 791 of file lex.h.

◆ inside_any_object_index()

bool octave::base_lexer::inside_any_object_index ( void  )
inherited

◆ is_keyword_token()

int octave::base_lexer::is_keyword_token ( const std::string s)
inherited

◆ is_push_lexer()

virtual bool octave::base_lexer::is_push_lexer ( void  ) const
inlinevirtualinherited

Reimplemented in octave::push_lexer.

Definition at line 601 of file lex.h.

◆ is_variable()

bool octave::base_lexer::is_variable ( const std::string name,
const symbol_scope scope 
)
inherited

◆ lexer_debug()

void octave::base_lexer::lexer_debug ( const char *  pattern)
inherited

◆ looking_at_space()

bool octave::base_lexer::looking_at_space ( void  )
inherited

◆ looks_like_command_arg()

bool octave::base_lexer::looks_like_command_arg ( void  )
inherited

◆ mark_as_variable()

void octave::lexical_feedback::mark_as_variable ( const std::string nm)
inherited

◆ mark_as_variables()

void octave::lexical_feedback::mark_as_variables ( const std::list< std::string > &  lst)
inherited

◆ mark_previous_token_trailing_space()

void octave::lexical_feedback::mark_previous_token_trailing_space ( void  )
inherited

◆ maybe_mark_previous_token_as_variable()

void octave::lexical_feedback::maybe_mark_previous_token_as_variable ( void  )
inherited

◆ maybe_unput_comma_before_unary_op()

bool octave::base_lexer::maybe_unput_comma_before_unary_op ( int  tok)
inherited

◆ maybe_warn_language_extension_comment()

void octave::base_lexer::maybe_warn_language_extension_comment ( char  c)
inherited

◆ maybe_warn_separator_insert()

void octave::base_lexer::maybe_warn_separator_insert ( char  sep)
inherited

◆ operator=()

lexer& octave::lexer::operator= ( const lexer )
delete

◆ pop_start_state()

void octave::base_lexer::pop_start_state ( void  )
inherited

◆ prep_for_file()

void octave::base_lexer::prep_for_file ( void  )
inherited

◆ previous_token_is_binop()

bool octave::lexical_feedback::previous_token_is_binop ( void  ) const
inherited

◆ previous_token_is_keyword()

bool octave::lexical_feedback::previous_token_is_keyword ( void  ) const
inherited

◆ previous_token_may_be_command()

bool octave::lexical_feedback::previous_token_may_be_command ( void  ) const
inherited

◆ previous_token_value()

int octave::lexical_feedback::previous_token_value ( void  ) const
inherited

◆ previous_token_value_is()

bool octave::lexical_feedback::previous_token_value_is ( int  tok_val) const
inherited

◆ promptflag() [1/2]

int octave::lexer::promptflag ( void  ) const
inlinevirtual

Implements octave::base_lexer.

Definition at line 787 of file lex.h.

◆ promptflag() [2/2]

int octave::lexer::promptflag ( int  n)
inlinevirtual

Implements octave::base_lexer.

Definition at line 789 of file lex.h.

◆ push_start_state()

void octave::base_lexer::push_start_state ( int  state)
inherited

◆ push_token()

void octave::base_lexer::push_token ( token )
inherited

◆ reset()

void octave::lexer::reset ( void  )
inlinevirtual

Reimplemented from octave::base_lexer.

Definition at line 776 of file lex.h.

References octave::base_lexer::reset().

◆ show_token()

int octave::base_lexer::show_token ( int  tok)
inherited

◆ space_follows_previous_token()

bool octave::lexical_feedback::space_follows_previous_token ( void  ) const
inherited

◆ start_state()

int octave::base_lexer::start_state ( void  ) const
inlineinherited

Definition at line 715 of file lex.h.

◆ text_yyinput()

int octave::base_lexer::text_yyinput ( void  )
inherited

◆ warn_language_extension()

void octave::base_lexer::warn_language_extension ( const std::string msg)
inherited

◆ warn_language_extension_continuation()

void octave::base_lexer::warn_language_extension_continuation ( void  )
inherited

◆ warn_language_extension_operator()

void octave::base_lexer::warn_language_extension_operator ( const std::string op)
inherited

◆ warn_single_quote_string()

void octave::base_lexer::warn_single_quote_string ( void  )
inherited

◆ whitespace_is_significant()

bool octave::base_lexer::whitespace_is_significant ( void  )
inherited

◆ xunput() [1/2]

void octave::base_lexer::xunput ( char  c,
char *  buf 
)
inherited

◆ xunput() [2/2]

void octave::base_lexer::xunput ( char  c)
inherited

Member Data Documentation

◆ m_at_beginning_of_statement

bool octave::lexical_feedback::m_at_beginning_of_statement
inherited

Definition at line 353 of file lex.h.

◆ m_block_comment_nesting_level

int octave::lexical_feedback::m_block_comment_nesting_level
inherited

Definition at line 442 of file lex.h.

◆ m_braceflag

int octave::lexical_feedback::m_braceflag
inherited

Definition at line 430 of file lex.h.

◆ m_bracketflag

int octave::lexical_feedback::m_bracketflag
inherited

Definition at line 427 of file lex.h.

◆ m_buffer_function_text

bool octave::lexical_feedback::m_buffer_function_text
inherited

Definition at line 418 of file lex.h.

◆ m_command_arg_paren_count

int octave::lexical_feedback::m_command_arg_paren_count
inherited

Definition at line 445 of file lex.h.

◆ m_comment_buf

comment_buffer octave::base_lexer::m_comment_buf
inherited

Definition at line 688 of file lex.h.

◆ m_comment_text

std::string octave::lexical_feedback::m_comment_text
inherited

Definition at line 455 of file lex.h.

◆ m_current_input_column

int octave::lexical_feedback::m_current_input_column
inherited

Definition at line 424 of file lex.h.

◆ m_current_input_line

std::string octave::lexical_feedback::m_current_input_line
inherited

Definition at line 452 of file lex.h.

◆ m_defining_func

int octave::lexical_feedback::m_defining_func
inherited

Definition at line 436 of file lex.h.

◆ m_dir_name

std::string octave::lexical_feedback::m_dir_name
inherited

Definition at line 477 of file lex.h.

◆ m_end_of_input

bool octave::lexical_feedback::m_end_of_input
inherited

Definition at line 349 of file lex.h.

◆ m_fcn_file_full_name

std::string octave::lexical_feedback::m_fcn_file_full_name
inherited

Definition at line 474 of file lex.h.

◆ m_fcn_file_name

std::string octave::lexical_feedback::m_fcn_file_name
inherited

Definition at line 471 of file lex.h.

◆ m_force_script

bool octave::lexical_feedback::m_force_script
inherited

Definition at line 405 of file lex.h.

◆ m_function_text

std::string octave::lexical_feedback::m_function_text
inherited

Definition at line 461 of file lex.h.

◆ m_help_text

std::string octave::lexical_feedback::m_help_text
inherited

Definition at line 458 of file lex.h.

◆ m_input_buf

input_buffer octave::base_lexer::m_input_buf
inherited

Definition at line 685 of file lex.h.

◆ m_input_line_number

int octave::lexical_feedback::m_input_line_number
inherited

Definition at line 421 of file lex.h.

◆ m_interpreter

interpreter* octave::base_lexer::m_interpreter
inherited

Definition at line 691 of file lex.h.

◆ m_looking_at_anon_fcn_args

bool octave::lexical_feedback::m_looking_at_anon_fcn_args
inherited

Definition at line 356 of file lex.h.

◆ m_looking_at_decl_list

bool octave::lexical_feedback::m_looking_at_decl_list
inherited

Definition at line 366 of file lex.h.

◆ m_looking_at_function_handle

int octave::lexical_feedback::m_looking_at_function_handle
inherited

Definition at line 439 of file lex.h.

◆ m_looking_at_indirect_ref

bool octave::lexical_feedback::m_looking_at_indirect_ref
inherited

Definition at line 381 of file lex.h.

◆ m_looking_at_initializer_expression

bool octave::lexical_feedback::m_looking_at_initializer_expression
inherited

Definition at line 370 of file lex.h.

◆ m_looking_at_matrix_or_assign_lhs

bool octave::lexical_feedback::m_looking_at_matrix_or_assign_lhs
inherited

Definition at line 374 of file lex.h.

◆ m_looking_at_object_index

std::list<bool> octave::lexical_feedback::m_looking_at_object_index
inherited

Definition at line 484 of file lex.h.

◆ m_looking_at_parameter_list

bool octave::lexical_feedback::m_looking_at_parameter_list
inherited

Definition at line 362 of file lex.h.

◆ m_looking_at_return_list

bool octave::lexical_feedback::m_looking_at_return_list
inherited

Definition at line 359 of file lex.h.

◆ m_looking_for_object_index

bool octave::lexical_feedback::m_looking_for_object_index
inherited

Definition at line 377 of file lex.h.

◆ m_looping

int octave::lexical_feedback::m_looping
inherited

Definition at line 433 of file lex.h.

◆ m_maybe_classdef_get_set_method

bool octave::lexical_feedback::m_maybe_classdef_get_set_method
inherited

Definition at line 392 of file lex.h.

◆ m_nesting_level

bbp_nesting_level octave::lexical_feedback::m_nesting_level
inherited

Definition at line 499 of file lex.h.

◆ m_package_name

std::string octave::lexical_feedback::m_package_name
inherited

Definition at line 480 of file lex.h.

◆ m_parsed_function_name

std::stack<bool> octave::lexical_feedback::m_parsed_function_name
inherited

Definition at line 489 of file lex.h.

◆ m_parsing_class_method

bool octave::lexical_feedback::m_parsing_class_method
inherited

Definition at line 384 of file lex.h.

◆ m_parsing_classdef

bool octave::lexical_feedback::m_parsing_classdef
inherited

Definition at line 387 of file lex.h.

◆ m_parsing_classdef_get_method

bool octave::lexical_feedback::m_parsing_classdef_get_method
inherited

Definition at line 395 of file lex.h.

◆ m_parsing_classdef_set_method

bool octave::lexical_feedback::m_parsing_classdef_set_method
inherited

Definition at line 398 of file lex.h.

◆ m_pending_local_variables

std::set<std::string> octave::lexical_feedback::m_pending_local_variables
inherited

Definition at line 492 of file lex.h.

◆ m_quote_is_transpose

bool octave::lexical_feedback::m_quote_is_transpose
inherited

Definition at line 401 of file lex.h.

◆ m_reader

input_reader octave::lexer::m_reader

Definition at line 813 of file lex.h.

◆ m_reading_classdef_file

bool octave::lexical_feedback::m_reading_classdef_file
inherited

Definition at line 414 of file lex.h.

Referenced by octave::base_reader::reading_classdef_file().

◆ m_reading_fcn_file

bool octave::lexical_feedback::m_reading_fcn_file
inherited

Definition at line 408 of file lex.h.

Referenced by octave::base_reader::reading_fcn_file().

◆ m_reading_script_file

bool octave::lexical_feedback::m_reading_script_file
inherited

Definition at line 411 of file lex.h.

Referenced by octave::base_reader::reading_script_file().

◆ m_scanner

void* octave::base_lexer::m_scanner
inherited

Definition at line 682 of file lex.h.

◆ m_string_column

int octave::lexical_feedback::m_string_column
inherited

Definition at line 468 of file lex.h.

◆ m_string_line

int octave::lexical_feedback::m_string_line
inherited

Definition at line 467 of file lex.h.

◆ m_string_text

std::string octave::lexical_feedback::m_string_text
inherited

Definition at line 464 of file lex.h.

◆ m_symtab_context

symbol_table_context octave::lexical_feedback::m_symtab_context
inherited

Definition at line 495 of file lex.h.

◆ m_token_count

size_t octave::lexical_feedback::m_token_count
inherited

Definition at line 449 of file lex.h.

◆ m_tokens

token_cache octave::lexical_feedback::m_tokens
inherited

Definition at line 502 of file lex.h.

◆ start_state_stack

std::stack<int> octave::base_lexer::start_state_stack
protectedinherited

Definition at line 750 of file lex.h.


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