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

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

http://github.com/tybor/Liberty
Specman e | 60 lines | 25 code | 6 blank | 29 comment | 0 complexity | 03197eac70a7ddd1fe36eeadec9bc95a 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_NOT_THEN_ANY
 5   --
 6   -- negate the node such that if node matches it makes
 7   -- a backtrack but conversely if node fails, the character
 8   -- is accepted (any character) and exploration continues.
 9   --
10
11inherit
12   REGULAR_EXPRESSION_ITEM
13   REGULAR_EXPRESSION_ITEM_GLOBALS
14
15create {ANY}
16   make
17
18feature {ANY}
19   node: BACKTRACKING_NODE
20         -- the node to negate
21
22   make, set_node (value: BACKTRACKING_NODE)
23      require
24         value_not_void: value /= Void
25      do
26         node := value
27      ensure
28         definition: node = value
29         node_not_void: node /= Void
30      end
31
32   explore (matcher: BACKTRACKING_REGULAR_EXPRESSION)
33      do
34         matcher.push_cut_point
35         matcher.push_or(the_any_character_item)
36         matcher.push_and(the_cut_and_false_node)
37         matcher.set_current_node(node)
38      end
39
40end -- class REGULAR_EXPRESSION_ITEM_NOT_THEN_ANY
41--
42-- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file.
43--
44-- Permission is hereby granted, free of charge, to any person obtaining a copy
45-- of this software and associated documentation files (the "Software"), to deal
46-- in the Software without restriction, including without limitation the rights
47-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
48-- copies of the Software, and to permit persons to whom the Software is
49-- furnished to do so, subject to the following conditions:
50--
51-- The above copyright notice and this permission notice shall be included in
52-- all copies or substantial portions of the Software.
53--
54-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
55-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
56-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
57-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
58-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
59-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
60-- THE SOFTWARE.