% Reference Card for Boost.Spirit 2.5.8 % Copyright (c) 2014 Richard Thomson. May be freely distributed. % Created Friday, October 31, 2014 % Updated Tuesday, July 12, 2016 % Thanks to Joseph H. Silverman for his TeX reference card on which % this reference card is based. % Thanks to Stephen Gildea for the multicolumn macro package % which Joseph Silverman modified from his GNU emacs reference card % TeX is a trademark of the American Mathematical Society %**start of header \newcount\columnsperpage % This file can be printed with 1, 2, or 3 columns per page (see below). % [For 2 or 3 columns, you'll need 6 and 8 point fonts.] % Specify how many you want here. Nothing else needs to be changed. \columnsperpage=3 % Smaller (97%) pdf file with horizontal offset 1.5in % dvipdfm -l -m 0.97 -x 1.5in -o spirit-reference.pdf spirit-reference.dvi % There are a couple extra sections included at the end of the document % (after the \bye) that didn't fit into six columns. % It would be nice to have additional sections covering: % \hrules and \vrules, Registers % \input and \output files (including \read, \write, \message) % This reference card is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. % This file is intended to be processed by plain TeX (TeX82). % % The final reference card has six columns, three on each side. % This file can be used to produce it in any of three ways: % 1 column per page % produces six separate pages, each of which needs to be reduced to 80%. % This gives the best resolution. % 2 columns per page % produces three already-reduced pages. % You will still need to cut and paste. % 3 columns per page % produces two pages which must be printed sideways to make a % ready-to-use 8.5 x 11 inch reference card. % For this you need a dvi device driver that can print sideways. % Which mode to use is controlled by setting \columnsperpage above. % % Author: % Richard Thomson % Internet: legalize@xmission.com % (based on a reference card by Joseph H. Silverman) % (reference card macros due to Stephen Gildea) % History: % Version 1.0 - October 2014 % Version 1.1 - July 2016 \def\versionnumber{1.0} % Version of this reference card \def\year{2016} \def\month{July} \def\version{\month\ \year\ v\versionnumber} \def\shortcopyrightnotice{ \vskip 0pt plus 2 fill\begingroup\parskip=0pt\small \centerline{\copyright\ \number\year\ Richard Thomson, Permissions on back. v\versionnumber} Send comments and corrections to Richard Thomson, $\langle$legalize@xmission.com$\rangle$ \endgroup} \def\copyrightnotice{ \vskip 1ex plus 2 fill\begingroup\parskip=0pt\small \centerline{Copyright \copyright\ \year\ Richard Thomson, \version} Permission is granted to make and distribute copies of this card provided the copyright notice and this permission notice are preserved on all copies. \endgroup} % make \bye not \outer so that the \def\bye in the \else clause below % can be scanned without complaint. \def\bye{\par\vfill\supereject\end} \newdimen\intercolumnskip \newbox\columna \newbox\columnb \def\ncolumns{\the\columnsperpage} \message{[\ncolumns\space column\if 1\ncolumns\else s\fi\space per page]} \def\scaledmag#1{ scaled \magstep #1} % This multi-way format was designed by Stephen Gildea % October 1986. \if 1\ncolumns \hsize 4in \vsize 10in \voffset -.7in \font\titlefont=\fontname\tenbf \scaledmag3 \font\headingfont=\fontname\tenbf \scaledmag2 \font\smallfont=\fontname\sevenrm \font\smallsy=\fontname\sevensy \footline{\hss\folio} \def\makefootline{\baselineskip10pt\hsize6.5in\line{\the\footline}} \else \hsize 3.2in \vsize 7.95in \hoffset -.75in \voffset -.745in \font\titlefont=cmbx10 \scaledmag2 \font\headingfont=cmbx10 \scaledmag1 \font\smallfont=cmr6 \font\smallsy=cmsy6 \font\eightrm=cmr8 \font\eighti=cmmi8 \font\eightsy=cmsy8 \font\eightbf=cmbx8 \font\eighttt=cmtt8 \font\eightit=cmti8 \font\eightsl=cmsl8 \textfont0=\eightrm \textfont1=\eighti \textfont2=\eightsy \def\rm{\eightrm} \def\bf{\eightbf} \def\tt{\eighttt} \def\it{\eightit} \def\sl{\eightsl} \normalbaselineskip=.8\normalbaselineskip \normallineskip=.8\normallineskip \normallineskiplimit=.8\normallineskiplimit \normalbaselines\rm %make definitions take effect \if 2\ncolumns \let\maxcolumn=b \footline{\hss\rm\folio\hss} \def\makefootline{\vskip 2in \hsize=6.86in\line{\the\footline}} \else \if 3\ncolumns \let\maxcolumn=c \nopagenumbers \else \errhelp{You must set \columnsperpage equal to 1, 2, or 3.} \errmessage{Illegal number of columns per page} \fi\fi \intercolumnskip=.46in \def\abc{a} \output={% % This next line is useful when designing the layout. %\immediate\write16{Column \folio\abc\space starts with \firstmark} \if \maxcolumn\abc \multicolumnformat \global\def\abc{a} \else\if a\abc \global\setbox\columna\columnbox \global\def\abc{b} %% in case we never use \columnb (two-column mode) \global\setbox\columnb\hbox to -\intercolumnskip{} \else \global\setbox\columnb\columnbox \global\def\abc{c}\fi\fi} \def\multicolumnformat{\shipout\vbox{\makeheadline \hbox{\box\columna\hskip\intercolumnskip \box\columnb\hskip\intercolumnskip\columnbox} \makefootline}\advancepageno} \def\columnbox{\leftline{\pagebody}} \def\bye{\par\vfill\supereject \if a\abc \else\null\vfill\eject\fi \if a\abc \else\null\vfill\eject\fi \end} \fi % ***** Verbatim typesetting ***** % Verbatim typesetting is done by % \verbatim"stuff to verbatim typeset" % Any character can be used in place of ". % E.g. \verbatim?stuff? or \verbatim|stuff|. Cf. TeXbook pp.380-382 \def\uncatcodespecials{\def\do##1{\catcode`##1=12}\dospecials} \def\setupverbatim{\tt% \def\par{\leavevmode\endgraf}\catcode`\`=\active% \obeylines\uncatcodespecials\obeyspaces} \def\verbatim{\begingroup\setupverbatim\doverbatim} \def\doverbatim#1{\def\next##1#1{##1\endgroup}\next} \def\\{\verbatim} \def\ds{\displaystyle} \def\SPC{\quad} % space between symbol and command \parindent 0pt \parskip 1ex plus .5ex minus .5ex \def\small{\smallfont\textfont2=\smallsy\baselineskip=.8\baselineskip} \outer\def\newcolumn{\vfill\eject} \outer\def\title#1{{\titlefont\centerline{#1}}\vskip 1ex plus .5ex minus.5ex} %\outer\def\section#1{\par\filbreak % \vskip 1ex plus 2ex minus 2ex {\headingfont #1}\mark{#1}% % \vskip 1ex plus 1ex minus .5ex} \outer\def\section#1{\par\filbreak \vskip .75ex plus 1ex minus 2ex {\headingfont #1}\mark{#1}% \vskip .5ex plus .5ex minus .5ex} \def\paralign{\vskip\parskip\halign} \def\<#1>{$\langle${\rm #1}$\rangle$} \def\begintext{\par\leavevmode\begingroup\parskip0pt\rm} \def\endtext{\endgroup} \def\unused{$unused$} % ************ TEXT STARTS HERE ************************** \title{Boost.Spirit 2.5.8 Reference Card} \section{Primitive Parsers} % ***** Three Column Format ***** \paralign to\hsize{% #\hfil\SPC\tabskip=0pt &#\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\cr %----------- 3 Column Data ------------------- \\|attr(a)|&Attribute&\\|A|\cr \\|eoi|&End of Input&\unused\cr \\|eol|&End of Line&\unused\cr \\|eps|&Epsilon&\unused\cr \\|eps(p)|&&\unused\cr \\|symbols|&Symbol Table&\\|T|\cr } \section{Unary Parsers} % ***** Three Column Format ***** \paralign to\hsize{% #\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\cr %----------- 3 Column Data ------------------- \\|&a|&And Predicate&\unused\cr \\|!a|&Not Predicate&\unused\cr \\|*a|&Zero or More&\\|vector|\cr \\|*u|&&\unused\cr \\|-a|&Optional&\\|optional|\cr \\|-u|&&\unused\cr \\|+a|&One or More&\\|vector|\cr \\|+u|&&\unused\cr \\|attr_cast(p)|&Attribute Cast&\\|T|\cr } \section{Binary Parsers} % ***** Three Column Format ***** \paralign to\hsize{% #\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\cr %----------- 3 Column Data ------------------- \\|a - b|&Difference&\\|A|\cr \\|u - b|&&\unused\cr \\|a % b|&Separated List&\\|vector|\cr \\|u % b|&&\unused\cr } \section{N-ary Parsers} % ***** Three Column Format ***** \paralign to\hsize{% #\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\cr %----------- 3 Column Data ------------------- \\/a | b/&Alternative&\\|variant|\cr \\/a | u/& &\\|optional|\cr \\/a | b | u/& &\\|optional>|\cr \\/u | b/& &\\|optional|\cr \\/u | u/& &\unused\cr \\/a | a/& &\\|A|\cr \\|a > b|&Expect&\\|tuple|\cr \\|a > u|& &\\|A|\cr \\|u > b|& &\\|B|\cr \\|u > u|& &\unused\cr \\|a > vA|& &\\|vector|\cr \\|vA > a|& &\\|vector|\cr \\|vA > vA|& &\\|vector|\cr \\|a ^ b|&Permute&\\|tuple,optional>|\cr \\|a ^ u|& &\\|optional|\cr \\|u ^ b|& &\\|optional|\cr \\|u ^ u|& &\unused\cr \\|a >> b|&Sequence&\\|tuple|\cr \\|a >> u|& &\\|A|\cr \\|u >> b|& &\\|B|\cr \\|u >> u|& &\unused\cr \\|a >> a|& &\\|vector|\cr \\|a >> vA|& &\\|vector|\cr \\|vA >> a|& &\\|vector|\cr \\|vA >> vA|& &\\|vector|\cr \\/a || b/&Sequence Or&\\|tuple,optional>|\cr \\/a || u/& &\\|optional|\cr \\/u || a/& &\\|optional|\cr \\/u || u/& &\unused\cr \\/a || a/& &\\|vector>|\cr } \section{Nonterminal Parsers} \paralign to\hsize{ #\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\cr \\|rule|&Rule&\\|RT|\cr \\|rule|& &\unused\cr \\|rule|& &\unused\cr \\|rule|& &\unused\cr \\|rule|& &\unused\cr \\|grammar|&Grammar&\\|RT|\cr \\|grammar|& &\unused\cr \\|grammar|& &\unused\cr \\|grammar|& &\unused\cr \\|grammar|& &\unused\cr } \section{Parser Directives} \paralign to\hsize{% #\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\cr \\|as()[a]|&Atomic Assignment&\\|T|\cr \\|expect[a]|&Expectation&\\|A|\cr \\|expect[u]|&&\unused\cr \\|hold[a]|&Hold Attribute&\\|A|\cr \\|hold[u]|&&\unused\cr \\|lexeme[a]|&Lexeme&\\|A|\cr \\|lexeme[u]|&&\unused\cr \\|matches[a]|&Matches&\\|bool|\cr \\|no_case[a]|&Case Insensitive&\\|A|\cr \\|no_case[u]|&&\unused\cr \\|no_skip[a]|&No Skipping&\\|A|\cr \\|no_skip[u]|&&\unused\cr \\|omit[a]|&Omit Attribute&\unused\cr \\|raw[a]|&Raw Iterators&\\|iterator_range|\cr \\|raw[u]|&&\unused\cr \\|repeat[a]|&Repeat&\\|vector|\cr \\|repeat[u]|&&\unused\cr \\|repeat(n)[a]|&&\\|vector|\cr \\|repeat(n)[u]|&&\unused\cr \\|repeat(min,max)[a]|&&\\|vector|\cr \\|repeat(min,max)[u]|&&\unused\cr \\|repeat(min,inf)[a]|&&\\|vector|\cr \\|repeat(min,inf)[u]|&&\unused\cr \\|skip[a]|&Skip Whitespace&\\|A|\cr \\|skip[u]|&&\unused\cr \\|skip(p)[a]|&&\\|A|\cr \\|skip(p)[u]|&&\unused\cr } \section{Semantic Actions} \paralign to\hsize{% #\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\cr \\|p[fa]|&Apply Semantic Action&\\|A|\cr \\|p[|$phoenix$ $lambda$\\|]|&&\\|A|\cr } \paralign to\hsize{% #\hfil\cr \\|template|\cr \\|void fa(Attrib& attr);|\cr \cr \\|template|\cr \\|void fa(Attrib& attr, Context& context);|\cr \cr \\|template|\cr \\|void fa(Attrib& attr, Context& context, bool& pass);|\cr } \section{Phoenix Placeholders} \paralign to\hsize{% #\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\cr \\|_1|, \\|_2|, $\dots$, \\|_N|&Nth Attribute of \\|p|\cr \\|_val|&Enclosing rule's synthesized attribute\cr \\|_r1|, \\|_r2|, $\dots$, \\|_rN|&Enclosing rule's Nth inherited attribute.\cr \\|_a|, \\|_b|, $\dots$, \\|_j|&Enclosing rule's local variables.\cr \\|_pass|&Assign \\|false| to \\|_pass| to force failure.\cr } \section{Iterator Parser API} \paralign to \hsize{#\cr \\|bool parse(|\cr \\| It& first, It last, Exp const& expr);|\cr \\|bool parse(|\cr \\| It& first, It last, Exp const& expr,|\cr \\| A1& a1, ..., An& an);|\cr \\|bool phrase_parse(|\cr \\| It& first, It last, Exp const& expr,|\cr \\| Skipper const& skipper,|\cr \\| skip_flag post_skip = postskip);|\cr \\|bool phrase_parse(|\cr \\| It& first, It last, Exp const& expr,|\cr \\| Skipper const& skipper,|\cr \\| A1& a1, ..., An& an);|\cr \\|bool phrase_parse(|\cr \\| It& first, It last, Exp const& expr,|\cr \\| Skipper const& skipper,|\cr \\| skip_flag post_skip,|\cr \\| A1& a1, ..., An& an);|\cr } \section{Stream Parser API} \paralign to\hsize{#\cr $unspecified$\\| match(Exp const& expr);|\cr $unspecified$\\| match(|\cr \\| Exp const& expr,|\cr \\| A1& a1, ..., An& an);|\cr $unspecified$\\| phrase_match(|\cr \\| Exp const& expr,|\cr \\| Skipper const& skipper,|\cr \\| skip_flag post_skip = postskip);|\cr $unspecified$\\| phrase_match(|\cr \\| Exp const& expr,|\cr \\| Skipper const& skipper,|\cr \\| skip_flag post_skip,|\cr \\| A1& a1, ..., An& an);|\cr } \shortcopyrightnotice \section{Binary Value Parsers} % ***** Three Column Format ***** \paralign to\hsize{% #\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\cr \\|byte_|&Native Byte&\\|uint_least8_t|\cr \\|byte_(b)|&&\unused\cr \\|word|&Native Word&\\|uint_least16_t|\cr \\|word(w)|&&\unused\cr \\|dword|&Native Double Word&\\|uint_least32_t|\cr \\|dword(dw)|&&\unused\cr \\|qword|&Native Quad Word&\\|uint_least64_t|\cr \\|qword(qw)|&&\unused\cr \\|bin_float|&Native Float&\\|float|\cr \\|bin_float(f)|&&\unused\cr \\|bin_double|&Native Double&\\|double|\cr \\|bin_double(d)|&&\unused\cr \\|little_|$item$&Little Endian $item$&as above\cr \\|little_|$item$\\|(w)|&&\unused\cr \\|big_|$item$&Big Endian $item$&as above\cr \\|big_|$item$\\|(w)|&&\unused\cr } \section{Character Encodings} \paralign to\hsize{% #\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\cr \\|ascii|&7-bit ASCII\cr \\|iso8859_1|&ISO 8859-1\cr \\|standard|&Using \\||\cr \\|standard_wide|&Using \\||\cr } \section{Character Parsers} \paralign to\hsize{% #\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\cr \\|c|&Character Literal&\unused\cr \\|lit(c)|&&\unused\cr \\|ns::char_|&Any Character&\\|ns::char_type|\cr \\|ns::char_(c)|&Character Value&\\|ns::char_type|\cr \\|ns::char_(f,l)|&Character Range&\\|ns::char_type|\cr \\|ns::char_(str)|&Any Character in String&\\|ns::char_type|\cr \\|~cp|&Characters not in \\|cp|&Attribute of \\|cp|\cr } \section{Character Class Parsers} \paralign to\hsize{% #\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\cr \\|ns::alnum|&Letters or Digits&\\|ns::char_type|\cr \\|ns::alpha|&Alphabetic&\\|ns::char_type|\cr \\|ns::blank|&Spaces or Tabs&\\|ns::char_type|\cr \\|ns::cntrl|&Control Characters&\\|ns::char_type|\cr \\|ns::digit|&Numeric Digits&\\|ns::char_type|\cr \\|ns::graph|&Non-space Printing Characters&\\|ns::char_type|\cr \\|ns::lower|&Lower Case Letters&\\|ns::char_type|\cr \\|ns::print|&Printing Characters&\\|ns::char_type|\cr \\|ns::punct|&Punctuation&\\|ns::char_type|\cr \\|ns::space|&White Space&\\|ns::char_type|\cr \\|ns::upper|&Upper Case Letters&\\|ns::char_type|\cr \\|ns::xdigit|&Hexadecimal Digits&\\|ns::char_type|\cr } \section{String Parsers} \paralign to\hsize{% #\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\cr \\|str|&String Literal&\unused\cr \\|lit(str)|&&\unused\cr \\|ns::string("str")|&String&\\|basic_string|\cr \\|ns::string(L"str")|&&\\|basic_string|\cr } \section{Unsigned Integer Parsers} \paralign to\hsize{% #\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\cr \\|lit(num)|&Integer Literal&\unused\cr \\|ushort_|&Short&\\|unsigned short|\cr \\|ushort_(num)|&Short Value&\\|unsigned short|\cr \\|uint_|&Integer&\\|unsigned int|\cr \\|uint_(num)|&Integer Value&\\|unsigned int|\cr \\|ulong_|&Long&\\|unsigned long|\cr \\|ulong_(num)|&Long Value&\\|unsigned long|\cr \\|ulong_long|&Long Long&\\|unsigned long long|\cr \\|ulong_long(num)|&Long Long Value&\\|unsigned long long|\cr \\|bin|&Binary Integer&\\|unsigned int|\cr \\|bin(num)|&Binary Integer Value&\\|unsigned int|\cr \\|oct|&Octal Integer&\\|unsigned int|\cr \\|oct(num)|&Octal Integer Value&\\|unsigned int|\cr \\|hex|&Hexadecimal Integer&\\|unsigned int|\cr \\|hex(num)|&Hex Integer Value&\\|unsigned int|\cr } \section{Generalized Unsigned Integer Parser} \paralign to\hsize{% #\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\cr \\|uint_parser|&\\|T|\cr \\|uint_parser(num)|&\\|T|\cr } \section{Signed Integer Parsers} \paralign to\hsize{% #\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\cr \\|lit(num)|&Integer Literal&\unused\cr \\|short_|&Short&\\|short|\cr \\|short_(num)|&Short Value&\\|short|\cr \\|int_|&Integer&\\|int|\cr \\|int_(num)|&Integer Value&\\|int|\cr \\|long_|&Long&\\|long|\cr \\|long_(num)|&Long Value&\\|long|\cr \\|long_long|&Long Long&\\|long long|\cr \\|long_long(num)|&Long Long Value&\\|long long|\cr } \section{Generalized Signed Integer Parser} \paralign to\hsize{% #\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\cr \\|int_parser|&\\|T|\cr \\|int_parser(num)|&\\|T|\cr } \section{Real Number Parsers} \paralign to\hsize{% #\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\cr \\|lit(num)|&Real Number Literal&\unused\cr \\|float_|&Float&\\|float|\cr \\|float_(num)|&Float Value&\\|float|\cr \\|double_|&Double&\\|double|\cr \\|double_(num)|&Double Value&\\|double|\cr \\|long_double|&Long Double&\\|long double|\cr \\|long_double(num)|&Long Double Value&\\|long double|\cr } \section{Generalized Real Number Parser} \paralign to\hsize{% #\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\cr \\|real_parser|&\\|T|\cr \\|real_parser(num)|&\\|T|\cr } \section{Boolean Parsers} \paralign to\hsize{% #\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\cr \\|lit(boolean)|&Boolean Literal&\unused\cr \\|false_|&Match ``\\|false|''&\\|bool|\cr \\|true_|&Match ``\\|true|''&\\|bool|\cr \\|bool_|&Boolean&\\|bool|\cr \\|bool_(boolean)|&Boolean Value&\\|bool|\cr } \section{Generalized Boolean Parser} \paralign to\hsize{% #\hfil\SPC\tabskip=0pt plus 1 fil &#\hfil\cr \\|bool_parser|&\\|T|\cr \\|bool_parser(boolean)|&\\|T|\cr } \copyrightnotice \bye