Commit graph

31 commits

Author SHA1 Message Date
Daniel Eklöf
3431d5fc75
yml: replace_env_variables(): const:ify function variables 2024-06-09 10:05:21 +02:00
Tomas Slusny
20659d3350 Add support for environment variable references
The format is
key: ${env_variable}

Closes #96

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
2024-06-09 01:11:34 +02:00
Delgan
b85ba99980 Apply "clang-format" preferences globally 2024-04-07 10:05:10 +02:00
Daniel Eklöf
971361b046
yaml: keep original value when anchor and target node both defines the same key
When merging an anchor into a target yaml node, and both the target
node and the anchor defines the same key(s), keep the value from the
target node.

Closes #286
2023-04-09 09:27:31 +02:00
Ogromny
f5cfc103d0
modules/dwl: new module 2022-12-13 15:56:16 +01:00
Jan Beich
03476e9360 yml: silence unused variable warning with Clang 13
yml.c:383:9: error: variable 'indent' set but not used [-Werror,-Wunused-but-set-variable]
    int indent = 0;
        ^
2021-10-03 23:40:23 +00:00
Daniel Eklöf
98a4789e26
yml: don’t crash when (trying to) merge anchors that aren’t dictionaries
Up until now, we only asserted the value being merged in was a
dictionary.

Now we do a proper check and return a real error message instead.

Closes #32
2021-02-11 19:02:14 +01:00
Daniel Eklöf
9cf00f8200
codespell: spelling fixes 2020-12-25 12:31:20 +01:00
Daniel Eklöf
eceee99fb0
yml: don’t overwrite errors from yml_parser_parse()
When we detect an error in yml_parser_parse(), we handle that
specifically, and then jump to the generic error handler.

The generic error handler overwrites the previously formatted error
before cleaning up and returning.

This meant that a) the actual error message was lost, and replaced
with a generic “unknown error”, and b) the dynamically allocated error
string buffer was leaked.
2020-09-24 13:38:56 +02:00
Daniel Eklöf
3c9a08bf7f
yml: destroy 'current' yaml event before erroring out 2020-01-15 11:06:54 +01:00
Daniel Eklöf
1a7b00054f
yml: fix crash when referencing a nonn-existent anchor 2020-01-15 11:03:40 +01:00
Daniel Eklöf
0550d2799d
tllist: use tllist from external git repository 2019-11-17 19:17:34 +01:00
Daniel Eklöf
5ace4d77c7 yml: handle root's node being NULL 2019-04-29 18:49:44 +02:00
Daniel Eklöf
6622616ec7 yml: post-process: root's node may be NULL (empty configuration) 2019-04-29 18:47:46 +02:00
Daniel Eklöf
d922bc572f yml: add line/column info to every node 2019-01-11 23:20:06 +01:00
Daniel Eklöf
f0cc0b4383 yml: initialize return value, fixes gcc warning (-O3 -Wall) 2019-01-07 18:26:29 +01:00
Daniel Eklöf
aa38063e37 wip: verify configuration
We now verify the configuration (currently down to module level, but
not including particles) that are present are of the expected type.
2019-01-06 20:04:01 +01:00
Daniel Eklöf
cba97a0e65 yml: remove commented out (old) code 2019-01-02 12:32:19 +01:00
Daniel Eklöf
2977af835c yml: add TODO to handle duplicate keys when merging dictionaries 2019-01-02 12:14:23 +01:00
Daniel Eklöf
91fa8a0217 yml: cleanup 2019-01-02 12:09:42 +01:00
Daniel Eklöf
305058deab yml: detect (and report to user) duplicate keys in dictionaries 2019-01-02 12:08:41 +01:00
Daniel Eklöf
b13305526a yml: apparently, libyaml's line number in the error context is 0 based
Which makes zero sense when reporting the error to the user.
2019-01-01 23:27:54 +01:00
Daniel Eklöf
5abd825137 yml: yml_load(): optionally allocates an error string (on error) 2019-01-01 23:25:36 +01:00
Daniel Eklöf
3dc7d0e39d yml: yml_destroy(): return immediately if node is NULL
This can happen for example when destroying a partially created
dictionary entry, where only the key node has been created.
2019-01-01 23:24:27 +01:00
Daniel Eklöf
9351d3b6d9 yml: yml_value_as_bool(): return false if value didn't match any known values 2019-01-01 20:32:12 +01:00
Daniel Eklöf
b2082e38ed yml: support multiple merge values
This adds support for merging multiple values, using a list of
dictionaries:

    foo:
      <<: [*foo, *bar]
2018-12-29 16:06:04 +01:00
Daniel Eklöf
0e3dd72313 yml: bump anchor vector size 2018-12-26 15:31:37 +01:00
Daniel Eklöf
f1f3190767 yml: don't print out final node(s) 2018-12-17 20:26:02 +01:00
Daniel Eklöf
40e6af2e2e yml: use tllists to represent dictionaries and lists 2018-12-15 12:52:12 +01:00
Daniel Eklöf
4e2f578518 yml: implement alias and '<<' expansion 2018-12-13 19:05:52 +01:00
Daniel Eklöf
8bf8a398b9 initial commit: wip 2018-11-17 11:30:33 +01:00