Lines 204-209
class Lexer:
Link Here
|
204 |
for statename, ef in self.lexstateeoff.items(): |
204 |
for statename, ef in self.lexstateeoff.items(): |
205 |
tabeof[statename] = ef.__name__ if ef else None |
205 |
tabeof[statename] = ef.__name__ if ef else None |
206 |
tf.write('_lexstateeoff = %s\n' % repr(tabeof)) |
206 |
tf.write('_lexstateeoff = %s\n' % repr(tabeof)) |
|
|
207 |
print(f">>> written into {filename}") |
207 |
|
208 |
|
208 |
# ------------------------------------------------------------ |
209 |
# ------------------------------------------------------------ |
209 |
# readtab() - Read lexer information from a tab file |
210 |
# readtab() - Read lexer information from a tab file |
Lines 862-867
class LexerReflect(object):
Link Here
|
862 |
# ----------------------------------------------------------------------------- |
863 |
# ----------------------------------------------------------------------------- |
863 |
def lex(module=None, object=None, debug=False, optimize=False, lextab='lextab', |
864 |
def lex(module=None, object=None, debug=False, optimize=False, lextab='lextab', |
864 |
reflags=int(re.VERBOSE), nowarn=False, outputdir=None, debuglog=None, errorlog=None): |
865 |
reflags=int(re.VERBOSE), nowarn=False, outputdir=None, debuglog=None, errorlog=None): |
|
|
866 |
print(">>> in ply.lex") |
865 |
|
867 |
|
866 |
if lextab is None: |
868 |
if lextab is None: |
867 |
lextab = 'lextab' |
869 |
lextab = 'lextab' |
Lines 910-915
def lex(module=None, object=None, debug=False, optimize=False, lextab='lextab',
Link Here
|
910 |
raise SyntaxError("Can't build lexer") |
912 |
raise SyntaxError("Can't build lexer") |
911 |
|
913 |
|
912 |
if optimize and lextab: |
914 |
if optimize and lextab: |
|
|
915 |
print(f">>> reading {lextab}") |
913 |
try: |
916 |
try: |
914 |
lexobj.readtab(lextab, ldict) |
917 |
lexobj.readtab(lextab, ldict) |
915 |
token = lexobj.token |
918 |
token = lexobj.token |
Lines 918-923
def lex(module=None, object=None, debug=False, optimize=False, lextab='lextab',
Link Here
|
918 |
return lexobj |
921 |
return lexobj |
919 |
|
922 |
|
920 |
except ImportError: |
923 |
except ImportError: |
|
|
924 |
print(">>> import failed") |
921 |
pass |
925 |
pass |
922 |
|
926 |
|
923 |
# Dump some basic debugging information |
927 |
# Dump some basic debugging information |
Lines 1040-1047
def lex(module=None, object=None, debug=False, optimize=False, lextab='lextab',
Link Here
|
1040 |
srcfile = getattr(sys.modules[pkgname], '__file__', '') |
1044 |
srcfile = getattr(sys.modules[pkgname], '__file__', '') |
1041 |
outputdir = os.path.dirname(srcfile) |
1045 |
outputdir = os.path.dirname(srcfile) |
1042 |
try: |
1046 |
try: |
|
|
1047 |
print(f">>> writing {lextab}") |
1043 |
lexobj.writetab(lextab, outputdir) |
1048 |
lexobj.writetab(lextab, outputdir) |
1044 |
except IOError as e: |
1049 |
except IOError as e: |
|
|
1050 |
print(f">>> failed: {e}") |
1045 |
errorlog.warning("Couldn't write lextab module %r. %s" % (lextab, e)) |
1051 |
errorlog.warning("Couldn't write lextab module %r. %s" % (lextab, e)) |
1046 |
|
1052 |
|
1047 |
return lexobj |
1053 |
return lexobj |