Codebase list flexc++ / a819655
New upstream version 2.09.01 Frank B. Brokken 3 years ago
6 changed file(s) with 54 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
0 #define VERSION "2.09.00"
0 #define VERSION "2.09.01"
11 #define YEARS "2008-2021"
0 flexc++ (2.09.01)
1
2 * Added a section about how to handle character constants to the
3 flexc++input(7) man-page.
4
5 -- Frank B. Brokken <f.b.brokken@rug.nl> Thu, 18 Mar 2021 11:33:54 +0100
6
07 flexc++ (2.09.00)
18
29 * When switching streams the current working directory is changed to
0
1 Character constants are surrounded by single quote characters. They match
2 single characters which, however, can be specified in various ways.
3 itemization(
4 it() The simplest form consists of just a single character: the pattern
5 tt('a') matches the character tt(a), the pattern tt('.') matches the
6 dot-character (tt(.) thus loses its meaning of `any character but
7 the newline character');
8 it() Standard escape characters (like tt('\n', '\f', '\b')) are converted
9 to their (single character) ascii-values, matching those characters
10 when they are encountered in the input. Therefore, of the following
11 two rules the second is never matched (with flc() generating a
12 corresponding warning, since both match the newline character):
13 verb(
14 '\n' return 1;
15 \n return 2;
16 )
17 it() Octal numbers, starting with a backslash and consisting of three
18 octal digits are converted to a number matching input characters of
19 those numbers. E.g., tt('\101') is converted to 65, matching ascii
20 character tt(A);
21 it() Likewise, hexadecimal numbers, starting with tt(x) and followed by
22 two hexadecimal digits are converted to a number matching input
23 characters whose values equal those numbers. E.g., tt('\x41') is also
24 matching ascii character tt(A);
25 it() Other escaped single characters match those characters. E.g.,
26 tt('\\') matches the single backslash, tt('\'') matches the single
27 quote character. But also: tt('\F') matches the single tt(F)
28 character, since no special escaped meaning is associated with tt(F).
29 )
30
31 Considering the above, to match character (in this example: except for the
32 newline character) including its surrounding quotes a regular expression
33 consisting of an escaped quote character, followed by any character, followed
34 by a quote character can be used:
35 verb(
36 \'.' // matches characters surrounded by quotes
37 )
256256 subsequent character (ranges) are added to the set, until the final closing
257257 bracket (tt(])) has been reached.
258258
259 bf(Character constants)
260
261 includefile(../charconsts.yo)
262
259263 bf(Operator precedence)
260264
261265 The regular expressions listed above are grouped according to precedence, from
8484 lsect(patterns)(Patterns)
8585 includefile(lexer/patterns)
8686
87 sect(Character constants)
88 includefile(../charconsts)
89
8790 lsect(actions)(Actions)
8891 includefile(lexer/actions)
8992
0 NOUSERMACRO(postCode)
0 NOUSERMACRO(postCode cwd)
11
22 The tt(Scanner) class offers the following members, which can be called from
33 within actions (or by members called from