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

#include "lex.h"

Inheritance diagram for octave::push_lexer:
Collaboration diagram for octave::push_lexer:

Public Member Functions

 push_lexer (bool eof, interpreter &interp)
 
 push_lexer (const push_lexer &)=delete
 
 push_lexer (const std::string &input, bool eof, interpreter &interp)
 
 push_lexer (const std::string &input, interpreter &interp)
 
 push_lexer (interpreter &interp)
 
void append_input (const std::string &input, bool eof)
 
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)
 
bool debug_flag (void) const
 
void display_start_state (void) const
 
void display_token (int tok)
 
bool display_tokens (void) const
 
void fatal_error (const char *msg)
 
int fill_flex_buffer (char *buf, unsigned int max_size)
 
int finish_command_arg (void)
 
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_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_meta_identifier (void)
 
void handle_number (void)
 
int handle_op (int tok, bool bos=false, bool compat=true)
 
int handle_superclass_identifier (void)
 
int handle_token (int tok, token *tok_val=nullptr)
 
void increment_token_count (void)
 
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
 
bool input_from_tmp_history_file (void)
 
std::string input_source (void) const
 
bool inside_any_object_index (void)
 
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)
 
int make_keyword_token (const std::string &s)
 
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)
 
push_lexeroperator= (const push_lexer &)=delete
 
size_t pending_token_count (void) const
 
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
 
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)
 
void update_token_positions (int tok_len)
 
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)
 
void xunput (char c, char *buf)
 

Public Attributes

bool m_allow_command_syntax
 
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
 
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
 
filepos m_filepos
 
bool m_force_script
 
std::string m_function_text
 
std::string m_help_text
 
input_buffer m_input_buf
 
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< bool > m_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< bool > m_parsed_function_name
 
bool m_parsing_anon_fcn_body
 
bool m_parsing_class_method
 
bool m_parsing_classdef
 
bool m_parsing_classdef_decl
 
bool m_parsing_classdef_get_method
 
bool m_parsing_classdef_set_method
 
bool m_parsing_classdef_superclass
 
std::set< std::string > m_pending_local_variables
 
bool m_quote_is_transpose
 
bool m_reading_classdef_file
 
bool m_reading_fcn_file
 
bool m_reading_script_file
 
void * m_scanner
 
std::string m_string_text
 
symbol_table_context m_symtab_context
 
filepos m_tok_beg
 
filepos m_tok_end
 
size_t m_token_count
 
token_cache m_tokens
 

Protected Attributes

std::stack< int > start_state_stack
 

Detailed Description

Definition at line 825 of file lex.h.

Constructor & Destructor Documentation

◆ push_lexer() [1/5]

octave::push_lexer::push_lexer ( interpreter interp)
inline

Definition at line 830 of file lex.h.

◆ push_lexer() [2/5]

octave::push_lexer::push_lexer ( const std::string &  input,
interpreter interp 
)
inline

Definition at line 836 of file lex.h.

References input().

◆ push_lexer() [3/5]

octave::push_lexer::push_lexer ( bool  eof,
interpreter interp 
)
inline

Definition at line 842 of file lex.h.

◆ push_lexer() [4/5]

octave::push_lexer::push_lexer ( const std::string &  input,
bool  eof,
interpreter interp 
)
inline

Definition at line 848 of file lex.h.

References input().

◆ push_lexer() [5/5]

octave::push_lexer::push_lexer ( const push_lexer )
delete

Member Function Documentation

◆ append_input()

void octave::push_lexer::append_input ( const std::string &  input,
bool  eof 
)

◆ at_end_of_buffer()

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

Definition at line 634 of file lex.h.

Referenced by octave::push_parser::run().

◆ at_end_of_file()

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

Definition at line 636 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()

◆ count_token_internal()

◆ current_token()

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

Definition at line 6248 of file lex.cc.

References octave::base_lexer::m_scanner, yyget_lval, and YYSTYPE.

Referenced by octave::base_lexer::display_token().

◆ debug_flag()

◆ display_start_state()

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

◆ display_token()

◆ display_tokens()

bool octave::base_lexer::display_tokens ( void  ) const
inherited

◆ fatal_error()

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

Definition at line 6390 of file lex.cc.

References error().

◆ fill_flex_buffer()

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

◆ finish_command_arg()

◆ finish_comment()

◆ flex_yyleng()

◆ flex_yytext()

◆ 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 670 of file lex.h.

Referenced by octave::base_parser::make_statement().

◆ handle_close_bracket()

◆ handle_continuation()

◆ handle_end_of_input()

◆ handle_fq_identifier()

◆ handle_identifier()

◆ handle_meta_identifier()

◆ handle_number()

◆ handle_op()

◆ handle_superclass_identifier()

◆ handle_token()

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

◆ increment_token_count()

void octave::base_lexer::increment_token_count ( void  )
inherited

◆ init()

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

◆ input_from_eval_string()

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

Reimplemented in octave::lexer.

Definition at line 729 of file lex.h.

Referenced by octave::base_parser::make_anon_fcn_handle(), and octave::base_lexer::reset().

◆ input_from_file()

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

Reimplemented in octave::lexer.

Definition at line 727 of file lex.h.

Referenced by octave::base_lexer::make_keyword_token().

◆ input_from_terminal()

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

Reimplemented in octave::lexer.

Definition at line 725 of file lex.h.

Referenced by octave::base_parser::make_anon_fcn_handle().

◆ input_from_tmp_history_file()

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

◆ input_source()

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

Reimplemented from octave::base_lexer.

Definition at line 864 of file lex.h.

◆ inside_any_object_index()

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

◆ is_push_lexer()

bool octave::push_lexer::is_push_lexer ( void  ) const
inlinevirtual

Reimplemented from octave::base_lexer.

Definition at line 860 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()

◆ make_keyword_token()

int octave::base_lexer::make_keyword_token ( const std::string &  s)
inherited

Definition at line 5516 of file lex.cc.

References break_kw, case_kw, catch_kw, octave::token::classdef_end, classdef_kw, continue_kw, 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, octave::token::enumeration_end, enumeration_kw, octave::token::events_end, events_kw, octave::token::for_end, for_kw, octave::token::function_end, function_kw, get_kw, global_kw, octave::token::if_end, if_kw, octave_kw_hash::in_word_set(), octave::base_lexer::input_from_file(), octave::base_lexer::inside_any_object_index(), octave_kw::kw_id, octave::filepos::line(), octave::lexical_feedback::m_at_beginning_of_statement, octave::lexical_feedback::m_buffer_function_text, octave::lexical_feedback::m_current_input_line, octave::lexical_feedback::m_defining_func, octave::lexical_feedback::m_fcn_file_full_name, octave::lexical_feedback::m_filepos, octave::lexical_feedback::m_force_script, octave::lexical_feedback::m_function_text, octave::lexical_feedback::m_looking_at_decl_list, octave::lexical_feedback::m_looking_at_return_list, octave::lexical_feedback::m_looping, octave::lexical_feedback::m_maybe_classdef_get_set_method, octave::lexical_feedback::m_parsed_function_name, octave::lexical_feedback::m_parsing_classdef, octave::lexical_feedback::m_reading_classdef_file, octave::lexical_feedback::m_reading_fcn_file, octave::lexical_feedback::m_reading_script_file, octave::lexical_feedback::m_tok_beg, octave::lexical_feedback::m_tok_end, octave::lexical_feedback::m_token_count, magic_file_kw, magic_line_kw, octave::token::methods_end, methods_kw, otherwise_kw, panic_impossible, octave::token::parfor_end, parfor_kw, persistent_kw, octave::token::properties_end, properties_kw, octave::base_lexer::push_token(), return_kw, set_kw, octave::token::simple_end, octave::token::switch_end, switch_kw, octave_kw::tok, octave::token::try_catch_end, try_kw, until_kw, unwind_protect_cleanup_kw, octave::token::unwind_protect_end, unwind_protect_kw, octave::base_lexer::update_token_positions(), octave::token::while_end, and while_kw.

Referenced by octave::base_lexer::handle_identifier().

◆ 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()

◆ maybe_warn_language_extension_comment()

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

Definition at line 6217 of file lex.cc.

References octave::base_lexer::warn_language_extension().

◆ maybe_warn_separator_insert()

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

◆ operator=()

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

◆ pending_token_count()

size_t octave::base_lexer::pending_token_count ( void  ) const
inherited

◆ 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()

◆ 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

◆ push_start_state()

◆ push_token()

◆ 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

◆ text_yyinput()

◆ update_token_positions()

◆ warn_language_extension()

◆ 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

Definition at line 6230 of file lex.cc.

References n, and octave::base_lexer::warn_language_extension().

Referenced by octave::base_lexer::handle_op().

◆ warn_single_quote_string()

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

◆ whitespace_is_significant()

◆ xunput() [1/2]

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

Definition at line 5461 of file lex.cc.

References octave::base_lexer::flex_yytext(), and octave::base_lexer::xunput().

◆ xunput() [2/2]

Member Data Documentation

◆ m_allow_command_syntax

◆ m_at_beginning_of_statement

◆ m_block_comment_nesting_level

int octave::lexical_feedback::m_block_comment_nesting_level
inherited

◆ m_braceflag

int octave::lexical_feedback::m_braceflag
inherited

◆ m_bracketflag

int octave::lexical_feedback::m_bracketflag
inherited

◆ m_buffer_function_text

bool octave::lexical_feedback::m_buffer_function_text
inherited

◆ m_command_arg_paren_count

int octave::lexical_feedback::m_command_arg_paren_count
inherited

◆ m_comment_buf

◆ m_comment_text

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

◆ m_current_input_line

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

◆ m_defining_func

int octave::lexical_feedback::m_defining_func
inherited

◆ m_dir_name

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

◆ m_end_of_input

bool octave::lexical_feedback::m_end_of_input
inherited

Definition at line 357 of file lex.h.

Referenced by octave::base_parser::at_end_of_input(), and octave::lexical_feedback::reset().

◆ m_fcn_file_full_name

◆ m_fcn_file_name

◆ m_filepos

◆ m_force_script

bool octave::lexical_feedback::m_force_script
inherited

◆ m_function_text

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

◆ m_help_text

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

◆ m_input_buf

input_buffer octave::base_lexer::m_input_buf
inherited

Definition at line 718 of file lex.h.

Referenced by append_input(), octave::lexer::fill_flex_buffer(), and fill_flex_buffer().

◆ m_interpreter

◆ m_looking_at_anon_fcn_args

bool octave::lexical_feedback::m_looking_at_anon_fcn_args
inherited

Definition at line 367 of file lex.h.

Referenced by octave::lexical_feedback::reset().

◆ m_looking_at_decl_list

bool octave::lexical_feedback::m_looking_at_decl_list
inherited

◆ m_looking_at_function_handle

int octave::lexical_feedback::m_looking_at_function_handle
inherited

Definition at line 456 of file lex.h.

Referenced by octave::lexical_feedback::reset().

◆ m_looking_at_indirect_ref

bool octave::lexical_feedback::m_looking_at_indirect_ref
inherited

◆ m_looking_at_initializer_expression

bool octave::lexical_feedback::m_looking_at_initializer_expression
inherited

Definition at line 381 of file lex.h.

Referenced by octave::lexical_feedback::reset().

◆ m_looking_at_matrix_or_assign_lhs

bool octave::lexical_feedback::m_looking_at_matrix_or_assign_lhs
inherited

Definition at line 385 of file lex.h.

Referenced by octave::lexical_feedback::reset().

◆ m_looking_at_object_index

◆ m_looking_at_parameter_list

bool octave::lexical_feedback::m_looking_at_parameter_list
inherited

◆ m_looking_at_return_list

bool octave::lexical_feedback::m_looking_at_return_list
inherited

◆ m_looking_for_object_index

bool octave::lexical_feedback::m_looking_for_object_index
inherited

◆ m_looping

◆ m_maybe_classdef_get_set_method

bool octave::lexical_feedback::m_maybe_classdef_get_set_method
inherited

◆ m_nesting_level

◆ m_package_name

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

Definition at line 503 of file lex.h.

Referenced by octave::lexical_feedback::reset(), and octave::base_parser::start_function().

◆ m_parsed_function_name

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

◆ m_parsing_anon_fcn_body

bool octave::lexical_feedback::m_parsing_anon_fcn_body
inherited

◆ m_parsing_class_method

bool octave::lexical_feedback::m_parsing_class_method
inherited

Definition at line 398 of file lex.h.

Referenced by octave::lexical_feedback::reset(), and octave::base_parser::start_function().

◆ m_parsing_classdef

bool octave::lexical_feedback::m_parsing_classdef
inherited

◆ m_parsing_classdef_decl

bool octave::lexical_feedback::m_parsing_classdef_decl
inherited

Definition at line 406 of file lex.h.

Referenced by octave::base_lexer::handle_op(), and octave::lexical_feedback::reset().

◆ m_parsing_classdef_get_method

bool octave::lexical_feedback::m_parsing_classdef_get_method
inherited

Definition at line 418 of file lex.h.

Referenced by octave::lexical_feedback::reset(), and octave::base_parser::start_function().

◆ m_parsing_classdef_set_method

bool octave::lexical_feedback::m_parsing_classdef_set_method
inherited

Definition at line 421 of file lex.h.

Referenced by octave::lexical_feedback::reset(), and octave::base_parser::start_function().

◆ m_parsing_classdef_superclass

bool octave::lexical_feedback::m_parsing_classdef_superclass
inherited

Definition at line 410 of file lex.h.

Referenced by octave::base_lexer::handle_op(), and octave::lexical_feedback::reset().

◆ m_pending_local_variables

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

◆ m_quote_is_transpose

bool octave::lexical_feedback::m_quote_is_transpose
inherited

Definition at line 424 of file lex.h.

Referenced by octave::lexical_feedback::reset().

◆ m_reading_classdef_file

◆ m_reading_fcn_file

◆ m_reading_script_file

◆ m_scanner

◆ m_string_text

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

◆ m_symtab_context

◆ m_tok_beg

◆ m_tok_end

◆ m_token_count

size_t octave::lexical_feedback::m_token_count
inherited

◆ m_tokens

◆ start_state_stack

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

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