Download JFlex User`s Manual

Transcript
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
15
16
17
17
18
18
19
20
20
21
21
22
22
24
28
29
29
5 Encodings, Platforms, and Unicode
5.1 The Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.2 Scanning text files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.3 Scanning binaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31
31
32
33
6 Conformance with Unicode Regular Expressions UTS#18
34
7 A few words on performance
36
8 Porting Issues
8.1 Porting from JLex . . . . . . . . . . .
8.2 Porting from lex/flex . . . . . . . . . .
8.2.1 Basic structure . . . . . . . . .
8.2.2 Macros and Regular Expression
8.2.3 Lexical Rules . . . . . . . . . .
.
.
.
.
.
37
37
38
38
39
39
.
.
.
.
.
39
39
39
40
40
41
10 Bugs and Deficiencies
10.1 Deficiencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.2 Bugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
43
43
43
11 Copying and License
44
4.3
4.2.2 Scanning method . . . . . . . . . . . . .
4.2.3 The end of file . . . . . . . . . . . . . .
4.2.4 Standalone scanners . . . . . . . . . . .
4.2.5 CUP compatibility . . . . . . . . . . . .
4.2.6 BYacc/J compatibility . . . . . . . . . .
4.2.7 Code generation . . . . . . . . . . . . .
4.2.8 Character sets . . . . . . . . . . . . . .
4.2.9 Line, character and column counting . .
4.2.10 Obsolete JLex options . . . . . . . . . .
4.2.11 State declarations . . . . . . . . . . . .
4.2.12 Macro definitions . . . . . . . . . . . . .
Lexical rules . . . . . . . . . . . . . . . . . . . .
4.3.1 Syntax . . . . . . . . . . . . . . . . . . .
4.3.2 Semantics . . . . . . . . . . . . . . . . .
4.3.3 How the input is matched . . . . . . . .
4.3.4 The generated class . . . . . . . . . . .
4.3.5 Scanner methods and fields accessible in
. . . . .
. . . . .
. . . . .
Syntax
. . . . .
9 Working together
9.1 JFlex and CUP . . . . . . . . . . . . . . . . . .
9.1.1 CUP version 0.10j and above . . . . . .
9.1.2 Custom symbol interface . . . . . . . . .
9.1.3 Using existing JFlex/CUP specifications
9.2 JFlex and BYacc/J . . . . . . . . . . . . . . . .
2
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
actions (API)
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. . .
. . .
. . .
with
. . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. . .
. . .
. . .
CUP
. . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. . . .
. . . .
. . . .
0.10j .
. . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.