How to use the ply.lex.lexer function in ply

To help you get started, we’ve selected a few ply examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github facebook / openbmc / common / recipes-core / fscd3 / fscd_test / ply / cpp.py View on Github external
def __init__(self, lexer=None):
        if lexer is None:
            lexer = lex.lexer
        self.lexer = lexer
        self.macros = {}
        self.path = []
        self.temp_path = []

        # Probe the lexer for selected tokens
        self.lexprobe()

        tm = time.localtime()
        self.define('__DATE__ "%s"' % time.strftime("%b %d %Y", tm))
        self.define('__TIME__ "%s"' % time.strftime("%H:%M:%S", tm))
        self.parser = None
github cosmonium / cosmonium / third-party / ply / cpp.py View on Github external
def __init__(self,lexer=None):
        if lexer is None:
            lexer = lex.lexer
        self.lexer = lexer
        self.macros = { }
        self.path = []
        self.temp_path = []

        # Probe the lexer for selected tokens
        self.lexprobe()

        tm = time.localtime()
        self.define("__DATE__ \"%s\"" % time.strftime("%b %d %Y",tm))
        self.define("__TIME__ \"%s\"" % time.strftime("%H:%M:%S",tm))
        self.parser = None
github Samsung / veles / veles / cpp.py View on Github external
def __init__(self, lexer=None):
        if lexer is None:
            lexer = lex.lexer
        self.lexer = lexer
        self.macros = { }
        self.path = []
        self.temp_path = []

        # Probe the lexer for selected tokens
        self.lexprobe()

        tm = time.localtime()
        self.define("__DATE__ \"%s\"" % time.strftime("%b %d %Y", tm))
        self.define("__TIME__ \"%s\"" % time.strftime("%H:%M:%S", tm))
        self.parser = None
github dabeaz / ply / ply / cpp.py View on Github external
def __init__(self,lexer=None):
        if lexer is None:
            lexer = lex.lexer
        self.lexer = lexer
        self.macros = { }
        self.path = []
        self.temp_path = []

        # Probe the lexer for selected tokens
        self.lexprobe()

        tm = time.localtime()
        self.define("__DATE__ \"%s\"" % time.strftime("%b %d %Y",tm))
        self.define("__TIME__ \"%s\"" % time.strftime("%H:%M:%S",tm))
        self.parser = None
github gnachman / iTerm2 / tools / ply / ply-3.4 / ply / cpp.py View on Github external
def __init__(self,lexer=None):
        if lexer is None:
            lexer = lex.lexer
        self.lexer = lexer
        self.macros = { }
        self.path = []
        self.temp_path = []

        # Probe the lexer for selected tokens
        self.lexprobe()

        tm = time.localtime()
        self.define("__DATE__ \"%s\"" % time.strftime("%b %d %Y",tm))
        self.define("__TIME__ \"%s\"" % time.strftime("%H:%M:%S",tm))
        self.parser = None
github astropy / astropy / astropy / extern / ply / cpp.py View on Github external
def __init__(self,lexer=None):
        if lexer is None:
            lexer = lex.lexer
        self.lexer = lexer
        self.macros = { }
        self.path = []
        self.temp_path = []

        # Probe the lexer for selected tokens
        self.lexprobe()

        tm = time.localtime()
        self.define("__DATE__ \"%s\"" % time.strftime("%b %d %Y",tm))
        self.define("__TIME__ \"%s\"" % time.strftime("%H:%M:%S",tm))
        self.parser = None
github nardo / torque_sockets / products / nixysa / ply / cpp.py View on Github external
def __init__(self,lexer=None):
        if lexer is None:
            lexer = lex.lexer
        self.lexer = lexer
        self.macros = { }
        self.path = []
        self.temp_path = []

        # Probe the lexer for selected tokens
        self.lexprobe()

        tm = time.localtime()
        self.define("__DATE__ \"%s\"" % time.strftime("%b %d %Y",tm))
        self.define("__TIME__ \"%s\"" % time.strftime("%H:%M:%S",tm))
        self.parser = None
github nojanath / SublimeKSP / ksp_compiler3 / ksp_parser.py View on Github external
def parse(script_code):
    lex.lexer.lineno = 0
    lex.lexer.filename = 'current file'  # filepath
    data = script_code.replace('\r', '')
    result = parser.parse(data, tracking=True)
    return result
github Zeex / sampgdk / lib / python / ply / ply / cpp.py View on Github external
def __init__(self,lexer=None):
        if lexer is None:
            lexer = lex.lexer
        self.lexer = lexer
        self.macros = { }
        self.path = []
        self.temp_path = []

        # Probe the lexer for selected tokens
        self.lexprobe()

        tm = time.localtime()
        self.define("__DATE__ \"%s\"" % time.strftime("%b %d %Y",tm))
        self.define("__TIME__ \"%s\"" % time.strftime("%H:%M:%S",tm))
        self.parser = None
github gem5 / gem5 / src / mem / slicc / parser / parser.py View on Github external
def scan(filenames):
    hh = slicc_generated_hh.copy()
    cc = slicc_generated_cc.copy()

    for filename in filenames:
        lex.lexer.lineno = 1
        try:
            print "parsing ",filename
            results = yacc.parse(file(filename, 'r').read())
        except (ParseError,TokenError), e:
            print "File ",filename," ",e
            raise e
        #except ParseError, e:
        #    print "File ",filename," "e
        #    raise e, tuple([filename] + [ i for i in e ])

        #except ParseError, e:
        #    print e

            
        for result in results:
            result.add(hh, cc)