Skip to content

Commit

Permalink
Handle spaces in filenames for .include #150
Browse files Browse the repository at this point in the history
  • Loading branch information
mph- committed Nov 16, 2024
1 parent 8d57f7c commit be0a1fb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lcapy/netfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,15 @@ def _make_anon_node_name(self):

def _include(self, string):

parts = string.split(' ')
if len(parts) < 2 or parts[0] != '.include':
from re import match

pattern = r'(\.include)\s+(.+?)\s+(as)\s+(\w+)'
matches = match(pattern, string)
if matches:
parts = list(matches.groups())
else:
raise ValueError('Expecting include filename in %s' % string)

filename = parts[1]
if len(parts) == 2:
return self._netfile_add(filename, self.namespace)
Expand Down

0 comments on commit be0a1fb

Please sign in to comment.