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);
123 bool is_bracket (
void)
144 bool is_anon_fcn_body (
void)
149 bool is_bracket_or_brace (
void)
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 maybe_classdef_get_set_method (false), parsing_classdef (false),
265 quote_is_transpose (false), force_script (false),
266 reading_fcn_file (false), reading_script_file (false),
267 reading_classdef_file (false),
268 input_line_number (1), current_input_column (1),
269 bracketflag (0), braceflag (0),
270 looping (0), defining_func (0), looking_at_function_handle (0),
271 block_comment_nesting_level (0), token_count (0),
272 current_input_line (), comment_text (), help_text (),
273 string_text (), string_line (0), string_column (0),
274 fcn_file_name (), fcn_file_full_name (), looking_at_object_index (),
275 parsed_function_name (), pending_local_variables (),
276 symtab_context (), nesting_level (), tokens ()
287 int previous_token_value (
void)
const;
289 bool previous_token_value_is (
int tok_val)
const;
291 void mark_previous_token_trailing_space (
void);
293 bool space_follows_previous_token (
void)
const;
295 bool previous_token_is_binop (
void)
const;
297 bool previous_token_is_keyword (
void)
const;
299 bool previous_token_may_be_command (
void)
const;
301 void maybe_mark_previous_token_as_variable (
void);
303 void mark_as_variable (
const std::string& nm);
304 void mark_as_variables (
const std::list<std::string>& lst);
466 : buffer (), pos (0), chars_left (0), eof (false)
469 void fill (
const std::string&
input,
bool eof_arg);
472 int copy_chunk (
char *buf,
size_t max_size);
474 bool empty (
void)
const {
return chars_left == 0; }
502 comment_list->append (s, t);
540 virtual void reset (
void);
542 void prep_for_file (
void);
544 void begin_string (
int state);
546 virtual int fill_flex_buffer (
char *buf,
unsigned int max_size) = 0;
552 int handle_end_of_input (
void);
554 char *flex_yytext (
void);
556 int flex_yyleng (
void);
558 int text_yyinput (
void);
560 void xunput (
char c,
char *buf);
562 void xunput (
char c);
564 bool looking_at_space (
void);
566 bool inside_any_object_index (
void);
570 int is_keyword_token (
const std::string& s);
572 bool whitespace_is_significant (
void);
574 void handle_number (
void);
576 void handle_continuation (
void);
582 int handle_close_bracket (
int bracket_type);
584 bool looks_like_command_arg (
void);
586 int handle_superclass_identifier (
void);
588 int handle_meta_identifier (
void);
590 int handle_identifier (
void);
592 void maybe_warn_separator_insert (
char sep);
594 void gripe_single_quote_string (
void);
596 void gripe_matlab_incompatible (
const std::string& msg);
598 void maybe_gripe_matlab_incompatible_comment (
char c);
600 void gripe_matlab_incompatible_continuation (
void);
602 void gripe_matlab_incompatible_operator (
const std::string& op);
604 void push_token (
token *);
606 token *current_token (
void);
608 void display_token (
int tok);
610 void fatal_error (
const char *msg);
612 void lexer_debug (
const char *pattern);
623 virtual void increment_promptflag (
void) = 0;
625 virtual void decrement_promptflag (
void) = 0;
627 virtual int promptflag (
void)
const = 0;
629 virtual int promptflag (
int) = 0;
639 void push_start_state (
int state);
641 void pop_start_state (
void);
643 void clear_start_state (
void);
647 void display_start_state (
void)
const;
649 int handle_op (
const char *pattern,
int tok,
bool bos =
false);
651 int handle_incompatible_op (
const char *pattern,
int tok,
bool bos =
false);
653 bool maybe_unput_comma_before_unary_op (
int tok);
655 int handle_unary_op (
int tok,
bool bos =
false);
657 int handle_incompatible_unary_op (
int tok,
bool bos =
false);
659 int handle_assign_op (
const char *pattern,
int tok);
661 int handle_incompatible_assign_op (
const char *pattern,
int tok);
663 int handle_op_internal (
int tok,
bool bos,
bool compat);
665 int handle_token (
const std::string& name,
int tok);
667 int handle_token (
int tok,
token *tok_val = 0);
669 int count_token (
int tok);
671 int count_token_internal (
int tok);
673 int show_token (
int tok);
705 input_reader.
reset ();
714 int promptflag (
void)
const {
return input_reader.promptflag (); }
716 int promptflag (
int n) {
return input_reader.promptflag (n); }
718 std::string input_source (
void)
const
720 return input_reader.input_source ();
723 bool input_from_terminal (
void)
const
725 return input_reader.input_from_terminal ();
728 bool input_from_file (
void)
const
730 return input_reader.input_from_file ();
733 bool input_from_eval_string (
void)
const
735 return input_reader.input_from_eval_string ();
738 int fill_flex_buffer (
char *buf,
unsigned int max_size);
760 append_input (
input, eof);
772 void append_input (
const std::string&
input,
bool eof)
774 input_buf.fill (input, eof);
783 int promptflag (
int n)
792 int fill_flex_buffer (
char *buf,
unsigned int max_size);