Commit 1158948c authored by yoogx's avatar yoogx

* Adjust parser to address AADLv2.1 parsing of list of records

        For ticket #29
parent 9426eaee
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2015 ESA & ISAE. --
-- -- -- --
-- Ocarina is free software; you can redistribute it and/or modify -- -- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the -- -- it under terms of the GNU General Public License as published by the --
...@@ -2508,6 +2508,9 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is ...@@ -2508,6 +2508,9 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is
return No_Node; return No_Node;
end if; end if;
when T_Left_Square_Bracket =>
return P_Record_Term;
when others => when others =>
DPE (PC_Boolean_Or_Record_Term); DPE (PC_Boolean_Or_Record_Term);
return No_Node; return No_Node;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. -- -- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2015 ESA & ISAE. --
-- -- -- --
-- Ocarina is free software; you can redistribute it and/or modify -- -- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the -- -- it under terms of the GNU General Public License as published by the --
...@@ -85,7 +85,6 @@ package body Ocarina.FE_AADL.Parser.Properties is ...@@ -85,7 +85,6 @@ package body Ocarina.FE_AADL.Parser.Properties is
Loc : Location; Loc : Location;
Prop_Value : Node_Id; Prop_Value : Node_Id;
Parse_List_Of_Properties : Boolean := True;
begin begin
-- Parse Property_Value -- Parse Property_Value
...@@ -93,30 +92,7 @@ package body Ocarina.FE_AADL.Parser.Properties is ...@@ -93,30 +92,7 @@ package body Ocarina.FE_AADL.Parser.Properties is
Save_Lexer (Loc); Save_Lexer (Loc);
Scan_Token; Scan_Token;
-- The AADLv2 BNF is ambiguous, a string starting with a '(' if Token = T_Left_Parenthesis then
-- can either be a list of property expressions e.g. "(foo,
-- bar);" _or_ a single_expression containing a record term,
-- e.g. "(foo => 1; bar =>2;)". This look ahead loop scans
-- token to see which case we are currently processing.
declare
Loc2 : Location;
begin
Save_Lexer (Loc2);
if Token = T_Left_Parenthesis then
while Token /= T_Right_Parenthesis loop
Scan_Token;
if Token = T_Semicolon or else Token = T_Applies then
Parse_List_Of_Properties := False;
end if;
end loop;
else
Parse_List_Of_Properties := False;
end if;
Restore_Lexer (Loc2);
end;
if Parse_List_Of_Properties then
Save_Lexer (Loc); Save_Lexer (Loc);
Scan_Token; Scan_Token;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment