# Path: pingphp/helper.py
# def read(path):
#     result = ''
#     try:
#         file_ = open(path, 'rU')
#         result = file_.read()
#         if len(result) != 0 and result[-1] != '\n':
#             result += '\n'
#     except:
#         logging.error('Read file: ' + path + ' fail')
#     finally:
#         file_.close()
#     return result
# 
# Path: pingphp/lexer.py
# class PingLexer(object):
#     def __init__(self, inputStr):
#         lexer = lex.lex()
#         lexer.input(inputStr)
#         self.tokList = tokenList(lexer)
#         self.tokList = changeTokenList(self.tokList)
#         self.nowIndex = 0
# 
#     def token(self):
#         if self.nowIndex < len(self.tokList):
#             result = self.tokList[self.nowIndex]
#             self.nowIndex += 1
#             return result
# 
#     def __iter__(self):
#         return self
# 
#     def next(self):
#         t = self.token()
#         if t is None:
#             raise StopIteration
#         return t
# 
#     __next__ = next


import sys
from pingphp.helper import read
from pingphp.lexer import PingLexer
#!/usr/bin/env python


filename = './test/test/'

if len(sys.argv)>1:
    filename += sys.argv[1]
else:
    print('Please input filename!')
    exit(1)


# Path: pingphp/helper.py
# def read(path):
#     result = ''
#     try:
#         file_ = open(path, 'rU')
#         result = file_.read()
#         if len(result) != 0 and result[-1] != '\n':
#             result += '\n'
#     except:
#         logging.error('Read file: ' + path + ' fail')
#     finally:
#         file_.close()
#     return result
# 
# Path: pingphp/lexer.py
# class PingLexer(object):
#     def __init__(self, inputStr):
#         lexer = lex.lex()
#         lexer.input(inputStr)
#         self.tokList = tokenList(lexer)
#         self.tokList = changeTokenList(self.tokList)
#         self.nowIndex = 0
# 
#     def token(self):
#         if self.nowIndex < len(self.tokList):
#             result = self.tokList[self.nowIndex]
#             self.nowIndex += 1
#             return result
# 
#     def __iter__(self):
#         return self
# 
#     def next(self):
#         t = self.token()
#         if t is None:
#             raise StopIteration
#         return t
# 
#     __next__ = next


# Path: testlexer.py
import sys
from pingphp.helper import read
from pingphp.lexer import PingLexer

#!/usr/bin/env python


filename = './test/test/'

if len(sys.argv)>1:
    filename += sys.argv[1]
else:
    print('Please input filename!')
    exit(1)


lexer = PingLexer(read(filename))