3 Commits
Author SHA1 Message Date
Will Estes 4322cc82f3 html from #95 2016-10-22 09:41:09 -04:00
Will Estes a49c591c86 manual: import current manual 2016-10-20 20:35:50 -04:00
Will Estes 6c668b89ca clear out source code 2016-10-20 20:31:27 -04:00
520 changed files with 30752 additions and 79003 deletions
-15
View File
@@ -1,15 +0,0 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
groups:
github-actions:
patterns:
- "*"
-1
View File
@@ -1 +0,0 @@
github: westes
-31
View File
@@ -1,31 +0,0 @@
name: Build and Test
on:
push:
branches: [ master ]
tags-ignore:
- 'v*'
pull_request:
branches: [ master ]
permissions: read-all
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: apt
run: sudo apt-get update && sudo apt-get install -y gcc autoconf automake libtool gettext autopoint bison help2man lzip texinfo texlive
- name: autogen
run: ./autogen.sh
- name: configure
run: ./configure
- name: make
run: make
- name: make check
run: make check
- name: make distcheck
run: make distcheck
-83
View File
@@ -1,83 +0,0 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
schedule:
- cron: '39 5 * * 5'
permissions: {}
jobs:
analyze:
name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ubuntu-22.04
timeout-minutes: 240
permissions:
# required for all workflows
security-events: write
# required to fetch internal or private CodeQL packs
packages: read
# only required for workflows in private repositories
actions: read
contents: read
strategy:
fail-fast: false
matrix:
include:
- language: c-cpp
build-mode: autobuild
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
# Ensure autopoint is installed. CodeQL misses it sometimes.
- name: apt
run: sudo apt-get update && sudo apt-get install -y gcc autoconf automake libtool gettext autopoint bison help2man lzip texinfo texlive
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
with:
category: "/language:${{matrix.language}}"
-90
View File
@@ -1,90 +0,0 @@
name: Nightly
on:
schedule:
- cron: '04 00 * * *'
workflow_dispatch:
permissions: {}
jobs:
nightly:
name: Run a Nightly Build and Save the Artifacts
runs-on: ubuntu-22.04
outputs:
update_needed: ${{ steps.update.outputs.needed }}
version_slug: ${{ steps.update.outputs.slug }}
version: ${{ steps.version.outputs.version }}
permissions:
actions: read
contents: write
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Check time since last commit
id: update
run: |
slug=$(git log -n 1 --pretty='format:%h-%as')
echo "slug=$slug" >> $GITHUB_OUTPUT
authorDate=$(echo $slug | cut -d '-' -f 2-4)
update=1
[ $(( $(date +%s) - $(date --date=$authorDate +%s) )) -ge 172800 ] && echo "::notice title=No Changes::No changes within the last two days. Skipping nightly build." && update=0
echo "needed=$update" >> $GITHUB_OUTPUT
- name: Change version number
id: version
env:
slug: ${{ steps.update.outputs.slug }}
update_needed: ${{ steps.update.outputs.needed }}
if: ${{ env.update_needed == 1 }}
run: |
ver=$(sed -n "s/^\(AC_INIT.*generator\],\)\[\(.*\)\]\(,\[flex-help.*\)$/\2/p" $GITHUB_WORKSPACE/configure.ac)
ver=${ver#v}
ver=${ver%-*}
ver=$ver-$slug
echo "version=$ver" >> $GITHUB_OUTPUT
sed -i "s/^\(AC_INIT.*generator\],\)\(.*\)\(,\[flex-help.*\)$/\1[$ver]\3/" $GITHUB_WORKSPACE/configure.ac
- name: apt
env:
update_needed: ${{ steps.update.outputs.needed }}
if: ${{ env.update_needed == 1 }}
run: sudo apt-get update && sudo apt-get install -y gcc autoconf automake libtool gettext autopoint bison help2man lzip texinfo texlive
- name: Update CHANGE_LOG
env:
update_needed: ${{ steps.update.outputs.needed }}
if: ${{ env.update_needed == 1 }}
run: |
./tools/git2cl > $GITHUB_WORKSPACE/ChangeLog
- name: build
env:
update_needed: ${{ steps.update.outputs.needed }}
if: ${{ env.update_needed == 1 }}
run: |
./autogen.sh
./configure
make
make distcheck
- name: Make Git archives
env:
ver: ${{ steps.version.outputs.version }}
update_needed: ${{ steps.update.outputs.needed }}
if: ${{ env.update_needed == 1 }}
run: |
git archive -o $ver.src.tar.gz --prefix=flex-$ver/ HEAD
TZ=America/Los_Angeles git archive -o $ver.src.zip --prefix=flex-$ver/ HEAD
echo "SOURCE_GZ=$(echo $ver.src.tar.gz)" >> $GITHUB_ENV
echo "SOURCE_ZIP=$(echo $ver.src.zip)" >> $GITHUB_ENV
- name: Get artifact names
env:
ver: ${{ steps.version.outputs.version }}
update_needed: ${{ steps.update.outputs.needed }}
if: ${{ env.update_needed == 1 }}
run: |
echo "ARTIFACT_GZ=$(echo flex-$ver.tar.gz)" >> $GITHUB_ENV
echo "ARTIFACT_LZ=$(echo flex-$ver.tar.lz)" >> $GITHUB_ENV
- name: Upload Artifacts to Nightlies Release
id: upload-nightly-artifacts
env:
update_needed: ${{ steps.update.outputs.needed }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ env.update_needed == 1 }}
run: |
gh release upload nightlies ${{ env.ARTIFACT_GZ }} ${{ env.ARTIFACT_LZ }} ${{ env.SOURCE_GZ }} ${{ env.SOURCE_ZIP }} --clobber
-24
View File
@@ -1,24 +0,0 @@
*.orig
*.rej
*.sig
*.tar.gz
*.tar.lz
*~
.deps
.libs
ABOUT-NLS
ChangeLog
Makefile
Makefile.in
aclocal.m4
autom4te.cache
autoscan.log
build-aux/
config.log
config.status
configure
configure.scan
flex-*/
libtool
m4/
stamp-*
Vendored
-15
View File
@@ -1,15 +0,0 @@
--blank-lines-after-declarations
--blank-lines-after-procedures
-br /* open braces on same line */
-nce /* start else on new line */
-nbc /* vars on same line */
-di8 /* line up var decl at col 8 */
-brs /* struct brace on same line */
-i8 /* indent 4 */
-lp /* line up parens */
-ts8 /* tab stop */
-bbo /* break before && || */
-hnl /* honor newlines */
--space-special-semicolon
--line-length75
--dont-break-procedure-type
-50
View File
@@ -1,50 +0,0 @@
Aaron Stone <sodabrew@users.sourceforge.net>
Akim Demaille <akim@lrde.epita.fr>
Alastair Hughes <hobbitalastair@gmail.com>
Alex Kennedy <alexzanderkennedy@gmail.com>
Alexis La Goutte <alexis.lagoutte@gmail.com>
Bastian Köcher <git@kchr.de>
Christoph Junghans <ottxor@gentoo.org>
Christos Zoulas <christos@zoulas.com>
Cyril Brulebois <kibi@debian.org>
Demi Obenour <demiobenour@gmail.com>
Dennis Clarke <dclarke@blastwave.org>
Egor Pugin <egor.pugin@gmail.com>
Elias Pipping <pipping@users.sourceforge.net>
Explorer09 <explorer09@gmail.com>
Hans-Bernhard Broeker <HBBroeker@T-Online.de>
Harald van Dijk <harald@gigawatt.nl>
Hugh Sasse <hgs@dmu.ac.uk>
Jaska Uimonen <jaska.uimonen@helsinki.fi>
Jeff Smith <whydoubt@gmail.com>
John Millaway <john43@users.sourceforge.net>
Manoj Srivastava <srivasta@golden-gryphon.com>
Mariusz Pluciński <mplucinski@mplucinski.com>
Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Michael McConville <mmcconville@mykolab.com> <mmcco@mykolab.com>
Michael Reed <m.reed@mykolab.com>
Michael van Elst <mlelstv@NetBSD.org>
Mightyjo <mightyjo@gmail.com>
Mike Frysinger <vapier@gentoo.org>
OBATA Akio <obache@NetBSD.org>
Robert Larice <Robert.Larice@t-online.de> rlar <rlar>
Robert Larice <Robert.Larice@t-online.de> Robert.Larice Robert Larice <Robert.Larice@t-online.de>
Robert Minsk <rminsk@users.sourceforge.net>
Samuel Thibault <samuel.thibault@ens-lyon.org>
Sean McBride <sean@rogue-research.com>
Serguey Parkhomovsky <sergueyparkhomovsky@gmail.com> <xindigo@gmail.com>
Simon Sobisch <simonsobisch@web.de>
Stefan Reinauer <stefan.reinauer@coreboot.org>
Thomas Klausner <wiz@NetBSD.org>
Till Varoquaux <till.varoquaux@gmail.com>
Tobias Klauser <tklauser@distanz.ch>
Todd C. Miller <Todd.Miller@courtesan.com>
Translation Project <coordinator@translationproject.org> <coordinators@translationproject.org>
Translation Project <coordinator@translationproject.org> <translation@translationproject.org>
Vern Paxson <vern@ee.lbl.gov>
Will Estes <westes575@gmail.com> <wlestes@users.sourceforge.net>
Yuri <yuri@tsoft.com>
luistung <dongliang1986@gmail.com>
lukeallardyce <lukeallardyce@users.sourceforge.net>
nomis52 <nomis52@users.sourceforge.net>
viktor.shepel <shepelvictor@bigmir.net>
-1
View File
@@ -1 +0,0 @@
2.6.4
-16
View File
@@ -1,16 +0,0 @@
In 2001, Will Estes took over as maintainer of flex.
John Millaway is a co-author of the current version of flex. He has
contributed a large number of new features, fixed a large number of
outstanding bugs and has made significant contributions to the flex
documentation.
Aaron Stone has contributed several bug fixes to the flex codebase.
Vern Paxson wrote flex with the help of many ideas and much
inspiration from Van Jacobson. Original version by Jef Poskanzer.
The fast table representation is a partial implementation of a design
done by Van Jacobson. The implementation was done by Kevin Gong and
Vern Paxson.
-5
View File
@@ -1,5 +0,0 @@
# Contributor Code of Conduct
This project adheres to No Code of Conduct. We are all adults. We accept anyone's contributions. Nothing else matters.
For more information please visit the [No Code of Conduct](https://github.com/domgetter/NCoC) homepage.
-199
View File
@@ -1,199 +0,0 @@
# CONTRIBUTING to Flex
## Introduction
Thank you for your interest in contributing to Flex! Flex's [issue
tracker](https://github.com/westes/flex/issues) is on GitHub. That's
the best place to find a task that needs attention. It's also the best
place to check whether a problem you've found is known to the
community.
## Baseline Build Environment
The maintenance baseline build environment is Ubuntu 20.04 LTS.
Flex needs a previous version of itself in order to build a new
version of itself. You can either install an operating system package
of flex, or you can build flex from one of the release tar balls.
Configuring your Flex development environment to match the maintenance
baseline will help you collaborate and review contributions with the
other developers working on Flex. See the
[INSTALL](https://github.com/westes/flex/blob/master/INSTALL.md) for
programs required to build flex from scratch.
## Branching Convention
Flex source code is maintained in Git at GitHub. Each Flex developer
forks their own copy of the main repository at
[westes/flex](https://github.com/westes/flex). Flex development occurs
in feature branches of the forks. PRs will eventually be submitted
from the feature branches of the forks to westes/flex.
Flex development forks are not required to reside on GitHub. However:
- GitHub's pull request (PR) process only works with repositories
hosted on GitHub;
- Flex's automated testing pipeline depends on GitHub's Actions
infrastructure and may not function on other Git servers.
Therefore, if your fork of flex resides outside of github, you may
wish to submit your patches via email, using standard git mechanisms.
## Preparing Your Commits
Small PRs are easier to review and merge. Minimize the scope of the
changes in a single PR within reason. Changes that touch one or two
files are likely to be reviewed and accepted more quickly than changes
that touch every file in Flex. Your pull request should do one atomic
thing unless there is a really good reason for your pull request to do
more than one thing.
Format your commit messages following [Conventional Commits
1.0.0](https://www.conventionalcommits.org/en/v1.0.0/) (CC BY 3.0
netlify.com). Briefly:
```
<type>[(optional scope)][!]: <description>
[BLANK LINE]
[optional body]
[BLANK LINE]
[optional footer(s)]
```
A typical commit message might look like:
```
docs: Add CONTRIBUTING manual
Refs: #1234
```
The description should summarize the changes in a single, short
sentence. The description should be written in the imperative mood,
like the descriptions of the types below.
The primary types are:
- build: Change the build system, including tracking external dependencies
- ci: Change the CI/CD system
- docs: Update the package documentation
- feat: Add a new feature
- fix: Fix a bug or incorrect behavior
- perf: Improve performance of a feature
- refactor: Simplify maintainability without affecting performance or behavior
- revert: Revert a previous commit
- style: Correct a style mismatch (indentation, etc.)
- test: Change or add to the test suite
The optional scope must appear in parentheses and must consist of a
noun describing the section of the code base that was changed.
```
docs(contrib): Update URLs in CONTRIBUTING manual
```
The optional `!` must appear before the description whenever the
commit introduces a breaking change - one that breaks compatibility
with previous versions of the code base. Whenever the `!` marker
appears, a BREAKING-CHANGE footer should also be included.
The optional body may be included to provid additional information
or context about the change. If it appears, it must be preceded by a
blank line.
The optional footers may be included to provide additional referential
information and links to tracked issues, PRs, etc. Each footer must be
preceded by a blank line. Footers must be formatted as `<footer-type>:
<description>`, similar to the first line of commit messages. The
description's format depends upon the footer-type. Known footer-types
include:
- Refs: A comma-separated list of commit hashes and/or issue and PR numbers. Issue and PR numbers must be prefixed with a `#`.
- BREAKING-CHANGE: A description of the change that breaks compatibility with previous versions of the code, including the version number at which compatibility is broken.
A breaking change commit message might look like:
```
feat!: Switch to quantum scanner
BREAKING-CHANGE: New scanner runs in constant time but doesn't support any existing hardware.
Breaks compatibility with 1.0.0.
```
Squash your commits so that each commit is an atomic change. This aids
discussion and revision during the review process. In particular,
there should be no commits that fixup prior commits.
## Submitting PRs
Before submitting a PR to flex, test your changes either locally or
using the GitHub Actions pipeline.
### Testing locally
1. Commit and/or stash your changes.
1. Clean your working copy using
```
git clean -xdf
```
1. Build flex following the directions in [INSTALL](https://www.github.com/westes/flex/blob/master/INSTALL.md).
1. Run both the `make check` and `make distcheck` targets.
### Testing with GitHub Actions
If you created a fork of Flex on GitHub, any PR you make to your own
main branch will trigger the build and test pipeline.
1. Commit your changes.
1. Push your local branch to your remote at GitHub. Assuming your GitHub remote is called origin:
```
git push origin feature_branch
```
To submit a pull request through GitHub's web interface:
1. Open your GitHub Flex repository in your web browser.
1. Click the 'Pull requests' link.
1. Click the 'New pull request' button.
1. Change the 'base repository' from 'westes/flex' to your fork.
1. Change the 'base' branch to 'master' if it isn't already set.
1. Change the 'compare' branch to your feature branch.
1. Click the 'Create pull request' button.
1. Click the 'Actions' link to monitor the progress of your build and test job.
### Submitting PRs to westes/flex
Sending a PR to westes/flex follows nearly the same process as sending one to your own main branch.
1. Commit your changes.
1. Push your local branch to your remote at GitHub. Assuming your GitHub remote is called origin:
```
git push origin feature_branch
```
To use GitHub's web interface:
1. Open your GitHub Flex repository in your web browser.
1. Click the 'Pull requests' link.
1. Click the 'New pull request' button.
1. Change the 'base repository' to 'westes/flex'.
1. Change the 'base' branch to 'master' if it isn't already set.
1. Change the 'compare' branch to your feature branch.
1. Click the 'Create pull request' button.
1. Add notes to your PR including
- A title or commit-like message
- A summary of the commits in your pull request
- Issue numbers your PR covers
- Links to your GitHub Actions test results or a copy of the last few lines of output from your local test results.
If this is your first contribution to Flex, execution of the Actions
pipeline will have to be manually approved by the maintainer. If you
are a returning contributor, you can click the Actions link to watch
your job run.
Keep an eye on your PR's discussion page and your email for review
notes and questions from other developers.
Thanks for contributing!
-42
View File
@@ -1,42 +0,0 @@
Flex carries the copyright used for BSD software, slightly modified
because it originated at the Lawrence Berkeley (not Livermore!) Laboratory,
which operates under a contract with the Department of Energy:
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007 The Flex Project.
Copyright (c) 1990, 1997 The Regents of the University of California.
All rights reserved.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.
This basically says "do whatever you please with this software except
remove this notice or take advantage of the University's (or the flex
authors') name".
Note that the "flex.skl" scanner skeleton carries no copyright notice.
You are free to do whatever you please with scanners generated using flex;
for them, you are not even bound by the above copyright.
-110
View File
@@ -1,110 +0,0 @@
# INSTALLING Flex
## Should you be here at all?
If building, developing or compiling C programs is new to you, you
probably want to use your operating system's standard means of
installing software to install flex. If you do not need the latest
features of flex, you probably just want to use your operating
system's standard means of installing software to obtain flex.
## Now that you know you should be here ...
If you are not familiar with bootstrapping C code from a git
repository or if GNU autotools seems like a jumble of tenuous
incantationery to you, then make sure that you downloaded one of the
release tar archives of flex. You can verify this by checking the
filename of what you downloaded. If it is something like
`flex-<version>.tar.<compressiontype>` then you have a release tar
archive. If you have a filename like `flex.tar.gz` or `flex.zip`, you
have a copy of the git repository and you didn't download the thing
you wanted to.
## Building from a release archive
To build flex from a release archive:
```bash
$ ./configure <any configure options you need>
$ make
```
To see what options are available from the configure script:
```bash
$ ./configure --help
```
Optionally run the test suite:
```bash
$ make check
```
To install the flex you just built:
```bash
$ make install
```
Note that you may want to make use of the DESTDIR argument on the
`make install` command line or that you may want to have used the
`--prefix` argument with configure (or mostly equivalently the
`prefix` argument on the make command line).
## Building from the git repository
To build from the git repository:
First, make sure you have a copy of flex installed somewhere on your
path so that configure can find it. You can usually do this with your
operating system's standard means of installing software. Sometimes,
you have to build from a recent release of flex, however. Using a
version of flex built from the flex codebase is always acceptable if
you have already bootstrapped doing so.
You will also need all the programs that flex needs in order to be
built from scratch:
* compiler suite - flex is built with gcc
* bash, or a good Bourne-style shell
* m4 - `m4 -P` needs to work; GNU m4 and a few others are suitable
* GNU bison; to generate parse.c from parse.y
* autoconf; for handling the build system
* automake; for Makefile generation
* libtool; often packaged with automake, but not always
* make; for running the generated Makefiles
* gettext; for i18n support
* help2man; to generate the flex man page
* tar, gzip, lzip, etc.; for packaging of the source distribution
* GNU texinfo; to build and test the flex manual. Note that if you want
to build the dvi/ps/pdf versions of the documentation you will need
texi2dvi and related programs, along with a sufficiently powerful
implementation of TeX to process them. See your operating system
documentation for how to achieve this. The printable versions of the
manual are not built unless specifically requested, but the targets
are included by automake.
* GNU indent; for indenting the flex source the way we want it done
* GNU sed; GNU extensions are used so other sed versions will not work
In cases where the versions of the above tools matter, the file
configure.ac will specify the minimum required versions.
Then:
```bash
$ ./autogen.sh
```
After autogen.sh finishes successfully, building flex follows the same
steps as building flex from a release archive.
Note that, in addition to `make check`, `make distcheck` builds a
release archive and builds and tests flex from inside a directory
containing only known distributed files.
If you have trouble building flex from git sources on non-Debian systems,
(e.g. MacOS) make sure that any required GNU tools have been added to
your PATH before your system defaults. Also check that required GNU tools
are aliased to their typical names - some package systems prefix them with
"gnu-" which make them hard for configure to find.
-98
View File
@@ -1,98 +0,0 @@
# This file is part of flex.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# Neither the name of the University nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE.
# Notes on building:
# Possible values for DEFS:
#
# By default, flex generates 8-bit scanners when using table compression,
# and 7-bit scanners when using uncompressed tables (-f or -F options).
# For flex to always generate 8-bit scanners, add "-DDEFAULT_CSIZE=256"
# to DEFS.
ACLOCAL_AMFLAGS = -I m4
dist_doc_DATA = \
AUTHORS \
COPYING \
NEWS \
ONEWS \
README.md
EXTRA_DIST = \
.indent.pro \
INSTALL.md \
CONTRIBUTING.md
dist_noinst_SCRIPTS = \
autogen.sh \
po/update_linguas.sh
SUBDIRS = \
src \
doc \
examples \
po \
tests \
tools
# Convenience targets to build libfl only
# These are actually wrappers around automake- and libtool-generated targets
libfl:
cd src && $(MAKE) $(AM_MAKEFLAGS) libfl.la libfl.pc
install-libfl:
cd src && \
$(MAKE) $(AM_MAKEFLAGS) lib_LTLIBRARIES=libfl.la \
pkgconfig_DATA=libfl.pc install-libLTLIBRARIES install-pkgconfigDATA
uninstall-libfl:
cd src && \
$(MAKE) $(AM_MAKEFLAGS) \
lib_LTLIBRARIES=libfl.la pkgconfig_DATA=libfl.pc \
uninstall-libLTLIBRARIES uninstall-pkgconfigDATA
# libfl.pc is cleaned via 'distclean' target
clean-libfl:
cd src && \
$(MAKE) $(AM_MAKEFLAGS) lib_LTLIBRARIES=libfl.la clean-libLTLIBRARIES \
clean-libtool
# Create the ChangeLog, but only if we're inside a git working directory
ChangeLog: $(srcdir)/tools/git2cl
if [ -d $(srcdir)/.git ] ; then \
$(srcdir)/tools/git2cl > $@ \
; fi
indent:
cd src && $(MAKE) $(AM_MAKEFLAGS) indent
install-exec-hook:
cd $(DESTDIR)$(bindir) && \
$(LN_S) -f flex$(EXEEXT) flex++$(EXEEXT)
lint:
shellcheck -f gcc tests/*.sh src/*.sh *.sh
.PHONY: libfl install-libfl uninstall-libfl clean-libfl \
ChangeLog indent lint
-800
View File
@@ -1,800 +0,0 @@
flex NEWS
* Noteworthy changes in release ?.? (????-??-??) [?]
** build
*** Flex now includes its own <config.h> header before including
system headers so that any system specific features detected by
configure are taken into account during compilation of flex
itself.
*** The flex build system now includes Makefile targets at the top
level to allow just building and installing libfl.
*** The flex distribution now includes a file, src/libfl.pc, to allow
using pkgconfig to find out what flags to use when building
against libfl from flex.
*** Various edge cases, mostly involving out-of-tree builds have been
accounted for in the autotools build system.
*** A crash during building on NetBSD has been fixed.
*** Flex is now automatically built by travis-ci. That should increase
the visibility of bugs and help prevent regressions.
** documentation
*** new bg, eo, ka, pt, uk translations from the translation project
** scanner
*** Some memory leaks have been fixed.
*** A long standing bug that effected expressions of the form c{i,j}
where 'c' is a character and {i,j} describes the number of times
to match against 'c' when case sensitivity was turned on has been
fixed.
*** New option: --backup-file allows setting the name of the file
written containing backing up information. Useful if you need
backing up information from multiple scanners in the same
directory.
*** flex emits correct line number directives when line numbers refer
to the file containing the line number directives.
*** The options {no,}yy{get,set}_column are now supported.
** test
*** Generating the various tableoptions make rules is now more portable.
*** Tests of the options -C*f and -C*F will now run correctly on
filesystems that are not case sensitive.
* Noteworthy changes in release 2.6.4 (2017-05-06) [stable]
** build
*** The indent target now knows about flex's new (as of 2.6.0)
layout. The indent rules it would apply are not correct and do
need to be fixed.
*** The files included in the flex distribution are now built by the
version of flex that is included in the distribution.
*** The configure script has a better idea of which headers are
required to build flex. It will also error when missing functions
are detected.
*** We have lowered the versions of automake and gettext that
configure.ac lists as required for building flex. In autogen.sh,
we now check for how to call libtoolize and use what we find in
the rest of the script.
*** Since files in lib/ are picked up as needed by src/, we no longer
generate a Makefile for that directory.
*** Flex can be cross compiled.
** documentation
*** Some typos were removed from the manual.
** scanner
*** Some minor performance enhancements.
*** We honor user defined yy_* macros again. We are also more careful
to not leak macro definitions into header files.
*** A number of portability fixes were introduced so building flex is
more reliable on more platforms. Additionally, outdated function
calls were removed.
*** When building the flex executable itself, %# comments from
flex.skl are removed when generating the C source code array. This
reduces the size of flex.
** test suite
*** All scripts in the test suite are now run by $(SHELL) and the
needed portability fixes have been included.
*** Test suite dependencies are handled much better. This only matters
if you are actively developing flex or its test suite.
*** Tests that depend on platform dependent features now properly skip
when those platforms are not present.
*** When running "make check", you can now pas V=0 to silence more of
the build. This is useful when you're less concerned about the
details of building and linking the test programs themselves.
* Noteworthy changes in release 2.6.3 (2016-12-30) [stable]
** scanner
*** several bug fixes resolved problems introduced in recent flex
versions regarding processing of comments, literals and various
quoting scenarios.
*** If the path to m4 was sufficiently long, a buffer overflow could
occur. This has been resolved. The fix also removes dependence on
the constant PATH_MAX.
** build
*** A new configure option --disable-bootstrap changes the behavior of
the build system when building flex. The default
"--enable-bootstrap" behavior is to build flex, then to use that
flex to build flex again. With --disable-bootstrap, the scanner is
simply built by sedding the scanner source. This is friendlier to
cross compilation.
*** The compatibility functions in lib/ are no longer built as a
library. Instead, they are built as $(LIBOBJ) objects. This is
simpler and friendlier to cross compilation.
*** It is now possible to build flex without building the accompanying
libfl. This is friendlier to cross compilation. See the
--disable-libfl option to configure. Resolves #99.
*** the PIC version of libfl was not correctly built. It is no longer
included in the build/installation targets of flex since it was
unused.
*** the distributed man page is only rebuilt when the relevant source
files change or when the binary doesn't exist. In particular, this
is friendlier to cross compilation. Resolves #108
** test
*** the shell scripts in the test suite are more portable across different shell implementations.
* version 2.6.2 released 2016-10-24
** flex internals
*** a segfault involving yyrestart(NULL) has been fixed
*** flex should now handle quoting when mixed with m4 processing correctly
*** flex handles `[[' and `]]' correctly
*** flex no longer generates non-ANSI code
*** more compilation warnings were squashed in generated scanners
*** prevented a buffer overflow that could occur when input buffers were the exact wrong size
** test suite
*** input filenames on MSWindows are now calculated correctly
*** general code cleanups in a number of tests now make the test suite compile much more cleanly
** build system
*** the xz archive has been replaced with an lzip archive
*** a new option to configure --enable-warnings to encapsulate passing
of warning-related flags which is useful in testing flex
*** make indent now works for out of source builds
*** Portability warnings when generating Makefile.in files are now suppressed; they were just noise and the use of GNU extensions in Makefile.{am,in,} was intentional and well known.
** bugs
*** resolved gh#67
** new sv translation from the translation project
* version 2.6.1 released 2016-03-01
** flex resources
*** The flex project is now hosted at github. Consider this a "period of transition". In particular, you should start at https://github.com/westes/flex for the flex codebase, issue tracking and pull requests.
*** New releases of flex are to be found at https://github.com/westes/flex/releases.
** flex internals
*** Flex now uses more modern and more standard names for variable types. There's more work to be done on that front yet, though.
*** A number of compiler warnings have been remedied.
*** Line directives should now work as expected and be absent when that is expected.
** test suite
*** When running the test suite, c++ files are compiled with the c++ header inside the flex distribution, rather than relying on the build system's flex header , which might not be installed yet or which might be out of date with respect to what flex tests expect.
*** Some portability fixes in the test suite such as opening files for reading in binary mode
** Building flex
*** The file src/scan.c asdistributed with flex source is now built with the current version of flex. Occasionally this had to be done manually to pick up new flex features. It's now just a part of flex's build system.
*** The pdf version of the manual is no longer distributed with flex, although if you have the texinfo package installed, you can still build it.
*** lots of general build system cleanup
*** the build system tries a bit harder to find libtoolize and texi2dvi.
*** When help2man and texi2dvi are missing, the error messages are now much more helpful.
** bug fixes
*** resolved github issues #53, #54, #55, #61.
*** Resolved sf bugs #128, #129, #155, #160, #184, #187, #195.
* version 2.6.0 released 2015-11-17
** User Visible Changes
*** C++ scanners now use references instead of pointers. See the manual for details.
*** A number of compiler warnings were addressed, so flex generated scanners should be quieter under compiler warning scenarios.
*** Allow error reporting routines to accept varying number of arguments
*** Removed deprecated 'register' storage class specifier
*** Changed output formats from octal to hexadecimal
*** check limits before using array index cclp; resolves sf-166
*** Suppress clang warning about empty @param paragraph; resolves sf#158
*** Fixed malloc/realloc replacement, resolves sf bug#151.
*** Adjusted buffer sizes on ia64.
*** various documentation and code clean up fixes: resolves sf bugs #167, #168, among other patches.
** Flex Internals
*** flex is now organized into subdirectories. This keeps the tree neater at the top level and puts like things near each other and unlike things away from each other.
*** The test suite has been reorganized and is now run with the parallel test suite harness from automake.
*** Cleaned up the automake parts of the build system to better reflect what automake does on its own. Also added a call to libtoolize in autogen.sh because autoreconf gets confused without a prior run of libtoolize.
*** po/Makefile now includes a rule to fetch the latest translations from the translation project. "make -f po/Makefile getpo" from the top level of the flex tree will fetch the files.
*** New da translation from the translation project
* flex version 2.5.39 released 2014-03-26
** no user visible changes in this release
* version 2.5.38 released 2014-02-14
** internationalization
*** add sr translation from the translation project
*** update da, es, ko, nl, pt_BR, ro, ru, sv, tr, vi, zh_CN translations from the translation project
*** rename zh_tw to its proper zh_TW name
* version 2.5.37 released 2012-08-03
** Import flex into git. See
git://flex.git.sourceforge.net/gitroot/flex/flex.
** Fix make install target to not fail when the flex++ program is
already installed
** New translations from the translation project: de, fi, pl, vi
* version 2.5.36 released 2012-07-20
** various portability fixes that quiet compiler warnings on 64-bit
hosts
** various manual fixes, including correcting the name of a %option and
updating some simple examples to use ANSI C syntax
** various bug fixes that prevent certain error conditions from
persisting when they should not persist
** improvements to the test suite so it behaves better when linking
compiled files
** new translations from the translation project: ca, da, es, fi, fr,
ga, ko, pt_br, ro, ru, sv, tr, zh_cn
** the flex distribution is now built with automake 1.10.1 and automake
2.61
* version 2.5.35 released 2008-02-26
** fixed bug that prevented flex from accepting certain comments in the
scanner file (resolves bugs #1849809 and #1849805)
** fix bug that prevented headers for all functions from being generated
(resolves bug #1628314)
** change yy_size_t to be size_t (resolves bug #1849812)
** new de, nl, pl, pt_br, vi translations from the translation project
* version 2.5.34 released 2007-12-12
** introduce yylex_init_extra; see the manual for details
** introduce %option extra-type="your_type *" (resolves bug #1744505)
** The flex program now parses multiple short concatenated options (resolves bug
#1619820). Thanks to Petr Machata of Red Hat on this issue.
** better checking after yyalloc/yyrealloc (resolves bug #1595967)
** flex now provides for a libfl_pic.a compiled with position
independent code. Particularly useful when including a flex scanner
in a shared library and with more recent versions of gcc. Thanks to the Debian project for the idea.
** SourceForge feature request #1658379: Expose YY_BUF_SIZE in the
header file.
** flex better escapes filenames with special characters in them
(resolves bug #1623600)
** a memory leak was plugged(resolves bug #1601111)
** pattern language expanded; see the manual for details on the below
highlights
*** pattern options added to specify patterns as case-insensitive or
case-sensitive
*** pattern options to specify whether the "." character should match
the newline character
*** pattern options added to allow ignoring of whitespace in patterns
*** POSIX character classes may be negated in patterns
*** patterns may now use set difference, union operators
** the manual now contains an appendix listing various common patterns
which may be useful when writing scanners
** some memory leaks were removed from the C++ scanner (but the C++
scanner is still experimental and may change radically without
notice)
** c++ scanners can now use yywrap
** added new unit test for c++ and yywrap
** portability fixes to some unit tests
** flex man page and flex manual in pdf now distributed in the flex
distribution
** new ca, vi, ga, nl translations from the translation project
** flex no longer comes with an rpm spec file
** flex development now happens with automake 1.9.6
* version 2.5.33 released 2006-2-20
** all flex resources are now to be found from the website at
http://flex.sourceforge.net/
** there was no release 2.5.32 published
** numerous bug and security fixes
** new nl, vi, sv, ro, po, ga, ca, fr, tr translations from the translation project
** upgrade to use gettext 0.12 (this now makes the "pdf" and "ps"
targets in the build system able to be run successfully)
* version 2.5.31 released 2003-4-1
** remove --enable-maintainer-mode configure option; none of the
Makefiles were using it and it can be unduly confusing
* version 2.5.30 released 2003-4-1
** yylineno is per-buffer in reentrant scanners
** added %top directive for placing code at the top of the generated
scanner; see manual for details
** flex now uses m4 to generate scanners; while this means that
scanners are more readable, it means that flex requires m4 to be
installed; see manual for details
* version 2.5.29 released 2003-3-5
** Automatic stack management for multiple input buffers in C and C++ scanners
** moved the flex documentation to a new doc/ subdirectory
** cleanups to the yy namespace
* version 2.5.28 released 2003-2-12
** flex is now hosted at sourceforge
** Fixed trailing slash bug in YY_INPUT macro def
** Flex now warns if always-interactive is specified with fast or full
* version 2.5.27 released 2003-1-21
** flex now works with recent bison versions
** new pt_br translation from the translation project
* version 2.5.26 released 2003-1-14
** Fixed table deserialization bug on big-endian archs. Patch sent from Bryce Nichols <bryce@bnichols.org>
** yyleng has proper declarations now; this caused flex to generate
unusable scanners for some programs
** the flex distribution now includes a spec file suitable for use
with rpm
** some more c++ fixes
** new es translation from the translation project
** slight tweaks to the flex_int*_t types
** flex now warns about pattern ranges that might be ambiguous when
generating a case-insensitive scanner
* version 2.5.25 released 2002-12-2
** flex now uses flex_int*_t types. For C99 systems, they are just the
int*_t types; for non-C99 systems, we just make some typedefs
** new pt_br translation from the translation project
* version 2.5.24 released 2002-11-25
* more portability fixes
** the manual continues to be updated and edited, but it's still got a
ways to go
** it is possible to have multiple c++ scanners in the same program again
** new turkish translation from the translation project
* version 2.5.23 released 2002-10-21
** more portability fixes
** the manual includes a title page and a table-of-contents when printed
** the test suite can be run with "make check" from the top-level
directory
** configure now accepts the --enable-maintainer-mode option
** gettext functionality is now only available externally
** the constant FLEX_BETA is defined if flex is a beta release
** the script create-test was not included in the distribution and it
should have been
* version 2.5.22 released 2002-10-10
** more portability fixes around how we get ahold of the integral
types; there is a constant FLEX_NEED_INTEGRAL_TYPE_DEFINITIONS
which you should define if you don't have the <inttypes.h> header
file (after you complain to your C vendor for not providing a
reasonable C environment)
** more test suite cleanups; in particular, the test suite should run
correctly when build from a different directory
** upgraded automake to 1.7 and consequently autoconf to 2.54; this
means, among other things, that there is some support for
formatting the manual in postscript and pdf in the distributed
Makefile.in (and therefore in the Makefile built by configure)
** the flex.1 manpage is generated by help2man; (this has been true
for quite a while but was not listed here)
** flex now includes three defined constants to indicate which version
of flex generated a scanner (YY_FLEX_{MAJOR,MINOR,SUBMINOR}_VERSION)
** flex tries its best to output only the relevant portions of the
skeleton when generating a scanner, thus avoiding as much
conditional compilation as possible
* version 2.5.21 released 2002-9-17
** one of the tests in the test suite broke the dist target
* version 2.5.20 released 2002-9-16
** A flex scanner has the ability to save the DFA tables to a file,
and load them at runtime when needed; see the manual for details
** Added %option bison-bridge (--bison-bridge)
** Removed %option reentrant-bison/--reentrant-bison/-Rb
** yylineno is present in all scanners; Modified nasty performance
penalty warning with yylineno in documentation
** test-table-opts is now run last in the test suite because it's so fat
** flex can, to some extent, diagnose where internal problems occur
** new translations from the translation project: fr, ca, de, ru, sv
**Flex generates C99 defs now; see YY_TRADITIONAL_FUNC_DEFS in the
manual if that's not a good thing for you
* version 2.5.19 released 2002-9-5
** prevent segfault on input lines which are longer than the allocated
space (problem report from Manoj Srivastava
<srivasta@golden-gryphon.com>)
** Changed option 'header' to 'header-file'
* version 2.5.18 released 2002-9-4
** portability fixes for integer constants and in the way the test
suite reports its results
** the test for bison was reporting bison missing when it was, in
fact, found
** if we don't find GNU indent, we're more careful when we're not
finding it
* version 2.5.17 released 2002-8-29
** more portability fixes
** updated config.sub and config.guess
** flex is indented by GNU indent (this was done earlier but not
explicitly documented)
* version 2.5.16 released 2002-8-28
** c++ scanners compile again
** there is now an indent target in the top-level Makefile; configure
checks for GNU indent which is required for proper operation of the
indent target
** some more portability fixes were made
** %options and invocation sections of manual merged
** a c++ test was added to the test suite
** we're trying to clean up more files in the test suite's make clean
targets
* version 2.5.15 released 2002-8-21
** reject-state buffer is now dynamically allocated and REJECT buffer
variables are reentrant-safe
** manual now discusses memory usage
** skeleton now processed by m4 before mkskel.sh; (this only matters
if you want to change the skeleton or if you're doing flex development)
** zh_cn translation added from translation project
** a bug that caused a segfault has now been fixed
** the test suite now respects the usual CFLAGS, etc. variables
** removed some warnings which some tests triggered with the -s option
** the flex-generated header file now tries to be smarter about
conditionally including start conditions
** tables code omitted from generated scanner when not used
* version 2.5.14 released 2002-8-15
** the tests using the reentrant c scanner as c++ were reworked
slightly to be sure that the c++ was enforced
** de translation now included in the distribution
** various portability fixes regarding nls support, c++ include
headers, etc.
* version 2.5.13 released 2002-8-15
** the header file output with %option header is now much smaller
** Fixed type mismatch in printf in scanner skeleton
** yylex_init now reports errors
* version 2.5.12 released 2002-8-8
** updated gettext support to 0.11.5
** new fr translation from the translation project
** bison is no longer needed to build flex; If you are building flex
from a release (i.e., not from a cvs snapshot), then you don't need
to have a pre-built lex around either (unless you modify scan.l, of
course); (This has been true for some time, but was not mentioned
here.)
* version 2.5.11 released 2002-7-31
** Fixed bug where yyless did not consider yylineno
** the yylineno performance hit is now gone
** fixed some typos in the manual and we now include texinfo.tex in
the distribution
** traditional prototypes output for C scanners, controlled by a
preprocessor symbol; see documentation for details
* version 2.5.10 released 2002-7-24
** yy_globals renamed to yyscanner and yy_globals_t renamed to
yy_guts_t
** added dist-bzip2 option to Makefile.am so we now produce a bzip2'd
archive in addition to the standard gzip archive
* version 2.5.9
** new tests in test suite: test-mem-{nr,r}, test-posix,
test-posixly-correct, test-debug-{nr,r}
** made changes to work with gcc-3.2 development code
** ability to choose which memory functions are used in flex
** new yylex_destroy() function for the non-reentrant scanner
** new handling of POSIXLY_CORRECT environment variable
** the test suite now has its copyrights explicitly described
** new ca, de, fr, ru, sv, tr translations
* version 2.5.8
** a new --posix option generates scanners with posix-style abc{1,3}
compatible parsing, see manual for the screwy details
* version 2.5.7
** configure.in now includes a call to AC_PREREQ to enforce the
requirement for autoconf at least 2.50 (This only effects you if
you're doing flex development.)
** configure now uses autoconf's versioning information and configure
--help reports the bug-reporting address for flex
** test suite now only reports success versus failure; reporting
skipped is problematic under the current setup
** compilation with --disable-nls now works
** flex can now be built in a separate directory
* version 2.5.6
** gettext support added (from gettext 0.11)
*** translations for ca, da, de, es, fr, ko, ru, sv, tr included
** distribution now built under automake 1.6 and autoconf 2.53
** command-line option parsing happens differently now:
*** Added long option parsing
*** Options -n and -c, previously deprecated, now simply do nothing
*** Options are now parsed left to right
** added a number of new options
*** All positive %options are now accessible from the command line
*** Added option -D, to define a preprocessor symbol
*** Added option --header=FILE to specify a C .h file to generate
*** added option --yywrap to call yywrap on EOF
*** added option --yylineno to track line count in yylineno
*** --yyclass=NAME name of C++ class when generating c++ scanners
*** for long option names which are associated with existing short
options, see accompanying documentation
*** new %option nounistd or command-line --nounistd added to prevent
flex from generating #include <unistd.h> on systems that don't
have that include file
** Support for reentrant C scanners has been added
*** Updated the manual with the new reentrant API
*** Two new options %option reentrant (-R) and
%option reentrant-bison (-Rb)
*** All globals optionally placed into struct yyglobals_t
*** All access to globals replaced by macro invocations
*** All functions optionally take one additional
argument, yy_globals
*** New style for invoking reentrant scanner:
yylex_init(void** scanner );
yylex( scanner );
yylex_destroy( scanner );
*** Added get/set functions for members of struct yy_globals_t
e.g., yyget_text, yyget_leng, etc
*** Prefix substitution added for new functions
*** Macro shortcuts to the lengthy get/set functions
provided for use in actions, e.g., yytext, yyleng, etc
*** Arbitrary, user-defined data, "yyextra", may be added to scanner
** %option nomain no longer implies %option yywrap
But the inverse is still true
** Developer test suite added
*** TESTS/ directory has been added. Users can
'make test' in the TESTS directory to execute the test suite
** Support for bison variables yylval and yylloc added
** automake support for the build process
** manual is now in texinfo/info format
*** flex.1 removed from distribution
** flex no longer generates C-language scanners with C++-style
comments
** flex now generates scanners in c++ which are compatible with
recent c++ compilers
** flex input scanner now recognizes '\r' as an EOL character
See the file ONEWS for changes in earlier releases.
See the file COPYING for copying conditions.
Local Variables:
mode: text
mode: outline-minor
end:
-1233
View File
File diff suppressed because it is too large Load Diff
-73
View File
@@ -1,73 +0,0 @@
[![Build Status](https://github.com/westes/flex/actions/workflows/build.yml/badge.svg)](https://github.com/westes/flex/actions/workflows/build.yml)
This is flex, the fast lexical analyzer generator.
flex is a tool for generating scanners: programs which recognize
lexical patterns in text.
The flex codebase is kept in
[Git on GitHub.](https://github.com/westes/flex) Source releases of flex with some intermediate files already built can be found on [the github releases page.](https://github.com/westes/flex/releases)
Use GitHub's [issues](https://github.com/westes/flex/issues) and
[pull request](https://github.com/westes/flex) features to file bugs
and submit patches.
There are several mailing lists available as well:
* flex-announce@lists.sourceforge.net - where posts will be made
announcing new releases of flex.
* flex-help@lists.sourceforge.net - where you can post questions about
using flex
* flex-devel@lists.sourceforge.net - where you can discuss development
of flex itself
Find information on subscribing to the mailing lists or search in the
archive at: https://sourceforge.net/p/flex/mailman/
Note: Posting is only allowed from addresses that are subscribed to
the lists.
The flex distribution contains the following files which may be of
interest:
* README.md - This file.
* NEWS - current version number and list of user-visible changes.
* INSTALL.md - basic installation information.
* ABOUT-NLS - description of internationalization support in flex.
* COPYING - flex's copyright and license.
* doc/ - user documentation.
* examples/ - containing examples of some possible flex scanners and a
few other things. See the file examples/README for more
details.
* tests/ - regression tests. See tests/README for details.
* po/ - internationalization support files.
---
This file is part of flex.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.
-53
View File
@@ -1,53 +0,0 @@
Vern had the following things to say:
Many thanks to the 2.5 beta-testers for finding bugs and helping test and
increase portability: Stan Adermann, Scott David Daniels, Charles Elliott,
Joe Gayda, Chris Meier, James Nordby, Terrence O'Kane, Karsten Pahnke,
Francois Pinard, Pat Rankin, Andreas Scherer, Marc Wiese, Nathan Zelle.
Thanks to the many flex beta-testers, feedbackers, and contributors,
especially Francois Pinard, Casey Leedom, Robert Abramovitz, Stan
Adermann, Terry Allen, David Barker-Plummer, John Basrai, Neal Becker,
Nelson H.F. Beebe, benson@odi.com, Karl Berry, Peter A. Bigot, Simon
Blanchard, Keith Bostic, Frederic Brehm, Ian Brockbank, Kin Cho, Nick
Christopher, Brian Clapper, J.T. Conklin, Jason Coughlin, Bill Cox,
Nick Cropper, Dave Curtis, Scott David Daniels, Chris G. Demetriou,
Theo Deraadt, Mike Donahue, Chuck Doucette, Tom Epperly, Leo Eskin,
Chris Faylor, Chris Flatters, Jon Forrest, Jeffrey Friedl, Joe Gayda,
Kaveh R. Ghazi, Wolfgang Glunz, Eric Goldman, Christopher M. Gould,
Ulrich Grepel, Peer Griebel, Jan Hajic, Charles Hemphill, NORO Hideo,
Jarkko Hietaniemi, Scott Hofmann, Jeff Honig, Dana Hudes, Eric Hughes,
John Interrante, Ceriel Jacobs, Michal Jaegermann, Sakari Jalovaara,
Jeffrey R. Jones, Henry Juengst, Klaus Kaempf, Jonathan I. Kamens,
Terrence O Kane, Amir Katz, ken@ken.hilco.com, Kevin B. Kenny, Steve
Kirsch, Winfried Koenig, Marq Kole, Ronald Lamprecht, Greg Lee, Rohan
Lenard, Craig Leres, John Levine, Steve Liddle, David Loffredo, Mike
Long, Mohamed el Lozy, Brian Madsen, Malte, Joe Marshall, Bengt
Martensson, Chris Metcalf, Luke Mewburn, Jim Meyering, R. Alexander
Milowski, Erik Naggum, G.T. Nicol, Landon Noll, James Nordby, Marc
Nozell, Richard Ohnemus, Karsten Pahnke, Sven Panne, Roland Pesch,
Walter Pelissero, Gaumond Pierre, Esmond Pitt, Jef Poskanzer, Joe
Rahmeh, Jarmo Raiha, Frederic Raimbault, Pat Rankin, Rick Richardson,
Kevin Rodgers, Kai Uwe Rommel, Jim Roskind, Alberto Santini, Andreas
Scherer, Darrell Schiebel, Raf Schietekat, Doug Schmidt, Philippe
Schnoebelen, Andreas Schwab, Larry Schwimmer, Alex Siegel, Eckehard
Stolz, Jan-Erik Strvmquist, Mike Stump, Paul Stuart, Dave Tallman, Ian
Lance Taylor, Chris Thewalt, Richard M. Timoney, Jodi Tsai, Paul
Tuinenga, Gary Weik, Frank Whaley, Gerhard Wilhelms, Kent Williams,
Ken Yap, Ron Zellar, Nathan Zelle, David Zuhn, and those whose names
have slipped my marginal mail-archiving skills but whose contributions
are appreciated all the same.
Thanks to Keith Bostic, Jon Forrest, Noah Friedman,
John Gilmore, Craig Leres, John Levine, Bob Mulcahy, G.T.
Nicol, Francois Pinard, Rich Salz, and Richard Stallman for help with various
distribution headaches.
Thanks to Esmond Pitt and Earle Horton for 8-bit character support; to
Benson Margulies and Fred Burke for C++ support; to Kent Williams and Tom
Epperly for C++ class support; to Ove Ewerlid for support of NUL's; and to
Eric Hughes for support of multiple buffers.
This work was primarily done when I was with the Real Time Systems Group
at the Lawrence Berkeley Laboratory in Berkeley, CA. Many thanks to all there
for the support I received.
-9
View File
@@ -1,9 +0,0 @@
Things to be worked on:
* Tests for %option user-init, %option pre-action, %option post-action.
* integrate examples directory into tests so that normal testing
proves the examples are up to date.
* Do away with any need for -lfl by generating a default yywrap
if the user doesn't specify one.
-52
View File
@@ -1,52 +0,0 @@
#!/bin/sh
# This file is part of flex.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# Neither the name of the University nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE.
# If you see no configure script, then run ./autogen.sh to create it
# and proceed with the "normal" build procedures.
# use LIBTOOLIZE, if set
if test "x$LIBTOOLIZE" = "x"; then
for ac_prog in libtoolize glibtoolize; do
if $ac_prog --version >/dev/null 2>&1; then
LIBTOOLIZE=$ac_prog
break
fi
done
fi
# test libtoolize
if test "x$LIBTOOLIZE" = "x" || ! $LIBTOOLIZE --version >/dev/null; then
echo "error: libtoolize not working, re-run with LIBTOOLIZE=/path/to/libtoolize">&2
echo " LIBTOOLIZE is currently \"$LIBTOOLIZE\"">&2
exit 1
fi
#if we pretend to have a ChangeLog, then automake is less
#worried. (Don't worry, we *do* have a ChangeLog, we just need the
#Makefile first.)
if ! test -f ChangeLog; then
touch ChangeLog
fi
$LIBTOOLIZE --install --force
autoreconf --install --force
-229
View File
@@ -1,229 +0,0 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
# This file is part of flex.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# Neither the name of the University nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE.
# autoconf requirements and initialization
dnl We recommend builders to regenerate configure and auxiliary scripts with
dnl exact versions of tools that generate flex release tarball, or latest
dnl versions of tools for flex development. The minimum feature and version
dnl requirements are provided for information only (no guarantee that the tools
dnl will work and we may bump requirements with future code changes).
dnl Uses AC_PATH_PROGS_FEATURE_CHECK. Requires autoconf-2.62 as minimum.
AC_PREREQ([2.62])
AC_INIT([the fast lexical analyser generator],[2.6.4],[flex-help@lists.sourceforge.net],[flex])
AC_CONFIG_SRCDIR([src/scan.l])
AC_CONFIG_AUX_DIR([build-aux])
AC_USE_SYSTEM_EXTENSIONS
dnl "LT_*" macros and "libtoolize --install" require libtool-2.2 as minimum.
LT_PREREQ([2.2])
LT_INIT
dnl Uses dist-lzip. Requires automake-1.11.3 as minimum.
AM_INIT_AUTOMAKE([1.11.3 -Wno-portability foreign std-options dist-lzip parallel-tests subdir-objects])
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_LIBOBJ_DIR([lib])
AC_CONFIG_MACRO_DIR([m4])
SHARED_VERSION_INFO="2:0:0"
AC_SUBST(SHARED_VERSION_INFO)
# checks for programs
AM_GNU_GETTEXT([external])
dnl Try to pull in latest gettext infrastructure ("po" and "m4") files.
dnl Unfortunately autoreconf as of 2.69 doesn't recognize
dnl AM[_]GNU[_]GETTEXT_REQUIRE_VERSION so we provide AM[_]GNU[_]GETTEXT_VERSION
dnl as fallback. (autopoint will ignore latter if former is specified.)
dnl
dnl Bugs in gettext before 0.14 prevent building flex with it.
dnl FLEX_GNU_GETTEXT_REAL_REQUIRE_VERSION=0.14
AM_GNU_GETTEXT_REQUIRE_VERSION([0.19.6])
AM_GNU_GETTEXT_VERSION([0.19.6])
AC_PROG_YACC
AC_MSG_CHECKING(whether $YACC is GNU Bison)
AS_IF([test -n "$YACC" && $YACC --version 2>&1 | $GREP "GNU Bison" >/dev/null],
[AC_MSG_RESULT(yes)
use_gnu_bison=1],
[AC_MSG_RESULT(no)
AC_MSG_WARN($YACC does not appear to be GNU Bison; required for maintainers)
use_gnu_bison=0
YACC="\${top_srcdir}/build-aux/missing bison"
])
AM_CONDITIONAL([HAVE_BISON], [test $use_gnu_bison -eq 1])
dnl AC_PROG_LEX requires an argument in autoconf 2.70, but we cannot
dnl specify it through AM_PROG_LEX until automake 1.17.
AC_PROG_LEX([noyywrap])
AM_PROG_LEX
AC_PROG_CC
AX_PROG_CC_FOR_BUILD
AC_PROG_CXX
AM_PROG_CC_C_O
AC_PROG_LN_S
AC_PROG_AWK
AC_PROG_INSTALL
AS_IF([test "x${BUILD_OBJEXT-}" = x],
[AS_IF([test "$cross_compiling" = no],
[BUILD_EXEEXT="$EXEEXT"
BUILD_OBJEXT="$OBJEXT"],
[BUILD_EXEEXT="${ac_cv_build_exeext-}"
BUILD_OBJEXT="${ac_cv_build_objext-}"])])
AS_IF([test "x${BUILD_OBJEXT-}" = x && test "x${enable_bootstrap-yes}" = xyes],
[AC_MSG_ERROR([BUILD_OBJEXT is invalid; please regenerate 'configure' with a newer ax_prog_cc_for_build.m4 (serial 23 or later) or configure with '--disable-bootstrap'])])
pkgconfigdir=${libdir}/pkgconfig
AC_SUBST(pkgconfigdir)
# allow passing a variable `WARNINGFLAGS',
# either when invoking `configure', or when invoking `make'
# default to something useful if GCC was detected
AC_ARG_ENABLE([warnings],
[AS_HELP_STRING([--enable-warnings],
[enable a bunch of compiler warning flags (defaults to GCC warning flags).])],
[AS_IF([test "x$GCC" = xyes],
[ : ${WARNINGFLAGS="-Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs -Wold-style-definition -Wredundant-decls -Wconversion -Wno-unused-but-set-variable"} ])])
AC_SUBST([WARNINGFLAGS])
AC_ARG_ENABLE([libfl],
[AS_HELP_STRING([--disable-libfl],
[do not build -lfl runtime support library])],
[], [enable_libfl=yes])
AM_CONDITIONAL([ENABLE_LIBFL], [test "x$enable_libfl" = xyes])
# --disable-bootstrap is intended only to workaround problems with bootstrap
# (e.g. when cross-compiling flex or when bootstrapping has bugs).
# Ideally we should be able to bootstrap even when cross-compiling.
AC_ARG_ENABLE([bootstrap],
[AS_HELP_STRING([--disable-bootstrap],
[don't perform a bootstrap when building flex])],
[], [enable_bootstrap=yes])
AM_CONDITIONAL([ENABLE_BOOTSTRAP], [test "x$enable_bootstrap" = xyes])
AM_CONDITIONAL([CROSS], [test "x$cross_compiling" = xyes])
AC_PATH_PROG([HELP2MAN], help2man, [\${top_srcdir}/build-aux/missing help2man])
AS_IF([test "$HELP2MAN" = "\${top_srcdir}/build-aux/missing help2man"],
AC_MSG_WARN(help2man: program not found: building man page will not work)
)
AC_PATH_PROGS([TEXI2DVI], [gtexi2dvi texi2dvi], [\${top_srcdir}/build-aux/missing texi2dvi])
AS_IF([test "$TEXI2DVI" = "\${top_srcdir}/build-aux/missing texi2dvi"],
AC_MSG_WARN(texi2dvi: program not found: building pdf version of manual will not work)
)
# Check for a m4 that supports -P
AC_CACHE_CHECK([for m4 that supports -P], [ac_cv_path_M4],
[AC_PATH_PROGS_FEATURE_CHECK([M4], [gm4 gnum4 m4],
[[m4out=`echo 'm''4_divnum' | $ac_path_M4 -P`]
[test "x$m4out" = x0 \
&& ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
[AC_MSG_ERROR([could not find m4 that supports -P])])])
AC_SUBST([M4], [$ac_cv_path_M4])
AC_DEFINE_UNQUOTED([M4], ["$M4"], [Define to the m4 executable name.])
AC_PATH_PROG([INDENT], indent)
AS_IF([test -n "$INDENT"], [
AC_MSG_CHECKING(whether $INDENT is GNU indent)
AS_IF([$INDENT --version 2>/dev/null | $GREP "GNU indent" >/dev/null],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
AC_MSG_WARN($INDENT does not appear to be GNU indent; 'make indent' may not function properly)
INDENT="\${top_srcdir}/build-aux/missing indent"
])
])
# checks for headers
AC_CHECK_HEADERS([regex.h strings.h sys/wait.h unistd.h], [],
[AC_MSG_ERROR(required header not found on your system)])
AC_CHECK_HEADERS([inttypes.h libintl.h limits.h locale.h malloc.h netinet/in.h])
# checks for libraries
# The test test-pthread uses libpthread, so we check for it here, but
# all we need is the preprocessor symbol defined since we don't need
# LIBS to include libpthread for building flex.
LIBPTHREAD=''
AC_CHECK_LIB(pthread, pthread_mutex_lock,
[AC_CHECK_HEADERS([pthread.h], [LIBPTHREAD=-lpthread],
[AC_MSG_WARN([pthread tests will be skipped])])],
[AC_MSG_WARN([pthread tests will be skipped])])
AC_SUBST([LIBPTHREAD])
AC_CHECK_LIB(m, log10)
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_TYPE_SIZE_T
# Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_FORK
dnl Autoconf bug: AC_FUNC_MALLOC and AC_FUNC_REALLOC might not warn of cross
dnl compilation. Workaround this.
AC_FUNC_MALLOC
AS_IF([test "$cross_compiling" = yes],
AC_MSG_WARN([result $ac_cv_func_malloc_0_nonnull guessed because of cross compilation]))
AC_FUNC_REALLOC
AS_IF([test "$cross_compiling" = yes],
AC_MSG_WARN([result $ac_cv_func_realloc_0_nonnull guessed because of cross compilation]))
dnl Autoheader (<= 2.69) bug: "dnl" comments in a quoted argument of
dnl AC_CHECK_FUNCS will expand wierdly in config.h.in.
dnl (https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html)
AC_CHECK_FUNCS([dup2 memset regcomp strcasecmp strchr strdup strtol], [],
[AC_MSG_ERROR(required library function not found on your system)])
# Optional library functions:
# pow - Used only by "examples/manual/expr".
# setlocale - Needed only if NLS is enabled.
# reallocarr - NetBSD function. Use reallocarray if not available.
# reallocarray - OpenBSD function. We have replacement if not available.
AC_CHECK_FUNCS([pow setlocale reallocarr reallocarray])
AC_CHECK_DECLS(__func__)
AS_IF([test "$cross_compiling" = yes],
[AC_CONFIG_FILES([src/config_for_build.h])])
AC_CONFIG_FILES(
Makefile
doc/Makefile
examples/Makefile
examples/fastwc/Makefile
examples/manual/Makefile
po/Makefile.in
src/libfl.pc
src/Makefile
tools/Makefile
tests/Makefile
)
AC_OUTPUT
-1
View File
@@ -1 +0,0 @@
XBS-Destinations: sourceforge
-30
View File
@@ -1,30 +0,0 @@
flex.aux
flex.cp
flex.cps
flex.dvi
flex.fn
flex.fns
flex.hk
flex.hks
flex.info*
flex.ky
flex.log
flex.op
flex.ops
flex.pg
flex.toc
flex.tp
flex.tps
flex.vr
flex.vrs
Makefile
Makefile.in
flex.1
flex.pdf
flex.ps
version.texi
flex.html
flex.t2p
flex
flex.exe
-51
View File
@@ -1,51 +0,0 @@
if CROSS
FLEX = $(top_builddir)/src/stage1flex
else
FLEX = $(top_builddir)/src/flex$(EXEEXT)
endif
TEXI2DVI = @TEXI2DVI@ -I $(srcdir)/../examples/manual/
TEXI2PDF = @TEXI2PDF@ -I $(srcdir)/../examples/manual/
info_TEXINFOS = flex.texi
AM_MAKEINFOFLAGS = -I $(srcdir)/../examples/manual/
dist_man_MANS = flex.1
MAINTAINERCLEANFILES = flex.1
CLEANFILES = \
*.aux \
*.cp \
*.cps \
*.fn \
*.fns \
*.hk \
*.hks \
*.ky \
*.log \
*.op \
*.ops\
*.pg \
*.toc \
*.tp \
*.tps \
*.vr \
*.vrs \
flex
# Use a fixed program name, without extension (such as ".exe"), for man
# page generation. 'help2man' strips directory prefix ("./") from the
# usage string, but not file extensions.
flex.1: $(top_srcdir)/configure.ac $(top_srcdir)/src/cpp-flex.skl $(top_srcdir)/src/options.c $(top_srcdir)/src/options.h
( cd $(top_builddir)/src && \
prog_name=`echo '$(FLEX)' | sed 's|^$(top_builddir)/src/||'` && \
$(MAKE) $(AM_MAKEFLAGS) $$prog_name \
)
$(INSTALL) -m 700 $(FLEX) flex$(EXEEXT)
$(HELP2MAN) \
--name='$(PACKAGE_NAME)' \
--section=1 \
--source='The Flex Project' \
--manual='Programming' \
--output=$@ \
./flex
-9140
View File
File diff suppressed because it is too large Load Diff
-29
View File
@@ -1,29 +0,0 @@
# This file is part of flex.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# Neither the name of the University nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE.
EXTRA_DIST = \
testxxLexer.l \
debflex.awk \
README
SUBDIRS = \
manual \
fastwc
-15
View File
@@ -1,15 +0,0 @@
This directory contains some examples of what you can do with
flex. These files are not tested regularly so you might have to tinker
a bit before they work for you. Updates, new files and patches are welcome.
- debflex.awk, an awk script for annotating flex debug output.
It presently only works with gawk and mawk, not with "old"
or "new" awk.
- testxxLexer.l, a sample C++ program that uses flex's scanner
class option ("-+").
- fastwc/, a subdirectory containing examples of how to use flex
to write progressively higher-performance versions of the Unix
"wc" utility. This certainly should work with 2.5, but hasn't
been tested.
-119
View File
@@ -1,119 +0,0 @@
# Clarify the flex debug trace by substituting first line of each rule.
# Francois Pinard <pinard@iro.umontreal.ca>, July 1990.
#
# Rewritten to process correctly \n's in scanner input.
# BEGIN section modified to correct a collection of rules.
# Michal Jaegermann <michal@phys.ualberta.ca>, December 1993
#
# Sample usage:
# flex -d PROGRAM.l
# gcc -o PROGRAM PROGRAM.c -lfl
# PROGRAM 2>&1 | gawk -f debflex.awk PROGRAM.l
#
# (VP's note: this script presently does not work with either "old" or
# "new" awk; fixes so it does will be welcome)
BEGIN {
# Insure proper usage.
if (ARGC != 2) {
print "usage: gawk -f debflex.awk FLEX_SOURCE <DEBUG_OUTPUT";
exit (1);
}
# Remove and save the name of flex source.
source = ARGV[1];
ARGC--;
# Swallow the flex source file.
line = 0;
section = 1;
while (getline <source) {
# Count the lines.
line++;
# Count the sections. When encountering section 3,
# break out of the awk BEGIN block.
if (match ($0, /^%%/)) {
section++;
if (section == 3) {
break;
}
}
else {
# Only the lines in section 2 which do not begin in a
# tab or space might be referred to by the flex debug
# trace. Save only those lines.
if (section == 2 && match ($0, /^[^ \t]/)) {
rules[line] = $0;
}
}
}
dashes = "-----------------------------------------------------------";
collect = "";
line = 0;
}
# collect complete rule output from a scanner
$0 !~ /^--/ {
collect = collect "\n" $0;
next;
}
# otherwise we have a new rule - process what we got so far
{
process();
}
# and the same thing if we hit EOF
END {
process();
}
function process() {
# splitting this way we loose some double dashes and
# left parentheses from echoed input - a small price to pay
n = split(collect, field, "\n--|[(]");
# this loop kicks in only when we already collected something
for (i = 1; i <= n; i++) {
if (0 != line) {
# we do not care for traces of newlines.
if (0 == match(field[i], /\"\n+\"[)]/)) {
if (rules[line]) {
text = field[i];
while ( ++i <= n) {
text = text field[i];
}
printf("%s:%d: %-8s -- %s\n",
source, line, text, rules[line]);
}
else {
print;
printf "%s:%d: *** No such rule.\n", source, line;
}
}
line = 0;
break;
}
if ("" != field[i]) {
if ("end of buffer or a NUL)" == field[i]) {
print dashes; # Simplify trace of buffer reloads
continue;
}
if (match(field[i], /accepting rule at line /)) {
# force interpretation of line as a number
line = 0 + substr(field[i], RLENGTH);
continue;
}
# echo everything else
printf("--%s\n", field[i]);
}
}
collect = "\n" $0; # ... and start next trace
}
-29
View File
@@ -1,29 +0,0 @@
# This file is part of flex.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# Neither the name of the University nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE.
EXTRA_DIST = \
wc5.l \
wc4.l \
wc3.l \
wc2.l \
wc1.l \
mywc.c \
README
-56
View File
@@ -1,56 +0,0 @@
This directory contains some examples illustrating techniques for extracting
high-performance from flex scanners. Each program implements a simplified
version of the Unix "wc" tool: read text from stdin and print the number of
characters, words, and lines present in the text. All programs were compiled
using gcc (version unavailable, sorry) with the -O flag, and run on a
SPARCstation 1+. The input used was a PostScript file, mainly containing
figures, with the following "wc" counts:
lines words characters
214217 635954 2592172
The basic principles illustrated by these programs are:
- match as much text with each rule as possible
- adding rules does not slow you down!
- avoid backing up
and the big caveat that comes with them is:
- you buy performance with decreased maintainability; make
sure you really need it before applying the above techniques.
See the "Performance Considerations" section of flexdoc for more
details regarding these principles.
The different versions of "wc":
mywc.c
a simple but fairly efficient C version
wc1.l a naive flex "wc" implementation
wc2.l somewhat faster; adds rules to match multiple tokens at once
wc3.l faster still; adds more rules to match longer runs of tokens
wc4.l fastest; still more rules added; hard to do much better
using flex (or, I suspect, hand-coding)
wc5.l identical to wc3.l except one rule has been slightly
shortened, introducing backing-up
Timing results (all times in user CPU seconds):
program time notes
------- ---- -----
wc1 16.4 default flex table compression (= -Cem)
wc1 6.7 -Cf compression option
/bin/wc 5.8 Sun's standard "wc" tool
mywc 4.6 simple but better C implementation!
wc2 4.6 as good as C implementation; built using -Cf
wc3 3.8 -Cf
wc4 3.3 -Cf
wc5 5.7 -Cf; ouch, backing up is expensive
-26
View File
@@ -1,26 +0,0 @@
/* A simple but fairly efficient C version of the Unix "wc" tool */
#include <stdio.h>
#include <ctype.h>
main()
{
int c, cc = 0, wc = 0, lc = 0;
FILE *f = stdin;
while ((c = getc(f)) != EOF) {
++cc;
if (isgraph(c)) {
++wc;
do {
c = getc(f);
if (c == EOF)
goto done;
++cc;
} while (isgraph(c));
}
if (c == '\n')
++lc;
}
done: printf( "%8d%8d%8d\n", lc, wc, cc );
}
-19
View File
@@ -1,19 +0,0 @@
/* First cut at a flex-based "wc" tool. */
ws [ \t]
nonws [^ \t\n]
%option main noyywrap
%%
int cc = 0, wc = 0, lc = 0;
{nonws}+ cc += yyleng; ++wc;
{ws}+ cc += yyleng;
\n ++lc; ++cc;
<<EOF>> {
printf( "%8d %8d %8d\n", lc, wc, cc );
yyterminate();
}
-21
View File
@@ -1,21 +0,0 @@
/* Somewhat faster "wc" tool: match more text with each rule */
ws [ \t]
nonws [^ \t\n]
word {ws}*{nonws}+
%option main noyywrap
%%
int cc = 0, wc = 0, lc = 0;
{word}{ws}* cc += yyleng; ++wc;
{word}{ws}*\n cc += yyleng; ++wc; ++lc;
{ws}+ cc += yyleng;
\n+ cc += yyleng; lc += yyleng;
<<EOF>> {
printf( "%8d %8d %8d\n", lc, wc, cc );
yyterminate();
}
-25
View File
@@ -1,25 +0,0 @@
/* Somewhat faster still: potentially match a lot of text with each rule */
ws [ \t]
nonws [^ \t\n]
word {ws}*{nonws}+
words {word}{ws}+
%option main noyywrap
%%
int cc = 0, wc = 0, lc = 0;
{word}{ws}* cc += yyleng; ++wc;
{word}{ws}*\n cc += yyleng; ++wc; ++lc;
{words}{word}{ws}* cc += yyleng; wc += 2;
{words}{2}{word}{ws}* cc += yyleng; wc += 3;
{words}{3}{word}{ws}* cc += yyleng; wc += 4;
{ws}+ cc += yyleng;
\n+ cc += yyleng; lc += yyleng;
<<EOF>> {
printf( "%8d %8d %8d\n", lc, wc, cc );
yyterminate();
}
-28
View File
@@ -1,28 +0,0 @@
/* Fastest version of wc: add rules to pick up newlines, too */
ws [ \t]
nonws [^ \t\n]
word {ws}*{nonws}+
words {word}{ws}+
%option main noyywrap
%%
int cc = 0, wc = 0, lc = 0;
{word}{ws}* ++wc; cc += yyleng;
{word}{ws}*\n ++wc; cc += yyleng; ++lc;
{words}{word}{ws}* wc += 2; cc += yyleng;
{words}{word}{ws}*\n wc += 2; cc += yyleng; ++lc;
{words}{2}{word}{ws}* wc += 3; cc += yyleng;
{words}{2}{word}{ws}*\n wc += 3; cc += yyleng; ++lc;
{words}{3}{word}{ws}* wc += 4; cc += yyleng;
{words}{3}{word}{ws}*\n wc += 4; cc += yyleng; ++lc;
{ws}+ cc += yyleng;
\n+ cc += yyleng; lc += yyleng;
<<EOF>> {
printf( "%8d %8d %8d\n", lc, wc, cc );
yyterminate();
}
-25
View File
@@ -1,25 +0,0 @@
/* Oops; slight change from wc3.l introduces backtracking */
ws [ \t]
nonws [^ \t\n]
word {ws}*{nonws}+
words {word}{ws}+
%option main noyywrap
%%
int cc = 0, wc = 0, lc = 0;
{word}{ws}* cc += yyleng; ++wc;
{word}{ws}*\n cc += yyleng; ++wc; ++lc;
{words}{word} cc += yyleng; wc += 2; /* oops */
{words}{2}{word}{ws}* cc += yyleng; wc += 3;
{words}{3}{word}{ws}* cc += yyleng; wc += 4;
{ws}+ cc += yyleng;
\n+ cc += yyleng; lc += yyleng;
<<EOF>> {
printf( "%8d %8d %8d\n", lc, wc, cc );
yyterminate();
}
-24
View File
@@ -1,24 +0,0 @@
Tue Oct 5 21:51:59 1993 Vern Paxson
* Removed FILTER/ subdirectory.
* Removed alloca.c.
* Changed Makefile definition of CC to just "gcc -g", removed
assumption of alloca being present.
* Added pointer to MISC/fastwc/ to wc.lex.
Tue Jun 8 15:47:39 1993 Gavin Thomas Nicol (nick at sillybugs)
* Changed main() in wc.lex extensively. The old version would not
work correctly without the YY_NEW_FILE. (lex handles the older
version OK though).
* Added a rule to expr.lex to handle whitespace. The old version
reported an illegal character.
* Added -traditional to the gcc flags because the flex definition
for free() clashes with some systems that have old header files.
-58
View File
@@ -1,58 +0,0 @@
# This file is part of flex.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# Neither the name of the University nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE.
EXTRA_DIST = \
ChangeLog \
Makefile.examples \
README \
cat.lex \
dates.lex \
datetest.dat \
eof_rules.lex \
eof_test01.txt \
eof_test02.txt \
eof_test03.txt \
example_er.lex \
example_r.lex \
example_nr.lex \
expr.lex \
expr.y \
front.lex \
front.y \
j2t.lex \
myname.lex \
myname.txt \
myname2.lex \
numbers.lex \
pas_include.lex \
pascal.lex \
reject.lex \
replace.lex \
string1.lex \
string2.lex \
strtest.dat \
unput.lex \
user_act.lex \
userinit.lex \
wc.lex \
yymore.lex \
yymore2.lex \
yymoretest.dat
-101
View File
@@ -1,101 +0,0 @@
#############################################################
#
# Makefile : Makefile for Flex examples.
# Author : G.T.Nicol
# Last Updated : 1993/10/05
#
# If you use bison, you may have to supply an alloca
#
#############################################################
CC = gcc -g
LEX = flex -i -I
YACC = bison -d -y
ALLOCA =
############################################################
#
# DO NOT CHANGE ANYTHING FROM HERE ON !!!!!!!!!
#
############################################################
PATH := /usr/local/bin:${PATH}
all: expr front myname eof wc replace user_act string1\
string2 yymore numbers dates cat
example_r: example_r.lex
$(LEX) example_r.lex
$(CC) lex.yy.c -o example_r
example_nr: example_nr.lex
$(LEX) example_nr.lex
$(CC) lex.yy.c -o example_nr
example_er: example_er.lex
$(LEX) example_er.lex
$(CC) lex.yy.c -o example_er
expr: expr.y expr.lex
$(YACC) expr.y
$(LEX) expr.lex
$(CC) -o expr lex.yy.c y.tab.c $(ALLOCA) -ll -lm
front: front.y front.lex
$(YACC) front.y
$(LEX) front.lex
$(CC) -o front lex.yy.c y.tab.c $(ALLOCA) -ll -lm
numbers: numbers.lex
$(LEX) numbers.lex
$(CC) lex.yy.c -o numbers
dates: dates.lex
$(LEX) dates.lex
$(CC) lex.yy.c -o dates -ll
yymore: yymore.lex
$(LEX) yymore.lex
$(CC) lex.yy.c -o yymore -ll
string1: string1.lex
$(LEX) string1.lex
$(CC) lex.yy.c -o string1 -ll
string2: string2.lex
$(LEX) string2.lex
$(CC) lex.yy.c -o string2 -ll
myname: myname.lex
$(LEX) myname.lex
$(CC) lex.yy.c -o myname -ll
myname2: myname2.lex
$(LEX) myname2.lex
$(CC) lex.yy.c -o myname2 -ll
eof: eof_rules.lex
$(LEX) eof_rules.lex
$(CC) lex.yy.c -o eof -ll
wc: wc.lex
$(LEX) wc.lex
$(CC) lex.yy.c -o wc -ll
cat: cat.lex
$(LEX) cat.lex
$(CC) lex.yy.c -o cat -ll
replace: replace.lex
$(LEX) replace.lex
$(CC) lex.yy.c -o replace -ll
user_act: expr.y expr.lex
$(LEX) user_act.lex
$(CC) -o user_act lex.yy.c -ll
clean:
rm -f *.BAK *.o core *~* *.a
rm -f *.tab.h *.tab.c
rm -f myname expr lex.yy.c *.out eof wc yymore
rm -f replace front user_act string1 string2
rm -f dates numbers cat
-18
View File
@@ -1,18 +0,0 @@
This directory contains the example programs from the manual, and a
few other things as well. To make all the programs, simply type "make
-f Makefile.examples", and assuming you have flex and gcc, all will be
well.
To build the programs individually, type
make -f Makefile.examples program_name
For example:
make -f Makefile.examples expr
If you add an example to this directory, don't forget these steps:
* Add it to the EXTRA_DIST list in Makefile.am
* Add a build recipe to Makefile/examples.
-45
View File
@@ -1,45 +0,0 @@
/*
* cat.lex: A demonstration of YY_NEW_FILE.
*/
%{
#include <stdio.h>
char **names = NULL;
int current = 1;
%}
%%
<<EOF>> {
current += 1;
if(names[current] != NULL){
yyin = fopen(names[current],"r");
if(yyin == NULL){
fprintf(stderr,"cat: unable to open %s\n",
names[current]);
yyterminate();
}
YY_NEW_FILE;
} else {
yyterminate();
}
}
%%
int main(int argc, char **argv)
{
if(argc < 2){
fprintf(stderr,"Usage: cat files....\n");
exit(1);
}
names = argv;
yyin = fopen(names[current],"r");
if(yyin == NULL){
fprintf(stderr,"cat: unable to open %s\n",
names[current]);
yyterminate();
}
yylex();
}
-106
View File
@@ -1,106 +0,0 @@
/*
* dates.lex: An example of using start states to
* distinguish between different date formats.
*/
%{
#include <ctype.h>
char month[20],dow[20],day[20],year[20];
%}
skip of|the|[ \t,]*
mon (mon(day)?)
tue (tue(sday)?)
wed (wed(nesday)?)
thu (thu(rsday)?)
fri (fri(day)?)
sat (sat(urday)?)
sun (sun(day)?)
day_of_the_week ({mon}|{tue}|{wed}|{thu}|{fri}|{sat}|{sun})
jan (jan(uary)?)
feb (feb(ruary)?)
mar (mar(ch)?)
apr (apr(il)?)
may (may)
jun (jun(e)?)
jul (jul(y)?)
aug (aug(ust)?)
sep (sep(tember)?)
oct (oct(ober)?)
nov (nov(ember)?)
dec (dec(ember)?)
first_half ({jan}|{feb}|{mar}|{apr}|{may}|{jun})
second_half ({jul}|{aug}|{sep}|{oct}|{nov}|{dec})
month {first_half}|{second_half}
nday [1-9]|[1-2][0-9]|3[0-1]
nmonth [1-9]|1[0-2]
nyear [0-9]{1,4}
year_ext (ad|AD|bc|BC)?
day_ext (st|nd|rd|th)?
%s LONG SHORT
%s DAY DAY_FIRST YEAR_FIRST YEAR_LAST YFMONTH YLMONTH
%%
/* the default is month-day-year */
<LONG>{day_of_the_week} strcpy(dow,yytext);
<LONG>{month} strcpy(month,yytext); yybegin(DAY);
/* handle the form: day-month-year */
<LONG>{nday}{day_ext} strcpy(day,yytext); yybegin(DAY_FIRST);
<DAY_FIRST>{month} strcpy(month,yytext); yybegin(LONG);
<DAY>{nday}{day_ext} strcpy(day,yytext); yybegin(LONG);
<LONG>{nyear}{year_ext} {
printf("Long:\n");
printf(" DOW : %s \n",dow);
printf(" Day : %s \n",day);
printf(" Month : %s \n",month);
printf(" Year : %s \n",yytext);
strcpy(dow,"");
strcpy(day,"");
strcpy(month,"");
}
/* handle dates of the form: day-month-year */
<SHORT>{nday} strcpy(day,yytext); yybegin(YEAR_LAST);
<YEAR_LAST>{nmonth} strcpy(month,yytext);yybegin(YLMONTH);
<YLMONTH>{nyear} strcpy(year,yytext); yybegin(SHORT);
/* handle dates of the form: year-month-day */
<SHORT>{nyear} strcpy(year,yytext); yybegin(YEAR_FIRST);
<YEAR_FIRST>{nmonth} strcpy(month,yytext);yybegin(YFMONTH);
<YFMONTH>{nday} strcpy(day,yytext); yybegin(SHORT);
<SHORT>\n {
printf("Short:\n");
printf(" Day : %s \n",day);
printf(" Month : %s \n",month);
printf(" Year : %s \n",year);
strcpy(year,"");
strcpy(day,"");
strcpy(month,"");
}
long\n yybegin(LONG);
short\n yybegin(SHORT);
{skip}*
\n
.
-28
View File
@@ -1,28 +0,0 @@
short
1989:12:23
1989:11:12
23:12:1989
11:12:1989
1989/12/23
1989/11/12
23/12/1989
11/12/1989
1989-12-23
1989-11-12
23-12-1989
11-12-1989
long
Friday the 5th of January, 1989
Friday, 5th of January, 1989
Friday, January 5th, 1989
Fri, January 5th, 1989
Fri, Jan 5th, 1989
Fri, Jan 5, 1989
FriJan 5, 1989
FriJan5, 1989
FriJan51989
Jan51989
-65
View File
@@ -1,65 +0,0 @@
/*
* eof_rules.lex : An example of using multiple buffers
* EOF rules, and start states
*/
%{
#define MAX_NEST 10
YY_BUFFER_STATE include_stack[MAX_NEST];
int include_count = -1;
%}
%x INCLUDE
%%
^"#include"[ \t]*\" yybegin(INCLUDE);
<INCLUDE>\" yybegin(INITIAL);
<INCLUDE>[^\"]+ { /* get the include file name */
if ( include_count >= MAX_NEST){
fprintf( stderr, "Too many include files" );
exit( 1 );
}
include_stack[++include_count] = yy_current_buffer();
yyin = fopen( yytext, "r" );
if ( ! yyin ){
fprintf( stderr, "Unable to open \"%s\"\n",yytext);
exit( 1 );
}
yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE));
yybegin(INITIAL);
}
<INCLUDE><<EOF>>
{
fprintf( stderr, "EOF in include" );
yyterminate();
}
<<EOF>> {
if ( include_count <= 0 ){
yyterminate();
} else {
yy_delete_buffer(include_stack[include_count--] );
yy_switch_to_buffer(include_stack[include_count] );
yybegin(INCLUDE);
}
}
[a-z]+ ECHO;
.|\n ECHO;
-17
View File
@@ -1,17 +0,0 @@
This is test file #1
-------------------------------------------------
We will now include test #2 in a standard way.
#include "eof_test02.txt"
-------------------------------------------------
And now we will include test # 2 with a different
format
#include "eof_test02.txt"
-------------------------------------------------
and this is the end of the test.
-8
View File
@@ -1,8 +0,0 @@
INCLUDE #2
This is the second file that will
be included.
>>> Foo are GNU?
#include "eof_test03.txt"
-7
View File
@@ -1,7 +0,0 @@
INCLUDE #3
This is the third file that will
be included.
>>> echo "I am `whoami`!!"
-35
View File
@@ -1,35 +0,0 @@
/* basic example, fully reentrant thread-safe version */
%{
struct stats {
int num_lines;
int num_chars;
};
%}
%option reentrant noyywrap
%option extra-type="struct stats"
%%
\n {
struct stats ns = yyget_extra(yyscanner);
++ns.num_lines; ++ns.num_chars;
yyset_extra(ns, yyscanner);
}
. {
struct stats ns = yyget_extra(yyscanner);
++ns.num_chars;
yyset_extra(ns, yyscanner);
}
%%
int main() {
yyscan_t scanner;
struct stats ns;
yylex_init ( &scanner );
yylex ( scanner );
ns = yyget_extra(scanner);
printf( "# of lines = %d, # of chars = %d\n",
ns.num_lines, ns.num_chars);
yylex_destroy ( scanner );
}
-16
View File
@@ -1,16 +0,0 @@
/* basic example - non-reentrant version */
%{
int num_lines = 0, num_chars = 0;
%}
%option noyywrap
%%
\n ++num_lines; ++num_chars;
. ++num_chars;
%%
int main() {
yylex();
printf( "# of lines = %d, # of chars = %d\n",
num_lines, num_chars );
}
-21
View File
@@ -1,21 +0,0 @@
/* basic example - flawed reentrant version with global */
%{
int num_lines = 0, num_chars = 0;
%}
%option reentrant noyywrap
%%
\n ++num_lines; ++num_chars;
. ++num_chars;
%%
int main() {
yyscan_t scanner;
yylex_init ( &scanner );
yylex ( scanner );
yylex_destroy ( scanner );
printf( "# of lines = %d, # of chars = %d\n",
num_lines, num_chars );
}
-35
View File
@@ -1,35 +0,0 @@
/*
* expr.lex : Scanner for a simple
* expression parser.
*/
%{
#include "y.tab.h"
%}
%%
[0-9]+ { yylval.val = atol(yytext);
return(NUMBER);
}
[0-9]+\.[0-9]+ {
sscanf(yytext,"%f",&yylval.val);
return(NUMBER);
}
"+" return(PLUS);
"-" return(MINUS);
"*" return(MULT);
"/" return(DIV);
"^" return(EXPON);
"(" return(LB);
")" return(RB);
\n return(EOL);
[\t ]* /* throw away whitespace */
. { yyerror("Illegal character");
return(EOL);
}
%%
-64
View File
@@ -1,64 +0,0 @@
/*
* expr.y : A simple yacc expression parser
* Based on the Bison manual example.
*/
%{
#include <stdio.h>
#include <math.h>
%}
%union {
float val;
}
%token NUMBER
%token PLUS MINUS MULT DIV EXPON
%token EOL
%token LB RB
%left MINUS PLUS
%left MULT DIV
%right EXPON
%type <val> exp NUMBER
%%
input :
| input line
;
line : EOL
| exp EOL { printf("%g\n",$1);}
exp : NUMBER { $$ = $1; }
| exp PLUS exp { $$ = $1 + $3; }
| exp MINUS exp { $$ = $1 - $3; }
| exp MULT exp { $$ = $1 * $3; }
| exp DIV exp { $$ = $1 / $3; }
| MINUS exp %prec MINUS { $$ = -$2; }
| exp EXPON exp { $$ = pow($1,$3);}
| LB exp RB { $$ = $2; }
;
%%
yyerror(char *message)
{
printf("%s\n",message);
}
int main(int argc, char *argv[])
{
yyparse();
return(0);
}
-37
View File
@@ -1,37 +0,0 @@
%{
#include <stdio.h>
#include <string.h>
#include "y.tab.h" /* this comes from bison */
#define copy_and_return(token_type) { strcpy(yylval.name,yytext); \
return(token_type); }
int yylexlinenum = 0; /* so we can count lines */
%}
%%
/* Lexical scanning rules begin from here. */
MEN|WOMEN|STOCKS|TREES copy_and_return(NOUN)
MISTAKES|GNUS|EMPLOYEES copy_and_return(NOUN)
LOSERS|USERS|CARS|WINDOWS copy_and_return(NOUN)
DATABASE|NETWORK|FSF|GNU copy_and_return(PROPER_NOUN)
COMPANY|HOUSE|OFFICE|LPF copy_and_return(PROPER_NOUN)
THE|THIS|THAT|THOSE copy_and_return(DECLARATIVE)
ALL|FIRST|LAST copy_and_return(CONDITIONAL)
FIND|SEARCH|SORT|ERASE|KILL copy_and_return(VERB)
ADD|REMOVE|DELETE|PRINT copy_and_return(VERB)
QUICKLY|SLOWLY|CAREFULLY copy_and_return(ADVERB)
IN|AT|ON|AROUND|INSIDE|ON copy_and_return(POSITIONAL)
"." return(PERIOD);
"\n" yylexlinenum++; return(NEWLINE);
.
%%
-118
View File
@@ -1,118 +0,0 @@
/* C code supplied at the beginning of the file. */
%{
#include <stdio.h>
#include <string.h>
extern int yylexlinenum; /* these are in YYlex */
extern char *yytext; /* current token */
%}
/* Keywords and reserved words begin here. */
%union{ /* this is the data union */
char name[128]; /* names */
}
/*-------------------- the reserved words -----------------------------*/
%token PERIOD
%token NEWLINE
%token POSITIONAL
%token VERB
%token ADVERB
%token PROPER_NOUN
%token NOUN
%token DECLARATIVE
%token CONDITIONAL
%type <name> declarative
%type <name> verb_phrase
%type <name> noun_phrase
%type <name> position_phrase
%type <name> adverb
%type <name> POSITIONAL VERB ADVERB PROPER_NOUN
%type <name> NOUN DECLARATIVE CONDITIONAL
%%
sentence_list : sentence
| sentence_list NEWLINE sentence
;
sentence : verb_phrase noun_phrase position_phrase adverb period
{
printf("I understand that sentence.\n");
printf("VP = %s \n",$1);
printf("NP = %s \n",$2);
printf("PP = %s \n",$3);
printf("AD = %s \n",$4);
}
| { yyerror("That's a strange sentence !!"); }
;
position_phrase : POSITIONAL declarative PROPER_NOUN
{
sprintf($$,"%s %s %s",$1,$2,$3);
}
| /* empty */ { strcpy($$,""); }
;
verb_phrase : VERB { strcpy($$,$1); strcat($$," "); }
| adverb VERB
{
sprintf($$,"%s %s",$1,$2);
}
;
adverb : ADVERB { strcpy($$,$1); }
| /* empty */ { strcpy($$,""); }
;
noun_phrase : DECLARATIVE NOUN
{
sprintf($$,"%s %s",$1,$2);
}
| CONDITIONAL declarative NOUN
{
sprintf($$,"%s %s %s",$1,$2,$3);
}
| NOUN { strcpy($$,$1); strcat($$," "); }
;
declarative : DECLARATIVE { strcpy($$,$1); }
| /* empty */ { strcpy($$,""); }
;
period : /* empty */
| PERIOD
;
%%
/* Supplied main() and yyerror() functions. */
int main(int argc, char *argv[])
{
yyparse(); /* parse the file */
return(0);
}
int yyerror(char *message)
{
extern FILE *yyout;
fprintf(yyout,"\nError at line %5d. (%s) \n",
yylexlinenum,message);
}
-442
View File
@@ -1,442 +0,0 @@
/*
* j2t.lex : An example of the use (possibly abuse!)
* of start states.
*/
%{
#define MAX_STATES 1024
#define TRUE 1
#define FALSE 0
#define CHAPTER "@chapter"
#define SECTION "@section"
#define SSECTION "@subsection"
#define SSSECTION "@subsubsection"
int states[MAX_STATES];
int statep = 0;
int need_closing = FALSE;
char buffer[YY_BUF_SIZE];
extern char *yytext;
/*
* set up the head of the *.texinfo file the program
* will produce. This is a standard texinfo header.
*/
void print_header(void)
{
printf("\\input texinfo @c -*-texinfo-*-\n");
printf("@c %c**start of header\n",'%');
printf("@setfilename jargon.info\n");
printf("@settitle The New Hackers Dictionary\n");
printf("@synindex fn cp\n");
printf("@synindex vr cp\n");
printf("@c %c**end of header\n",'%');
printf("@setchapternewpage odd\n");
printf("@finalout\n");
printf("@c @smallbook\n");
printf("\n");
printf("@c ==========================================================\n\n");
printf("@c This file was produced by j2t. Any mistakes are *not* the\n");
printf("@c fault of the jargon file editors. \n");
printf("@c ==========================================================\n\n");
printf("@titlepage\n");
printf("@title The New Hackers Dictionary\n");
printf("@subtitle Version 2.9.10\n");
printf("@subtitle Generated by j2t\n");
printf("@author Eric S. Raymond, Guy L. Steel, Mark Crispin et al.\n");
printf("@end titlepage\n");
printf("@page\n");
printf("\n@c ==========================================================\n");
printf("\n\n");
printf("@unnumbered Preface\n");
printf("@c *******\n");
}
/*
* create the tail of the texinfo file produced.
*/
void print_trailer(void)
{
printf("\n@c ==========================================================\n");
printf("@contents\n"); /* print the table of contents */
printf("@bye\n\n");
}
/*
* write an underline under a section
* or chapter so we can find it later.
*/
void write_underline(int len, int space, char ch)
{
int loop;
printf("@c ");
for(loop=3; loop<space; loop++){
printf(" ");
}
while(len--){
printf("%c",ch);
}
printf("\n\n");
}
/*
* check for texinfo special characters
* and escape them
*/
char *check_and_convert(char *string)
{
int buffpos = 0;
int len,loop;
len = strlen(string);
for(loop=0; loop<len; loop++){
if(string[loop] == '@' || string[loop] == '{' || string[loop] == '}'){
buffer[buffpos++] = '@';
buffer[buffpos++] = string[loop];
} else {
buffer[buffpos++] = string[loop];
}
}
buffer[buffpos] = '\0';
return(buffer);
}
/*
* write out a chapter,section, or subsection
* header
*/
void write_block_header(char *type)
{
int loop;
int len;
(void)check_and_convert(yytext);
len = strlen(buffer);
for(loop=0; buffer[loop] != '\n';loop++)
;
buffer[loop] = '\0';
printf("%s %s\n",type,buffer);
write_underline(strlen(buffer),strlen(type)+1,'*');
}
%}
/*
* the flex description starts here
*/
%x HEADING EXAMPLE ENUM EXAMPLE2
%x BITEM BITEM_ITEM
%s LITEM LITEM2
%%
^#[^#]*"#" /* skip the header & trailer */
/* chapters have asterisks under them
* and are terminated by a colon
*/
^[^\n:]+\n[*]+\n write_block_header(CHAPTER);
^"= "[A-Z]" ="\n"="* { /* we create a section for each category */
if(need_closing == TRUE){
printf("@end table\n\n\n");
}
need_closing = TRUE;
write_block_header(SECTION);
printf("\n\n@table @b\n");
}
"Examples:"[^\.]+ yyecho();
"*"[^*\n]+"*" { /* @emph{}(emphasized) text */
yytext[yyleng-1] = '\0';
(void)check_and_convert(&yytext[1]);
printf("@i{%s}",buffer);
}
"{{"[^}]+"}}" { /* special emphasis */
yytext[yyleng-2] = '\0';
(void)check_and_convert(&yytext[2]);
printf("@b{%s}",buffer);
}
"{"[^}]+"}" { /* special emphasis */
yytext[yyleng-1] = '\0';
(void)check_and_convert(&yytext[1]);
printf("@b{%s}",buffer);
}
/* escape some special texinfo characters */
<INITIAL,LITEM,LITEM2,BITEM,ENUM,EXAMPLE,EXAMPLE2>"@" printf("@@");
<INITIAL,LITEM,LITEM2,BITEM,ENUM,EXAMPLE,EXAMPLE2>"{" printf("@{");
<INITIAL,LITEM,LITEM2,BITEM,ENUM,EXAMPLE,EXAMPLE2>"}" printf("@}");
/*
* reproduce @example code
*/
":"\n+[^\n0-9*]+\n" "[^ ] {
int loop;
int len;
int cnt;
printf(":\n\n@example \n");
strcpy(buffer,yytext);
len = strlen(buffer);
cnt = 0;
for(loop=len; loop > 0;loop--){
if(buffer[loop] == '\n')
cnt++;
if(cnt == 2)
break;
}
yyless(loop+1);
statep++;
states[statep] = EXAMPLE2;
yybegin(EXAMPLE2);
}
<EXAMPLE,EXAMPLE2>^\n {
printf("@end example\n\n");
statep--;
yybegin(states[statep]);
}
/*
* reproduce @enumerate lists
*/
":"\n+[ \t]*[0-9]+"." {
int loop;
int len;
printf(":\n\n@enumerate \n");
strcpy(buffer,yytext);
len = strlen(buffer);
for(loop=len; loop > 0;loop--){
if(buffer[loop] == '\n')
break;
}
yyless(loop);
statep++;
states[statep] = ENUM;
yybegin(ENUM);
}
<ENUM>"@" printf("@@");
<ENUM>":"\n+" "[^0-9] {
printf(":\n\n@example\n");
statep++;
states[statep] = EXAMPLE;
yybegin(EXAMPLE);
}
<ENUM>\n[ \t]+[0-9]+"." {
printf("\n\n@item ");
}
<ENUM>^[^ ] |
<ENUM>\n\n\n[ \t]+[^0-9] {
printf("\n\n@end enumerate\n\n");
statep--;
yybegin(states[statep]);
}
/*
* reproduce one kind of @itemize list
*/
":"\n+":" {
int loop;
int len;
printf(":\n\n@itemize @bullet \n");
yyless(2);
statep++;
states[statep] = LITEM2;
yybegin(LITEM2);
}
<LITEM2>^":".+":" {
(void)check_and_convert(&yytext[1]);
buffer[strlen(buffer)-1]='\0';
printf("@item @b{%s:}\n",buffer);
}
<LITEM2>\n\n\n+[^:\n] {
printf("\n\n@end itemize\n\n");
yyecho();
statep--;
yybegin(states[statep]);
}
/*
* create a list out of the revision history part.
* We need the "Version" for this because it
* clashes with other rules otherwise.
*/
:[\n]+"Version"[^:\n*]+":" {
int loop;
int len;
printf(":\n\n@itemize @bullet \n");
strcpy(buffer,yytext);
len = strlen(buffer);
for(loop=len; loop > 0;loop--){
if(buffer[loop] == '\n')
break;
}
yyless(loop);
statep++;
states[statep] = LITEM;
yybegin(LITEM);
}
<LITEM>^.+":" {
(void)check_and_convert(yytext);
buffer[strlen(buffer)-1]='\0';
printf("@item @b{%s}\n\n",buffer);
}
<LITEM>^[^:\n]+\n\n[^:\n]+\n {
int loop;
strcpy(buffer,yytext);
for(loop=0; buffer[loop] != '\n'; loop++);
buffer[loop] = '\0';
printf("%s\n",buffer);
printf("@end itemize\n\n");
printf("%s",&buffer[loop+1]);
statep--;
yybegin(states[statep]);
}
/*
* reproduce @itemize @bullet lists
*/
":"\n[ ]*"*" {
int loop;
int len;
printf(":\n\n@itemize @bullet \n");
len = strlen(buffer);
for(loop=0; loop < len;loop++){
if(buffer[loop] == '\n')
break;
}
yyless((len-loop)+2);
statep++;
states[statep] = BITEM;
yybegin(BITEM);
}
<BITEM>^" "*"*" {
printf("@item");
statep++;
states[statep] = BITEM_ITEM;
yybegin(BITEM_ITEM);
}
<BITEM>"@" printf("@@");
<BITEM>^\n {
printf("@end itemize\n\n");
statep--;
yybegin(states[statep]);
}
<BITEM_ITEM>[^\:]* {
printf(" @b{%s}\n\n",check_and_convert(yytext));
}
<BITEM_ITEM>":" {
statep--;
yybegin(states[statep]);
}
/*
* recreate @chapter, @section etc.
*/
^:[^:]* {
(void)check_and_convert(&yytext[1]);
statep++;
states[statep] = HEADING;
yybegin(HEADING);
}
<HEADING>:[^\n] {
printf("@item @b{%s}\n",buffer);
write_underline(strlen(buffer),6,'~');
statep--;
yybegin(states[statep]);
}
<HEADING>:\n"*"* {
if(need_closing == TRUE){
printf("@end table\n\n\n");
need_closing = FALSE;
}
printf("@chapter %s\n",buffer);
write_underline(strlen(buffer),9,'*');
statep--;
yybegin(states[statep]);
}
<HEADING>:\n"="* {
if(need_closing == TRUE){
printf("@end table\n\n\n");
need_closing = FALSE;
}
printf("@section %s\n",buffer);
write_underline(strlen(buffer),9,'=');
statep--;
yybegin(states[statep]);
}
<HEADING>"@" printf("@@");
<HEADING>:\n"-"* {
if(need_closing == TRUE){
printf("@end table\n\n\n");
need_closing = FALSE;
}
printf("@subsection %s\n",buffer);
write_underline(strlen(buffer),12,'-');
statep--;
yybegin(states[statep]);
}
/*
* recreate @example text
*/
^" " {
printf("@example\n");
statep++;
states[statep] = EXAMPLE;
yybegin(EXAMPLE);
}
<EXAMPLE>^" "
. yyecho();
%%
/*
* initialise and go.
*/
int main(int argc, char *argv[])
{
states[0] = INITIAL;
statep = 0;
print_header();
yylex();
print_trailer();
return(0);
}
-15
View File
@@ -1,15 +0,0 @@
/*
*
* myname.lex : A sample Flex program
* that does token replacement.
*/
%%
%NAME { printf("%s",getenv("LOGNAME")); }
%HOST { printf("%s",getenv("HOST")); }
%HOSTTYPE { printf("%s",getenv("HOSTTYPE"));}
%HOME { printf("%s",getenv("HOME")); }
%%
-6
View File
@@ -1,6 +0,0 @@
Hello, my name name is %NAME. Actually
"%NAME" isn't my real name, it is the
alias I use when I'm on %HOST, which
is the %HOSTTYPE I use. My HOME
directory is %HOME.
-19
View File
@@ -1,19 +0,0 @@
/*
* myname2.lex : A sample Flex program
* that does token replacement.
*/
%{
#include <stdio.h>
%}
%x STRING
%%
\" ECHO; BEGIN(STRING);
<STRING>[^\"\n]* ECHO;
<STRING>\" ECHO; BEGIN(INITIAL);
%NAME { printf("%s",getenv("LOGNAME")); }
%HOST { printf("%s",getenv("HOST")); }
%HOSTTYPE { printf("%s",getenv("HOSTTYPE"));}
%HOME { printf("%s",getenv("HOME")); }
-145
View File
@@ -1,145 +0,0 @@
/*
* numbers.lex : An example of the definitions and techniques
* for scanning numbers
*/
%{
#include <stdio.h>
#define UNSIGNED_LONG_SYM 1
#define SIGNED_LONG_SYM 2
#define UNSIGNED_SYM 3
#define SIGNED_SYM 4
#define LONG_DOUBLE_SYM 5
#define FLOAT_SYM 6
union _yylval {
long double ylong_double;
float yfloat;
unsigned long yunsigned_long;
unsigned yunsigned;
long ysigned_long;
int ysigned;
} yylval;
%}
digit [0-9]
hex_digit [0-9a-fA-F]
oct_digit [0-7]
exponent [eE][+-]?{digit}+
i {digit}+
float_constant ({i}\.{i}?|{i}?\.{i}){exponent}?
hex_constant 0[xX]{hex_digit}+
oct_constant 0{oct_digit}*
int_constant {digit}+
long_ext [lL]
unsigned_ext [uU]
float_ext [fF]
ulong_ext {long_ext}{unsigned_ext}|{unsigned_ext}{long_ext}
%%
{hex_constant}{ulong_ext} { /* we need to skip the "0x" part */
sscanf(&yytext[2],"%lx",&yylval.yunsigned_long);
return(UNSIGNED_LONG_SYM);
}
{hex_constant}{long_ext} {
sscanf(&yytext[2],"%lx",&yylval.ysigned_long);
return(SIGNED_LONG_SYM);
}
{hex_constant}{unsigned_ext} {
sscanf(&yytext[2],"%x",&yylval.yunsigned);
return(UNSIGNED_SYM);
}
{hex_constant} { /* use %lx to protect against overflow */
sscanf(&yytext[2],"%lx",&yylval.ysigned_long);
return(SIGNED_LONG_SYM);
}
{oct_constant}{ulong_ext} {
sscanf(yytext,"%lo",&yylval.yunsigned_long);
return(UNSIGNED_LONG_SYM);
}
{oct_constant}{long_ext} {
sscanf(yytext,"%lo",&yylval.ysigned_long);
return(SIGNED_LONG_SYM);
}
{oct_constant}{unsigned_ext} {
sscanf(yytext,"%o",&yylval.yunsigned);
return(UNSIGNED_SYM);
}
{oct_constant} { /* use %lo to protect against overflow */
sscanf(yytext,"%lo",&yylval.ysigned_long);
return(SIGNED_LONG_SYM);
}
{int_constant}{ulong_ext} {
sscanf(yytext,"%ld",&yylval.yunsigned_long);
return(UNSIGNED_LONG_SYM);
}
{int_constant}{long_ext} {
sscanf(yytext,"%ld",&yylval.ysigned_long);
return(SIGNED_LONG_SYM);
}
{int_constant}{unsigned_ext} {
sscanf(yytext,"%d",&yylval.yunsigned);
return(UNSIGNED_SYM);
}
{int_constant} { /* use %ld to protect against overflow */
sscanf(yytext,"%ld",&yylval.ysigned_long);
return(SIGNED_LONG_SYM);
}
{float_constant}{long_ext} {
sscanf(yytext,"%lf",&yylval.ylong_double);
return(LONG_DOUBLE_SYM);
}
{float_constant}{float_ext} {
sscanf(yytext,"%f",&yylval.yfloat);
return(FLOAT_SYM);
}
{float_constant} { /* use %lf to protect against overflow */
sscanf(yytext,"%lf",&yylval.ylong_double);
return(LONG_DOUBLE_SYM);
}
%%
int main(void)
{
int code;
while((code = yylex())){
printf("yytext : %s\n",yytext);
switch(code){
case UNSIGNED_LONG_SYM:
printf("Type of number : UNSIGNED LONG\n");
printf("Value of number : %lu\n",yylval.yunsigned_long);
break;
case SIGNED_LONG_SYM:
printf("Type of number : SIGNED LONG\n");
printf("Value of number : %ld\n",yylval.ysigned_long);
break;
case UNSIGNED_SYM:
printf("Type of number : UNSIGNED\n");
printf("Value of number : %u\n",yylval.yunsigned);
break;
case SIGNED_SYM:
printf("Type of number : SIGNED\n");
printf("Value of number : %d\n",yylval.ysigned);
break;
case LONG_DOUBLE_SYM:
printf("Type of number : LONG DOUBLE\n");
printf("Value of number : %lf\n",yylval.ylong_double);
break;
case FLOAT_SYM:
printf("Type of number : FLOAT\n");
printf("Value of number : %f\n",yylval.yfloat);
break;
default:
printf("Type of number : UNDEFINED\n");
printf("Value of number : UNDEFINED\n");
break;
}
}
return(0);
}
-78
View File
@@ -1,78 +0,0 @@
/*
* eof_rules.lex : An example of using multiple buffers
* EOF rules, and start states
*/
%{
#define MAX_NEST 10
YY_BUFFER_STATE include_stack[MAX_NEST];
int include_count = -1;
%}
%x INCLUDE
%x COMMENT
%%
"{" yybegin(COMMENT);
<COMMENT>"}" yybegin(INITIAL);
<COMMENT>"$include"[ \t]*"(" yybegin(INCLUDE);
<COMMENT>[ \t]* /* skip whitespace */
<INCLUDE>")" yybegin(COMMENT);
<INCLUDE>[ \t]* /* skip whitespace */
<INCLUDE>[^ \t\n() ]+ { /* get the include file name */
if ( include_count >= MAX_NEST){
fprintf( stderr, "Too many include files" );
exit( 1 );
}
include_stack[++include_count] = yy_current_buffer();
yyin = fopen( yytext, "r" );
if ( ! yyin ){
fprintf( stderr, "Unable to open %s",yytext);
exit( 1 );
}
yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE));
yybegin(INITIAL);
}
<INCLUDE><<EOF>>
{
fprintf( stderr, "EOF in include" );
yyterminate();
}
<COMMENT><<EOF>>
{
fprintf( stderr, "EOF in comment" );
yyterminate();
}
<<EOF>> {
if ( include_count <= 0 ){
yyterminate();
} else {
yy_delete_buffer(include_stack[include_count--] );
yy_switch_to_buffer(include_stack[include_count] );
yybegin(INCLUDE);
}
}
[a-z]+ yyecho();
.|\n yyecho();
-120
View File
@@ -1,120 +0,0 @@
/*
* pascal.lex: An example PASCAL scanner
*
*/
%{
#include <stdio.h>
#include "y.tab.h"
int line_number = 0;
void yyerror(char *message);
%}
%x COMMENT1 COMMENT2
white_space [ \t]*
digit [0-9]
alpha [A-Za-z_]
alpha_num ({alpha}|{digit})
hex_digit [0-9A-F]
identifier {alpha}{alpha_num}*
unsigned_integer {digit}+
hex_integer ${hex_digit}{hex_digit}*
exponent e[+-]?{digit}+
i {unsigned_integer}
real ({i}\.{i}?|{i}?\.{i}){exponent}?
string \'([^'\n]|\'\')+\'
bad_string \'([^'\n]|\'\')+
%%
"{" yybegin(COMMENT1);
<COMMENT1>[^}\n]+
<COMMENT1>\n ++line_number;
<COMMENT1><<EOF>> yyerror("EOF in comment");
<COMMENT1>"}" yybegin(INITIAL);
"(*" yybegin(COMMENT2);
<COMMENT2>[^)*\n]+
<COMMENT2>\n ++line_number;
<COMMENT2><<EOF>> yyerror("EOF in comment");
<COMMENT2>"*)" yybegin(INITIAL);
<COMMENT2>[*)]
/* note that FILE and BEGIN are already
* defined in FLEX or C so they can't
* be used. This can be overcome in
* a cleaner way by defining all the
* tokens to start with TOK_ or some
* other prefix.
*/
and return(AND);
array return(ARRAY);
begin return(_BEGIN);
case return(CASE);
const return(CONST);
div return(DIV);
do return(DO);
downto return(DOWNTO);
else return(ELSE);
end return(END);
file return(_FILE);
for return(FOR);
function return(FUNCTION);
goto return(GOTO);
if return(IF);
in return(IN);
label return(LABEL);
mod return(MOD);
nil return(NIL);
not return(NOT);
of return(OF);
packed return(PACKED);
procedure return(PROCEDURE);
program return(PROGRAM);
record return(RECORD);
repeat return(REPEAT);
set return(SET);
then return(THEN);
to return(TO);
type return(TYPE);
until return(UNTIL);
var return(VAR);
while return(WHILE);
with return(WITH);
"<="|"=<" return(LEQ);
"=>"|">=" return(GEQ);
"<>" return(NEQ);
"=" return(EQ);
".." return(DOUBLEDOT);
{unsigned_integer} return(UNSIGNED_INTEGER);
{real} return(REAL);
{hex_integer} return(HEX_INTEGER);
{string} return{STRING};
{bad_string} yyerror("Unterminated string");
{identifier} return(IDENTIFIER);
[*/+\-,^.;:()\[\]] return(yytext[0]);
{white_space} /* do nothing */
\n line_number += 1;
. yyerror("Illegal input");
%%
void yyerror(char *message)
{
fprintf(stderr,"Error: \"%s\" in line %d. Token = %s\n",
message,line_number,yytext);
exit(1);
}
-12
View File
@@ -1,12 +0,0 @@
/*
* reject.lex: An example of yyreject() and yyunput()
* misuse.
*/
%%
UNIX {
yyunput('U'); yyunput('N'); yyunput('G'); yyunput('\0');
yyreject();
}
GNU printf("GNU is Not Unix!\n");
%%
-33
View File
@@ -1,33 +0,0 @@
/*
* replace.lex : A simple filter for renaming
* parts of flex of bison generated
* scanners or parsers.
*/
%{
#include <stdio.h>
char lower_replace[1024];
char upper_replace[1024];
%}
%%
"yy" printf("%s",lower_replace);
"YY" printf("%s",upper_replace);
, yyecho();
%%
int main(int argc, char *argv[])
{
if(argc < 2){
printf("Usage %s lower UPPER\n",argv[0]);
exit(1);
}
strcpy(lower_replace,argv[1]);
strcpy(upper_replace,argv[2]);
yylex();
return(0);
}
-98
View File
@@ -1,98 +0,0 @@
/*
* string1.lex: Handling strings by using yyinput()
*/
%{
#include <ctype.h>
#include <malloc.h>
#define ALLOC_SIZE 32 /* for (re)allocating the buffer */
#define isodigit(x) ((x) >= '0' && (x) <= '7')
#define hextoint(x) (isdigit((x)) ? (x) - '0' : ((x) - 'A') + 10)
void yyerror(char *message)
{
printf("\nError: %s\n",message);
}
%}
%%
\" {
int inch,count,max_size;
char *buffer;
int temp;
buffer = malloc(ALLOC_SIZE);
max_size = ALLOC_SIZE;
inch = yyinput();
count = 0;
while(inch != EOF && inch != '"' && inch != '\n'){
if(inch == '\\'){
inch = yyinput();
switch(inch){
case '\n': inch = yyinput(); break;
case 'b' : inch = '\b'; break;
case 't' : inch = '\t'; break;
case 'n' : inch = '\n'; break;
case 'v' : inch = '\v'; break;
case 'f' : inch = '\f'; break;
case 'r' : inch = '\r'; break;
case 'X' :
case 'x' : inch = yyinput();
if(isxdigit(inch)){
temp = hextoint(toupper(inch));
inch = yyinput();
if(isxdigit(inch)){
temp = (temp << 4) + hextoint(toupper(inch));
} else {
unput(inch);
}
inch = temp;
} else {
unput(inch);
inch = 'x';
}
break;
default:
if(isodigit(inch)){
temp = inch - '0';
inch = yyinput();
if(isodigit(inch)){
temp = (temp << 3) + (inch - '0');
} else {
unput(inch);
goto done;
}
inch = yyinput();
if(isodigit(inch)){
temp = (temp << 3) + (inch - '0');
} else {
unput(inch);
}
done:
inch = temp;
}
}
}
buffer[count++] = inch;
if(count >= max_size){
buffer = realloc(buffer,max_size + ALLOC_SIZE);
max_size += ALLOC_SIZE;
}
inch = yyinput();
}
if(inch == EOF || inch == '\n'){
yyerror("Unterminated string.");
}
buffer[count] = '\0';
printf("String = \"%s\"\n",buffer);
free(buffer);
}
.
\n
%%
-94
View File
@@ -1,94 +0,0 @@
/*
* string2.lex: An example of using scanning strings
* by using start states.
*/
%{
#include <ctype.h>
#include <malloc.h>
#define isodigit(x) ((x) >= '0' && (x) <= '7')
#define hextoint(x) (isdigit((x)) ? (x) - '0' : ((x) - 'A') + 10)
char *buffer = NULL;
int buffer_size = 0;
void yyerror(char *message)
{
printf("\nError: %s\n",message);
}
%}
%x STRING
hex (x|X)[0-9a-fA-F]{1,2}
oct [0-7]{1,3}
%%
\" {
buffer = malloc(1);
buffer_size = 1; strcpy(buffer,"");
yybegin(STRING);
}
<STRING>\n {
yyerror("Unterminated string");
free(buffer);
yybegin(INITIAL);
}
<STRING><<EOF>> {
yyerror("EOF in string");
free(buffer);
yybegin(INITIAL);
}
<STRING>[^\\\n"] {
buffer = realloc(buffer,buffer_size+yyleng+1);
buffer_size += yyleng;
strcat(buffer,yytext);
}
<STRING>\\\n /* ignore this */
<STRING>\\{hex} {
int temp =0,loop = 0;
for(loop=yyleng-2; loop>0; loop--){
temp <<= 4;
temp += hextoint(toupper(yytext[yyleng-loop]));
}
buffer = realloc(buffer,buffer_size+1);
buffer[buffer_size-1] = temp;
buffer[buffer_size] = '\0';
buffer_size += 1;
}
<STRING>\\{oct} {
int temp =0,loop = 0;
for(loop=yyleng-1; loop>0; loop--){
temp <<= 3;
temp += (yytext[yyleng-loop] - '0');
}
buffer = realloc(buffer,buffer_size+1);
buffer[buffer_size-1] = temp;
buffer[buffer_size] = '\0';
buffer_size += 1;
}
<STRING>\\[^\n] {
buffer = realloc(buffer,buffer_size+1);
switch(yytext[yyleng-1]){
case 'b' : buffer[buffer_size-1] = '\b'; break;
case 't' : buffer[buffer_size-1] = '\t'; break;
case 'n' : buffer[buffer_size-1] = '\n'; break;
case 'v' : buffer[buffer_size-1] = '\v'; break;
case 'f' : buffer[buffer_size-1] = '\f'; break;
case 'r' : buffer[buffer_size-1] = '\r'; break;
default : buffer[buffer_size-1] = yytext[yyleng-1];
}
buffer[buffer_size] = '\0';
buffer_size += 1;
}
<STRING>\" {
printf("string = \"%s\"",buffer);
free(buffer);
yybegin(INITIAL);
}
%%
-21
View File
@@ -1,21 +0,0 @@
"This is a string"
"The next string will be empty"
""
"This is a string with a \b(\\b) in it"
"This is a string with a \t(\\t) in it"
"This is a string with a \n(\\n) in it"
"This is a string with a \v(\\v) in it"
"This is a string with a \f(\\f) in it"
"This is a string with a \r(\\r) in it"
"This is a string with a \"(\\\") in it"
"This is a string with a \z(\\z) in it"
"This is a string with a \X4a(\\X4a) in it"
"This is a string with a \x4a(\\x4a) in it"
"This is a string with a \x7(\\x7) in it"
"This is a string with a \112(\\112) in it"
"This is a string with a \043(\\043) in it"
"This is a string with a \7(\\7) in it"
"This is a multi-line \
string"
"This is an unterminated string
"This is an unterminated string too
-32
View File
@@ -1,32 +0,0 @@
/*
* unput.l : An example of what *not*
* to do with yyunput().
*/
%{
#include <stdio.h>
void putback_yytext(void);
%}
%%
foobar putback_yytext();
raboof putback_yytext();
%%
void putback_yytext(void)
{
int i;
int l = strlen(yytext);
char buffer[YY_BUF_SIZE];
strcpy(buffer,yytext);
printf("Got: %s\n",yytext);
for(i=0; i<l; i++){
yyunput(buffer[i]);
}
}
-30
View File
@@ -1,30 +0,0 @@
%{
#include <ctype.h>
void user_action(void);
%}
%option pre-action = "user_action();"
%%
.* yyecho();
\n yyecho();
%%
void user_action(void)
{
int loop;
for(loop=0; loop<yyleng; loop++){
if(islower(yytext[loop])){
yytext[loop] = toupper(yytext[loop]);
}
}
}
-29
View File
@@ -1,29 +0,0 @@
%{
extern FILE *yyin;
void open_input_file(void)
{
char *file_name,buffer[1024];
yyin = NULL;
while(yyin == NULL){
printf("Input file: ");
file_name = fgets(buffer,1024,stdin);
if(file_name){
file_name[strlen(file_name)-1] = '\0';
yyin = fopen(file_name,"r");
if(yyin == NULL){
printf("Unable to open \"%s\"\n",file_name);
}
} else {
printf("stdin\n");
yyin = stdin;
break;
}
}
}
%}
%option user-init = "open_input_file();"
%%
-122
View File
@@ -1,122 +0,0 @@
%{
/*
* wc.lex : A simple example of using FLEX
* to create a wc-like utility.
*
* See MISC/fastwc/ in the flex distribution for examples
* of how to write this scanner for maximum performance.
*/
int numchars = 0;
int numwords = 0;
int numlines = 0;
int totchars = 0;
int totwords = 0;
int totlines = 0;
/*
* rules start from here
*/
%}
%%
[\n] { numchars++; numlines++; }
[\r] { numchars++; }
[^ \t\n]+ { numwords++; numchars += yyleng; }
. { numchars++; }
%%
/*
* additional C code start from here. This supplies
* all the argument processing etc.
*/
int main(int argc, char *argv[])
{
int loop,first=1;
int lflag = 0; /* 1 if we count # of lines */
int wflag = 0; /* 1 if we count # of words */
int cflag = 0; /* 1 if we count # of characters */
int fflag = 0; /* 1 if we have a file name */
for(loop=1; loop<argc; loop++){
if(argv[loop][0] == '-'){
switch(argv[loop][1]){
case 'l':
lflag = 1;
break;
case 'w':
wflag = 1;
break;
case 'c':
cflag = 1;
break;
default:
fprintf(stderr,"unknown option -%c\n",
argv[loop][1]);
}
}
}
if(lflag == 0 && wflag == 0 && cflag == 0){
lflag = wflag = cflag = 1; /* default to all on */
}
for(loop=1; loop<argc; loop++){
if(argv[loop][0] != '-'){
fflag = 1;
numlines = numchars = numwords = 0;
if((yyin = fopen(argv[loop],"rb")) != NULL){
if(first){
first = 0;
} else {
YY_NEW_FILE;
}
(void) yylex();
fclose(yyin);
totwords += numwords;
totchars += numchars;
totlines += numlines;
printf("file : %25s :",argv[loop]) ;
if(lflag){
fprintf(stdout,"lines %5d ",numlines);
}
if(cflag){
fprintf(stdout,"characters %5d ",numchars);
}
if(wflag){
fprintf(stdout,"words %5d ",numwords);
}
fprintf(stdout,"\n");
}else{
fprintf(stderr,"wc : file not found %s\n",argv[loop]);
}
}
}
if(!fflag){
fprintf(stderr,"usage : wc [-l -w -c] file [file...]\n");
fprintf(stderr,"-l = count lines\n");
fprintf(stderr,"-c = count characters\n");
fprintf(stderr,"-w = count words\n");
exit(1);
}
for(loop=0;loop<79; loop++){
fprintf(stdout,"-");
}
fprintf(stdout,"\n");
fprintf(stdout,"total : %25s ","") ;
if(lflag){
fprintf(stdout,"lines %5d ",totlines);
}
if(cflag){
fprintf(stdout,"characters %5d ",totchars);
}
if(wflag){
fprintf(stdout,"words %5d ",totwords);
}
fprintf(stdout,"\n");
return(0);
}
-29
View File
@@ -1,29 +0,0 @@
/*
* yymore.lex: An example of using yymore()
* to good effect.
*/
%{
#include <memory.h>
void yyerror(char *message)
{
printf("Error: %s\n",message);
}
%}
%x STRING
%%
\" yybegin(STRING);
<STRING>[^\\\n"]* yymore();
<STRING><<EOF>> yyerror("EOF in string."); yybegin(INITIAL);
<STRING>\n yyerror("Unterminated string."); yybegin(INITIAL);
<STRING>\\\n yymore();
<STRING>\" {
yytext[yyleng-1] = '\0';
printf("string = \"%s\"",yytext); yybegin(INITIAL);
}
%%
-33
View File
@@ -1,33 +0,0 @@
/*
* yymore.lex: An example of using yymore()
* to good effect.
*/
%{
#include <memory.h>
void yyerror(char *message)
{
printf("Error: %s\n",message);
}
%}
%x STRING
%%
\" yybegin(STRING);
<STRING>[^\\\n"]* yymore();
<STRING><<EOF>> yyerror("EOF in string."); yybegin(INITIAL);
<STRING>\n yyerror("Unterminated string."); yybegin(INITIAL);
<STRING>\\\n {
bcopy(yytext,yytext+2,yyleng-2);
yytext += 2; yyleng -= 2;
yymore();
}
<STRING>\" {
yyleng -= 1; yytext[yyleng] = '\0';
printf("string = \"%s\"",yytext); yybegin(INITIAL);
}
%%
-7
View File
@@ -1,7 +0,0 @@
"This is a test \
of multi-line string \
scanning in flex. \
This may be breaking some law \
of usage though..."
-58
View File
@@ -1,58 +0,0 @@
// An example of using the flex C++ scanner class.
%option C++ noyywrap
%{
int mylineno = 0;
%}
string \"[^\n"]+\"
ws [ \t]+
alpha [A-Za-z]
dig [0-9]
name ({alpha}|{dig}|\$)({alpha}|{dig}|\_|\.|\-|\/|\$)*
num1 [-+]?{dig}+\.?([eE][-+]?{dig}+)?
num2 [-+]?{dig}*\.{dig}+([eE][-+]?{dig}+)?
number {num1}|{num2}
%%
{ws} /* skip blanks and tabs */
"/*" {
int c;
while((c = yyinput()) != 0)
{
if(c == '\n')
++mylineno;
else if(c == '*')
{
if((c = yyinput()) == '/')
break;
else
unput(c);
}
}
}
{number} std::cout << "number " << YYText() << '\n';
\n mylineno++;
{name} std::cout << "name " << YYText() << '\n';
{string} std::cout << "string " << YYText() << '\n';
%%
int main( int /* argc */, char** /* argv */ )
{
FlexLexer* lexer = new yyFlexLexer;
while(lexer->yylex() != 0)
;
return 0;
}
-4
View File
@@ -1,4 +0,0 @@
*.la
*.lo
*.o
*.obj
-17
View File
@@ -1,17 +0,0 @@
#include <config.h>
#undef malloc
#include <sys/types.h>
void *malloc (size_t n);
/* Allocate an N-byte block of memory from the heap.
If N is zero, allocate a 1-byte block. */
void *
rpl_malloc (size_t n)
{
if (n == 0)
n = 1;
return malloc (n);
}
-29
View File
@@ -1,29 +0,0 @@
#include <config.h>
#undef realloc
#undef malloc
#include <stdlib.h>
#include <errno.h>
void * rpl_realloc (void *p, size_t n)
{
void *result;
if (n == 0)
{
n = 1;
}
if (p == NULL)
{
result = malloc (n);
}
else
result = realloc (p, n);
if (result == NULL)
errno = ENOMEM;
return result;
}
-175
View File
@@ -1,175 +0,0 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_PROG_CC_FOR_BUILD
#
# DESCRIPTION
#
# This macro searches for a C compiler that generates native executables,
# that is a C compiler that surely is not a cross-compiler. This can be
# useful if you have to generate source code at compile-time like for
# example GCC does.
#
# The macro sets the CC_FOR_BUILD and CPP_FOR_BUILD macros to anything
# needed to compile or link (CC_FOR_BUILD) and preprocess (CPP_FOR_BUILD).
# The value of these variables can be overridden by the user by specifying
# a compiler with an environment variable (like you do for standard CC).
#
# It also sets BUILD_EXEEXT and BUILD_OBJEXT to the executable and object
# file extensions for the build platform, and GCC_FOR_BUILD to `yes' if
# the compiler we found is GCC. All these variables but GCC_FOR_BUILD are
# substituted in the Makefile.
#
# LICENSE
#
# Copyright (c) 2008 Paolo Bonzini <bonzini@gnu.org>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 26
AU_ALIAS([AC_PROG_CC_FOR_BUILD], [AX_PROG_CC_FOR_BUILD])
AC_DEFUN([AX_PROG_CC_FOR_BUILD], [dnl
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_CPP])dnl
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
dnl Use the standard macros, but make them use other variable names
dnl
pushdef([ac_cv_prog_CPP], ac_cv_build_prog_CPP)dnl
pushdef([ac_cv_prog_gcc], ac_cv_build_prog_gcc)dnl
pushdef([ac_cv_prog_cc_c89], ac_cv_build_prog_cc_c89)dnl
pushdef([ac_cv_prog_cc_c99], ac_cv_build_prog_cc_c99)dnl
pushdef([ac_cv_prog_cc_c11], ac_cv_build_prog_cc_c11)dnl
pushdef([ac_cv_prog_cc_c23], ac_cv_build_prog_cc_c23)dnl
pushdef([ac_cv_prog_cc_stdc], ac_cv_build_prog_cc_stdc)dnl
pushdef([ac_cv_prog_cc_works], ac_cv_build_prog_cc_works)dnl
pushdef([ac_cv_prog_cc_cross], ac_cv_build_prog_cc_cross)dnl
pushdef([ac_cv_prog_cc_g], ac_cv_build_prog_cc_g)dnl
pushdef([ac_prog_cc_stdc], ac_build_prog_cc_stdc)dnl
pushdef([ac_exeext], ac_build_exeext)dnl
pushdef([ac_objext], ac_build_objext)dnl
pushdef([CC], CC_FOR_BUILD)dnl
pushdef([CPP], CPP_FOR_BUILD)dnl
pushdef([GCC], GCC_FOR_BUILD)dnl
pushdef([CFLAGS], CFLAGS_FOR_BUILD)dnl
pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl
pushdef([LDFLAGS], LDFLAGS_FOR_BUILD)dnl
pushdef([host], build)dnl
pushdef([host_alias], build_alias)dnl
pushdef([host_cpu], build_cpu)dnl
pushdef([host_vendor], build_vendor)dnl
pushdef([host_os], build_os)dnl
pushdef([ac_cv_host], ac_cv_build)dnl
pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl
pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl
pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl
pushdef([ac_cv_host_os], ac_cv_build_os)dnl
pushdef([ac_tool_prefix], ac_build_tool_prefix)dnl
pushdef([am_cv_CC_dependencies_compiler_type], am_cv_build_CC_dependencies_compiler_type)dnl
pushdef([am_cv_prog_cc_c_o], am_cv_build_prog_cc_c_o)dnl
pushdef([cross_compiling], cross_compiling_build)dnl
dnl
dnl These variables are problematic to rename by M4 macros, so we save
dnl their values in alternative names, and restore the values later.
dnl
dnl _AC_COMPILER_EXEEXT and _AC_COMPILER_OBJEXT internally call
dnl AC_SUBST which prevents the renaming of EXEEXT and OBJEXT
dnl variables. It's not a good idea to rename ac_cv_exeext and
dnl ac_cv_objext either as they're related.
dnl Renaming ac_exeext and ac_objext is safe though.
dnl
ac_cv_host_exeext=$ac_cv_exeext
AS_VAR_SET_IF([ac_cv_build_exeext],
[ac_cv_exeext=$ac_cv_build_exeext],
[AS_UNSET([ac_cv_exeext])])
ac_cv_host_objext=$ac_cv_objext
AS_VAR_SET_IF([ac_cv_build_objext],
[ac_cv_objext=$ac_cv_build_objext],
[AS_UNSET([ac_cv_objext])])
dnl
dnl ac_cv_c_compiler_gnu is used in _AC_LANG_COMPILER_GNU (called by
dnl AC_PROG_CC) indirectly.
dnl
ac_cv_host_c_compiler_gnu=$ac_cv_c_compiler_gnu
AS_VAR_SET_IF([ac_cv_build_c_compiler_gnu],
[ac_cv_c_compiler_gnu=$ac_cv_build_c_compiler_gnu],
[AS_UNSET([ac_cv_c_compiler_gnu])])
cross_compiling_build=no
ac_build_tool_prefix=
AS_IF([test -n "$build"], [ac_build_tool_prefix="$build-"],
[test -n "$build_alias"],[ac_build_tool_prefix="$build_alias-"])
AC_LANG_PUSH([C])
AC_PROG_CC
_AC_COMPILER_EXEEXT
_AC_COMPILER_OBJEXT
AC_PROG_CPP
BUILD_EXEEXT=$ac_cv_exeext
BUILD_OBJEXT=$ac_cv_objext
dnl Restore the old definitions
dnl
popdef([cross_compiling])dnl
popdef([am_cv_prog_cc_c_o])dnl
popdef([am_cv_CC_dependencies_compiler_type])dnl
popdef([ac_tool_prefix])dnl
popdef([ac_cv_host_os])dnl
popdef([ac_cv_host_vendor])dnl
popdef([ac_cv_host_cpu])dnl
popdef([ac_cv_host_alias])dnl
popdef([ac_cv_host])dnl
popdef([host_os])dnl
popdef([host_vendor])dnl
popdef([host_cpu])dnl
popdef([host_alias])dnl
popdef([host])dnl
popdef([LDFLAGS])dnl
popdef([CPPFLAGS])dnl
popdef([CFLAGS])dnl
popdef([GCC])dnl
popdef([CPP])dnl
popdef([CC])dnl
popdef([ac_objext])dnl
popdef([ac_exeext])dnl
popdef([ac_prog_cc_stdc])dnl
popdef([ac_cv_prog_cc_g])dnl
popdef([ac_cv_prog_cc_cross])dnl
popdef([ac_cv_prog_cc_works])dnl
popdef([ac_cv_prog_cc_stdc])dnl
popdef([ac_cv_prog_cc_c23])dnl
popdef([ac_cv_prog_cc_c11])dnl
popdef([ac_cv_prog_cc_c99])dnl
popdef([ac_cv_prog_cc_c89])dnl
popdef([ac_cv_prog_gcc])dnl
popdef([ac_cv_prog_CPP])dnl
dnl
ac_cv_exeext=$ac_cv_host_exeext
EXEEXT=$ac_cv_host_exeext
ac_cv_objext=$ac_cv_host_objext
OBJEXT=$ac_cv_host_objext
ac_cv_c_compiler_gnu=$ac_cv_host_c_compiler_gnu
ac_compiler_gnu=$ac_cv_host_c_compiler_gnu
dnl restore global variables ac_ext, ac_cpp, ac_compile,
dnl ac_link, ac_compiler_gnu (dependent on the current
dnl language after popping):
AC_LANG_POP([C])
dnl Finally, set Makefile variables
dnl
AC_SUBST([BUILD_EXEEXT])dnl
AC_SUBST([BUILD_OBJEXT])dnl
AC_SUBST([CFLAGS_FOR_BUILD])dnl
AC_SUBST([CPPFLAGS_FOR_BUILD])dnl
AC_SUBST([LDFLAGS_FOR_BUILD])dnl
])
+119
View File
@@ -0,0 +1,119 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
The flex manual is placed under the same licensing conditions as the
rest of flex:
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
The Flex Project.
Copyright (C) 1990, 1997 The Regents of the University of California.
All rights reserved.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. -->
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Lexical Analysis With Flex, for Flex 2.6.2: A Note About yytext And Memory</title>
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: A Note About yytext And Memory">
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: A Note About yytext And Memory">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Indices.html#Indices" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Memory-Management.html#Memory-Management" rel="up" title="Memory Management">
<link href="Serialized-Tables.html#Serialized-Tables" rel="next" title="Serialized Tables">
<link href="Overriding-The-Default-Memory-Management.html#Overriding-The-Default-Memory-Management" rel="prev" title="Overriding The Default Memory Management">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="A-Note-About-yytext-And-Memory"></a>
<div class="header">
<p>
Previous: <a href="Overriding-The-Default-Memory-Management.html#Overriding-The-Default-Memory-Management" accesskey="p" rel="prev">Overriding The Default Memory Management</a>, Up: <a href="Memory-Management.html#Memory-Management" accesskey="u" rel="up">Memory Management</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="A-Note-About-yytext-And-Memory-1"></a>
<h3 class="section">21.3 A Note About yytext And Memory</h3>
<a name="index-yytext_002c-memory-considerations"></a>
<p>When flex finds a match, <code>yytext</code> points to the first character of the
match in the input buffer. The string itself is part of the input buffer, and
is <em>NOT</em> allocated separately. The value of yytext will be overwritten the next
time yylex() is called. In short, the value of yytext is only valid from within
the matched rule&rsquo;s action.
</p>
<p>Often, you want the value of yytext to persist for later processing, i.e., by a
parser with non-zero lookahead. In order to preserve yytext, you will have to
copy it with strdup() or a similar function. But this introduces some headache
because your parser is now responsible for freeing the copy of yytext. If you
use a yacc or bison parser, (commonly used with flex), you will discover that
the error recovery mechanisms can cause memory to be leaked.
</p>
<p>To prevent memory leaks from strdup&rsquo;d yytext, you will have to track the memory
somehow. Our experience has shown that a garbage collection mechanism or a
pooled memory mechanism will save you a lot of grief when writing parsers.
</p>
</body>
</html>
+112
View File
@@ -0,0 +1,112 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
The flex manual is placed under the same licensing conditions as the
rest of flex:
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
The Flex Project.
Copyright (C) 1990, 1997 The Regents of the University of California.
All rights reserved.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. -->
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Lexical Analysis With Flex, for Flex 2.6.2: About yyscan_t</title>
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: About yyscan_t">
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: About yyscan_t">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Indices.html#Indices" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Reentrant-Detail.html#Reentrant-Detail" rel="up" title="Reentrant Detail">
<link href="Reentrant-Functions.html#Reentrant-Functions" rel="next" title="Reentrant Functions">
<link href="Extra-Data.html#Extra-Data" rel="prev" title="Extra Data">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="About-yyscan_005ft"></a>
<div class="header">
<p>
Previous: <a href="Extra-Data.html#Extra-Data" accesskey="p" rel="prev">Extra Data</a>, Up: <a href="Reentrant-Detail.html#Reentrant-Detail" accesskey="u" rel="up">Reentrant Detail</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="About-yyscan_005ft-1"></a>
<h4 class="subsection">19.4.7 About yyscan_t</h4>
<a name="index-yyscan_005ft-_0028reentrant-only_0029"></a>
<p><code>yyscan_t</code> is defined as:
</p>
<div class="example">
<pre class="verbatim"> typedef void* yyscan_t;
</pre></div>
<p>It is initialized by <code>yylex_init()</code> to point to
an internal structure. You should never access this value
directly. In particular, you should never attempt to free it
(use <code>yylex_destroy()</code> instead.)
</p>
</body>
</html>
+134
View File
@@ -0,0 +1,134 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
The flex manual is placed under the same licensing conditions as the
rest of flex:
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
The Flex Project.
Copyright (C) 1990, 1997 The Regents of the University of California.
All rights reserved.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. -->
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Lexical Analysis With Flex, for Flex 2.6.2: Accessor Methods</title>
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Accessor Methods">
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Accessor Methods">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Indices.html#Indices" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Reentrant-Detail.html#Reentrant-Detail" rel="up" title="Reentrant Detail">
<link href="Extra-Data.html#Extra-Data" rel="next" title="Extra Data">
<link href="Init-and-Destroy-Functions.html#Init-and-Destroy-Functions" rel="prev" title="Init and Destroy Functions">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Accessor-Methods"></a>
<div class="header">
<p>
Next: <a href="Extra-Data.html#Extra-Data" accesskey="n" rel="next">Extra Data</a>, Previous: <a href="Init-and-Destroy-Functions.html#Init-and-Destroy-Functions" accesskey="p" rel="prev">Init and Destroy Functions</a>, Up: <a href="Reentrant-Detail.html#Reentrant-Detail" accesskey="u" rel="up">Reentrant Detail</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Accessing-Variables-with-Reentrant-Scanners"></a>
<h4 class="subsection">19.4.5 Accessing Variables with Reentrant Scanners</h4>
<a name="index-reentrant_002c-accessor-functions"></a>
<p>Accessor methods (get/set functions) provide access to common
<code>flex</code> variables.
</p>
<p>Many scanners that you build will be part of a larger project. Portions
of your project will need access to <code>flex</code> values, such as
<code>yytext</code>. In a non-reentrant scanner, these values are global, so
there is no problem accessing them. However, in a reentrant scanner, there are no
global <code>flex</code> values. You can not access them directly. Instead,
you must access <code>flex</code> values using accessor methods (get/set
functions). Each accessor method is named <code>yyget_NAME</code> or
<code>yyset_NAME</code>, where <code>NAME</code> is the name of the <code>flex</code>
variable you want. For example:
</p>
<a name="index-accessor-functions_002c-use-of"></a>
<div class="example">
<pre class="verbatim"> /* Set the last character of yytext to NULL. */
void chop ( yyscan_t scanner )
{
int len = yyget_leng( scanner );
yyget_text( scanner )[len - 1] = '\0';
}
</pre></div>
<p>The above code may be called from within an action like this:
</p>
<div class="example">
<pre class="verbatim"> %%
.+\n { chop( yyscanner );}
</pre></div>
<p>You may find that <code>%option header-file</code> is particularly useful for generating
prototypes of all the accessor functions. See <a href="Options-for-Specifying-Filenames.html#option_002dheader">option-header</a>.
</p>
</body>
</html>
+392
View File
@@ -0,0 +1,392 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
The flex manual is placed under the same licensing conditions as the
rest of flex:
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
The Flex Project.
Copyright (C) 1990, 1997 The Regents of the University of California.
All rights reserved.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. -->
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Lexical Analysis With Flex, for Flex 2.6.2: Actions</title>
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Actions">
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Actions">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Indices.html#Indices" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="index.html#Top" rel="up" title="Top">
<link href="Generated-Scanner.html#Generated-Scanner" rel="next" title="Generated Scanner">
<link href="Matching.html#Matching" rel="prev" title="Matching">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Actions"></a>
<div class="header">
<p>
Next: <a href="Generated-Scanner.html#Generated-Scanner" accesskey="n" rel="next">Generated Scanner</a>, Previous: <a href="Matching.html#Matching" accesskey="p" rel="prev">Matching</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Actions-1"></a>
<h2 class="chapter">8 Actions</h2>
<a name="index-actions"></a>
<p>Each pattern in a rule has a corresponding <em>action</em>, which can be
any arbitrary C statement. The pattern ends at the first non-escaped
whitespace character; the remainder of the line is its action. If the
action is empty, then when the pattern is matched the input token is
simply discarded. For example, here is the specification for a program
which deletes all occurrences of &lsquo;<samp>zap me</samp>&rsquo; from its input:
</p>
<a name="index-deleting-lines-from-input"></a>
<div class="example">
<pre class="verbatim"> %%
&quot;zap me&quot;
</pre></div>
<p>This example will copy all other characters in the input to the output
since they will be matched by the default rule.
</p>
<p>Here is a program which compresses multiple blanks and tabs down to a
single blank, and throws away whitespace found at the end of a line:
</p>
<a name="index-whitespace_002c-compressing"></a>
<a name="index-compressing-whitespace"></a>
<div class="example">
<pre class="verbatim"> %%
[ \t]+ putchar( ' ' );
[ \t]+$ /* ignore this token */
</pre></div>
<a name="index-_0025_007b-and-_0025_007d_002c-in-Rules-Section"></a>
<a name="index-actions_002c-use-of-_007b-and-_007d"></a>
<a name="index-actions_002c-embedded-C-strings"></a>
<a name="index-C_002dstrings_002c-in-actions"></a>
<a name="index-comments_002c-in-actions"></a>
<p>If the action contains a &lsquo;<samp>{</samp>&rsquo;, then the action spans till the
balancing &lsquo;<samp>}</samp>&rsquo; is found, and the action may cross multiple lines.
<code>flex</code> knows about C strings and comments and won&rsquo;t be fooled by
braces found within them, but also allows actions to begin with
&lsquo;<samp>%{</samp>&rsquo; and will consider the action to be all the text up to the
next &lsquo;<samp>%}</samp>&rsquo; (regardless of ordinary braces inside the action).
</p>
<a name="index-_007c_002c-in-actions"></a>
<p>An action consisting solely of a vertical bar (&lsquo;<samp>|</samp>&rsquo;) means &ldquo;same as the
action for the next rule&rdquo;. See below for an illustration.
</p>
<p>Actions can include arbitrary C code, including <code>return</code> statements
to return a value to whatever routine called <code>yylex()</code>. Each time
<code>yylex()</code> is called it continues processing tokens from where it
last left off until it either reaches the end of the file or executes a
return.
</p>
<a name="index-yytext_002c-modification-of"></a>
<p>Actions are free to modify <code>yytext</code> except for lengthening it
(adding characters to its end&ndash;these will overwrite later characters in
the input stream). This however does not apply when using <code>%array</code>
(see <a href="Matching.html#Matching">Matching</a>). In that case, <code>yytext</code> may be freely modified
in any way.
</p>
<a name="index-yyleng_002c-modification-of"></a>
<a name="index-yymore_002c-and-yyleng"></a>
<p>Actions are free to modify <code>yyleng</code> except they should not do so if
the action also includes use of <code>yymore()</code> (see below).
</p>
<a name="index-preprocessor-macros_002c-for-use-in-actions"></a>
<p>There are a number of special directives which can be included within an
action:
</p>
<dl compact="compact">
<dt><code>ECHO</code></dt>
<dd><a name="index-ECHO"></a>
<p>copies yytext to the scanner&rsquo;s output.
</p>
</dd>
<dt><code>BEGIN</code></dt>
<dd><a name="index-BEGIN"></a>
<p>followed by the name of a start condition places the scanner in the
corresponding start condition (see below).
</p>
</dd>
<dt><code>REJECT</code></dt>
<dd><a name="index-REJECT"></a>
<p>directs the scanner to proceed on to the &ldquo;second best&rdquo; rule which
matched the input (or a prefix of the input). The rule is chosen as
described above in <a href="Matching.html#Matching">Matching</a>, and <code>yytext</code> and <code>yyleng</code>
set up appropriately. It may either be one which matched as much text
as the originally chosen rule but came later in the <code>flex</code> input
file, or one which matched less text. For example, the following will
both count the words in the input and call the routine <code>special()</code>
whenever &lsquo;<samp>frob</samp>&rsquo; is seen:
</p>
<div class="example">
<pre class="verbatim"> int word_count = 0;
%%
frob special(); REJECT;
[^ \t\n]+ ++word_count;
</pre></div>
<p>Without the <code>REJECT</code>, any occurrences of &lsquo;<samp>frob</samp>&rsquo; in the input
would not be counted as words, since the scanner normally executes only
one action per token. Multiple uses of <code>REJECT</code> are allowed, each
one finding the next best choice to the currently active rule. For
example, when the following scanner scans the token &lsquo;<samp>abcd</samp>&rsquo;, it will
write &lsquo;<samp>abcdabcaba</samp>&rsquo; to the output:
</p>
<a name="index-REJECT_002c-calling-multiple-times"></a>
<a name="index-_007c_002c-use-of"></a>
<div class="example">
<pre class="verbatim"> %%
a |
ab |
abc |
abcd ECHO; REJECT;
.|\n /* eat up any unmatched character */
</pre></div>
<p>The first three rules share the fourth&rsquo;s action since they use the
special &lsquo;<samp>|</samp>&rsquo; action.
</p>
<p><code>REJECT</code> is a particularly expensive feature in terms of scanner
performance; if it is used in <em>any</em> of the scanner&rsquo;s actions it
will slow down <em>all</em> of the scanner&rsquo;s matching. Furthermore,
<code>REJECT</code> cannot be used with the &lsquo;<samp>-Cf</samp>&rsquo; or &lsquo;<samp>-CF</samp>&rsquo; options
(see <a href="Scanner-Options.html#Scanner-Options">Scanner Options</a>).
</p>
<p>Note also that unlike the other special actions, <code>REJECT</code> is a
<em>branch</em>. Code immediately following it in the action will
<em>not</em> be executed.
</p>
</dd>
<dt><code>yymore()</code></dt>
<dd><a name="index-yymore_0028_0029"></a>
<p>tells the scanner that the next time it matches a rule, the
corresponding token should be <em>appended</em> onto the current value of
<code>yytext</code> rather than replacing it. For example, given the input
&lsquo;<samp>mega-kludge</samp>&rsquo; the following will write &lsquo;<samp>mega-mega-kludge</samp>&rsquo; to
the output:
</p>
<a name="index-yymore_0028_0029_002c-mega_002dkludge"></a>
<a name="index-yymore_0028_0029-to-append-token-to-previous-token"></a>
<div class="example">
<pre class="verbatim"> %%
mega- ECHO; yymore();
kludge ECHO;
</pre></div>
<p>First &lsquo;<samp>mega-</samp>&rsquo; is matched and echoed to the output. Then &lsquo;<samp>kludge</samp>&rsquo;
is matched, but the previous &lsquo;<samp>mega-</samp>&rsquo; is still hanging around at the
beginning of
<code>yytext</code>
so the
<code>ECHO</code>
for the &lsquo;<samp>kludge</samp>&rsquo; rule will actually write &lsquo;<samp>mega-kludge</samp>&rsquo;.
</p></dd>
</dl>
<a name="index-yymore_002c-performance-penalty-of"></a>
<p>Two notes regarding use of <code>yymore()</code>. First, <code>yymore()</code>
depends on the value of <code>yyleng</code> correctly reflecting the size of
the current token, so you must not modify <code>yyleng</code> if you are using
<code>yymore()</code>. Second, the presence of <code>yymore()</code> in the
scanner&rsquo;s action entails a minor performance penalty in the scanner&rsquo;s
matching speed.
</p>
<a name="index-yyless_0028_0029"></a>
<p><code>yyless(n)</code> returns all but the first <code>n</code> characters of the
current token back to the input stream, where they will be rescanned
when the scanner looks for the next match. <code>yytext</code> and
<code>yyleng</code> are adjusted appropriately (e.g., <code>yyleng</code> will now
be equal to <code>n</code>). For example, on the input &lsquo;<samp>foobar</samp>&rsquo; the
following will write out &lsquo;<samp>foobarbar</samp>&rsquo;:
</p>
<a name="index-yyless_0028_0029_002c-pushing-back-characters"></a>
<a name="index-pushing-back-characters-with-yyless"></a>
<div class="example">
<pre class="verbatim"> %%
foobar ECHO; yyless(3);
[a-z]+ ECHO;
</pre></div>
<p>An argument of 0 to <code>yyless()</code> will cause the entire current input
string to be scanned again. Unless you&rsquo;ve changed how the scanner will
subsequently process its input (using <code>BEGIN</code>, for example), this
will result in an endless loop.
</p>
<p>Note that <code>yyless()</code> is a macro and can only be used in the flex
input file, not from other source files.
</p>
<a name="index-unput_0028_0029"></a>
<a name="index-pushing-back-characters-with-unput"></a>
<p><code>unput(c)</code> puts the character <code>c</code> back onto the input stream.
It will be the next character scanned. The following action will take
the current token and cause it to be rescanned enclosed in parentheses.
</p>
<a name="index-unput_0028_0029_002c-pushing-back-characters"></a>
<a name="index-pushing-back-characters-with-unput_0028_0029"></a>
<div class="example">
<pre class="verbatim"> {
int i;
/* Copy yytext because unput() trashes yytext */
char *yycopy = strdup( yytext );
unput( ')' );
for ( i = yyleng - 1; i &gt;= 0; --i )
unput( yycopy[i] );
unput( '(' );
free( yycopy );
}
</pre></div>
<p>Note that since each <code>unput()</code> puts the given character back at the
<em>beginning</em> of the input stream, pushing back strings must be done
back-to-front.
</p>
<a name="index-_0025pointer_002c-and-unput_0028_0029"></a>
<a name="index-unput_0028_0029_002c-and-_0025pointer"></a>
<p>An important potential problem when using <code>unput()</code> is that if you
are using <code>%pointer</code> (the default), a call to <code>unput()</code>
<em>destroys</em> the contents of <code>yytext</code>, starting with its
rightmost character and devouring one character to the left with each
call. If you need the value of <code>yytext</code> preserved after a call to
<code>unput()</code> (as in the above example), you must either first copy it
elsewhere, or build your scanner using <code>%array</code> instead
(see <a href="Matching.html#Matching">Matching</a>).
</p>
<a name="index-pushing-back-EOF"></a>
<a name="index-EOF_002c-pushing-back"></a>
<p>Finally, note that you cannot put back &lsquo;<samp>EOF</samp>&rsquo; to attempt to mark the
input stream with an end-of-file.
</p>
<a name="index-input_0028_0029"></a>
<p><code>input()</code> reads the next character from the input stream. For
example, the following is one way to eat up C comments:
</p>
<a name="index-comments_002c-discarding"></a>
<a name="index-discarding-C-comments"></a>
<div class="example">
<pre class="verbatim"> %%
&quot;/*&quot; {
int c;
for ( ; ; )
{
while ( (c = input()) != '*' &amp;&amp;
c != EOF )
; /* eat up text of comment */
if ( c == '*' )
{
while ( (c = input()) == '*' )
;
if ( c == '/' )
break; /* found the end */
}
if ( c == EOF )
{
error( &quot;EOF in comment&quot; );
break;
}
}
}
</pre></div>
<a name="index-input_0028_0029_002c-and-C_002b_002b"></a>
<a name="index-yyinput_0028_0029"></a>
<p>(Note that if the scanner is compiled using <code>C++</code>, then
<code>input()</code> is instead referred to as <b>yyinput()</b>, in order to
avoid a name clash with the <code>C++</code> stream by the name of
<code>input</code>.)
</p>
<a name="index-flushing-the-internal-buffer"></a>
<a name="index-YY_005fFLUSH_005fBUFFER"></a>
<p><code>YY_FLUSH_BUFFER;</code> flushes the scanner&rsquo;s internal buffer so that
the next time the scanner attempts to match a token, it will first
refill the buffer using <code>YY_INPUT()</code> (see <a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a>).
This action is a special case of the more general
<code>yy_flush_buffer;</code> function, described below (see <a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a>)
</p>
<a name="index-yyterminate_0028_0029"></a>
<a name="index-terminating-with-yyterminate_0028_0029"></a>
<a name="index-exiting-with-yyterminate_0028_0029"></a>
<a name="index-halting-with-yyterminate_0028_0029"></a>
<p><code>yyterminate()</code> can be used in lieu of a return statement in an
action. It terminates the scanner and returns a 0 to the scanner&rsquo;s
caller, indicating &ldquo;all done&rdquo;. By default, <code>yyterminate()</code> is
also called when an end-of-file is encountered. It is a macro and may
be redefined.
</p>
<hr>
<div class="header">
<p>
Next: <a href="Generated-Scanner.html#Generated-Scanner" accesskey="n" rel="next">Generated Scanner</a>, Previous: <a href="Matching.html#Matching" accesskey="p" rel="prev">Matching</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
+135
View File
@@ -0,0 +1,135 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
The flex manual is placed under the same licensing conditions as the
rest of flex:
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
The Flex Project.
Copyright (C) 1990, 1997 The Regents of the University of California.
All rights reserved.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. -->
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Lexical Analysis With Flex, for Flex 2.6.2: Addresses</title>
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Addresses">
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Addresses">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Indices.html#Indices" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Common-Patterns.html#Common-Patterns" rel="up" title="Common Patterns">
<link href="Indices.html#Indices" rel="next" title="Indices">
<link href="Quoted-Constructs.html#Quoted-Constructs" rel="prev" title="Quoted Constructs">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Addresses"></a>
<div class="header">
<p>
Previous: <a href="Quoted-Constructs.html#Quoted-Constructs" accesskey="p" rel="prev">Quoted Constructs</a>, Up: <a href="Common-Patterns.html#Common-Patterns" accesskey="u" rel="up">Common Patterns</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Addresses-1"></a>
<h4 class="subsection">A.4.4 Addresses</h4>
<dl compact="compact">
<dt>IPv4 Address</dt>
<dd><pre class="verbatim">dec-octet [0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]
IPv4address {dec-octet}\.{dec-octet}\.{dec-octet}\.{dec-octet}
</pre>
</dd>
<dt>IPv6 Address</dt>
<dd><pre class="verbatim">h16 [0-9A-Fa-f]{1,4}
ls32 {h16}:{h16}|{IPv4address}
IPv6address ({h16}:){6}{ls32}|
::({h16}:){5}{ls32}|
({h16})?::({h16}:){4}{ls32}|
(({h16}:){0,1}{h16})?::({h16}:){3}{ls32}|
(({h16}:){0,2}{h16})?::({h16}:){2}{ls32}|
(({h16}:){0,3}{h16})?::{h16}:{ls32}|
(({h16}:){0,4}{h16})?::{ls32}|
(({h16}:){0,5}{h16})?::{h16}|
(({h16}:){0,6}{h16})?::
</pre>
<p>See <a href="http://www.ietf.org/rfc/rfc2373.txt">RFC 2373</a> for details.
Note that you have to fold the definition of <code>IPv6address</code> into one
line and that it also matches the &ldquo;unspecified address&rdquo; &ldquo;::&rdquo;.
</p>
</dd>
<dt>URI</dt>
<dd><p><code>(([^:/?#]+):)?(&quot;//&quot;([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?</code>
</p>
<p>This pattern is nearly useless, since it allows just about any character
to appear in a URI, including spaces and control characters. See
<a href="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396</a> for details.
</p>
</dd>
</dl>
</body>
</html>
+111
View File
@@ -0,0 +1,111 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
The flex manual is placed under the same licensing conditions as the
rest of flex:
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
The Flex Project.
Copyright (C) 1990, 1997 The Regents of the University of California.
All rights reserved.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. -->
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Lexical Analysis With Flex, for Flex 2.6.2: Appendices</title>
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Appendices">
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Appendices">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Indices.html#Indices" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="index.html#Top" rel="up" title="Top">
<link href="Makefiles-and-Flex.html#Makefiles-and-Flex" rel="next" title="Makefiles and Flex">
<link href="How-do-I-access-the-values-set-in-a-Flex-action-from-within-a-Bison-action_003f.html#How-do-I-access-the-values-set-in-a-Flex-action-from-within-a-Bison-action_003f" rel="prev" title="How do I access the values set in a Flex action from within a Bison action?">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Appendices"></a>
<div class="header">
<p>
Next: <a href="Indices.html#Indices" accesskey="n" rel="next">Indices</a>, Previous: <a href="FAQ.html#FAQ" accesskey="p" rel="prev">FAQ</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Appendices-1"></a>
<h2 class="appendix">Appendix A Appendices</h2>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="Makefiles-and-Flex.html#Makefiles-and-Flex" accesskey="1">Makefiles and Flex</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="Bison-Bridge.html#Bison-Bridge" accesskey="2">Bison Bridge</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="M4-Dependency.html#M4-Dependency" accesskey="3">M4 Dependency</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="Common-Patterns.html#Common-Patterns" accesskey="4">Common Patterns</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
</body>
</html>
@@ -0,0 +1,177 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
The flex manual is placed under the same licensing conditions as the
rest of flex:
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
The Flex Project.
Copyright (C) 1990, 1997 The Regents of the University of California.
All rights reserved.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. -->
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Lexical Analysis With Flex, for Flex 2.6.2: Are certain equivalent patterns faster than others?</title>
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Are certain equivalent patterns faster than others?">
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Are certain equivalent patterns faster than others?">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Indices.html#Indices" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="FAQ.html#FAQ" rel="up" title="FAQ">
<link href="Is-backing-up-a-big-deal_003f.html#Is-backing-up-a-big-deal_003f" rel="next" title="Is backing up a big deal?">
<link href="deleteme00.html#deleteme00" rel="prev" title="deleteme00">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Are-certain-equivalent-patterns-faster-than-others_003f"></a>
<div class="header">
<p>
Next: <a href="Is-backing-up-a-big-deal_003f.html#Is-backing-up-a-big-deal_003f" accesskey="n" rel="next">Is backing up a big deal?</a>, Previous: <a href="deleteme00.html#deleteme00" accesskey="p" rel="prev">deleteme00</a>, Up: <a href="FAQ.html#FAQ" accesskey="u" rel="up">FAQ</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Are-certain-equivalent-patterns-faster-than-others_003f-1"></a>
<h3 class="unnumberedsec">Are certain equivalent patterns faster than others?</h3>
<div class="example">
<pre class="verbatim">To: Adoram Rogel &lt;adoram@orna.hybridge.com&gt;
Subject: Re: Flex 2.5.2 performance questions
In-reply-to: Your message of Wed, 18 Sep 96 11:12:17 EDT.
Date: Wed, 18 Sep 96 10:51:02 PDT
From: Vern Paxson &lt;vern&gt;
[Note, the most recent flex release is 2.5.4, which you can get from
ftp.ee.lbl.gov. It has bug fixes over 2.5.2 and 2.5.3.]
&gt; 1. Using the pattern
&gt; ([Ff](oot)?)?[Nn](ote)?(\.)?
&gt; instead of
&gt; (((F|f)oot(N|n)ote)|((N|n)ote)|((N|n)\.)|((F|f)(N|n)(\.)))
&gt; (in a very complicated flex program) caused the program to slow from
&gt; 300K+/min to 100K/min (no other changes were done).
These two are not equivalent. For example, the first can match &quot;footnote.&quot;
but the second can only match &quot;footnote&quot;. This is almost certainly the
cause in the discrepancy - the slower scanner run is matching more tokens,
and/or having to do more backing up.
&gt; 2. Which of these two are better: [Ff]oot or (F|f)oot ?
From a performance point of view, they're equivalent (modulo presumably
minor effects such as memory cache hit rates; and the presence of trailing
context, see below). From a space point of view, the first is slightly
preferable.
&gt; 3. I have a pattern that look like this:
&gt; pats {p1}|{p2}|{p3}|...|{p50} (50 patterns ORd)
&gt;
&gt; running yet another complicated program that includes the following rule:
&gt; &lt;snext&gt;{and}/{no4}{bb}{pats}
&gt;
&gt; gets me to &quot;too complicated - over 32,000 states&quot;...
I can't tell from this example whether the trailing context is variable-length
or fixed-length (it could be the latter if {and} is fixed-length). If it's
variable length, which flex -p will tell you, then this reflects a basic
performance problem, and if you can eliminate it by restructuring your
scanner, you will see significant improvement.
&gt; so I divided {pats} to {pats1}, {pats2},..., {pats5} each consists of about
&gt; 10 patterns and changed the rule to be 5 rules.
&gt; This did compile, but what is the rule of thumb here ?
The rule is to avoid trailing context other than fixed-length, in which for
a/b, either the 'a' pattern or the 'b' pattern have a fixed length. Use
of the '|' operator automatically makes the pattern variable length, so in
this case '[Ff]oot' is preferred to '(F|f)oot'.
&gt; 4. I changed a rule that looked like this:
&gt; &lt;snext8&gt;{and}{bb}/{ROMAN}[^A-Za-z] { BEGIN...
&gt;
&gt; to the next 2 rules:
&gt; &lt;snext8&gt;{and}{bb}/{ROMAN}[A-Za-z] { ECHO;}
&gt; &lt;snext8&gt;{and}{bb}/{ROMAN} { BEGIN...
&gt;
&gt; Again, I understand the using [^...] will cause a great performance loss
Actually, it doesn't cause any sort of performance loss. It's a surprising
fact about regular expressions that they always match in linear time
regardless of how complex they are.
&gt; but are there any specific rules about it ?
See the &quot;Performance Considerations&quot; section of the man page, and also
the example in MISC/fastwc/.
Vern
</pre></div>
<hr>
<div class="header">
<p>
Next: <a href="Is-backing-up-a-big-deal_003f.html#Is-backing-up-a-big-deal_003f" accesskey="n" rel="next">Is backing up a big deal?</a>, Previous: <a href="deleteme00.html#deleteme00" accesskey="p" rel="prev">deleteme00</a>, Up: <a href="FAQ.html#FAQ" accesskey="u" rel="up">FAQ</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
+122
View File
@@ -0,0 +1,122 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
The flex manual is placed under the same licensing conditions as the
rest of flex:
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
The Flex Project.
Copyright (C) 1990, 1997 The Regents of the University of California.
All rights reserved.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. -->
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Lexical Analysis With Flex, for Flex 2.6.2: Bibliography</title>
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Bibliography">
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Bibliography">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Indices.html#Indices" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="index.html#Top" rel="up" title="Top">
<link href="FAQ.html#FAQ" rel="next" title="FAQ">
<link href="Limitations.html#Limitations" rel="prev" title="Limitations">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Bibliography"></a>
<div class="header">
<p>
Next: <a href="FAQ.html#FAQ" accesskey="n" rel="next">FAQ</a>, Previous: <a href="Limitations.html#Limitations" accesskey="p" rel="prev">Limitations</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Additional-Reading"></a>
<h2 class="chapter">25 Additional Reading</h2>
<p>You may wish to read more about the following programs:
</p><ul>
<li> lex
</li><li> yacc
</li><li> sed
</li><li> awk
</li></ul>
<p>The following books may contain material of interest:
</p>
<p>John Levine, Tony Mason, and Doug Brown,
<em>Lex &amp; Yacc</em>,
O&rsquo;Reilly and Associates. Be sure to get the 2nd edition.
</p>
<p>M. E. Lesk and E. Schmidt,
<em>LEX &ndash; Lexical Analyzer Generator</em>
</p>
<p>Alfred Aho, Ravi Sethi and Jeffrey Ullman, <em>Compilers: Principles,
Techniques and Tools</em>, Addison-Wesley (1986). Describes the
pattern-matching techniques used by <code>flex</code> (deterministic finite
automata).
</p>
</body>
</html>
+203
View File
@@ -0,0 +1,203 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
The flex manual is placed under the same licensing conditions as the
rest of flex:
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
The Flex Project.
Copyright (C) 1990, 1997 The Regents of the University of California.
All rights reserved.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. -->
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Lexical Analysis With Flex, for Flex 2.6.2: Bison Bridge</title>
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Bison Bridge">
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Bison Bridge">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Indices.html#Indices" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Appendices.html#Appendices" rel="up" title="Appendices">
<link href="M4-Dependency.html#M4-Dependency" rel="next" title="M4 Dependency">
<link href="Makefiles-and-Flex.html#Makefiles-and-Flex" rel="prev" title="Makefiles and Flex">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Bison-Bridge"></a>
<div class="header">
<p>
Next: <a href="M4-Dependency.html#M4-Dependency" accesskey="n" rel="next">M4 Dependency</a>, Previous: <a href="Makefiles-and-Flex.html#Makefiles-and-Flex" accesskey="p" rel="prev">Makefiles and Flex</a>, Up: <a href="Appendices.html#Appendices" accesskey="u" rel="up">Appendices</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="C-Scanners-with-Bison-Parsers"></a>
<h3 class="section">A.2 C Scanners with Bison Parsers</h3>
<a name="index-bison_002c-bridging-with-flex"></a>
<a name="index-yylval"></a>
<a name="index-yylloc"></a>
<a name="index-YYLTYPE"></a>
<a name="index-YYSTYPE"></a>
<p>This section describes the <code>flex</code> features useful when integrating
<code>flex</code> with <code>GNU bison</code><a name="DOCF7" href="#FOOT7"><sup>7</sup></a>.
Skip this section if you are not using
<code>bison</code> with your scanner. Here we discuss only the <code>flex</code>
half of the <code>flex</code> and <code>bison</code> pair. We do not discuss
<code>bison</code> in any detail. For more information about generating
<code>bison</code> parsers, see <cite><a href="http://www.gnu.org/software/bison/manual/html_node/index.html#Top">the GNU Bison Manual</a></cite>.
</p>
<p>A compatible <code>bison</code> scanner is generated by declaring &lsquo;<samp>%option
bison-bridge</samp>&rsquo; or by supplying &lsquo;<samp>--bison-bridge</samp>&rsquo; when invoking <code>flex</code>
from the command line. This instructs <code>flex</code> that the macro
<code>yylval</code> may be used. The data type for
<code>yylval</code>, <code>YYSTYPE</code>,
is typically defined in a header file, included in section 1 of the
<code>flex</code> input file. For a list of functions and macros
available, See <a href="Reentrant-Functions.html#bison_002dfunctions">bison-functions</a>.
</p>
<p>The declaration of yylex becomes,
</p>
<a name="index-yylex-_0028reentrant-version_0029"></a>
<div class="example">
<pre class="verbatim"> int yylex ( YYSTYPE * lvalp, yyscan_t scanner );
</pre></div>
<p>If <code>%option bison-locations</code> is specified, then the declaration
becomes,
</p>
<a name="index-yylex-_0028reentrant-version_0029-1"></a>
<div class="example">
<pre class="verbatim"> int yylex ( YYSTYPE * lvalp, YYLTYPE * llocp, yyscan_t scanner );
</pre></div>
<p>Note that the macros <code>yylval</code> and <code>yylloc</code> evaluate to pointers.
Support for <code>yylloc</code> is optional in <code>bison</code>, so it is optional in
<code>flex</code> as well. The following is an example of a <code>flex</code> scanner that
is compatible with <code>bison</code>.
</p>
<a name="index-bison_002c-scanner-to-be-called-from-bison"></a>
<div class="example">
<pre class="verbatim"> /* Scanner for &quot;C&quot; assignment statements... sort of. */
%{
#include &quot;y.tab.h&quot; /* Generated by bison. */
%}
%option bison-bridge bison-locations
%
[[:digit:]]+ { yylval-&gt;num = atoi(yytext); return NUMBER;}
[[:alnum:]]+ { yylval-&gt;str = strdup(yytext); return STRING;}
&quot;=&quot;|&quot;;&quot; { return yytext[0];}
. {}
%
</pre></div>
<p>As you can see, there really is no magic here. We just use
<code>yylval</code> as we would any other variable. The data type of
<code>yylval</code> is generated by <code>bison</code>, and included in the file
<samp>y.tab.h</samp>. Here is the corresponding <code>bison</code> parser:
</p>
<a name="index-bison_002c-parser"></a>
<div class="example">
<pre class="verbatim"> /* Parser to convert &quot;C&quot; assignments to lisp. */
%{
/* Pass the argument to yyparse through to yylex. */
#define YYPARSE_PARAM scanner
#define YYLEX_PARAM scanner
%}
%locations
%pure_parser
%union {
int num;
char* str;
}
%token &lt;str&gt; STRING
%token &lt;num&gt; NUMBER
%%
assignment:
STRING '=' NUMBER ';' {
printf( &quot;(setf %s %d)&quot;, $1, $3 );
}
;
</pre></div>
<div class="footnote">
<hr>
<h4 class="footnotes-heading">Footnotes</h4>
<h3><a name="FOOT7" href="#DOCF7">(7)</a></h3>
<p>The features described here are
purely optional, and are by no means the only way to use flex with bison.
We merely provide some glue to ease development of your parser-scanner pair.</p>
</div>
<hr>
<div class="header">
<p>
Next: <a href="M4-Dependency.html#M4-Dependency" accesskey="n" rel="next">M4 Dependency</a>, Previous: <a href="Makefiles-and-Flex.html#Makefiles-and-Flex" accesskey="p" rel="prev">Makefiles and Flex</a>, Up: <a href="Appendices.html#Appendices" accesskey="u" rel="up">Appendices</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
@@ -0,0 +1,110 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
The flex manual is placed under the same licensing conditions as the
rest of flex:
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
The Flex Project.
Copyright (C) 1990, 1997 The Regents of the University of California.
All rights reserved.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. -->
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Lexical Analysis With Flex, for Flex 2.6.2: Can I build nested parsers that work with the same input file?</title>
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Can I build nested parsers that work with the same input file?">
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Can I build nested parsers that work with the same input file?">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Indices.html#Indices" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="FAQ.html#FAQ" rel="up" title="FAQ">
<link href="How-can-I-match-text-only-at-the-end-of-a-file_003f.html#How-can-I-match-text-only-at-the-end-of-a-file_003f" rel="next" title="How can I match text only at the end of a file?">
<link href="How-can-I-have-multiple-input-sources-feed-into-the-same-scanner-at-the-same-time_003f.html#How-can-I-have-multiple-input-sources-feed-into-the-same-scanner-at-the-same-time_003f" rel="prev" title="How can I have multiple input sources feed into the same scanner at the same time?">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Can-I-build-nested-parsers-that-work-with-the-same-input-file_003f"></a>
<div class="header">
<p>
Next: <a href="How-can-I-match-text-only-at-the-end-of-a-file_003f.html#How-can-I-match-text-only-at-the-end-of-a-file_003f" accesskey="n" rel="next">How can I match text only at the end of a file?</a>, Previous: <a href="How-can-I-have-multiple-input-sources-feed-into-the-same-scanner-at-the-same-time_003f.html#How-can-I-have-multiple-input-sources-feed-into-the-same-scanner-at-the-same-time_003f" accesskey="p" rel="prev">How can I have multiple input sources feed into the same scanner at the same time?</a>, Up: <a href="FAQ.html#FAQ" accesskey="u" rel="up">FAQ</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Can-I-build-nested-parsers-that-work-with-the-same-input-file_003f-1"></a>
<h3 class="unnumberedsec">Can I build nested parsers that work with the same input file?</h3>
<p>This is not going to work without some additional effort. The reason is
that <code>flex</code> block-buffers the input it reads from <code>yyin</code>. This means that the
&ldquo;outermost&rdquo; <code>yylex()</code>, when called, will automatically slurp up the first 8K
of input available on yyin, and subsequent calls to other <code>yylex()</code>&rsquo;s won&rsquo;t
see that input. You might be tempted to work around this problem by
redefining <code>YY_INPUT</code> to only return a small amount of text, but it turns out
that that approach is quite difficult. Instead, the best solution is to
combine all of your scanners into one large scanner, using a different
exclusive start condition for each.
</p>
</body>
</html>
@@ -0,0 +1,133 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
The flex manual is placed under the same licensing conditions as the
rest of flex:
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
The Flex Project.
Copyright (C) 1990, 1997 The Regents of the University of California.
All rights reserved.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. -->
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Lexical Analysis With Flex, for Flex 2.6.2: Can I fake multi-byte character support?</title>
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Can I fake multi-byte character support?">
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Can I fake multi-byte character support?">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Indices.html#Indices" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="FAQ.html#FAQ" rel="up" title="FAQ">
<link href="deleteme01.html#deleteme01" rel="next" title="deleteme01">
<link href="Is-backing-up-a-big-deal_003f.html#Is-backing-up-a-big-deal_003f" rel="prev" title="Is backing up a big deal?">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Can-I-fake-multi_002dbyte-character-support_003f"></a>
<div class="header">
<p>
Next: <a href="deleteme01.html#deleteme01" accesskey="n" rel="next">deleteme01</a>, Previous: <a href="Is-backing-up-a-big-deal_003f.html#Is-backing-up-a-big-deal_003f" accesskey="p" rel="prev">Is backing up a big deal?</a>, Up: <a href="FAQ.html#FAQ" accesskey="u" rel="up">FAQ</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Can-I-fake-multi_002dbyte-character-support_003f-1"></a>
<h3 class="unnumberedsec">Can I fake multi-byte character support?</h3>
<div class="example">
<pre class="verbatim">To: Heeman_Lee@hp.com
Subject: Re: flex - multi-byte support?
In-reply-to: Your message of Thu, 03 Oct 1996 17:24:04 PDT.
Date: Fri, 04 Oct 1996 11:42:18 PDT
From: Vern Paxson &lt;vern&gt;
&gt; I assume as long as my *.l file defines the
&gt; range of expected character code values (in octal format), flex will
&gt; scan the file and read multi-byte characters correctly. But I have no
&gt; confidence in this assumption.
Your lack of confidence is justified - this won't work.
Flex has in it a widespread assumption that the input is processed
one byte at a time. Fixing this is on the to-do list, but is involved,
so it won't happen any time soon. In the interim, the best I can suggest
(unless you want to try fixing it yourself) is to write your rules in
terms of pairs of bytes, using definitions in the first section:
X \xfe\xc2
...
%%
foo{X}bar found_foo_fe_c2_bar();
etc. Definitely a pain - sorry about that.
By the way, the email address you used for me is ancient, indicating you
have a very old version of flex. You can get the most recent, 2.5.4, from
ftp.ee.lbl.gov.
Vern
</pre></div>
</body>
</html>
@@ -0,0 +1,104 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
The flex manual is placed under the same licensing conditions as the
rest of flex:
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
The Flex Project.
Copyright (C) 1990, 1997 The Regents of the University of California.
All rights reserved.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. -->
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Lexical Analysis With Flex, for Flex 2.6.2: Can I get the flex manual in another format?</title>
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Can I get the flex manual in another format?">
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Can I get the flex manual in another format?">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Indices.html#Indices" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="FAQ.html#FAQ" rel="up" title="FAQ">
<link href="Does-there-exist-a-_0022faster_0022-NDFA_002d_003eDFA-algorithm_003f.html#Does-there-exist-a-_0022faster_0022-NDFA_002d_003eDFA-algorithm_003f" rel="next" title="Does there exist a &quot;faster&quot; NDFA-&gt;DFA algorithm?">
<link href="The-period-isn_0027t-working-the-way-I-expected_002e.html#The-period-isn_0027t-working-the-way-I-expected_002e" rel="prev" title="The period isn't working the way I expected.">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Can-I-get-the-flex-manual-in-another-format_003f"></a>
<div class="header">
<p>
Next: <a href="Does-there-exist-a-_0022faster_0022-NDFA_002d_003eDFA-algorithm_003f.html#Does-there-exist-a-_0022faster_0022-NDFA_002d_003eDFA-algorithm_003f" accesskey="n" rel="next">Does there exist a &quot;faster&quot; NDFA-&gt;DFA algorithm?</a>, Previous: <a href="The-period-isn_0027t-working-the-way-I-expected_002e.html#The-period-isn_0027t-working-the-way-I-expected_002e" accesskey="p" rel="prev">The period isn't working the way I expected.</a>, Up: <a href="FAQ.html#FAQ" accesskey="u" rel="up">FAQ</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Can-I-get-the-flex-manual-in-another-format_003f-1"></a>
<h3 class="unnumberedsec">Can I get the flex manual in another format?</h3>
<p>The <code>flex</code> source distribution includes a texinfo manual. You are
free to convert that texinfo into whatever format you desire. The
<code>texinfo</code> package includes tools for conversion to a number of formats.
</p>
</body>
</html>
@@ -0,0 +1,102 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
The flex manual is placed under the same licensing conditions as the
rest of flex:
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
The Flex Project.
Copyright (C) 1990, 1997 The Regents of the University of California.
All rights reserved.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. -->
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Lexical Analysis With Flex, for Flex 2.6.2: Can I include comments in the &quot;rules&quot; section of the file?</title>
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Can I include comments in the &quot;rules&quot; section of the file?">
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Can I include comments in the &quot;rules&quot; section of the file?">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Indices.html#Indices" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="FAQ.html#FAQ" rel="up" title="FAQ">
<link href="I-get-an-error-about-undefined-yywrap_0028_0029_002e.html#I-get-an-error-about-undefined-yywrap_0028_0029_002e" rel="next" title="I get an error about undefined yywrap().">
<link href="Where-else-can-I-find-help_003f.html#Where-else-can-I-find-help_003f" rel="prev" title="Where else can I find help?">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Can-I-include-comments-in-the-_0022rules_0022-section-of-the-file_003f"></a>
<div class="header">
<p>
Next: <a href="I-get-an-error-about-undefined-yywrap_0028_0029_002e.html#I-get-an-error-about-undefined-yywrap_0028_0029_002e" accesskey="n" rel="next">I get an error about undefined yywrap().</a>, Previous: <a href="Where-else-can-I-find-help_003f.html#Where-else-can-I-find-help_003f" accesskey="p" rel="prev">Where else can I find help?</a>, Up: <a href="FAQ.html#FAQ" accesskey="u" rel="up">FAQ</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Can-I-include-comments-in-the-_0022rules_0022-section-of-the-file_003f-1"></a>
<h3 class="unnumberedsec">Can I include comments in the &quot;rules&quot; section of the file?</h3>
<p>Yes, just about anywhere you want to. See the manual for the specific syntax.
</p>
</body>
</html>
@@ -0,0 +1,155 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
The flex manual is placed under the same licensing conditions as the
rest of flex:
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
The Flex Project.
Copyright (C) 1990, 1997 The Regents of the University of California.
All rights reserved.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. -->
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Lexical Analysis With Flex, for Flex 2.6.2: Can you discuss some flex internals?</title>
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Can you discuss some flex internals?">
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Can you discuss some flex internals?">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Indices.html#Indices" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="FAQ.html#FAQ" rel="up" title="FAQ">
<link href="unput_0028_0029-messes-up-yy_005fat_005fbol.html#unput_0028_0029-messes-up-yy_005fat_005fbol" rel="next" title="unput() messes up yy_at_bol">
<link href="deleteme01.html#deleteme01" rel="prev" title="deleteme01">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Can-you-discuss-some-flex-internals_003f"></a>
<div class="header">
<p>
Next: <a href="unput_0028_0029-messes-up-yy_005fat_005fbol.html#unput_0028_0029-messes-up-yy_005fat_005fbol" accesskey="n" rel="next">unput() messes up yy_at_bol</a>, Previous: <a href="deleteme01.html#deleteme01" accesskey="p" rel="prev">deleteme01</a>, Up: <a href="FAQ.html#FAQ" accesskey="u" rel="up">FAQ</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Can-you-discuss-some-flex-internals_003f-1"></a>
<h3 class="unnumberedsec">Can you discuss some flex internals?</h3>
<div class="example">
<pre class="verbatim">To: Johan Linde &lt;jl@theophys.kth.se&gt;
Subject: Re: translation of flex
In-reply-to: Your message of Sun, 10 Nov 1996 09:16:36 PST.
Date: Mon, 11 Nov 1996 10:33:50 PST
From: Vern Paxson &lt;vern&gt;
&gt; I'm working for the Swedish team translating GNU program, and I'm currently
&gt; working with flex. I have a few questions about some of the messages which
&gt; I hope you can answer.
All of the things you're wondering about, by the way, concerning flex
internals - probably the only person who understands what they mean in
English is me! So I wouldn't worry too much about getting them right.
That said ...
&gt; #: main.c:545
&gt; msgid &quot; %d protos created\n&quot;
&gt;
&gt; Does proto mean prototype?
Yes - prototypes of state compression tables.
&gt; #: main.c:539
&gt; msgid &quot; %d/%d (peak %d) template nxt-chk entries created\n&quot;
&gt;
&gt; Here I'm mainly puzzled by 'nxt-chk'. I guess it means 'next-check'. (?)
&gt; However, 'template next-check entries' doesn't make much sense to me. To be
&gt; able to find a good translation I need to know a little bit more about it.
There is a scheme in the Aho/Sethi/Ullman compiler book for compressing
scanner tables. It involves creating two pairs of tables. The first has
&quot;base&quot; and &quot;default&quot; entries, the second has &quot;next&quot; and &quot;check&quot; entries.
The &quot;base&quot; entry is indexed by the current state and yields an index into
the next/check table. The &quot;default&quot; entry gives what to do if the state
transition isn't found in next/check. The &quot;next&quot; entry gives the next
state to enter, but only if the &quot;check&quot; entry verifies that this entry is
correct for the current state. Flex creates templates of series of
next/check entries and then encodes differences from these templates as a
way to compress the tables.
&gt; #: main.c:533
&gt; msgid &quot; %d/%d base-def entries created\n&quot;
&gt;
&gt; The same problem here for 'base-def'.
See above.
Vern
</pre></div>
<hr>
<div class="header">
<p>
Next: <a href="unput_0028_0029-messes-up-yy_005fat_005fbol.html#unput_0028_0029-messes-up-yy_005fat_005fbol" accesskey="n" rel="next">unput() messes up yy_at_bol</a>, Previous: <a href="deleteme01.html#deleteme01" accesskey="p" rel="prev">deleteme01</a>, Up: <a href="FAQ.html#FAQ" accesskey="u" rel="up">FAQ</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
+309
View File
@@ -0,0 +1,309 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
The flex manual is placed under the same licensing conditions as the
rest of flex:
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
The Flex Project.
Copyright (C) 1990, 1997 The Regents of the University of California.
All rights reserved.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. -->
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Lexical Analysis With Flex, for Flex 2.6.2: Code-Level And API Options</title>
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Code-Level And API Options">
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Code-Level And API Options">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Indices.html#Indices" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Scanner-Options.html#Scanner-Options" rel="up" title="Scanner Options">
<link href="Options-for-Scanner-Speed-and-Size.html#Options-for-Scanner-Speed-and-Size" rel="next" title="Options for Scanner Speed and Size">
<link href="Options-Affecting-Scanner-Behavior.html#Options-Affecting-Scanner-Behavior" rel="prev" title="Options Affecting Scanner Behavior">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Code_002dLevel-And-API-Options"></a>
<div class="header">
<p>
Next: <a href="Options-for-Scanner-Speed-and-Size.html#Options-for-Scanner-Speed-and-Size" accesskey="n" rel="next">Options for Scanner Speed and Size</a>, Previous: <a href="Options-Affecting-Scanner-Behavior.html#Options-Affecting-Scanner-Behavior" accesskey="p" rel="prev">Options Affecting Scanner Behavior</a>, Up: <a href="Scanner-Options.html#Scanner-Options" accesskey="u" rel="up">Scanner Options</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Code_002dLevel-And-API-Options-1"></a>
<h3 class="section">16.3 Code-Level And API Options</h3>
<dl compact="compact">
<dd>
<a name="option_002dansi_002ddefinitions"></a><a name="index-_002d_002d_002doption_002dansi_002ddefinitions"></a>
<a name="index-ansi_002ddefinitions"></a>
</dd>
<dt>&lsquo;<samp>--ansi-definitions, <code>%option ansi-definitions</code></samp>&rsquo;</dt>
<dd><p>Deprecated, ignored
</p>
<a name="option_002dansi_002dprototypes"></a><a name="index-_002d_002d_002doption_002dansi_002dprototypes"></a>
<a name="index-ansi_002dprototypes"></a>
</dd>
<dt>&lsquo;<samp>--ansi-prototypes, <code>%option ansi-prototypes</code></samp>&rsquo;</dt>
<dd><p>Deprecated, ignored
</p>
<a name="option_002dbison_002dbridge"></a><a name="index-_002d_002d_002dbison_002dbridge"></a>
<a name="index-bison_002dbridge"></a>
</dd>
<dt>&lsquo;<samp>--bison-bridge, <code>%option bison-bridge</code></samp>&rsquo;</dt>
<dd><p>instructs flex to generate a C scanner that is
meant to be called by a
<code>GNU bison</code>
parser. The scanner has minor API changes for
<code>bison</code>
compatibility. In particular, the declaration of
<code>yylex</code>
is modified to take an additional parameter,
<code>yylval</code>.
See <a href="Bison-Bridge.html#Bison-Bridge">Bison Bridge</a>.
</p>
<a name="option_002dbison_002dlocations"></a><a name="index-_002d_002d_002dbison_002dlocations"></a>
<a name="index-bison_002dlocations"></a>
</dd>
<dt>&lsquo;<samp>--bison-locations, <code>%option bison-locations</code></samp>&rsquo;</dt>
<dd><p>instruct flex that
<code>GNU bison</code> <code>%locations</code> are being used.
This means <code>yylex</code> will be passed
an additional parameter, <code>yylloc</code>. This option
implies <code>%option bison-bridge</code>.
See <a href="Bison-Bridge.html#Bison-Bridge">Bison Bridge</a>.
</p>
<a name="option_002dnoline"></a><a name="index-_002dL"></a>
<a name="index-_002d_002d_002dnoline"></a>
<a name="index-noline"></a>
</dd>
<dt>&lsquo;<samp>-L, --noline, <code>%option noline</code></samp>&rsquo;</dt>
<dd><p>instructs
<code>flex</code>
not to generate
<code>#line</code>
directives. Without this option,
<code>flex</code>
peppers the generated scanner
with <code>#line</code> directives so error messages in the actions will be correctly
located with respect to either the original
<code>flex</code>
input file (if the errors are due to code in the input file), or
<samp>lex.yy.c</samp>
(if the errors are
<code>flex</code>&rsquo;s
fault &ndash; you should report these sorts of errors to the email address
given in <a href="Reporting-Bugs.html#Reporting-Bugs">Reporting Bugs</a>).
</p>
<a name="option_002dreentrant"></a><a name="index-_002dR"></a>
<a name="index-_002d_002d_002dreentrant"></a>
<a name="index-reentrant"></a>
</dd>
<dt>&lsquo;<samp>-R, --reentrant, <code>%option reentrant</code></samp>&rsquo;</dt>
<dd><p>instructs flex to generate a reentrant C scanner. The generated scanner
may safely be used in a multi-threaded environment. The API for a
reentrant scanner is different than for a non-reentrant scanner
see <a href="Reentrant.html#Reentrant">Reentrant</a>). Because of the API difference between
reentrant and non-reentrant <code>flex</code> scanners, non-reentrant flex
code must be modified before it is suitable for use with this option.
This option is not compatible with the &lsquo;<samp>--c++</samp>&rsquo; option.
</p>
<p>The option &lsquo;<samp>--reentrant</samp>&rsquo; does not affect the performance of
the scanner.
</p>
<a name="option_002dc_002b_002b"></a><a name="index-_002d_002b"></a>
<a name="index-_002d_002d_002dc_002b_002b"></a>
<a name="index-c_002b_002b"></a>
</dd>
<dt>&lsquo;<samp>-+, --c++, <code>%option c++</code></samp>&rsquo;</dt>
<dd><p>specifies that you want flex to generate a C++
scanner class. See <a href="Cxx.html#Cxx">Cxx</a>, for
details.
</p>
<a name="option_002darray"></a><a name="index-_002d_002d_002darray"></a>
<a name="index-array"></a>
</dd>
<dt>&lsquo;<samp>--array, <code>%option array</code></samp>&rsquo;</dt>
<dd><p>specifies that you want yytext to be an array instead of a char*
</p>
<a name="option_002dpointer"></a><a name="index-_002d_002d_002dpointer"></a>
<a name="index-pointer"></a>
</dd>
<dt>&lsquo;<samp>--pointer, <code>%option pointer</code></samp>&rsquo;</dt>
<dd><p>specify that <code>yytext</code> should be a <code>char *</code>, not an array.
This default is <code>char *</code>.
</p>
<a name="option_002dprefix"></a><a name="index-_002dP"></a>
<a name="index-_002d_002d_002dprefix"></a>
<a name="index-prefix"></a>
</dd>
<dt>&lsquo;<samp>-PPREFIX, --prefix=PREFIX, <code>%option prefix=&quot;PREFIX&quot;</code></samp>&rsquo;</dt>
<dd><p>changes the default &lsquo;<samp>yy</samp>&rsquo; prefix used by <code>flex</code> for all
globally-visible variable and function names to instead be
&lsquo;<samp>PREFIX</samp>&rsquo;. For example, &lsquo;<samp>--prefix=foo</samp>&rsquo; changes the name of
<code>yytext</code> to <code>footext</code>. It also changes the name of the default
output file from <samp>lex.yy.c</samp> to <samp>lex.foo.c</samp>. Here is a partial
list of the names affected:
</p>
<div class="example">
<pre class="verbatim"> yy_create_buffer
yy_delete_buffer
yy_flex_debug
yy_init_buffer
yy_flush_buffer
yy_load_buffer_state
yy_switch_to_buffer
yyin
yyleng
yylex
yylineno
yyout
yyrestart
yytext
yywrap
yyalloc
yyrealloc
yyfree
</pre></div>
<p>(If you are using a C++ scanner, then only <code>yywrap</code> and
<code>yyFlexLexer</code> are affected.) Within your scanner itself, you can
still refer to the global variables and functions using either version
of their name; but externally, they have the modified name.
</p>
<p>This option lets you easily link together multiple
<code>flex</code>
programs into the same executable. Note, though, that using this
option also renames
<code>yywrap()</code>,
so you now
<em>must</em>
either
provide your own (appropriately-named) version of the routine for your
scanner, or use
<code>%option noyywrap</code>,
as linking with
&lsquo;<samp>-lfl</samp>&rsquo;
no longer provides one for you by default.
</p>
<a name="option_002dmain"></a><a name="index-_002d_002d_002dmain"></a>
<a name="index-main"></a>
</dd>
<dt>&lsquo;<samp>--main, <code>%option main</code></samp>&rsquo;</dt>
<dd><p>directs flex to provide a default <code>main()</code> program for the
scanner, which simply calls <code>yylex()</code>. This option implies
<code>noyywrap</code> (see below).
</p>
<a name="option_002dnounistd"></a><a name="index-_002d_002d_002dnounistd"></a>
<a name="index-nounistd"></a>
</dd>
<dt>&lsquo;<samp>--nounistd, <code>%option nounistd</code></samp>&rsquo;</dt>
<dd><p>suppresses inclusion of the non-ANSI header file <samp>unistd.h</samp>. This option
is meant to target environments in which <samp>unistd.h</samp> does not exist. Be aware
that certain options may cause flex to generate code that relies on functions
normally found in <samp>unistd.h</samp>, (e.g. <code>isatty()</code>, <code>read()</code>.)
If you wish to use these functions, you will have to inform your compiler where
to find them.
See <a href="Options-Affecting-Scanner-Behavior.html#option_002dalways_002dinteractive">option-always-interactive</a>. See <a href="Options-for-Scanner-Speed-and-Size.html#option_002dread">option-read</a>.
</p>
<a name="option_002dyyclass"></a><a name="index-_002d_002d_002dyyclass"></a>
<a name="index-yyclass"></a>
</dd>
<dt>&lsquo;<samp>--yyclass=NAME, <code>%option yyclass=&quot;NAME&quot;</code></samp>&rsquo;</dt>
<dd><p>only applies when generating a C++ scanner (the &lsquo;<samp>--c++</samp>&rsquo; option). It
informs <code>flex</code> that you have derived <code>NAME</code> as a subclass of
<code>yyFlexLexer</code>, so <code>flex</code> will place your actions in the member
function <code>foo::yylex()</code> instead of <code>yyFlexLexer::yylex()</code>. It
also generates a <code>yyFlexLexer::yylex()</code> member function that emits
a run-time error (by invoking <code>yyFlexLexer::LexerError())</code> if
called. See <a href="Cxx.html#Cxx">Cxx</a>.
</p>
</dd>
</dl>
<hr>
<div class="header">
<p>
Next: <a href="Options-for-Scanner-Speed-and-Size.html#Options-for-Scanner-Speed-and-Size" accesskey="n" rel="next">Options for Scanner Speed and Size</a>, Previous: <a href="Options-Affecting-Scanner-Behavior.html#Options-Affecting-Scanner-Behavior" accesskey="p" rel="prev">Options Affecting Scanner Behavior</a>, Up: <a href="Scanner-Options.html#Scanner-Options" accesskey="u" rel="up">Scanner Options</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
+148
View File
@@ -0,0 +1,148 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
The flex manual is placed under the same licensing conditions as the
rest of flex:
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
The Flex Project.
Copyright (C) 1990, 1997 The Regents of the University of California.
All rights reserved.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. -->
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Lexical Analysis With Flex, for Flex 2.6.2: Comments in the Input</title>
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Comments in the Input">
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Comments in the Input">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Indices.html#Indices" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Format.html#Format" rel="up" title="Format">
<link href="Patterns.html#Patterns" rel="next" title="Patterns">
<link href="User-Code-Section.html#User-Code-Section" rel="prev" title="User Code Section">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Comments-in-the-Input"></a>
<div class="header">
<p>
Previous: <a href="User-Code-Section.html#User-Code-Section" accesskey="p" rel="prev">User Code Section</a>, Up: <a href="Format.html#Format" accesskey="u" rel="up">Format</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Comments-in-the-Input-1"></a>
<h3 class="section">5.4 Comments in the Input</h3>
<a name="index-comments_002c-syntax-of"></a>
<p>Flex supports C-style comments, that is, anything between &lsquo;<samp>/*</samp>&rsquo; and
&lsquo;<samp>*/</samp>&rsquo; is
considered a comment. Whenever flex encounters a comment, it copies the
entire comment verbatim to the generated source code. Comments may
appear just about anywhere, but with the following exceptions:
</p>
<ul>
<li> <a name="index-comments_002c-in-rules-section"></a>
Comments may not appear in the Rules Section wherever flex is expecting
a regular expression. This means comments may not appear at the
beginning of a line, or immediately following a list of scanner states.
</li><li> Comments may not appear on an &lsquo;<samp>%option</samp>&rsquo; line in the Definitions
Section.
</li></ul>
<p>If you want to follow a simple rule, then always begin a comment on a
new line, with one or more whitespace characters before the initial
&lsquo;<samp>/*</samp>&rsquo;). This rule will work anywhere in the input file.
</p>
<p>All the comments in the following example are valid:
</p>
<a name="index-comments_002c-valid-uses-of"></a>
<a name="index-comments-in-the-input"></a>
<div class="example">
<pre class="verbatim">%{
/* code block */
%}
/* Definitions Section */
%x STATE_X
%%
/* Rules Section */
ruleA /* after regex */ { /* code block */ } /* after code block */
/* Rules Section (indented) */
&lt;STATE_X&gt;{
ruleC ECHO;
ruleD ECHO;
%{
/* code block */
%}
}
%%
/* User Code Section */
</pre></div>
</body>
</html>
+116
View File
@@ -0,0 +1,116 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
The flex manual is placed under the same licensing conditions as the
rest of flex:
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
The Flex Project.
Copyright (C) 1990, 1997 The Regents of the University of California.
All rights reserved.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. -->
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Lexical Analysis With Flex, for Flex 2.6.2: Common Patterns</title>
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Common Patterns">
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Common Patterns">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Indices.html#Indices" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Appendices.html#Appendices" rel="up" title="Appendices">
<link href="Numbers.html#Numbers" rel="next" title="Numbers">
<link href="M4-Dependency.html#M4-Dependency" rel="prev" title="M4 Dependency">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Common-Patterns"></a>
<div class="header">
<p>
Previous: <a href="M4-Dependency.html#M4-Dependency" accesskey="p" rel="prev">M4 Dependency</a>, Up: <a href="Appendices.html#Appendices" accesskey="u" rel="up">Appendices</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Common-Patterns-1"></a>
<h3 class="section">A.4 Common Patterns</h3>
<a name="index-patterns_002c-common"></a>
<p>This appendix provides examples of common regular expressions you might use
in your scanner.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="Numbers.html#Numbers" accesskey="1">Numbers</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="Identifiers.html#Identifiers" accesskey="2">Identifiers</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="Quoted-Constructs.html#Quoted-Constructs" accesskey="3">Quoted Constructs</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="Addresses.html#Addresses" accesskey="4">Addresses</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
</body>
</html>
+576
View File
@@ -0,0 +1,576 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
The flex manual is placed under the same licensing conditions as the
rest of flex:
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
The Flex Project.
Copyright (C) 1990, 1997 The Regents of the University of California.
All rights reserved.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. -->
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Lexical Analysis With Flex, for Flex 2.6.2: Concept Index</title>
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Concept Index">
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Concept Index">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Indices.html#Indices" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Indices.html#Indices" rel="up" title="Indices">
<link href="Index-of-Functions-and-Macros.html#Index-of-Functions-and-Macros" rel="next" title="Index of Functions and Macros">
<link href="Indices.html#Indices" rel="prev" title="Indices">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Concept-Index"></a>
<div class="header">
<p>
Next: <a href="Index-of-Functions-and-Macros.html#Index-of-Functions-and-Macros" accesskey="n" rel="next">Index of Functions and Macros</a>, Previous: <a href="Indices.html#Indices" accesskey="p" rel="prev">Indices</a>, Up: <a href="Indices.html#Indices" accesskey="u" rel="up">Indices</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Concept-Index-1"></a>
<h3 class="unnumberedsec">Concept Index</h3>
<table><tr><th valign="top">Jump to: &nbsp; </th><td><a class="summary-letter" href="#Concept-Index_cp_symbol-1"><b>$</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_symbol-2"><b>%</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_symbol-3"><b>&lt;</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_symbol-4"><b>[</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_symbol-5"><b>^</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_symbol-6"><b>|</b></a>
&nbsp;
<br>
<a class="summary-letter" href="#Concept-Index_cp_letter-A"><b>A</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-B"><b>B</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-C"><b>C</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-D"><b>D</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-E"><b>E</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-F"><b>F</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-G"><b>G</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-H"><b>H</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-I"><b>I</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-K"><b>K</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-L"><b>L</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-M"><b>M</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-N"><b>N</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-O"><b>O</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-P"><b>P</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-R"><b>R</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-S"><b>S</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-T"><b>T</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-U"><b>U</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-V"><b>V</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-W"><b>W</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-Y"><b>Y</b></a>
&nbsp;
</td></tr></table>
<table class="index-cp" border="0">
<tr><td></td><th align="left">Index Entry</th><td>&nbsp;</td><th align="left"> Section</th></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_symbol-1">$</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-_0024-as-normal-character-in-patterns">$ as normal character in patterns</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_symbol-2">%</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="Matching.html#index-_0025array_002c-advantages-of">%array, advantages of</a>:</td><td>&nbsp;</td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
<tr><td></td><td valign="top"><a href="Matching.html#index-_0025array_002c-use-of">%array, use of</a>:</td><td>&nbsp;</td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
<tr><td></td><td valign="top"><a href="Matching.html#index-_0025array_002c-with-C_002b_002b">%array, with C++</a>:</td><td>&nbsp;</td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-_0025option-noyywrapp">%option noyywrapp</a>:</td><td>&nbsp;</td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-_0025pointer_002c-and-unput_0028_0029">%pointer, and unput()</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Matching.html#index-_0025pointer_002c-use-of">%pointer, use of</a>:</td><td>&nbsp;</td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
<tr><td></td><td valign="top"><a href="Definitions-Section.html#index-_0025top">%top</a>:</td><td>&nbsp;</td><td valign="top"><a href="Definitions-Section.html#Definitions-Section">Definitions Section</a></td></tr>
<tr><td></td><td valign="top"><a href="Definitions-Section.html#index-_0025_007b-and-_0025_007d_002c-in-Definitions-Section">%{ and %}, in Definitions Section</a>:</td><td>&nbsp;</td><td valign="top"><a href="Definitions-Section.html#Definitions-Section">Definitions Section</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-_0025_007b-and-_0025_007d_002c-in-Rules-Section">%{ and %}, in Rules Section</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_symbol-3">&lt;</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="EOF.html#index-_003c_003cEOF_003e_003e_002c-use-of">&lt;&lt;EOF&gt;&gt;, use of</a>:</td><td>&nbsp;</td><td valign="top"><a href="EOF.html#EOF">EOF</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_symbol-4">[</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-_005b_005d-in-patterns">[] in patterns</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_symbol-5">^</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-_005e-as-non_002dspecial-character-in-patterns">^ as non-special character in patterns</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_symbol-6">|</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-_007c_002c-in-actions">|, in actions</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-_007c_002c-use-of">|, use of</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-A">A</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="Accessor-Methods.html#index-accessor-functions_002c-use-of">accessor functions, use of</a>:</td><td>&nbsp;</td><td valign="top"><a href="Accessor-Methods.html#Accessor-Methods">Accessor Methods</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-actions">actions</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-actions_002c-embedded-C-strings">actions, embedded C strings</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Misc-Macros.html#index-actions_002c-redefining-YY_005fBREAK">actions, redefining YY_BREAK</a>:</td><td>&nbsp;</td><td valign="top"><a href="Misc-Macros.html#Misc-Macros">Misc Macros</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-actions_002c-use-of-_007b-and-_007d">actions, use of { and }</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Definitions-Section.html#index-aliases_002c-how-to-define">aliases, how to define</a>:</td><td>&nbsp;</td><td valign="top"><a href="Definitions-Section.html#Definitions-Section">Definitions Section</a></td></tr>
<tr><td></td><td valign="top"><a href="Scanner-Options.html#index-arguments_002c-command_002dline">arguments, command-line</a>:</td><td>&nbsp;</td><td valign="top"><a href="Scanner-Options.html#Scanner-Options">Scanner Options</a></td></tr>
<tr><td></td><td valign="top"><a href="User-Values.html#index-array_002c-default-size-for-yytext">array, default size for yytext</a>:</td><td>&nbsp;</td><td valign="top"><a href="User-Values.html#User-Values">User Values</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-B">B</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="Performance.html#index-backing-up_002c-eliminating">backing up, eliminating</a>:</td><td>&nbsp;</td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
<tr><td></td><td valign="top"><a href="Performance.html#index-backing-up_002c-eliminating-by-adding-error-rules">backing up, eliminating by adding error rules</a>:</td><td>&nbsp;</td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
<tr><td></td><td valign="top"><a href="Performance.html#index-backing-up_002c-eliminating-with-catch_002dall-rule">backing up, eliminating with catch-all rule</a>:</td><td>&nbsp;</td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
<tr><td></td><td valign="top"><a href="Performance.html#index-backing-up_002c-example-of-eliminating">backing up, example of eliminating</a>:</td><td>&nbsp;</td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-BEGIN">BEGIN</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-BEGIN_002c-explanation">BEGIN, explanation</a>:</td><td>&nbsp;</td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-beginning-of-line_002c-in-patterns">beginning of line, in patterns</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Bison-Bridge.html#index-bison_002c-bridging-with-flex">bison, bridging with flex</a>:</td><td>&nbsp;</td><td valign="top"><a href="Bison-Bridge.html#Bison-Bridge">Bison Bridge</a></td></tr>
<tr><td></td><td valign="top"><a href="Bison-Bridge.html#index-bison_002c-parser">bison, parser</a>:</td><td>&nbsp;</td><td valign="top"><a href="Bison-Bridge.html#Bison-Bridge">Bison Bridge</a></td></tr>
<tr><td></td><td valign="top"><a href="Bison-Bridge.html#index-bison_002c-scanner-to-be-called-from-bison">bison, scanner to be called from bison</a>:</td><td>&nbsp;</td><td valign="top"><a href="Bison-Bridge.html#Bison-Bridge">Bison Bridge</a></td></tr>
<tr><td></td><td valign="top"><a href="Misc-Macros.html#index-BOL_002c-checking-the-BOL-flag">BOL, checking the BOL flag</a>:</td><td>&nbsp;</td><td valign="top"><a href="Misc-Macros.html#Misc-Macros">Misc Macros</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-BOL_002c-in-patterns">BOL, in patterns</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Misc-Macros.html#index-BOL_002c-setting-it">BOL, setting it</a>:</td><td>&nbsp;</td><td valign="top"><a href="Misc-Macros.html#Misc-Macros">Misc Macros</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-braces-in-patterns">braces in patterns</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Reporting-Bugs.html#index-bugs_002c-reporting">bugs, reporting</a>:</td><td>&nbsp;</td><td valign="top"><a href="Reporting-Bugs.html#Reporting-Bugs">Reporting Bugs</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-C">C</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="Definitions-Section.html#index-C-code-in-flex-input">C code in flex input</a>:</td><td>&nbsp;</td><td valign="top"><a href="Definitions-Section.html#Definitions-Section">Definitions Section</a></td></tr>
<tr><td></td><td valign="top"><a href="Cxx.html#index-C_002b_002b">C++</a>:</td><td>&nbsp;</td><td valign="top"><a href="Cxx.html#Cxx">Cxx</a></td></tr>
<tr><td></td><td valign="top"><a href="User-Values.html#index-C_002b_002b-and-_0025array">C++ and %array</a>:</td><td>&nbsp;</td><td valign="top"><a href="User-Values.html#User-Values">User Values</a></td></tr>
<tr><td></td><td valign="top"><a href="How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f.html#index-C_002b_002b-I_002fO_002c-customizing">C++ I/O, customizing</a>:</td><td>&nbsp;</td><td valign="top"><a href="How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f.html#How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f">How do I use my own I/O classes in a C++ scanner?</a></td></tr>
<tr><td></td><td valign="top"><a href="Cxx.html#index-C_002b_002b-scanners_002c-including-multiple-scanners">C++ scanners, including multiple scanners</a>:</td><td>&nbsp;</td><td valign="top"><a href="Cxx.html#Cxx">Cxx</a></td></tr>
<tr><td></td><td valign="top"><a href="Cxx.html#index-C_002b_002b-scanners_002c-use-of">C++ scanners, use of</a>:</td><td>&nbsp;</td><td valign="top"><a href="Cxx.html#Cxx">Cxx</a></td></tr>
<tr><td></td><td valign="top"><a href="Cxx.html#index-c_002b_002b_002c-experimental-form-of-scanner-class">c++, experimental form of scanner class</a>:</td><td>&nbsp;</td><td valign="top"><a href="Cxx.html#Cxx">Cxx</a></td></tr>
<tr><td></td><td valign="top"><a href="Cxx.html#index-C_002b_002b_002c-multiple-different-scanners">C++, multiple different scanners</a>:</td><td>&nbsp;</td><td valign="top"><a href="Cxx.html#Cxx">Cxx</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-C_002dstrings_002c-in-actions">C-strings, in actions</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-case_002dinsensitive_002c-effect-on-character-classes">case-insensitive, effect on character classes</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-character-classes-in-patterns">character classes in patterns</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-character-classes-in-patterns_002c-syntax-of">character classes in patterns, syntax of</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-character-classes_002c-equivalence-of">character classes, equivalence of</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Multiple-Input-Buffers.html#index-clearing-an-input-buffer">clearing an input buffer</a>:</td><td>&nbsp;</td><td valign="top"><a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a></td></tr>
<tr><td></td><td valign="top"><a href="Scanner-Options.html#index-command_002dline-options">command-line options</a>:</td><td>&nbsp;</td><td valign="top"><a href="Scanner-Options.html#Scanner-Options">Scanner Options</a></td></tr>
<tr><td></td><td valign="top"><a href="Definitions-Section.html#index-comments-in-flex-input">comments in flex input</a>:</td><td>&nbsp;</td><td valign="top"><a href="Definitions-Section.html#Definitions-Section">Definitions Section</a></td></tr>
<tr><td></td><td valign="top"><a href="Comments-in-the-Input.html#index-comments-in-the-input">comments in the input</a>:</td><td>&nbsp;</td><td valign="top"><a href="Comments-in-the-Input.html#Comments-in-the-Input">Comments in the Input</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-comments_002c-discarding">comments, discarding</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-comments_002c-example-of-scanning-C-comments">comments, example of scanning C comments</a>:</td><td>&nbsp;</td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-comments_002c-in-actions">comments, in actions</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Comments-in-the-Input.html#index-comments_002c-in-rules-section">comments, in rules section</a>:</td><td>&nbsp;</td><td valign="top"><a href="Comments-in-the-Input.html#Comments-in-the-Input">Comments in the Input</a></td></tr>
<tr><td></td><td valign="top"><a href="Comments-in-the-Input.html#index-comments_002c-syntax-of">comments, syntax of</a>:</td><td>&nbsp;</td><td valign="top"><a href="Comments-in-the-Input.html#Comments-in-the-Input">Comments in the Input</a></td></tr>
<tr><td></td><td valign="top"><a href="Comments-in-the-Input.html#index-comments_002c-valid-uses-of">comments, valid uses of</a>:</td><td>&nbsp;</td><td valign="top"><a href="Comments-in-the-Input.html#Comments-in-the-Input">Comments in the Input</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-compressing-whitespace">compressing whitespace</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-concatenation_002c-in-patterns">concatenation, in patterns</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Copyright.html#index-copyright-of-flex">copyright of flex</a>:</td><td>&nbsp;</td><td valign="top"><a href="Copyright.html#Copyright">Copyright</a></td></tr>
<tr><td></td><td valign="top"><a href="Simple-Examples.html#index-counting-characters-and-lines">counting characters and lines</a>:</td><td>&nbsp;</td><td valign="top"><a href="Simple-Examples.html#Simple-Examples">Simple Examples</a></td></tr>
<tr><td></td><td valign="top"><a href="How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f.html#index-customizing-I_002fO-in-C_002b_002b-scanners">customizing I/O in C++ scanners</a>:</td><td>&nbsp;</td><td valign="top"><a href="How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f.html#How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f">How do I use my own I/O classes in a C++ scanner?</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-D">D</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="Simple-Examples.html#index-default-rule">default rule</a>:</td><td>&nbsp;</td><td valign="top"><a href="Simple-Examples.html#Simple-Examples">Simple Examples</a></td></tr>
<tr><td></td><td valign="top"><a href="Matching.html#index-default-rule-1">default rule</a>:</td><td>&nbsp;</td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
<tr><td></td><td valign="top"><a href="Definitions-Section.html#index-defining-pattern-aliases">defining pattern aliases</a>:</td><td>&nbsp;</td><td valign="top"><a href="Definitions-Section.html#Definitions-Section">Definitions Section</a></td></tr>
<tr><td></td><td valign="top"><a href="Definitions-Section.html#index-Definitions_002c-in-flex-input">Definitions, in flex input</a>:</td><td>&nbsp;</td><td valign="top"><a href="Definitions-Section.html#Definitions-Section">Definitions Section</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-deleting-lines-from-input">deleting lines from input</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-discarding-C-comments">discarding C comments</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Copyright.html#index-distributing-flex">distributing flex</a>:</td><td>&nbsp;</td><td valign="top"><a href="Copyright.html#Copyright">Copyright</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-E">E</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-ECHO">ECHO</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-ECHO_002c-and-yyout">ECHO, and yyout</a>:</td><td>&nbsp;</td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
<tr><td></td><td valign="top"><a href="Definitions-Section.html#index-embedding-C-code-in-flex-input">embedding C code in flex input</a>:</td><td>&nbsp;</td><td valign="top"><a href="Definitions-Section.html#Definitions-Section">Definitions Section</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-end-of-file_002c-in-patterns">end of file, in patterns</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-end-of-line_002c-in-negated-character-classes">end of line, in negated character classes</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-end-of-line_002c-in-patterns">end of line, in patterns</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-end_002dof_002dfile_002c-and-yyrestart_0028_0029">end-of-file, and yyrestart()</a>:</td><td>&nbsp;</td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-EOF-and-yyrestart_0028_0029">EOF and yyrestart()</a>:</td><td>&nbsp;</td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-EOF-in-patterns_002c-syntax-of">EOF in patterns, syntax of</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Multiple-Input-Buffers.html#index-EOF_002c-example-using-multiple-input-buffers">EOF, example using multiple input buffers</a>:</td><td>&nbsp;</td><td valign="top"><a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a></td></tr>
<tr><td></td><td valign="top"><a href="EOF.html#index-EOF_002c-explanation">EOF, explanation</a>:</td><td>&nbsp;</td><td valign="top"><a href="EOF.html#EOF">EOF</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-EOF_002c-pushing-back">EOF, pushing back</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-EOL_002c-in-negated-character-classes">EOL, in negated character classes</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-EOL_002c-in-patterns">EOL, in patterns</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Lex-and-Posix.html#index-error-messages_002c-end-of-buffer-missed">error messages, end of buffer missed</a>:</td><td>&nbsp;</td><td valign="top"><a href="Lex-and-Posix.html#Lex-and-Posix">Lex and Posix</a></td></tr>
<tr><td></td><td valign="top"><a href="Diagnostics.html#index-error-reporting_002c-diagnostic-messages">error reporting, diagnostic messages</a>:</td><td>&nbsp;</td><td valign="top"><a href="Diagnostics.html#Diagnostics">Diagnostics</a></td></tr>
<tr><td></td><td valign="top"><a href="Cxx.html#index-error-reporting_002c-in-C_002b_002b">error reporting, in C++</a>:</td><td>&nbsp;</td><td valign="top"><a href="Cxx.html#Cxx">Cxx</a></td></tr>
<tr><td></td><td valign="top"><a href="Performance.html#index-error-rules_002c-to-eliminate-backing-up">error rules, to eliminate backing up</a>:</td><td>&nbsp;</td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-escape-sequences-in-patterns_002c-syntax-of">escape sequences in patterns, syntax of</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-exiting-with-yyterminate_0028_0029">exiting with yyterminate()</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Cxx.html#index-experimental-form-of-c_002b_002b-scanner-class">experimental form of c++ scanner class</a>:</td><td>&nbsp;</td><td valign="top"><a href="Cxx.html#Cxx">Cxx</a></td></tr>
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-extended-scope-of-start-conditions">extended scope of start conditions</a>:</td><td>&nbsp;</td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-F">F</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="Format.html#index-file-format">file format</a>:</td><td>&nbsp;</td><td valign="top"><a href="Format.html#Format">Format</a></td></tr>
<tr><td></td><td valign="top"><a href="Tables-File-Format.html#index-file-format_002c-serialized-tables">file format, serialized tables</a>:</td><td>&nbsp;</td><td valign="top"><a href="Tables-File-Format.html#Tables-File-Format">Tables File Format</a></td></tr>
<tr><td></td><td valign="top"><a href="Multiple-Input-Buffers.html#index-flushing-an-input-buffer">flushing an input buffer</a>:</td><td>&nbsp;</td><td valign="top"><a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-flushing-the-internal-buffer">flushing the internal buffer</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Format.html#index-format-of-flex-input">format of flex input</a>:</td><td>&nbsp;</td><td valign="top"><a href="Format.html#Format">Format</a></td></tr>
<tr><td></td><td valign="top"><a href="Format.html#index-format-of-input-file">format of input file</a>:</td><td>&nbsp;</td><td valign="top"><a href="Format.html#Format">Format</a></td></tr>
<tr><td></td><td valign="top"><a href="Loading-and-Unloading-Serialized-Tables.html#index-freeing-tables">freeing tables</a>:</td><td>&nbsp;</td><td valign="top"><a href="Loading-and-Unloading-Serialized-Tables.html#Loading-and-Unloading-Serialized-Tables">Loading and Unloading Serialized Tables</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-G">G</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-getting-current-start-state-with-YY_005fSTART">getting current start state with YY_START</a>:</td><td>&nbsp;</td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-H">H</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-halting-with-yyterminate_0028_0029">halting with yyterminate()</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Multiple-Input-Buffers.html#index-handling-include-files-with-multiple-input-buffers">handling include files with multiple input buffers</a>:</td><td>&nbsp;</td><td valign="top"><a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a></td></tr>
<tr><td></td><td valign="top"><a href="Multiple-Input-Buffers.html#index-handling-include-files-with-multiple-input-buffers-1">handling include files with multiple input buffers</a>:</td><td>&nbsp;</td><td valign="top"><a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a></td></tr>
<tr><td></td><td valign="top"><a href="Cxx.html#index-header-files_002c-with-C_002b_002b">header files, with C++</a>:</td><td>&nbsp;</td><td valign="top"><a href="Cxx.html#Cxx">Cxx</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-I">I</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="Cxx.html#index-include-files_002c-with-C_002b_002b">include files, with C++</a>:</td><td>&nbsp;</td><td valign="top"><a href="Cxx.html#Cxx">Cxx</a></td></tr>
<tr><td></td><td valign="top"><a href="Definitions-Section.html#index-input-file_002c-Definitions-section">input file, Definitions section</a>:</td><td>&nbsp;</td><td valign="top"><a href="Definitions-Section.html#Definitions-Section">Definitions Section</a></td></tr>
<tr><td></td><td valign="top"><a href="Rules-Section.html#index-input-file_002c-Rules-Section">input file, Rules Section</a>:</td><td>&nbsp;</td><td valign="top"><a href="Rules-Section.html#Rules-Section">Rules Section</a></td></tr>
<tr><td></td><td valign="top"><a href="User-Code-Section.html#index-input-file_002c-user-code-Section">input file, user code Section</a>:</td><td>&nbsp;</td><td valign="top"><a href="User-Code-Section.html#User-Code-Section">User Code Section</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-input_0028_0029">input()</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-input_0028_0029_002c-and-C_002b_002b">input(), and C++</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Format.html#index-input_002c-format-of">input, format of</a>:</td><td>&nbsp;</td><td valign="top"><a href="Format.html#Format">Format</a></td></tr>
<tr><td></td><td valign="top"><a href="Matching.html#index-input_002c-matching">input, matching</a>:</td><td>&nbsp;</td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-K">K</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="Performance.html#index-keywords_002c-for-performance">keywords, for performance</a>:</td><td>&nbsp;</td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-L">L</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="Lex-and-Posix.html#index-lex-_0028traditional_0029-and-POSIX">lex (traditional) and POSIX</a>:</td><td>&nbsp;</td><td valign="top"><a href="Lex-and-Posix.html#Lex-and-Posix">Lex and Posix</a></td></tr>
<tr><td></td><td valign="top"><a href="How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f.html#index-LexerInput_002c-overriding">LexerInput, overriding</a>:</td><td>&nbsp;</td><td valign="top"><a href="How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f.html#How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f">How do I use my own I/O classes in a C++ scanner?</a></td></tr>
<tr><td></td><td valign="top"><a href="How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f.html#index-LexerOutput_002c-overriding">LexerOutput, overriding</a>:</td><td>&nbsp;</td><td valign="top"><a href="How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f.html#How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f">How do I use my own I/O classes in a C++ scanner?</a></td></tr>
<tr><td></td><td valign="top"><a href="Limitations.html#index-limitations-of-flex">limitations of flex</a>:</td><td>&nbsp;</td><td valign="top"><a href="Limitations.html#Limitations">Limitations</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-literal-text-in-patterns_002c-syntax-of">literal text in patterns, syntax of</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Loading-and-Unloading-Serialized-Tables.html#index-loading-tables-at-runtime">loading tables at runtime</a>:</td><td>&nbsp;</td><td valign="top"><a href="Loading-and-Unloading-Serialized-Tables.html#Loading-and-Unloading-Serialized-Tables">Loading and Unloading Serialized Tables</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-M">M</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="M4-Dependency.html#index-m4">m4</a>:</td><td>&nbsp;</td><td valign="top"><a href="M4-Dependency.html#M4-Dependency">M4 Dependency</a></td></tr>
<tr><td></td><td valign="top"><a href="Makefiles-and-Flex.html#index-Makefile_002c-example-of-implicit-rules">Makefile, example of implicit rules</a>:</td><td>&nbsp;</td><td valign="top"><a href="Makefiles-and-Flex.html#Makefiles-and-Flex">Makefiles and Flex</a></td></tr>
<tr><td></td><td valign="top"><a href="Makefiles-and-Flex.html#index-Makefile_002c-explicit-example">Makefile, explicit example</a>:</td><td>&nbsp;</td><td valign="top"><a href="Makefiles-and-Flex.html#Makefiles-and-Flex">Makefiles and Flex</a></td></tr>
<tr><td></td><td valign="top"><a href="Makefiles-and-Flex.html#index-Makefile_002c-syntax">Makefile, syntax</a>:</td><td>&nbsp;</td><td valign="top"><a href="Makefiles-and-Flex.html#Makefiles-and-Flex">Makefiles and Flex</a></td></tr>
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-matching-C_002dstyle-double_002dquoted-strings">matching C-style double-quoted strings</a>:</td><td>&nbsp;</td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
<tr><td></td><td valign="top"><a href="Matching.html#index-matching_002c-and-trailing-context">matching, and trailing context</a>:</td><td>&nbsp;</td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
<tr><td></td><td valign="top"><a href="Matching.html#index-matching_002c-length-of">matching, length of</a>:</td><td>&nbsp;</td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
<tr><td></td><td valign="top"><a href="Matching.html#index-matching_002c-multiple-matches">matching, multiple matches</a>:</td><td>&nbsp;</td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
<tr><td></td><td valign="top"><a href="Cxx.html#index-member-functions_002c-C_002b_002b">member functions, C++</a>:</td><td>&nbsp;</td><td valign="top"><a href="Cxx.html#Cxx">Cxx</a></td></tr>
<tr><td></td><td valign="top"><a href="Memory-Management.html#index-memory-management">memory management</a>:</td><td>&nbsp;</td><td valign="top"><a href="Memory-Management.html#Memory-Management">Memory Management</a></td></tr>
<tr><td></td><td valign="top"><a href="Multiple-Input-Buffers.html#index-memory_002c-allocating-input-buffers">memory, allocating input buffers</a>:</td><td>&nbsp;</td><td valign="top"><a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a></td></tr>
<tr><td></td><td valign="top"><a href="Init-and-Destroy-Functions.html#index-memory_002c-considerations-for-reentrant-scanners">memory, considerations for reentrant scanners</a>:</td><td>&nbsp;</td><td valign="top"><a href="Init-and-Destroy-Functions.html#Init-and-Destroy-Functions">Init and Destroy Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="Multiple-Input-Buffers.html#index-memory_002c-deleting-input-buffers">memory, deleting input buffers</a>:</td><td>&nbsp;</td><td valign="top"><a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a></td></tr>
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-memory_002c-for-start-condition-stacks">memory, for start condition stacks</a>:</td><td>&nbsp;</td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
<tr><td></td><td valign="top"><a href="Serialized-Tables.html#index-memory_002c-serialized-tables">memory, serialized tables</a>:</td><td>&nbsp;</td><td valign="top"><a href="Serialized-Tables.html#Serialized-Tables">Serialized Tables</a></td></tr>
<tr><td></td><td valign="top"><a href="Loading-and-Unloading-Serialized-Tables.html#index-memory_002c-serialized-tables-1">memory, serialized tables</a>:</td><td>&nbsp;</td><td valign="top"><a href="Loading-and-Unloading-Serialized-Tables.html#Loading-and-Unloading-Serialized-Tables">Loading and Unloading Serialized Tables</a></td></tr>
<tr><td></td><td valign="top"><a href="Cxx.html#index-methods_002c-c_002b_002b">methods, c++</a>:</td><td>&nbsp;</td><td valign="top"><a href="Cxx.html#Cxx">Cxx</a></td></tr>
<tr><td></td><td valign="top"><a href="Matching.html#index-minimal-scanner">minimal scanner</a>:</td><td>&nbsp;</td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
<tr><td></td><td valign="top"><a href="Multiple-Input-Buffers.html#index-multiple-input-streams">multiple input streams</a>:</td><td>&nbsp;</td><td valign="top"><a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-N">N</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="Lex-and-Posix.html#index-name-definitions_002c-not-POSIX">name definitions, not POSIX</a>:</td><td>&nbsp;</td><td valign="top"><a href="Lex-and-Posix.html#Lex-and-Posix">Lex and Posix</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-negating-ranges-in-patterns">negating ranges in patterns</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-newline_002c-matching-in-patterns">newline, matching in patterns</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Lex-and-Posix.html#index-non_002dPOSIX-features-of-flex">non-POSIX features of flex</a>:</td><td>&nbsp;</td><td valign="top"><a href="Lex-and-Posix.html#Lex-and-Posix">Lex and Posix</a></td></tr>
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-noyywrap_002c-_0025option">noyywrap, %option</a>:</td><td>&nbsp;</td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-NULL-character-in-patterns_002c-syntax-of">NULL character in patterns, syntax of</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-O">O</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-octal-characters-in-patterns">octal characters in patterns</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Scanner-Options.html#index-options_002c-command_002dline">options, command-line</a>:</td><td>&nbsp;</td><td valign="top"><a href="Scanner-Options.html#Scanner-Options">Scanner Options</a></td></tr>
<tr><td></td><td valign="top"><a href="How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f.html#index-overriding-LexerInput">overriding LexerInput</a>:</td><td>&nbsp;</td><td valign="top"><a href="How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f.html#How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f">How do I use my own I/O classes in a C++ scanner?</a></td></tr>
<tr><td></td><td valign="top"><a href="How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f.html#index-overriding-LexerOutput">overriding LexerOutput</a>:</td><td>&nbsp;</td><td valign="top"><a href="How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f.html#How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f">How do I use my own I/O classes in a C++ scanner?</a></td></tr>
<tr><td></td><td valign="top"><a href="Overriding-The-Default-Memory-Management.html#index-overriding-the-memory-routines">overriding the memory routines</a>:</td><td>&nbsp;</td><td valign="top"><a href="Overriding-The-Default-Memory-Management.html#Overriding-The-Default-Memory-Management">Overriding The Default Memory Management</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-P">P</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="Simple-Examples.html#index-Pascal_002dlike-language">Pascal-like language</a>:</td><td>&nbsp;</td><td valign="top"><a href="Simple-Examples.html#Simple-Examples">Simple Examples</a></td></tr>
<tr><td></td><td valign="top"><a href="Definitions-Section.html#index-pattern-aliases_002c-defining">pattern aliases, defining</a>:</td><td>&nbsp;</td><td valign="top"><a href="Definitions-Section.html#Definitions-Section">Definitions Section</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-pattern-aliases_002c-expansion-of">pattern aliases, expansion of</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Definitions-Section.html#index-pattern-aliases_002c-how-to-define">pattern aliases, how to define</a>:</td><td>&nbsp;</td><td valign="top"><a href="Definitions-Section.html#Definitions-Section">Definitions Section</a></td></tr>
<tr><td></td><td valign="top"><a href="Definitions-Section.html#index-pattern-aliases_002c-use-of">pattern aliases, use of</a>:</td><td>&nbsp;</td><td valign="top"><a href="Definitions-Section.html#Definitions-Section">Definitions Section</a></td></tr>
<tr><td></td><td valign="top"><a href="Lex-and-Posix.html#index-patterns-and-actions-on-different-lines">patterns and actions on different lines</a>:</td><td>&nbsp;</td><td valign="top"><a href="Lex-and-Posix.html#Lex-and-Posix">Lex and Posix</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-patterns_002c-character-class-equivalence">patterns, character class equivalence</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Common-Patterns.html#index-patterns_002c-common">patterns, common</a>:</td><td>&nbsp;</td><td valign="top"><a href="Common-Patterns.html#Common-Patterns">Common Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-patterns_002c-end-of-line">patterns, end of line</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-patterns_002c-grouping-and-precedence">patterns, grouping and precedence</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-patterns_002c-in-rules-section">patterns, in rules section</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-patterns_002c-invalid-trailing-context">patterns, invalid trailing context</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Matching.html#index-patterns_002c-matching">patterns, matching</a>:</td><td>&nbsp;</td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-patterns_002c-precedence-of-operators">patterns, precedence of operators</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-patterns_002c-repetitions-with-grouping">patterns, repetitions with grouping</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-patterns_002c-special-characters-treated-as-non_002dspecial">patterns, special characters treated as non-special</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-patterns_002c-syntax">patterns, syntax</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-patterns_002c-syntax-1">patterns, syntax</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Performance.html#index-patterns_002c-tuning-for-performance">patterns, tuning for performance</a>:</td><td>&nbsp;</td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-patterns_002c-valid-character-classes">patterns, valid character classes</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Performance.html#index-performance-optimization_002c-matching-longer-tokens">performance optimization, matching longer tokens</a>:</td><td>&nbsp;</td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
<tr><td></td><td valign="top"><a href="Performance.html#index-performance-optimization_002c-recognizing-keywords">performance optimization, recognizing keywords</a>:</td><td>&nbsp;</td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
<tr><td></td><td valign="top"><a href="Performance.html#index-performance_002c-backing-up">performance, backing up</a>:</td><td>&nbsp;</td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
<tr><td></td><td valign="top"><a href="Performance.html#index-performance_002c-considerations">performance, considerations</a>:</td><td>&nbsp;</td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
<tr><td></td><td valign="top"><a href="Performance.html#index-performance_002c-using-keywords">performance, using keywords</a>:</td><td>&nbsp;</td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
<tr><td></td><td valign="top"><a href="Multiple-Input-Buffers.html#index-popping-an-input-buffer">popping an input buffer</a>:</td><td>&nbsp;</td><td valign="top"><a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a></td></tr>
<tr><td></td><td valign="top"><a href="Lex-and-Posix.html#index-POSIX-and-lex">POSIX and lex</a>:</td><td>&nbsp;</td><td valign="top"><a href="Lex-and-Posix.html#Lex-and-Posix">Lex and Posix</a></td></tr>
<tr><td></td><td valign="top"><a href="Lex-and-Posix.html#index-POSIX-comp_003bcompliance">POSIX comp;compliance</a>:</td><td>&nbsp;</td><td valign="top"><a href="Lex-and-Posix.html#Lex-and-Posix">Lex and Posix</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-POSIX_002c-character-classes-in-patterns_002c-syntax-of">POSIX, character classes in patterns, syntax of</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-preprocessor-macros_002c-for-use-in-actions">preprocessor macros, for use in actions</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Multiple-Input-Buffers.html#index-pushing-an-input-buffer">pushing an input buffer</a>:</td><td>&nbsp;</td><td valign="top"><a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-pushing-back-characters-with-unput">pushing back characters with unput</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-pushing-back-characters-with-unput_0028_0029">pushing back characters with unput()</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-pushing-back-characters-with-yyless">pushing back characters with yyless</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-pushing-back-EOF">pushing back EOF</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-R">R</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-ranges-in-patterns">ranges in patterns</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-ranges-in-patterns_002c-negating">ranges in patterns, negating</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-recognizing-C-comments">recognizing C comments</a>:</td><td>&nbsp;</td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
<tr><td></td><td valign="top"><a href="Reentrant-Uses.html#index-reentrant-scanners_002c-multiple-interleaved-scanners">reentrant scanners, multiple interleaved scanners</a>:</td><td>&nbsp;</td><td valign="top"><a href="Reentrant-Uses.html#Reentrant-Uses">Reentrant Uses</a></td></tr>
<tr><td></td><td valign="top"><a href="Reentrant-Uses.html#index-reentrant-scanners_002c-recursive-invocation">reentrant scanners, recursive invocation</a>:</td><td>&nbsp;</td><td valign="top"><a href="Reentrant-Uses.html#Reentrant-Uses">Reentrant Uses</a></td></tr>
<tr><td></td><td valign="top"><a href="Global-Replacement.html#index-reentrant_002c-accessing-flex-variables">reentrant, accessing flex variables</a>:</td><td>&nbsp;</td><td valign="top"><a href="Global-Replacement.html#Global-Replacement">Global Replacement</a></td></tr>
<tr><td></td><td valign="top"><a href="Accessor-Methods.html#index-reentrant_002c-accessor-functions">reentrant, accessor functions</a>:</td><td>&nbsp;</td><td valign="top"><a href="Accessor-Methods.html#Accessor-Methods">Accessor Methods</a></td></tr>
<tr><td></td><td valign="top"><a href="Reentrant-Overview.html#index-reentrant_002c-API-explanation">reentrant, API explanation</a>:</td><td>&nbsp;</td><td valign="top"><a href="Reentrant-Overview.html#Reentrant-Overview">Reentrant Overview</a></td></tr>
<tr><td></td><td valign="top"><a href="Extra-Reentrant-Argument.html#index-reentrant_002c-calling-functions">reentrant, calling functions</a>:</td><td>&nbsp;</td><td valign="top"><a href="Extra-Reentrant-Argument.html#Extra-Reentrant-Argument">Extra Reentrant Argument</a></td></tr>
<tr><td></td><td valign="top"><a href="Reentrant-Example.html#index-reentrant_002c-example-of">reentrant, example of</a>:</td><td>&nbsp;</td><td valign="top"><a href="Reentrant-Example.html#Reentrant-Example">Reentrant Example</a></td></tr>
<tr><td></td><td valign="top"><a href="Reentrant.html#index-reentrant_002c-explanation">reentrant, explanation</a>:</td><td>&nbsp;</td><td valign="top"><a href="Reentrant.html#Reentrant">Reentrant</a></td></tr>
<tr><td></td><td valign="top"><a href="Extra-Data.html#index-reentrant_002c-extra-data">reentrant, extra data</a>:</td><td>&nbsp;</td><td valign="top"><a href="Extra-Data.html#Extra-Data">Extra Data</a></td></tr>
<tr><td></td><td valign="top"><a href="Init-and-Destroy-Functions.html#index-reentrant_002c-initialization">reentrant, initialization</a>:</td><td>&nbsp;</td><td valign="top"><a href="Init-and-Destroy-Functions.html#Init-and-Destroy-Functions">Init and Destroy Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-regular-expressions_002c-in-patterns">regular expressions, in patterns</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-REJECT">REJECT</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-REJECT_002c-calling-multiple-times">REJECT, calling multiple times</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Performance.html#index-REJECT_002c-performance-costs">REJECT, performance costs</a>:</td><td>&nbsp;</td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
<tr><td></td><td valign="top"><a href="Reporting-Bugs.html#index-reporting-bugs">reporting bugs</a>:</td><td>&nbsp;</td><td valign="top"><a href="Reporting-Bugs.html#Reporting-Bugs">Reporting Bugs</a></td></tr>
<tr><td></td><td valign="top"><a href="Lex-and-Posix.html#index-restarting-the-scanner">restarting the scanner</a>:</td><td>&nbsp;</td><td valign="top"><a href="Lex-and-Posix.html#Lex-and-Posix">Lex and Posix</a></td></tr>
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-RETURN_002c-within-actions">RETURN, within actions</a>:</td><td>&nbsp;</td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
<tr><td></td><td valign="top"><a href="Simple-Examples.html#index-rules_002c-default">rules, default</a>:</td><td>&nbsp;</td><td valign="top"><a href="Simple-Examples.html#Simple-Examples">Simple Examples</a></td></tr>
<tr><td></td><td valign="top"><a href="Rules-Section.html#index-rules_002c-in-flex-input">rules, in flex input</a>:</td><td>&nbsp;</td><td valign="top"><a href="Rules-Section.html#Rules-Section">Rules Section</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-S">S</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="Introduction.html#index-scanner_002c-definition-of">scanner, definition of</a>:</td><td>&nbsp;</td><td valign="top"><a href="Introduction.html#Introduction">Introduction</a></td></tr>
<tr><td></td><td valign="top"><a href="Format.html#index-sections-of-flex-input">sections of flex input</a>:</td><td>&nbsp;</td><td valign="top"><a href="Format.html#Format">Format</a></td></tr>
<tr><td></td><td valign="top"><a href="Serialized-Tables.html#index-serialization">serialization</a>:</td><td>&nbsp;</td><td valign="top"><a href="Serialized-Tables.html#Serialized-Tables">Serialized Tables</a></td></tr>
<tr><td></td><td valign="top"><a href="Creating-Serialized-Tables.html#index-serialization-of-tables">serialization of tables</a>:</td><td>&nbsp;</td><td valign="top"><a href="Creating-Serialized-Tables.html#Creating-Serialized-Tables">Creating Serialized Tables</a></td></tr>
<tr><td></td><td valign="top"><a href="Creating-Serialized-Tables.html#index-serialized-tables_002c-multiple-scanners">serialized tables, multiple scanners</a>:</td><td>&nbsp;</td><td valign="top"><a href="Creating-Serialized-Tables.html#Creating-Serialized-Tables">Creating Serialized Tables</a></td></tr>
<tr><td></td><td valign="top"><a href="Multiple-Input-Buffers.html#index-stack_002c-input-buffer-pop">stack, input buffer pop</a>:</td><td>&nbsp;</td><td valign="top"><a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a></td></tr>
<tr><td></td><td valign="top"><a href="Multiple-Input-Buffers.html#index-stack_002c-input-buffer-push">stack, input buffer push</a>:</td><td>&nbsp;</td><td valign="top"><a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a></td></tr>
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-stacks_002c-routines-for-manipulating">stacks, routines for manipulating</a>:</td><td>&nbsp;</td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-start-condition_002c-applying-to-multiple-patterns">start condition, applying to multiple patterns</a>:</td><td>&nbsp;</td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-start-conditions">start conditions</a>:</td><td>&nbsp;</td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-start-conditions_002c-behavior-of-default-rule">start conditions, behavior of default rule</a>:</td><td>&nbsp;</td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-start-conditions_002c-exclusive">start conditions, exclusive</a>:</td><td>&nbsp;</td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-start-conditions_002c-for-different-interpretations-of-same-input">start conditions, for different interpretations of same input</a>:</td><td>&nbsp;</td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-start-conditions_002c-in-patterns">start conditions, in patterns</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-start-conditions_002c-inclusive">start conditions, inclusive</a>:</td><td>&nbsp;</td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-start-conditions_002c-inclusive-v_002es_002e-exclusive">start conditions, inclusive v.s. exclusive</a>:</td><td>&nbsp;</td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-start-conditions_002c-integer-values">start conditions, integer values</a>:</td><td>&nbsp;</td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-start-conditions_002c-multiple">start conditions, multiple</a>:</td><td>&nbsp;</td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-start-conditions_002c-special-wildcard-condition">start conditions, special wildcard condition</a>:</td><td>&nbsp;</td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-start-conditions_002c-use-of-a-stack">start conditions, use of a stack</a>:</td><td>&nbsp;</td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-start-conditions_002c-use-of-wildcard-condition-_0028_003c_002a_003e_0029">start conditions, use of wildcard condition (&lt;*&gt;)</a>:</td><td>&nbsp;</td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-start-conditions_002c-using-BEGIN">start conditions, using BEGIN</a>:</td><td>&nbsp;</td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-stdin_002c-default-for-yyin">stdin, default for yyin</a>:</td><td>&nbsp;</td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-stdout_002c-as-default-for-yyout">stdout, as default for yyout</a>:</td><td>&nbsp;</td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
<tr><td></td><td valign="top"><a href="Multiple-Input-Buffers.html#index-strings_002c-scanning-strings-instead-of-files">strings, scanning strings instead of files</a>:</td><td>&nbsp;</td><td valign="top"><a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-T">T</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="Creating-Serialized-Tables.html#index-tables_002c-creating-serialized">tables, creating serialized</a>:</td><td>&nbsp;</td><td valign="top"><a href="Creating-Serialized-Tables.html#Creating-Serialized-Tables">Creating Serialized Tables</a></td></tr>
<tr><td></td><td valign="top"><a href="Tables-File-Format.html#index-tables_002c-file-format">tables, file format</a>:</td><td>&nbsp;</td><td valign="top"><a href="Tables-File-Format.html#Tables-File-Format">Tables File Format</a></td></tr>
<tr><td></td><td valign="top"><a href="Loading-and-Unloading-Serialized-Tables.html#index-tables_002c-freeing">tables, freeing</a>:</td><td>&nbsp;</td><td valign="top"><a href="Loading-and-Unloading-Serialized-Tables.html#Loading-and-Unloading-Serialized-Tables">Loading and Unloading Serialized Tables</a></td></tr>
<tr><td></td><td valign="top"><a href="Loading-and-Unloading-Serialized-Tables.html#index-tables_002c-loading-and-unloading">tables, loading and unloading</a>:</td><td>&nbsp;</td><td valign="top"><a href="Loading-and-Unloading-Serialized-Tables.html#Loading-and-Unloading-Serialized-Tables">Loading and Unloading Serialized Tables</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-terminating-with-yyterminate_0028_0029">terminating with yyterminate()</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Matching.html#index-token">token</a>:</td><td>&nbsp;</td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-trailing-context_002c-in-patterns">trailing context, in patterns</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-trailing-context_002c-limits-of">trailing context, limits of</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td></td><td valign="top"><a href="Matching.html#index-trailing-context_002c-matching">trailing context, matching</a>:</td><td>&nbsp;</td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
<tr><td></td><td valign="top"><a href="Performance.html#index-trailing-context_002c-performance-costs">trailing context, performance costs</a>:</td><td>&nbsp;</td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
<tr><td></td><td valign="top"><a href="Performance.html#index-trailing-context_002c-variable-length">trailing context, variable length</a>:</td><td>&nbsp;</td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-U">U</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-unput_0028_0029">unput()</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-unput_0028_0029_002c-and-_0025pointer">unput(), and %pointer</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-unput_0028_0029_002c-pushing-back-characters">unput(), pushing back characters</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="User-Code-Section.html#index-user-code_002c-in-flex-input">user code, in flex input</a>:</td><td>&nbsp;</td><td valign="top"><a href="User-Code-Section.html#User-Code-Section">User Code Section</a></td></tr>
<tr><td></td><td valign="top"><a href="Simple-Examples.html#index-username-expansion">username expansion</a>:</td><td>&nbsp;</td><td valign="top"><a href="Simple-Examples.html#Simple-Examples">Simple Examples</a></td></tr>
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-using-integer-values-of-start-condition-names">using integer values of start condition names</a>:</td><td>&nbsp;</td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-V">V</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="Patterns.html#index-verbatim-text-in-patterns_002c-syntax-of">verbatim text in patterns, syntax of</a>:</td><td>&nbsp;</td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-W">W</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="Limitations.html#index-warning_002c-dangerous-trailing-context">warning, dangerous trailing context</a>:</td><td>&nbsp;</td><td valign="top"><a href="Limitations.html#Limitations">Limitations</a></td></tr>
<tr><td></td><td valign="top"><a href="Diagnostics.html#index-warning_002c-rule-cannot-be-matched">warning, rule cannot be matched</a>:</td><td>&nbsp;</td><td valign="top"><a href="Diagnostics.html#Diagnostics">Diagnostics</a></td></tr>
<tr><td></td><td valign="top"><a href="Diagnostics.html#index-warnings_002c-diagnostic-messages">warnings, diagnostic messages</a>:</td><td>&nbsp;</td><td valign="top"><a href="Diagnostics.html#Diagnostics">Diagnostics</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-whitespace_002c-compressing">whitespace, compressing</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-Y">Y</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="Yacc.html#index-yacc-interface">yacc interface</a>:</td><td>&nbsp;</td><td valign="top"><a href="Yacc.html#Yacc">Yacc</a></td></tr>
<tr><td></td><td valign="top"><a href="Yacc.html#index-yacc_002c-interface">yacc, interface</a>:</td><td>&nbsp;</td><td valign="top"><a href="Yacc.html#Yacc">Yacc</a></td></tr>
<tr><td></td><td valign="top"><a href="Overriding-The-Default-Memory-Management.html#index-yyalloc_002c-overriding">yyalloc, overriding</a>:</td><td>&nbsp;</td><td valign="top"><a href="Overriding-The-Default-Memory-Management.html#Overriding-The-Default-Memory-Management">Overriding The Default Memory Management</a></td></tr>
<tr><td></td><td valign="top"><a href="Overriding-The-Default-Memory-Management.html#index-yyfree_002c-overriding">yyfree, overriding</a>:</td><td>&nbsp;</td><td valign="top"><a href="Overriding-The-Default-Memory-Management.html#Overriding-The-Default-Memory-Management">Overriding The Default Memory Management</a></td></tr>
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-yyin">yyin</a>:</td><td>&nbsp;</td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-yyinput_0028_0029">yyinput()</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Matching.html#index-yyleng">yyleng</a>:</td><td>&nbsp;</td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-yyleng_002c-modification-of">yyleng, modification of</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-yyless_0028_0029">yyless()</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-yyless_0028_0029_002c-pushing-back-characters">yyless(), pushing back characters</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-yylex_0028_0029_002c-in-generated-scanner">yylex(), in generated scanner</a>:</td><td>&nbsp;</td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-yylex_0028_0029_002c-overriding">yylex(), overriding</a>:</td><td>&nbsp;</td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-yylex_002c-overriding-the-prototype-of">yylex, overriding the prototype of</a>:</td><td>&nbsp;</td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
<tr><td></td><td valign="top"><a href="Reentrant-Functions.html#index-yylineno_002c-in-a-reentrant-scanner">yylineno, in a reentrant scanner</a>:</td><td>&nbsp;</td><td valign="top"><a href="Reentrant-Functions.html#Reentrant-Functions">Reentrant Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="Performance.html#index-yylineno_002c-performance-costs">yylineno, performance costs</a>:</td><td>&nbsp;</td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-yymore_0028_0029">yymore()</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-yymore_0028_0029-to-append-token-to-previous-token">yymore() to append token to previous token</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-yymore_0028_0029_002c-mega_002dkludge">yymore(), mega-kludge</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-yymore_002c-and-yyleng">yymore, and yyleng</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-yymore_002c-performance-penalty-of">yymore, performance penalty of</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-yyout">yyout</a>:</td><td>&nbsp;</td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
<tr><td></td><td valign="top"><a href="Overriding-The-Default-Memory-Management.html#index-yyrealloc_002c-overriding">yyrealloc, overriding</a>:</td><td>&nbsp;</td><td valign="top"><a href="Overriding-The-Default-Memory-Management.html#Overriding-The-Default-Memory-Management">Overriding The Default Memory Management</a></td></tr>
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-yyrestart_0028_0029">yyrestart()</a>:</td><td>&nbsp;</td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-yyterminate_0028_0029">yyterminate()</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Matching.html#index-yytext">yytext</a>:</td><td>&nbsp;</td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
<tr><td></td><td valign="top"><a href="User-Values.html#index-yytext_002c-default-array-size">yytext, default array size</a>:</td><td>&nbsp;</td><td valign="top"><a href="User-Values.html#User-Values">User Values</a></td></tr>
<tr><td></td><td valign="top"><a href="A-Note-About-yytext-And-Memory.html#index-yytext_002c-memory-considerations">yytext, memory considerations</a>:</td><td>&nbsp;</td><td valign="top"><a href="A-Note-About-yytext-And-Memory.html#A-Note-About-yytext-And-Memory">A Note About yytext And Memory</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-yytext_002c-modification-of">yytext, modification of</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Matching.html#index-yytext_002c-two-types-of">yytext, two types of</a>:</td><td>&nbsp;</td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-yywrap_0028_0029">yywrap()</a>:</td><td>&nbsp;</td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-yywrap_002c-default-for">yywrap, default for</a>:</td><td>&nbsp;</td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
<tr><td></td><td valign="top"><a href="Multiple-Input-Buffers.html#index-YY_005fCURRENT_005fBUFFER_002c-and-multiple-buffers-Finally_002c-the-macro">YY_CURRENT_BUFFER, and multiple buffers Finally, the macro</a>:</td><td>&nbsp;</td><td valign="top"><a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a></td></tr>
<tr><td></td><td valign="top"><a href="Extra-Data.html#index-YY_005fEXTRA_005fTYPE_002c-defining-your-own-type">YY_EXTRA_TYPE, defining your own type</a>:</td><td>&nbsp;</td><td valign="top"><a href="Extra-Data.html#Extra-Data">Extra Data</a></td></tr>
<tr><td></td><td valign="top"><a href="Actions.html#index-YY_005fFLUSH_005fBUFFER">YY_FLUSH_BUFFER</a>:</td><td>&nbsp;</td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-YY_005fINPUT">YY_INPUT</a>:</td><td>&nbsp;</td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-YY_005fINPUT_002c-overriding">YY_INPUT, overriding</a>:</td><td>&nbsp;</td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-YY_005fSTART_002c-example">YY_START, example</a>:</td><td>&nbsp;</td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
<tr><td></td><td valign="top"><a href="Misc-Macros.html#index-YY_005fUSER_005fACTION-to-track-each-time-a-rule-is-matched">YY_USER_ACTION to track each time a rule is matched</a>:</td><td>&nbsp;</td><td valign="top"><a href="Misc-Macros.html#Misc-Macros">Misc Macros</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
</table>
<table><tr><th valign="top">Jump to: &nbsp; </th><td><a class="summary-letter" href="#Concept-Index_cp_symbol-1"><b>$</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_symbol-2"><b>%</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_symbol-3"><b>&lt;</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_symbol-4"><b>[</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_symbol-5"><b>^</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_symbol-6"><b>|</b></a>
&nbsp;
<br>
<a class="summary-letter" href="#Concept-Index_cp_letter-A"><b>A</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-B"><b>B</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-C"><b>C</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-D"><b>D</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-E"><b>E</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-F"><b>F</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-G"><b>G</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-H"><b>H</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-I"><b>I</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-K"><b>K</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-L"><b>L</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-M"><b>M</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-N"><b>N</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-O"><b>O</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-P"><b>P</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-R"><b>R</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-S"><b>S</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-T"><b>T</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-U"><b>U</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-V"><b>V</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-W"><b>W</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-Y"><b>Y</b></a>
&nbsp;
</td></tr></table>
<hr>
<div class="header">
<p>
Next: <a href="Index-of-Functions-and-Macros.html#Index-of-Functions-and-Macros" accesskey="n" rel="next">Index of Functions and Macros</a>, Previous: <a href="Indices.html#Indices" accesskey="p" rel="prev">Indices</a>, Up: <a href="Indices.html#Indices" accesskey="u" rel="up">Indices</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
+142
View File
@@ -0,0 +1,142 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
The flex manual is placed under the same licensing conditions as the
rest of flex:
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
The Flex Project.
Copyright (C) 1990, 1997 The Regents of the University of California.
All rights reserved.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. -->
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Lexical Analysis With Flex, for Flex 2.6.2: Copyright</title>
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Copyright">
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Copyright">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Indices.html#Indices" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="index.html#Top" rel="up" title="Top">
<link href="Reporting-Bugs.html#Reporting-Bugs" rel="next" title="Reporting Bugs">
<link href="index.html#Top" rel="prev" title="Top">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Copyright"></a>
<div class="header">
<p>
Next: <a href="Reporting-Bugs.html#Reporting-Bugs" accesskey="n" rel="next">Reporting Bugs</a>, Previous: <a href="index.html#Top" accesskey="p" rel="prev">Top</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Copyright-1"></a>
<h2 class="chapter">1 Copyright</h2>
<a name="index-copyright-of-flex"></a>
<a name="index-distributing-flex"></a>
<p>The flex manual is placed under the same licensing conditions as the
rest of flex:
</p>
<p>Copyright &copy; 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
The Flex Project.
</p>
<p>Copyright &copy; 1990, 1997 The Regents of the University of California.
All rights reserved.
</p>
<p>This code is derived from software contributed to Berkeley by
Vern Paxson.
</p>
<p>The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
</p>
<p>Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
</p>
<ol>
<li> Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
</li><li> Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
</li></ol>
<p>Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
</p>
<p>THIS SOFTWARE IS PROVIDED &ldquo;AS IS&rdquo; AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.
</p>
</body>
</html>
+136
View File
@@ -0,0 +1,136 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
The flex manual is placed under the same licensing conditions as the
rest of flex:
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
The Flex Project.
Copyright (C) 1990, 1997 The Regents of the University of California.
All rights reserved.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. -->
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Lexical Analysis With Flex, for Flex 2.6.2: Creating Serialized Tables</title>
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Creating Serialized Tables">
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Creating Serialized Tables">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Indices.html#Indices" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Serialized-Tables.html#Serialized-Tables" rel="up" title="Serialized Tables">
<link href="Loading-and-Unloading-Serialized-Tables.html#Loading-and-Unloading-Serialized-Tables" rel="next" title="Loading and Unloading Serialized Tables">
<link href="Serialized-Tables.html#Serialized-Tables" rel="prev" title="Serialized Tables">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Creating-Serialized-Tables"></a>
<div class="header">
<p>
Next: <a href="Loading-and-Unloading-Serialized-Tables.html#Loading-and-Unloading-Serialized-Tables" accesskey="n" rel="next">Loading and Unloading Serialized Tables</a>, Previous: <a href="Serialized-Tables.html#Serialized-Tables" accesskey="p" rel="prev">Serialized Tables</a>, Up: <a href="Serialized-Tables.html#Serialized-Tables" accesskey="u" rel="up">Serialized Tables</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Creating-Serialized-Tables-1"></a>
<h3 class="section">22.1 Creating Serialized Tables</h3>
<a name="index-tables_002c-creating-serialized"></a>
<a name="index-serialization-of-tables"></a>
<p>You may create a scanner with serialized tables by specifying:
</p>
<div class="example">
<pre class="verbatim"> %option tables-file=FILE
or
--tables-file=FILE
</pre></div>
<p>These options instruct flex to save the DFA tables to the file <var>FILE</var>. The tables
will <em>not</em> be embedded in the generated scanner. The scanner will not
function on its own. The scanner will be dependent upon the serialized tables. You must
load the tables from this file at runtime before you can scan anything.
</p>
<p>If you do not specify a filename to <code>--tables-file</code>, the tables will be
saved to <samp>lex.yy.tables</samp>, where &lsquo;<samp>yy</samp>&rsquo; is the appropriate prefix.
</p>
<p>If your project uses several different scanners, you can concatenate the
serialized tables into one file, and flex will find the correct set of tables,
using the scanner prefix as part of the lookup key. An example follows:
</p>
<a name="index-serialized-tables_002c-multiple-scanners"></a>
<div class="example">
<pre class="verbatim">$ flex --tables-file --prefix=cpp cpp.l
$ flex --tables-file --prefix=c c.l
$ cat lex.cpp.tables lex.c.tables &gt; all.tables
</pre></div>
<p>The above example created two scanners, &lsquo;<samp>cpp</samp>&rsquo;, and &lsquo;<samp>c</samp>&rsquo;. Since we did
not specify a filename, the tables were serialized to <samp>lex.c.tables</samp> and
<samp>lex.cpp.tables</samp>, respectively. Then, we concatenated the two files
together into <samp>all.tables</samp>, which we will distribute with our project. At
runtime, we will open the file and tell flex to load the tables from it. Flex
will find the correct tables automatically. (See next section).
</p>
</body>
</html>
+357
View File
@@ -0,0 +1,357 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
The flex manual is placed under the same licensing conditions as the
rest of flex:
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
The Flex Project.
Copyright (C) 1990, 1997 The Regents of the University of California.
All rights reserved.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. -->
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Lexical Analysis With Flex, for Flex 2.6.2: Cxx</title>
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Cxx">
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Cxx">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Indices.html#Indices" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="index.html#Top" rel="up" title="Top">
<link href="Reentrant.html#Reentrant" rel="next" title="Reentrant">
<link href="Performance.html#Performance" rel="prev" title="Performance">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Cxx"></a>
<div class="header">
<p>
Next: <a href="Reentrant.html#Reentrant" accesskey="n" rel="next">Reentrant</a>, Previous: <a href="Performance.html#Performance" accesskey="p" rel="prev">Performance</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Generating-C_002b_002b-Scanners"></a>
<h2 class="chapter">18 Generating C++ Scanners</h2>
<a name="index-c_002b_002b_002c-experimental-form-of-scanner-class"></a>
<a name="index-experimental-form-of-c_002b_002b-scanner-class"></a>
<p><strong>IMPORTANT</strong>: the present form of the scanning class is <em>experimental</em>
and may change considerably between major releases.
</p>
<a name="index-C_002b_002b"></a>
<a name="index-member-functions_002c-C_002b_002b"></a>
<a name="index-methods_002c-c_002b_002b"></a>
<p><code>flex</code> provides two different ways to generate scanners for use
with C++. The first way is to simply compile a scanner generated by
<code>flex</code> using a C++ compiler instead of a C compiler. You should
not encounter any compilation errors (see <a href="Reporting-Bugs.html#Reporting-Bugs">Reporting Bugs</a>). You can
then use C++ code in your rule actions instead of C code. Note that the
default input source for your scanner remains <samp>yyin</samp>, and default
echoing is still done to <samp>yyout</samp>. Both of these remain <code>FILE
*</code> variables and not C++ <em>streams</em>.
</p>
<p>You can also use <code>flex</code> to generate a C++ scanner class, using the
&lsquo;<samp>-+</samp>&rsquo; option (or, equivalently, <code>%option c++)</code>, which is
automatically specified if the name of the <code>flex</code> executable ends
in a &rsquo;+&rsquo;, such as <code>flex++</code>. When using this option, <code>flex</code>
defaults to generating the scanner to the file <samp>lex.yy.cc</samp> instead
of <samp>lex.yy.c</samp>. The generated scanner includes the header file
<samp>FlexLexer.h</samp>, which defines the interface to two C++ classes.
</p>
<p>The first class in <samp>FlexLexer.h</samp>, <code>FlexLexer</code>,
provides an abstract base class defining the general scanner class
interface. It provides the following member functions:
</p>
<dl compact="compact">
<dd><a name="index-YYText-_0028C_002b_002b-only_0029"></a>
</dd>
<dt><code>const char* YYText()</code></dt>
<dd><p>returns the text of the most recently matched token, the equivalent of
<code>yytext</code>.
</p>
<a name="index-YYLeng-_0028C_002b_002b-only_0029"></a>
</dd>
<dt><code>int YYLeng()</code></dt>
<dd><p>returns the length of the most recently matched token, the equivalent of
<code>yyleng</code>.
</p>
<a name="index-lineno-_0028C_002b_002b-only_0029"></a>
</dd>
<dt><code>int lineno() const</code></dt>
<dd><p>returns the current input line number (see <code>%option yylineno)</code>, or
<code>1</code> if <code>%option yylineno</code> was not used.
</p>
<a name="index-set_005fdebug-_0028C_002b_002b-only_0029"></a>
</dd>
<dt><code>void set_debug( int flag )</code></dt>
<dd><p>sets the debugging flag for the scanner, equivalent to assigning to
<code>yy_flex_debug</code> (see <a href="Scanner-Options.html#Scanner-Options">Scanner Options</a>). Note that you must build
the scanner using <code>%option debug</code> to include debugging information
in it.
</p>
<a name="index-debug-_0028C_002b_002b-only_0029"></a>
</dd>
<dt><code>int debug() const</code></dt>
<dd><p>returns the current setting of the debugging flag.
</p></dd>
</dl>
<p>Also provided are member functions equivalent to
<code>yy_switch_to_buffer()</code>, <code>yy_create_buffer()</code> (though the
first argument is an <code>istream&amp;</code> object reference and not a
<code>FILE*)</code>, <code>yy_flush_buffer()</code>, <code>yy_delete_buffer()</code>, and
<code>yyrestart()</code> (again, the first argument is a <code>istream&amp;</code>
object reference).
</p>
<a name="index-yyFlexLexer-_0028C_002b_002b-only_0029"></a>
<a name="index-FlexLexer-_0028C_002b_002b-only_0029"></a>
<p>The second class defined in <samp>FlexLexer.h</samp> is <code>yyFlexLexer</code>,
which is derived from <code>FlexLexer</code>. It defines the following
additional member functions:
</p>
<dl compact="compact">
<dd><a name="index-yyFlexLexer-constructor-_0028C_002b_002b-only_0029"></a>
</dd>
<dt><code>yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 )</code></dt>
<dt><code>yyFlexLexer( istream&amp; arg_yyin, ostream&amp; arg_yyout )</code></dt>
<dd><p>constructs a <code>yyFlexLexer</code> object using the given streams for input
and output. If not specified, the streams default to <code>cin</code> and
<code>cout</code>, respectively. <code>yyFlexLexer</code> does not take ownership of
its stream arguments. It&rsquo;s up to the user to ensure the streams pointed
to remain alive at least as long as the <code>yyFlexLexer</code> instance.
</p>
<a name="index-yylex-_0028C_002b_002b-version_0029"></a>
</dd>
<dt><code>virtual int yylex()</code></dt>
<dd><p>performs the same role is <code>yylex()</code> does for ordinary <code>flex</code>
scanners: it scans the input stream, consuming tokens, until a rule&rsquo;s
action returns a value. If you derive a subclass <code>S</code> from
<code>yyFlexLexer</code> and want to access the member functions and variables
of <code>S</code> inside <code>yylex()</code>, then you need to use <code>%option
yyclass=&quot;S&quot;</code> to inform <code>flex</code> that you will be using that subclass
instead of <code>yyFlexLexer</code>. In this case, rather than generating
<code>yyFlexLexer::yylex()</code>, <code>flex</code> generates <code>S::yylex()</code>
(and also generates a dummy <code>yyFlexLexer::yylex()</code> that calls
<code>yyFlexLexer::LexerError()</code> if called).
</p>
<a name="index-switch_005fstreams-_0028C_002b_002b-only_0029"></a>
</dd>
<dt><code>virtual void switch_streams(istream* new_in = 0, ostream* new_out = 0)</code></dt>
<dt><code>virtual void switch_streams(istream&amp; new_in, ostream&amp; new_out)</code></dt>
<dd><p>reassigns <code>yyin</code> to <code>new_in</code> (if non-null) and <code>yyout</code> to
<code>new_out</code> (if non-null), deleting the previous input buffer if
<code>yyin</code> is reassigned.
</p>
</dd>
<dt><code>int yylex( istream* new_in, ostream* new_out = 0 )</code></dt>
<dt><code>int yylex( istream&amp; new_in, ostream&amp; new_out )</code></dt>
<dd><p>first switches the input streams via <code>switch_streams( new_in,
new_out )</code> and then returns the value of <code>yylex()</code>.
</p></dd>
</dl>
<p>In addition, <code>yyFlexLexer</code> defines the following protected virtual
functions which you can redefine in derived classes to tailor the
scanner:
</p>
<dl compact="compact">
<dd><a name="index-LexerInput-_0028C_002b_002b-only_0029"></a>
</dd>
<dt><code>virtual int LexerInput( char* buf, int max_size )</code></dt>
<dd><p>reads up to <code>max_size</code> characters into <code>buf</code> and returns the
number of characters read. To indicate end-of-input, return 0
characters. Note that <code>interactive</code> scanners (see the &lsquo;<samp>-B</samp>&rsquo;
and &lsquo;<samp>-I</samp>&rsquo; flags in <a href="Scanner-Options.html#Scanner-Options">Scanner Options</a>) define the macro
<code>YY_INTERACTIVE</code>. If you redefine <code>LexerInput()</code> and need to
take different actions depending on whether or not the scanner might be
scanning an interactive input source, you can test for the presence of
this name via <code>#ifdef</code> statements.
</p>
<a name="index-LexerOutput-_0028C_002b_002b-only_0029"></a>
</dd>
<dt><code>virtual void LexerOutput( const char* buf, int size )</code></dt>
<dd><p>writes out <code>size</code> characters from the buffer <code>buf</code>, which, while
<code>NUL</code>-terminated, may also contain internal <code>NUL</code>s if the
scanner&rsquo;s rules can match text with <code>NUL</code>s in them.
</p>
<a name="index-error-reporting_002c-in-C_002b_002b"></a>
<a name="index-LexerError-_0028C_002b_002b-only_0029"></a>
</dd>
<dt><code>virtual void LexerError( const char* msg )</code></dt>
<dd><p>reports a fatal error message. The default version of this function
writes the message to the stream <code>cerr</code> and exits.
</p></dd>
</dl>
<p>Note that a <code>yyFlexLexer</code> object contains its <em>entire</em>
scanning state. Thus you can use such objects to create reentrant
scanners, but see also <a href="Reentrant.html#Reentrant">Reentrant</a>. You can instantiate multiple
instances of the same <code>yyFlexLexer</code> class, and you can also combine
multiple C++ scanner classes together in the same program using the
&lsquo;<samp>-P</samp>&rsquo; option discussed above.
</p>
<p>Finally, note that the <code>%array</code> feature is not available to C++
scanner classes; you must use <code>%pointer</code> (the default).
</p>
<p>Here is an example of a simple C++ scanner:
</p>
<a name="index-C_002b_002b-scanners_002c-use-of"></a>
<div class="example">
<pre class="verbatim"> // An example of using the flex C++ scanner class.
%{
#include &lt;iostream&gt;
using namespace std;
int mylineno = 0;
%}
%option noyywrap c++
string \&quot;[^\n&quot;]+\&quot;
ws [ \t]+
alpha [A-Za-z]
dig [0-9]
name ({alpha}|{dig}|\$)({alpha}|{dig}|[_.\-/$])*
num1 [-+]?{dig}+\.?([eE][-+]?{dig}+)?
num2 [-+]?{dig}*\.{dig}+([eE][-+]?{dig}+)?
number {num1}|{num2}
%%
{ws} /* skip blanks and tabs */
&quot;/*&quot; {
int c;
while((c = yyinput()) != 0)
{
if(c == '\n')
++mylineno;
else if(c == '*')
{
if((c = yyinput()) == '/')
break;
else
unput(c);
}
}
}
{number} cout &lt;&lt; &quot;number &quot; &lt;&lt; YYText() &lt;&lt; '\n';
\n mylineno++;
{name} cout &lt;&lt; &quot;name &quot; &lt;&lt; YYText() &lt;&lt; '\n';
{string} cout &lt;&lt; &quot;string &quot; &lt;&lt; YYText() &lt;&lt; '\n';
%%
// This include is required if main() is an another source file.
//#include &lt;FlexLexer.h&gt;
int main( int /* argc */, char** /* argv */ )
{
FlexLexer* lexer = new yyFlexLexer;
while(lexer-&gt;yylex() != 0)
;
return 0;
}
</pre></div>
<a name="index-C_002b_002b_002c-multiple-different-scanners"></a>
<p>If you want to create multiple (different) lexer classes, you use the
&lsquo;<samp>-P</samp>&rsquo; flag (or the <code>prefix=</code> option) to rename each
<code>yyFlexLexer</code> to some other &lsquo;<samp>xxFlexLexer</samp>&rsquo;. You then can
include <samp>&lt;FlexLexer.h&gt;</samp> in your other sources once per lexer class,
first renaming <code>yyFlexLexer</code> as follows:
</p>
<a name="index-include-files_002c-with-C_002b_002b"></a>
<a name="index-header-files_002c-with-C_002b_002b"></a>
<a name="index-C_002b_002b-scanners_002c-including-multiple-scanners"></a>
<div class="example">
<pre class="verbatim"> #undef yyFlexLexer
#define yyFlexLexer xxFlexLexer
#include &lt;FlexLexer.h&gt;
#undef yyFlexLexer
#define yyFlexLexer zzFlexLexer
#include &lt;FlexLexer.h&gt;
</pre></div>
<p>if, for example, you used <code>%option prefix=&quot;xx&quot;</code> for one of your
scanners and <code>%option prefix=&quot;zz&quot;</code> for the other.
</p>
<hr>
<div class="header">
<p>
Next: <a href="Reentrant.html#Reentrant" accesskey="n" rel="next">Reentrant</a>, Previous: <a href="Performance.html#Performance" accesskey="p" rel="prev">Performance</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More