html2 flex: a fast lexical analyzer generator: flex: a fast lexical analyzer generator
[Top] [Contents] [Index] [ ? ]

flex: a fast lexical analyzer generator

This manual describes flex, a tool for generating programs that perform pattern-matching on text. The manual includes both tutorial and reference sections.

This edition of The flex Manual documents flex version 2.5.31. It was last updated on 27 March 2003.

1. Copyright  
2. Reporting Bugs  
3. Introduction  
4. Some Simple Examples  
5. Format of the Input File  
6. Patterns  
7. How the Input Is Matched  
8. Actions  
9. The Generated Scanner  
10. Start Conditions  
11. Multiple Input Buffers  
12. End-of-File Rules  
13. Miscellaneous Macros  
14. Values Available To the User  
15. Interfacing with Yacc  
16. Scanner Options  
17. Performance Considerations  
18. Generating C++ Scanners  
19. Reentrant C Scanners  
20. Incompatibilities with Lex and Posix  
21. Memory Management  
22. Serialized Tables  
23. Diagnostics  
24. Limitations  
25. Additional Reading  
FAQ  
A. Appendices  
Indices  
-- The Detailed Node Listing ---
Format of the Input File
5.1 Format of the Definitions Section  
5.2 Format of the Rules Section  
5.3 Format of the User Code Section  
5.4 Comments in the Input  
Scanner Options
16.1 Options for Specifing Filenames  
16.2 Options Affecting Scanner Behavior  
16.3 Code-Level And API Options  
16.4 Options for Scanner Speed and Size  
16.5 Debugging Options  
16.6 Miscellaneous Options  
Reentrant C Scanners
19.1 Uses for Reentrant Scanners  
19.2 An Overview of the Reentrant API  
19.3 Reentrant Example  
19.4 The Reentrant API in Detail  
19.5 Functions and Macros Available in Reentrant C Scanners  
The Reentrant API in Detail
19.4.1 Declaring a Scanner As Reentrant  
19.4.2 The Extra Argument  
19.4.3 Global Variables Replaced By Macros  
19.4.4 Init and Destroy Functions  
19.4.5 Accessing Variables with Reentrant Scanners  
19.4.6 Extra Data  
19.4.7 About yyscan_t  
Memory Management
21.1 The Default Memory Management  
21.2 Overriding The Default Memory Management  
21.3 A Note About yytext And Memory  
Serialized Tables
22.1 Creating Serialized Tables  
22.2 Loading and Unloading Serialized Tables  
22.3 Tables File Format  
FAQ
When was flex born?  
How do I expand \ escape sequences in C-style quoted strings?  
Why do flex scanners call fileno if it is not ANSI compatible?  
Does flex support recursive pattern definitions?  
How do I skip huge chunks of input (tens of megabytes) while using flex?  
Flex is not matching my patterns in the same order that I defined them.  
My actions are executing out of order or sometimes not at all.  
How can I have multiple input sources feed into the same scanner at the same time?  
Can I build nested parsers that work with the same input file?  
How can I match text only at the end of a file?  
How can I make REJECT cascade across start condition boundaries?  
Why can't I use fast or full tables with interactive mode?  
How much faster is -F or -f than -C?  
If I have a simple grammar can't I just parse it with flex?  
Why doesn't yyrestart() set the start state back to INITIAL?  
How can I match C-style comments?  
The '.' isn't working the way I expected.  
Can I get the flex manual in another format?  
Does there exist a "faster" NDFA->DFA algorithm?  
How does flex compile the DFA so quickly?  
How can I use more than 8192 rules?  
How do I abandon a file in the middle of a scan and switch to a new file?  
How do I execute code only during initialization (only before the first scan)?  
How do I execute code at termination?  
Where else can I find help?  
Can I include comments in the "rules" section of the file?  
I get an error about undefined yywrap().  
How can I change the matching pattern at run time?  
How can I expand macros in the input?  
How can I build a two-pass scanner?  
How do I match any string not matched in the preceding rules?  
I am trying to port code from AT&T lex that uses yysptr and yysbuf.  
Is there a way to make flex treat NULL like a regular character?  
Whenever flex can not match the input it says "flex scanner jammed".  
Why doesn't flex have non-greedy operators like perl does?  
Memory leak - 16386 bytes allocated by malloc.  
How do I track the byte offset for lseek()?  
25.1 How do I use my own I/O classes in a C++ scanner?  
How do I skip as many chars as possible?  
deleteme00  
Are certain equivalent patterns faster than others?  
Is backing up a big deal?  
Can I fake multi-byte character support?  
deleteme01  
Can you discuss some flex internals?  
unput() messes up yy_at_bol  
The | operator is not doing what I want  
Why can't flex understand this variable trailing context pattern?  
The ^ operator isn't working  
Trailing context is getting confused with trailing optional patterns  
Is flex GNU or not?  
ERASEME53  
I need to scan if-then-else blocks and while loops  
ERASEME55  
ERASEME56  
ERASEME57  
Is there a repository for flex scanners?  
How can I conditionally compile or preprocess my flex input file?  
Where can I find grammars for lex and yacc?  
I get an end-of-buffer message for each character scanned.  
unnamed-faq-62  
unnamed-faq-63  
unnamed-faq-64  
unnamed-faq-65  
unnamed-faq-66  
unnamed-faq-67  
unnamed-faq-68  
unnamed-faq-69  
unnamed-faq-70  
unnamed-faq-71  
unnamed-faq-72  
unnamed-faq-73  
unnamed-faq-74  
unnamed-faq-75  
unnamed-faq-76  
unnamed-faq-77  
unnamed-faq-78  
unnamed-faq-79  
unnamed-faq-80  
unnamed-faq-81  
unnamed-faq-82  
unnamed-faq-83  
unnamed-faq-84  
unnamed-faq-85  
unnamed-faq-86  
unnamed-faq-87  
unnamed-faq-88  
unnamed-faq-90  
unnamed-faq-91  
unnamed-faq-92  
unnamed-faq-93  
unnamed-faq-94  
unnamed-faq-95  
unnamed-faq-96  
unnamed-faq-97  
unnamed-faq-98  
unnamed-faq-99  
unnamed-faq-100  
unnamed-faq-101  
Appendices
A.1 Makefiles and Flex  
A.2 C Scanners with Bison Parsers  
A.3 M4 Dependency  
Indices
Concept Index  
Index of Functions and Macros  
Index of Variables  
Index of Data Types  
Index of Hooks  
Index of Scanner Options  



This document was generated by root on April, 11 2004 using texi2html