This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
This patch implements part of the Ada2012 quantified expressions machinery. Iterator forms over arrays are supported. Execution of the following in Ada2012 mode must yield: YES FALSE TRUE TRUE TRUE -- with Text_IO; use Text_IO; procedure Proc is type Ar is array (1..10) of integer; Thing : Ar := (others => 0); function Change (X : integer) return Boolean is begin if Thing (X) >= 0 then Thing (X) := -1; return True; else return False; end if; end Change; begin if (for all I in thing'range => Thing (I) = 0) then Put_Line ("YES"); end if; Thing (5 ) := -111; Put_Line (Boolean'Image (for all J in thing'range => Thing (J) > 0)); Put_Line (Boolean'Image (for some J in thing'range => Thing (J) < 0)); while (for some I in thing'range => Change (I)) loop null; end loop; Put_Line (Boolean'Image (for all K in thing'range => Thing (K) < 0)); Thing := (0,1,2,3,4,5,6,7,8,9); Put_Line (Boolean'Image (for all I in Thing'first.. Thing'last - 1=> Thing (I) < THing (I+1))); end; Tested on x86_64-pc-linux-gnu, committed on trunk 2010-10-19 Ed Schonberg <schonberg@adacore.com> * exp_ch4.adb, exp_ch4.ads (Expand_Quantified_Expression): New procedure * exp_util.adb (Insert_Actions): Include Quantified_Expression. * expander.adb: Call Expand_Qualified_Expression. * par.adb: New procedure P_Quantified_Expression. Make P_Loop_Parameter_Specification global for use in quantified expressions. * par-ch3.adb (P_Subtype_Mark_Resync): Allow "some" as an identifier if version < Ada2012. * par-ch4.adb: New procedure P_Quantified_Expression. * par-ch5.adb: P_Loop_Parameter_Specification is now global. * scans.adb, scans.ads: Introduce token Some. For now leave as unreserved. * scn.adb (Scan_Reserved_Identifier): For earlier versions of Ada, treat Some as a regular identifier. * sem.adb: Call Analyze_Quantified_Expression. * sem_ch4.adb, sem_ch4.ads: New procedure Analyze_Quantified_Expression. * sem_ch5.adb, sem_ch5.ads: Analyze_Iteration_Scheme is public, for use in quantified expressions. * sem_res.adb: New procedure Resolve_Qualified_Expression. * sinfo.adb, sinfo.ads: New node N_Quantified_Expression * snames.ads-tmpl: New name Some. * sprint.adb: Output quantified_expression.
Attachment:
difs
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |