-------------------------------------------------------------- ------------------ -- -- -- OCARINA COMPONENTS -- -- -- -- O C A R I N A . A A D L . P A R S E R -- -- -- -- S p e c -- -- -- -- Copyright (C) 2004-2006, GET-Telecom Paris. -- -- -- -- Ocarina is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. Ocarina is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -- -- Public License for more details. You should have received a copy of the -- -- GNU General Public License distributed with Ocarina; see file COPYING. -- -- If not, write to the Free Software Foundation, 51 Franklin Street, Fifth -- -- Floor, Boston, MA 02111-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- Ocarina is maintained by the Ocarina team -- -- (ocarina-users@listes.enst.fr) -- -- -- ------------------------------------------------------------------------------ -- This package gathers the functions that parse the global elements -- of an AADL description, and also common parsing functions -- (e.g. identifier parsing). with Types; use Types; with Ocarina.AADL.Tokens; with Ocarina.AADL.Parser_Errors; use Ocarina.AADL.Parser_Errors; package Ocarina.AADL.Parser is function Process (File_Name : String; AADL_Root : node_id) return node_id; -- Parse the file File_Name and return the Node_Id or the root of -- the resulting AADL tree, or No_Node if the parsing failed. If -- AADL_Root is not No_Node, then return itself, as it is the tree -- root. procedure Init; -- Initialize the parser and register it to the general Ocarina -- parser. type p_item_function_ptr is access function (Container : node_id) return node_id; type p_refinable_item_function_ptr is access function (Container : node_id; Refinable : Boolean) return node_id; -- Pointer to a function which parses an item private function P_Items_List (Func : p_item_function_ptr; Container : node_id; Code : parsing_code) return Integer; function P_Items_List (Func : p_item_function_ptr; Container : node_id; Code : parsing_code) return list_id; -- Parse list items of syntax: ( { Item }+ | none_statement ) function P_Items_List (Func : p_refinable_item_function_ptr; Container : node_id; Refinable : Boolean; Code : parsing_code; At_Least_One : Boolean := True) return Integer; function P_Items_List (Func : p_item_function_ptr; Container : node_id; Delimiter : Ocarina.AADL.Tokens.token_type; Is_Delimited : Boolean) return list_id; -- Parse ( { Item Delimiter }* Item ) -- If Is_Delimited = TRUE, parse ( { Item }* Item Delimiter ) function P_Items_List (Func : p_item_function_ptr; Container : node_id; Separator : Ocarina.AADL.Tokens.token_type; Delimiter : Ocarina.AADL.Tokens.token_type; Code : parsing_code) return list_id; -- Parse list items of syntax: ( { Item Separator }* Item Delimiter ) -- Func is a pointer which is used to parse (Item) -- Code indicates the object that we are parsing function P_None_Statement return Boolean; -- Parse ( none ; ), this function does NOT return a Node_Id because -- no useful data will be retrieved -- Return TRUE if the reserved word 'none' is followed by a ';' end Ocarina.AADL.Parser;