Commit 123870f4 authored by Raymond Hettinger's avatar Raymond Hettinger

Further beautification of the example

parent 70b134a7
...@@ -1331,12 +1331,15 @@ successive matches:: ...@@ -1331,12 +1331,15 @@ successive matches::
if pos != len(s): if pos != len(s):
raise RuntimeError('Unexpected character %r on line %d' %(s[pos], line)) raise RuntimeError('Unexpected character %r on line %d' %(s[pos], line))
>>> statements = '''\ statements = '''\
total := total + price * quantity; total := total + price * quantity;
tax := price * 0.05; tax := price * 0.05;
''' '''
>>> for token in tokenize(statements):
print(token) for token in tokenize(statements):
print(token)
The tokenizer produces the following output::
Token(typ='ID', value='total', line=1, column=8) Token(typ='ID', value='total', line=1, column=8)
Token(typ='ASSIGN', value=':=', line=1, column=14) Token(typ='ASSIGN', value=':=', line=1, column=14)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment