summaryrefslogtreecommitdiff
path: root/tests/lex_re3.py
blob: 8f594f37ef534dc3c7ea8cf19c34a9943d0a7863 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# lex_re3.py
#
# Regular expression rule matches empty string

import ply.lex as lex

tokens = [
    "PLUS",
    "MINUS",
    "NUMBER",
    "POUND",
    ]

t_PLUS = r'\+'
t_MINUS = r'-'
t_NUMBER = r'(\d+)'
t_POUND = r'#'

def t_error(t):
    pass



lex.lex()