GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
lex.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1993-2025 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
44class interpreter;
45
46// Is the given string a keyword?
47extern bool iskeyword (const std::string& s);
48
49// For communication between the lexer and parser.
50
52{
53public:
54
55 // Track symbol table information when parsing functions.
56
58 {
59 public:
60
62 : m_interpreter (interp), m_frame_stack () { }
63
64 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (symbol_table_context)
65
67
68 void clear ();
69
70 bool empty () const { return m_frame_stack.empty (); }
71
72 std::size_t size () const { return m_frame_stack.size (); }
73
74 void pop ();
75
76 void push (const symbol_scope& scope)
77 {
78 m_frame_stack.push_front (scope);
79 }
80
81 symbol_scope curr_scope () const;
83
84 private:
85
86 interpreter& m_interpreter;
87
88 std::deque<symbol_scope> m_frame_stack;
89 };
90
91 // Track nesting of square brackets, curly braces, and parentheses.
92
94 {
95 private:
96
97 enum bracket_type
98 {
99 BRACKET = 1,
100 BRACE = 2,
101 PAREN = 3,
102 ANON_FCN_BODY = 4
103 };
104
105 public:
106
107 bbp_nesting_level () : m_context () { }
108
110 : m_context (nl.m_context)
111 { }
112
114 {
115 if (&nl != this)
116 m_context = nl.m_context;
117
118 return *this;
119 }
120
121 ~bbp_nesting_level () = default;
122
123 // Alias for clear function.
124 void reset () { clear (); }
125
126 void bracket () { m_context.push (BRACKET); }
127
129 {
130 return ! m_context.empty () && m_context.top () == BRACKET;
131 }
132
133 void brace () { m_context.push (BRACE); }
134
135 bool is_brace ()
136 {
137 return ! m_context.empty () && m_context.top () == BRACE;
138 }
139
140 void paren () { m_context.push (PAREN); }
141
142 bool is_paren ()
143 {
144 return ! m_context.empty () && m_context.top () == PAREN;
145 }
146
147 void anon_fcn_body () { m_context.push (ANON_FCN_BODY); }
148
150 {
151 return ! m_context.empty () && m_context.top () == ANON_FCN_BODY;
152 }
153
155 {
156 return (! m_context.empty ()
157 && (m_context.top () == BRACKET || m_context.top () == BRACE));
158 }
159
160 bool none () { return m_context.empty (); }
161
162 void remove ()
163 {
164 if (! m_context.empty ())
165 m_context.pop ();
166 }
167
168 void clear ()
169 {
170 while (! m_context.empty ())
171 m_context.pop ();
172 }
173
174 private:
175
176 std::stack<int> m_context;
177 };
178
180 {
181 public:
182
183 // Store an "unlimited" number of tokens.
184
185 // Tokens are allocated with new. Delete them when they are
186 // removed from the cache.
187 //
188 // One of the reasons for using this class instead of std::deque
189 // directly is that we can ensure that memory is cleaned up
190 // properly. It's more tedious to do that with deque since the
191 // deque destructor and clear method don't call delete on the
192 // elements that it stores. Another reason is that it makes it
193 // easier to change the implementation later if needed.
194
195 token_cache () : m_buffer () { }
196
197 OCTAVE_DISABLE_COPY_MOVE (token_cache)
198
200
201 void push (token *tok)
202 {
203 m_buffer.push_front (tok);
204 }
205
206 void pop ()
207 {
208 if (! empty ())
209 {
210 delete m_buffer.back ();
211 m_buffer.pop_back ();
212 }
213 }
214
215 // Direct access.
216 token * at (std::size_t n)
217 {
218 return empty () ? nullptr : m_buffer.at (n);
219 }
220
221 const token * at (std::size_t n) const
222 {
223 return empty () ? nullptr : m_buffer.at (n);
224 }
225
226 // Most recently pushed.
228 {
229 return empty () ? nullptr : m_buffer.front ();
230 }
231
232 const token * front () const
233 {
234 return empty () ? nullptr : m_buffer.front ();
235 }
236
238 {
239 return empty () ? nullptr : m_buffer.back ();
240 }
241
242 const token * back () const
243 {
244 return empty () ? nullptr : m_buffer.back ();
245 }
246
247 // Number of elements currently in the buffer.
248 std::size_t size () const { return m_buffer.size (); }
249
250 bool empty () const { return m_buffer.empty (); }
251
252 void clear ()
253 {
254 while (! empty ())
255 pop ();
256 }
257
258 private:
259
260 std::deque<token *> m_buffer;
261 };
262
264 : m_interpreter (interp),
265 m_end_of_input (false),
279 m_parsing_classdef (false),
285 m_quote_is_transpose (false),
286 m_force_script (false),
287 m_reading_fcn_file (false),
288 m_reading_script_file (false),
292 m_bracketflag (0),
293 m_braceflag (0),
294 m_looping (0),
295 m_defining_fcn (0),
299 m_token_count (0),
300 m_filepos (1, 1),
301 m_tok_beg (),
302 m_tok_end (),
303 m_string_text (),
309 m_dir_name (),
313 m_symtab_context (interp),
315 m_tokens ()
316 {
317 init ();
318 }
319
320 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (lexical_feedback)
321
323
324 void init ();
325
326 void reset ();
327
328 int previous_token_id () const;
330 const token * previous_token () const;
331
332 bool previous_token_is (int tok_id) const;
333 bool previous_token_is (const token *tok) const;
334
336
337 bool space_follows_previous_token () const;
338
339 bool previous_token_is_binop () const;
340
341 bool previous_token_is_keyword () const;
342
343 bool previous_token_may_be_command () const;
344
345 void mark_as_variable (const std::string& nm);
346 void mark_as_variables (const std::list<std::string>& lst);
347
349
350 // true means that we have encountered eof on the input stream.
352
353 // true means command syntax is allowed.
355
356 // true means we are at the beginning of a statement, where a
357 // command name is possible.
359
360 // true means we are parsing an anonymous function argument list.
362
363 // true means we're parsing the return list for a function.
365
366 // true means we're parsing the parameter list for a function.
368
369 // true means we're parsing a declaration list (global or
370 // persistent).
372
373 // true means we're parsing a matrix or the left hand side of
374 // multi-value assignment statement.
376
377 // object index not possible until we've seen something.
379
380 // true means we're looking at an indirect reference to a
381 // structure element.
383
384 // true means arguments is handled as keyword.
386
387 // true means "properties", "methods", "events", and "enumeration"
388 // are treated like keywords.
390
391 // true means we are parsing the body of an anonymous function.
393
394 // true means we are parsing a class method in function or classdef file.
396
397 // true means we are parsing a classdef file
399
400 // true means we are parsing the initial classdef declaration
401 // portion of classdef file, from the "classdef" token through the
402 // optional list of superclasses.
404
405 // true means we are parsing the superclass part of a classdef
406 // declaration.
408
409 // true means we are parsing a class method declaration line in a
410 // classdef file and can accept a property get or set method name.
411 // for example, "get.propertyname" is recognized as a function name.
413
414 // TRUE means we are parsing a classdef get.method.
416
417 // TRUE means we are parsing a classdef set.method.
419
420 // return transpose or start a string?
422
423 // TRUE means treat the current file as a script even if the first
424 // token is "function" or "classdef".
426
427 // TRUE means we're parsing a function file.
429
430 // TRUE means we're parsing a script file.
432
433 // TRUE means we're parsing a classdef file.
435
436 // TRUE means we should store the text of the function we are
437 // parsing.
439
440 // TRUE means a line comment uses '#' or a block comment used at least
441 // one '#' delimiter.
443
444 // square bracket level count.
446
447 // curly brace level count.
449
450 // true means we're in the middle of defining a loop.
452
453 // nonzero means we're in the middle of defining a function.
455
456 // nonzero means we are parsing a function handle.
458
459 // nestng level for block comments.
461
462 // Parenthesis count for command argument parsing.
464
465 // Count of tokens recognized by this lexer since initialized or
466 // since the last reset.
467 std::size_t m_token_count;
468
469 // The current position in the file (line and column).
471
472 // The positions of the beginning and end of the current token after
473 // calling update_token_positions. Also used apart from
474 // update_token_positions to handle the beginning and end of
475 // character strings.
478
479 // The current character string text.
480 std::string m_string_text;
481
482 // The current line of input.
484
485 // The text of the current comment, used to gather comment lines
486 // before storing in m_comment_list.
487 std::string m_comment_text;
488
489 // The text of functions entered on the command line.
490 std::string m_function_text;
491
492 // Simple name of function file we are reading.
493 std::string m_fcn_file_name;
494
495 // Full name of file we are reading.
497
498 // Directory name where this file was found. May be relative.
499 std::string m_dir_name;
500
501 // Name of +package containing this file, if any.
502 std::string m_package_name;
503
504 // if the front of the list is true, the closest paren, brace, or
505 // bracket nesting is an index for an object.
507
508 // if the top of the stack is true, then we've already seen the name
509 // of the current function. should only matter if
510 // current_function_level > 0
511 std::stack<bool> m_parsed_function_name;
512
513 // Track current symbol table scope and context.
515
516 // is the closest nesting level a square bracket, squiggly brace,
517 // a paren, or an anonymous function body?
519
520 // Tokens generated by the lexer.
522};
523
524// base_lexer inherits from lexical_feedback because we will
525// eventually have several different constructors and it is easier to
526// initialize if everything is grouped in a parent class rather than
527// listing all the members in the base_lexer class.
528
530{
531public:
532
533 // Handle buffering of input for lexer.
534
536 {
537 public:
538
540 : m_buffer (), m_offset (0), m_chars_left (0), m_eof (false)
541 { }
542
543 OCTAVE_DEFAULT_COPY_MOVE_DELETE (input_buffer)
544
545 void fill (const std::string& input, bool eof_arg);
546
547 // Copy at most max_size characters to buf.
548 int copy_chunk (char *buf, std::size_t max_size, bool by_lines = false);
549
550 bool empty () const { return m_chars_left == 0; }
551
552 bool at_eof () const { return m_eof; }
553
554 private:
555
556 std::string m_buffer;
557 std::size_t m_offset;
558 std::size_t m_chars_left;
559 bool m_eof;
560 };
561
563 : lexical_feedback (interp), m_scanner (nullptr), m_input_buf ()
564 {
565 init ();
566 }
567
568 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (base_lexer)
569
570 virtual ~base_lexer ();
571
572 void init ();
573
574 virtual bool is_push_lexer () const { return false; }
575
576 virtual void reset ();
577
578 void prep_for_file ();
579
580 void begin_string (int state);
581
582 virtual int fill_flex_buffer (char *buf, unsigned int max_size) = 0;
583
584 bool at_end_of_buffer () const { return m_input_buf.empty (); }
585
586 bool at_end_of_file () const { return m_input_buf.at_eof (); }
587
588 int handle_end_of_input ();
589
590 char * flex_yytext ();
591
592 int flex_yyleng ();
593
594 int text_yyinput ();
595
596 void xunput (char c, char *buf);
597
598 void xunput (char c);
599
600 void update_token_positions (int tok_len);
601
602 bool looking_at_space ();
603
605
606 token * make_keyword_token (const std::string& s);
607
608 bool fq_identifier_contains_keyword (const std::string& s);
609
611
612 // We only provide specializations with base equal to 2, 10, or 16.
613 template <int base>
615
616 void handle_continuation ();
617
619
621 {
624 return retval;
625 }
626
627 int handle_close_bracket (int bracket_type);
628
630
632
633 token * make_meta_identifier_token (const std::string& cls);
634
635 token * make_fq_identifier_token (const std::string& ident);
636
637 int handle_identifier ();
638
639 void check_comment_for_hash_char (const char *txt, std::size_t len);
640
641 void maybe_warn_separator_insert (char sep);
642
643 void warn_language_extension (const std::string& msg);
644
646
648
649 void warn_language_extension_operator (const std::string& op);
650
651 void warn_deprecated_syntax (const std::string& msg);
652
653 int syntax_error (const std::string& msg);
654 int syntax_error (const std::string& msg, const filepos& pos);
655 int syntax_error (const std::string& msg, const filepos& beg_pos, const filepos& end_pos);
656
657 void push_token (token *);
658
659 token * current_token ();
660
661 std::size_t pending_token_count () const;
662
663 void display_token (int tok_id);
664
665 void fatal_error (const char *msg);
666
667 bool debug_flag () const;
668
669 bool display_tokens () const;
670
671 void increment_token_count ();
672
673 void lexer_debug (const char *pattern);
674
675 // Internal state of the flex-generated lexer.
677
678 // Object that reads and buffers input.
680
681 // List of collected comments.
683
684 virtual std::string input_source () const { return "unknown"; }
685
686 virtual bool input_from_terminal () const { return false; }
687
688 virtual bool input_from_file () const { return false; }
689
690 virtual bool input_from_eval_string () const { return false; }
691
693
694 void push_start_state (int state);
695
696 void pop_start_state ();
697
698 void clear_start_state ();
699
700 int start_state () const { return start_state_stack.top (); }
701
702 void display_start_state () const;
703
704 bool maybe_unput_comma_before_unary_op (int tok_id);
705
706 int handle_op (int tok_id, bool bos = false, bool compat = true);
707
708 int finish_command_arg ();
709
710 int handle_token (int tok_id);
711 int handle_token (token *tok);
712
713 int count_token_internal (int tok_id);
714
715 int show_token (int tok_id);
716
717protected:
718
719 std::stack<int> start_state_stack;
720};
721
722class lexer : public base_lexer
723{
724public:
725
727 : base_lexer (interp), m_reader (interp), m_initial_input (true)
728 { }
729
730 lexer (FILE *file, interpreter& interp)
731 : base_lexer (interp), m_reader (interp, file), m_initial_input (true)
732 { }
733
734 lexer (FILE *file, interpreter& interp, const std::string& encoding)
735 : base_lexer (interp), m_reader (interp, file, encoding),
736 m_initial_input (true)
737 { }
738
739 lexer (const std::string& eval_string, interpreter& interp)
740 : base_lexer (interp), m_reader (interp, eval_string),
741 m_initial_input (true)
742 { }
743
744 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (lexer)
745
746 ~lexer () = default;
747
748 void reset ()
749 {
750 m_initial_input = true;
751
753 }
754
755 std::string input_source () const
756 {
757 return m_reader.input_source ();
758 }
759
761 {
763 }
764
765 bool input_from_file () const
766 {
767 return m_reader.input_from_file ();
768 }
769
771 {
773 }
774
775 int fill_flex_buffer (char *buf, unsigned int max_size);
776
778
779 // TRUE means we are filling the input buffer for the first time.
780 // Otherwise, we are requesting more input to complete the parse
781 // and, if printing a prompt, should use the secondary prompt
782 // string.
783
785};
786
787template <> int base_lexer::handle_number<2> ();
788template <> int base_lexer::handle_number<10> ();
789template <> int base_lexer::handle_number<16> ();
790
791class push_lexer : public base_lexer
792{
793public:
794
796 : base_lexer (interp)
797 {
798 append_input ("", false);
799 }
800
801 push_lexer (const std::string& input, interpreter& interp)
802 : base_lexer (interp)
803 {
804 append_input (input, false);
805 }
806
807 push_lexer (bool eof, interpreter& interp)
808 : base_lexer (interp)
809 {
810 append_input ("", eof);
811 }
812
813 push_lexer (const std::string& input, bool eof, interpreter& interp)
814 : base_lexer (interp)
815 {
816 append_input (input, eof);
817 }
818
819 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (push_lexer)
820
821 ~push_lexer () = default;
822
823 bool is_push_lexer () const { return true; }
824
825 void append_input (const std::string& input, bool eof);
826
827 std::string input_source () const { return "push buffer"; }
828
829 int fill_flex_buffer (char *buf, unsigned int max_size);
830};
831
832OCTAVE_END_NAMESPACE(octave)
833
834#endif
bool at_eof() const
Definition lex.h:552
bool empty() const
Definition lex.h:550
int copy_chunk(char *buf, std::size_t max_size, bool by_lines=false)
Definition lex.cc:5193
void fill(const std::string &input, bool eof_arg)
Definition lex.cc:5183
void maybe_warn_separator_insert(char sep)
Definition lex.cc:6346
base_lexer(interpreter &interp)
Definition lex.h:562
void warn_language_extension_operator(const std::string &op)
Definition lex.cc:6389
int handle_superclass_identifier()
Definition lex.cc:6204
comment_list get_comment_list()
Definition lex.h:620
bool at_end_of_buffer() const
Definition lex.h:584
void push_start_state(int state)
Definition lex.cc:6632
int handle_close_bracket(int bracket_type)
Definition lex.cc:6166
std::stack< int > start_state_stack
Definition lex.h:719
virtual bool is_push_lexer() const
Definition lex.h:574
bool looking_at_space()
Definition lex.cc:5421
bool inside_any_object_index()
Definition lex.cc:5429
bool at_end_of_file() const
Definition lex.h:586
virtual int fill_flex_buffer(char *buf, unsigned int max_size)=0
void begin_string(int state)
Definition lex.cc:5306
int start_state() const
Definition lex.h:700
bool input_from_tmp_history_file()
Definition lex.cc:6624
void update_token_positions(int tok_len)
Definition lex.cc:5409
int handle_end_of_input()
Definition lex.cc:5314
virtual bool input_from_terminal() const
Definition lex.h:686
void maybe_warn_language_extension_comment(char c)
Definition lex.cc:6376
bool looks_like_command_arg()
Definition lex.cc:6191
bool fq_identifier_contains_keyword(const std::string &s)
Definition lex.cc:5718
void warn_deprecated_syntax(const std::string &msg)
Definition lex.cc:6399
void push_token(token *)
Definition lex.cc:6432
void * m_scanner
Definition lex.h:676
void warn_language_extension(const std::string &msg)
Definition lex.cc:6361
void finish_comment(comment_elt::comment_type typ)
Definition lex.cc:6153
void display_start_state() const
Definition lex.cc:6661
void prep_for_file()
Definition lex.cc:5298
token * make_meta_identifier_token(const std::string &cls)
Definition lex.cc:6232
void init()
Definition lex.cc:5254
void warn_language_extension_continuation()
Definition lex.cc:6383
int handle_identifier()
Definition lex.cc:6266
int text_yyinput()
Definition lex.cc:5350
token * make_keyword_token(const std::string &s)
Definition lex.cc:5446
virtual bool input_from_file() const
Definition lex.h:688
input_buffer m_input_buf
Definition lex.h:679
token * make_fq_identifier_token(const std::string &ident)
Definition lex.cc:6247
void fatal_error(const char *msg)
Definition lex.cc:6581
int handle_op(int tok_id, bool bos=false, bool compat=true)
Definition lex.cc:6733
virtual std::string input_source() const
Definition lex.h:684
int syntax_error(const std::string &msg)
Definition lex.cc:6410
int show_token(int tok_id)
Definition lex.cc:6812
int handle_token(int tok_id)
Definition lex.cc:6783
void clear_start_state()
Definition lex.cc:6652
void handle_continuation()
Definition lex.cc:6086
bool maybe_unput_comma_before_unary_op(int tok_id)
Definition lex.cc:6710
bool debug_flag() const
Definition lex.cc:6587
void xunput(char c, char *buf)
Definition lex.cc:5385
void display_token(int tok_id)
Definition lex.cc:6453
int handle_number()
std::size_t pending_token_count() const
Definition lex.cc:6447
virtual bool input_from_eval_string() const
Definition lex.h:690
virtual void reset()
Definition lex.cc:5275
void check_comment_for_hash_char(const char *txt, std::size_t len)
Definition lex.cc:6333
int count_token_internal(int tok_id)
Definition lex.cc:6803
virtual ~base_lexer()
Definition lex.cc:5248
bool whitespace_is_significant()
Definition lex.cc:5746
bool display_tokens() const
Definition lex.cc:6594
char * flex_yytext()
Definition lex.cc:5338
comment_list m_comment_list
Definition lex.h:682
int flex_yyleng()
Definition lex.cc:5344
void lexer_debug(const char *pattern)
Definition lex.cc:6610
int finish_command_arg()
Definition lex.cc:6772
void pop_start_state()
Definition lex.cc:6642
void increment_token_count()
Definition lex.cc:6601
token * current_token()
Definition lex.cc:6440
bool input_from_file() const
Definition input.h:288
std::string input_source() const
Definition input.h:278
bool input_from_eval_string() const
Definition input.h:293
bool input_from_terminal() const
Definition input.h:283
Definition lex.h:723
bool m_initial_input
Definition lex.h:784
bool input_from_eval_string() const
Definition lex.h:770
input_reader m_reader
Definition lex.h:777
lexer(FILE *file, interpreter &interp)
Definition lex.h:730
bool input_from_file() const
Definition lex.h:765
std::string input_source() const
Definition lex.h:755
void reset()
Definition lex.h:748
lexer(interpreter &interp)
Definition lex.h:726
~lexer()=default
lexer(FILE *file, interpreter &interp, const std::string &encoding)
Definition lex.h:734
lexer(const std::string &eval_string, interpreter &interp)
Definition lex.h:739
bool input_from_terminal() const
Definition lex.h:760
bbp_nesting_level & operator=(const bbp_nesting_level &nl)
Definition lex.h:113
bbp_nesting_level(const bbp_nesting_level &nl)
Definition lex.h:109
symbol_table_context(interpreter &interp)
Definition lex.h:61
symbol_scope curr_scope() const
Definition lex.cc:4965
symbol_scope parent_scope() const
Definition lex.cc:4974
std::size_t size() const
Definition lex.h:72
void push(const symbol_scope &scope)
Definition lex.h:76
std::size_t size() const
Definition lex.h:248
const token * back() const
Definition lex.h:242
void push(token *tok)
Definition lex.h:201
const token * front() const
Definition lex.h:232
token * at(std::size_t n)
Definition lex.h:216
const token * at(std::size_t n) const
Definition lex.h:221
bool m_looking_at_parameter_list
Definition lex.h:367
bool m_reading_classdef_file
Definition lex.h:434
bool previous_token_is_binop() const
Definition lex.cc:5105
bool space_follows_previous_token() const
Definition lex.cc:5098
bool m_looking_at_anon_fcn_args
Definition lex.h:361
std::string m_package_name
Definition lex.h:502
void mark_as_variables(const std::list< std::string > &lst)
Definition lex.cc:5141
bool previous_token_is_keyword() const
Definition lex.cc:5125
bool previous_token_is(int tok_id) const
Definition lex.cc:5076
filepos m_filepos
Definition lex.h:470
bool m_arguments_is_keyword
Definition lex.h:385
std::string m_current_input_line
Definition lex.h:483
bool m_end_of_input
Definition lex.h:351
bool m_allow_command_syntax
Definition lex.h:354
int m_looping
Definition lex.h:451
bool m_parsing_classdef_set_method
Definition lex.h:418
int m_bracketflag
Definition lex.h:445
bool m_parsing_anon_fcn_body
Definition lex.h:392
std::string m_comment_text
Definition lex.h:487
token_cache m_tokens
Definition lex.h:521
std::stack< bool > m_parsed_function_name
Definition lex.h:511
bool m_at_beginning_of_statement
Definition lex.h:358
int m_block_comment_nesting_level
Definition lex.h:460
bool previous_token_may_be_command() const
Definition lex.cc:5150
token * previous_token()
Definition lex.cc:5057
int m_command_arg_paren_count
Definition lex.h:463
std::string m_fcn_file_full_name
Definition lex.h:496
bool m_looking_at_return_list
Definition lex.h:364
bool m_parsing_classdef_get_method
Definition lex.h:415
std::string m_string_text
Definition lex.h:480
std::list< bool > m_looking_at_object_index
Definition lex.h:506
int m_braceflag
Definition lex.h:448
bool m_parsing_classdef_decl
Definition lex.h:403
bool m_looking_at_matrix_or_assign_lhs
Definition lex.h:375
bool m_parsing_classdef_superclass
Definition lex.h:407
lexical_feedback(interpreter &interp)
Definition lex.h:263
bool m_looking_for_object_index
Definition lex.h:378
interpreter & m_interpreter
Definition lex.h:348
bbp_nesting_level m_nesting_level
Definition lex.h:518
bool m_parsing_classdef
Definition lex.h:398
int previous_token_id() const
Definition lex.cc:5069
bool m_reading_script_file
Definition lex.h:431
bool m_classdef_element_names_are_keywords
Definition lex.h:389
bool m_reading_fcn_file
Definition lex.h:428
std::size_t m_token_count
Definition lex.h:467
std::string m_function_text
Definition lex.h:490
bool m_comment_uses_hash_char
Definition lex.h:442
filepos m_tok_end
Definition lex.h:477
std::string m_fcn_file_name
Definition lex.h:493
bool m_looking_at_decl_list
Definition lex.h:371
symbol_table_context m_symtab_context
Definition lex.h:514
bool m_quote_is_transpose
Definition lex.h:421
filepos m_tok_beg
Definition lex.h:476
bool m_parsing_class_method
Definition lex.h:395
void mark_previous_token_trailing_space()
Definition lex.cc:5090
bool m_buffer_function_text
Definition lex.h:438
bool m_force_script
Definition lex.h:425
void reset()
Definition lex.cc:4997
void mark_as_variable(const std::string &nm)
Definition lex.cc:5132
std::string m_dir_name
Definition lex.h:499
bool m_maybe_classdef_get_set_method
Definition lex.h:412
bool m_looking_at_indirect_ref
Definition lex.h:382
int m_looking_at_function_handle
Definition lex.h:457
int m_defining_fcn
Definition lex.h:454
void init()
Definition lex.cc:4989
int fill_flex_buffer(char *buf, unsigned int max_size)
Definition lex.cc:6897
push_lexer(const std::string &input, bool eof, interpreter &interp)
Definition lex.h:813
~push_lexer()=default
push_lexer(interpreter &interp)
Definition lex.h:795
void append_input(const std::string &input, bool eof)
Definition lex.cc:6874
push_lexer(bool eof, interpreter &interp)
Definition lex.h:807
bool is_push_lexer() const
Definition lex.h:823
std::string input_source() const
Definition lex.h:827
push_lexer(const std::string &input, interpreter &interp)
Definition lex.h:801
Definition token.h:42
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
bool iskeyword(const std::string &s)
Definition lex.cc:1335
F77_RET_T len
Definition xerbla.cc:61