annotate ply-3.8/test/lex_token2.py @ 9554:23f43464694e

<Zarutian> le/rn Frams\xc3\xb3knarflokkurinn/A, now defunct, political party in Iceland. Like its sister party Sj\xc3\xa1lfst\xc3\xa6\xc3\xb0isflokkurinn it is named by the antonym of what it is. (The name means the Progressive Party but they have nearly always been highly regressive). Think dumb Hill-Billies in ill fitting suits and you get their constiuents.
author HackBot
date Sun, 30 Oct 2016 14:33:24 +0000
parents 343ff337a19b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7267
343ff337a19b <ais523> ` tar -xf ply-3.8.tar.gz
HackBot
parents:
diff changeset
1 # lex_token2.py
343ff337a19b <ais523> ` tar -xf ply-3.8.tar.gz
HackBot
parents:
diff changeset
2 #
343ff337a19b <ais523> ` tar -xf ply-3.8.tar.gz
HackBot
parents:
diff changeset
3 # Tests for tokens of wrong type
343ff337a19b <ais523> ` tar -xf ply-3.8.tar.gz
HackBot
parents:
diff changeset
4
343ff337a19b <ais523> ` tar -xf ply-3.8.tar.gz
HackBot
parents:
diff changeset
5 import sys
343ff337a19b <ais523> ` tar -xf ply-3.8.tar.gz
HackBot
parents:
diff changeset
6 if ".." not in sys.path: sys.path.insert(0,"..")
343ff337a19b <ais523> ` tar -xf ply-3.8.tar.gz
HackBot
parents:
diff changeset
7
343ff337a19b <ais523> ` tar -xf ply-3.8.tar.gz
HackBot
parents:
diff changeset
8 import ply.lex as lex
343ff337a19b <ais523> ` tar -xf ply-3.8.tar.gz
HackBot
parents:
diff changeset
9
343ff337a19b <ais523> ` tar -xf ply-3.8.tar.gz
HackBot
parents:
diff changeset
10 tokens = "PLUS MINUS NUMBER"
343ff337a19b <ais523> ` tar -xf ply-3.8.tar.gz
HackBot
parents:
diff changeset
11
343ff337a19b <ais523> ` tar -xf ply-3.8.tar.gz
HackBot
parents:
diff changeset
12 t_PLUS = r'\+'
343ff337a19b <ais523> ` tar -xf ply-3.8.tar.gz
HackBot
parents:
diff changeset
13 t_MINUS = r'-'
343ff337a19b <ais523> ` tar -xf ply-3.8.tar.gz
HackBot
parents:
diff changeset
14 t_NUMBER = r'\d+'
343ff337a19b <ais523> ` tar -xf ply-3.8.tar.gz
HackBot
parents:
diff changeset
15
343ff337a19b <ais523> ` tar -xf ply-3.8.tar.gz
HackBot
parents:
diff changeset
16 def t_error(t):
343ff337a19b <ais523> ` tar -xf ply-3.8.tar.gz
HackBot
parents:
diff changeset
17 pass
343ff337a19b <ais523> ` tar -xf ply-3.8.tar.gz
HackBot
parents:
diff changeset
18
343ff337a19b <ais523> ` tar -xf ply-3.8.tar.gz
HackBot
parents:
diff changeset
19
343ff337a19b <ais523> ` tar -xf ply-3.8.tar.gz
HackBot
parents:
diff changeset
20 lex.lex()
343ff337a19b <ais523> ` tar -xf ply-3.8.tar.gz
HackBot
parents:
diff changeset
21
343ff337a19b <ais523> ` tar -xf ply-3.8.tar.gz
HackBot
parents:
diff changeset
22