GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
base_lexer Class Referenceabstract

#include "lex.h"

Inheritance diagram for base_lexer:
lexical_feedback lexer push_lexer

Classes

class  comment_buffer
 
class  input_buffer
 

Public Member Functions

 base_lexer (interpreter &interp)
 
virtual ~base_lexer ()
 
bool at_end_of_buffer () const
 
bool at_end_of_file () const
 
void begin_string (int state)
 
void check_comment_for_hash_char (const char *txt, std::size_t len)
 
void clear_start_state ()
 
int count_token (int tok)
 
int count_token_internal (int tok)
 
tokencurrent_token ()
 
bool debug_flag () const
 
void display_start_state () const
 
void display_token (int tok)
 
bool display_tokens () const
 
void fatal_error (const char *msg)
 
virtual int fill_flex_buffer (char *buf, unsigned int max_size)=0
 
int finish_command_arg ()
 
void finish_comment (comment_elt::comment_type typ)
 
int flex_yyleng ()
 
char * flex_yytext ()
 
bool fq_identifier_contains_keyword (const std::string &s)
 
comment_listget_comment ()
 
int handle_close_bracket (int bracket_type)
 
void handle_continuation ()
 
int handle_end_of_input ()
 
int handle_fq_identifier ()
 
int handle_identifier ()
 
int handle_meta_identifier ()
 
template<>
int handle_number ()
 
template<>
int handle_number ()
 
template<>
int handle_number ()
 
template<int base>
int handle_number ()
 
template<>
int handle_number ()
 
template<>
int handle_number ()
 
template<>
int handle_number ()
 
int handle_op (int tok, bool bos=false, bool compat=true)
 
int handle_superclass_identifier ()
 
int handle_token (int tok, token *tok_val=nullptr)
 
void increment_token_count ()
 
void init ()
 
virtual bool input_from_eval_string () const
 
virtual bool input_from_file () const
 
virtual bool input_from_terminal () const
 
bool input_from_tmp_history_file ()
 
virtual std::string input_source () const
 
bool inside_any_object_index ()
 
virtual bool is_push_lexer () const
 
void lexer_debug (const char *pattern)
 
bool looking_at_space ()
 
bool looks_like_command_arg ()
 
int make_keyword_token (const std::string &s)
 
bool maybe_unput_comma_before_unary_op (int tok)
 
void maybe_warn_language_extension_comment (char c)
 
void maybe_warn_separator_insert (char sep)
 
std::size_t pending_token_count () const
 
void pop_start_state ()
 
void prep_for_file ()
 
void push_start_state (int state)
 
void push_token (token *)
 
virtual void reset ()
 
int show_token (int tok)
 
int start_state () const
 
int text_yyinput ()
 
void update_token_positions (int tok_len)
 
void warn_deprecated_syntax (const std::string &msg)
 
void warn_language_extension (const std::string &msg)
 
void warn_language_extension_continuation ()
 
void warn_language_extension_operator (const std::string &op)
 
bool whitespace_is_significant ()
 
void xunput (char c)
 
void xunput (char c, char *buf)
 

Public Attributes

comment_buffer m_comment_buf
 
input_buffer m_input_buf
 
void * m_scanner
 

Protected Attributes

std::stack< int > start_state_stack
 

Detailed Description

Definition at line 527 of file lex.h.

Constructor & Destructor Documentation

◆ base_lexer()

base_lexer::base_lexer ( interpreter interp)
inline

Definition at line 605 of file lex.h.

◆ ~base_lexer()

base_lexer::~base_lexer ( )
virtual

Definition at line 5265 of file lex.cc.

References m_scanner, and yylex_destroy.

Member Function Documentation

◆ at_end_of_buffer()

bool base_lexer::at_end_of_buffer ( ) const
inline

Definition at line 628 of file lex.h.

◆ at_end_of_file()

bool base_lexer::at_end_of_file ( ) const
inline

Definition at line 630 of file lex.h.

◆ begin_string()

void base_lexer::begin_string ( int  state)

Definition at line 5323 of file lex.cc.

◆ check_comment_for_hash_char()

void base_lexer::check_comment_for_hash_char ( const char *  txt,
std::size_t  len 
)

Definition at line 6415 of file lex.cc.

References len, and lexical_feedback::m_comment_uses_hash_char.

◆ clear_start_state()

void base_lexer::clear_start_state ( )

Definition at line 6712 of file lex.cc.

References INITIAL.

◆ count_token()

int base_lexer::count_token ( int  tok)

Definition at line 6856 of file lex.cc.

References lexical_feedback::m_tok_beg, and lexical_feedback::m_tok_end.

◆ count_token_internal()

int base_lexer::count_token_internal ( int  tok)

Definition at line 6866 of file lex.cc.

◆ current_token()

token * base_lexer::current_token ( )

Definition at line 6500 of file lex.cc.

References m_scanner, yyget_lval, and YYSTYPE.

◆ debug_flag()

bool base_lexer::debug_flag ( ) const

◆ display_start_state()

void base_lexer::display_start_state ( ) const

◆ display_token()

◆ display_tokens()

bool base_lexer::display_tokens ( ) const

◆ fatal_error()

void base_lexer::fatal_error ( const char *  msg)

Definition at line 6641 of file lex.cc.

References error().

◆ fill_flex_buffer()

virtual int base_lexer::fill_flex_buffer ( char *  buf,
unsigned int  max_size 
)
pure virtual

Implemented in push_lexer, and lexer.

◆ finish_command_arg()

◆ finish_comment()

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

Definition at line 6196 of file lex.cc.

◆ flex_yyleng()

int base_lexer::flex_yyleng ( )

Definition at line 5362 of file lex.cc.

References m_scanner, and yyget_leng.

◆ flex_yytext()

char * base_lexer::flex_yytext ( )

Definition at line 5356 of file lex.cc.

References m_scanner, and yyget_text.

◆ fq_identifier_contains_keyword()

bool base_lexer::fq_identifier_contains_keyword ( const std::string &  s)

Definition at line 5746 of file lex.cc.

References iskeyword().

◆ get_comment()

comment_list* base_lexer::get_comment ( )
inline

Definition at line 664 of file lex.h.

Referenced by base_parser::make_statement().

◆ handle_close_bracket()

◆ handle_continuation()

void base_lexer::handle_continuation ( )

Definition at line 6129 of file lex.cc.

◆ handle_end_of_input()

◆ handle_fq_identifier()

int base_lexer::handle_fq_identifier ( )

Definition at line 6312 of file lex.cc.

◆ handle_identifier()

◆ handle_meta_identifier()

int base_lexer::handle_meta_identifier ( )

Definition at line 6281 of file lex.cc.

◆ handle_number() [1/7]

template<>
int base_lexer::handle_number ( )

Definition at line 5844 of file lex.cc.

◆ handle_number() [2/7]

template<>
int base_lexer::handle_number ( )

Definition at line 5937 of file lex.cc.

References imag(), and OCTAVE_LOCAL_BUFFER.

◆ handle_number() [3/7]

template<>
int base_lexer::handle_number ( )

Definition at line 6052 of file lex.cc.

◆ handle_number() [4/7]

template<int base>
int base_lexer::handle_number ( )

◆ handle_number() [5/7]

template<>
int base_lexer::handle_number ( )

◆ handle_number() [6/7]

template<>
int base_lexer::handle_number ( )

◆ handle_number() [7/7]

template<>
int base_lexer::handle_number ( )

◆ handle_op()

◆ handle_superclass_identifier()

int base_lexer::handle_superclass_identifier ( )

Definition at line 6247 of file lex.cc.

◆ handle_token()

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

Definition at line 6845 of file lex.cc.

References lexical_feedback::m_tok_beg, and lexical_feedback::m_tok_end.

◆ increment_token_count()

void base_lexer::increment_token_count ( )

◆ init()

void base_lexer::init ( )

Definition at line 5271 of file lex.cc.

References m_scanner, yylex_init, and yyset_extra.

◆ input_from_eval_string()

virtual bool base_lexer::input_from_eval_string ( ) const
inlinevirtual

Reimplemented in lexer.

Definition at line 725 of file lex.h.

Referenced by base_parser::make_anon_fcn_handle().

◆ input_from_file()

virtual bool base_lexer::input_from_file ( ) const
inlinevirtual

Reimplemented in lexer.

Definition at line 723 of file lex.h.

◆ input_from_terminal()

virtual bool base_lexer::input_from_terminal ( ) const
inlinevirtual

Reimplemented in lexer.

Definition at line 721 of file lex.h.

Referenced by base_parser::make_anon_fcn_handle().

◆ input_from_tmp_history_file()

bool base_lexer::input_from_tmp_history_file ( )

◆ input_source()

virtual std::string base_lexer::input_source ( ) const
inlinevirtual

Reimplemented in push_lexer, and lexer.

Definition at line 719 of file lex.h.

◆ inside_any_object_index()

bool base_lexer::inside_any_object_index ( )

Definition at line 5447 of file lex.cc.

References lexical_feedback::m_looking_at_object_index.

◆ is_push_lexer()

virtual bool base_lexer::is_push_lexer ( ) const
inlinevirtual

Reimplemented in push_lexer.

Definition at line 618 of file lex.h.

◆ lexer_debug()

void base_lexer::lexer_debug ( const char *  pattern)

Definition at line 6670 of file lex.cc.

◆ looking_at_space()

bool base_lexer::looking_at_space ( )

Definition at line 5439 of file lex.cc.

◆ looks_like_command_arg()

◆ make_keyword_token()

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

Definition at line 5464 of file lex.cc.

References token::arguments_end, arguments_kw, break_kw, case_kw, catch_kw, token::classdef_end, classdef_kw, continue_kw, do_kw, else_kw, elseif_kw, end_kw, end_try_catch_kw, end_unwind_protect_kw, endarguments_kw, endclassdef_kw, endenumeration_kw, endevents_kw, endfor_kw, endfunction_kw, endif_kw, endmethods_kw, endparfor_kw, endproperties_kw, endspmd_kw, endswitch_kw, endwhile_kw, token::enumeration_end, enumeration_kw, token::events_end, events_kw, token::for_end, for_kw, token::function_end, function_kw, get_kw, global_kw, token::if_end, if_kw, octave_kw_hash::in_word_set(), octave_kw::kw_id, filepos::line(), lexical_feedback::m_arguments_is_keyword, lexical_feedback::m_at_beginning_of_statement, lexical_feedback::m_buffer_function_text, lexical_feedback::m_classdef_element_names_are_keywords, lexical_feedback::m_current_input_line, lexical_feedback::m_defining_fcn, lexical_feedback::m_fcn_file_full_name, lexical_feedback::m_filepos, lexical_feedback::m_force_script, lexical_feedback::m_function_text, lexical_feedback::m_looking_at_decl_list, lexical_feedback::m_looking_at_return_list, lexical_feedback::m_looping, lexical_feedback::m_maybe_classdef_get_set_method, lexical_feedback::m_parsed_function_name, lexical_feedback::m_reading_classdef_file, lexical_feedback::m_reading_fcn_file, lexical_feedback::m_reading_script_file, lexical_feedback::m_tok_beg, lexical_feedback::m_tok_end, lexical_feedback::m_token_count, magic_file_kw, magic_line_kw, token::methods_end, methods_kw, otherwise_kw, panic_impossible, token::parfor_end, parfor_kw, persistent_kw, token::properties_end, properties_kw, return_kw, set_kw, token::simple_end, token::spmd_end, spmd_kw, token::switch_end, switch_kw, octave_kw::tok, 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.

◆ maybe_unput_comma_before_unary_op()

bool base_lexer::maybe_unput_comma_before_unary_op ( int  tok)

◆ maybe_warn_language_extension_comment()

void base_lexer::maybe_warn_language_extension_comment ( char  c)

Definition at line 6458 of file lex.cc.

◆ maybe_warn_separator_insert()

void base_lexer::maybe_warn_separator_insert ( char  sep)

◆ pending_token_count()

std::size_t base_lexer::pending_token_count ( ) const

Definition at line 6507 of file lex.cc.

References lexical_feedback::m_tokens, and lexical_feedback::token_cache::size().

◆ pop_start_state()

void base_lexer::pop_start_state ( )

Definition at line 6702 of file lex.cc.

References BEGIN, and OCTAVE_YYG.

◆ prep_for_file()

void base_lexer::prep_for_file ( )

Definition at line 5315 of file lex.cc.

References INPUT_FILE_START, and lexical_feedback::m_reading_script_file.

◆ push_start_state()

void base_lexer::push_start_state ( int  state)

Definition at line 6692 of file lex.cc.

◆ push_token()

void base_lexer::push_token ( token tok)

◆ reset()

◆ show_token()

int base_lexer::show_token ( int  tok)

Definition at line 6875 of file lex.cc.

◆ start_state()

int base_lexer::start_state ( ) const
inline

Definition at line 735 of file lex.h.

◆ text_yyinput()

int base_lexer::text_yyinput ( )

Definition at line 5368 of file lex.cc.

References m_scanner.

◆ update_token_positions()

void base_lexer::update_token_positions ( int  tok_len)

◆ warn_deprecated_syntax()

void base_lexer::warn_deprecated_syntax ( const std::string &  msg)

◆ warn_language_extension()

void base_lexer::warn_language_extension ( const std::string &  msg)

◆ warn_language_extension_continuation()

void base_lexer::warn_language_extension_continuation ( )

Definition at line 6465 of file lex.cc.

◆ warn_language_extension_operator()

void base_lexer::warn_language_extension_operator ( const std::string &  op)

Definition at line 6471 of file lex.cc.

References n.

◆ whitespace_is_significant()

◆ xunput() [1/2]

void base_lexer::xunput ( char  c)

Definition at line 5419 of file lex.cc.

◆ xunput() [2/2]

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

Definition at line 5403 of file lex.cc.

Member Data Documentation

◆ m_comment_buf

◆ m_input_buf

input_buffer base_lexer::m_input_buf

Definition at line 714 of file lex.h.

◆ m_scanner

void* base_lexer::m_scanner

Definition at line 711 of file lex.h.

◆ start_state_stack

std::stack<int> base_lexer::start_state_stack
protected

Definition at line 755 of file lex.h.


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