PageRenderTime 8ms CodeModel.GetById 2ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/tutorial/backtracking/expand_expression/abstract/expand_alternative.e

http://github.com/tybor/Liberty
Specman e | 51 lines | 27 code | 6 blank | 18 comment | 1 complexity | 0da6b9a6fe2bb02e3f4b31c6e15cb89f MD5 | raw file
 1-- See the Copyright notice at the end of this file.
 2--
 3class EXPAND_ALTERNATIVE
 4
 5inherit
 6	ABSTRACT_BACKTRACKING_ALTERNATIVE
 7	EXPRESSION_ITEM_GLOBALS
 8
 9feature {ABSTRACT_BACKTRACKING}
10	next_alternative (explorer: EXPAND_EXPRESSION) is
11		do
12			explorer.stack.resize(count)
13			if Iterate and then item.type = Or_item then
14				explorer.goto_item(item.first)
15				item := item.second
16				explorer.continue_alternative
17			else
18				explorer.goto_item(item)
19				explorer.pop_alternative
20			end
21		end
22
23feature {}
24	item: EXPRESSION_ITEM
25
26	count: INTEGER
27
28feature {EXPAND_EXPRESSION}
29	make (itm: EXPRESSION_ITEM; cnt: INTEGER) is
30		do
31			count := cnt
32			item := itm
33		end
34
35end -- class EXPAND_ALTERNATIVE
36--
37-- ------------------------------------------------------------------------------------------------------------------------------
38-- Copyright notice below. Please read.
39--
40-- This file is free software, which comes along with SmartEiffel. This software is distributed in the hope that it will be
41-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
42-- You can modify it as you want, provided this footer is kept unaltered, and a notification of the changes is added.
43-- You are allowed to redistribute it and sell it, alone or as a part of another product.
44--
45-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P.       - University of Nancy 1 - FRANCE
46-- Copyright(C) 2003-2005: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
47--
48-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
49--
50-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
51-- ------------------------------------------------------------------------------------------------------------------------------