PageRenderTime 12ms CodeModel.GetById 2ms app.highlight 3ms RepoModel.GetById 3ms app.codeStats 1ms

/src/tools/syntax/tree/liberty_ast_e10.e

http://github.com/tybor/Liberty
Specman e | 131 lines | 96 code | 20 blank | 15 comment | 1 complexity | e8dd557a5649ecb041256cf7b19059f9 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_E10
 16
 17inherit
 18   LIBERTY_AST_NON_TERMINAL_NODE
 19
 20create {LIBERTY_NODE_FACTORY}
 21   make
 22
 23feature {LIBERTY_AST_HANDLER}
 24   is_call: BOOLEAN is
 25      do
 26         Result := count = 1 and then nodes.first.name.is_equal(once "Call")
 27      end
 28
 29   call: LIBERTY_AST_CALL is
 30      require
 31         is_call
 32      do
 33         Result ::= nodes.item(0)
 34      end
 35
 36   is_tuple: BOOLEAN is
 37      do
 38         Result := nodes.first.name.is_equal(once "KW [")
 39         check
 40            Result = nodes.last.name.is_equal(once "KW ]")
 41         end
 42      end
 43
 44   tuple_actuals: EIFFEL_LIST_NODE is
 45         -- Void if empty tuple
 46      require
 47         is_tuple
 48      do
 49         if count = 3 then
 50            Result ::= nodes.item(1)
 51         end
 52      end
 53
 54   is_open_argument: BOOLEAN is
 55      do
 56         Result := count = 1 and then nodes.first.name.is_equal(once "KW ?")
 57      end
 58
 59   is_inline_agent: BOOLEAN is
 60      do
 61         Result := count = 4
 62         check
 63            Result = nodes.item(0).name.is_equal(once "Agent_Signature")
 64         end
 65      end
 66
 67   inline_agent_signature: LIBERTY_AST_AGENT_SIGNATURE is
 68      require
 69         is_inline_agent
 70      do
 71         Result ::= nodes.item(0)
 72      end
 73
 74   inline_agent_definition: LIBERTY_AST_ROUTINE_DEFINITION is
 75      require
 76         is_inline_agent
 77      do
 78         Result ::= nodes.item(2)
 79      end
 80
 81   inline_agent_actuals: LIBERTY_AST_ACTUALS is
 82      require
 83         is_inline_agent
 84      do
 85         Result ::= nodes.item(3)
 86      end
 87
 88   is_agent_creation: BOOLEAN is
 89      do
 90         Result := count = 2 and then nodes.item(0).name.is_equal(once "KW agent")
 91      end
 92
 93   agent_creation_expression: LIBERTY_AST_EXPRESSION is
 94      require
 95         is_agent_creation
 96      do
 97         Result ::= nodes.item(1)
 98      end
 99
100   is_creation_expression: BOOLEAN is
101      do
102         Result := count = 1 and then nodes.item(0).name.is_equal(once "Creation_Expression")
103      end
104
105   creation_expression: LIBERTY_AST_CREATION_EXPRESSION is
106      require
107         is_creation_expression
108      do
109         Result ::= nodes.item(0)
110      end
111
112   is_void: BOOLEAN is
113      do
114         Result := count = 1 and then nodes.item(0).name.is_equal(once "KW Void")
115      end
116
117feature {ANY}
118   count: INTEGER is
119      do
120         Result := nodes.count
121      end
122
123   name: STRING is "e10"
124
125feature {}
126   possible_counts: SET[INTEGER] is
127      once
128         Result := {AVL_SET[INTEGER] << 1, 2, 3, 4 >> }
129      end
130
131end