MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / parse

Method parse

extern/boost/boost/test/utils/runtime/cla/parser.hpp:155–297  ·  view source on GitHub ↗

input processing method

Source from the content-addressed store, hash-verified

153
154 // input processing method
155 int
156 parse( int argc, char** argv, runtime::arguments_store& res )
157 {
158 // save program name for help message
159 m_program_name = argv[0];
160 cstring path_sep( "\\/" );
161
162 cstring::iterator it = unit_test::utils::find_last_of( m_program_name.begin(), m_program_name.end(),
163 path_sep.begin(), path_sep.end() );
164 if( it != m_program_name.end() )
165 m_program_name.trim_left( it + 1 );
166
167 // Set up the traverser
168 argv_traverser tr( argc, (char const**)argv );
169
170 // Loop till we reach end of input
171 while( !tr.eoi() ) {
172 cstring curr_token = tr.current_token();
173
174 cstring prefix;
175 cstring name;
176 cstring value_separator;
177 bool negative_form = false;
178
179 // Perform format validations and split the argument into prefix, name and separator
180 // False return value indicates end of params indicator is met
181 if( !validate_token_format( curr_token, prefix, name, value_separator, negative_form ) ) {
182 // get rid of "end of params" token
183 tr.next_token();
184 break;
185 }
186
187 // Locate trie corresponding to found prefix and skip it in the input
188 trie_ptr curr_trie = m_param_trie[prefix];
189
190 if( !curr_trie ) {
191 // format_error() << "Unrecognized parameter prefix in the argument " << tr.current_token()
192 rt_cla_detail::report_foreing_token( m_program_name, curr_token );
193 tr.save_token();
194 continue;
195 }
196
197 curr_token.trim_left( prefix.size() );
198
199 // Locate parameter based on a name and skip it in the input
200 locate_result locate_res = locate_parameter( curr_trie, name, curr_token );
201 parameter_cla_id const& found_id = locate_res.first;
202 basic_param_ptr found_param = locate_res.second;
203
204 if( negative_form ) {
205 BOOST_TEST_I_ASSRT( found_id.m_negatable,
206 format_error( found_param->p_name )
207 << "Parameter tag " << found_id.m_tag << " is not negatable." );
208
209 curr_token.trim_left( m_negation_prefix.size() );
210 }
211
212 curr_token.trim_left( name.size() );

Callers

nothing calls this directly

Calls 14

find_last_ofFunction · 0.85
report_foreing_tokenFunction · 0.85
eoiMethod · 0.80
current_tokenMethod · 0.80
next_tokenMethod · 0.80
save_tokenMethod · 0.80
remainderMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
is_emptyMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected