Lines Matching full:statement

27   def __init__(self, statement, line_no, variables):  argument
28 self.statement = statement
81 def handle(self, statement, variables): argument
86 variant = statement.variant
88 self._if(statement, variables)
90 self._elif(statement, variables)
92 self._else(statement)
95 self._fi(statement)
107 def _if(self, statement, variables): argument
111 elif evaluate_line(statement, variables):
116 def _elif(self, statement, variables): argument
119 statement.line_no)
121 raise BadStructureException("CHECK-ELIF cannot be after CHECK-ELSE", statement.line_no)
125 if evaluate_line(statement, variables):
132 def _else(self, statement): argument
135 statement.line_no)
137 raise BadStructureException("Consecutive CHECK-ELSE statements", statement.line_no)
147 def _fi(self, statement): argument
149 raise BadStructureException("CHECK-FI does not have a matching CHECK-IF", statement.line_no)
163 def find_matching_line(statement, c1_pass, scope, variables, exclude_lines=[]): argument
164 """ Finds the first line in `c1_pass` which matches `statement`.
169 Returns the index of the `c1Pass` line matching the statement and variables
177 new_variables = match_lines(statement, c1_pass.body[i], variables)
180 raise MatchFailedException(statement, scope.start, variables)
207 lines in `scope` are scanned and each line can only match one statement.
210 line numbers) and the variable values after the match of the last statement.
212 Raises MatchFailedException when a statement cannot be satisfied.
220 for statement in self.dag_queue:
221 assert statement.variant == TestStatement.Variant.DAG
222 match = find_matching_line(statement, self.c1_pass, scope, variables, matched_lines)
236 Raises MatchFailedException if a statement matches a line in the scope.
238 for statement in self.not_queue:
239 assert statement.variant == TestStatement.Variant.NOT
241 if match_lines(statement, self.c1_pass.body[i], self.variables) is not None:
242 raise MatchFailedException(statement, i, self.variables)
250 def handle_in_order(self, statement): argument
251 """ Single in-order statement. Find the first line that matches and move
257 match = find_matching_line(statement, self.c1_pass, scope, self.variables)
260 def handle_next_line(self, statement): argument
261 """ Single next-line statement. Test if the current line matches and move
267 raise BadStructureException("A next-line statement can only be placed "
268 "after an in-order statement or another next-line statement.",
269 statement.line_no)
272 match = find_matching_line(statement, self.c1_pass, scope, self.variables)
275 def handle_eval(self, statement): argument
276 """ Evaluates the statement in the current context.
280 if not evaluate_line(statement, self.variables):
281 raise MatchFailedException(statement, self.cursor, self.variables)
283 def handle(self, statement): argument
284 variant = None if statement is None else statement.variant
290 self.if_stack.handle(statement, self.variables)
299 # First non-DAG statement always triggers execution of any preceding
307 self.handle_in_order(statement)
309 self.handle_next_line(statement)
311 self.dag_queue.append(statement)
313 self.not_queue.append(statement)
316 self.handle_eval(statement)
328 Raises MatchFailedException when a statement cannot be satisfied.
338 for statement in test_statements:
339 state.handle(statement)
369 if e.statement.variant == TestStatement.Variant.NOT:
370 msg = "NOT statement matched line {}"
372 msg = "Statement could not be matched starting from line {}"
377 Logger.test_failed(msg, e.statement, e.variables)