/src/tools/syntax/tree/liberty_ast_manifest_or_type_test.e
Specman e | 186 lines | 143 code | 29 blank | 14 comment | 1 complexity | af1b4bf8c4ff653b74a7228d46511370 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_MANIFEST_OR_TYPE_TEST 16 17inherit 18 LIBERTY_AST_NON_TERMINAL_NODE 19 20create {LIBERTY_NODE_FACTORY} 21 make 22 23feature {LIBERTY_AST_HANDLER} 24 is_number: BOOLEAN is 25 do 26 Result := count = 1 and then nodes.item(0).name.is_equal(once "KW number") 27 end 28 29 number: LIBERTY_AST_NUMBER is 30 require 31 is_number 32 do 33 Result ::= nodes.item(0) 34 end 35 36 is_true: BOOLEAN is 37 do 38 Result := count = 1 and then nodes.item(0).name.is_equal(once "KW True") 39 end 40 41 is_false: BOOLEAN is 42 do 43 Result := count = 1 and then nodes.item(0).name.is_equal(once "KW False") 44 end 45 46 is_character: BOOLEAN is 47 do 48 Result := count = 1 and then nodes.item(0).name.is_equal(once "KW character") 49 end 50 51 character: LIBERTY_AST_CHARACTER is 52 require 53 is_character 54 do 55 Result ::= nodes.item(0) 56 end 57 58 is_string: BOOLEAN is 59 do 60 Result := (count = 1 or else count = 2) and then nodes.last.name.is_equal(once "KW string") 61 end 62 63 is_once_string: BOOLEAN is 64 do 65 Result := nodes.item(0).name.is_equal(once "KW once") 66 ensure 67 Result implies is_string 68 end 69 70 string: LIBERTY_AST_STRING is 71 require 72 is_string 73 do 74 Result ::= nodes.last 75 end 76 77 is_typed_open_argument: BOOLEAN is 78 do 79 Result := count = 3 80 check 81 Result implies nodes.item(1).name.is_equal(once "Type_Definition") 82 end 83 end 84 85 open_argument_type: LIBERTY_AST_TYPE_DEFINITION is 86 require 87 is_typed_open_argument 88 do 89 Result ::= nodes.item(1) 90 end 91 92 is_assignment_test: BOOLEAN is 93 do 94 Result := count = 5 and then nodes.item(3).name.is_equal(once "KW ?:=") 95 end 96 97 assignment_test_type: LIBERTY_AST_TYPE_DEFINITION is 98 require 99 is_assignment_test 100 do 101 Result ::= nodes.item(1) 102 end 103 104 assignment_test_expression: LIBERTY_AST_EXPRESSION is 105 require 106 is_assignment_test 107 do 108 Result ::= nodes.item(4) 109 end 110 111 is_typed_manifest: BOOLEAN is 112 do 113 Result := count > 3 and then not is_assignment_test and then nodes.item(1).name.is_equal(once "Type_Definition") 114 end 115 116 is_number_typed_manifest: BOOLEAN is 117 do 118 Result := count = 4 and then nodes.item(2).name.is_equal(once "KW number") 119 ensure 120 Result implies is_typed_manifest 121 end 122 123 is_string_typed_manifest: BOOLEAN is 124 do 125 Result := count = 4 and then nodes.item(2).name.is_equal(once "KW string") 126 ensure 127 Result implies is_typed_manifest 128 end 129 130 is_array_typed_manifest: BOOLEAN is 131 do 132 Result := count = 5 and then nodes.item(3).name.is_equal(once "Array") 133 ensure 134 Result implies is_typed_manifest 135 end 136 137 typed_manifest_type: LIBERTY_AST_TYPE_DEFINITION is 138 require 139 is_typed_manifest 140 do 141 Result ::= nodes.item(1) 142 end 143 144 typed_manifest_number: LIBERTY_AST_NUMBER is 145 require 146 is_number_typed_manifest 147 do 148 Result ::= nodes.item(2) 149 end 150 151 typed_manifest_string: LIBERTY_AST_STRING is 152 require 153 is_string_typed_manifest 154 do 155 Result ::= nodes.item(2) 156 end 157 158 typed_manifest_array_parameters: EIFFEL_LIST_NODE is 159 require 160 is_array_typed_manifest 161 do 162 Result ::= nodes.item(2) 163 end 164 165 typed_manifest_array: LIBERTY_AST_ARRAY is 166 require 167 is_array_typed_manifest 168 do 169 Result ::= nodes.item(3) 170 end 171 172feature {ANY} 173 count: INTEGER is 174 do 175 Result := nodes.count 176 end 177 178 name: STRING is "Manifest_Or_Type_Test" 179 180feature {} 181 possible_counts: SET[INTEGER] is 182 once 183 Result := {AVL_SET[INTEGER] << 1, 2, 3, 4, 5 >> } 184 end 185 186end