/src/tools/syntax/tree/liberty_ast_expression_root.e
Specman e | 58 lines | 36 code | 8 blank | 14 comment | 0 complexity | 93b22fa8d83d22a88a2db3545ad4410e 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-- 15deferred class LIBERTY_AST_EXPRESSION_ROOT[S_ -> LIBERTY_AST_NON_TERMINAL_NODE, B_ -> LIBERTY_AST_EXPRESSION_BINARY[S_]] 16 17inherit 18 LIBERTY_AST_NON_TERMINAL_NODE 19 20feature {LIBERTY_AST_HANDLER} 21 simple_expression: S_ is 22 require 23 is_simple_expression 24 do 25 Result ::= nodes.first 26 ensure 27 Result /= Void 28 end 29 30 binary_expression: B_ is 31 require 32 is_binary_expression 33 do 34 Result ::= nodes.first 35 ensure 36 Result /= Void 37 end 38 39 is_simple_expression: BOOLEAN is 40 do 41 Result := not is_binary_expression 42 end 43 44 is_binary_expression: BOOLEAN is 45 do 46 Result := nodes.first.name.has_suffix(once "-exp") 47 end 48 49feature {ANY} 50 count: INTEGER is 1 51 52feature {} 53 possible_counts: SET[INTEGER] is 54 once 55 Result := {AVL_SET[INTEGER] << 1 >> } 56 end 57 58end