1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
---|
2 | <html> |
---|
3 | <head> |
---|
4 | <title>Escape Character Parser</title> |
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
---|
6 | <link href="theme/style.css" rel="stylesheet" type="text/css"> |
---|
7 | </head> |
---|
8 | |
---|
9 | <body> |
---|
10 | <table width="100%" border="0" background="theme/bkd2.gif" cellspacing="2"> |
---|
11 | <tr> |
---|
12 | <td width="10" height="49"> <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b> </b></font></td> |
---|
13 | <td width="85%" height="49"> <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>Escape Character Parser</b></font></td> |
---|
14 | <td width="112" height="49"><a href="http://spirit.sf.net"><img src="theme/spirit.gif" width="112" height="48" align="right" border="0"></a></td> |
---|
15 | </tr> |
---|
16 | </table> |
---|
17 | <br> |
---|
18 | <table border="0"> |
---|
19 | <tr> |
---|
20 | <td width="10"></td> |
---|
21 | <td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> |
---|
22 | <td width="30"><a href="switch_parser.html"><img src="theme/l_arr.gif" width="20" height="19" border="0"></a></td> |
---|
23 | <td width="30"><a href="loops.html"><img src="theme/r_arr.gif" border="0"></a></td> |
---|
24 | </tr> |
---|
25 | </table> |
---|
26 | <p><a name="escape_char_parser"></a>The Escape Character Parser is a utility |
---|
27 | parser, which parses escaped character sequences used in C/C++, |
---|
28 | LEX or Perl regular expressions. Combined with the confix_p utility parser, it is useful for parsing C/C++ strings containing double quotes and other escaped |
---|
29 | characters:</p> |
---|
30 | <pre> confix_p<span class="special">(</span><em class="literal">'"'</em><span class="special">,</span> <span class="special">*</span>c_escape_ch_p<span class="special">,</span> <em><span class="literal">'"</span></em><span class="literal"><em>'</em></span><span class="special">)</span></pre> |
---|
31 | <p>There are two different types of the Escape Character Parser: |
---|
32 | <tt>c_escape_ch_p</tt>, which parses C/C++ escaped character sequences and |
---|
33 | <tt>lex_escape_ch_p</tt>, which parses LEX style escaped character sequences. |
---|
34 | The following table shows the valid character sequences understood by these |
---|
35 | utility parsers.</p> |
---|
36 | <table width="90%" border="0" align="center"> |
---|
37 | <tr> |
---|
38 | <td colspan="2" class="table_title"><b>Summary of valid escaped character |
---|
39 | sequences</b></td> |
---|
40 | </tr> |
---|
41 | <tr> |
---|
42 | <td width="29%" height="27" class="table_cells"><b>c_escape_ch_p</b></td> |
---|
43 | <td width="71%" class="table_cells"><p><code>\b, \t, \n, \f, \r, \\, \", |
---|
44 | \', \xHH, \OOO</code><br> |
---|
45 | where: H is some hexadecimal digit (0..9, a..f, A..F) and O is some octal |
---|
46 | digit (0..7)</p></td> |
---|
47 | </tr> |
---|
48 | <tr> |
---|
49 | <td height="27" class="table_cells"><strong>lex_escape_ch_p</strong></td> |
---|
50 | <td class="table_cells"> |
---|
51 | <p>all C/C++ escaped character sequences as described above and additionally |
---|
52 | any other character, which follows a backslash</p> |
---|
53 | </td> |
---|
54 | </tr> |
---|
55 | </table> |
---|
56 | <p>If there is a semantic action attached directly to the Escape Character Parser, |
---|
57 | all valid escaped characters are converted to their character equivalent |
---|
58 | (i.e. a backslash followed by a 'r' is converted to '\r'), which is |
---|
59 | fed to the attached actor. The number of hexadecimal |
---|
60 | or octal digits parsed depends on the size of one input character. An |
---|
61 | overflow will be detected and will generate a non-match. lex_escape_ch_p |
---|
62 | will strip the leading backslash for all character |
---|
63 | sequences which are not listed as valid C/C++ escape sequences when passing |
---|
64 | the unescaped character to an attached action.</p> |
---|
65 | <p>Please note though, that if there is a semantic action attached to an |
---|
66 | outermost parser (for instance as in <tt>(*c_escape_ch_p)[some_actor]</tt>, |
---|
67 | where the action is attached to the kleene star generated parser) no conversion |
---|
68 | takes place at the moment, but nevertheless the escaped characters are parsed |
---|
69 | correctly. This limitation will be removed in a future version of the library.</p> |
---|
70 | <table border="0"> |
---|
71 | <tr> |
---|
72 | <td width="10"></td> |
---|
73 | <td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> |
---|
74 | <td width="30"><a href="switch_parser.html"><img src="theme/l_arr.gif" width="20" height="19" border="0"></a></td> |
---|
75 | <td width="30"><a href="loops.html"><img src="theme/r_arr.gif" border="0"></a></td> |
---|
76 | </tr> |
---|
77 | </table> |
---|
78 | |
---|
79 | <br> |
---|
80 | <hr size="1"> |
---|
81 | <p class="copyright">Copyright © 2001-2002 Daniel C. Nuffer<br> |
---|
82 | Copyright © 2003 Hartmut Kaiser <br> |
---|
83 | <br> |
---|
84 | <font size="2">Use, modification and distribution is subject to the Boost Software |
---|
85 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
---|
86 | http://www.boost.org/LICENSE_1_0.txt) </font> </p> |
---|
87 | </body> |
---|
88 | </html> |
---|