GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
base_lexer Class Referenceabstract

#include "lex.h"

Inheritance diagram for base_lexer:
lexical_feedback lexer push_lexer

Classes

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_internal (int tok_id)
 
tokencurrent_token ()
 
bool debug_flag () const
 
void display_start_state () const
 
void display_token (int tok_id)
 
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_list get_comment_list ()
 
int handle_close_bracket (int bracket_type)
 
void handle_continuation ()
 
int handle_end_of_input ()
 
int handle_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_id, bool bos=false, bool compat=true)
 
int handle_superclass_identifier ()
 
int handle_token (int tok_id)
 
int handle_token (token *tok)
 
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 ()
 
tokenmake_fq_identifier_token (const std::string &ident)
 
tokenmake_keyword_token (const std::string &s)
 
tokenmake_meta_identifier_token (const std::string &cls)
 
bool maybe_unput_comma_before_unary_op (int tok_id)
 
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_id)
 
int start_state () const
 
int syntax_error (const std::string &msg)
 
int syntax_error (const std::string &msg, const filepos &beg_pos, const filepos &end_pos)
 
int syntax_error (const std::string &msg, const filepos &pos)
 
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_list m_comment_list
 
input_buffer m_input_buf
 
void * m_scanner
 

Protected Attributes

std::stack< intstart_state_stack
 

Detailed Description

Definition at line 529 of file lex.h.

Constructor & Destructor Documentation

◆ base_lexer()

base_lexer::base_lexer ( interpreter interp)
inline

Definition at line 562 of file lex.h.

References init().

◆ ~base_lexer()

base_lexer::~base_lexer ( )
virtual

Definition at line 5248 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 584 of file lex.h.

References base_lexer::input_buffer::empty(), and m_input_buf.

Referenced by push_parser::run().

◆ at_end_of_file()

bool base_lexer::at_end_of_file ( ) const
inline

Definition at line 586 of file lex.h.

References base_lexer::input_buffer::at_eof(), and m_input_buf.

◆ begin_string()

void base_lexer::begin_string ( int  state)

Definition at line 5306 of file lex.cc.

References lexical_feedback::m_filepos, and lexical_feedback::m_tok_beg.

◆ check_comment_for_hash_char()

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

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

References INITIAL.

◆ count_token_internal()

int base_lexer::count_token_internal ( int  tok_id)

Definition at line 6803 of file lex.cc.

◆ current_token()

token * base_lexer::current_token ( )

Definition at line 6440 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 6581 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 lexer, and push_lexer.

◆ finish_command_arg()

◆ finish_comment()

◆ flex_yyleng()

int base_lexer::flex_yyleng ( )

Definition at line 5344 of file lex.cc.

References m_scanner, and yyget_leng.

◆ flex_yytext()

char * base_lexer::flex_yytext ( )

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

References iskeyword().

◆ get_comment_list()

comment_list base_lexer::get_comment_list ( )
inline

Definition at line 620 of file lex.h.

References comment_list::clear(), and m_comment_list.

◆ handle_close_bracket()

◆ handle_continuation()

◆ handle_end_of_input()

◆ handle_identifier()

◆ handle_number() [1/7]

◆ handle_number() [2/7]

◆ handle_number() [3/7]

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

◆ handle_token() [1/2]

int base_lexer::handle_token ( int  tok_id)

Definition at line 6783 of file lex.cc.

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

◆ handle_token() [2/2]

int base_lexer::handle_token ( token tok)

Definition at line 6789 of file lex.cc.

References lexical_feedback::m_arguments_is_keyword, and token::token_id().

◆ increment_token_count()

void base_lexer::increment_token_count ( )

◆ init()

void base_lexer::init ( )

Definition at line 5254 of file lex.cc.

References m_scanner, yylex_init, and yyset_extra.

Referenced by base_lexer().

◆ input_from_eval_string()

virtual bool base_lexer::input_from_eval_string ( ) const
inlinevirtual

Reimplemented in lexer.

Definition at line 690 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 688 of file lex.h.

◆ input_from_terminal()

virtual bool base_lexer::input_from_terminal ( ) const
inlinevirtual

Reimplemented in lexer.

Definition at line 686 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 lexer, and push_lexer.

Definition at line 684 of file lex.h.

◆ inside_any_object_index()

bool base_lexer::inside_any_object_index ( )

Definition at line 5429 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 574 of file lex.h.

◆ lexer_debug()

void base_lexer::lexer_debug ( const char *  pattern)

Definition at line 6610 of file lex.cc.

◆ looking_at_space()

bool base_lexer::looking_at_space ( )

Definition at line 5421 of file lex.cc.

◆ looks_like_command_arg()

◆ make_fq_identifier_token()

token * base_lexer::make_fq_identifier_token ( const std::string &  ident)

◆ make_keyword_token()

token * base_lexer::make_keyword_token ( const std::string &  s)

Definition at line 5446 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, 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_id, 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.

◆ make_meta_identifier_token()

token * base_lexer::make_meta_identifier_token ( const std::string &  cls)

◆ maybe_unput_comma_before_unary_op()

bool base_lexer::maybe_unput_comma_before_unary_op ( int  tok_id)

◆ maybe_warn_language_extension_comment()

void base_lexer::maybe_warn_language_extension_comment ( char  c)

Definition at line 6376 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 6447 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 6642 of file lex.cc.

References BEGIN, and OCTAVE_YYG.

◆ prep_for_file()

void base_lexer::prep_for_file ( )

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

References BEGIN, and OCTAVE_YYG.

◆ push_token()

void base_lexer::push_token ( token tok)

◆ reset()

◆ show_token()

int base_lexer::show_token ( int  tok_id)

Definition at line 6812 of file lex.cc.

◆ start_state()

int base_lexer::start_state ( ) const
inline

Definition at line 700 of file lex.h.

References start_state_stack.

◆ syntax_error() [1/3]

int base_lexer::syntax_error ( const std::string &  msg)

Definition at line 6410 of file lex.cc.

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

◆ syntax_error() [2/3]

int base_lexer::syntax_error ( const std::string &  msg,
const filepos beg_pos,
const filepos end_pos 
)

Definition at line 6422 of file lex.cc.

References LEXICAL_ERROR, and token::token_id().

◆ syntax_error() [3/3]

int base_lexer::syntax_error ( const std::string &  msg,
const filepos pos 
)

Definition at line 6416 of file lex.cc.

◆ text_yyinput()

int base_lexer::text_yyinput ( )

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

◆ warn_language_extension_operator()

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

Definition at line 6389 of file lex.cc.

◆ whitespace_is_significant()

◆ xunput() [1/2]

void base_lexer::xunput ( char  c)

Definition at line 5401 of file lex.cc.

◆ xunput() [2/2]

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

Definition at line 5385 of file lex.cc.

References m_scanner.

Member Data Documentation

◆ m_comment_list

comment_list base_lexer::m_comment_list

Definition at line 682 of file lex.h.

Referenced by get_comment_list().

◆ m_input_buf

input_buffer base_lexer::m_input_buf

Definition at line 679 of file lex.h.

Referenced by at_end_of_buffer(), and at_end_of_file().

◆ m_scanner

void* base_lexer::m_scanner

Definition at line 676 of file lex.h.

Referenced by push_parser::run().

◆ start_state_stack

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

Definition at line 719 of file lex.h.

Referenced by start_state().


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