22 #ifndef COLOR_GRAMMAR_HPP 23 #define COLOR_GRAMMAR_HPP 25 #include <boost/spirit/home/qi/string/tst.hpp> 26 #include <boost/spirit/home/qi/string/tst_map.hpp> 33 namespace qi = spirit::qi;
34 namespace classic = boost::spirit::classic;
35 namespace phx = boost::phoenix;
36 namespace chs = spirit::standard;
42 struct ColorSymbols : qi::symbols<char, Color, qi::tst_map<char, Color> >
58 struct ColorGrammar :
public qi::grammar<StringIterator, Color(), chs::space_type>
67 qi::uint_parser<uint8, 10, 1, 3>
number;
78 qi::rule<ItType, Color(), qi::locals<uint8, uint8, uint8, uint8> >
rule_hexcolor;
80 qi::rule<ItType, Color(), qi::locals<float, float>, Skipper>
rule_rgb;
82 qi::rule<ItType, Color(), qi::locals<float, float, float>, Skipper>
rule_rgba;
A grammar to parse a mapcss color.
qi::rule< ItType, uint8(), qi::locals< uint8, uint8 > > rule_hexvalue
Rule to parse the hex color code.
StringIterator ItType
Iterator type for this grammar.
ColorSymbols()
This file is part of alaCarte.
symbols for the binary operators
qi::uint_parser< uint8, 10, 1, 3 > number
Rule to parse a number with up to 3 digits.
qi::uint_parser< uint8, 16, 1, 1 > hexdigit
Rule to parse a hex digit.
qi::rule< ItType, Color(), qi::locals< float, float >, Skipper > rule_rgb
Rule for rgb(...)
qi::rule< ItType, Color(), qi::locals< float, float, float >, Skipper > rule_rgba
Rule for rgba(...)
ColorSymbols colorSymbol_
Symbol parser for colors.
qi::rule< ItType, Color(), Skipper > rule_color
Mainrule.
chs::space_type Skipper
Skipper type used in this grammar.
std::string::const_iterator StringIterator
Iterator to iterate over a file.
qi::rule< ItType, Color(), qi::locals< uint8, uint8, uint8, uint8 > > rule_hexcolor
Rule for #COLORCODE.