PageRenderTime 21ms CodeModel.GetById 15ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/src/lib/regular_expression/internal/regular_expression_items/regular_expression_item_look_end.e

http://github.com/tybor/Liberty
Specman e | 65 lines | 31 code | 7 blank | 27 comment | 2 complexity | 109354f15d4163497cee5d72c5db2803 MD5 | raw file
 1-- This file is part of a Liberty Eiffel library.
 2-- See the full copyright at the end.
 3--
 4class REGULAR_EXPRESSION_ITEM_LOOK_END
 5   --
 6   --
 7
 8inherit
 9   REGULAR_EXPRESSION_ITEM
10   REGULAR_EXPRESSION_ITEM_GLOBALS
11
12create {ANY}
13   make
14
15feature {ANY}
16   is_ahead: BOOLEAN
17         -- should look ahead? (or else behind?)
18
19   should_continue: BOOLEAN
20         -- should continue? (or else backtrack?)
21
22   make (ahead, continue: BOOLEAN)
23      do
24         is_ahead := ahead
25         should_continue := continue
26      ensure
27         definition: is_ahead = ahead and should_continue = continue
28      end
29
30   explore (matcher: BACKTRACKING_REGULAR_EXPRESSION)
31      do
32         if is_ahead then
33            matcher.end_look_ahead
34         else
35            matcher.end_look_behind
36         end
37         matcher.cut
38         if should_continue then
39            matcher.continue
40         else
41            matcher.backtrack
42         end
43      end
44
45end -- class REGULAR_EXPRESSION_ITEM_LOOK_END
46--
47-- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file.
48--
49-- Permission is hereby granted, free of charge, to any person obtaining a copy
50-- of this software and associated documentation files (the "Software"), to deal
51-- in the Software without restriction, including without limitation the rights
52-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
53-- copies of the Software, and to permit persons to whom the Software is
54-- furnished to do so, subject to the following conditions:
55--
56-- The above copyright notice and this permission notice shall be included in
57-- all copies or substantial portions of the Software.
58--
59-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
60-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
61-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
62-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
63-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
64-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
65-- THE SOFTWARE.