<reponame>nmusatti/nxpy
# nxpy_ply --------------------------------------------------------------------

# Copyright <NAME> 2010 - 2018
# Use, modification, and distribution are subject to the Boost Software
# License, Version 1.0. (See accompanying file LICENSE.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)

# See https://github.com/nmusatti/nxpy/tree/master/libs/ply. ------------------

r"""
Class wrapper for PLY's lex module.

"""

from __future__ import absolute_import

import re

import ply.lex


class Scanner(object):
    def __init__(self, debug=False, ignorecase=False):
        self.debug = debug
        reflags = 0
        if ignorecase:
            reflags = re.IGNORECASE 
        self.lexer = ply.lex.lex(module=self, debug=self.debug, reflags=reflags)

    def reset(self, input_):
        self.lexer.input(input_)
    
    def token(self):
        return self.lexer.token()

# nxpy_ply --------------------------------------------------------------------

# Copyright <NAME> 2010 - 2018
# Use, modification, and distribution are subject to the Boost Software
# License, Version 1.0. (See accompanying file LICENSE.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)

# See https://github.com/nmusatti/nxpy/tree/master/libs/ply. ------------------

r"""
Class wrapper for PLY's lex module.

"""

from __future__ import absolute_import

import re

import ply.lex


class Scanner(object):
    def __init__(self, debug=False, ignorecase=False):
        self.debug = debug
        reflags = 0
        if ignorecase:
            reflags = re.IGNORECASE 
        self.lexer = ply.lex.lex(module=self, debug=self.debug, reflags=reflags)

    def reset(self, input_):
        self.lexer.input(input_)
    
    def token(self):
        return self.lexer.token()
# nxpy_ply -------------------------------------------------------------------- # Copyright <NAME> 2010 - 2018 # Use, modification, and distribution are subject to the Boost Software # License, Version 1.0. (See accompanying file LICENSE.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) # See https://github.com/nmusatti/nxpy/tree/master/libs/ply. ------------------ Class wrapper for PLY's lex module.