
\begin{DoxyItemize}
\item infos = Information about the yanlr plugin is in keys below
\item infos/author = René Schwaiger \href{mailto:sanssecours@me.com}{\tt sanssecours@me.\+com}
\item infos/licence = B\+SD
\item infos/needs = directoryvalue yamlsmith
\item infos/provides = storage/yaml
\item infos/recommends =
\item infos/placements = getstorage
\item infos/status = maintained unittest preview experimental unfinished nodoc concept discouraged
\item infos/metadata =
\item infos/description = This storage plugin use a parser generated by A\+N\+T\+LR to read Y\+A\+ML files
\end{DoxyItemize}\hypertarget{md_src_plugins_yanlr_README_src_plugins_yanlr_README_md}{}\section{Yan LR}\label{md_src_plugins_yanlr_README_src_plugins_yanlr_README_md}
\subsection*{Introduction}

This plugin uses A\+N\+T\+LR to generate a parser for the \href{http://yaml.org}{\tt Y\+A\+ML} serialization format. Apart from the hand written \href{/home/markus/Projekte/Elektra/current/src/plugins/yanlr/yaml_lexer.cpp}{\tt lexer}, all other parts of the plugin use standard A\+N\+T\+LR tools, such as


\begin{DoxyItemize}
\item an A\+N\+T\+LR parser grammar,
\item a \href{/home/markus/Projekte/Elektra/current/src/plugins/yanlr/listener.cpp}{\tt listener}, that reacts to matches in the grammar building a key set, and
\item an \href{/home/markus/Projekte/Elektra/current/src/plugins/yanlr/error_listener.cpp}{\tt error listener} that reacts to syntax errors
\end{DoxyItemize}

\subsection*{Examples}

\subsubsection*{Mappings}

``{\ttfamily  $<$h1$>$Mount plugin to namespace}user/tests/yanlr` sudo kdb mount config.\+yaml user/tests/yanlr yanlr

\section*{Manually add some mappings to the configuration file}

printf \textquotesingle{}all \+: circles presuppose~\newline
\textquotesingle{} $>$ {\ttfamily kdb file user/tests/yanlr} printf \textquotesingle{}hello \+: world~\newline
\textquotesingle{} $>$$>$ {\ttfamily 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

\section*{Store value at root of mountpoint}

kdb set user/tests/yanlr \textquotesingle{}Mount Eerie\textquotesingle{} kdb get user/tests/yanlr \#$>$ Mount Eerie

\section*{Add new key-\/value pairs}

\section*{Yan LR actually uses the Y\+A\+ML Smith plugin to write data}

kdb set /tests/yanlr/brand new kdb set /tests/yanlr/brand/new eyes kdb set /tests/yanlr/dance/gavin \textquotesingle{}Dance!\textquotesingle{}

kdb ls /tests/yanlr \#$>$ user/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!

\section*{Undo modifications to the key database}

kdb rm -\/r user/tests/yanlr sudo kdb umount user/tests/yanlr 
\begin{DoxyCode}
### Arrays
\end{DoxyCode}
 \section*{Mount plugin to cascading namespace {\ttfamily /tests/yanlr}}

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

\section*{Manually add a sequences to the configuration file}

printf \textquotesingle{}primes\+:~\newline
\textquotesingle{} $>$ {\ttfamily kdb file user/tests/yanlr} printf \textquotesingle{} -\/ two~\newline
\textquotesingle{} $>$$>$ {\ttfamily kdb file user/tests/yanlr} printf \textquotesingle{} -\/ three~\newline
\textquotesingle{} $>$$>$ {\ttfamily kdb file user/tests/yanlr} printf \textquotesingle{} -\/ five~\newline
\textquotesingle{} $>$$>$ {\ttfamily 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

\section*{Retrieve index of last array element}

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

\section*{Undo modifications to the key database}

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

\subsection*{Limitations}


\begin{DoxyItemize}
\item The plugin does {\bfseries not support}
\begin{DoxyItemize}
\item plain scalars that span {\bfseries multiple lines},
\item {\bfseries special characters} inside double quoted scalars,
\item other {\bfseries line endings} than {\ttfamily \textbackslash{}n} (Unix line endings),
\item {\bfseries block scalars},
\item {\bfseries flow collections},
\item {\bfseries tags},
\item {\bfseries anchors \& aliases},
\item {\bfseries multiple documents}, and
\item document {\bfseries start and end markers}
\end{DoxyItemize}
\item Yan LR does not provide write support for data. Please use the \hyperlink{md_src_plugins_yamlsmith_README_src_plugins_yamlsmith_README_md}{Y\+A\+ML Smith} plugin for that purpose.
\end{DoxyItemize}

\subsubsection*{Comments}

The \href{/home/markus/Projekte/Elektra/current/src/plugins/yanlr/yaml_lexer.cpp}{\tt lexer} does currently tokenize comments. Consequently the plugin grammar of the plugin does also match comments. However, the \href{/home/markus/Projekte/Elektra/current/src/plugins/yanlr/listener.cpp}{\tt listener} does currently {\bfseries ignore comments}. 