Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def scanner(debug=False):
if debug:
logger = lex.PlyLogger(sys.stderr)
else:
logger = lex.NullLogger()
tab = "llvm_p86._p86_lextab"
mod = sys.modules[__name__]
return lex.lex(debuglog=logger,
errorlog=logger,
optimize=1,
lextab=tab,
outputdir=os.path.dirname(__file__),
module=mod)
def __init__(self):
self.lex = lex.lex(
module=self,
debug=False,
reflags=(re.UNICODE | re.MULTILINE),
errorlog=lex.NullLogger(),
)
def t_NATIVEQUOTE(t):
r'<<<[\s\S]*?>>>'
t.lexer.lineno += sum(1 for c in t.value if c == '\n')
t.type = reserved.get(t.value,'NATIVEQUOTE')
return t
class TokenErrorNode(object):
def __init__(self,token):
self.lineno = iu.Location(iu.filename,token.lineno)
def t_error(t):
raise iu.IvyError(TokenErrorNode(t),"illegal character '{}'".format(t.value[0]))
print "Illegal character '%s'" % t.value[0]
lexer = lex.lex(errorlog=lex.NullLogger())
class LexerVersion(object):
""" Context Manager that sets the lexer based on the given language version
"""
def __init__(self,version):
self.version = version
def __enter__(self):
global reserved
self.orig_reserved = reserved
reserved = dict(all_reserved)
# print "version {}".format(self.version)
if self.version <= [1,0]:
for s in ['state','local']:
# print "deleting {}".format(s)
del reserved[s]
if self.version <= [1,1]:
def scanner(debug=False):
if debug:
logger = lex.PlyLogger(sys.stderr)
else:
logger = lex.NullLogger()
tab = "llvm_p86._p86pre_lextab"
mod = sys.modules[__name__]
return lex.lex(debuglog=logger,
errorlog=logger,
optimize=1,
lextab=tab,
outputdir=os.path.dirname(__file__),
module=mod)
def build(self, pattern, **kwargs):
"""
Create a lexer.
"""
self.lexer = lex.lex(module=self, errorlog=lex.NullLogger(), **kwargs) #
self.lexer.input(pattern)
self.storeLexTokenList()