I understand, thanks. - Michael On Mon, 15 Nov 2004 21:58:55 +0100, Martin v. Löwis <martin at v.loewis.de> wrote: > Michael Walter wrote: > > I think it's inconsistent because it works for "list literals" but not > > for "integer literals". What do I miss? > > That tokenization works consistently, using the "maximum match" > strategy. > > If you meant to parse > > 1.__class__ > > as "<integer 1>" "." "<identifier __class__>", not as "<float 1.0>" > "<identifier __class_>", then, for consistency, you should also parse > the second line of > > s = 100 > prints > > as "<keyword print>" "<identifier s>", not as "<identifier prints>". > Since the latter is certainly undesirable, the former must be > followed for consistency. > > You easily derive the rule "a space is necessary between keyword > and identifier" from the second example; you should, for consistency, > also derive the rule "a space is necessary between an integer > literal and a dot". > > As for "list literals": The Python grammar calls them "displays", > not "literals", as they don't (necessarily) denote a literal value, > e.g. in [1,2,x,y+5]. > > Regards, > Martin >
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4