PageRenderTime 18ms CodeModel.GetById 12ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/src/lib/parse/eiffel/eiffel_non_terminal_node.e

http://github.com/tybor/Liberty
Specman e | 102 lines | 66 code | 13 blank | 23 comment | 3 complexity | d676d73f5def5602fb0794f8fe45e5a5 MD5 | raw file
  1-- This file is part of a Liberty Eiffel library.
  2-- See the full copyright at the end.
  3--
  4deferred class EIFFEL_NON_TERMINAL_NODE
  5
  6inherit
  7   EIFFEL_NODE
  8
  9feature {ANY}
 10   name_at (index: INTEGER): FIXED_STRING is
 11      require
 12         valid_index(index)
 13      deferred
 14      end
 15
 16   node_at (index: INTEGER): EIFFEL_NODE is
 17      require
 18         valid_index(index)
 19      deferred
 20      end
 21
 22   valid_index (index: INTEGER): BOOLEAN is
 23      deferred
 24      ensure
 25         definition: Result = (index >= lower and then index <= upper)
 26      end
 27
 28   lower: INTEGER is
 29      deferred
 30      ensure
 31         Result >= 0
 32      end
 33
 34   upper: INTEGER is
 35      deferred
 36      ensure
 37         Result >= upper - 1
 38      end
 39
 40   count: INTEGER is
 41      deferred
 42      ensure
 43         definition: Result = upper - lower + 1
 44      end
 45
 46   is_empty: BOOLEAN is
 47      deferred
 48      ensure
 49         definition: Result = (count = 0)
 50      end
 51
 52   source_line: INTEGER is
 53      do
 54         if count > 0 then
 55            Result := node_at(0).source_line
 56         end
 57      end
 58
 59   source_column: INTEGER is
 60      do
 61         if count > 0 then
 62            Result := node_at(0).source_column
 63         end
 64      end
 65
 66   source_index: INTEGER is
 67      do
 68         if count > 0 then
 69            Result := node_at(0).source_index
 70         end
 71      end
 72
 73feature {EIFFEL_GRAMMAR}
 74   set (index: INTEGER; node: EIFFEL_NODE) is
 75      require
 76         valid_index(index)
 77      deferred
 78      ensure
 79         node_at(index) = node
 80      end
 81
 82end -- class EIFFEL_NON_TERMINAL_NODE
 83--
 84-- Copyright (c) 2009 by all the people cited in the AUTHORS file.
 85--
 86-- Permission is hereby granted, free of charge, to any person obtaining a copy
 87-- of this software and associated documentation files (the "Software"), to deal
 88-- in the Software without restriction, including without limitation the rights
 89-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 90-- copies of the Software, and to permit persons to whom the Software is
 91-- furnished to do so, subject to the following conditions:
 92--
 93-- The above copyright notice and this permission notice shall be included in
 94-- all copies or substantial portions of the Software.
 95--
 96-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 97-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 98-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 99-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
100-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
101-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
102-- THE SOFTWARE.