summaryrefslogtreecommitdiff
path: root/ply/lex.py
diff options
context:
space:
mode:
authorDavid Beazley <dave@dabeaz.com>2016-08-30 12:36:55 -0500
committerDavid Beazley <dave@dabeaz.com>2016-08-30 12:36:55 -0500
commitd55082d66c46cb58061617312a0507dbcde51055 (patch)
tree1a6d3461deae4638eaf0ea32f9e26a24ecbedf38 /ply/lex.py
parent40dbd98451aaead653d1282ed88c8bd67b870dbd (diff)
downloadply-d55082d66c46cb58061617312a0507dbcde51055.tar.gz
Fixed Issue #97. Validation of files when original .py file isn't present.
Diffstat (limited to 'ply/lex.py')
-rw-r--r--ply/lex.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/ply/lex.py b/ply/lex.py
index c45b8a0..842f05d 100644
--- a/ply/lex.py
+++ b/ply/lex.py
@@ -830,7 +830,10 @@ class LexerReflect(object):
# -----------------------------------------------------------------------------
def validate_module(self, module):
- lines, linen = inspect.getsourcelines(module)
+ try:
+ lines, linen = inspect.getsourcelines(module)
+ except IOError:
+ return
fre = re.compile(r'\s*def\s+(t_[a-zA-Z_0-9]*)\(')
sre = re.compile(r'\s*(t_[a-zA-Z_0-9]*)\s*=')