From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,ecc058d81d1613b5 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.180.94.8 with SMTP id cy8mr9934942wib.1.1356837413743; Sat, 29 Dec 2012 19:16:53 -0800 (PST) Path: i11ni337233wiw.0!nntp.google.com!feeder3.cambriumusenet.nl!82.197.223.108.MISMATCH!feeder2.cambriumusenet.nl!feed.tweaknews.nl!85.12.40.139.MISMATCH!xlned.com!feeder7.xlned.com!newsfeed10.multikabel.net!multikabel.net!newsfeed20.multikabel.net!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!newsreader4.netcologne.de!news.netcologne.de!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Help on record to a Newbie Date: Thu, 27 Dec 2012 21:51:54 +0200 Organization: Tidorum Ltd Message-ID: References: Mime-Version: 1.0 X-Trace: individual.net oZVMvHWmRzEMeBF/xJroZAzq0k4qsA43GciarNuQjHtpk3bg4WZdzpeVTYCL71hzlN Cancel-Lock: sha1:nuS1KAD5jf2kwvUg/n22FGadImM= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/17.0 Thunderbird/17.0 In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Date: 2012-12-27T21:51:54+02:00 List-Id: On 12-12-27 21:31 , Cedric wrote: > Hi All, > > I started learning Ada (it's the third time I try!). Wishing you well in this... It would be easier to help you if you showed the whole compilation unit that is giving you trouble, and not just an extract of it. > I defined and declared the following: > > type t_terminal_type is (black_n_white, black_n_yellow, > black_n_green, color); > type t_color_type is (red, green, blue, yellow, black, white, grey); > type t_configure_type is > record > terminal : t_terminal_type; > foreground, > background : t_color_type; > end record; > > t_config : t_configure_type; That all looks like good declarations of some types and one object (a variable). But the following lines are *statements*, not declarations. You cannot mix declarations and statements, you must separate them syntactically. In most cases, the separator is the "begin" keyword. > t_config.terminal := black_n_white; > t_config.background := black; > t_config.foreground := white; > > The compiler (GNAT 2012) comes back with "declaration expected" for the last three lines. That is expected: if the compiler accepted the declarations quoted earlier, it expects more declarations, or some syntax that indicates the end of the declaration list, such as "begin". > As far as I understood the language I have declared the variable "t_config". Yes. > This variable has the components terminal, background and > foreground of their respective types which can be accessed > using dot-notation. Yes. > What did I miss here? Perhaps a "begin" between the declarations and the statements? I'm not sure exactly how to correct your code, since you didn't say if the declarations are in a package declaration (.ads file -- you cannot put any executable statements there), in a body (.adb file), or within a subprogram in a body. If you show the whole file that contains the things you quoted, you will get more precise help. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .