Exemple #1
0
def find_programHeader(s, stripcomments=False):
    pFileHeader = parse_source.get_pFileHeader()

    if stripcomments:
        s = parse_source.transStripComments(s)

    for item in pFileHeader.scanString(s):
        toks, _, _ = item
        # return, only one instance of a header in a file
        return (toks[0], toks[1])
Exemple #2
0
def findAbstractImports(s, parser, stripcomments=False):
    if stripcomments:
        s = parse_source.transStripComments(s)

    units = []
    for item in parser.scanString(s):
        toks, _, _ = item
        for unititem in toks:
            name, filename = None, None
            try:
                name = unititem[0]
                filename = unititem[1]
            except IndexError:
                pass
            unit = filename or name + '.pas'
            units.append(unit)
    units = util.uniq(units)
    return units
Exemple #3
0
def find_stripCommentsKeepAllDirectives(s, stripcomments=False):
    s = parse_source.transStripComments(s, keep_directives=True,
                                        keep_all_directives=True)
    return s
Exemple #4
0
def find_stripComments(s, stripcomments=False):
    s = parse_source.transStripComments(s)
    return s