comparison libinterp/parse-tree/lex.h @ 16100:6b26e18d1dcb

reorder data members in lexical_feedback class * lex.h, lex.ll (lexical_feedback): Reorder data members in class to group bool, int, and container classes. (lexical_feedback::lexical_feedback, lexical_feedback::init): Reorder initialization to match.
author John W. Eaton <jwe@octave.org>
date Mon, 25 Feb 2013 19:45:46 -0500
parents 2fc554ffbc28
children 8d19626b38ae
comparison
equal deleted inserted replaced
16099:4b6c44096862 16100:6b26e18d1dcb
59 lexical_feedback 59 lexical_feedback
60 { 60 {
61 public: 61 public:
62 62
63 lexical_feedback (void) 63 lexical_feedback (void)
64 64 : convert_spaces_to_comma (true), do_comma_insert (false),
65 : bracketflag (0), braceflag (0), looping (0), 65 at_beginning_of_statement (true),
66 convert_spaces_to_comma (true), at_beginning_of_statement (true), 66 looking_at_anon_fcn_args (true), looking_at_return_list (false),
67 defining_func (0), looking_at_function_handle (0), 67 looking_at_parameter_list (false), looking_at_decl_list (false),
68 looking_at_anon_fcn_args (true), 68 looking_at_initializer_expression (false),
69 looking_at_return_list (false), looking_at_parameter_list (false), 69 looking_at_matrix_or_assign_lhs (false),
70 looking_at_decl_list (false), looking_at_initializer_expression (false), 70 looking_for_object_index (false),
71 looking_at_matrix_or_assign_lhs (false), looking_at_object_index (), 71 looking_at_indirect_ref (false), parsing_class_method (false),
72 looking_for_object_index (false), do_comma_insert (false), 72 maybe_classdef_get_set_method (false), parsing_classdef (false),
73 looking_at_indirect_ref (false), parsed_function_name (), 73 quote_is_transpose (false), bracketflag (0), braceflag (0),
74 parsing_class_method (false), maybe_classdef_get_set_method (false), 74 looping (0), defining_func (0), looking_at_function_handle (0),
75 parsing_classdef (false), quote_is_transpose (false), 75 looking_at_object_index (), parsed_function_name (),
76 pending_local_variables () 76 pending_local_variables ()
77
78 { 77 {
79 init (); 78 init ();
80 } 79 }
81 80
82 ~lexical_feedback (void) { } 81 ~lexical_feedback (void) { }
83 82
84 void init (void); 83 void init (void);
85 84
86 // Square bracket level count.
87 int bracketflag;
88
89 // Curly brace level count.
90 int braceflag;
91
92 // TRUE means we're in the middle of defining a loop.
93 int looping;
94
95 // TRUE means that we should convert spaces to a comma inside a 85 // TRUE means that we should convert spaces to a comma inside a
96 // matrix definition. 86 // matrix definition.
97 bool convert_spaces_to_comma; 87 bool convert_spaces_to_comma;
98 88
89 // GAG. Stupid kludge so that [[1,2][3,4]] will work.
90 bool do_comma_insert;
91
99 // TRUE means we are at the beginning of a statement, where a 92 // TRUE means we are at the beginning of a statement, where a
100 // command name is possible. 93 // command name is possible.
101 bool at_beginning_of_statement; 94 bool at_beginning_of_statement;
102
103 // Nonzero means we're in the middle of defining a function.
104 int defining_func;
105
106 // Nonzero means we are parsing a function handle.
107 int looking_at_function_handle;
108 95
109 // TRUE means we are parsing an anonymous function argument list. 96 // TRUE means we are parsing an anonymous function argument list.
110 bool looking_at_anon_fcn_args; 97 bool looking_at_anon_fcn_args;
111 98
112 // TRUE means we're parsing the return list for a function. 99 // TRUE means we're parsing the return list for a function.
125 112
126 // TRUE means we're parsing a matrix or the left hand side of 113 // TRUE means we're parsing a matrix or the left hand side of
127 // multi-value assignment statement. 114 // multi-value assignment statement.
128 bool looking_at_matrix_or_assign_lhs; 115 bool looking_at_matrix_or_assign_lhs;
129 116
130 // If the front of the list is TRUE, the closest paren, brace, or
131 // bracket nesting is an index for an object.
132 std::list<bool> looking_at_object_index;
133
134 // Object index not possible until we've seen something. 117 // Object index not possible until we've seen something.
135 bool looking_for_object_index; 118 bool looking_for_object_index;
136
137 // GAG. Stupid kludge so that [[1,2][3,4]] will work.
138 bool do_comma_insert;
139 119
140 // TRUE means we're looking at an indirect reference to a 120 // TRUE means we're looking at an indirect reference to a
141 // structure element. 121 // structure element.
142 bool looking_at_indirect_ref; 122 bool looking_at_indirect_ref;
143
144 // If the top of the stack is TRUE, then we've already seen the name
145 // of the current function. Should only matter if
146 // current_function_level > 0
147 std::stack<bool> parsed_function_name;
148 123
149 // TRUE means we are parsing a class method in function or classdef file. 124 // TRUE means we are parsing a class method in function or classdef file.
150 bool parsing_class_method; 125 bool parsing_class_method;
151 126
152 // TRUE means we are parsing a class method declaration line in a 127 // TRUE means we are parsing a class method declaration line in a
157 // TRUE means we are parsing a classdef file 132 // TRUE means we are parsing a classdef file
158 bool parsing_classdef; 133 bool parsing_classdef;
159 134
160 // Return transpose or start a string? 135 // Return transpose or start a string?
161 bool quote_is_transpose; 136 bool quote_is_transpose;
137
138 // Square bracket level count.
139 int bracketflag;
140
141 // Curly brace level count.
142 int braceflag;
143
144 // TRUE means we're in the middle of defining a loop.
145 int looping;
146
147 // Nonzero means we're in the middle of defining a function.
148 int defining_func;
149
150 // Nonzero means we are parsing a function handle.
151 int looking_at_function_handle;
152
153 // If the front of the list is TRUE, the closest paren, brace, or
154 // bracket nesting is an index for an object.
155 std::list<bool> looking_at_object_index;
156
157 // If the top of the stack is TRUE, then we've already seen the name
158 // of the current function. Should only matter if
159 // current_function_level > 0
160 std::stack<bool> parsed_function_name;
162 161
163 // Set of identifiers that might be local variable names. 162 // Set of identifiers that might be local variable names.
164 std::set<std::string> pending_local_variables; 163 std::set<std::string> pending_local_variables;
165 164
166 private: 165 private: