~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to third_party/ply/test/lex_many_tokens.py

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-02 13:11:51 UTC
  • Revision ID: package-import@ubuntu.com-20130502131151-q8dvteqr1ef2x7xz
Tags: upstream-1.4.1~20130504~adb56cb
ImportĀ upstreamĀ versionĀ 1.4.1~20130504~adb56cb

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# lex_many_tokens.py
 
2
#
 
3
# Test lex's ability to handle a large number of tokens (beyond the
 
4
# 100-group limit of the re module)
 
5
 
 
6
import sys
 
7
if ".." not in sys.path: sys.path.insert(0,"..")
 
8
 
 
9
import ply.lex as lex
 
10
 
 
11
tokens = ["TOK%d" % i for i in range(1000)]
 
12
 
 
13
for tok in tokens:
 
14
    if sys.version_info[0] < 3:
 
15
        exec("t_%s = '%s:'" % (tok,tok))
 
16
    else:
 
17
        exec("t_%s = '%s:'" % (tok,tok), globals())
 
18
 
 
19
t_ignore = " \t"
 
20
 
 
21
def t_error(t):
 
22
    pass
 
23
 
 
24
lex.lex(optimize=1,lextab="manytab")
 
25
lex.runmain(data="TOK34: TOK143: TOK269: TOK372: TOK452: TOK561: TOK999:")
 
26
 
 
27