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

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

http://github.com/tybor/Liberty
Specman e | 57 lines | 24 code | 6 blank | 27 comment | 1 complexity | 79252d8aaa99f0a2732ca9d65a7c395e 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_RANGE
 5   --
 6   -- accept a character in a range
 7   --
 8
 9inherit
10   REGULAR_EXPRESSION_ITEM
11
12create {ANY}
13   make
14
15feature {ANY}
16   lower, upper: CHARACTER
17         -- lower and upper range
18
19   make (low, up: CHARACTER)
20      do
21         lower := low
22         upper := up
23      ensure
24         definition: lower = low and upper = up
25      end
26
27   explore (matcher: BACKTRACKING_REGULAR_EXPRESSION)
28      do
29         if matcher.valid_last_character and then matcher.last_character.in_range(lower, upper) then
30            matcher.advance
31            matcher.continue
32         else
33            matcher.backtrack
34         end
35      end
36
37end -- class REGULAR_EXPRESSION_ITEM_RANGE
38--
39-- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file.
40--
41-- Permission is hereby granted, free of charge, to any person obtaining a copy
42-- of this software and associated documentation files (the "Software"), to deal
43-- in the Software without restriction, including without limitation the rights
44-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
45-- copies of the Software, and to permit persons to whom the Software is
46-- furnished to do so, subject to the following conditions:
47--
48-- The above copyright notice and this permission notice shall be included in
49-- all copies or substantial portions of the Software.
50--
51-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
52-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
53-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
54-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
55-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
56-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
57-- THE SOFTWARE.