Ejemplo n.º 1
0
	def _process_token_set(self, b, t, e):
		m = self._set_token_re.match(e)
		if m:
			v = ExpressionParameter(m.group(1))
			e = self.expr_parser.parse(m.group(2))
			b.append(t, {'var': v, 'expr': e})
		else:
			raise AssertionError, 'Invalid syntax for SET, expected assignment'
Ejemplo n.º 2
0
	def _process_token_for(self, b, t, e):
		m = self._for_in_token_re.match(e)
		if t == 'FOREACH' and not m:
			m = self._for_is_token_re.match(e)

		if m:
			v = ExpressionParameter(m.group(1))
			e = self.expr_parser.parse(m.group(2))
			b.start('FOR', {'var': v, 'expr': e})
			self._stack.append('FOR')
		else:
			if t == 'FOR':
				raise AssertionError, 'Invalid syntax in FOR, expected "IN"'
			else:
				raise AssertionError, 'Invalid syntax in FOREACH, expected "IN" or "="'