#include "lex.h"
Classes | |
class | bbp_nesting_level |
class | symbol_table_context |
class | token_cache |
Public Member Functions | |
lexical_feedback (interpreter &interp) | |
~lexical_feedback () | |
void | init () |
void | mark_as_variable (const std::string &nm) |
void | mark_as_variables (const std::list< std::string > &lst) |
void | mark_previous_token_trailing_space () |
token * | previous_token () |
const token * | previous_token () const |
int | previous_token_id () const |
bool | previous_token_is (const token *tok) const |
bool | previous_token_is (int tok_id) const |
bool | previous_token_is_binop () const |
bool | previous_token_is_keyword () const |
bool | previous_token_may_be_command () const |
void | reset () |
bool | space_follows_previous_token () const |
|
inline |
lexical_feedback::~lexical_feedback | ( | ) |
Definition at line 4983 of file lex.cc.
References lexical_feedback::token_cache::clear(), and m_tokens.
void lexical_feedback::init | ( | ) |
Definition at line 4989 of file lex.cc.
References m_looking_at_object_index.
Referenced by lexical_feedback().
void lexical_feedback::mark_as_variable | ( | const std::string & | nm | ) |
Definition at line 5132 of file lex.cc.
References lexical_feedback::symbol_table_context::curr_scope(), m_symtab_context, and symbol_scope::mark_as_variable().
Referenced by base_parser::make_assign_op(), and base_parser::make_for_command().
void lexical_feedback::mark_as_variables | ( | const std::list< std::string > & | lst | ) |
Definition at line 5141 of file lex.cc.
References lexical_feedback::symbol_table_context::curr_scope(), m_symtab_context, and symbol_scope::mark_as_variables().
Referenced by base_parser::make_assign_op(), base_parser::make_decl_command(), base_parser::make_for_command(), octave_push_parse(), and base_parser::validate_matrix_for_assignment().
void lexical_feedback::mark_previous_token_trailing_space | ( | ) |
Definition at line 5090 of file lex.cc.
References token::mark_trailing_space(), previous_token(), and previous_token_is().
Referenced by base_lexer::handle_continuation().
token * lexical_feedback::previous_token | ( | ) |
Definition at line 5057 of file lex.cc.
References lexical_feedback::token_cache::front(), and m_tokens.
Referenced by mark_previous_token_trailing_space(), previous_token_id(), previous_token_is(), previous_token_is(), previous_token_is_keyword(), previous_token_may_be_command(), and space_follows_previous_token().
const token * lexical_feedback::previous_token | ( | ) | const |
Definition at line 5063 of file lex.cc.
References lexical_feedback::token_cache::front(), and m_tokens.
int lexical_feedback::previous_token_id | ( | ) | const |
Definition at line 5069 of file lex.cc.
References previous_token(), and token::token_id().
Referenced by base_lexer::maybe_unput_comma_before_unary_op(), and previous_token_is_binop().
Definition at line 5083 of file lex.cc.
References previous_token(), and token::token_is().
Definition at line 5076 of file lex.cc.
References previous_token(), and token::token_is().
Referenced by mark_previous_token_trailing_space().
bool lexical_feedback::previous_token_is_binop | ( | ) | const |
Definition at line 5105 of file lex.cc.
References ADD_EQ, AND_EQ, DIV_EQ, EDIV, EDIV_EQ, ELEFTDIV, ELEFTDIV_EQ, EMUL, EMUL_EQ, EPOW, EPOW_EQ, EXPR_AND, EXPR_AND_AND, EXPR_EQ, EXPR_GE, EXPR_GT, EXPR_LE, EXPR_LT, EXPR_NE, EXPR_OR, EXPR_OR_OR, LEFTDIV, LEFTDIV_EQ, MUL_EQ, OR_EQ, POW, POW_EQ, previous_token_id(), and SUB_EQ.
Referenced by base_lexer::maybe_unput_comma_before_unary_op().
bool lexical_feedback::previous_token_is_keyword | ( | ) | const |
Definition at line 5125 of file lex.cc.
References token::iskeyword(), and previous_token().
bool lexical_feedback::previous_token_may_be_command | ( | ) | const |
Definition at line 5150 of file lex.cc.
References m_allow_command_syntax, token::may_be_command(), and previous_token().
Referenced by base_lexer::looks_like_command_arg().
void lexical_feedback::reset | ( | ) |
Definition at line 4997 of file lex.cc.
References lexical_feedback::symbol_table_context::clear(), lexical_feedback::token_cache::clear(), m_allow_command_syntax, m_arguments_is_keyword, m_at_beginning_of_statement, m_block_comment_nesting_level, m_braceflag, m_bracketflag, m_buffer_function_text, m_classdef_element_names_are_keywords, m_command_arg_paren_count, m_comment_text, m_comment_uses_hash_char, m_current_input_line, m_defining_fcn, m_dir_name, m_end_of_input, m_fcn_file_full_name, m_fcn_file_name, m_filepos, m_force_script, m_function_text, m_looking_at_anon_fcn_args, m_looking_at_decl_list, m_looking_at_function_handle, m_looking_at_indirect_ref, m_looking_at_matrix_or_assign_lhs, m_looking_at_object_index, m_looking_at_parameter_list, m_looking_at_return_list, m_looking_for_object_index, m_looping, m_maybe_classdef_get_set_method, m_nesting_level, m_package_name, m_parsed_function_name, m_parsing_anon_fcn_body, m_parsing_class_method, m_parsing_classdef, m_parsing_classdef_decl, m_parsing_classdef_get_method, m_parsing_classdef_set_method, m_parsing_classdef_superclass, m_quote_is_transpose, m_reading_classdef_file, m_reading_fcn_file, m_reading_script_file, m_string_text, m_symtab_context, m_tok_beg, m_tok_end, m_token_count, m_tokens, and lexical_feedback::bbp_nesting_level::reset().
Referenced by base_lexer::reset().
bool lexical_feedback::space_follows_previous_token | ( | ) | const |
Definition at line 5098 of file lex.cc.
References previous_token(), and token::space_follows_token().
Referenced by base_lexer::looks_like_command_arg(), and base_lexer::maybe_unput_comma_before_unary_op().
bool lexical_feedback::m_allow_command_syntax |
Definition at line 354 of file lex.h.
Referenced by base_parser::disallow_command_syntax(), base_lexer::looks_like_command_arg(), previous_token_may_be_command(), and reset().
bool lexical_feedback::m_arguments_is_keyword |
Definition at line 385 of file lex.h.
Referenced by base_lexer::handle_token(), base_lexer::make_keyword_token(), octave_push_parse(), and reset().
bool lexical_feedback::m_at_beginning_of_statement |
Definition at line 358 of file lex.h.
Referenced by base_lexer::finish_comment(), base_lexer::handle_close_bracket(), base_lexer::handle_continuation(), base_lexer::handle_identifier(), base_lexer::handle_number(), base_lexer::handle_op(), base_lexer::make_keyword_token(), octave_push_parse(), and reset().
int lexical_feedback::m_block_comment_nesting_level |
Definition at line 460 of file lex.h.
Referenced by base_lexer::handle_end_of_input(), and reset().
int lexical_feedback::m_braceflag |
Definition at line 448 of file lex.h.
Referenced by base_lexer::handle_close_bracket(), and reset().
int lexical_feedback::m_bracketflag |
Definition at line 445 of file lex.h.
Referenced by base_lexer::handle_close_bracket(), and reset().
bool lexical_feedback::m_buffer_function_text |
Definition at line 438 of file lex.h.
Referenced by lexer::fill_flex_buffer(), base_parser::finish_function(), base_lexer::make_keyword_token(), and reset().
bool lexical_feedback::m_classdef_element_names_are_keywords |
Definition at line 389 of file lex.h.
Referenced by base_lexer::make_keyword_token(), octave_push_parse(), and reset().
int lexical_feedback::m_command_arg_paren_count |
Definition at line 463 of file lex.h.
Referenced by base_lexer::finish_command_arg(), and reset().
std::string lexical_feedback::m_comment_text |
Definition at line 487 of file lex.h.
Referenced by base_lexer::finish_comment(), base_lexer::handle_continuation(), and reset().
bool lexical_feedback::m_comment_uses_hash_char |
Definition at line 442 of file lex.h.
Referenced by base_lexer::check_comment_for_hash_char(), base_lexer::finish_comment(), base_lexer::handle_continuation(), and reset().
std::string lexical_feedback::m_current_input_line |
Definition at line 483 of file lex.h.
Referenced by push_lexer::append_input(), base_parser::bison_error(), lexer::fill_flex_buffer(), base_lexer::make_keyword_token(), and reset().
int lexical_feedback::m_defining_fcn |
Definition at line 454 of file lex.h.
Referenced by base_lexer::make_keyword_token(), octave_push_parse(), base_parser::recover_from_parsing_function(), and reset().
std::string lexical_feedback::m_dir_name |
Definition at line 499 of file lex.h.
Referenced by base_parser::finish_function(), base_parser::make_script(), reset(), and base_parser::start_function().
bool lexical_feedback::m_end_of_input |
Definition at line 351 of file lex.h.
Referenced by base_parser::finish_input(), octave_push_parse(), and reset().
std::string lexical_feedback::m_fcn_file_full_name |
Definition at line 496 of file lex.h.
Referenced by base_parser::bison_error(), base_parser::make_anon_fcn_handle(), base_parser::make_classdef(), base_parser::make_decl_command(), base_lexer::make_keyword_token(), base_parser::make_script(), base_lexer::maybe_warn_separator_insert(), reset(), parser::run(), push_parser::run(), base_parser::start_function(), base_lexer::warn_deprecated_syntax(), and base_lexer::warn_language_extension().
std::string lexical_feedback::m_fcn_file_name |
Definition at line 493 of file lex.h.
Referenced by base_lexer::handle_end_of_input(), base_parser::make_classdef(), base_parser::make_fcn_name(), base_parser::make_script(), reset(), and base_parser::start_function().
filepos lexical_feedback::m_filepos |
Definition at line 470 of file lex.h.
Referenced by base_lexer::begin_string(), base_parser::bison_error(), base_lexer::handle_continuation(), base_lexer::handle_end_of_input(), base_lexer::handle_superclass_identifier(), base_lexer::make_fq_identifier_token(), base_lexer::make_keyword_token(), base_lexer::make_meta_identifier_token(), base_lexer::maybe_warn_separator_insert(), reset(), base_lexer::update_token_positions(), base_lexer::warn_deprecated_syntax(), and base_lexer::warn_language_extension().
bool lexical_feedback::m_force_script |
Definition at line 425 of file lex.h.
Referenced by base_lexer::make_keyword_token(), reset(), and base_parser::start_function().
std::string lexical_feedback::m_function_text |
Definition at line 490 of file lex.h.
Referenced by lexer::fill_flex_buffer(), base_parser::finish_function(), base_lexer::make_keyword_token(), and reset().
interpreter& lexical_feedback::m_interpreter |
Definition at line 348 of file lex.h.
Referenced by lexical_feedback::symbol_table_context::curr_scope(), base_lexer::debug_flag(), base_lexer::display_tokens(), lexer::fill_flex_buffer(), base_parser::finish_array_list(), base_parser::finish_classdef_file(), base_lexer::increment_token_count(), base_lexer::input_from_tmp_history_file(), base_parser::make_colon_expression(), base_lexer::reset(), and base_parser::validate_matrix_for_assignment().
bool lexical_feedback::m_looking_at_anon_fcn_args |
Definition at line 361 of file lex.h.
Referenced by octave_push_parse(), and reset().
bool lexical_feedback::m_looking_at_decl_list |
Definition at line 371 of file lex.h.
Referenced by base_lexer::make_keyword_token(), octave_push_parse(), and reset().
int lexical_feedback::m_looking_at_function_handle |
Definition at line 457 of file lex.h.
Referenced by octave_push_parse(), and reset().
bool lexical_feedback::m_looking_at_indirect_ref |
Definition at line 382 of file lex.h.
Referenced by base_lexer::handle_identifier(), base_parser::make_indirect_ref(), base_parser::make_indirect_ref(), octave_push_parse(), and reset().
bool lexical_feedback::m_looking_at_matrix_or_assign_lhs |
Definition at line 375 of file lex.h.
Referenced by octave_push_parse(), and reset().
std::list<bool> lexical_feedback::m_looking_at_object_index |
Definition at line 506 of file lex.h.
Referenced by base_lexer::handle_close_bracket(), init(), base_lexer::inside_any_object_index(), reset(), and base_lexer::whitespace_is_significant().
bool lexical_feedback::m_looking_at_parameter_list |
Definition at line 367 of file lex.h.
Referenced by octave_push_parse(), base_parser::recover_from_parsing_function(), and reset().
bool lexical_feedback::m_looking_at_return_list |
Definition at line 364 of file lex.h.
Referenced by base_lexer::make_keyword_token(), octave_push_parse(), base_parser::recover_from_parsing_function(), and reset().
bool lexical_feedback::m_looking_for_object_index |
Definition at line 378 of file lex.h.
Referenced by base_lexer::handle_close_bracket(), base_lexer::handle_identifier(), base_lexer::handle_number(), base_lexer::handle_op(), base_lexer::make_fq_identifier_token(), base_lexer::make_meta_identifier_token(), octave_push_parse(), and reset().
int lexical_feedback::m_looping |
Definition at line 451 of file lex.h.
Referenced by base_parser::make_break_command(), base_parser::make_continue_command(), base_parser::make_do_until_command(), base_parser::make_for_command(), base_lexer::make_keyword_token(), base_parser::make_while_command(), and reset().
bool lexical_feedback::m_maybe_classdef_get_set_method |
Definition at line 412 of file lex.h.
Referenced by base_parser::make_fcn_name(), base_lexer::make_keyword_token(), octave_push_parse(), and reset().
bbp_nesting_level lexical_feedback::m_nesting_level |
Definition at line 518 of file lex.h.
Referenced by base_lexer::handle_close_bracket(), octave_push_parse(), reset(), and base_lexer::whitespace_is_significant().
std::string lexical_feedback::m_package_name |
Definition at line 502 of file lex.h.
Referenced by reset(), and base_parser::start_function().
std::stack<bool> lexical_feedback::m_parsed_function_name |
Definition at line 511 of file lex.h.
Referenced by base_parser::make_fcn_name(), base_lexer::make_keyword_token(), octave_push_parse(), base_parser::recover_from_parsing_function(), and reset().
bool lexical_feedback::m_parsing_anon_fcn_body |
Definition at line 392 of file lex.h.
Referenced by base_lexer::handle_identifier(), octave_push_parse(), and reset().
bool lexical_feedback::m_parsing_class_method |
Definition at line 395 of file lex.h.
Referenced by reset(), and base_parser::start_function().
bool lexical_feedback::m_parsing_classdef |
Definition at line 398 of file lex.h.
Referenced by base_parser::make_function(), octave_push_parse(), reset(), and base_parser::start_function().
bool lexical_feedback::m_parsing_classdef_decl |
Definition at line 403 of file lex.h.
Referenced by base_lexer::handle_op(), octave_push_parse(), and reset().
bool lexical_feedback::m_parsing_classdef_get_method |
Definition at line 415 of file lex.h.
Referenced by octave_push_parse(), reset(), and base_parser::start_function().
bool lexical_feedback::m_parsing_classdef_set_method |
Definition at line 418 of file lex.h.
Referenced by octave_push_parse(), reset(), and base_parser::start_function().
bool lexical_feedback::m_parsing_classdef_superclass |
Definition at line 407 of file lex.h.
Referenced by base_lexer::handle_op(), octave_push_parse(), and reset().
bool lexical_feedback::m_quote_is_transpose |
bool lexical_feedback::m_reading_classdef_file |
Definition at line 434 of file lex.h.
Referenced by base_parser::bison_error(), base_parser::finish_classdef_file(), base_lexer::handle_end_of_input(), base_lexer::make_keyword_token(), octave_push_parse(), reset(), base_lexer::reset(), and base_parser::start_function().
bool lexical_feedback::m_reading_fcn_file |
Definition at line 428 of file lex.h.
Referenced by base_parser::bison_error(), base_parser::finish_function(), base_lexer::handle_end_of_input(), base_lexer::make_keyword_token(), octave_push_parse(), base_parser::recover_from_parsing_function(), reset(), base_lexer::reset(), and base_parser::start_function().
bool lexical_feedback::m_reading_script_file |
Definition at line 431 of file lex.h.
Referenced by base_parser::bison_error(), base_lexer::handle_end_of_input(), base_parser::make_decl_command(), base_lexer::make_keyword_token(), octave_push_parse(), base_lexer::prep_for_file(), base_parser::push_fcn_symtab(), reset(), base_lexer::reset(), and base_parser::start_function().
std::string lexical_feedback::m_string_text |
Definition at line 480 of file lex.h.
Referenced by base_lexer::finish_command_arg(), and reset().
symbol_table_context lexical_feedback::m_symtab_context |
Definition at line 514 of file lex.h.
Referenced by base_parser::make_anon_fcn_handle(), base_parser::make_classdef(), base_parser::make_fcn_name(), base_parser::make_identifier(), base_parser::make_script(), mark_as_variable(), mark_as_variables(), octave_push_parse(), base_parser::push_fcn_symtab(), base_parser::recover_from_parsing_function(), reset(), base_lexer::reset(), and base_parser::start_function().
filepos lexical_feedback::m_tok_beg |
Definition at line 476 of file lex.h.
Referenced by base_lexer::begin_string(), base_lexer::finish_command_arg(), base_lexer::handle_end_of_input(), base_lexer::handle_identifier(), base_lexer::handle_number(), base_lexer::handle_op(), base_lexer::handle_superclass_identifier(), base_lexer::handle_token(), base_lexer::make_fq_identifier_token(), base_lexer::make_keyword_token(), base_lexer::make_meta_identifier_token(), reset(), base_lexer::syntax_error(), and base_lexer::update_token_positions().
filepos lexical_feedback::m_tok_end |
Definition at line 477 of file lex.h.
Referenced by base_lexer::finish_command_arg(), base_lexer::handle_end_of_input(), base_lexer::handle_identifier(), base_lexer::handle_number(), base_lexer::handle_op(), base_lexer::handle_superclass_identifier(), base_lexer::handle_token(), base_lexer::make_fq_identifier_token(), base_lexer::make_keyword_token(), base_lexer::make_meta_identifier_token(), reset(), base_lexer::syntax_error(), and base_lexer::update_token_positions().
std::size_t lexical_feedback::m_token_count |
Definition at line 467 of file lex.h.
Referenced by base_lexer::increment_token_count(), base_lexer::make_keyword_token(), and reset().
token_cache lexical_feedback::m_tokens |
Definition at line 521 of file lex.h.
Referenced by ~lexical_feedback(), base_lexer::pending_token_count(), previous_token(), previous_token(), base_lexer::push_token(), and reset().