PageRenderTime 13ms CodeModel.GetById 10ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/src/tools/syntax/tree/liberty_ast_target.e

http://github.com/tybor/Liberty
Specman e | 103 lines | 72 code | 17 blank | 14 comment | 1 complexity | 6c2422bb492a33fe14fc192bf043e915 MD5 | raw file
  1-- This file is part of Liberty Eiffel.
  2--
  3-- Liberty Eiffel is free software: you can redistribute it and/or modify
  4-- it under the terms of the GNU General Public License as published by
  5-- the Free Software Foundation, version 3 of the License.
  6--
  7-- Liberty Eiffel is distributed in the hope that it will be useful,
  8-- but WITHOUT ANY WARRANTY; without even the implied warranty of
  9-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 10-- GNU General Public License for more details.
 11--
 12-- You should have received a copy of the GNU General Public License
 13-- along with Liberty Eiffel.  If not, see <http://www.gnu.org/licenses/>.
 14--
 15class LIBERTY_AST_TARGET
 16
 17inherit
 18   LIBERTY_AST_NON_TERMINAL_NODE
 19
 20create {LIBERTY_NODE_FACTORY}
 21   make
 22
 23feature {LIBERTY_AST_HANDLER}
 24   is_result: BOOLEAN is
 25      do
 26         Result := count = 1 and then nodes.first.name.is_equal(once "KW Result")
 27      end
 28
 29   is_current: BOOLEAN is
 30      do
 31         Result := count = 1 and then nodes.first.name.is_equal(once "KW Current")
 32      end
 33
 34   is_parenthesized_expression: BOOLEAN is
 35      do
 36         Result := count = 3 and then nodes.first.name.is_equal(once "KW (")
 37      end
 38
 39   is_precursor: BOOLEAN is
 40      do
 41         Result := count = 3 and then nodes.first.name.is_equal(once "KW Precursor")
 42      end
 43
 44   is_implicit_feature_call: BOOLEAN is
 45      do
 46         Result := count = 2 and then nodes.first.name.is_equal(once "KW entity name")
 47      end
 48
 49   is_manifest_or_type_test: BOOLEAN is
 50      do
 51         Result := count = 1 and then nodes.first.name.is_equal(once "Manifest_Or_Type_Test")
 52      end
 53
 54   manifest_or_type_test: LIBERTY_AST_MANIFEST_OR_TYPE_TEST is
 55      require
 56         is_manifest_or_type_test
 57      do
 58         Result ::= nodes.item(0)
 59      end
 60
 61   parenthesized_expression: LIBERTY_AST_EXPRESSION is
 62      require
 63         is_parenthesized_expression
 64      do
 65         Result ::= nodes.item(1)
 66      end
 67
 68   precursor_type_mark: LIBERTY_AST_PRECURSOR_TYPE_MARK is
 69      require
 70         is_precursor
 71      do
 72         Result ::= nodes.item(1)
 73      end
 74
 75   implicit_feature_name: LIBERTY_AST_ENTITY_NAME is
 76      require
 77         is_implicit_feature_call
 78      do
 79         Result ::= nodes.item(0)
 80      end
 81
 82   actuals: LIBERTY_AST_ACTUALS is
 83      require
 84         is_precursor or else is_implicit_feature_call
 85      do
 86         Result ::= nodes.last
 87      end
 88
 89feature {ANY}
 90   count: INTEGER is
 91      do
 92         Result := nodes.count
 93      end
 94
 95   name: STRING is "Target"
 96
 97feature {}
 98   possible_counts: SET[INTEGER] is
 99      once
100         Result := {AVL_SET[INTEGER] << 1, 2, 3 >> }
101      end
102
103end