Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: tools/nixysa/third_party/ply-3.1/test/lex_module_import.py

Issue 2043006: WTF NPAPI extension. Early draft. Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 # -----------------------------------------------------------------------------
2 # lex_module_import.py
3 #
4 # A lexer defined in a module, but built in lex_module.py
5 # -----------------------------------------------------------------------------
6
7 tokens = (
8 'NAME','NUMBER',
9 'PLUS','MINUS','TIMES','DIVIDE','EQUALS',
10 'LPAREN','RPAREN',
11 )
12
13 # Tokens
14
15 t_PLUS = r'\+'
16 t_MINUS = r'-'
17 t_TIMES = r'\*'
18 t_DIVIDE = r'/'
19 t_EQUALS = r'='
20 t_LPAREN = r'\('
21 t_RPAREN = r'\)'
22 t_NAME = r'[a-zA-Z_][a-zA-Z0-9_]*'
23
24 def t_NUMBER(t):
25 r'\d+'
26 try:
27 t.value = int(t.value)
28 except ValueError:
29 print("Integer value too large %s" % t.value)
30 t.value = 0
31 return t
32
33 t_ignore = " \t"
34
35 def t_newline(t):
36 r'\n+'
37 t.lineno += t.value.count("\n")
38
39 def t_error(t):
40 print("Illegal character '%s'" % t.value[0])
41 t.lexer.skip(1)
42
OLDNEW
« no previous file with comments | « tools/nixysa/third_party/ply-3.1/test/lex_module.py ('k') | tools/nixysa/third_party/ply-3.1/test/lex_object.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698