GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
lex.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1993-2018 John W. Eaton
4 
5 This file is part of Octave.
6 
7 Octave is free software: you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <https://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_lex_h)
24 #define octave_lex_h 1
25 
26 #include "octave-config.h"
27 
28 #include <deque>
29 #include <limits>
30 #include <list>
31 #include <set>
32 #include <stack>
33 
34 #include "comment-list.h"
35 #include "input.h"
36 #include "symscope.h"
37 #include "token.h"
38 
39 namespace octave
40 {
41  class interpreter;
42 
43  // Is the given string a keyword?
44  extern bool is_keyword (const std::string& s);
45 
46  // For communication between the lexer and parser.
47 
48  class
50  {
51  public:
52 
53  // Track symbol table information when parsing functions.
54 
56  {
57  public:
58 
60  : m_frame_stack () { }
61 
62  ~symbol_table_context (void) { clear (); }
63 
64  void clear (void);
65 
66  bool empty (void) const { return m_frame_stack.empty (); }
67 
68  size_t size (void) const { return m_frame_stack.size (); }
69 
70  void pop (void);
71 
72  void push (const symbol_scope& scope)
73  {
74  m_frame_stack.push_front (scope);
75  }
76 
77  symbol_scope curr_scope (void) const;
78  symbol_scope parent_scope (void) const;
79 
80  private:
81 
82  std::deque<symbol_scope> m_frame_stack;
83  };
84 
85  // Track nesting of square brackets, curly braces, and parentheses.
86 
88  {
89  private:
90 
92  {
93  BRACKET = 1,
94  BRACE = 2,
95  PAREN = 3,
96  ANON_FCN_BODY = 4
97  };
98 
99  public:
100 
101  bbp_nesting_level (void) : m_context () { }
102 
104  : m_context (nl.m_context)
105  { }
106 
107  bbp_nesting_level& operator = (const bbp_nesting_level& nl)
108  {
109  if (&nl != this)
110  m_context = nl.m_context;
111 
112  return *this;
113  }
114 
115  ~bbp_nesting_level (void) = default;
116 
117  void reset (void)
118  {
119  while (! m_context.empty ())
120  m_context.pop ();
121  }
122 
123  void bracket (void) { m_context.push (BRACKET); }
124 
125  bool is_bracket (void)
126  {
127  return ! m_context.empty () && m_context.top () == BRACKET;
128  }
129 
130  void brace (void) { m_context.push (BRACE); }
131 
132  bool is_brace (void)
133  {
134  return ! m_context.empty () && m_context.top () == BRACE;
135  }
136 
137  void paren (void) { m_context.push (PAREN); }
138 
139  bool is_paren (void)
140  {
141  return ! m_context.empty () && m_context.top () == PAREN;
142  }
143 
144  void anon_fcn_body (void) { m_context.push (ANON_FCN_BODY); }
145 
146  bool is_anon_fcn_body (void)
147  {
148  return ! m_context.empty () && m_context.top () == ANON_FCN_BODY;
149  }
150 
152  {
153  return (! m_context.empty ()
154  && (m_context.top () == BRACKET || m_context.top () == BRACE));
155  }
156 
157  bool none (void) { return m_context.empty (); }
158 
159  void remove (void)
160  {
161  if (! m_context.empty ())
162  m_context.pop ();
163  }
164 
165  void clear (void)
166  {
167  while (! m_context.empty ())
168  m_context.pop ();
169  }
170 
171  private:
172 
173  std::stack<int> m_context;
174  };
175 
177  {
178  public:
179 
180  // Store an "unlimited" number of tokens.
181 
182  // Tokens are allocated with new. Delete them when they are
183  // removed from the cache.
184  //
185  // One of the reasons for using this class instead of std::deque
186  // directly is that we can ensure that memory is cleaned up
187  // properly. It's more tedious to do that with deque since the
188  // deque destructor and clear method don't call delete on the
189  // elements that it stores. Another reason is that it makes it
190  // easier to change the implementation later if needed.
191 
192  token_cache (void) : m_buffer () { }
193 
194  // No copying!
195 
196  token_cache (const token_cache&) = delete;
197 
198  token_cache& operator = (const token_cache&) = delete;
199 
200  ~token_cache (void) { clear (); }
201 
202  void push (token *tok)
203  {
204  m_buffer.push_front (tok);
205  }
206 
207  void pop (void)
208  {
209  if (! empty ())
210  {
211  delete m_buffer.back ();
212  m_buffer.pop_back ();
213  }
214  }
215 
216  // Direct access.
217  token * at (size_t n)
218  {
219  return empty () ? nullptr : m_buffer.at (n);
220  }
221 
222  const token * at (size_t n) const
223  {
224  return empty () ? nullptr : m_buffer.at (n);
225  }
226 
227  // Most recently pushed.
228  token * front (void)
229  {
230  return empty () ? nullptr : m_buffer.front ();
231  }
232 
233  const token * front (void) const
234  {
235  return empty () ? nullptr : m_buffer.front ();
236  }
237 
238  token * back (void)
239  {
240  return empty () ? nullptr : m_buffer.back ();
241  }
242 
243  const token * back (void) const
244  {
245  return empty () ? nullptr : m_buffer.back ();
246  }
247 
248  // Number of elements currently in the buffer.
249  size_t size (void) const { return m_buffer.size (); }
250 
251  bool empty (void) const { return m_buffer.empty (); }
252 
253  void clear (void)
254  {
255  while (! empty ())
256  pop ();
257  }
258 
259  private:
260 
261  std::deque<token *> m_buffer;
262  };
263 
265  : m_end_of_input (false),
266  m_at_beginning_of_statement (true),
267  m_looking_at_anon_fcn_args (false),
268  m_looking_at_return_list (false),
269  m_looking_at_parameter_list (false),
270  m_looking_at_decl_list (false),
271  m_looking_at_initializer_expression (false),
272  m_looking_at_matrix_or_assign_lhs (false),
273  m_looking_for_object_index (false),
274  m_looking_at_indirect_ref (false),
275  m_parsing_class_method (false),
276  m_parsing_classdef (false),
277  m_maybe_classdef_get_set_method (false),
278  m_parsing_classdef_get_method (false),
279  m_parsing_classdef_set_method (false),
280  m_quote_is_transpose (false),
281  m_force_script (false),
282  m_reading_fcn_file (false),
283  m_reading_script_file (false),
284  m_reading_classdef_file (false),
285  m_buffer_function_text (false),
286  m_input_line_number (1),
287  m_current_input_column (1),
288  m_bracketflag (0),
289  m_braceflag (0),
290  m_looping (0),
291  m_defining_func (0),
292  m_looking_at_function_handle (0),
293  m_block_comment_nesting_level (0),
294  m_command_arg_paren_count (0),
295  m_token_count (0),
296  m_current_input_line (),
297  m_comment_text (),
298  m_help_text (),
299  m_function_text (),
300  m_string_text (),
301  m_string_line (0),
302  m_string_column (0),
303  m_fcn_file_name (),
304  m_fcn_file_full_name (),
305  m_dir_name (),
306  m_package_name (),
307  m_looking_at_object_index (),
308  m_parsed_function_name (),
309  m_pending_local_variables (),
310  m_symtab_context (),
311  m_nesting_level (),
312  m_tokens ()
313  {
314  init ();
315  }
316 
317  // No copying!
318 
319  lexical_feedback (const lexical_feedback&) = delete;
320 
321  lexical_feedback& operator = (const lexical_feedback&) = delete;
322 
323  ~lexical_feedback (void);
324 
325  void init (void);
326 
327  void reset (void);
328 
329  int previous_token_value (void) const;
330 
331  bool previous_token_value_is (int tok_val) const;
332 
333  void mark_previous_token_trailing_space (void);
334 
335  bool space_follows_previous_token (void) const;
336 
337  bool previous_token_is_binop (void) const;
338 
339  bool previous_token_is_keyword (void) const;
340 
341  bool previous_token_may_be_command (void) const;
342 
343  void maybe_mark_previous_token_as_variable (void);
344 
345  void mark_as_variable (const std::string& nm);
346  void mark_as_variables (const std::list<std::string>& lst);
347 
348  // true means that we have encountered eof on the input stream.
350 
351  // true means we are at the beginning of a statement, where a
352  // command name is possible.
354 
355  // true means we are parsing an anonymous function argument list.
357 
358  // true means we're parsing the return list for a function.
360 
361  // true means we're parsing the parameter list for a function.
363 
364  // true means we're parsing a declaration list (global or
365  // persistent).
367 
368  // true means we are looking at the initializer expression for a
369  // parameter list element.
371 
372  // true means we're parsing a matrix or the left hand side of
373  // multi-value assignment statement.
375 
376  // object index not possible until we've seen something.
378 
379  // true means we're looking at an indirect reference to a
380  // structure element.
382 
383  // true means we are parsing a class method in function or classdef file.
385 
386  // true means we are parsing a classdef file
388 
389  // true means we are parsing a class method declaration line in a
390  // classdef file and can accept a property get or set method name.
391  // for example, "get.propertyname" is recognized as a function name.
393 
394  // TRUE means we are parsing a classdef get.method.
396 
397  // TRUE means we are parsing a classdef set.method.
399 
400  // return transpose or start a string?
402 
403  // TRUE means treat the current file as a script even if the first
404  // token is "function" or "classdef".
406 
407  // TRUE means we're parsing a function file.
409 
410  // TRUE means we're parsing a script file.
412 
413  // TRUE means we're parsing a classdef file.
415 
416  // TRUE means we should store the text of the function we are
417  // parsing.
419 
420  // the current input line number.
422 
423  // the column of the current token.
425 
426  // square bracket level count.
428 
429  // curly brace level count.
431 
432  // true means we're in the middle of defining a loop.
434 
435  // nonzero means we're in the middle of defining a function.
437 
438  // nonzero means we are parsing a function handle.
440 
441  // nestng level for block comments.
443 
444  // Parenthesis count for command argument parsing.
446 
447  // Count of tokens recognized by this lexer since initialized or
448  // since the last reset.
450 
451  // The current line of input.
453 
454  // The current comment text.
456 
457  // The current help text.
459 
460  // The text of functions entered on the command line.
462 
463  // The current character string text.
465 
466  // The position of the beginning of the current character string.
469 
470  // Simple name of function file we are reading.
472 
473  // Full name of file we are reading.
475 
476  // Directory name where this file was found. May be relative.
478 
479  // Name of +package containing this file, if any.
481 
482  // if the front of the list is true, the closest paren, brace, or
483  // bracket nesting is an index for an object.
484  std::list<bool> m_looking_at_object_index;
485 
486  // if the top of the stack is true, then we've already seen the name
487  // of the current function. should only matter if
488  // current_function_level > 0
489  std::stack<bool> m_parsed_function_name;
490 
491  // set of identifiers that might be local variable names.
492  std::set<std::string> m_pending_local_variables;
493 
494  // Track current symbol table scope and context.
496 
497  // is the closest nesting level a square bracket, squiggly brace,
498  // a paren, or an anonymous function body?
500 
501  // Tokens generated by the lexer.
503  };
504 
505  // base_lexer inherits from lexical_feedback because we will
506  // eventually have several different constructors and it is easier to
507  // intialize if everything is grouped in a parent class rather than
508  // listing all the members in the base_lexer class.
509 
510  class
512  {
513  public:
514 
515  // Handle buffering of input for lexer.
516 
518  {
519  public:
520 
522  : m_buffer (), m_pos (nullptr), m_chars_left (0), m_eof (false)
523  { }
524 
525  void fill (const std::string& input, bool eof_arg);
526 
527  // Copy at most max_size characters to buf.
528  int copy_chunk (char *buf, size_t max_size);
529 
530  bool empty (void) const { return m_chars_left == 0; }
531 
532  bool at_eof (void) const { return m_eof; }
533 
534  private:
535 
537  const char *m_pos;
538  size_t m_chars_left;
539  bool m_eof;
540  };
541 
542  // Collect comment text.
543 
544  class
546  {
547  public:
548 
549  comment_buffer (void) : m_comment_list (nullptr) { }
550 
551  ~comment_buffer (void) { delete m_comment_list; }
552 
554  {
555  if (! m_comment_list)
556  m_comment_list = new comment_list ();
557 
558  m_comment_list->append (s, t);
559  }
560 
561  // Caller is expected to delete the returned value.
562 
564  {
565  comment_list *retval = m_comment_list;
566 
567  m_comment_list = nullptr;
568 
569  return retval;
570  }
571 
572  void reset (void)
573  {
574  delete m_comment_list;
575 
576  m_comment_list = nullptr;
577  }
578 
579  private:
580 
582  };
583 
584  base_lexer (interpreter *interp = nullptr)
585  : lexical_feedback (), m_scanner (nullptr), m_input_buf (),
586  m_comment_buf (), m_interpreter (interp)
587  {
588  init ();
589  }
590 
591  // No copying!
592 
593  base_lexer (const base_lexer&) = delete;
594 
595  base_lexer& operator = (const base_lexer&) = delete;
596 
597  virtual ~base_lexer (void);
598 
599  void init (void);
600 
601  virtual bool is_push_lexer (void) const { return false; }
602 
603  virtual void reset (void);
604 
605  void prep_for_file (void);
606 
607  void begin_string (int state);
608 
609  virtual int fill_flex_buffer (char *buf, unsigned int max_size) = 0;
610 
611  bool at_end_of_buffer (void) const { return m_input_buf.empty (); }
612 
613  bool at_end_of_file (void) const { return m_input_buf.at_eof (); }
614 
615  int handle_end_of_input (void);
616 
617  char * flex_yytext (void);
618 
619  int flex_yyleng (void);
620 
621  int text_yyinput (void);
622 
623  void xunput (char c, char *buf);
624 
625  void xunput (char c);
626 
627  bool looking_at_space (void);
628 
629  bool inside_any_object_index (void);
630 
631  bool is_variable (const std::string& name, const symbol_scope& scope);
632 
633  int is_keyword_token (const std::string& s);
634 
635  bool fq_identifier_contains_keyword (const std::string& s);
636 
637  bool whitespace_is_significant (void);
638 
639  void handle_number (void);
640 
641  void handle_continuation (void);
642 
643  void finish_comment (comment_elt::comment_type typ);
644 
645  comment_list * get_comment (void) { return m_comment_buf.get_comment (); }
646 
647  int handle_close_bracket (int bracket_type);
648 
649  bool looks_like_command_arg (void);
650 
651  int handle_superclass_identifier (void);
652 
653  int handle_meta_identifier (void);
654 
655  int handle_fq_identifier (void);
656 
657  int handle_identifier (void);
658 
659  void maybe_warn_separator_insert (char sep);
660 
661  void warn_single_quote_string (void);
662 
663  void warn_language_extension (const std::string& msg);
664 
665  void maybe_warn_language_extension_comment (char c);
666 
667  void warn_language_extension_continuation (void);
668 
669  void warn_language_extension_operator (const std::string& op);
670 
671  void push_token (token *);
672 
673  token * current_token (void);
674 
675  void display_token (int tok);
676 
677  void fatal_error (const char *msg);
678 
679  void lexer_debug (const char *pattern);
680 
681  // Internal state of the flex-generated lexer.
682  void *m_scanner;
683 
684  // Object that reads and buffers input.
686 
687  // Object that collects comment text.
689 
690  // Interpreter that contains us, if any.
692 
693  virtual void increment_promptflag (void) = 0;
694 
695  virtual void decrement_promptflag (void) = 0;
696 
697  virtual int promptflag (void) const = 0;
698 
699  virtual int promptflag (int) = 0;
700 
701  virtual std::string input_source (void) const { return "unknown"; }
702 
703  virtual bool input_from_terminal (void) const { return false; }
704 
705  virtual bool input_from_file (void) const { return false; }
706 
707  virtual bool input_from_eval_string (void) const { return false; }
708 
709  void push_start_state (int state);
710 
711  void pop_start_state (void);
712 
713  void clear_start_state (void);
714 
715  int start_state (void) const { return start_state_stack.top (); }
716 
717  void display_start_state (void) const;
718 
719  int handle_op (const char *pattern, int tok, bool bos = false);
720 
721  int handle_language_extension_op (const char *pattern, int tok,
722  bool bos = false);
723 
724  bool maybe_unput_comma_before_unary_op (int tok);
725 
726  int handle_unary_op (int tok, bool bos = false);
727 
728  int handle_language_extension_unary_op (int tok, bool bos = false);
729 
730  int handle_assign_op (const char *pattern, int tok);
731 
732  int handle_language_extension_assign_op (const char *pattern, int tok);
733 
734  int handle_op_internal (int tok, bool bos, bool compat);
735 
736  int handle_token (const std::string& name, int tok);
737 
738  int handle_token (int tok, token *tok_val = nullptr);
739 
740  int count_token (int tok);
741 
742  int count_token_internal (int tok);
743 
744  int show_token (int tok);
745 
746  void enable_fq_identifier (void);
747 
748  protected:
749 
750  std::stack<int> start_state_stack;
751  };
752 
753  class
754  lexer : public base_lexer
755  {
756  public:
757 
758  lexer (interpreter *interp = nullptr)
759  : base_lexer (interp), m_reader (this)
760  { }
761 
762  lexer (FILE *file, interpreter *interp = nullptr)
763  : base_lexer (interp), m_reader (file, this)
764  { }
765 
766  lexer (const std::string& eval_string, interpreter *interp = nullptr)
767  : base_lexer (interp), m_reader (eval_string, this)
768  { }
769 
770  // No copying!
771 
772  lexer (const lexer&) = delete;
773 
774  lexer& operator = (const lexer&) = delete;
775 
776  void reset (void)
777  {
778  m_reader.reset ();
779 
781  }
782 
783  void increment_promptflag (void) { m_reader.increment_promptflag (); }
784 
785  void decrement_promptflag (void) { m_reader.decrement_promptflag (); }
786 
787  int promptflag (void) const { return m_reader.promptflag (); }
788 
789  int promptflag (int n) { return m_reader.promptflag (n); }
790 
792  {
793  return m_reader.input_source ();
794  }
795 
796  bool input_from_terminal (void) const
797  {
798  return m_reader.input_from_terminal ();
799  }
800 
801  bool input_from_file (void) const
802  {
803  return m_reader.input_from_file ();
804  }
805 
806  bool input_from_eval_string (void) const
807  {
808  return m_reader.input_from_eval_string ();
809  }
810 
811  int fill_flex_buffer (char *buf, unsigned int max_size);
812 
814  };
815 
816  class
817  push_lexer : public base_lexer
818  {
819  public:
820 
821  push_lexer (interpreter *interp = nullptr)
822  : base_lexer (interp), m_pflag (1)
823  {
824  append_input ("", false);
825  }
826 
827  push_lexer (const std::string& input, interpreter *interp = nullptr)
828  : base_lexer (interp), m_pflag (1)
829  {
830  append_input (input, false);
831  }
832 
833  push_lexer (bool eof, interpreter *interp = nullptr)
834  : base_lexer (interp), m_pflag (1)
835  {
836  append_input ("", eof);
837  }
838 
839  push_lexer (const std::string& input, bool eof,
840  interpreter *interp = nullptr)
841  : base_lexer (interp), m_pflag (1)
842  {
843  append_input (input, eof);
844  }
845 
846  // No copying!
847 
848  push_lexer (const push_lexer&) = delete;
849 
850  push_lexer& operator = (const push_lexer&) = delete;
851 
852  bool is_push_lexer (void) const { return true; }
853 
854  void reset (void)
855  {
856  promptflag (1);
857 
859  }
860 
861  void append_input (const std::string& input, bool eof);
862 
863  void increment_promptflag (void) { m_pflag++; }
864 
865  void decrement_promptflag (void) { m_pflag--; }
866 
867  int promptflag (void) const { return m_pflag; }
868 
869  int promptflag (int n)
870  {
871  int retval = m_pflag;
872  m_pflag = n;
873  return retval;
874  }
875 
876  std::string input_source (void) const { return "push buffer"; }
877 
878  int fill_flex_buffer (char *buf, unsigned int max_size);
879 
880  protected:
881 
882  int m_pflag;
883  };
884 }
885 
886 #endif
For example cd octave end example noindent changes the current working directory to file
Definition: dirfns.cc:124
std::string m_comment_text
Definition: lex.h:455
void decrement_promptflag(void)
Definition: lex.h:865
int m_command_arg_paren_count
Definition: lex.h:445
push_lexer(const std::string &input, bool eof, interpreter *interp=nullptr)
Definition: lex.h:839
bool m_looking_at_initializer_expression
Definition: lex.h:370
bool input_from_terminal(void) const
Definition: lex.h:796
size_t size(void) const
Definition: lex.h:249
std::string m_help_text
Definition: lex.h:458
bool m_buffer_function_text
Definition: lex.h:418
void push(const symbol_scope &scope)
Definition: lex.h:72
bbp_nesting_level m_nesting_level
Definition: lex.h:499
bool m_looking_at_anon_fcn_args
Definition: lex.h:356
bool m_at_beginning_of_statement
Definition: lex.h:353
push_lexer(bool eof, interpreter *interp=nullptr)
Definition: lex.h:833
base_lexer(interpreter *interp=nullptr)
Definition: lex.h:584
int m_block_comment_nesting_level
Definition: lex.h:442
lexer(const std::string &eval_string, interpreter *interp=nullptr)
Definition: lex.h:766
virtual bool input_from_file(void) const
Definition: lex.h:705
comment_list * get_comment(void)
Definition: lex.h:645
int m_looking_at_function_handle
Definition: lex.h:439
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
Definition: ov-usr-fcn.cc:997
input_reader m_reader
Definition: lex.h:813
bool m_parsing_classdef_set_method
Definition: lex.h:398
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
Definition: file-io.cc:587
s
Definition: file-io.cc:2729
comment_list * get_comment(void)
Definition: lex.h:563
bool is_push_lexer(void) const
Definition: lex.h:852
input_buffer m_input_buf
Definition: lex.h:685
virtual bool input_from_eval_string(void) const
Definition: lex.h:707
std::string input_source(void) const
Definition: lex.h:791
int promptflag(void) const
Definition: lex.h:867
create a structure array and initialize its values The dimensions of each cell array of values must match Singleton cells and non cell values are repeated so that they fill the entire array If the cells are empty
Definition: ov-struct.cc:1736
nd deftypefn *std::string name
Definition: sysdep.cc:647
std::set< std::string > m_pending_local_variables
Definition: lex.h:492
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
Definition: utils.cc:975
bool at_eof(void) const
Definition: lex.h:532
OCTINTERP_API octave_value_list eval_string(const std::string &, bool silent, int &parse_status, int nargout)
comment_buffer m_comment_buf
Definition: lex.h:688
const token * front(void) const
Definition: lex.h:233
std::string m_current_input_line
Definition: lex.h:452
static bool is_variable(octave::symbol_table &symtab, const std::string &name)
Definition: variables.cc:201
void increment_promptflag(void)
Definition: lex.h:783
std::deque< symbol_scope > m_frame_stack
Definition: lex.h:82
is false
Definition: cellfun.cc:400
bbp_nesting_level(const bbp_nesting_level &nl)
Definition: lex.h:103
octave_value retval
Definition: data.cc:6246
const token * back(void) const
Definition: lex.h:243
std::string m_function_text
Definition: lex.h:461
returns the type of the matrix and caches it for future use Called with more than one the function will not attempt to guess the type if it is still unknown This is useful for debugging purposes The possible matrix types depend on whether the matrix is full or and can be one of the following able sis tem and mark type as unknown tem as the structure of the matrix explicitly gives this(Sparse matrices only) tem code
Definition: matrix_type.cc:120
push_lexer(const std::string &input, interpreter *interp=nullptr)
Definition: lex.h:827
int start_state(void) const
Definition: lex.h:715
std::string m_dir_name
Definition: lex.h:477
bool is_keyword(const std::string &s)
OCTAVE_EXPORT octave_value_list or cell arrays Arguments are concatenated vertically The returned values are padded with blanks as needed to make each row of the string array have the same length Empty input strings are significant and will concatenated in the output For numerical input
Definition: strfns.cc:81
bool input_from_eval_string(void) const
Definition: lex.h:806
is longer than or if then or only for unique occurrences of the complete pattern(false). The default is true. If a cell array of strings ar
Definition: strfind.cc:190
std::stack< bool > m_parsed_function_name
Definition: lex.h:489
push_lexer(interpreter *interp=nullptr)
Definition: lex.h:821
bool m_looking_at_return_list
Definition: lex.h:359
lexical_feedback(void)
Definition: lex.h:264
symbol_table_context m_symtab_context
Definition: lex.h:495
void * m_scanner
Definition: lex.h:682
virtual void reset(void)
static uint32_t state[624]
Definition: randmtzig.cc:183
bool m_reading_script_file
Definition: lex.h:411
size_t m_token_count
Definition: lex.h:449
bool m_parsing_class_method
Definition: lex.h:384
void increment_promptflag(void)
Definition: lex.h:863
bool at_end_of_file(void) const
Definition: lex.h:613
bool at_end_of_buffer(void) const
Definition: lex.h:611
comment_list * m_comment_list
Definition: lex.h:581
virtual std::string input_source(void) const
Definition: lex.h:701
void decrement_promptflag(void)
Definition: lex.h:785
virtual bool is_push_lexer(void) const
Definition: lex.h:601
bool m_looking_at_parameter_list
Definition: lex.h:362
interpreter * m_interpreter
Definition: lex.h:691
int promptflag(int n)
Definition: lex.h:789
std::string input_source(void) const
Definition: lex.h:876
bool m_looking_at_decl_list
Definition: lex.h:366
bool m_reading_classdef_file
Definition: lex.h:414
bool m_looking_at_indirect_ref
Definition: lex.h:381
token_cache m_tokens
Definition: lex.h:502
bool m_parsing_classdef_get_method
Definition: lex.h:395
virtual bool input_from_terminal(void) const
Definition: lex.h:703
bool m_looking_at_matrix_or_assign_lhs
Definition: lex.h:374
void reset(void)
Definition: lex.h:776
std::stack< int > start_state_stack
Definition: lex.h:750
lexer(FILE *file, interpreter *interp=nullptr)
Definition: lex.h:762
lexer(interpreter *interp=nullptr)
Definition: lex.h:758
bool m_quote_is_transpose
Definition: lex.h:401
std::string m_string_text
Definition: lex.h:464
std::deque< token * > m_buffer
Definition: lex.h:261
void append(const std::string &s, comment_elt::comment_type t)
Definition: lex.h:553
bool input_from_file(void) const
Definition: lex.h:801
std::list< bool > m_looking_at_object_index
Definition: lex.h:484
int promptflag(int n)
Definition: lex.h:869
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:888
bool empty(void) const
Definition: lex.h:530
int promptflag(void) const
Definition: lex.h:787
const token * at(size_t n) const
Definition: lex.h:222
std::string m_fcn_file_full_name
Definition: lex.h:474
std::string m_package_name
Definition: lex.h:480
bool m_looking_for_object_index
Definition: lex.h:377
bool m_maybe_classdef_get_set_method
Definition: lex.h:392
void reset(void)
Definition: lex.h:854
std::string m_fcn_file_name
Definition: lex.h:471
int m_current_input_column
Definition: lex.h:424