Commit 6a6e62fa authored by Taddeus Kroes's avatar Taddeus Kroes

Fixed multi-line regex.

parent 53fe3c91
......@@ -38,13 +38,15 @@ def separate_imports(content):
imports = []
filename = '[a-zA-Z0-9\._-]+'
comma = re.compile(' *, *(?:\\\\\r?\n *)?')
comma = re.compile(' *, *(?:\\\\\r?\n *)?', re.M)
file_list = '%s(?:%s%s?)*' % (filename, comma.pattern, filename)
m = re.match('^import (%s)(?:(?:\r?\n)+(.*))?$' % file_list, content, re.M)
m = re.match('^import (%s)(?:(?:\r?\n)+((?:.|\n)*))?$' % file_list,
content, re.M)
if m:
imports = comma.split(m.group(1))
content = m.group(2)
print 'groups:', m.groups()
if not content:
content = ''
......@@ -136,6 +138,9 @@ class Importer(Cache):
# Parse imports from file content
imports, content = separate_imports(raw)
if imports:
print 'imports:', imports
print 'content:', content
self.import_map.update({path: imports})
# Only add imported files that have not been loaded yet
......@@ -159,7 +164,7 @@ class Importer(Cache):
#concat += self.concatenate(new_imports, path)
concat += content
self.loaded += path
self.loaded.append(path)
return concat
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment