/src/tools/syntax/tree/liberty_ast_assignment_or_call.e
Specman e | 107 lines | 78 code | 15 blank | 14 comment | 0 complexity | 76f3fd623f1f5115507b3e8baec833af 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_ASSIGNMENT_OR_CALL 16 17inherit 18 LIBERTY_AST_NON_TERMINAL_NODE 19 20create {LIBERTY_NODE_FACTORY} 21 make 22 23feature {LIBERTY_AST_HANDLER} 24 writable: LIBERTY_AST_WRITABLE is 25 require 26 is_assignment 27 do 28 Result ::= nodes.item(0) 29 end 30 31 expression: LIBERTY_AST_EXPRESSION is 32 require 33 is_assignment 34 do 35 Result ::= nodes.item(2) 36 end 37 38 target: LIBERTY_AST_TARGET is 39 require 40 is_call 41 do 42 Result ::= nodes.item(0) 43 end 44 45 r10: LIBERTY_AST_R10 is 46 require 47 is_call 48 do 49 Result ::= nodes.item(1) 50 end 51 52 is_regular_assignment: BOOLEAN is 53 require 54 is_assignment 55 do 56 Result := nodes.item(1).name.is_equal(once "KW :=") 57 ensure 58 Result implies not is_assignment_attempt and then not is_forced_assignment 59 end 60 61 is_assignment_attempt: BOOLEAN is 62 require 63 is_assignment 64 do 65 Result := nodes.item(1).name.is_equal(once "KW ?=") 66 ensure 67 Result implies not is_regular_assignment and then not is_forced_assignment 68 end 69 70 is_forced_assignment: BOOLEAN is 71 require 72 is_assignment 73 do 74 Result := nodes.item(1).name.is_equal(once "KW ::=") 75 ensure 76 Result implies not is_assignment_attempt and then not is_regular_assignment 77 end 78 79 is_assignment: BOOLEAN is 80 do 81 Result := count = 3 82 ensure 83 Result = not is_call 84 end 85 86 is_call: BOOLEAN is 87 do 88 Result := count = 2 89 ensure 90 Result = not is_assignment 91 end 92 93feature {ANY} 94 count: INTEGER is 95 do 96 Result := nodes.count 97 end 98 99 name: STRING is "Assignment_Or_Call" 100 101feature {} 102 possible_counts: SET[INTEGER] is 103 once 104 Result := {AVL_SET[INTEGER] << 2, 3 >> } 105 end 106 107end