Elektra  0.8.24
Plugin: yanlr

Yan LR

Introduction

This plugin uses ANTLR to generate a parser for the YAML serialization format. Apart from the hand written lexer, all other parts of the plugin use standard ANTLR tools, such as

Examples

Mappings

`` <h1>Mount plugin to cascading namespace/tests/yanlr` sudo kdb mount config.yaml user/tests/yanlr yanlr

Manually add some mappings to the configuration file

printf 'all : circles presuppose
' > kdb file user/tests/yanlr printf 'hello : world
' >> kdb file user/tests/yanlr

kdb ls /tests/yanlr #> user/tests/yanlr/all #> user/tests/yanlr/hello

kdb get user/tests/yanlr/all #> circles presuppose

Add new key-value pairs

Yan LR actually uses the YAML Smith plugin to write data

kdb set /tests/yanlr/brand new kdb set /tests/yanlr/brand/new eyes kdb set /tests/yanlr/dance/gavin 'Dance!'

kdb ls /tests/yanlr #> user/tests/yanlr/all #> user/tests/yanlr/brand #> user/tests/yanlr/brand/new #> user/tests/yanlr/dance/gavin #> user/tests/yanlr/hello

kdb get /tests/yanlr/hello #> world kdb get user/tests/yanlr/brand #> new kdb get /tests/yanlr/dance/gavin #> Dance!

Undo modifications to the key database

kdb rm -r user/tests/yanlr sudo kdb umount user/tests/yanlr

### Arrays

Mount plugin to cascading namespace /tests/yanlr

sudo kdb mount config.yaml user/tests/yanlr yanlr

Manually add a sequences to the configuration file

printf 'primes:
' > kdb file user/tests/yanlr printf ' - two
' >> kdb file user/tests/yanlr printf ' - three
' >> kdb file user/tests/yanlr printf ' - five
' >> kdb file user/tests/yanlr

kdb ls user/tests/yanlr #> user/tests/yanlr/primes #> user/tests/yanlr/primes/#0 #> user/tests/yanlr/primes/#1 #> user/tests/yanlr/primes/#2

kdb set user/tests/yanlr/primes/#3 seven

Retrieve index of last array element

kdb getmeta user/tests/yanlr/primes array #> #3

Undo modifications to the key database

kdb rm -r user/tests/yanlr sudo kdb umount user/tests/yanlr ```

Limitations

Comments

The lexer does currently tokenize comments. Consequently the plugin grammar of the plugin does also match comments. However, the listener does currently ignore comments.