示例#1
0
def parse(filepath):
    import os
    content = filepath
    if os.path.isfile(filepath):
        content = util.read(filepath)
    parser = Parser()
    return parser.parse_with_rule(None, content)
示例#2
0
文件: parser.py 项目: y372465774/luna
    def __init__(self):
        dir = os.path.dirname(os.path.abspath(__file__))
        fp = os.path.join(dir, 'grammar.txt')
        content = util.read(fp)

        self.grammar = Grammar(content)
        self.builder = AstBuilder()
示例#3
0
def parse(filepath):
    import os
    content = filepath
    if os.path.isfile(filepath):
        content = util.read(filepath)
    parser = Parser()
    return parser.parse_with_rule(None, content)
示例#4
0
 def do(filepath):
     base = join(dirname(dirname(__file__)), 'programs')
     fp = join(base, filepath)
     content = util.read(fp)
     return content
示例#5
0
 def do(filepath):
     base = join(dirname(dirname(__file__)), 'programs')
     fp = join(base, filepath)
     content = util.read(fp)
     return content