miker2 / flexi_config_reader

A flexible configuration format that supports templated tables and referencing of existing keys.
MIT License
3 stars 1 forks source link

Config file that ends in a `proto` results in a parse error (despite successful parsing) #137

Open michael-projectx opened 5 months ago

michael-projectx commented 5 months ago

minimal example:

reference p as q {
    $A = 1
}

proto p {
    q = $A
}

If the order of the reference and proto are swapped, the parse error goes away. The following does not produce the error:

proto p {
    q = 1
}

But just this does:

proto p {
    q = $A
}
michael-projectx commented 5 months ago

Debug note: The parser is failing because the $A object is not being fully consumed during the action step. There is a check on line 43 of config_parser.cpp that checks if the cfg_res object is null, and the $A object is still there. Commenting out that line results in a success and the config_build app successfully prints the correct config result. More debugging required.

michael-projectx commented 5 months ago

See: https://github.com/miker2/flexi_config_reader/pull/138

This partially addresses the issue. Architecturally there are bigger issues that need addressing to avoid the workaround provide by #138