Skip to content

Commit e13521a

Browse files
authored
Merge pull request #205 from haskell/sphinx
2 parents 6af2a2b + b603324 commit e13521a

22 files changed

+1681
-2467
lines changed

.gitignore

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,6 @@
77
/data/
88
/dist
99
/dist-newstyle
10-
/doc/alex.1
11-
/doc/alex.pdf
12-
/doc/alex/*.html
13-
/doc/alex/fptools.css
14-
/doc/autom4te.cache/
15-
/doc/configure
16-
/doc/config.log
17-
/doc/config.mk
18-
/doc/config.status
1910
/examples/*.alex.hs
2011
/examples/*.happy.hs
2112
/examples/*.bin

CHANGELOG.md

Lines changed: 96 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,23 +111,112 @@
111111
* Unicode support (contributed mostly by Jean-Philippe Bernardy,
112112
with help from Alan Zimmerman).
113113

114-
* An Alex lexer now takes a UTF-8 encoded byte sequence as input
115-
(see Section 5.1, “Unicode and UTF-8”. If you are using the
114+
* An Alex lexer now takes a UTF-8 encoded byte sequence as input.
115+
If you are using the
116116
"basic" wrapper or one of the other wrappers that takes a
117117
Haskell String as input, the string is automatically encoded
118-
into UTF-8 by Alex. If your input is a ByteString, you are
119-
responsible for ensuring that the input is UTF-8 encoded. The
120-
old 8-bit behaviour is still available via the --latin1
121-
option.
118+
into UTF-8 by Alex. If your input is a `ByteString`, you are
119+
responsible for ensuring that the input is UTF-8 encoded.
122120

123121
* Alex source files are assumed to be in UTF-8, like Haskell
124122
source files. The lexer specification can use Unicode
125123
characters and ranges.
126124

127125
* `alexGetChar` is renamed to `alexGetByte` in the generated code.
128126

129-
* There is a new option, `--latin1`, that restores the old
127+
* There is a new option, `--latin1`, that restores the old 8-bit
130128
behaviour.
131129

132130
* Alex now does DFA minimization, which helps to reduce the size
133131
of the generated tables, especially for lexers that use Unicode.
132+
133+
## Release Notes for version 2.2
134+
135+
- `Cabal-1.2` is now required.
136+
137+
- `ByteString` wrappers: use Alex to lex ByteStrings directly.
138+
139+
## Release Notes for version 2.1.0
140+
141+
- Switch to a Cabal build system: you need a recent version of Cabal
142+
(1.1.6 or later). If you have GHC 6.4.2, then you need to upgrade
143+
Cabal before building Alex. GHC 6.6 is fine.
144+
145+
- Slight change in the error semantics: the input returned on error is
146+
before the erroneous character was read, not after. This helps to
147+
give better error messages.
148+
149+
## Release Notes for version 2.0
150+
151+
Alex has changed a *lot* between versions 1.x and 2.0. The following is
152+
supposed to be an exhaustive list of the changes:
153+
154+
### Syntax changes
155+
156+
- Code blocks are now surrounded by `{...}` rather than `%{...%}`.
157+
158+
- Character-set macros now begin with ‘`$`’ instead of ‘`^`’ and have
159+
multi-character names.
160+
161+
- Regular expression macros now begin with ‘`@`’ instead of ‘`%`’ and
162+
have multi-character names.
163+
164+
- Macro definitions are no longer surrounded by `{ ... }`.
165+
166+
- Rules are now of the form
167+
168+
<c1,c2,...> regex { code }
169+
170+
where `c1`, `c2` are startcodes, and `code` is an arbitrary Haskell
171+
expression.
172+
173+
- Regular expression syntax changes:
174+
175+
- `()` is the empty regular expression (used to be ‘`$`’)
176+
177+
- set complement can now be expressed as `[^sets]` (for similarity
178+
with lex regular expressions).
179+
180+
- The `'abc'` form is no longer available, use `[abc]` instead.
181+
182+
-`^`’ and ‘`$`’ have the usual meanings: ‘`^`’ matches just
183+
after a ‘`\n`’, and ‘`$`’ matches just before a ‘`\n`’.
184+
185+
-`\n`’ is now the escape character, not ‘`^`’.
186+
187+
- The form `"..."` means the same as the sequence of characters
188+
inside the quotes, the difference being that special characters
189+
do not need to be escaped inside `"..."`.
190+
191+
- Rules can have arbitrary predicates attached to them. This subsumes
192+
the previous left-context and right-context facilities (although
193+
these are still allowed as syntactic sugar).
194+
195+
### Changes in the form of an Alex file
196+
197+
- Each file can now only define a single grammar. This change was made
198+
to simplify code generation. Multiple grammars can be simulated
199+
using startcodes, or split into separate modules.
200+
201+
- The API has been simplified, and at the same time made more
202+
flexible.
203+
204+
- You no longer need to import the `Alex` module.
205+
206+
### Usage changes
207+
208+
The command-line syntax is quite different.
209+
210+
### Implementation changes
211+
212+
- A more efficient table representation, coupled with standard
213+
table-compression techniques, are used to keep the size of the
214+
generated code down.
215+
216+
- When compiling a grammar with GHC, the `-g` switch causes an even
217+
faster and smaller grammar to be generated.
218+
219+
- Startcodes are implemented in a different way: each state
220+
corresponds to a different initial state in the DFA, so the scanner
221+
doesn't have to check the startcode when it gets to an accept state.
222+
This results in a larger, but quicker, scanner.

alex.cabal

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,6 @@ data-files:
4545
extra-source-files:
4646
CHANGELOG.md
4747
README.md
48-
TODO
49-
doc/Makefile
50-
doc/aclocal.m4
51-
doc/alex.1.in
52-
doc/alex.xml
53-
doc/config.mk.in
54-
doc/configure.ac
55-
doc/docbook-xml.mk
56-
doc/fptools.css
5748
examples/Makefile
5849
examples/Tokens.x
5950
examples/Tokens_gscan.x

doc/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_build/

doc/Makefile

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,28 @@
1-
include config.mk
1+
# Minimal makefile for Sphinx documentation
2+
#
23

3-
XML_DOC = alex
4-
INSTALL_XML_DOC = alex
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _build
510

6-
include docbook-xml.mk
11+
# Flag -n ("nitpick") warns about broken references
12+
# Flag -W turns warnings into errors
13+
# Flag --keep-going continues after errors
14+
SPHINXOPTS := -n -W --keep-going -E
15+
16+
.PHONY: help html Makefile
17+
18+
# default goal, first
19+
html: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
21+
22+
help:
23+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
24+
25+
# Catch-all target: route all unknown targets to Sphinx using the new
26+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
27+
%: Makefile
28+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

doc/README.md

Lines changed: 0 additions & 25 deletions
This file was deleted.

doc/about.rst

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
2+
.. _about:
3+
4+
About Alex
5+
==========
6+
7+
Alex can always be obtained from its `home
8+
page <http://www.haskell.org/alex>`__. The latest source code lives in
9+
the `git repository <https://github.com/haskell/alex>`__ on ``GitHub``.
10+
11+
.. _bug-reports:
12+
13+
Reporting bugs in Alex
14+
----------------------
15+
16+
Please report bugs on the
17+
`Alex issue tracker <https://github.com/haskell/alex/issues>`__.
18+
There are no specific mailing lists for the discussion of Alex-related
19+
matters, but such topics should be fine on the `Haskell Cafe
20+
<http://www.haskell.org/mailman/listinfo/haskell-cafe>`__ mailing
21+
list.
22+
23+
License
24+
-------
25+
26+
Copyright (c) 1995-2011, Chris Dornan and Simon Marlow. All rights
27+
reserved.
28+
29+
Redistribution and use in source and binary forms, with or without
30+
modification, are permitted provided that the following conditions are
31+
met:
32+
33+
- Redistributions of source code must retain the above copyright
34+
notice, this list of conditions and the following disclaimer.
35+
36+
- Redistributions in binary form must reproduce the above copyright
37+
notice, this list of conditions and the following disclaimer in the
38+
documentation and/or other materials provided with the distribution.
39+
40+
- Neither the name of the copyright holders, nor the names of the
41+
contributors may be used to endorse or promote products derived from
42+
this software without specific prior written permission.
43+
44+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
45+
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
46+
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
47+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
48+
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
49+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
50+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
51+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
52+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
53+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
54+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
55+
56+
About this documentation
57+
------------------------
58+
59+
This documentation is based on a DocBook documentation originally written by
60+
Chris Dornan, Isaac Jones, and Simon Marlow.
61+
62+
Converted to RST / Sphinx / readthedocs.org by Andreas Abel in February 2022.

0 commit comments

Comments
 (0)