LCOV - code coverage report
Current view: top level - src/plugins/tcl - action.hpp (source / functions) Hit Total Coverage
Test: coverage-filtered.info Lines: 9 9 100.0 %
Date: 2019-09-12 12:28:41 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /**
       2             :  * @file
       3             :  *
       4             :  * @brief
       5             :  *
       6             :  * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
       7             :  */
       8             : 
       9             : #ifndef ACTION_HPP
      10             : #define ACTION_HPP
      11             : 
      12             : #include <keyset.hpp>
      13             : 
      14             : #include <ostream>
      15             : 
      16             : #include <boost/bind.hpp>
      17             : #include <boost/fusion/include/std_pair.hpp>
      18             : #include <boost/spirit/include/qi.hpp>
      19             : #include <boost/spirit/include/support_standard.hpp>
      20             : 
      21             : #include <fstream>
      22             : #include <iostream>
      23             : #include <iterator>
      24             : #include <map>
      25             : 
      26             : #include "printer.hpp"
      27             : 
      28             : namespace elektra
      29             : {
      30             : 
      31             : 
      32             : namespace qi = boost::spirit::qi;
      33             : namespace unicode = boost::spirit::standard;
      34             : 
      35             : template <typename Iterator>
      36          36 : struct Action : qi::grammar<Iterator, unicode::space_type>
      37             : {
      38         522 :         Action (kdb::KeySet & ks, kdb::Key & parent) : Action::base_type (query), p (ks, parent)
      39             :         {
      40          90 :                 query = '{' >> *(pair) > '}';
      41         216 :                 pair = '{' >> key > '=' >> val >> *('{' >> metakey > '=' >> metaval > '}') > '}'; // lgtm [cpp/comparison-precedence]
      42             : 
      43             : 
      44         126 :                 key = (+(qi::char_ - qi::char_ ("={}[]<>")))[boost::bind (&Printer::add_key, &p, _1)];
      45         126 :                 val = (+(qi::char_ - qi::char_ ("={}[]<>")))[boost::bind (&Printer::add_val, &p, _1)];
      46         126 :                 metakey = (+(qi::char_ - qi::char_ ("={}[]<>")))[boost::bind (&Printer::add_metakey, &p, _1)];
      47         126 :                 metaval = (+(qi::char_ - qi::char_ ("={}[]<>")))[boost::bind (&Printer::add_metaval, &p, _1)];
      48          18 :         }
      49             : 
      50             :         Printer p;
      51             : 
      52             :         qi::rule<Iterator, unicode::space_type> query;
      53             :         qi::rule<Iterator, unicode::space_type> pair;
      54             :         qi::rule<Iterator, unicode::space_type> key, val, metakey, metaval;
      55             : };
      56             : 
      57             : } // namespace elektra
      58             : 
      59             : #endif

Generated by: LCOV version 1.13