23 #if !defined (octave_lex_h)
24 #define octave_lex_h 1
56 while (! frame_stack.empty ())
60 bool empty (
void)
const {
return frame_stack.empty (); }
72 frame_stack.push (scope);
180 : buffer (), sz (sz_arg)
185 if (buffer.size () == sz)
188 buffer.push_front (tok);
195 delete buffer.back ();
203 return empty () ? 0 : buffer.at (n);
208 return empty () ? 0 : buffer.at (n);
214 return empty () ? 0 : buffer.front ();
219 return empty () ? 0 : buffer.front ();
224 return empty () ? 0 : buffer.back ();
229 return empty () ? 0 : buffer.back ();
233 size_t size (
void)
const {
return buffer.size (); }
235 bool empty (
void)
const {
return buffer.empty (); }
257 : end_of_input (false), at_beginning_of_statement (true),
258 looking_at_anon_fcn_args (false), looking_at_return_list (false),
259 looking_at_parameter_list (false), looking_at_decl_list (false),
260 looking_at_initializer_expression (false),
261 looking_at_matrix_or_assign_lhs (false),
262 looking_for_object_index (false),
263 looking_at_indirect_ref (false), parsing_class_method (false),
264 parsing_classdef (false), maybe_classdef_get_set_method (false),
265 parsing_classdef_get_method (false),
266 parsing_classdef_set_method (false),
267 quote_is_transpose (false), force_script (false),
268 reading_fcn_file (false), reading_script_file (false),
269 reading_classdef_file (false),
270 input_line_number (1), current_input_column (1),
271 bracketflag (0), braceflag (0),
272 looping (0), defining_func (0), looking_at_function_handle (0),
273 block_comment_nesting_level (0), command_arg_paren_count (0),
274 token_count (0), current_input_line (), comment_text (),
275 help_text (), string_text (), string_line (0), string_column (0),
276 fcn_file_name (), fcn_file_full_name (), looking_at_object_index (),
277 parsed_function_name (), pending_local_variables (),
278 symtab_context (), nesting_level (), tokens ()
289 int previous_token_value (
void)
const;
291 bool previous_token_value_is (
int tok_val)
const;
293 void mark_previous_token_trailing_space (
void);
295 bool space_follows_previous_token (
void)
const;
297 bool previous_token_is_binop (
void)
const;
299 bool previous_token_is_keyword (
void)
const;
301 bool previous_token_may_be_command (
void)
const;
303 void maybe_mark_previous_token_as_variable (
void);
305 void mark_as_variable (
const std::string& nm);
306 void mark_as_variables (
const std::list<std::string>& lst);
477 : buffer (), pos (0), chars_left (0), eof (false)
480 void fill (
const std::string&
input,
bool eof_arg);
483 int copy_chunk (
char *buf,
size_t max_size);
485 bool empty (
void)
const {
return chars_left == 0; }
513 comment_list->append (s, t);
551 virtual void reset (
void);
553 void prep_for_file (
void);
555 void begin_string (
int state);
557 virtual int fill_flex_buffer (
char *buf,
unsigned int max_size) = 0;
563 int handle_end_of_input (
void);
565 char *flex_yytext (
void);
567 int flex_yyleng (
void);
569 int text_yyinput (
void);
571 void xunput (
char c,
char *buf);
573 void xunput (
char c);
575 bool looking_at_space (
void);
577 bool inside_any_object_index (
void);
581 int is_keyword_token (
const std::string& s);
583 bool fq_identifier_contains_keyword (
const std::string& s);
585 bool whitespace_is_significant (
void);
587 void handle_number (
void);
589 void handle_continuation (
void);
595 int handle_close_bracket (
int bracket_type);
597 bool looks_like_command_arg (
void);
599 int handle_superclass_identifier (
void);
601 int handle_meta_identifier (
void);
603 int handle_fq_identifier (
void);
605 int handle_identifier (
void);
607 void maybe_warn_separator_insert (
char sep);
609 void gripe_single_quote_string (
void);
611 void gripe_language_extension (
const std::string& msg);
613 void maybe_gripe_language_extension_comment (
char c);
615 void gripe_language_extension_continuation (
void);
617 void gripe_language_extension_operator (
const std::string& op);
619 void push_token (
token *);
621 token *current_token (
void);
623 void display_token (
int tok);
625 void fatal_error (
const char *msg);
627 void lexer_debug (
const char *pattern);
638 virtual void increment_promptflag (
void) = 0;
640 virtual void decrement_promptflag (
void) = 0;
642 virtual int promptflag (
void)
const = 0;
644 virtual int promptflag (
int) = 0;
654 void push_start_state (
int state);
656 void pop_start_state (
void);
658 void clear_start_state (
void);
662 void display_start_state (
void)
const;
664 int handle_op (
const char *pattern,
int tok,
bool bos =
false);
666 int handle_language_extension_op (
const char *pattern,
int tok,
669 bool maybe_unput_comma_before_unary_op (
int tok);
671 int handle_unary_op (
int tok,
bool bos =
false);
673 int handle_language_extension_unary_op (
int tok,
bool bos =
false);
675 int handle_assign_op (
const char *pattern,
int tok);
677 int handle_language_extension_assign_op (
const char *pattern,
int tok);
679 int handle_op_internal (
int tok,
bool bos,
bool compat);
681 int handle_token (
const std::string& name,
int tok);
683 int handle_token (
int tok,
token *tok_val = 0);
685 int count_token (
int tok);
687 int count_token_internal (
int tok);
689 int show_token (
int tok);
691 void enable_fq_identifier (
void);
723 input_reader.reset ();
732 int promptflag (
void)
const {
return input_reader.promptflag (); }
734 int promptflag (
int n) {
return input_reader.promptflag (n); }
738 return input_reader.input_source ();
743 return input_reader.input_from_terminal ();
748 return input_reader.input_from_file ();
753 return input_reader.input_from_eval_string ();
756 int fill_flex_buffer (
char *buf,
unsigned int max_size);
778 append_input (
input, eof);
792 input_buf.fill (input, eof);
810 int fill_flex_buffer (
char *buf,
unsigned int max_size);
virtual bool input_from_terminal(void) const
bool input_from_terminal(void) const
void push(symbol_table::scope_id scope=symbol_table::current_scope())
std::string input_source(void) const
const token * back(void) const
symbol_table::scope_id curr_scope(void) const
bool looking_at_parameter_list
static uint32_t state[624]
int block_comment_nesting_level
bool is_bracket_or_brace(void)
virtual std::string input_source(void) const
octave_comment_list * get_comment(void)
virtual bool input_from_eval_string(void) const
void append_input(const std::string &input, bool eof)
bool at_end_of_file(void) const
std::stack< int > start_state_stack
std::stack< bool > parsed_function_name
bool looking_at_initializer_expression
symbol_table_context(void)
octave_value_list eval_string(const std::string &eval_str, bool silent, int &parse_status, int nargout)
static bool is_variable(const std::string &name)
bool is_push_lexer(void) const
bool looking_at_anon_fcn_args
virtual bool is_push_lexer(void) const
void increment_promptflag(void)
int promptflag(void) const
token_cache(size_t sz_arg=std::numeric_limits< size_t >::max())
symbol_table_context symtab_context
std::list< bool > looking_at_object_index
bool at_end_of_buffer(void) const
std::string current_input_line
int command_arg_paren_count
virtual bool input_from_file(void) const
static std::string fcn_file_name(const octave_value &fcn)
bbp_nesting_level(const bbp_nesting_level &nl)
static llvm::LLVMContext & context
bbp_nesting_level nesting_level
bool parsing_classdef_get_method
std::deque< token * > buffer
bool is_keyword(const std::string &s)
std::stack< int > context
int promptflag(void) const
#define panic_impossible()
bool parsing_class_method
std::string fcn_file_name
void decrement_promptflag(void)
std::set< std::string > pending_local_variables
bool at_beginning_of_statement
bool looking_for_object_index
bool input_from_eval_string(void) const
std::stack< symbol_table::scope_id > frame_stack
octave_input_reader input_reader
int start_state(void) const
std::string input_source(void) const
const token * at(size_t n) const
octave_push_lexer(const std::string &input=std::string(), bool eof=false)
charNDArray max(char d, const charNDArray &m)
std::string fcn_file_full_name
const token * front(void) const
bool looking_at_matrix_or_assign_lhs
void decrement_promptflag(void)
bool is_anon_fcn_body(void)
bool reading_classdef_file
bool looking_at_decl_list
bool looking_at_return_list
bool maybe_classdef_get_set_method
int looking_at_function_handle
static int input(yyscan_t yyscanner)
bool looking_at_indirect_ref
bool parsing_classdef_set_method
bool input_from_file(void) const
comment_buffer comment_buf
static scope_id current_scope(void)
octave_lexer(const std::string &eval_string)
void increment_promptflag(void)