Path: csiph.com!usenet.pasdenom.info!bete-des-vosges.org!news.redatomik.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'tree': 0.05; 'aggregate': 0.07; 'extent': 0.07; 'referring': 0.07; 'string': 0.09; 'idea?': 0.09; 'literal': 0.09; 'parsed': 0.09; 'subject:Why': 0.09; 'python': 0.11; '(given': 0.16; '10:45': 0.16; 'expression.': 0.16; 'expressions,': 0.16; 'literal,': 0.16; 'literals.': 0.16; 'node,': 0.16; 'quoted': 0.16; 'subject: \n ': 0.16; 'subject:comment': 0.16; 'subject:quoted': 0.16; 'subject:simple': 0.16; 'subject:triple': 0.16; 'token,': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'parse': 0.24; 'looks': 0.24; 'this:': 0.26; 'least': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; "skip:' 10": 0.31; 'except': 0.35; 'no,': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'shows': 0.36; 'subject:?': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'either': 0.39; 'how': 0.40; 'expression': 0.60; 'ian': 0.60; 'more': 0.64; 'thomas': 0.65; 'subject:. ': 0.67; 'mar': 0.68; '26,': 0.68; 'goal': 0.75; '2015': 0.84; 'one*': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=7Z/hxBSQYfv30tXxclG9rfr8bk7lPGkqIT15WGtuls0=; b=0hdz7fc65pY/I4GV+B8KUhXhprmxyJG5ncfKC/+legSHQsnGZsjKs3bDmwAWN0guCE 2hlhy40TU4baUIpO25rIdGG+ILxqCTBtxyslJ57hbQ5t02emX+f8R02c6jIg1q2BBKWy eRIECSZRaOE3O5BX9WKT71BI6uxlVOqwfBtmmnI57DVaCDqw8HVX1udrN8etKOJBipQg 1fGF2KJjoYCnofNY0/5tFRkxHGSzFiv4wpjB21e6NLmvY9/DObyNDofJ38xUWQJ3aspA vjCny1Cmt10aUsiwaaMVLxNzGSEX6wO//pCP66enMw+mEbmjxmAeooiyBHgWF2cryHHC xnGQ== X-Received: by 10.70.96.98 with SMTP id dr2mr28814520pdb.96.1427394582953; Thu, 26 Mar 2015 11:29:42 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <2362875.FIK8ImHTJA@PointedEars.de> References: <3533816.ZYnZ2OzjCs@PointedEars.de> <3971951.908YQu3oQO@PointedEars.de> <1504323.jUKfeKbQsP@PointedEars.de> <2362875.FIK8ImHTJA@PointedEars.de> From: Ian Kelly Date: Thu, 26 Mar 2015 12:29:02 -0600 Subject: Re: A simple single line, triple-quoted comment is giving syntax error. Why? To: Python Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.19 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 50 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1427394586 news.xs4all.nl 2937 [2001:888:2000:d::a6]:46259 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:88082 On Thu, Mar 26, 2015 at 10:45 AM, Thomas 'PointedEars' Lahn wrote: > Ian Kelly wrote: >> What the grammar that you quoted from shows is that STRING+ is an >> expression. The individual STRINGs of a STRING+ are not expressions, >> except to the extent that they can be parsed in isolation as a >> STRING+. > > How did you get that idea? STRING+ means one or more consecutive STRING > tokens (ignoring whitespace in-between), which means one or more consecut= ive > string literals. A (single) string literal definitely is an expression a= s > it can be produced with the =E2=80=9Cexpr=E2=80=9D goal symbol of the Pyt= hon grammar (given > there in a flavor of EBNF). Yes, that's what I was referring to in my parenthetical "except..." above. What I mean is that if you construct a parse tree of "foo" "bar" using that grammar, it looks like this: expr | STRING+ / \ STRING STRING Not like this: expr | STRING+ / \ expr expr | | STRING STRING There is only one expr node, and it contains both STRING tokens. >> By the same token, a STRING+ is a single string literal, not >> an aggregate of several. > > No, in the used flavour of EBNF the unquoted =E2=80=9C+=E2=80=9D followin= g a goal symbol > clearly means the occurrence of *at least one* of the immediately precedi= ng > symbol, meaning either one *or more than one*. It means one or more *tokens*, not one or more literals.