Skip to content

Include directive issue #20

@pevsonic

Description

@pevsonic

I've got some config files to define lots of different configurable items (its a big protocol message set) that work as follows :

item-defs.cfg :

item-defs: (
@include "items/item1.cfg",
@include "items/item2.cfg",
# ...
@include "items/item150.cfg"
);

items/item1.cfg :

{
    item-def = {
        # ...
    };
},

items/item150.cfg :

{
    item-def = {
        # ...
    };
},

etc...

These work fine via libconfig but using libconf I get an error such as :

    item_defs.config = libconf.load(f)
  File "/home/pev/.local/lib/python3.7/site-packages/libconf.py", line 497, in load
    includedir=includedir)
  File "/home/pev/.local/lib/python3.7/site-packages/libconf.py", line 251, in from_file
    tokens.extend(tokenizer.tokenize(''.join(lines)))
  File "/home/pev/.local/lib/python3.7/site-packages/libconf.py", line 206, in tokenize
    string[pos:pos+20]))
libconf.ConfigParseError: Couldn't load config in 'item-defs.cfg' row 10, column 1: '@include "item-defs/'

Looking in the source this appears to be a limitation with the Tokeniser but there should be a way around it somehow. Can you advise on any approach for a workaround?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions