
\begin{DoxyItemize}
\item infos = Information about the yaypeg 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 uses a P\+EG based parser to read Y\+A\+ML files
\end{DoxyItemize}\hypertarget{autotoc_md968_src_plugins_yaypeg_README_md}{}\section{Y\+Ay P\+EG}\label{autotoc_md968_src_plugins_yaypeg_README_md}
The Y\+Ay P\+EG plugin use a parser based on \href{https://github.com/taocpp/PEGTL}{\tt P\+E\+G\+TL} to convert Y\+A\+ML data to Elektra’s {\ttfamily Key\+Set} type.\hypertarget{autotoc_md968_autotoc_md969}{}\subsection{Dependencies}\label{autotoc_md968_autotoc_md969}
This plugin requires \href{https://repology.org/project/pegtl/versions}{\tt P\+E\+G\+TL} {\ttfamily 2.\+7.\+1} or later. It does not support P\+E\+G\+TL {\ttfamily 3}, which requires C++ 17.\hypertarget{autotoc_md968_autotoc_md970}{}\subsection{Examples}\label{autotoc_md968_autotoc_md970}
\hypertarget{autotoc_md968_autotoc_md971}{}\subsubsection{Mappings}\label{autotoc_md968_autotoc_md971}
``` \hypertarget{autotoc_md968_autotoc_md972}{}\section{Mount plugin}\label{autotoc_md968_autotoc_md972}
sudo kdb mount config.\+yaml user/tests/yaypeg yaypeg\hypertarget{autotoc_md968_autotoc_md973}{}\section{Add some values}\label{autotoc_md968_autotoc_md973}
kdb set user/tests/yaypeg/movements/deadly \textquotesingle{}Dull\textquotesingle{} kdb set user/tests/yaypeg/movements/deep \textquotesingle{}Red\textquotesingle{}\hypertarget{autotoc_md968_autotoc_md974}{}\section{Manually add a key}\label{autotoc_md968_autotoc_md974}
printf \textquotesingle{}Rosalía\+: El\+::\+Mal\+::\+Querer\textquotesingle{} $>$$>$ {\ttfamily kdb file user/tests/yaypeg}\hypertarget{autotoc_md968_autotoc_md975}{}\section{List keys}\label{autotoc_md968_autotoc_md975}
kdb ls user/tests/yaypeg \#$>$ user/tests/yaypeg/\+Rosalía \#$>$ user/tests/yaypeg/movements/deadly \#$>$ user/tests/yaypeg/movements/deep\hypertarget{autotoc_md968_autotoc_md976}{}\section{Retrieve a value}\label{autotoc_md968_autotoc_md976}
kdb get user/tests/yaypeg/\+Rosalía \#$>$ El\+::\+Mal\+::\+Querer\hypertarget{autotoc_md968_autotoc_md977}{}\section{Undo modifications}\label{autotoc_md968_autotoc_md977}
kdb rm -\/r user/tests/yaypeg sudo kdb umount user/tests/yaypeg 
\begin{DoxyCode}
### Arrays
\end{DoxyCode}
 \hypertarget{autotoc_md968_autotoc_md978}{}\section{Mount plugin}\label{autotoc_md968_autotoc_md978}
sudo kdb mount config.\+yaml user/tests/yaypeg yaypeg\hypertarget{autotoc_md968_autotoc_md979}{}\section{Manually add some values}\label{autotoc_md968_autotoc_md979}
printf \textquotesingle{}ponies\+:~\newline
\textquotesingle{} $>$ {\ttfamily kdb file user/tests/yaypeg} printf \textquotesingle{} -\/ Fluttershy \# Yay!~\newline
\textquotesingle{} $>$$>$ {\ttfamily kdb file user/tests/yaypeg} printf \textquotesingle{} -\/ Pinkie Pie~\newline
\textquotesingle{} $>$$>$ {\ttfamily kdb file user/tests/yaypeg} printf \textquotesingle{} -\/ Maud Pie\textquotesingle{} $>$$>$ {\ttfamily kdb file user/tests/yaypeg}\hypertarget{autotoc_md968_autotoc_md980}{}\section{List array keys}\label{autotoc_md968_autotoc_md980}
kdb ls user/tests/yaypeg \#$>$ user/tests/yaypeg/ponies \#$>$ user/tests/yaypeg/ponies/\#0 \#$>$ user/tests/yaypeg/ponies/\#1 \#$>$ user/tests/yaypeg/ponies/\#2\hypertarget{autotoc_md968_autotoc_md981}{}\section{Retrieve last array entry}\label{autotoc_md968_autotoc_md981}
kdb get user/tests/yaypeg/ponies/\$(kdb getmeta user/tests/yaypeg/ponies array) \#$>$ Maud Pie\hypertarget{autotoc_md968_autotoc_md982}{}\section{Undo modifications}\label{autotoc_md968_autotoc_md982}
kdb rm -\/r user/tests/yaypeg sudo kdb umount user/tests/yaypeg 
\begin{DoxyCode}
### Boolean Values
\end{DoxyCode}
 \hypertarget{autotoc_md968_autotoc_md983}{}\section{Mount plugin}\label{autotoc_md968_autotoc_md983}
sudo kdb mount config.\+yaml user/tests/yaypeg yaypeg\hypertarget{autotoc_md968_autotoc_md984}{}\section{Manually add a boolean value to the database}\label{autotoc_md968_autotoc_md984}
printf \textquotesingle{}one\+: true\textquotesingle{} $>$ {\ttfamily kdb file user/tests/yaypeg}\hypertarget{autotoc_md968_autotoc_md985}{}\section{Elektra stores boolean values as `0` and `1`}\label{autotoc_md968_autotoc_md985}
kdb get user/tests/yaypeg/one \#$>$ 1\hypertarget{autotoc_md968_autotoc_md986}{}\section{Undo modifications to the key database}\label{autotoc_md968_autotoc_md986}
kdb rm -\/r user/tests/yaypeg sudo kdb umount user/tests/yaypeg 
\begin{DoxyCode}
### Error Messages
\end{DoxyCode}
 \hypertarget{autotoc_md968_autotoc_md987}{}\section{Mount plugin}\label{autotoc_md968_autotoc_md987}
sudo kdb mount config.\+yaml user/tests/yaypeg yaypeg\hypertarget{autotoc_md968_autotoc_md988}{}\section{Manually add syntactically incorrect data}\label{autotoc_md968_autotoc_md988}
printf \textquotesingle{}Fluttershy\+:~\newline
\textquotesingle{} $>$ {\ttfamily kdb file user/tests/yaypeg} printf \textquotesingle{}I’d like to be a tree~\newline
\textquotesingle{} $>$$>$ {\ttfamily kdb file user/tests/yaypeg} \# Incorrect indentation

kdb ls user/tests/yaypeg \hypertarget{autotoc_md968_autotoc_md989}{}\section{R\+E\+T\+: 5}\label{autotoc_md968_autotoc_md989}
\hypertarget{autotoc_md968_autotoc_md990}{}\section{S\+T\+D\+E\+R\+R\+: .$\ast$config.\+yaml\+:2\+:0\+: Incomplete document, expected “end of file”.$\ast$}\label{autotoc_md968_autotoc_md990}
\hypertarget{autotoc_md968_autotoc_md991}{}\section{Let us look at the error message more closely.}\label{autotoc_md968_autotoc_md991}
\hypertarget{autotoc_md968_autotoc_md992}{}\section{Since the location of `config.\+yaml` depends on the current user and O\+S,}\label{autotoc_md968_autotoc_md992}
\hypertarget{autotoc_md968_autotoc_md993}{}\section{we store the text before `config.\+yaml` as `user/tests/error/prefix`.}\label{autotoc_md968_autotoc_md993}
kdb set user/tests/error \char`\"{}\$(2$>$\&1 kdb ls user/tests/yaypeg)\char`\"{} kdb set user/tests/error/prefix \char`\"{}\$(kdb get user/tests/error $\vert$ grep \textquotesingle{}config.\+yaml\textquotesingle{} $\vert$ head -\/1 $\vert$ sed -\/\+E \textquotesingle{}s/(.$\ast$)config.\+yaml.$\ast$/\textbackslash{}1/\textquotesingle{})\char`\"{} \hypertarget{autotoc_md968_autotoc_md994}{}\section{We also store the length of the prefix, so we can remove it from every}\label{autotoc_md968_autotoc_md994}
\hypertarget{autotoc_md968_autotoc_md995}{}\section{line of the error message.}\label{autotoc_md968_autotoc_md995}
kdb set user/tests/error/prefix/length \char`\"{}\$(kdb get user/tests/error/prefix $\vert$ wc -\/c $\vert$ sed \textquotesingle{}s/\mbox{[} \mbox{]}$\ast$//g\textquotesingle{})\char`\"{}\hypertarget{autotoc_md968_autotoc_md996}{}\section{Since we only want to look at the “reason” of the error, we}\label{autotoc_md968_autotoc_md996}
\hypertarget{autotoc_md968_autotoc_md997}{}\section{remove the other part of the error message with `head` and `tail`.}\label{autotoc_md968_autotoc_md997}
kdb get user/tests/error $\vert$ tail -\/n3 $\vert$ cut -\/c\char`\"{}\$(kdb get user/tests/error/prefix/length)\char`\"{}-\/ \#$>$ config.\+yaml\+:2\+:0\+: Incomplete document, expected “end of file” \#$>$ I’d like to be a tree \#$>$ $^\wedge$\hypertarget{autotoc_md968_autotoc_md998}{}\section{Fix syntax error}\label{autotoc_md968_autotoc_md998}
printf \textquotesingle{}Fluttershy\+:~\newline
\textquotesingle{} $>$ {\ttfamily kdb file user/tests/yaypeg} printf \textquotesingle{} I’d like to be a tree~\newline
\textquotesingle{} $>$$>$ {\ttfamily kdb file user/tests/yaypeg}

kdb get user/tests/yaypeg/\+Fluttershy \#$>$ I’d like to be a tree\hypertarget{autotoc_md968_autotoc_md999}{}\section{Add double quoted scalar with missing closing quote character}\label{autotoc_md968_autotoc_md999}
printf \textquotesingle{}"nothing,nowhere.\textquotesingle{} $>$ {\ttfamily kdb file user/tests/yaypeg} kdb ls user/tests/yaypeg \hypertarget{autotoc_md968_autotoc_md1000}{}\section{R\+E\+T\+: 5}\label{autotoc_md968_autotoc_md1000}
\hypertarget{autotoc_md968_autotoc_md1001}{}\section{S\+T\+D\+E\+R\+R\+: .$\ast$config.\+yaml\+:1\+:17\+: Missing closing double quote or incorrect value inside flow scalar.$\ast$}\label{autotoc_md968_autotoc_md1001}
\hypertarget{autotoc_md968_autotoc_md1002}{}\section{Check error messages for other syntax errors}\label{autotoc_md968_autotoc_md1002}
printf \textquotesingle{}\char`\"{}\textbackslash{}ö\char`\"{}\textquotesingle{} $>$ {\ttfamily kdb file user/tests/yaypeg} kdb ls user/tests/yaypeg \hypertarget{autotoc_md968_autotoc_md1003}{}\section{R\+E\+T\+: 5}\label{autotoc_md968_autotoc_md1003}
\hypertarget{autotoc_md968_autotoc_md1004}{}\section{S\+T\+D\+E\+R\+R\+: .$\ast$config.\+yaml\+:1\+:2\+: Unexpected escape character.$\ast$}\label{autotoc_md968_autotoc_md1004}
printf \char`\"{}\textbackslash{}\char`\"{}\textbackslash{}07"" $>$ {\ttfamily kdb file user/tests/yaypeg} kdb ls user/tests/yaypeg \hypertarget{autotoc_md968_autotoc_md1005}{}\section{R\+E\+T\+: 5}\label{autotoc_md968_autotoc_md1005}
\hypertarget{autotoc_md968_autotoc_md1006}{}\section{S\+T\+D\+E\+R\+R\+: .$\ast$config.\+yaml\+:1\+:1\+: Missing closing double quote or incorrect value inside flow scalar.$\ast$}\label{autotoc_md968_autotoc_md1006}
printf \char`\"{}\textquotesingle{}\+Single\char`\"{} $>$ {\ttfamily kdb file user/tests/yaypeg} kdb ls user/tests/yaypeg \hypertarget{autotoc_md968_autotoc_md1007}{}\section{R\+E\+T\+: 5}\label{autotoc_md968_autotoc_md1007}
\hypertarget{autotoc_md968_autotoc_md1008}{}\section{S\+T\+D\+E\+R\+R\+: .$\ast$config.\+yaml\+:1\+:7\+: Missing closing single quote or incorrect value inside flow scalar.$\ast$}\label{autotoc_md968_autotoc_md1008}
printf \char`\"{}\textquotesingle{}\textbackslash{}07\textquotesingle{}\char`\"{} $>$ {\ttfamily kdb file user/tests/yaypeg} kdb ls user/tests/yaypeg \hypertarget{autotoc_md968_autotoc_md1009}{}\section{R\+E\+T\+: 5}\label{autotoc_md968_autotoc_md1009}
\hypertarget{autotoc_md968_autotoc_md1010}{}\section{S\+T\+D\+E\+R\+R\+: .$\ast$config.\+yaml\+:1\+:1\+: Missing closing single quote or incorrect value inside flow scalar.$\ast$}\label{autotoc_md968_autotoc_md1010}
\hypertarget{autotoc_md968_autotoc_md1011}{}\section{Store syntactically correct data}\label{autotoc_md968_autotoc_md1011}
printf \textquotesingle{}dummy\textquotesingle{} $>$ {\ttfamily kdb file user/tests/yaypeg}\hypertarget{autotoc_md968_autotoc_md1012}{}\section{Undo modifications}\label{autotoc_md968_autotoc_md1012}
kdb rm -\/r user/tests/error kdb rm -\/r user/tests/yaypeg sudo kdb umount user/tests/yaypeg ```\hypertarget{autotoc_md968_autotoc_md1013}{}\subsection{Limitations}\label{autotoc_md968_autotoc_md1013}

\begin{DoxyItemize}
\item The plugin does {\bfseries not support}
\begin{DoxyItemize}
\item {\bfseries block scalars},
\item {\bfseries flow collections},
\item {\bfseries tags},
\item {\bfseries anchors \& aliases}, and
\item {\bfseries multiple documents}
\end{DoxyItemize}
\end{DoxyItemize}\hypertarget{autotoc_md968_autotoc_md1014}{}\subsubsection{Comments}\label{autotoc_md968_autotoc_md1014}
While the parser does read comments, the \href{/home/jenkins/workspace/libelektra_master-Q2SIBK3KE2NBEMJ4WVGJXAXCSCB77DUBUULVLZDKHQEV3WNDXBMA/src/plugins/yaypeg/listener.cpp}{\tt listener} does currently not add metakeys for them. This means that comments will be lost, if you modify a key set.\hypertarget{autotoc_md968_autotoc_md1015}{}\subsubsection{Error Messages}\label{autotoc_md968_autotoc_md1015}
Visualized error messages (containing {\ttfamily $^\wedge$} markers) might not point to the correct error location, if the input contains tabs or unicode characters with a length other than {\ttfamily 1}. 