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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1f96acbbf1e7e66a X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!novia!newspump.monmouth.com!newspeer.monmouth.com!newsgate.cistron.nl!xs4all!amsnews11.chello.com!feeder1.cambrium.nl!feed.tweaknews.nl!news.netcologne.de!nhp.netcologne.de!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: lexical ambiguity Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1nozvv83n7lhc.1b3qf0olmyllp$.dlg@40tude.net> <9M_gg.1598$O5.554@llslave.llan.ll.mit.edu> <1149590366.8521.5.camel@localhost> Date: Wed, 7 Jun 2006 11:02:51 +0200 Message-ID: <19ibym5lwjybs$.1pkufcf0ck917$.dlg@40tude.net> NNTP-Posting-Date: 07 Jun 2006 11:02:41 MEST NNTP-Posting-Host: f9708bcc.newsread4.arcor-online.net X-Trace: DXC=9]l?;Qh>cMGUhhl_USDNiO:ejgIfPPldDjW\KbG]kaMH]kI_X=5KeaF`ik5[JH3BEK[6LHn;2LCVN[PBPlWd`n]J X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:4703 Date: 2006-06-07T11:02:41+02:00 List-Id: On 06 Jun 2006 13:38:06 +0200, M E Leypold wrote: > Georg Bauhaus writes: > >> On Mon, 2006-06-05 at 22:11 +0000, Jeffrey R. Carter wrote: >>> Keith Thompson wrote: >>> > >>> > If I recall correctly, it's sufficient to remember what the previous >>> > token was. A character literal cannot follow an identifier. >>> >>> Right, so it must be either an attribute, a qualified expression, or an >>> error. >> >> Though the previous token shouldn't be a reserved word, as in >> >> if'('="-"("="('='=',',','=',')) > > Or > > return'a'; > > So now (question to all): Is the following rule enough? > > - "'" is the beginning of a character literal if the token before > "'" has not been an identifier (reserved words not counted as > identifier in this case). It does not differ from the case of +/-. In the infix context, i.e. after an operand (whatever it might be), ' is an infix operation as well as +/-. In the prefix context, where an operand is expected ' introduces a character literal (=operand), +/- do an unary prefix operation. Your rule is wrong: 'A' and 'B'. "and" is a reserved word. Then of course "..." comments should be parsed before. Which gives you a nice vicious circle around ' " ' and " ' ". (:-)) The bottom line: parsing has state. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de