Download JFlex User`s Manual
Transcript
4.2.7 Character sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.2.8 Line, character and column counting . . . . . . . . . . . . . . . . . . . 17 4.2.9 Obsolete JLex options . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 4.2.10 State declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 4.2.11 Macro definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 4.3 Lexical rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 4.3.1 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 4.3.2 Semantics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 4.3.3 How the input is matched . . . . . . . . . . . . . . . . . . . . . . . . . 23 4.3.4 Scanner methods and variables accessible in actions . . . . . . . . . . 23 5 A few words on performance 25 5.1 Comparison of JLex and JFlex . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 5.2 How to write a faster specification . . . . . . . . . . . . . . . . . . . . . . . . 27 6 Porting Issues 28 6.1 Porting from JLex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 6.2 Porting from lex/flex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 6.2.1 Basic structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 6.2.2 Macros and Regular Expression Syntax . . . . . . . . . . . . . . . . . . 30 6.2.3 Lexical States . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 6.2.4 Lexical Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 7 Working together: JFlex and CUP 31 7.1 CUP version 0.10j . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 7.2 Using existing JFlex/CUP specifications with CUP 0.10j . . . . . . . . . . . . . 31 7.3 Using older versions of CUP . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 8 Bugs and Deficiencies 34 8.1 Deficiencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 8.2 Bugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 9 Copying and License 34 2