Mercurial > hg > octave-nkf
annotate libinterp/parse-tree/lex.h @ 16107:3b791008b88e
give name to anonymous enum
* lex.h (class lexical_feedback::bbp_nesting_level): Name anonymous
enum "bracket_type".
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 25 Feb 2013 23:49:43 -0500 |
parents | 031117f4db7c |
children | 7302f8a4df83 |
rev | line source |
---|---|
1 | 1 /* |
2 | |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
13973
diff
changeset
|
3 Copyright (C) 1993-2012 John W. Eaton |
1 | 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 the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
1 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
1 | 20 |
21 */ | |
22 | |
383 | 23 #if !defined (octave_lex_h) |
24 #define octave_lex_h 1 | |
1 | 25 |
8745
6dc61981d18b
better handling of object indexing in lexer
John W. Eaton <jwe@octave.org>
parents:
8701
diff
changeset
|
26 #include <list> |
16101
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
27 #include <set> |
11464
21b5284fa78d
avoid error when parsing nested functions
John W. Eaton <jwe@octave.org>
parents:
11367
diff
changeset
|
28 #include <stack> |
8745
6dc61981d18b
better handling of object indexing in lexer
John W. Eaton <jwe@octave.org>
parents:
8701
diff
changeset
|
29 |
5775 | 30 // FIXME -- these input buffer things should be members of a |
1826 | 31 // parser input stream class. |
32 | |
1 | 33 typedef struct yy_buffer_state *YY_BUFFER_STATE; |
34 | |
35 // Associate a buffer with a new file to read. | |
9247
b2790fd23800
More export symbols to allow usage from an IDE.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8920
diff
changeset
|
36 extern OCTINTERP_API YY_BUFFER_STATE create_buffer (FILE *f); |
1 | 37 |
38 // Report the current buffer. | |
9247
b2790fd23800
More export symbols to allow usage from an IDE.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8920
diff
changeset
|
39 extern OCTINTERP_API YY_BUFFER_STATE current_buffer (void); |
1 | 40 |
41 // Connect to new buffer buffer. | |
9247
b2790fd23800
More export symbols to allow usage from an IDE.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8920
diff
changeset
|
42 extern OCTINTERP_API void switch_to_buffer (YY_BUFFER_STATE buf); |
1 | 43 |
44 // Delete a buffer. | |
9247
b2790fd23800
More export symbols to allow usage from an IDE.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8920
diff
changeset
|
45 extern OCTINTERP_API void delete_buffer (YY_BUFFER_STATE buf); |
1 | 46 |
13973
2c664266e9d0
clean up parser memory on exit
John W. Eaton <jwe@octave.org>
parents:
13237
diff
changeset
|
47 extern OCTINTERP_API void clear_all_buffers (void); |
2c664266e9d0
clean up parser memory on exit
John W. Eaton <jwe@octave.org>
parents:
13237
diff
changeset
|
48 |
2c664266e9d0
clean up parser memory on exit
John W. Eaton <jwe@octave.org>
parents:
13237
diff
changeset
|
49 extern OCTINTERP_API void cleanup_parser (void); |
2c664266e9d0
clean up parser memory on exit
John W. Eaton <jwe@octave.org>
parents:
13237
diff
changeset
|
50 |
4867 | 51 // Is the given string a keyword? |
52 extern bool is_keyword (const std::string& s); | |
53 | |
9474
25ed2d6aacf6
Parse nested functions more accurately.
David Grundberg <individ@acc.umu.se>
parents:
9396
diff
changeset
|
54 extern void prep_lexer_for_script_file (void); |
25ed2d6aacf6
Parse nested functions more accurately.
David Grundberg <individ@acc.umu.se>
parents:
9396
diff
changeset
|
55 extern void prep_lexer_for_function_file (void); |
7715
5b4d278ec828
parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents:
7634
diff
changeset
|
56 |
1826 | 57 // For communication between the lexer and parser. |
58 | |
3585 | 59 class |
60 lexical_feedback | |
1826 | 61 { |
62 public: | |
63 | |
16106
031117f4db7c
use enum for values returned by eat_continuation and eat_whitespace
John W. Eaton <jwe@octave.org>
parents:
16105
diff
changeset
|
64 // Did eat_whitespace or eat_continuation eat a space or tab, or a |
031117f4db7c
use enum for values returned by eat_continuation and eat_whitespace
John W. Eaton <jwe@octave.org>
parents:
16105
diff
changeset
|
65 // newline, or both? |
031117f4db7c
use enum for values returned by eat_continuation and eat_whitespace
John W. Eaton <jwe@octave.org>
parents:
16105
diff
changeset
|
66 // |
031117f4db7c
use enum for values returned by eat_continuation and eat_whitespace
John W. Eaton <jwe@octave.org>
parents:
16105
diff
changeset
|
67 // Functions that return this type will return a logical OR of the |
031117f4db7c
use enum for values returned by eat_continuation and eat_whitespace
John W. Eaton <jwe@octave.org>
parents:
16105
diff
changeset
|
68 // following values: |
031117f4db7c
use enum for values returned by eat_continuation and eat_whitespace
John W. Eaton <jwe@octave.org>
parents:
16105
diff
changeset
|
69 // |
031117f4db7c
use enum for values returned by eat_continuation and eat_whitespace
John W. Eaton <jwe@octave.org>
parents:
16105
diff
changeset
|
70 // NO_WHITESPACE no spaces to eat |
031117f4db7c
use enum for values returned by eat_continuation and eat_whitespace
John W. Eaton <jwe@octave.org>
parents:
16105
diff
changeset
|
71 // SPACE_OR_TAB space or tab in input |
031117f4db7c
use enum for values returned by eat_continuation and eat_whitespace
John W. Eaton <jwe@octave.org>
parents:
16105
diff
changeset
|
72 // NEWLINE bare new line in input |
031117f4db7c
use enum for values returned by eat_continuation and eat_whitespace
John W. Eaton <jwe@octave.org>
parents:
16105
diff
changeset
|
73 |
031117f4db7c
use enum for values returned by eat_continuation and eat_whitespace
John W. Eaton <jwe@octave.org>
parents:
16105
diff
changeset
|
74 enum whitespace_type |
031117f4db7c
use enum for values returned by eat_continuation and eat_whitespace
John W. Eaton <jwe@octave.org>
parents:
16105
diff
changeset
|
75 { |
031117f4db7c
use enum for values returned by eat_continuation and eat_whitespace
John W. Eaton <jwe@octave.org>
parents:
16105
diff
changeset
|
76 NO_WHITESPACE = 1, |
031117f4db7c
use enum for values returned by eat_continuation and eat_whitespace
John W. Eaton <jwe@octave.org>
parents:
16105
diff
changeset
|
77 SPACE_OR_TAB = 2, |
031117f4db7c
use enum for values returned by eat_continuation and eat_whitespace
John W. Eaton <jwe@octave.org>
parents:
16105
diff
changeset
|
78 NEWLINE = 4 |
031117f4db7c
use enum for values returned by eat_continuation and eat_whitespace
John W. Eaton <jwe@octave.org>
parents:
16105
diff
changeset
|
79 }; |
031117f4db7c
use enum for values returned by eat_continuation and eat_whitespace
John W. Eaton <jwe@octave.org>
parents:
16105
diff
changeset
|
80 |
031117f4db7c
use enum for values returned by eat_continuation and eat_whitespace
John W. Eaton <jwe@octave.org>
parents:
16105
diff
changeset
|
81 |
16104
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
82 // Track nesting of square brackets, curly braces, and parentheses. |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
83 |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
84 class bbp_nesting_level |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
85 { |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
86 private: |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
87 |
16107
3b791008b88e
give name to anonymous enum
John W. Eaton <jwe@octave.org>
parents:
16106
diff
changeset
|
88 enum bracket_type |
16104
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
89 { |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
90 BRACKET = 1, |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
91 BRACE = 2, |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
92 PAREN = 3 |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
93 }; |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
94 |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
95 public: |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
96 |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
97 bbp_nesting_level (void) : context () { } |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
98 |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
99 bbp_nesting_level (const bbp_nesting_level& nl) : context (nl.context) { } |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
100 |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
101 bbp_nesting_level& operator = (const bbp_nesting_level& nl) |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
102 { |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
103 if (&nl != this) |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
104 context = nl.context; |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
105 |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
106 return *this; |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
107 } |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
108 |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
109 ~bbp_nesting_level (void) { } |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
110 |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
111 void bracket (void) { context.push (BRACKET); } |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
112 |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
113 bool is_bracket (void) |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
114 { |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
115 return ! context.empty () && context.top () == BRACKET; |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
116 } |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
117 |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
118 void brace (void) { context.push (BRACE); } |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
119 |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
120 bool is_brace (void) |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
121 { |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
122 return ! context.empty () && context.top () == BRACE; |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
123 } |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
124 |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
125 void paren (void) { context.push (PAREN); } |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
126 |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
127 bool is_paren (void) |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
128 { |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
129 return ! context.empty () && context.top () == PAREN; |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
130 } |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
131 |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
132 bool is_bracket_or_brace (void) |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
133 { |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
134 return (! context.empty () |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
135 && (context.top () == BRACKET || context.top () == BRACE)); |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
136 } |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
137 |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
138 bool none (void) { return context.empty (); } |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
139 |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
140 void remove (void) |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
141 { |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
142 if (! context.empty ()) |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
143 context.pop (); |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
144 } |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
145 |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
146 void clear (void) |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
147 { |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
148 while (! context.empty ()) |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
149 context.pop (); |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
150 } |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
151 |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
152 private: |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
153 |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
154 std::stack<int> context; |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
155 }; |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
156 |
11515
6dbf9bcce90e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
11464
diff
changeset
|
157 lexical_feedback (void) |
16100
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
158 : convert_spaces_to_comma (true), do_comma_insert (false), |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
159 at_beginning_of_statement (true), |
16101
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
160 looking_at_anon_fcn_args (false), looking_at_return_list (false), |
16100
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
161 looking_at_parameter_list (false), looking_at_decl_list (false), |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
162 looking_at_initializer_expression (false), |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
163 looking_at_matrix_or_assign_lhs (false), |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
164 looking_for_object_index (false), |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
165 looking_at_indirect_ref (false), parsing_class_method (false), |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
166 maybe_classdef_get_set_method (false), parsing_classdef (false), |
16102
679a54d274d9
move global parser_end_of_input variable to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16101
diff
changeset
|
167 quote_is_transpose (false), parser_end_of_input (false), |
16103
6434f70f0ee0
move input_line_number and current_input_column to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16102
diff
changeset
|
168 input_line_number (1), current_input_column (1), |
16102
679a54d274d9
move global parser_end_of_input variable to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16101
diff
changeset
|
169 bracketflag (0), braceflag (0), |
16100
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
170 looping (0), defining_func (0), looking_at_function_handle (0), |
16105
b7de58feb2d3
move block_comment_nesting_level to lexical_feedback_class
John W. Eaton <jwe@octave.org>
parents:
16104
diff
changeset
|
171 block_comment_nesting_level (0), |
16100
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
172 looking_at_object_index (), parsed_function_name (), |
16104
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
173 pending_local_variables (), nesting_level () |
16101
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
174 { |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
175 init (); |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
176 } |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
177 |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
178 lexical_feedback (const lexical_feedback& lf) |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
179 : convert_spaces_to_comma (lf.convert_spaces_to_comma), |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
180 do_comma_insert (lf.do_comma_insert), |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
181 at_beginning_of_statement (lf.at_beginning_of_statement), |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
182 looking_at_anon_fcn_args (lf.looking_at_anon_fcn_args), |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
183 looking_at_return_list (lf.looking_at_return_list), |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
184 looking_at_parameter_list (lf.looking_at_parameter_list), |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
185 looking_at_decl_list (lf.looking_at_decl_list), |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
186 looking_at_initializer_expression (lf.looking_at_initializer_expression), |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
187 looking_at_matrix_or_assign_lhs (lf.looking_at_matrix_or_assign_lhs), |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
188 looking_for_object_index (lf.looking_for_object_index), |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
189 looking_at_indirect_ref (lf.looking_at_indirect_ref), |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
190 parsing_class_method (lf.parsing_class_method), |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
191 maybe_classdef_get_set_method (lf.maybe_classdef_get_set_method), |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
192 parsing_classdef (lf.parsing_classdef), |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
193 quote_is_transpose (lf.quote_is_transpose), |
16102
679a54d274d9
move global parser_end_of_input variable to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16101
diff
changeset
|
194 parser_end_of_input (lf.parser_end_of_input), |
16103
6434f70f0ee0
move input_line_number and current_input_column to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16102
diff
changeset
|
195 input_line_number (lf.input_line_number), |
6434f70f0ee0
move input_line_number and current_input_column to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16102
diff
changeset
|
196 current_input_column (lf.current_input_column), |
16101
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
197 bracketflag (lf.bracketflag), |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
198 braceflag (lf.braceflag), |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
199 looping (lf.looping), |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
200 defining_func (lf.defining_func), |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
201 looking_at_function_handle (lf.looking_at_function_handle), |
16105
b7de58feb2d3
move block_comment_nesting_level to lexical_feedback_class
John W. Eaton <jwe@octave.org>
parents:
16104
diff
changeset
|
202 block_comment_nesting_level (lf.block_comment_nesting_level), |
16101
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
203 looking_at_object_index (lf.looking_at_object_index), |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
204 parsed_function_name (lf.parsed_function_name), |
16104
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
205 pending_local_variables (lf.pending_local_variables), |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
206 nesting_level (lf.nesting_level) |
16101
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
207 { } |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
208 |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
209 lexical_feedback& operator = (const lexical_feedback& lf) |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
210 { |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
211 if (&lf != this) |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
212 { |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
213 convert_spaces_to_comma = lf.convert_spaces_to_comma; |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
214 do_comma_insert = lf.do_comma_insert; |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
215 at_beginning_of_statement = lf.at_beginning_of_statement; |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
216 looking_at_anon_fcn_args = lf.looking_at_anon_fcn_args; |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
217 looking_at_return_list = lf.looking_at_return_list; |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
218 looking_at_parameter_list = lf.looking_at_parameter_list; |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
219 looking_at_decl_list = lf.looking_at_decl_list; |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
220 looking_at_initializer_expression = lf.looking_at_initializer_expression; |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
221 looking_at_matrix_or_assign_lhs = lf.looking_at_matrix_or_assign_lhs; |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
222 looking_for_object_index = lf.looking_for_object_index; |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
223 looking_at_indirect_ref = lf.looking_at_indirect_ref; |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
224 parsing_class_method = lf.parsing_class_method; |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
225 maybe_classdef_get_set_method = lf.maybe_classdef_get_set_method; |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
226 parsing_classdef = lf.parsing_classdef; |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
227 quote_is_transpose = lf.quote_is_transpose; |
16102
679a54d274d9
move global parser_end_of_input variable to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16101
diff
changeset
|
228 parser_end_of_input = lf.parser_end_of_input; |
16103
6434f70f0ee0
move input_line_number and current_input_column to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16102
diff
changeset
|
229 input_line_number = lf.input_line_number; |
6434f70f0ee0
move input_line_number and current_input_column to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16102
diff
changeset
|
230 current_input_column = lf.current_input_column; |
16101
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
231 bracketflag = lf.bracketflag; |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
232 braceflag = lf.braceflag; |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
233 looping = lf.looping; |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
234 defining_func = lf.defining_func; |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
235 looking_at_function_handle = lf.looking_at_function_handle; |
16105
b7de58feb2d3
move block_comment_nesting_level to lexical_feedback_class
John W. Eaton <jwe@octave.org>
parents:
16104
diff
changeset
|
236 block_comment_nesting_level = lf.block_comment_nesting_level, |
16101
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
237 looking_at_object_index = lf.looking_at_object_index; |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
238 parsed_function_name = lf.parsed_function_name; |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
239 pending_local_variables = lf.pending_local_variables; |
16104
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
240 nesting_level = lf.nesting_level; |
16101
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
241 } |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
242 |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
243 return *this; |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
244 } |
1826 | 245 |
246 ~lexical_feedback (void) { } | |
247 | |
16101
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
248 void init (void) |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
249 { |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
250 // The closest paren, brace, or bracket nesting is not an object |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
251 // index. |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
252 looking_at_object_index.push_front (false); |
8d19626b38ae
provide copy contructor and operator = for lexical_feedback class.
John W. Eaton <jwe@octave.org>
parents:
16100
diff
changeset
|
253 } |
1826 | 254 |
2877 | 255 // TRUE means that we should convert spaces to a comma inside a |
2857 | 256 // matrix definition. |
257 bool convert_spaces_to_comma; | |
258 | |
16100
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
259 // GAG. Stupid kludge so that [[1,2][3,4]] will work. |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
260 bool do_comma_insert; |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
261 |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
8745
diff
changeset
|
262 // TRUE means we are at the beginning of a statement, where a |
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
8745
diff
changeset
|
263 // command name is possible. |
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
8745
diff
changeset
|
264 bool at_beginning_of_statement; |
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
8745
diff
changeset
|
265 |
13237
1bfca2bbea8b
fix parsing of anonymous functions inside cell array lists.
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
266 // TRUE means we are parsing an anonymous function argument list. |
1bfca2bbea8b
fix parsing of anonymous functions inside cell array lists.
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
267 bool looking_at_anon_fcn_args; |
1bfca2bbea8b
fix parsing of anonymous functions inside cell array lists.
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
268 |
2877 | 269 // TRUE means we're parsing the return list for a function. |
2857 | 270 bool looking_at_return_list; |
271 | |
2877 | 272 // TRUE means we're parsing the parameter list for a function. |
2857 | 273 bool looking_at_parameter_list; |
274 | |
8701
1652e39b934e
handle command names in declaration lists
John W. Eaton <jwe@octave.org>
parents:
8001
diff
changeset
|
275 // TRUE means we're parsing a declaration list (global or |
1652e39b934e
handle command names in declaration lists
John W. Eaton <jwe@octave.org>
parents:
8001
diff
changeset
|
276 // persistent). |
1652e39b934e
handle command names in declaration lists
John W. Eaton <jwe@octave.org>
parents:
8001
diff
changeset
|
277 bool looking_at_decl_list; |
1652e39b934e
handle command names in declaration lists
John W. Eaton <jwe@octave.org>
parents:
8001
diff
changeset
|
278 |
7634
ae90e05ad299
fix parameter list initializer bug
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
279 // TRUE means we are looking at the initializer expression for a |
ae90e05ad299
fix parameter list initializer bug
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
280 // parameter list element. |
ae90e05ad299
fix parameter list initializer bug
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
281 bool looking_at_initializer_expression; |
ae90e05ad299
fix parameter list initializer bug
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
282 |
3189 | 283 // TRUE means we're parsing a matrix or the left hand side of |
284 // multi-value assignment statement. | |
285 bool looking_at_matrix_or_assign_lhs; | |
286 | |
8745
6dc61981d18b
better handling of object indexing in lexer
John W. Eaton <jwe@octave.org>
parents:
8701
diff
changeset
|
287 // Object index not possible until we've seen something. |
6dc61981d18b
better handling of object indexing in lexer
John W. Eaton <jwe@octave.org>
parents:
8701
diff
changeset
|
288 bool looking_for_object_index; |
4234 | 289 |
2877 | 290 // TRUE means we're looking at an indirect reference to a |
2857 | 291 // structure element. |
292 bool looking_at_indirect_ref; | |
293 | |
9476 | 294 // TRUE means we are parsing a class method in function or classdef file. |
7336 | 295 bool parsing_class_method; |
296 | |
9476 | 297 // TRUE means we are parsing a class method declaration line in a |
298 // classdef file and can accept a property get or set method name. | |
299 // For example, "get.PropertyName" is recognized as a function name. | |
300 bool maybe_classdef_get_set_method; | |
301 | |
302 // TRUE means we are parsing a classdef file | |
303 bool parsing_classdef; | |
304 | |
1826 | 305 // Return transpose or start a string? |
2857 | 306 bool quote_is_transpose; |
1826 | 307 |
16102
679a54d274d9
move global parser_end_of_input variable to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16101
diff
changeset
|
308 // TRUE means that we have encountered EOF on the input stream. |
679a54d274d9
move global parser_end_of_input variable to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16101
diff
changeset
|
309 bool parser_end_of_input; |
679a54d274d9
move global parser_end_of_input variable to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16101
diff
changeset
|
310 |
16103
6434f70f0ee0
move input_line_number and current_input_column to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16102
diff
changeset
|
311 // The current input line number. |
6434f70f0ee0
move input_line_number and current_input_column to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16102
diff
changeset
|
312 int input_line_number; |
6434f70f0ee0
move input_line_number and current_input_column to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16102
diff
changeset
|
313 |
6434f70f0ee0
move input_line_number and current_input_column to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16102
diff
changeset
|
314 // The column of the current token. |
6434f70f0ee0
move input_line_number and current_input_column to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16102
diff
changeset
|
315 int current_input_column; |
6434f70f0ee0
move input_line_number and current_input_column to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16102
diff
changeset
|
316 |
16100
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
317 // Square bracket level count. |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
318 int bracketflag; |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
319 |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
320 // Curly brace level count. |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
321 int braceflag; |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
322 |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
323 // TRUE means we're in the middle of defining a loop. |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
324 int looping; |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
325 |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
326 // Nonzero means we're in the middle of defining a function. |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
327 int defining_func; |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
328 |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
329 // Nonzero means we are parsing a function handle. |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
330 int looking_at_function_handle; |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
331 |
16105
b7de58feb2d3
move block_comment_nesting_level to lexical_feedback_class
John W. Eaton <jwe@octave.org>
parents:
16104
diff
changeset
|
332 // Nestng level for blcok comments. |
b7de58feb2d3
move block_comment_nesting_level to lexical_feedback_class
John W. Eaton <jwe@octave.org>
parents:
16104
diff
changeset
|
333 int block_comment_nesting_level; |
b7de58feb2d3
move block_comment_nesting_level to lexical_feedback_class
John W. Eaton <jwe@octave.org>
parents:
16104
diff
changeset
|
334 |
16100
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
335 // If the front of the list is TRUE, the closest paren, brace, or |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
336 // bracket nesting is an index for an object. |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
337 std::list<bool> looking_at_object_index; |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
338 |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
339 // If the top of the stack is TRUE, then we've already seen the name |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
340 // of the current function. Should only matter if |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
341 // current_function_level > 0 |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
342 std::stack<bool> parsed_function_name; |
6b26e18d1dcb
reorder data members in lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
343 |
8001
ff9e7873f8ea
improve handling of command-style names in matrix_or_assign_lhs context
John W. Eaton <jwe@octave.org>
parents:
7723
diff
changeset
|
344 // Set of identifiers that might be local variable names. |
ff9e7873f8ea
improve handling of command-style names in matrix_or_assign_lhs context
John W. Eaton <jwe@octave.org>
parents:
7723
diff
changeset
|
345 std::set<std::string> pending_local_variables; |
16104
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
346 |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
347 // Is the closest nesting level a square bracket, squiggly brace or |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
348 // a paren? |
c8974e28da59
move nesting_level to lexical_feedback class
John W. Eaton <jwe@octave.org>
parents:
16103
diff
changeset
|
349 bbp_nesting_level nesting_level; |
1826 | 350 }; |
351 | |
7720
4e2eafef689c
unify comment and help text processing in lex.l and parse.y
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
352 class |
4e2eafef689c
unify comment and help text processing in lex.l and parse.y
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
353 stream_reader |
4e2eafef689c
unify comment and help text processing in lex.l and parse.y
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
354 { |
4e2eafef689c
unify comment and help text processing in lex.l and parse.y
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
355 public: |
4e2eafef689c
unify comment and help text processing in lex.l and parse.y
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
356 virtual int getc (void) = 0; |
4e2eafef689c
unify comment and help text processing in lex.l and parse.y
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
357 virtual int ungetc (int c) = 0; |
4e2eafef689c
unify comment and help text processing in lex.l and parse.y
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
358 |
4e2eafef689c
unify comment and help text processing in lex.l and parse.y
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
359 protected: |
4e2eafef689c
unify comment and help text processing in lex.l and parse.y
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
360 stream_reader (void) { } |
4e2eafef689c
unify comment and help text processing in lex.l and parse.y
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
361 ~stream_reader (void) { } |
4e2eafef689c
unify comment and help text processing in lex.l and parse.y
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
362 |
4e2eafef689c
unify comment and help text processing in lex.l and parse.y
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
363 private: |
4e2eafef689c
unify comment and help text processing in lex.l and parse.y
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
364 |
4e2eafef689c
unify comment and help text processing in lex.l and parse.y
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
365 // No copying! |
4e2eafef689c
unify comment and help text processing in lex.l and parse.y
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
366 stream_reader (const stream_reader&); |
4e2eafef689c
unify comment and help text processing in lex.l and parse.y
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
367 stream_reader& operator = (const stream_reader&); |
4e2eafef689c
unify comment and help text processing in lex.l and parse.y
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
368 }; |
4e2eafef689c
unify comment and help text processing in lex.l and parse.y
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
369 |
7723
74f5e0c7de9e
first pass at handling block comments
John W. Eaton <jwe@octave.org>
parents:
7720
diff
changeset
|
370 extern std::string |
74f5e0c7de9e
first pass at handling block comments
John W. Eaton <jwe@octave.org>
parents:
7720
diff
changeset
|
371 grab_comment_block (stream_reader& reader, bool at_bol, bool& eof); |
7720
4e2eafef689c
unify comment and help text processing in lex.l and parse.y
John W. Eaton <jwe@octave.org>
parents:
7715
diff
changeset
|
372 |
1826 | 373 // Flags that need to be shared between the lexer and parser. |
374 extern lexical_feedback lexer_flags; | |
440 | 375 |
1 | 376 #endif |