aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2016-09-28 20:46:52 +0200
committerTristan Gingold <tgingold@free.fr>2016-09-28 20:46:52 +0200
commit609ab44c99653762e6d0d26bdec2528aeeb77f0a (patch)
tree0996a03834e1d735ce46a24d00722cc54d93ecdc /src/vhdl
parentafe8072bf5faa1dca1705a08e88818d454ff8758 (diff)
downloadghdl-609ab44c99653762e6d0d26bdec2528aeeb77f0a.tar.gz
ghdl-609ab44c99653762e6d0d26bdec2528aeeb77f0a.tar.bz2
ghdl-609ab44c99653762e6d0d26bdec2528aeeb77f0a.zip
parse: remove duplicated function.
Diffstat (limited to 'src/vhdl')
-rw-r--r--src/vhdl/parse.adb51
1 files changed, 11 insertions, 40 deletions
diff --git a/src/vhdl/parse.adb b/src/vhdl/parse.adb
index 115b603a0..00ec78fb8 100644
--- a/src/vhdl/parse.adb
+++ b/src/vhdl/parse.adb
@@ -278,53 +278,22 @@ package body Parse is
-- If left is null_iir, the current token is used to create the left limit
-- expression.
--
- -- [3.1]
- -- range ::= RANGE_attribute_name
- -- | simple_expression direction simple_expression
- function Parse_Range_Expression (Left : Iir) return Iir
- is
- Res : Iir;
- begin
- Res := Create_Iir (Iir_Kind_Range_Expression);
- Set_Left_Limit (Res, Left);
-
- Location_Copy (Res, Left);
- case Current_Token is
- when Tok_To =>
- Set_Direction (Res, Iir_To);
- when Tok_Downto =>
- Set_Direction (Res, Iir_Downto);
- when others =>
- raise Internal_Error;
- end case;
-
- -- Skip TO or DOWNTO.
- Scan;
-
- Set_Right_Limit (Res, Parse_Simple_Expression);
- return Res;
- end Parse_Range_Expression;
-
-- [ 3.1 ]
-- range_constraint ::= RANGE range
--
-- [ 3.1 ]
- -- range ::= range_attribute_name
- -- | simple_expression direction simple_expression
+ -- range ::= RANGE_attribute_name
+ -- | simple_expression direction simple_expression
--
- -- [ 3.1 ]
-- direction ::= TO | DOWNTO
-
- -- precond: TO or DOWNTO
- -- postcond: next token
- function Parse_Range_Right (Left : Iir) return Iir
+ function Parse_Range_Expression (Left : Iir) return Iir
is
Res : Iir;
begin
Res := Create_Iir (Iir_Kind_Range_Expression);
- Set_Location (Res);
Set_Left_Limit (Res, Left);
+ Location_Copy (Res, Left);
case Current_Token is
when Tok_To =>
Set_Direction (Res, Iir_To);
@@ -334,10 +303,12 @@ package body Parse is
raise Internal_Error;
end case;
+ -- Skip TO or DOWNTO.
Scan;
+
Set_Right_Limit (Res, Parse_Simple_Expression);
return Res;
- end Parse_Range_Right;
+ end Parse_Range_Expression;
-- precond: next token
-- postcond: next token
@@ -350,7 +321,7 @@ package body Parse is
case Current_Token is
when Tok_To
| Tok_Downto =>
- return Parse_Range_Right (Left);
+ return Parse_Range_Expression (Left);
when others =>
if Left /= Null_Iir then
if Is_Range_Attribute_Name (Left) then
@@ -408,7 +379,7 @@ package body Parse is
case Current_Token is
when Tok_To
| Tok_Downto =>
- return Parse_Range_Right (Left);
+ return Parse_Range_Expression (Left);
when Tok_Range =>
return Parse_Subtype_Indication (Left);
when others =>
@@ -2008,7 +1979,7 @@ package body Parse is
| Tok_Downto =>
-- A range
Index_Constrained := True;
- Def := Parse_Range_Right (Type_Mark);
+ Def := Parse_Range_Expression (Type_Mark);
when others =>
-- For a /range/_attribute_name
Index_Constrained := True;
@@ -4502,7 +4473,7 @@ package body Parse is
elsif Current_Token = Tok_To or else Current_Token = Tok_Downto then
A_Choice := Create_Iir (Iir_Kind_Choice_By_Range);
Location_Copy (A_Choice, Expr1);
- Set_Choice_Range (A_Choice, Parse_Range_Right (Expr1));
+ Set_Choice_Range (A_Choice, Parse_Range_Expression (Expr1));
return A_Choice;
else
A_Choice := Create_Iir (Iir_Kind_Choice_By_Expression);