diff --git a/lcapy/netfile.py b/lcapy/netfile.py index f5163654..457056c7 100644 --- a/lcapy/netfile.py +++ b/lcapy/netfile.py @@ -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)