GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
lex.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1993-2024 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_lex_h)
27 #define octave_lex_h 1
28 
29 #include "octave-config.h"
30 
31 #include <deque>
32 #include <list>
33 #include <set>
34 #include <stack>
35 
36 #include "comment-list.h"
37 #include "filepos.h"
38 #include "input.h"
39 #include "symscope.h"
40 #include "token.h"
41 
43 
44 class interpreter;
45 
46 // Is the given string a keyword?
47 extern bool iskeyword (const std::string& s);
48 
49 // For communication between the lexer and parser.
50 
51 class
53 {
54 public:
55 
56  // Track symbol table information when parsing functions.
57 
59  {
60  public:
61 
63  : m_interpreter (interp), m_frame_stack () { }
64 
65  OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (symbol_table_context)
66 
67  ~symbol_table_context () { clear (); }
68 
69  void clear ();
70 
71  bool empty () const { return m_frame_stack.empty (); }
72 
73  std::size_t size () const { return m_frame_stack.size (); }
74 
75  void pop ();
76 
77  void push (const symbol_scope& scope)
78  {
79  m_frame_stack.push_front (scope);
80  }
81 
82  symbol_scope curr_scope () const;
83  symbol_scope parent_scope () const;
84 
85  private:
86 
87  interpreter& m_interpreter;
88 
89  std::deque<symbol_scope> m_frame_stack;
90  };
91 
92  // Track nesting of square brackets, curly braces, and parentheses.
93 
95  {
96  private:
97 
98  enum bracket_type
99  {
100  BRACKET = 1,
101  BRACE = 2,
102  PAREN = 3,
103  ANON_FCN_BODY = 4
104  };
105 
106  public:
107 
108  bbp_nesting_level () : m_context () { }
109 
111  : m_context (nl.m_context)
112  { }
113 
114  bbp_nesting_level& operator = (const bbp_nesting_level& nl)
115  {
116  if (&nl != this)
117  m_context = nl.m_context;
118 
119  return *this;
120  }
121 
122  ~bbp_nesting_level () = default;
123 
124  // Alias for clear function.
125  void reset () { clear (); }
126 
127  void bracket () { m_context.push (BRACKET); }
128 
129  bool is_bracket ()
130  {
131  return ! m_context.empty () && m_context.top () == BRACKET;
132  }
133 
134  void brace () { m_context.push (BRACE); }
135 
136  bool is_brace ()
137  {
138  return ! m_context.empty () && m_context.top () == BRACE;
139  }
140 
141  void paren () { m_context.push (PAREN); }
142 
143  bool is_paren ()
144  {
145  return ! m_context.empty () && m_context.top () == PAREN;
146  }
147 
148  void anon_fcn_body () { m_context.push (ANON_FCN_BODY); }
149 
151  {
152  return ! m_context.empty () && m_context.top () == ANON_FCN_BODY;
153  }
154 
156  {
157  return (! m_context.empty ()
158  && (m_context.top () == BRACKET || m_context.top () == BRACE));
159  }
160 
161  bool none () { return m_context.empty (); }
162 
163  void remove ()
164  {
165  if (! m_context.empty ())
166  m_context.pop ();
167  }
168 
169  void clear ()
170  {
171  while (! m_context.empty ())
172  m_context.pop ();
173  }
174 
175  private:
176 
177  std::stack<int> m_context;
178  };
179 
181  {
182  public:
183 
184  // Store an "unlimited" number of tokens.
185 
186  // Tokens are allocated with new. Delete them when they are
187  // removed from the cache.
188  //
189  // One of the reasons for using this class instead of std::deque
190  // directly is that we can ensure that memory is cleaned up
191  // properly. It's more tedious to do that with deque since the
192  // deque destructor and clear method don't call delete on the
193  // elements that it stores. Another reason is that it makes it
194  // easier to change the implementation later if needed.
195 
196  token_cache () : m_buffer () { }
197 
198  OCTAVE_DISABLE_COPY_MOVE (token_cache)
199 
200  ~token_cache () { clear (); }
201 
202  void push (token *tok)
203  {
204  m_buffer.push_front (tok);
205  }
206 
207  void pop ()
208  {
209  if (! empty ())
210  {
211  delete m_buffer.back ();
212  m_buffer.pop_back ();
213  }
214  }
215 
216  // Direct access.
217  token * at (std::size_t n)
218  {
219  return empty () ? nullptr : m_buffer.at (n);
220  }
221 
222  const token * at (std::size_t n) const
223  {
224  return empty () ? nullptr : m_buffer.at (n);
225  }
226 
227  // Most recently pushed.
229  {
230  return empty () ? nullptr : m_buffer.front ();
231  }
232 
233  const token * front () const
234  {
235  return empty () ? nullptr : m_buffer.front ();
236  }
237 
238  token * back ()
239  {
240  return empty () ? nullptr : m_buffer.back ();
241  }
242 
243  const token * back () const
244  {
245  return empty () ? nullptr : m_buffer.back ();
246  }
247 
248  // Number of elements currently in the buffer.
249  std::size_t size () const { return m_buffer.size (); }
250 
251  bool empty () const { return m_buffer.empty (); }
252 
253  void clear ()
254  {
255  while (! empty ())
256  pop ();
257  }
258 
259  private:
260 
261  std::deque<token *> m_buffer;
262  };
263 
265  : m_interpreter (interp),
266  m_end_of_input (false),
267  m_allow_command_syntax (true),
268  m_at_beginning_of_statement (true),
269  m_looking_at_anon_fcn_args (false),
270  m_looking_at_return_list (false),
271  m_looking_at_parameter_list (false),
272  m_looking_at_decl_list (false),
273  m_looking_at_matrix_or_assign_lhs (false),
274  m_looking_for_object_index (false),
275  m_looking_at_indirect_ref (false),
276  m_arguments_is_keyword (false),
277  m_classdef_element_names_are_keywords (false),
278  m_parsing_anon_fcn_body (false),
279  m_parsing_class_method (false),
280  m_parsing_classdef (false),
281  m_parsing_classdef_decl (false),
282  m_parsing_classdef_superclass (false),
283  m_maybe_classdef_get_set_method (false),
284  m_parsing_classdef_get_method (false),
285  m_parsing_classdef_set_method (false),
286  m_quote_is_transpose (false),
287  m_force_script (false),
288  m_reading_fcn_file (false),
289  m_reading_script_file (false),
290  m_reading_classdef_file (false),
291  m_buffer_function_text (false),
292  m_comment_uses_hash_char (false),
293  m_bracketflag (0),
294  m_braceflag (0),
295  m_looping (0),
296  m_defining_fcn (0),
297  m_looking_at_function_handle (0),
298  m_block_comment_nesting_level (0),
299  m_command_arg_paren_count (0),
300  m_token_count (0),
301  m_filepos (1, 1),
302  m_tok_beg (),
303  m_tok_end (),
304  m_string_text (),
305  m_current_input_line (),
306  m_comment_text (),
307  m_function_text (),
308  m_fcn_file_name (),
309  m_fcn_file_full_name (),
310  m_dir_name (),
311  m_package_name (),
312  m_looking_at_object_index (),
313  m_parsed_function_name (),
314  m_symtab_context (interp),
315  m_nesting_level (),
316  m_tokens ()
317  {
318  init ();
319  }
320 
321  OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (lexical_feedback)
322 
323  ~lexical_feedback ();
324 
325  void init ();
326 
327  void reset ();
328 
329  int previous_token_value () const;
330 
331  bool previous_token_value_is (int tok_val) const;
332 
333  void mark_previous_token_trailing_space ();
334 
335  bool space_follows_previous_token () const;
336 
337  bool previous_token_is_binop () const;
338 
339  bool previous_token_is_keyword () const;
340 
341  bool previous_token_may_be_command () const;
342 
343  void mark_as_variable (const std::string& nm);
344  void mark_as_variables (const std::list<std::string>& lst);
345 
347 
348  // true means that we have encountered eof on the input stream.
350 
351  // true means command syntax is allowed.
353 
354  // true means we are at the beginning of a statement, where a
355  // command name is possible.
357 
358  // true means we are parsing an anonymous function argument list.
360 
361  // true means we're parsing the return list for a function.
363 
364  // true means we're parsing the parameter list for a function.
366 
367  // true means we're parsing a declaration list (global or
368  // persistent).
370 
371  // true means we're parsing a matrix or the left hand side of
372  // multi-value assignment statement.
374 
375  // object index not possible until we've seen something.
377 
378  // true means we're looking at an indirect reference to a
379  // structure element.
381 
382  // true means arguments is handled as keyword.
384 
385  // true means "properties", "methods", "events", and "enumeration"
386  // are treated like keywords.
388 
389  // true means we are parsing the body of an anonymous function.
391 
392  // true means we are parsing a class method in function or classdef file.
394 
395  // true means we are parsing a classdef file
397 
398  // true means we are parsing the initial classdef declaration
399  // portion of classdef file, from the "classdef" token through the
400  // optional list of superclasses.
402 
403  // true means we are parsing the superclass part of a classdef
404  // declaration.
406 
407  // true means we are parsing a class method declaration line in a
408  // classdef file and can accept a property get or set method name.
409  // for example, "get.propertyname" is recognized as a function name.
411 
412  // TRUE means we are parsing a classdef get.method.
414 
415  // TRUE means we are parsing a classdef set.method.
417 
418  // return transpose or start a string?
420 
421  // TRUE means treat the current file as a script even if the first
422  // token is "function" or "classdef".
424 
425  // TRUE means we're parsing a function file.
427 
428  // TRUE means we're parsing a script file.
430 
431  // TRUE means we're parsing a classdef file.
433 
434  // TRUE means we should store the text of the function we are
435  // parsing.
437 
438  // TRUE means a line comment uses '#' or a block comment used at least
439  // one '#' delimiter.
441 
442  // square bracket level count.
444 
445  // curly brace level count.
447 
448  // true means we're in the middle of defining a loop.
450 
451  // nonzero means we're in the middle of defining a function.
453 
454  // nonzero means we are parsing a function handle.
456 
457  // nestng level for block comments.
459 
460  // Parenthesis count for command argument parsing.
462 
463  // Count of tokens recognized by this lexer since initialized or
464  // since the last reset.
465  std::size_t m_token_count;
466 
467  // The current position in the file (line and column).
469 
470  // The positions of the beginning and end of the current token after
471  // calling update_token_positions. Also used apart from
472  // update_token_positions to handle the beginning and end of
473  // character strings.
476 
477  // The current character string text.
478  std::string m_string_text;
479 
480  // The current line of input.
481  std::string m_current_input_line;
482 
483  // The text of the current comment, used to gather comment lines
484  // before storing in m_comment_buf.
485  std::string m_comment_text;
486 
487  // The text of functions entered on the command line.
488  std::string m_function_text;
489 
490  // Simple name of function file we are reading.
491  std::string m_fcn_file_name;
492 
493  // Full name of file we are reading.
494  std::string m_fcn_file_full_name;
495 
496  // Directory name where this file was found. May be relative.
497  std::string m_dir_name;
498 
499  // Name of +package containing this file, if any.
500  std::string m_package_name;
501 
502  // if the front of the list is true, the closest paren, brace, or
503  // bracket nesting is an index for an object.
504  std::list<bool> m_looking_at_object_index;
505 
506  // if the top of the stack is true, then we've already seen the name
507  // of the current function. should only matter if
508  // current_function_level > 0
509  std::stack<bool> m_parsed_function_name;
510 
511  // Track current symbol table scope and context.
513 
514  // is the closest nesting level a square bracket, squiggly brace,
515  // a paren, or an anonymous function body?
517 
518  // Tokens generated by the lexer.
520 };
521 
522 // base_lexer inherits from lexical_feedback because we will
523 // eventually have several different constructors and it is easier to
524 // initialize if everything is grouped in a parent class rather than
525 // listing all the members in the base_lexer class.
526 
527 class
529 {
530 public:
531 
532  // Handle buffering of input for lexer.
533 
535  {
536  public:
537 
539  : m_buffer (), m_offset (0), m_chars_left (0), m_eof (false)
540  { }
541 
542  OCTAVE_DEFAULT_COPY_MOVE_DELETE (input_buffer)
543 
544  void fill (const std::string& input, bool eof_arg);
545 
546  // Copy at most max_size characters to buf.
547  int copy_chunk (char *buf, std::size_t max_size, bool by_lines = false);
548 
549  bool empty () const { return m_chars_left == 0; }
550 
551  bool at_eof () const { return m_eof; }
552 
553  private:
554 
555  std::string m_buffer;
556  std::size_t m_offset;
557  std::size_t m_chars_left;
558  bool m_eof;
559  };
560 
561  // Collect comment text.
562 
563  class
565  {
566  public:
567 
568  comment_buffer () : m_comment_list (nullptr) { }
569 
570  OCTAVE_DISABLE_COPY_MOVE (comment_buffer)
571 
572  ~comment_buffer () { delete m_comment_list; }
573 
574  void append (const std::string& s, comment_elt::comment_type t, bool uses_hash_char)
575  {
576  if (! m_comment_list)
577  m_comment_list = new comment_list ();
578 
579  m_comment_list->append (s, t, uses_hash_char);
580  }
581 
582  // Caller is expected to delete the returned value.
583 
585  {
586  comment_list *retval = m_comment_list;
587 
588  m_comment_list = nullptr;
589 
590  return retval;
591  }
592 
593  void reset ()
594  {
595  delete m_comment_list;
596 
597  m_comment_list = nullptr;
598  }
599 
600  private:
601 
602  comment_list *m_comment_list;
603  };
604 
606  : lexical_feedback (interp), m_scanner (nullptr), m_input_buf (),
607  m_comment_buf ()
608  {
609  init ();
610  }
611 
612  OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (base_lexer)
613 
614  virtual ~base_lexer ();
615 
616  void init ();
617 
618  virtual bool is_push_lexer () const { return false; }
619 
620  virtual void reset ();
621 
622  void prep_for_file ();
623 
624  void begin_string (int state);
625 
626  virtual int fill_flex_buffer (char *buf, unsigned int max_size) = 0;
627 
628  bool at_end_of_buffer () const { return m_input_buf.empty (); }
629 
630  bool at_end_of_file () const { return m_input_buf.at_eof (); }
631 
632  int handle_end_of_input ();
633 
634  char * flex_yytext ();
635 
636  int flex_yyleng ();
637 
638  int text_yyinput ();
639 
640  void xunput (char c, char *buf);
641 
642  void xunput (char c);
643 
644  void update_token_positions (int tok_len);
645 
646  bool looking_at_space ();
647 
648  bool inside_any_object_index ();
649 
650  int make_keyword_token (const std::string& s);
651 
652  bool fq_identifier_contains_keyword (const std::string& s);
653 
654  bool whitespace_is_significant ();
655 
656  // We only provide specializations with base equal to 2, 10, or 16.
657  template <int base>
659 
660  void handle_continuation ();
661 
662  void finish_comment (comment_elt::comment_type typ);
663 
664  comment_list * get_comment () { return m_comment_buf.get_comment (); }
665 
666  int handle_close_bracket (int bracket_type);
667 
668  bool looks_like_command_arg ();
669 
670  int handle_superclass_identifier ();
671 
672  int handle_meta_identifier ();
673 
674  int handle_fq_identifier ();
675 
676  int handle_identifier ();
677 
678  void check_comment_for_hash_char (const char *txt, std::size_t len);
679 
680  void maybe_warn_separator_insert (char sep);
681 
682  void warn_language_extension (const std::string& msg);
683 
684  void maybe_warn_language_extension_comment (char c);
685 
686  void warn_language_extension_continuation ();
687 
688  void warn_language_extension_operator (const std::string& op);
689 
690  void warn_deprecated_syntax (const std::string& msg);
691 
692  void push_token (token *);
693 
694  token * current_token ();
695 
696  std::size_t pending_token_count () const;
697 
698  void display_token (int tok);
699 
700  void fatal_error (const char *msg);
701 
702  bool debug_flag () const;
703 
704  bool display_tokens () const;
705 
706  void increment_token_count ();
707 
708  void lexer_debug (const char *pattern);
709 
710  // Internal state of the flex-generated lexer.
711  void *m_scanner;
712 
713  // Object that reads and buffers input.
715 
716  // Object that collects comment text.
718 
719  virtual std::string input_source () const { return "unknown"; }
720 
721  virtual bool input_from_terminal () const { return false; }
722 
723  virtual bool input_from_file () const { return false; }
724 
725  virtual bool input_from_eval_string () const { return false; }
726 
727  bool input_from_tmp_history_file ();
728 
729  void push_start_state (int state);
730 
731  void pop_start_state ();
732 
733  void clear_start_state ();
734 
735  int start_state () const { return start_state_stack.top (); }
736 
737  void display_start_state () const;
738 
739  bool maybe_unput_comma_before_unary_op (int tok);
740 
741  int handle_op (int tok, bool bos = false, bool compat = true);
742 
743  int finish_command_arg ();
744 
745  int handle_token (int tok, token *tok_val = nullptr);
746 
747  int count_token (int tok);
748 
749  int count_token_internal (int tok);
750 
751  int show_token (int tok);
752 
753 protected:
754 
755  std::stack<int> start_state_stack;
756 };
757 
758 class
759 lexer : public base_lexer
760 {
761 public:
762 
763  lexer (interpreter& interp)
764  : base_lexer (interp), m_reader (interp), m_initial_input (true)
765  { }
766 
767  lexer (FILE *file, interpreter& interp)
768  : base_lexer (interp), m_reader (interp, file), m_initial_input (true)
769  { }
770 
771  lexer (FILE *file, interpreter& interp, const std::string& encoding)
772  : base_lexer (interp), m_reader (interp, file, encoding),
773  m_initial_input (true)
774  { }
775 
776  lexer (const std::string& eval_string, interpreter& interp)
777  : base_lexer (interp), m_reader (interp, eval_string),
778  m_initial_input (true)
779  { }
780 
781  OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (lexer)
782 
783  ~lexer () = default;
784 
785  void reset ()
786  {
787  m_initial_input = true;
788 
790  }
791 
792  std::string input_source () const
793  {
794  return m_reader.input_source ();
795  }
796 
797  bool input_from_terminal () const
798  {
799  return m_reader.input_from_terminal ();
800  }
801 
802  bool input_from_file () const
803  {
804  return m_reader.input_from_file ();
805  }
806 
808  {
809  return m_reader.input_from_eval_string ();
810  }
811 
812  int fill_flex_buffer (char *buf, unsigned int max_size);
813 
815 
816  // TRUE means we are filling the input buffer for the first time.
817  // Otherwise, we are requesting more input to complete the parse
818  // and, if printing a prompt, should use the secondary prompt
819  // string.
820 
822 };
823 
824 template <> int base_lexer::handle_number<2> ();
825 template <> int base_lexer::handle_number<10> ();
826 template <> int base_lexer::handle_number<16> ();
827 
828 class
829 push_lexer : public base_lexer
830 {
831 public:
832 
834  : base_lexer (interp)
835  {
836  append_input ("", false);
837  }
838 
839  push_lexer (const std::string& input, interpreter& interp)
840  : base_lexer (interp)
841  {
842  append_input (input, false);
843  }
844 
845  push_lexer (bool eof, interpreter& interp)
846  : base_lexer (interp)
847  {
848  append_input ("", eof);
849  }
850 
851  push_lexer (const std::string& input, bool eof, interpreter& interp)
852  : base_lexer (interp)
853  {
854  append_input (input, eof);
855  }
856 
857  OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (push_lexer)
858 
859  ~push_lexer () = default;
860 
861  bool is_push_lexer () const { return true; }
862 
863  void append_input (const std::string& input, bool eof);
864 
865  std::string input_source () const { return "push buffer"; }
866 
867  int fill_flex_buffer (char *buf, unsigned int max_size);
868 };
869 
870 OCTAVE_END_NAMESPACE(octave)
871 
872 #endif
comment_list * get_comment()
Definition: lex.h:584
void append(const std::string &s, comment_elt::comment_type t, bool uses_hash_char)
Definition: lex.h:574
bool at_eof() const
Definition: lex.h:551
bool empty() const
Definition: lex.h:549
base_lexer(interpreter &interp)
Definition: lex.h:605
bool at_end_of_buffer() const
Definition: lex.h:628
std::stack< int > start_state_stack
Definition: lex.h:755
virtual bool is_push_lexer() const
Definition: lex.h:618
comment_buffer m_comment_buf
Definition: lex.h:717
bool at_end_of_file() const
Definition: lex.h:630
virtual int fill_flex_buffer(char *buf, unsigned int max_size)=0
int start_state() const
Definition: lex.h:735
virtual bool input_from_terminal() const
Definition: lex.h:721
void * m_scanner
Definition: lex.h:711
comment_list * get_comment()
Definition: lex.h:664
virtual bool input_from_file() const
Definition: lex.h:723
input_buffer m_input_buf
Definition: lex.h:714
virtual std::string input_source() const
Definition: lex.h:719
int handle_number()
virtual bool input_from_eval_string() const
Definition: lex.h:725
virtual void reset()
Definition: lex.cc:5292
Definition: lex.h:760
bool m_initial_input
Definition: lex.h:821
bool input_from_eval_string() const
Definition: lex.h:807
input_reader m_reader
Definition: lex.h:814
lexer(FILE *file, interpreter &interp)
Definition: lex.h:767
bool input_from_file() const
Definition: lex.h:802
std::string input_source() const
Definition: lex.h:792
void reset()
Definition: lex.h:785
lexer(interpreter &interp)
Definition: lex.h:763
~lexer()=default
lexer(FILE *file, interpreter &interp, const std::string &encoding)
Definition: lex.h:771
lexer(const std::string &eval_string, interpreter &interp)
Definition: lex.h:776
bool input_from_terminal() const
Definition: lex.h:797
bbp_nesting_level(const bbp_nesting_level &nl)
Definition: lex.h:110
symbol_table_context(interpreter &interp)
Definition: lex.h:62
std::size_t size() const
Definition: lex.h:73
void push(const symbol_scope &scope)
Definition: lex.h:77
std::size_t size() const
Definition: lex.h:249
void push(token *tok)
Definition: lex.h:202
token * at(std::size_t n)
Definition: lex.h:217
bool empty() const
Definition: lex.h:251
const token * back() const
Definition: lex.h:243
const token * front() const
Definition: lex.h:233
const token * at(std::size_t n) const
Definition: lex.h:222
bool m_looking_at_parameter_list
Definition: lex.h:365
bool m_reading_classdef_file
Definition: lex.h:432
bool m_looking_at_anon_fcn_args
Definition: lex.h:359
std::string m_package_name
Definition: lex.h:500
filepos m_filepos
Definition: lex.h:468
bool m_arguments_is_keyword
Definition: lex.h:383
std::string m_current_input_line
Definition: lex.h:481
bool m_end_of_input
Definition: lex.h:349
bool m_allow_command_syntax
Definition: lex.h:352
int m_looping
Definition: lex.h:449
bool m_parsing_classdef_set_method
Definition: lex.h:416
int m_bracketflag
Definition: lex.h:443
bool m_parsing_anon_fcn_body
Definition: lex.h:390
std::string m_comment_text
Definition: lex.h:485
token_cache m_tokens
Definition: lex.h:519
std::stack< bool > m_parsed_function_name
Definition: lex.h:509
bool m_at_beginning_of_statement
Definition: lex.h:356
int m_block_comment_nesting_level
Definition: lex.h:458
int m_command_arg_paren_count
Definition: lex.h:461
std::string m_fcn_file_full_name
Definition: lex.h:494
bool m_looking_at_return_list
Definition: lex.h:362
bool m_parsing_classdef_get_method
Definition: lex.h:413
std::string m_string_text
Definition: lex.h:478
std::list< bool > m_looking_at_object_index
Definition: lex.h:504
int m_braceflag
Definition: lex.h:446
bool m_parsing_classdef_decl
Definition: lex.h:401
bool m_looking_at_matrix_or_assign_lhs
Definition: lex.h:373
bool m_parsing_classdef_superclass
Definition: lex.h:405
lexical_feedback(interpreter &interp)
Definition: lex.h:264
bool m_looking_for_object_index
Definition: lex.h:376
interpreter & m_interpreter
Definition: lex.h:346
bbp_nesting_level m_nesting_level
Definition: lex.h:516
bool m_parsing_classdef
Definition: lex.h:396
bool m_reading_script_file
Definition: lex.h:429
bool m_classdef_element_names_are_keywords
Definition: lex.h:387
bool m_reading_fcn_file
Definition: lex.h:426
std::size_t m_token_count
Definition: lex.h:465
std::string m_function_text
Definition: lex.h:488
bool m_comment_uses_hash_char
Definition: lex.h:440
filepos m_tok_end
Definition: lex.h:475
std::string m_fcn_file_name
Definition: lex.h:491
bool m_looking_at_decl_list
Definition: lex.h:369
symbol_table_context m_symtab_context
Definition: lex.h:512
bool m_quote_is_transpose
Definition: lex.h:419
filepos m_tok_beg
Definition: lex.h:474
bool m_parsing_class_method
Definition: lex.h:393
bool m_buffer_function_text
Definition: lex.h:436
bool m_force_script
Definition: lex.h:423
std::string m_dir_name
Definition: lex.h:497
bool m_maybe_classdef_get_set_method
Definition: lex.h:410
bool m_looking_at_indirect_ref
Definition: lex.h:380
int m_looking_at_function_handle
Definition: lex.h:455
int m_defining_fcn
Definition: lex.h:452
push_lexer(const std::string &input, bool eof, interpreter &interp)
Definition: lex.h:851
~push_lexer()=default
push_lexer(interpreter &interp)
Definition: lex.h:833
push_lexer(bool eof, interpreter &interp)
Definition: lex.h:845
bool is_push_lexer() const
Definition: lex.h:861
std::string input_source() const
Definition: lex.h:865
push_lexer(const std::string &input, interpreter &interp)
Definition: lex.h:839
Definition: token.h:39
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
bool iskeyword(const std::string &s)
Definition: lex.cc:1335
octave_idx_type n
Definition: mx-inlines.cc:761
#define lexer
Definition: oct-parse.cc:146
#define m_scanner
F77_RET_T len
Definition: xerbla.cc:61