Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9682dcd2b2 | ||
|
|
745a042652 | ||
|
|
b1720e831c | ||
|
|
1022a1cb0f | ||
|
|
e485c5d572 | ||
|
|
957bc5359b | ||
|
|
c117b7d1c9 | ||
|
|
bda3544af9 | ||
|
|
dcc7411099 | ||
|
|
9baaabbf4a | ||
|
|
f1a46ca73a | ||
|
|
fccdffc979 | ||
|
|
ae610e4ecf | ||
|
|
86137ce914 | ||
|
|
c028cdd42b | ||
|
|
8a44906f5c | ||
|
|
3122b9a415 | ||
|
|
2ab394e9d5 | ||
|
|
e63ad223f5 | ||
|
|
3e3b91d75a | ||
|
|
7059b54eb9 | ||
|
|
c88a723fc4 | ||
|
|
44d56c2804 | ||
|
|
4685c639cd | ||
|
|
6a71463d6d | ||
|
|
79596e186d | ||
|
|
94d1ceb2e9 | ||
|
|
e4ba9a90b2 | ||
|
|
fce0e9cbd1 | ||
|
|
8fcbced4e4 | ||
|
|
92a98bcf1e | ||
|
|
a76b9f592c | ||
|
|
c30687f0f1 | ||
|
|
dd05aab240 | ||
|
|
5b0e960177 | ||
|
|
04e7048069 | ||
|
|
a92dad12d8 | ||
|
|
0011cab9f9 | ||
|
|
f1694c513f | ||
|
|
55802e3b40 | ||
|
|
18fc5091b9 | ||
|
|
febeb97793 | ||
|
|
04f1424210 | ||
|
|
1f8d826558 | ||
|
|
1dc02f7b70 | ||
|
|
37350f906c | ||
|
|
8c758c7649 | ||
|
|
d46322fb89 | ||
|
|
5811f5ad65 | ||
|
|
ee0b1f6daf | ||
|
|
82915e38ba | ||
|
|
67f50f6907 | ||
|
|
bc5c3022d1 | ||
|
|
827682202e | ||
|
|
6fcfa14e15 | ||
|
|
0b5185c03a | ||
|
|
07d6f5f7f5 | ||
|
|
ab2d4b2504 | ||
|
|
299bfc7fe0 | ||
|
|
2ad0561e4f | ||
|
|
59677b5eb4 | ||
|
|
82bfcce637 | ||
|
|
6eb9718a67 | ||
|
|
5513aff4c0 | ||
|
|
43c7512c31 | ||
|
|
28cca31af9 | ||
|
|
e98dbd359a | ||
|
|
eece38b1e6 | ||
|
|
7553c68cb4 | ||
|
|
69ffc41706 | ||
|
|
1a26160b69 | ||
|
|
0b7572c30d | ||
|
|
5393573711 | ||
|
|
b0d740994c | ||
|
|
e2ee1bfa9d | ||
|
|
600717ad6a | ||
|
|
af13e1d896 | ||
|
|
f760dccc55 | ||
|
|
9d76662c22 | ||
|
|
5ed46a79a1 | ||
|
|
dcf934fb33 | ||
|
|
55487d4ab8 | ||
|
|
59de285996 | ||
|
|
da7d8fe924 | ||
|
|
325db7adfd | ||
|
|
ccb1d45431 | ||
|
|
deaabdd4ca | ||
|
|
550451d8b4 | ||
|
|
34f6e5269f | ||
|
|
8a4e4ebd54 | ||
|
|
79831797ff | ||
|
|
0bfddb867b | ||
|
|
7563ecaec0 | ||
|
|
e74cef8655 | ||
|
|
26f01b60ee | ||
|
|
6662452bde | ||
|
|
ffdc69dc2e | ||
|
|
8bc53228ff | ||
|
|
2a64e74ff7 | ||
|
|
76e14817fb | ||
|
|
e89281382f | ||
|
|
83b1f8769a | ||
|
|
325c102712 | ||
|
|
f15465cd60 | ||
|
|
9cfdb736c6 | ||
|
|
9601d30173 | ||
|
|
ffefa3914d | ||
|
|
d528489324 | ||
|
|
862eee4570 | ||
|
|
3734d5bdd7 | ||
|
|
e461e348b1 |
@@ -33,18 +33,20 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
uses: actions/setup-python@v7
|
||||
with:
|
||||
python-version: '3.8'
|
||||
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v4
|
||||
uses: actions/setup-java@v6
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
java-version: '24'
|
||||
# One of the distributions that packages OpenJDK, see
|
||||
# https://github.com/marketplace/actions/setup-java-jdk#supported-distributions
|
||||
distribution: 'oracle-openjdk'
|
||||
java-version: '26'
|
||||
|
||||
- name: Setup Common Prerequisites
|
||||
run: |
|
||||
@@ -79,6 +81,7 @@ jobs:
|
||||
-DRE2C_BUILD_RE2OCAML=OFF \
|
||||
-DRE2C_BUILD_RE2PY=OFF \
|
||||
-DRE2C_BUILD_RE2RUST=OFF \
|
||||
-DRE2C_BUILD_RE2SWIFT=OFF \
|
||||
-DRE2C_BUILD_RE2V=OFF \
|
||||
-DRE2C_BUILD_RE2ZIG=OFF \
|
||||
-DRE2C_BUILD_BENCHMARKS=ON \
|
||||
|
||||
@@ -36,11 +36,11 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Setup apt cache (Linux)
|
||||
if: startsWith(runner.os, 'Linux')
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v6
|
||||
with:
|
||||
path: /var/cache/apt
|
||||
key: ${{ runner.os }}-apt-cache-${{ matrix.os }}-${{ github.sha }}
|
||||
@@ -69,7 +69,7 @@ jobs:
|
||||
esac
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
uses: actions/setup-python@v7
|
||||
with:
|
||||
python-version: 3.x
|
||||
architecture: x64
|
||||
@@ -85,8 +85,17 @@ jobs:
|
||||
- name: Fast Configure
|
||||
run: |
|
||||
./configure \
|
||||
--disable-dlang \
|
||||
--disable-golang \
|
||||
--disable-haskell \
|
||||
--disable-java \
|
||||
--disable-js \
|
||||
--disable-ocaml \
|
||||
--disable-python \
|
||||
--disable-rust \
|
||||
--disable-swift \
|
||||
--disable-vlang \
|
||||
--disable-zig \
|
||||
--prefix=$PWD/install
|
||||
|
||||
- name: Fast Build
|
||||
@@ -146,7 +155,7 @@ jobs:
|
||||
- name: Archive test artifacts
|
||||
# Run this step only if tests failed (otherwise there is nothing to upload).
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
# To ensure that jobs don't overwrite existing artifacts,
|
||||
# use a different name per job.
|
||||
|
||||
@@ -62,11 +62,11 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Setup chocolatey Cache (Windows)
|
||||
if: startsWith(runner.os, 'Windows')
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v6
|
||||
with:
|
||||
path: C:\Users\runneradmin\AppData\Local\Temp\chocolatey
|
||||
key: ${{ runner.os }}-chocolatey-${{ matrix.os }}-${{ github.sha }}
|
||||
@@ -76,7 +76,7 @@ jobs:
|
||||
|
||||
- name: Setup apt cache (Linux)
|
||||
if: startsWith(runner.os, 'Linux')
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v6
|
||||
with:
|
||||
path: /var/cache/apt
|
||||
key: ${{ runner.os }}-apt-cache-${{ matrix.os }}-${{ github.sha }}
|
||||
@@ -105,7 +105,7 @@ jobs:
|
||||
esac
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
uses: actions/setup-python@v7
|
||||
with:
|
||||
python-version: 3.x
|
||||
architecture: x64
|
||||
@@ -165,7 +165,7 @@ jobs:
|
||||
- name: Archive test artifacts
|
||||
# Run this step only if tests failed (otherwise there is nothing to upload).
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
# To ensure that jobs don't overwrite existing artifacts,
|
||||
# use a different name per job.
|
||||
|
||||
@@ -2,6 +2,79 @@ Changelog
|
||||
=========
|
||||
|
||||
|
||||
4.6 (2026-08-29)
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
- Added support for Zig labeled continue optimization.
|
||||
(`#580 <https://github.com/skvadrik/re2c/pull/580>`_).
|
||||
|
||||
- Updated C/C++ examples to use re2c features available in version 4.0 or higher.
|
||||
|
||||
|
||||
4.5.1 (2026-03-27)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
- Added missing include files to the distribution
|
||||
(`#573 <https://github.com/skvadrik/re2c/issues/573>`_).
|
||||
|
||||
- Updated the documentation to mention the new include files.
|
||||
|
||||
|
||||
4.5 (2026-03-23)
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
- Migrated include files to Unicode 17.0.0 standard.
|
||||
|
||||
- Added Unicode include files:
|
||||
|
||||
+ `include/unicode_blocks.re <https://github.com/skvadrik/re2c/blob/master/include/unicode_blocks.re>`_
|
||||
+ `include/unicode_properties.re <https://github.com/skvadrik/re2c/blob/master/include/unicode_properties.re>`_
|
||||
|
||||
- Implemented Unicode case mapping for case-insensitive string literals
|
||||
(`#235 <https://github.com/skvadrik/re2c/issues/235>`_).
|
||||
|
||||
- Fixed `#571 <https://github.com/skvadrik/re2c/issues/571>`_
|
||||
(segmentation fault on erroneous input during determinization).
|
||||
|
||||
- Updated paper `A closer look at TDFA <https://arxiv.org/abs/2206.01398>`_
|
||||
(applied corrections by Lisa Felidae).
|
||||
|
||||
|
||||
4.4 (2025-12-20)
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
- Added generalized end-of-input symbol ``$``
|
||||
(`#525 <https://github.com/skvadrik/re2c/issues/525>`_).
|
||||
This change may break old code with conflicitng end-of-input rules,
|
||||
as they now have position-based precedence. The broken cases were
|
||||
reported with ``-Wdeprecated-eof-rule`` since version 4.3.
|
||||
|
||||
|
||||
4.3.1 (2025-12-01)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
- Fixed bugs:
|
||||
|
||||
+ `#560 <https://github.com/skvadrik/re2c/issues/560>`_
|
||||
(allow conditions that have no rules except for default rule)
|
||||
|
||||
+ `#561 <https://github.com/skvadrik/re2c/issues/561>`_
|
||||
(use unsigned character type in C/C++ examples)
|
||||
|
||||
+ `#564 <https://github.com/skvadrik/re2c/issues/564>`_
|
||||
(fix broken end of input rule $ with captures)
|
||||
|
||||
|
||||
4.3 (2025-06-30)
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
- Added warning ``-Wdeprecated-eof-rule``, this will be turned to error in the
|
||||
future (`#525 <https://github.com/skvadrik/re2c/issues/525>`_).
|
||||
|
||||
- Improved re2c performance (made determinization faster,
|
||||
`#544 <https://github.com/skvadrik/re2c/discussions/544>`_).
|
||||
|
||||
|
||||
4.2 (2025-04-23)
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
+10
-2
@@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(re2c VERSION 4.2 HOMEPAGE_URL "https://re2c.org/")
|
||||
project(re2c VERSION 4.6 HOMEPAGE_URL "https://re2c.org/")
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
|
||||
@@ -73,7 +73,11 @@ endif()
|
||||
# Cygwin and NetBSD.
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON) # fail if the C++ compiler does not support this standard
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON) # make sure object libraries work with shared libraries
|
||||
|
||||
# make sure object libraries work with shared libraries
|
||||
include(CheckPIESupported)
|
||||
check_pie_supported()
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
# needed for POSIX file API
|
||||
ac_check_headers("sys/types.h")
|
||||
@@ -226,6 +230,7 @@ set(re2c_sources
|
||||
src/encoding/ebcdic.cc
|
||||
src/encoding/enc.cc
|
||||
src/encoding/range_suffix.cc
|
||||
src/encoding/unicode_casemap.cc
|
||||
src/encoding/utf8.cc
|
||||
src/encoding/utf16.cc
|
||||
src/msg/msg.cc
|
||||
@@ -466,7 +471,9 @@ if(RE2C_IS_ROOT_PROJECT)
|
||||
include/syntax/swift
|
||||
include/syntax/v
|
||||
include/syntax/zig
|
||||
include/unicode_blocks.re
|
||||
include/unicode_categories.re
|
||||
include/unicode_properties.re
|
||||
DESTINATION "${RE2C_STDLIB_DIR}")
|
||||
|
||||
# rebuild all re2c sources using newly built re2c
|
||||
@@ -594,6 +601,7 @@ if (RE2C_BUILD_LIBS)
|
||||
src/nfa/re_to_nfa.cc
|
||||
src/encoding/enc.cc
|
||||
src/encoding/range_suffix.cc
|
||||
src/encoding/unicode_casemap.cc
|
||||
src/encoding/ebcdic.cc
|
||||
src/encoding/utf16.cc
|
||||
src/encoding/utf8.cc
|
||||
|
||||
+7
-1
@@ -239,6 +239,7 @@
|
||||
"RE2C_BUILD_RE2OCAML": false,
|
||||
"RE2C_BUILD_RE2PY": false,
|
||||
"RE2C_BUILD_RE2RUST": false,
|
||||
"RE2C_BUILD_RE2SWIFT": false,
|
||||
"RE2C_BUILD_RE2V": false,
|
||||
"RE2C_BUILD_RE2ZIG": false
|
||||
}
|
||||
@@ -266,6 +267,7 @@
|
||||
"RE2C_BUILD_RE2OCAML": false,
|
||||
"RE2C_BUILD_RE2PY": false,
|
||||
"RE2C_BUILD_RE2RUST": false,
|
||||
"RE2C_BUILD_RE2SWIFT": false,
|
||||
"RE2C_BUILD_RE2V": false,
|
||||
"RE2C_BUILD_RE2ZIG": false
|
||||
}
|
||||
@@ -291,6 +293,7 @@
|
||||
"RE2C_BUILD_RE2OCAML": false,
|
||||
"RE2C_BUILD_RE2PY": false,
|
||||
"RE2C_BUILD_RE2RUST": false,
|
||||
"RE2C_BUILD_RE2SWIFT": false,
|
||||
"RE2C_BUILD_RE2V": false,
|
||||
"RE2C_BUILD_RE2ZIG": false
|
||||
}
|
||||
@@ -305,7 +308,7 @@
|
||||
{
|
||||
"name": "windows-config-base",
|
||||
"hidden": true,
|
||||
"generator": "Visual Studio 17 2022",
|
||||
"generator": "Visual Studio 18 2026",
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
@@ -336,6 +339,7 @@
|
||||
"RE2C_BUILD_RE2OCAML": false,
|
||||
"RE2C_BUILD_RE2PY": false,
|
||||
"RE2C_BUILD_RE2RUST": false,
|
||||
"RE2C_BUILD_RE2SWIFT": false,
|
||||
"RE2C_BUILD_RE2V": false,
|
||||
"RE2C_BUILD_RE2ZIG": false
|
||||
}
|
||||
@@ -361,6 +365,7 @@
|
||||
"RE2C_BUILD_RE2OCAML": false,
|
||||
"RE2C_BUILD_RE2PY": false,
|
||||
"RE2C_BUILD_RE2RUST": false,
|
||||
"RE2C_BUILD_RE2SWIFT": false,
|
||||
"RE2C_BUILD_RE2V": false,
|
||||
"RE2C_BUILD_RE2ZIG": false
|
||||
}
|
||||
@@ -386,6 +391,7 @@
|
||||
"RE2C_BUILD_RE2OCAML": false,
|
||||
"RE2C_BUILD_RE2PY": false,
|
||||
"RE2C_BUILD_RE2RUST": false,
|
||||
"RE2C_BUILD_RE2SWIFT": false,
|
||||
"RE2C_BUILD_RE2V": false,
|
||||
"RE2C_BUILD_RE2ZIG": false
|
||||
}
|
||||
|
||||
+4
-1
@@ -104,6 +104,7 @@ re2c_SRC = \
|
||||
src/encoding/ebcdic.cc \
|
||||
src/encoding/enc.cc \
|
||||
src/encoding/range_suffix.cc \
|
||||
src/encoding/unicode_casemap.cc \
|
||||
src/encoding/utf8.cc \
|
||||
src/encoding/utf16.cc \
|
||||
src/msg/msg.cc \
|
||||
@@ -628,7 +629,9 @@ dist_stdlib_DATA = \
|
||||
include/syntax/swift \
|
||||
include/syntax/v \
|
||||
include/syntax/zig \
|
||||
include/unicode_categories.re
|
||||
include/unicode_blocks.re \
|
||||
include/unicode_categories.re \
|
||||
include/unicode_properties.re
|
||||
|
||||
BAZELFILES := \
|
||||
BUILD.bazel \
|
||||
|
||||
@@ -99,6 +99,7 @@ libre2c_la_SRC = \
|
||||
src/nfa/re_to_nfa.cc \
|
||||
src/encoding/enc.cc \
|
||||
src/encoding/range_suffix.cc \
|
||||
src/encoding/unicode_casemap.cc \
|
||||
src/encoding/ebcdic.cc \
|
||||
src/encoding/utf16.cc \
|
||||
src/encoding/utf8.cc \
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ def _re2c_impl(ctx):
|
||||
tools = [ctx.executable._re2c_tool],
|
||||
inputs = ctx.files.srcs + ctx.files.data,
|
||||
command = """
|
||||
"{re2c}" "{src}" -o "{out}" {re2c_args} {includes}
|
||||
"{re2c}" --no-generation-date "{src}" -o "{out}" {re2c_args} {includes}
|
||||
""".format(
|
||||
re2c = ctx.executable._re2c_tool.path,
|
||||
src = srcs[0].path,
|
||||
|
||||
+100
-60
@@ -56,11 +56,10 @@ decimal number:
|
||||
// re2c $INPUT \-o $OUTPUT \-i \-\-case\-ranges
|
||||
#include <assert.h>
|
||||
|
||||
int lex(const char *s) {
|
||||
const char *YYCURSOR = s;
|
||||
int lex(const char* YYCURSOR) {
|
||||
/*!re2c
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:define:YYCTYPE = char;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
|
||||
[1\-9][0\-9]* { return 0; }
|
||||
* { return 1; }
|
||||
@@ -87,11 +86,10 @@ In the output re2c replaced the block in the middle with the generated code:
|
||||
// re2c $INPUT \-o $OUTPUT \-i \-\-case\-ranges
|
||||
#include <assert.h>
|
||||
|
||||
int lex(const char *s) {
|
||||
const char *YYCURSOR = s;
|
||||
int lex(const char* YYCURSOR) {
|
||||
|
||||
{
|
||||
char yych;
|
||||
unsigned char yych;
|
||||
yych = *YYCURSOR;
|
||||
switch (yych) {
|
||||
case \(aq1\(aq ... \(aq9\(aq: goto yy2;
|
||||
@@ -821,6 +819,9 @@ variable named \fBstag\fP\&.
|
||||
.B \fB#mtag\fP
|
||||
An \fIm\-tag\fP: saves all input positions at which \fB#mtag\fP matches in a
|
||||
variable named \fBmtag\fP\&.
|
||||
.TP
|
||||
.B \fB$\fP
|
||||
End of input.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Character classes and string literals may contain the following escape
|
||||
@@ -931,6 +932,7 @@ This API contains primitives for generic operations:
|
||||
\fBYYSHIFTSTAG\fP,
|
||||
\fBYYSHIFTMTAG\fP,
|
||||
\fBYYLESSTHAN\fP\&.
|
||||
\fBYYEND\fP\&.
|
||||
Generic API supports two styles that determine the form in which the
|
||||
primitives should be defined:
|
||||
.nf
|
||||
@@ -962,6 +964,7 @@ API can be defined in terms of pointers \fBcursor\fP, \fBlimit\fP,
|
||||
re2c:YYRESTORECTX = \(dqcursor = ctxmarker;\(dq;
|
||||
re2c:YYRESTORETAG = \(dqcursor = ${tag};\(dq;
|
||||
re2c:YYLESSTHAN = \(dqlimit \- cursor < @@{len}\(dq;
|
||||
re2c:YYEND = \(dqlimit == cursor\(dq;
|
||||
re2c:YYSTAGP = \(dq@@{tag} = cursor;\(dq;
|
||||
re2c:YYSTAGN = \(dq@@{tag} = NULL;\(dq;
|
||||
re2c:YYSHIFT = \(dqcursor += @@{shift};\(dq;
|
||||
@@ -996,6 +999,7 @@ generic API can be defined in terms of pointers \fBcursor\fP, \fBlimit\fP,
|
||||
#define YYRESTORECTX() cursor = ctxmarker
|
||||
#define YYRESTORETAG(tag) cursor = tag
|
||||
#define YYLESSTHAN(len) limit \- cursor < len
|
||||
#define YYEND() limit == cursor
|
||||
#define YYSTAGP(tag) tag = cursor
|
||||
#define YYSTAGN(tag) tag = NULL
|
||||
#define YYSHIFT(shift) cursor += shift
|
||||
@@ -1073,6 +1077,14 @@ A generic API primitive with one variable \fBlen\fP\&.
|
||||
It should be defined as an r\-value of boolean type that equals \fBtrue\fP if
|
||||
and only if there are less than \fBlen\fP input characters left.
|
||||
.TP
|
||||
.B \fBYYEND\fP
|
||||
A generic API primitive with no variables.
|
||||
It should be defined as an r\-value of boolean type that equals \fBtrue\fP if
|
||||
and only if the \fIlogical\fP end of input has been reached (excluding any
|
||||
padding or sentinel symbols). \fBYYEND\fP is used to implement \fB$\fP symbol in
|
||||
regular expressions. It differs from \fBYYLESSTHAN\fP, which is used to ensure
|
||||
that the lexer won\(aqt read past the end of buffer.
|
||||
.TP
|
||||
.B \fBYYPEEK\fP
|
||||
A generic API primitive with no variables.
|
||||
It should be defined as an r\-value of type \fBYYCTYPE\fP that is equal to the
|
||||
@@ -1256,7 +1268,7 @@ Show help message.
|
||||
.TP
|
||||
.B \fB\-\-api <simple | record | generic>\fP
|
||||
Specify the API used by the generated code to interface with used\-defined
|
||||
code. Option \fBsimple\fP shold be used in simple cases when there\(aqs no need
|
||||
code. Option \fBsimple\fP should be used in simple cases when there\(aqs no need
|
||||
for buffer refilling and storing lexer state. Option \fBrecord\fP should be
|
||||
used when lexer state needs to be stored in a record (struct, class, etc.).
|
||||
Option \fBgeneric\fP should be used in complex cases when the other two APIs
|
||||
@@ -1393,6 +1405,12 @@ variable \fByystate\fP\&. Transitions between states update \fByystate\fP to the
|
||||
case label of the destination state and continue execution to the head of
|
||||
the loop.
|
||||
.TP
|
||||
.B \fB\-\-computed\-continue\fP
|
||||
This option requires the \fB\-\-loop\-switch\fP code model. It uses computed
|
||||
\fBcontinue\fP statements to select the next switch case directly, enabling
|
||||
jump\-table optimization similar to \fB\-\-computed\-gotos\fP in the goto/label
|
||||
code model.
|
||||
.TP
|
||||
.B \fB\-\-nested\-ifs \-s\fP
|
||||
Use nested \fBif\fP statements instead of \fBswitch\fP statements in conditional
|
||||
jumps. This usually results in more efficient code with non\-optimizing
|
||||
@@ -1656,6 +1674,13 @@ priority, matches any code unit, and always consumes a single code unit.
|
||||
.B \fB\-Wunreachable\-rules\fP
|
||||
Warn about rules that are shadowed by other rules and will never match.
|
||||
.TP
|
||||
.B \fB\-Wdeprecated\-eof_rule\fP
|
||||
Warn about standalone end of input rules \fB$\fP that will be broken by the
|
||||
future changes and require fixing. At the moment these rules take precedence
|
||||
when conflicting with other rules, but after the introduction of generalized
|
||||
end of input symbol \fB$\fP precedence order will change and these rules will
|
||||
become shadowed by other rules.
|
||||
.TP
|
||||
.B \fB\-Wuseless\-escape\fP
|
||||
Warn if a symbol is escaped when it shouldn\(aqt be.
|
||||
By default, re2c silently ignores such escapes, but this may as well
|
||||
@@ -1723,7 +1748,7 @@ A list of supported codegen targets with possible elements \fBcode\fP,
|
||||
.B \fBsupported_features\fP
|
||||
A list of supported features with possible elements \fBnested\-ifs\fP,
|
||||
\fBbitmaps\fP, \fBcomputed\-gotos\fP, \fBcase\-ranges\fP, \fBmonadic\fP, \fBunsafe\fP,
|
||||
\fBtags\fP, \fBcaptures\fP, \fBcaptvars\fP\&.
|
||||
\fBtags\fP, \fBcaptures\fP, \fBcaptvars\fP, \fBcomputed\-continue\fP\&.
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
@@ -1987,12 +2012,15 @@ Default switch case.
|
||||
.TP
|
||||
.B \fBcode:loop\fP
|
||||
A loop that runs forever (unless interrupted from the loop body).
|
||||
Supported variables: \fBlabel\fP (loop label), \fBstmt\fP (a list variable
|
||||
that expands to all statements in the loop body).
|
||||
Supported variables: \fBlabel\fP (loop label), \fBval\fP (initial state),
|
||||
\fBvar\fP (state variable), \fBstate\fP (a list variable that expands to all
|
||||
state names) and \fBstmt\fP (a list variable that expands to all statements
|
||||
in the loop body or the current state).
|
||||
.TP
|
||||
.B \fBcode:continue\fP
|
||||
Continue statement. Supported variables: \fBlabel\fP (label from which to
|
||||
continue execution).
|
||||
continue execution), \fBval\fP (value passed to a labeled switch) and \fBvar\fP
|
||||
(state variable).
|
||||
.TP
|
||||
.B \fBcode:goto\fP
|
||||
Goto statement. Supported variables: \fBlabel\fP (label of the jump
|
||||
@@ -2230,6 +2258,10 @@ Supported variables: \fBYYLESSTHAN\fP, \fBYYCURSOR\fP, \fBYYLIMIT\fP,
|
||||
\fBneed\fP (the number of code units to check against). Conditional:
|
||||
\fB\&.many\fP (true if the \fBneed\fP is more than one).
|
||||
.TP
|
||||
.B \fBcode:yyend\fP
|
||||
\fBYYEND\fP expression, possibly specialized for different APIs.
|
||||
Supported variables: \fBYYEND\fP, \fBYYCURSOR\fP, \fBYYLIMIT\fP\&.
|
||||
.TP
|
||||
.B \fBcode:yybm_filter\fP
|
||||
Condition that is used to filter out \fByych\fP values that are not
|
||||
covered by the \fByybm\fP table (used with \fB\-\-bitmaps\fP option).
|
||||
@@ -2296,6 +2328,10 @@ True if case ranges feature is enabled (\fB\-\-case\-ranges\fP or
|
||||
True if the relative form of computed \fBgoto\fP is used
|
||||
(\fB\-\-computed\-gotos\-relative\fP or \fBre2c:cgoto:relative = 1\fP).
|
||||
.TP
|
||||
.B \fB\&.computed_continue\fP
|
||||
True if loop/switch model uses labeled\-switch transitions
|
||||
(\fB\-\-computed\-continue\fP).
|
||||
.TP
|
||||
.B \fB\&.code_model.goto_label\fP
|
||||
True if code model based on goto/label is used (\fB\-\-goto\-label\fP).
|
||||
.TP
|
||||
@@ -2331,6 +2367,9 @@ languages that have \(dqunsafe\(dq feature.
|
||||
.B \fB\&.version\fP
|
||||
True if the generated fingerprint should contain re2c version.
|
||||
.TP
|
||||
.B \fB\&.yyfill.enable\fP
|
||||
True if \fBYYFILL\fP is enabled (\fBre2c:yyfill:enable = 1\fP).
|
||||
.TP
|
||||
.B \fB\&.yyfn.throw\fP
|
||||
True if \fBre2c:yyfn:throw\fP configuration is defined to a nonempty string.
|
||||
.UNINDENT
|
||||
@@ -2453,7 +2492,7 @@ static int lex(const char *YYCURSOR) {
|
||||
|
||||
for (;;) {
|
||||
/*!re2c
|
||||
re2c:define:YYCTYPE = char;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:yyfill:enable = 0;
|
||||
|
||||
* { return \-1; }
|
||||
@@ -2509,7 +2548,7 @@ static int lex(const char *str, unsigned int len) {
|
||||
|
||||
for (;;) {
|
||||
/*!re2c
|
||||
re2c:define:YYCTYPE = char;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:eof = 0;
|
||||
|
||||
@@ -2581,8 +2620,8 @@ static int lex(const char *str, unsigned int len) {
|
||||
loop:
|
||||
/*!re2c
|
||||
re2c:api:style = free\-form;
|
||||
re2c:define:YYCTYPE = char;
|
||||
re2c:define:YYFILL = \(dqgoto fail;\(dq;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:YYFILL = \(dqgoto fail;\(dq;
|
||||
|
||||
str = [\(aq] ([^\(aq\e\e] | [\e\e][^])* [\(aq];
|
||||
|
||||
@@ -2647,11 +2686,11 @@ static int lex(const char *str, unsigned int len) {
|
||||
for (;;) {
|
||||
/*!re2c
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:api = custom;
|
||||
re2c:api = generic;
|
||||
re2c:api:style = free\-form;
|
||||
re2c:define:YYCTYPE = char;
|
||||
re2c:define:YYPEEK = \(dqcur < lim ? *cur : 0\(dq; // fake null
|
||||
re2c:define:YYSKIP = \(dq++cur;\(dq;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:YYPEEK = \(dqcur < lim ? *cur : 0\(dq; // fake null
|
||||
re2c:YYSKIP = \(dq++cur;\(dq;
|
||||
|
||||
* { count = \-1; break; }
|
||||
[\ex00] { break;; }
|
||||
@@ -2806,11 +2845,11 @@ loop:
|
||||
in\->tok = in\->cur;
|
||||
/*!re2c
|
||||
re2c:api:style = free\-form;
|
||||
re2c:define:YYCTYPE = char;
|
||||
re2c:define:YYCURSOR = in\->cur;
|
||||
re2c:define:YYMARKER = in\->mar;
|
||||
re2c:define:YYLIMIT = in\->lim;
|
||||
re2c:define:YYFILL = \(dqfill(in) == 0\(dq;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:YYCURSOR = in\->cur;
|
||||
re2c:YYMARKER = in\->mar;
|
||||
re2c:YYLIMIT = in\->lim;
|
||||
re2c:YYFILL = \(dqfill(in) == 0\(dq;
|
||||
re2c:eof = 0;
|
||||
|
||||
str = [\(aq] ([^\(aq\e\e] | [\e\e][^])* [\(aq];
|
||||
@@ -2953,10 +2992,10 @@ loop:
|
||||
in\->tok = in\->cur;
|
||||
/*!re2c
|
||||
re2c:api:style = free\-form;
|
||||
re2c:define:YYCTYPE = char;
|
||||
re2c:define:YYCURSOR = in\->cur;
|
||||
re2c:define:YYLIMIT = in\->lim;
|
||||
re2c:define:YYFILL = \(dqif (fill(in, @@) != 0) return \-1;\(dq;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:YYCURSOR = in\->cur;
|
||||
re2c:YYLIMIT = in\->lim;
|
||||
re2c:YYFILL = \(dqif (fill(in, @@) != 0) return \-1;\(dq;
|
||||
|
||||
str = [\(aq] ([^\(aq\e\e] | [\e\e][^])* [\(aq];
|
||||
|
||||
@@ -3044,7 +3083,7 @@ static uint64_t parse_u32(const char *s) {
|
||||
|
||||
/*!re2c
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:define:YYCTYPE = char;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
|
||||
end = \(dq\ex00\(dq;
|
||||
|
||||
@@ -3206,9 +3245,9 @@ static uint64_t parse_u32(const char *s) {
|
||||
|
||||
/*!re2c
|
||||
re2c:api:style = free\-form;
|
||||
re2c:define:YYCTYPE = char;
|
||||
re2c:define:YYGETCONDITION = \(dqc\(dq;
|
||||
re2c:define:YYSETCONDITION = \(dqc = @@;\(dq;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:YYGETCOND = \(dqc\(dq;
|
||||
re2c:YYSETCOND = \(dqc = @@;\(dq;
|
||||
re2c:yyfill:enable = 0;
|
||||
|
||||
<*> * { return ERROR; }
|
||||
@@ -3346,13 +3385,13 @@ static Status lex(State *st, unsigned int *recv) {
|
||||
st\->tok = st\->cur;
|
||||
/*!re2c
|
||||
re2c:api:style = free\-form;
|
||||
re2c:define:YYCTYPE = \(dqchar\(dq;
|
||||
re2c:define:YYCURSOR = \(dqst\->cur\(dq;
|
||||
re2c:define:YYMARKER = \(dqst\->mar\(dq;
|
||||
re2c:define:YYLIMIT = \(dqst\->lim\(dq;
|
||||
re2c:define:YYGETSTATE = \(dqst\->state\(dq;
|
||||
re2c:define:YYSETSTATE = \(dqst\->state = @@;\(dq;
|
||||
re2c:define:YYFILL = \(dqreturn WAITING;\(dq;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:YYCURSOR = \(dqst\->cur\(dq;
|
||||
re2c:YYMARKER = \(dqst\->mar\(dq;
|
||||
re2c:YYLIMIT = \(dqst\->lim\(dq;
|
||||
re2c:YYGETSTATE = \(dqst\->state\(dq;
|
||||
re2c:YYSETSTATE = \(dqst\->state = @@;\(dq;
|
||||
re2c:YYFILL = \(dqreturn WAITING;\(dq;
|
||||
re2c:eof = 0;
|
||||
|
||||
packet = [a\-z]+[;];
|
||||
@@ -3501,7 +3540,7 @@ static What lex(const char *s) {
|
||||
const char *YYCURSOR = s, *YYMARKER;
|
||||
/*!re2c
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:define:YYCTYPE = char;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
|
||||
!use:fish;
|
||||
!use:colors;
|
||||
@@ -3542,7 +3581,7 @@ int main() {
|
||||
static int lex_utf8(const uint8_t *s) {
|
||||
const uint8_t *YYCURSOR = s, *YYMARKER;
|
||||
/*!use:re2c
|
||||
re2c:define:YYCTYPE = uint8_t;
|
||||
re2c:YYCTYPE = uint8_t;
|
||||
re2c:encoding:utf8 = 1;
|
||||
*/
|
||||
}
|
||||
@@ -3550,7 +3589,7 @@ static int lex_utf8(const uint8_t *s) {
|
||||
static int lex_utf32(const uint32_t *s) {
|
||||
const uint32_t *YYCURSOR = s, *YYMARKER;
|
||||
/*!use:re2c
|
||||
re2c:define:YYCTYPE = uint32_t;
|
||||
re2c:YYCTYPE = uint32_t;
|
||||
re2c:encoding:utf32 = 1;
|
||||
*/
|
||||
}
|
||||
@@ -3695,7 +3734,7 @@ static int lex(const char *str, SemVer *ver) {
|
||||
|
||||
/*!re2c
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:define:YYCTYPE = char;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:tags = 1;
|
||||
|
||||
num = [0\-9]+;
|
||||
@@ -3802,11 +3841,11 @@ static bool lex(Input &in, std::vector<SemVer> &vers) {
|
||||
/*!re2c
|
||||
re2c:eof = 0;
|
||||
re2c:api:style = free\-form;
|
||||
re2c:define:YYCTYPE = char;
|
||||
re2c:define:YYCURSOR = in.cur;
|
||||
re2c:define:YYMARKER = in.mar;
|
||||
re2c:define:YYLIMIT = in.lim;
|
||||
re2c:define:YYFILL = \(dqfill(in) == 0\(dq;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:YYCURSOR = in.cur;
|
||||
re2c:YYMARKER = in.mar;
|
||||
re2c:YYLIMIT = in.lim;
|
||||
re2c:YYFILL = \(dqfill(in) == 0\(dq;
|
||||
re2c:tags:expression = \(dqin.@@\(dq;
|
||||
|
||||
num = [0\-9]+;
|
||||
@@ -3889,7 +3928,7 @@ static int lex(const char *str, SemVer *ver) {
|
||||
|
||||
/*!re2c
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:define:YYCTYPE = char;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:captvars = 1;
|
||||
|
||||
num = [0\-9]+;
|
||||
@@ -3992,11 +4031,11 @@ static bool parse(const char *str, Ver &ver) {
|
||||
|
||||
/*!re2c
|
||||
re2c:api:style = free\-form;
|
||||
re2c:define:YYCTYPE = char;
|
||||
re2c:define:YYSTAGP = \(dq@@ = YYCURSOR;\(dq;
|
||||
re2c:define:YYSTAGN = \(dq@@ = NULL;\(dq;
|
||||
re2c:define:YYMTAGP = \(dqadd_mtag(mt, @@, YYCURSOR);\(dq;
|
||||
re2c:define:YYMTAGN = \(dqadd_mtag(mt, @@, NULL);\(dq;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:YYSTAGP = \(dq@@ = YYCURSOR;\(dq;
|
||||
re2c:YYSTAGN = \(dq@@ = NULL;\(dq;
|
||||
re2c:YYMTAGP = \(dqadd_mtag(mt, @@, YYCURSOR);\(dq;
|
||||
re2c:YYMTAGN = \(dqadd_mtag(mt, @@, NULL);\(dq;
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:tags = 1;
|
||||
|
||||
@@ -4068,8 +4107,9 @@ fixed\-length Unicode encoding with code space \fB[0\-0x10FFFF]\fP and 4\-byte c
|
||||
points and code units.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Include file \fBinclude/unicode_categories.re\fP provides re2c definitions for the
|
||||
standard Unicode categories.
|
||||
Include files \fBinclude/unicode_blocks.re\fP, \fBinclude/unicode_categories.re\fP
|
||||
and \fBinclude/unicode_properties.re\fP provide re2c definitions for blocks,
|
||||
categories and properties described in the Unicode standard.
|
||||
.sp
|
||||
Option \fB\-\-input\-encoding\fP specifies source file encoding, which can be used to
|
||||
enable Unicode literals in regular expressions. For example
|
||||
@@ -4093,7 +4133,7 @@ Below is an example of a lexer for UTF8 encoded Unicode identifiers.
|
||||
static int lex(const char *s) {
|
||||
const char *YYCURSOR = s, *YYMARKER;
|
||||
/*!re2c
|
||||
re2c:define:YYCTYPE = \(aqunsigned char\(aq;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:yyfill:enable = 0;
|
||||
|
||||
// Simplified \(dqUnicode Identifier and Pattern Syntax\(dq
|
||||
@@ -4177,7 +4217,7 @@ float { return OK; }
|
||||
Result lex(const char *s) {
|
||||
const char *YYCURSOR = s, *YYMARKER;
|
||||
/*!re2c
|
||||
re2c:define:YYCTYPE = char;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:yyfill:enable = 0;
|
||||
|
||||
* { return FAIL; }
|
||||
@@ -4235,8 +4275,8 @@ long lex(LexerState* st) {
|
||||
/*!re2c
|
||||
re2c:header = \(dqlexer/state.h\(dq;
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:define:YYCTYPE = char;
|
||||
re2c:define:YYCURSOR = \(dqst\->cur\(dq;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:YYCURSOR = \(dqst\->cur\(dq;
|
||||
re2c:tags = 1;
|
||||
re2c:tags:expression = \(dqst\->@@\(dq;
|
||||
|
||||
|
||||
+48
-8
@@ -815,6 +815,9 @@ variable named \fBstag\fP\&.
|
||||
.B \fB#mtag\fP
|
||||
An \fIm\-tag\fP: saves all input positions at which \fB#mtag\fP matches in a
|
||||
variable named \fBmtag\fP\&.
|
||||
.TP
|
||||
.B \fB$\fP
|
||||
End of input.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Character classes and string literals may contain the following escape
|
||||
@@ -922,7 +925,8 @@ It contains primitives for generic operations:
|
||||
\fBYYSHIFT\fP,
|
||||
\fBYYSHIFTSTAG\fP,
|
||||
\fBYYSHIFTMTAG\fP,
|
||||
\fBYYLESSTHAN\fP\&.
|
||||
\fBYYLESSTHAN\fP,
|
||||
\fBYYEND\fP\&.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Here is a full list of API primitives that may be used by the generated code in
|
||||
@@ -991,6 +995,14 @@ A generic API primitive with one variable \fBlen\fP\&.
|
||||
It should be defined as an r\-value of boolean type that equals \fBtrue\fP if
|
||||
and only if there are less than \fBlen\fP input characters left.
|
||||
.TP
|
||||
.B \fBYYEND\fP
|
||||
A generic API primitive with no variables.
|
||||
It should be defined as an r\-value of boolean type that equals \fBtrue\fP if
|
||||
and only if the \fIlogical\fP end of input has been reached (excluding any
|
||||
padding or sentinel symbols). \fBYYEND\fP is used to implement \fB$\fP symbol in
|
||||
regular expressions. It differs from \fBYYLESSTHAN\fP, which is used to ensure
|
||||
that the lexer won\(aqt read past the end of buffer.
|
||||
.TP
|
||||
.B \fBYYPEEK\fP
|
||||
A generic API primitive with no variables.
|
||||
It should be defined as an r\-value of type \fBYYCTYPE\fP that is equal to the
|
||||
@@ -1174,7 +1186,7 @@ Show help message.
|
||||
.TP
|
||||
.B \fB\-\-api <simple | record | generic>\fP
|
||||
Specify the API used by the generated code to interface with used\-defined
|
||||
code. Option \fBsimple\fP shold be used in simple cases when there\(aqs no need
|
||||
code. Option \fBsimple\fP should be used in simple cases when there\(aqs no need
|
||||
for buffer refilling and storing lexer state. Option \fBrecord\fP should be
|
||||
used when lexer state needs to be stored in a record (struct, class, etc.).
|
||||
Option \fBgeneric\fP should be used in complex cases when the other two APIs
|
||||
@@ -1311,6 +1323,12 @@ variable \fByystate\fP\&. Transitions between states update \fByystate\fP to the
|
||||
case label of the destination state and continue execution to the head of
|
||||
the loop.
|
||||
.TP
|
||||
.B \fB\-\-computed\-continue\fP
|
||||
This option requires the \fB\-\-loop\-switch\fP code model. It uses computed
|
||||
\fBcontinue\fP statements to select the next switch case directly, enabling
|
||||
jump\-table optimization similar to \fB\-\-computed\-gotos\fP in the goto/label
|
||||
code model.
|
||||
.TP
|
||||
.B \fB\-\-nested\-ifs \-s\fP
|
||||
Use nested \fBif\fP statements instead of \fBswitch\fP statements in conditional
|
||||
jumps. This usually results in more efficient code with non\-optimizing
|
||||
@@ -1574,6 +1592,13 @@ priority, matches any code unit, and always consumes a single code unit.
|
||||
.B \fB\-Wunreachable\-rules\fP
|
||||
Warn about rules that are shadowed by other rules and will never match.
|
||||
.TP
|
||||
.B \fB\-Wdeprecated\-eof_rule\fP
|
||||
Warn about standalone end of input rules \fB$\fP that will be broken by the
|
||||
future changes and require fixing. At the moment these rules take precedence
|
||||
when conflicting with other rules, but after the introduction of generalized
|
||||
end of input symbol \fB$\fP precedence order will change and these rules will
|
||||
become shadowed by other rules.
|
||||
.TP
|
||||
.B \fB\-Wuseless\-escape\fP
|
||||
Warn if a symbol is escaped when it shouldn\(aqt be.
|
||||
By default, re2d silently ignores such escapes, but this may as well
|
||||
@@ -1641,7 +1666,7 @@ A list of supported codegen targets with possible elements \fBcode\fP,
|
||||
.B \fBsupported_features\fP
|
||||
A list of supported features with possible elements \fBnested\-ifs\fP,
|
||||
\fBbitmaps\fP, \fBcomputed\-gotos\fP, \fBcase\-ranges\fP, \fBmonadic\fP, \fBunsafe\fP,
|
||||
\fBtags\fP, \fBcaptures\fP, \fBcaptvars\fP\&.
|
||||
\fBtags\fP, \fBcaptures\fP, \fBcaptvars\fP, \fBcomputed\-continue\fP\&.
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
@@ -1905,12 +1930,15 @@ Default switch case.
|
||||
.TP
|
||||
.B \fBcode:loop\fP
|
||||
A loop that runs forever (unless interrupted from the loop body).
|
||||
Supported variables: \fBlabel\fP (loop label), \fBstmt\fP (a list variable
|
||||
that expands to all statements in the loop body).
|
||||
Supported variables: \fBlabel\fP (loop label), \fBval\fP (initial state),
|
||||
\fBvar\fP (state variable), \fBstate\fP (a list variable that expands to all
|
||||
state names) and \fBstmt\fP (a list variable that expands to all statements
|
||||
in the loop body or the current state).
|
||||
.TP
|
||||
.B \fBcode:continue\fP
|
||||
Continue statement. Supported variables: \fBlabel\fP (label from which to
|
||||
continue execution).
|
||||
continue execution), \fBval\fP (value passed to a labeled switch) and \fBvar\fP
|
||||
(state variable).
|
||||
.TP
|
||||
.B \fBcode:goto\fP
|
||||
Goto statement. Supported variables: \fBlabel\fP (label of the jump
|
||||
@@ -2148,6 +2176,10 @@ Supported variables: \fBYYLESSTHAN\fP, \fBYYCURSOR\fP, \fBYYLIMIT\fP,
|
||||
\fBneed\fP (the number of code units to check against). Conditional:
|
||||
\fB\&.many\fP (true if the \fBneed\fP is more than one).
|
||||
.TP
|
||||
.B \fBcode:yyend\fP
|
||||
\fBYYEND\fP expression, possibly specialized for different APIs.
|
||||
Supported variables: \fBYYEND\fP, \fBYYCURSOR\fP, \fBYYLIMIT\fP\&.
|
||||
.TP
|
||||
.B \fBcode:yybm_filter\fP
|
||||
Condition that is used to filter out \fByych\fP values that are not
|
||||
covered by the \fByybm\fP table (used with \fB\-\-bitmaps\fP option).
|
||||
@@ -2214,6 +2246,10 @@ True if case ranges feature is enabled (\fB\-\-case\-ranges\fP or
|
||||
True if the relative form of computed \fBgoto\fP is used
|
||||
(\fB\-\-computed\-gotos\-relative\fP or \fBre2c:cgoto:relative = 1\fP).
|
||||
.TP
|
||||
.B \fB\&.computed_continue\fP
|
||||
True if loop/switch model uses labeled\-switch transitions
|
||||
(\fB\-\-computed\-continue\fP).
|
||||
.TP
|
||||
.B \fB\&.code_model.goto_label\fP
|
||||
True if code model based on goto/label is used (\fB\-\-goto\-label\fP).
|
||||
.TP
|
||||
@@ -2249,6 +2285,9 @@ languages that have \(dqunsafe\(dq feature.
|
||||
.B \fB\&.version\fP
|
||||
True if the generated fingerprint should contain re2d version.
|
||||
.TP
|
||||
.B \fB\&.yyfill.enable\fP
|
||||
True if \fBYYFILL\fP is enabled (\fBre2c:yyfill:enable = 1\fP).
|
||||
.TP
|
||||
.B \fB\&.yyfn.throw\fP
|
||||
True if \fBre2c:yyfn:throw\fP configuration is defined to a nonempty string.
|
||||
.UNINDENT
|
||||
@@ -3958,8 +3997,9 @@ fixed\-length Unicode encoding with code space \fB[0\-0x10FFFF]\fP and 4\-byte c
|
||||
points and code units.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Include file \fBinclude/unicode_categories.re\fP provides re2d definitions for the
|
||||
standard Unicode categories.
|
||||
Include files \fBinclude/unicode_blocks.re\fP, \fBinclude/unicode_categories.re\fP
|
||||
and \fBinclude/unicode_properties.re\fP provide re2d definitions for blocks,
|
||||
categories and properties described in the Unicode standard.
|
||||
.sp
|
||||
Option \fB\-\-input\-encoding\fP specifies source file encoding, which can be used to
|
||||
enable Unicode literals in regular expressions. For example
|
||||
|
||||
+50
-8
@@ -822,6 +822,9 @@ variable named \fBstag\fP\&.
|
||||
.B \fB#mtag\fP
|
||||
An \fIm\-tag\fP: saves all input positions at which \fB#mtag\fP matches in a
|
||||
variable named \fBmtag\fP\&.
|
||||
.TP
|
||||
.B \fB$\fP
|
||||
End of input.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Character classes and string literals may contain the following escape
|
||||
@@ -932,7 +935,8 @@ It contains primitives for generic operations:
|
||||
\fBYYSHIFT\fP,
|
||||
\fBYYSHIFTSTAG\fP,
|
||||
\fBYYSHIFTMTAG\fP,
|
||||
\fBYYLESSTHAN\fP\&.
|
||||
\fBYYLESSTHAN\fP,
|
||||
\fBYYEND\fP\&.
|
||||
Generic API supports two styles that determine the form in which the
|
||||
primitives should be defined:
|
||||
.nf
|
||||
@@ -964,6 +968,7 @@ API can be defined in terms of integer variables \fBcursor\fP, \fBlimit\fP,
|
||||
re2c:YYRESTORECTX = \(dqcursor = ctxmarker\(dq;
|
||||
re2c:YYRESTORETAG = \(dqcursor = ${tag}\(dq;
|
||||
re2c:YYLESSTHAN = \(dqlimit \- cursor < @@{len}\(dq;
|
||||
re2c:YYEND = \(dqlimit == cursor\(dq;
|
||||
re2c:YYSTAGP = \(dq@@{tag} = cursor\(dq;
|
||||
re2c:YYSTAGN = \(dq@@{tag} = \-1\(dq;
|
||||
re2c:YYSHIFT = \(dqcursor += @@{shift}\(dq;
|
||||
@@ -997,6 +1002,7 @@ YYRESTORE := func() { cursor = marker }
|
||||
YYBACKUPCTX := func() { ctxmarker = cursor }
|
||||
YYRESTORECTX := func() { cursor = ctxmarker }
|
||||
YYLESSTHAN := func(n int) bool { return limit\-cursor < n }
|
||||
YYEND := func(n int) bool { return limit == cursor }
|
||||
YYSHIFT := func(n int) { cursor += n }
|
||||
.ft P
|
||||
.fi
|
||||
@@ -1071,6 +1077,14 @@ A generic API primitive with one variable \fBlen\fP\&.
|
||||
It should be defined as an r\-value of boolean type that equals \fBtrue\fP if
|
||||
and only if there are less than \fBlen\fP input characters left.
|
||||
.TP
|
||||
.B \fBYYEND\fP
|
||||
A generic API primitive with no variables.
|
||||
It should be defined as an r\-value of boolean type that equals \fBtrue\fP if
|
||||
and only if the \fIlogical\fP end of input has been reached (excluding any
|
||||
padding or sentinel symbols). \fBYYEND\fP is used to implement \fB$\fP symbol in
|
||||
regular expressions. It differs from \fBYYLESSTHAN\fP, which is used to ensure
|
||||
that the lexer won\(aqt read past the end of buffer.
|
||||
.TP
|
||||
.B \fBYYPEEK\fP
|
||||
A generic API primitive with no variables.
|
||||
It should be defined as an r\-value of type \fBYYCTYPE\fP that is equal to the
|
||||
@@ -1254,7 +1268,7 @@ Show help message.
|
||||
.TP
|
||||
.B \fB\-\-api <simple | record | generic>\fP
|
||||
Specify the API used by the generated code to interface with used\-defined
|
||||
code. Option \fBsimple\fP shold be used in simple cases when there\(aqs no need
|
||||
code. Option \fBsimple\fP should be used in simple cases when there\(aqs no need
|
||||
for buffer refilling and storing lexer state. Option \fBrecord\fP should be
|
||||
used when lexer state needs to be stored in a record (struct, class, etc.).
|
||||
Option \fBgeneric\fP should be used in complex cases when the other two APIs
|
||||
@@ -1391,6 +1405,12 @@ variable \fByystate\fP\&. Transitions between states update \fByystate\fP to the
|
||||
case label of the destination state and continue execution to the head of
|
||||
the loop.
|
||||
.TP
|
||||
.B \fB\-\-computed\-continue\fP
|
||||
This option requires the \fB\-\-loop\-switch\fP code model. It uses computed
|
||||
\fBcontinue\fP statements to select the next switch case directly, enabling
|
||||
jump\-table optimization similar to \fB\-\-computed\-gotos\fP in the goto/label
|
||||
code model.
|
||||
.TP
|
||||
.B \fB\-\-nested\-ifs \-s\fP
|
||||
Use nested \fBif\fP statements instead of \fBswitch\fP statements in conditional
|
||||
jumps. This usually results in more efficient code with non\-optimizing
|
||||
@@ -1654,6 +1674,13 @@ priority, matches any code unit, and always consumes a single code unit.
|
||||
.B \fB\-Wunreachable\-rules\fP
|
||||
Warn about rules that are shadowed by other rules and will never match.
|
||||
.TP
|
||||
.B \fB\-Wdeprecated\-eof_rule\fP
|
||||
Warn about standalone end of input rules \fB$\fP that will be broken by the
|
||||
future changes and require fixing. At the moment these rules take precedence
|
||||
when conflicting with other rules, but after the introduction of generalized
|
||||
end of input symbol \fB$\fP precedence order will change and these rules will
|
||||
become shadowed by other rules.
|
||||
.TP
|
||||
.B \fB\-Wuseless\-escape\fP
|
||||
Warn if a symbol is escaped when it shouldn\(aqt be.
|
||||
By default, re2go silently ignores such escapes, but this may as well
|
||||
@@ -1721,7 +1748,7 @@ A list of supported codegen targets with possible elements \fBcode\fP,
|
||||
.B \fBsupported_features\fP
|
||||
A list of supported features with possible elements \fBnested\-ifs\fP,
|
||||
\fBbitmaps\fP, \fBcomputed\-gotos\fP, \fBcase\-ranges\fP, \fBmonadic\fP, \fBunsafe\fP,
|
||||
\fBtags\fP, \fBcaptures\fP, \fBcaptvars\fP\&.
|
||||
\fBtags\fP, \fBcaptures\fP, \fBcaptvars\fP, \fBcomputed\-continue\fP\&.
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
@@ -1985,12 +2012,15 @@ Default switch case.
|
||||
.TP
|
||||
.B \fBcode:loop\fP
|
||||
A loop that runs forever (unless interrupted from the loop body).
|
||||
Supported variables: \fBlabel\fP (loop label), \fBstmt\fP (a list variable
|
||||
that expands to all statements in the loop body).
|
||||
Supported variables: \fBlabel\fP (loop label), \fBval\fP (initial state),
|
||||
\fBvar\fP (state variable), \fBstate\fP (a list variable that expands to all
|
||||
state names) and \fBstmt\fP (a list variable that expands to all statements
|
||||
in the loop body or the current state).
|
||||
.TP
|
||||
.B \fBcode:continue\fP
|
||||
Continue statement. Supported variables: \fBlabel\fP (label from which to
|
||||
continue execution).
|
||||
continue execution), \fBval\fP (value passed to a labeled switch) and \fBvar\fP
|
||||
(state variable).
|
||||
.TP
|
||||
.B \fBcode:goto\fP
|
||||
Goto statement. Supported variables: \fBlabel\fP (label of the jump
|
||||
@@ -2228,6 +2258,10 @@ Supported variables: \fBYYLESSTHAN\fP, \fBYYCURSOR\fP, \fBYYLIMIT\fP,
|
||||
\fBneed\fP (the number of code units to check against). Conditional:
|
||||
\fB\&.many\fP (true if the \fBneed\fP is more than one).
|
||||
.TP
|
||||
.B \fBcode:yyend\fP
|
||||
\fBYYEND\fP expression, possibly specialized for different APIs.
|
||||
Supported variables: \fBYYEND\fP, \fBYYCURSOR\fP, \fBYYLIMIT\fP\&.
|
||||
.TP
|
||||
.B \fBcode:yybm_filter\fP
|
||||
Condition that is used to filter out \fByych\fP values that are not
|
||||
covered by the \fByybm\fP table (used with \fB\-\-bitmaps\fP option).
|
||||
@@ -2294,6 +2328,10 @@ True if case ranges feature is enabled (\fB\-\-case\-ranges\fP or
|
||||
True if the relative form of computed \fBgoto\fP is used
|
||||
(\fB\-\-computed\-gotos\-relative\fP or \fBre2c:cgoto:relative = 1\fP).
|
||||
.TP
|
||||
.B \fB\&.computed_continue\fP
|
||||
True if loop/switch model uses labeled\-switch transitions
|
||||
(\fB\-\-computed\-continue\fP).
|
||||
.TP
|
||||
.B \fB\&.code_model.goto_label\fP
|
||||
True if code model based on goto/label is used (\fB\-\-goto\-label\fP).
|
||||
.TP
|
||||
@@ -2329,6 +2367,9 @@ languages that have \(dqunsafe\(dq feature.
|
||||
.B \fB\&.version\fP
|
||||
True if the generated fingerprint should contain re2go version.
|
||||
.TP
|
||||
.B \fB\&.yyfill.enable\fP
|
||||
True if \fBYYFILL\fP is enabled (\fBre2c:yyfill:enable = 1\fP).
|
||||
.TP
|
||||
.B \fB\&.yyfn.throw\fP
|
||||
True if \fBre2c:yyfn:throw\fP configuration is defined to a nonempty string.
|
||||
.UNINDENT
|
||||
@@ -4109,8 +4150,9 @@ fixed\-length Unicode encoding with code space \fB[0\-0x10FFFF]\fP and 4\-byte c
|
||||
points and code units.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Include file \fBinclude/unicode_categories.re\fP provides re2go definitions for the
|
||||
standard Unicode categories.
|
||||
Include files \fBinclude/unicode_blocks.re\fP, \fBinclude/unicode_categories.re\fP
|
||||
and \fBinclude/unicode_properties.re\fP provide re2go definitions for blocks,
|
||||
categories and properties described in the Unicode standard.
|
||||
.sp
|
||||
Option \fB\-\-input\-encoding\fP specifies source file encoding, which can be used to
|
||||
enable Unicode literals in regular expressions. For example
|
||||
|
||||
+50
-10
@@ -843,6 +843,9 @@ variable named \fBstag\fP\&.
|
||||
.B \fB#mtag\fP
|
||||
An \fIm\-tag\fP: saves all input positions at which \fB#mtag\fP matches in a
|
||||
variable named \fBmtag\fP\&.
|
||||
.TP
|
||||
.B \fB$\fP
|
||||
End of input.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Character classes and string literals may contain the following escape
|
||||
@@ -942,7 +945,8 @@ It contains primitives for generic operations:
|
||||
\fBYYSHIFT\fP,
|
||||
\fBYYSHIFTSTAG\fP,
|
||||
\fBYYSHIFTMTAG\fP,
|
||||
\fBYYLESSTHAN\fP\&.
|
||||
\fBYYLESSTHAN\fP,
|
||||
\fBYYEND\fP\&.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Here is a full list of API primitives that may be used by the generated code in
|
||||
@@ -1011,6 +1015,14 @@ A generic API primitive with one variable \fBlen\fP\&.
|
||||
It should be defined as an r\-value of boolean type that equals \fBtrue\fP if
|
||||
and only if there are less than \fBlen\fP input characters left.
|
||||
.TP
|
||||
.B \fBYYEND\fP
|
||||
A generic API primitive with no variables.
|
||||
It should be defined as an r\-value of boolean type that equals \fBtrue\fP if
|
||||
and only if the \fIlogical\fP end of input has been reached (excluding any
|
||||
padding or sentinel symbols). \fBYYEND\fP is used to implement \fB$\fP symbol in
|
||||
regular expressions. It differs from \fBYYLESSTHAN\fP, which is used to ensure
|
||||
that the lexer won\(aqt read past the end of buffer.
|
||||
.TP
|
||||
.B \fBYYPEEK\fP
|
||||
A generic API primitive with no variables.
|
||||
It should be defined as an r\-value of type \fBYYCTYPE\fP that is equal to the
|
||||
@@ -1194,7 +1206,7 @@ Show help message.
|
||||
.TP
|
||||
.B \fB\-\-api <simple | record | generic>\fP
|
||||
Specify the API used by the generated code to interface with used\-defined
|
||||
code. Option \fBsimple\fP shold be used in simple cases when there\(aqs no need
|
||||
code. Option \fBsimple\fP should be used in simple cases when there\(aqs no need
|
||||
for buffer refilling and storing lexer state. Option \fBrecord\fP should be
|
||||
used when lexer state needs to be stored in a record (struct, class, etc.).
|
||||
Option \fBgeneric\fP should be used in complex cases when the other two APIs
|
||||
@@ -1331,6 +1343,12 @@ variable \fByystate\fP\&. Transitions between states update \fByystate\fP to the
|
||||
case label of the destination state and continue execution to the head of
|
||||
the loop.
|
||||
.TP
|
||||
.B \fB\-\-computed\-continue\fP
|
||||
This option requires the \fB\-\-loop\-switch\fP code model. It uses computed
|
||||
\fBcontinue\fP statements to select the next switch case directly, enabling
|
||||
jump\-table optimization similar to \fB\-\-computed\-gotos\fP in the goto/label
|
||||
code model.
|
||||
.TP
|
||||
.B \fB\-\-nested\-ifs \-s\fP
|
||||
Use nested \fBif\fP statements instead of \fBswitch\fP statements in conditional
|
||||
jumps. This usually results in more efficient code with non\-optimizing
|
||||
@@ -1594,6 +1612,13 @@ priority, matches any code unit, and always consumes a single code unit.
|
||||
.B \fB\-Wunreachable\-rules\fP
|
||||
Warn about rules that are shadowed by other rules and will never match.
|
||||
.TP
|
||||
.B \fB\-Wdeprecated\-eof_rule\fP
|
||||
Warn about standalone end of input rules \fB$\fP that will be broken by the
|
||||
future changes and require fixing. At the moment these rules take precedence
|
||||
when conflicting with other rules, but after the introduction of generalized
|
||||
end of input symbol \fB$\fP precedence order will change and these rules will
|
||||
become shadowed by other rules.
|
||||
.TP
|
||||
.B \fB\-Wuseless\-escape\fP
|
||||
Warn if a symbol is escaped when it shouldn\(aqt be.
|
||||
By default, re2hs silently ignores such escapes, but this may as well
|
||||
@@ -1661,7 +1686,7 @@ A list of supported codegen targets with possible elements \fBcode\fP,
|
||||
.B \fBsupported_features\fP
|
||||
A list of supported features with possible elements \fBnested\-ifs\fP,
|
||||
\fBbitmaps\fP, \fBcomputed\-gotos\fP, \fBcase\-ranges\fP, \fBmonadic\fP, \fBunsafe\fP,
|
||||
\fBtags\fP, \fBcaptures\fP, \fBcaptvars\fP\&.
|
||||
\fBtags\fP, \fBcaptures\fP, \fBcaptvars\fP, \fBcomputed\-continue\fP\&.
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
@@ -1925,12 +1950,15 @@ Default switch case.
|
||||
.TP
|
||||
.B \fBcode:loop\fP
|
||||
A loop that runs forever (unless interrupted from the loop body).
|
||||
Supported variables: \fBlabel\fP (loop label), \fBstmt\fP (a list variable
|
||||
that expands to all statements in the loop body).
|
||||
Supported variables: \fBlabel\fP (loop label), \fBval\fP (initial state),
|
||||
\fBvar\fP (state variable), \fBstate\fP (a list variable that expands to all
|
||||
state names) and \fBstmt\fP (a list variable that expands to all statements
|
||||
in the loop body or the current state).
|
||||
.TP
|
||||
.B \fBcode:continue\fP
|
||||
Continue statement. Supported variables: \fBlabel\fP (label from which to
|
||||
continue execution).
|
||||
continue execution), \fBval\fP (value passed to a labeled switch) and \fBvar\fP
|
||||
(state variable).
|
||||
.TP
|
||||
.B \fBcode:goto\fP
|
||||
Goto statement. Supported variables: \fBlabel\fP (label of the jump
|
||||
@@ -2168,6 +2196,10 @@ Supported variables: \fBYYLESSTHAN\fP, \fBYYCURSOR\fP, \fBYYLIMIT\fP,
|
||||
\fBneed\fP (the number of code units to check against). Conditional:
|
||||
\fB\&.many\fP (true if the \fBneed\fP is more than one).
|
||||
.TP
|
||||
.B \fBcode:yyend\fP
|
||||
\fBYYEND\fP expression, possibly specialized for different APIs.
|
||||
Supported variables: \fBYYEND\fP, \fBYYCURSOR\fP, \fBYYLIMIT\fP\&.
|
||||
.TP
|
||||
.B \fBcode:yybm_filter\fP
|
||||
Condition that is used to filter out \fByych\fP values that are not
|
||||
covered by the \fByybm\fP table (used with \fB\-\-bitmaps\fP option).
|
||||
@@ -2234,6 +2266,10 @@ True if case ranges feature is enabled (\fB\-\-case\-ranges\fP or
|
||||
True if the relative form of computed \fBgoto\fP is used
|
||||
(\fB\-\-computed\-gotos\-relative\fP or \fBre2c:cgoto:relative = 1\fP).
|
||||
.TP
|
||||
.B \fB\&.computed_continue\fP
|
||||
True if loop/switch model uses labeled\-switch transitions
|
||||
(\fB\-\-computed\-continue\fP).
|
||||
.TP
|
||||
.B \fB\&.code_model.goto_label\fP
|
||||
True if code model based on goto/label is used (\fB\-\-goto\-label\fP).
|
||||
.TP
|
||||
@@ -2269,6 +2305,9 @@ languages that have \(dqunsafe\(dq feature.
|
||||
.B \fB\&.version\fP
|
||||
True if the generated fingerprint should contain re2hs version.
|
||||
.TP
|
||||
.B \fB\&.yyfill.enable\fP
|
||||
True if \fBYYFILL\fP is enabled (\fBre2c:yyfill:enable = 1\fP).
|
||||
.TP
|
||||
.B \fB\&.yyfn.throw\fP
|
||||
True if \fBre2c:yyfn:throw\fP configuration is defined to a nonempty string.
|
||||
.UNINDENT
|
||||
@@ -3510,9 +3549,9 @@ data State a = State {
|
||||
%}
|
||||
|
||||
%{use
|
||||
re2c:YYFN = [\(dqlex32;Maybe Int\(dq, \(dqState{..};State (Array Int Int)\(dq];
|
||||
re2c:YYFN = [\(dqlex32;Maybe Int\(dq, \(dqState{..};State (Array Int Word)\(dq];
|
||||
re2c:encoding:utf32 = 1;
|
||||
re2c:YYCTYPE = Int;
|
||||
re2c:YYCTYPE = Word;
|
||||
%}
|
||||
|
||||
main :: IO ()
|
||||
@@ -4012,8 +4051,9 @@ fixed\-length Unicode encoding with code space \fB[0\-0x10FFFF]\fP and 4\-byte c
|
||||
points and code units.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Include file \fBinclude/unicode_categories.re\fP provides re2hs definitions for the
|
||||
standard Unicode categories.
|
||||
Include files \fBinclude/unicode_blocks.re\fP, \fBinclude/unicode_categories.re\fP
|
||||
and \fBinclude/unicode_properties.re\fP provide re2hs definitions for blocks,
|
||||
categories and properties described in the Unicode standard.
|
||||
.sp
|
||||
Option \fB\-\-input\-encoding\fP specifies source file encoding, which can be used to
|
||||
enable Unicode literals in regular expressions. For example
|
||||
|
||||
+72
-31
@@ -856,6 +856,9 @@ variable named \fBstag\fP\&.
|
||||
.B \fB#mtag\fP
|
||||
An \fIm\-tag\fP: saves all input positions at which \fB#mtag\fP matches in a
|
||||
variable named \fBmtag\fP\&.
|
||||
.TP
|
||||
.B \fB$\fP
|
||||
End of input.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Character classes and string literals may contain the following escape
|
||||
@@ -964,7 +967,8 @@ It contains primitives for generic operations:
|
||||
\fBYYSHIFT\fP,
|
||||
\fBYYSHIFTSTAG\fP,
|
||||
\fBYYSHIFTMTAG\fP,
|
||||
\fBYYLESSTHAN\fP\&.
|
||||
\fBYYLESSTHAN\fP,
|
||||
\fBYYEND\fP\&.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Here is a full list of API primitives that may be used by the generated code in
|
||||
@@ -1033,6 +1037,14 @@ A generic API primitive with one variable \fBlen\fP\&.
|
||||
It should be defined as an r\-value of boolean type that equals \fBtrue\fP if
|
||||
and only if there are less than \fBlen\fP input characters left.
|
||||
.TP
|
||||
.B \fBYYEND\fP
|
||||
A generic API primitive with no variables.
|
||||
It should be defined as an r\-value of boolean type that equals \fBtrue\fP if
|
||||
and only if the \fIlogical\fP end of input has been reached (excluding any
|
||||
padding or sentinel symbols). \fBYYEND\fP is used to implement \fB$\fP symbol in
|
||||
regular expressions. It differs from \fBYYLESSTHAN\fP, which is used to ensure
|
||||
that the lexer won\(aqt read past the end of buffer.
|
||||
.TP
|
||||
.B \fBYYPEEK\fP
|
||||
A generic API primitive with no variables.
|
||||
It should be defined as an r\-value of type \fBYYCTYPE\fP that is equal to the
|
||||
@@ -1216,7 +1228,7 @@ Show help message.
|
||||
.TP
|
||||
.B \fB\-\-api <simple | record | generic>\fP
|
||||
Specify the API used by the generated code to interface with used\-defined
|
||||
code. Option \fBsimple\fP shold be used in simple cases when there\(aqs no need
|
||||
code. Option \fBsimple\fP should be used in simple cases when there\(aqs no need
|
||||
for buffer refilling and storing lexer state. Option \fBrecord\fP should be
|
||||
used when lexer state needs to be stored in a record (struct, class, etc.).
|
||||
Option \fBgeneric\fP should be used in complex cases when the other two APIs
|
||||
@@ -1353,6 +1365,12 @@ variable \fByystate\fP\&. Transitions between states update \fByystate\fP to the
|
||||
case label of the destination state and continue execution to the head of
|
||||
the loop.
|
||||
.TP
|
||||
.B \fB\-\-computed\-continue\fP
|
||||
This option requires the \fB\-\-loop\-switch\fP code model. It uses computed
|
||||
\fBcontinue\fP statements to select the next switch case directly, enabling
|
||||
jump\-table optimization similar to \fB\-\-computed\-gotos\fP in the goto/label
|
||||
code model.
|
||||
.TP
|
||||
.B \fB\-\-nested\-ifs \-s\fP
|
||||
Use nested \fBif\fP statements instead of \fBswitch\fP statements in conditional
|
||||
jumps. This usually results in more efficient code with non\-optimizing
|
||||
@@ -1616,6 +1634,13 @@ priority, matches any code unit, and always consumes a single code unit.
|
||||
.B \fB\-Wunreachable\-rules\fP
|
||||
Warn about rules that are shadowed by other rules and will never match.
|
||||
.TP
|
||||
.B \fB\-Wdeprecated\-eof_rule\fP
|
||||
Warn about standalone end of input rules \fB$\fP that will be broken by the
|
||||
future changes and require fixing. At the moment these rules take precedence
|
||||
when conflicting with other rules, but after the introduction of generalized
|
||||
end of input symbol \fB$\fP precedence order will change and these rules will
|
||||
become shadowed by other rules.
|
||||
.TP
|
||||
.B \fB\-Wuseless\-escape\fP
|
||||
Warn if a symbol is escaped when it shouldn\(aqt be.
|
||||
By default, re2java silently ignores such escapes, but this may as well
|
||||
@@ -1683,7 +1708,7 @@ A list of supported codegen targets with possible elements \fBcode\fP,
|
||||
.B \fBsupported_features\fP
|
||||
A list of supported features with possible elements \fBnested\-ifs\fP,
|
||||
\fBbitmaps\fP, \fBcomputed\-gotos\fP, \fBcase\-ranges\fP, \fBmonadic\fP, \fBunsafe\fP,
|
||||
\fBtags\fP, \fBcaptures\fP, \fBcaptvars\fP\&.
|
||||
\fBtags\fP, \fBcaptures\fP, \fBcaptvars\fP, \fBcomputed\-continue\fP\&.
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
@@ -1947,12 +1972,15 @@ Default switch case.
|
||||
.TP
|
||||
.B \fBcode:loop\fP
|
||||
A loop that runs forever (unless interrupted from the loop body).
|
||||
Supported variables: \fBlabel\fP (loop label), \fBstmt\fP (a list variable
|
||||
that expands to all statements in the loop body).
|
||||
Supported variables: \fBlabel\fP (loop label), \fBval\fP (initial state),
|
||||
\fBvar\fP (state variable), \fBstate\fP (a list variable that expands to all
|
||||
state names) and \fBstmt\fP (a list variable that expands to all statements
|
||||
in the loop body or the current state).
|
||||
.TP
|
||||
.B \fBcode:continue\fP
|
||||
Continue statement. Supported variables: \fBlabel\fP (label from which to
|
||||
continue execution).
|
||||
continue execution), \fBval\fP (value passed to a labeled switch) and \fBvar\fP
|
||||
(state variable).
|
||||
.TP
|
||||
.B \fBcode:goto\fP
|
||||
Goto statement. Supported variables: \fBlabel\fP (label of the jump
|
||||
@@ -2190,6 +2218,10 @@ Supported variables: \fBYYLESSTHAN\fP, \fBYYCURSOR\fP, \fBYYLIMIT\fP,
|
||||
\fBneed\fP (the number of code units to check against). Conditional:
|
||||
\fB\&.many\fP (true if the \fBneed\fP is more than one).
|
||||
.TP
|
||||
.B \fBcode:yyend\fP
|
||||
\fBYYEND\fP expression, possibly specialized for different APIs.
|
||||
Supported variables: \fBYYEND\fP, \fBYYCURSOR\fP, \fBYYLIMIT\fP\&.
|
||||
.TP
|
||||
.B \fBcode:yybm_filter\fP
|
||||
Condition that is used to filter out \fByych\fP values that are not
|
||||
covered by the \fByybm\fP table (used with \fB\-\-bitmaps\fP option).
|
||||
@@ -2256,6 +2288,10 @@ True if case ranges feature is enabled (\fB\-\-case\-ranges\fP or
|
||||
True if the relative form of computed \fBgoto\fP is used
|
||||
(\fB\-\-computed\-gotos\-relative\fP or \fBre2c:cgoto:relative = 1\fP).
|
||||
.TP
|
||||
.B \fB\&.computed_continue\fP
|
||||
True if loop/switch model uses labeled\-switch transitions
|
||||
(\fB\-\-computed\-continue\fP).
|
||||
.TP
|
||||
.B \fB\&.code_model.goto_label\fP
|
||||
True if code model based on goto/label is used (\fB\-\-goto\-label\fP).
|
||||
.TP
|
||||
@@ -2291,6 +2327,9 @@ languages that have \(dqunsafe\(dq feature.
|
||||
.B \fB\&.version\fP
|
||||
True if the generated fingerprint should contain re2java version.
|
||||
.TP
|
||||
.B \fB\&.yyfill.enable\fP
|
||||
True if \fBYYFILL\fP is enabled (\fBre2c:yyfill:enable = 1\fP).
|
||||
.TP
|
||||
.B \fB\&.yyfn.throw\fP
|
||||
True if \fBre2c:yyfn:throw\fP configuration is defined to a nonempty string.
|
||||
.UNINDENT
|
||||
@@ -2532,10 +2571,10 @@ class Main {
|
||||
/*!max:re2c*/
|
||||
|
||||
// Expects yymaxfill\-padded string.
|
||||
static int lex(String str) {
|
||||
static int lex(byte[] str) {
|
||||
// Pad string with yymaxfill zeroes at the end.
|
||||
byte[] yyinput = new byte[str.length() + YYMAXFILL];
|
||||
System.arraycopy(str.getBytes(), 0, yyinput, 0, str.length());
|
||||
byte[] yyinput = new byte[str.length + YYMAXFILL];
|
||||
System.arraycopy(str, 0, yyinput, 0, str.length);
|
||||
|
||||
int yycursor = 0;
|
||||
int yylimit = yyinput.length;
|
||||
@@ -2543,15 +2582,15 @@ class Main {
|
||||
|
||||
loop: while (true) {
|
||||
/*!re2c
|
||||
re2c:YYCTYPE = \(dqbyte\(dq;
|
||||
re2c:YYPEEK = \(dqyyinput[yycursor]\(dq;
|
||||
re2c:YYCTYPE = \(dqint\(dq;
|
||||
re2c:YYPEEK = \(dqByte.toUnsignedInt(yyinput[yycursor])\(dq;
|
||||
re2c:YYFILL = \(dqreturn \-1;\(dq;
|
||||
|
||||
str = [\(aq] ([^\(aq\e\e] | [\e\e][^])* [\(aq];
|
||||
|
||||
[\ex00] {
|
||||
// Check that it is the sentinel, not some unexpected null.
|
||||
return (yycursor \- 1 == str.length()) ? count : \-1;
|
||||
return (yycursor \- 1 == str.length) ? count : \-1;
|
||||
}
|
||||
str { count += 1; continue loop; }
|
||||
[ ]+ { continue loop; }
|
||||
@@ -2561,10 +2600,10 @@ class Main {
|
||||
}
|
||||
|
||||
public static void main(String []args) {
|
||||
assert lex(\(dq\(dq) == 0;
|
||||
assert lex(\(dq\(aqqu\e0tes\(aq \(aqare\(aq \(aqfine: \e\e\(aq\(aq \(dq) == 3;
|
||||
assert lex(\(dq\(aqunterminated\e\e\(aq\(dq) == \-1;
|
||||
assert lex(\(dq\(aqunexpected \e00 null\e\e\(aq\(dq) == \-1;
|
||||
assert lex(\(dq\(dq.getBytes()) == 0;
|
||||
assert lex(\(dq\(aqqu\e0tes\(aq \(aqare\(aq \(aqfine: \e\e\(aq\(aq \(dq.getBytes()) == 3;
|
||||
assert lex(\(dq\(aqunterminated\e\e\(aq\(dq.getBytes()) == \-1;
|
||||
assert lex(\(dq\(aqunexpected \e00 null\e\e\(aq\(dq.getBytes()) == \-1;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2599,8 +2638,9 @@ class Main {
|
||||
loop: while (true) {
|
||||
/*!re2c
|
||||
re2c:api = generic;
|
||||
re2c:YYCTYPE = \(dqbyte\(dq;
|
||||
re2c:YYPEEK = \(dq(yycursor < yyinput.length) ? yyinput[yycursor] : 0\(dq;
|
||||
re2c:YYCTYPE = \(dqint\(dq;
|
||||
re2c:YYPEEK = \(dq(yycursor < yyinput.length)\(dq
|
||||
\(dq ? Byte.toUnsignedInt(yyinput[yycursor]) : 0\(dq;
|
||||
re2c:YYSKIP = \(dqyycursor += 1;\(dq;
|
||||
re2c:yyfill:enable = 0;
|
||||
|
||||
@@ -2764,8 +2804,8 @@ class Lexer {
|
||||
loop: while (true) {
|
||||
token = yycursor;
|
||||
/*!re2c
|
||||
re2c:YYCTYPE = \(dqbyte\(dq;
|
||||
re2c:YYPEEK = \(dqyyinput[yycursor]\(dq;
|
||||
re2c:YYCTYPE = \(dqint\(dq;
|
||||
re2c:YYPEEK = \(dqByte.toUnsignedInt(yyinput[yycursor])\(dq;
|
||||
re2c:YYFILL = \(dqfill() == 0\(dq;
|
||||
re2c:eof = 0;
|
||||
|
||||
@@ -2912,8 +2952,8 @@ class Lexer {
|
||||
loop: while (true) {
|
||||
token = yycursor;
|
||||
/*!re2c
|
||||
re2c:YYCTYPE = \(dqbyte\(dq;
|
||||
re2c:YYPEEK = \(dqyyinput[yycursor]\(dq;
|
||||
re2c:YYCTYPE = \(dqint\(dq;
|
||||
re2c:YYPEEK = \(dqByte.toUnsignedInt(yyinput[yycursor])\(dq;
|
||||
re2c:YYFILL = \(dqif (fill(@@) != 0) { return \-2; }\(dq;
|
||||
|
||||
str = [\(aq] ([^\(aq\e\e] | [\e\e][^])* [\(aq];
|
||||
@@ -3344,13 +3384,13 @@ class Lexer {
|
||||
}
|
||||
|
||||
private static Status lex(State yyrecord) {
|
||||
byte yych;
|
||||
int yych;
|
||||
loop: while (true) {
|
||||
yyrecord.token = yyrecord.yycursor;
|
||||
/*!re2c
|
||||
re2c:api = record;
|
||||
re2c:YYCTYPE = \(dqbyte\(dq;
|
||||
re2c:YYPEEK = \(dqyyrecord.yyinput[yyrecord.yycursor]\(dq;
|
||||
re2c:YYCTYPE = \(dqint\(dq;
|
||||
re2c:YYPEEK = \(dqByte.toUnsignedInt(yyrecord.yyinput[yyrecord.yycursor])\(dq;
|
||||
re2c:YYFILL = \(dqreturn Status.WAITING;\(dq;
|
||||
re2c:eof = 0;
|
||||
|
||||
@@ -3534,7 +3574,7 @@ class Main {
|
||||
int yycursor = 0;
|
||||
int yymarker = 0;
|
||||
/*!use:re2c
|
||||
re2c:YYCTYPE = \(dqint\(dq; // should be \(gabyte\(ga, but it\(aqs signed in Java
|
||||
re2c:YYCTYPE = \(dqint\(dq; // Java lacks unsigned 8\-bit integer type
|
||||
re2c:encoding:utf8 = 1;
|
||||
*/
|
||||
}
|
||||
@@ -3818,8 +3858,8 @@ class Lexer {
|
||||
loop: while (true) {
|
||||
token = yycursor;
|
||||
/*!re2c
|
||||
re2c:YYCTYPE = \(dqbyte\(dq;
|
||||
re2c:YYPEEK = \(dqyyinput[yycursor]\(dq;
|
||||
re2c:YYCTYPE = \(dqint\(dq;
|
||||
re2c:YYPEEK = \(dqByte.toUnsignedInt(yyinput[yycursor])\(dq;
|
||||
re2c:YYFILL = \(dqfill() == 0\(dq;
|
||||
re2c:eof = 0;
|
||||
re2c:tags = 1;
|
||||
@@ -3854,7 +3894,7 @@ class Lexer {
|
||||
// Run the lexer.
|
||||
Optional<ArrayList<SemVer>> vers = lexer.lex();
|
||||
|
||||
// Check resuts.
|
||||
// Check results.
|
||||
assert vers.isPresent() && vers.get().size() == BUFSIZE;
|
||||
SemVer v = new SemVer(1, 22, 333);
|
||||
for (int i = 0; i < BUFSIZE; ++i) {
|
||||
@@ -4040,8 +4080,9 @@ fixed\-length Unicode encoding with code space \fB[0\-0x10FFFF]\fP and 4\-byte c
|
||||
points and code units.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Include file \fBinclude/unicode_categories.re\fP provides re2java definitions for the
|
||||
standard Unicode categories.
|
||||
Include files \fBinclude/unicode_blocks.re\fP, \fBinclude/unicode_categories.re\fP
|
||||
and \fBinclude/unicode_properties.re\fP provide re2java definitions for blocks,
|
||||
categories and properties described in the Unicode standard.
|
||||
.sp
|
||||
Option \fB\-\-input\-encoding\fP specifies source file encoding, which can be used to
|
||||
enable Unicode literals in regular expressions. For example
|
||||
|
||||
+48
-8
@@ -848,6 +848,9 @@ variable named \fBstag\fP\&.
|
||||
.B \fB#mtag\fP
|
||||
An \fIm\-tag\fP: saves all input positions at which \fB#mtag\fP matches in a
|
||||
variable named \fBmtag\fP\&.
|
||||
.TP
|
||||
.B \fB$\fP
|
||||
End of input.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Character classes and string literals may contain the following escape
|
||||
@@ -956,7 +959,8 @@ It contains primitives for generic operations:
|
||||
\fBYYSHIFT\fP,
|
||||
\fBYYSHIFTSTAG\fP,
|
||||
\fBYYSHIFTMTAG\fP,
|
||||
\fBYYLESSTHAN\fP\&.
|
||||
\fBYYLESSTHAN\fP,
|
||||
\fBYYEND\fP\&.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Here is a full list of API primitives that may be used by the generated code in
|
||||
@@ -1025,6 +1029,14 @@ A generic API primitive with one variable \fBlen\fP\&.
|
||||
It should be defined as an r\-value of boolean type that equals \fBtrue\fP if
|
||||
and only if there are less than \fBlen\fP input characters left.
|
||||
.TP
|
||||
.B \fBYYEND\fP
|
||||
A generic API primitive with no variables.
|
||||
It should be defined as an r\-value of boolean type that equals \fBtrue\fP if
|
||||
and only if the \fIlogical\fP end of input has been reached (excluding any
|
||||
padding or sentinel symbols). \fBYYEND\fP is used to implement \fB$\fP symbol in
|
||||
regular expressions. It differs from \fBYYLESSTHAN\fP, which is used to ensure
|
||||
that the lexer won\(aqt read past the end of buffer.
|
||||
.TP
|
||||
.B \fBYYPEEK\fP
|
||||
A generic API primitive with no variables.
|
||||
It should be defined as an r\-value of type \fBYYCTYPE\fP that is equal to the
|
||||
@@ -1208,7 +1220,7 @@ Show help message.
|
||||
.TP
|
||||
.B \fB\-\-api <simple | record | generic>\fP
|
||||
Specify the API used by the generated code to interface with used\-defined
|
||||
code. Option \fBsimple\fP shold be used in simple cases when there\(aqs no need
|
||||
code. Option \fBsimple\fP should be used in simple cases when there\(aqs no need
|
||||
for buffer refilling and storing lexer state. Option \fBrecord\fP should be
|
||||
used when lexer state needs to be stored in a record (struct, class, etc.).
|
||||
Option \fBgeneric\fP should be used in complex cases when the other two APIs
|
||||
@@ -1345,6 +1357,12 @@ variable \fByystate\fP\&. Transitions between states update \fByystate\fP to the
|
||||
case label of the destination state and continue execution to the head of
|
||||
the loop.
|
||||
.TP
|
||||
.B \fB\-\-computed\-continue\fP
|
||||
This option requires the \fB\-\-loop\-switch\fP code model. It uses computed
|
||||
\fBcontinue\fP statements to select the next switch case directly, enabling
|
||||
jump\-table optimization similar to \fB\-\-computed\-gotos\fP in the goto/label
|
||||
code model.
|
||||
.TP
|
||||
.B \fB\-\-nested\-ifs \-s\fP
|
||||
Use nested \fBif\fP statements instead of \fBswitch\fP statements in conditional
|
||||
jumps. This usually results in more efficient code with non\-optimizing
|
||||
@@ -1608,6 +1626,13 @@ priority, matches any code unit, and always consumes a single code unit.
|
||||
.B \fB\-Wunreachable\-rules\fP
|
||||
Warn about rules that are shadowed by other rules and will never match.
|
||||
.TP
|
||||
.B \fB\-Wdeprecated\-eof_rule\fP
|
||||
Warn about standalone end of input rules \fB$\fP that will be broken by the
|
||||
future changes and require fixing. At the moment these rules take precedence
|
||||
when conflicting with other rules, but after the introduction of generalized
|
||||
end of input symbol \fB$\fP precedence order will change and these rules will
|
||||
become shadowed by other rules.
|
||||
.TP
|
||||
.B \fB\-Wuseless\-escape\fP
|
||||
Warn if a symbol is escaped when it shouldn\(aqt be.
|
||||
By default, re2js silently ignores such escapes, but this may as well
|
||||
@@ -1675,7 +1700,7 @@ A list of supported codegen targets with possible elements \fBcode\fP,
|
||||
.B \fBsupported_features\fP
|
||||
A list of supported features with possible elements \fBnested\-ifs\fP,
|
||||
\fBbitmaps\fP, \fBcomputed\-gotos\fP, \fBcase\-ranges\fP, \fBmonadic\fP, \fBunsafe\fP,
|
||||
\fBtags\fP, \fBcaptures\fP, \fBcaptvars\fP\&.
|
||||
\fBtags\fP, \fBcaptures\fP, \fBcaptvars\fP, \fBcomputed\-continue\fP\&.
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
@@ -1939,12 +1964,15 @@ Default switch case.
|
||||
.TP
|
||||
.B \fBcode:loop\fP
|
||||
A loop that runs forever (unless interrupted from the loop body).
|
||||
Supported variables: \fBlabel\fP (loop label), \fBstmt\fP (a list variable
|
||||
that expands to all statements in the loop body).
|
||||
Supported variables: \fBlabel\fP (loop label), \fBval\fP (initial state),
|
||||
\fBvar\fP (state variable), \fBstate\fP (a list variable that expands to all
|
||||
state names) and \fBstmt\fP (a list variable that expands to all statements
|
||||
in the loop body or the current state).
|
||||
.TP
|
||||
.B \fBcode:continue\fP
|
||||
Continue statement. Supported variables: \fBlabel\fP (label from which to
|
||||
continue execution).
|
||||
continue execution), \fBval\fP (value passed to a labeled switch) and \fBvar\fP
|
||||
(state variable).
|
||||
.TP
|
||||
.B \fBcode:goto\fP
|
||||
Goto statement. Supported variables: \fBlabel\fP (label of the jump
|
||||
@@ -2182,6 +2210,10 @@ Supported variables: \fBYYLESSTHAN\fP, \fBYYCURSOR\fP, \fBYYLIMIT\fP,
|
||||
\fBneed\fP (the number of code units to check against). Conditional:
|
||||
\fB\&.many\fP (true if the \fBneed\fP is more than one).
|
||||
.TP
|
||||
.B \fBcode:yyend\fP
|
||||
\fBYYEND\fP expression, possibly specialized for different APIs.
|
||||
Supported variables: \fBYYEND\fP, \fBYYCURSOR\fP, \fBYYLIMIT\fP\&.
|
||||
.TP
|
||||
.B \fBcode:yybm_filter\fP
|
||||
Condition that is used to filter out \fByych\fP values that are not
|
||||
covered by the \fByybm\fP table (used with \fB\-\-bitmaps\fP option).
|
||||
@@ -2248,6 +2280,10 @@ True if case ranges feature is enabled (\fB\-\-case\-ranges\fP or
|
||||
True if the relative form of computed \fBgoto\fP is used
|
||||
(\fB\-\-computed\-gotos\-relative\fP or \fBre2c:cgoto:relative = 1\fP).
|
||||
.TP
|
||||
.B \fB\&.computed_continue\fP
|
||||
True if loop/switch model uses labeled\-switch transitions
|
||||
(\fB\-\-computed\-continue\fP).
|
||||
.TP
|
||||
.B \fB\&.code_model.goto_label\fP
|
||||
True if code model based on goto/label is used (\fB\-\-goto\-label\fP).
|
||||
.TP
|
||||
@@ -2283,6 +2319,9 @@ languages that have \(dqunsafe\(dq feature.
|
||||
.B \fB\&.version\fP
|
||||
True if the generated fingerprint should contain re2js version.
|
||||
.TP
|
||||
.B \fB\&.yyfill.enable\fP
|
||||
True if \fBYYFILL\fP is enabled (\fBre2c:yyfill:enable = 1\fP).
|
||||
.TP
|
||||
.B \fB\&.yyfn.throw\fP
|
||||
True if \fBre2c:yyfn:throw\fP configuration is defined to a nonempty string.
|
||||
.UNINDENT
|
||||
@@ -3842,8 +3881,9 @@ fixed\-length Unicode encoding with code space \fB[0\-0x10FFFF]\fP and 4\-byte c
|
||||
points and code units.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Include file \fBinclude/unicode_categories.re\fP provides re2js definitions for the
|
||||
standard Unicode categories.
|
||||
Include files \fBinclude/unicode_blocks.re\fP, \fBinclude/unicode_categories.re\fP
|
||||
and \fBinclude/unicode_properties.re\fP provide re2js definitions for blocks,
|
||||
categories and properties described in the Unicode standard.
|
||||
.sp
|
||||
Option \fB\-\-input\-encoding\fP specifies source file encoding, which can be used to
|
||||
enable Unicode literals in regular expressions. For example
|
||||
|
||||
@@ -832,6 +832,9 @@ variable named \fBstag\fP\&.
|
||||
.B \fB#mtag\fP
|
||||
An \fIm\-tag\fP: saves all input positions at which \fB#mtag\fP matches in a
|
||||
variable named \fBmtag\fP\&.
|
||||
.TP
|
||||
.B \fB$\fP
|
||||
End of input.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Character classes and string literals may contain the following escape
|
||||
@@ -929,7 +932,8 @@ It contains primitives for generic operations:
|
||||
\fBYYSHIFT\fP,
|
||||
\fBYYSHIFTSTAG\fP,
|
||||
\fBYYSHIFTMTAG\fP,
|
||||
\fBYYLESSTHAN\fP\&.
|
||||
\fBYYLESSTHAN\fP,
|
||||
\fBYYEND\fP\&.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Here is a full list of API primitives that may be used by the generated code in
|
||||
@@ -998,6 +1002,14 @@ A generic API primitive with one variable \fBlen\fP\&.
|
||||
It should be defined as an r\-value of boolean type that equals \fBtrue\fP if
|
||||
and only if there are less than \fBlen\fP input characters left.
|
||||
.TP
|
||||
.B \fBYYEND\fP
|
||||
A generic API primitive with no variables.
|
||||
It should be defined as an r\-value of boolean type that equals \fBtrue\fP if
|
||||
and only if the \fIlogical\fP end of input has been reached (excluding any
|
||||
padding or sentinel symbols). \fBYYEND\fP is used to implement \fB$\fP symbol in
|
||||
regular expressions. It differs from \fBYYLESSTHAN\fP, which is used to ensure
|
||||
that the lexer won\(aqt read past the end of buffer.
|
||||
.TP
|
||||
.B \fBYYPEEK\fP
|
||||
A generic API primitive with no variables.
|
||||
It should be defined as an r\-value of type \fBYYCTYPE\fP that is equal to the
|
||||
@@ -1181,7 +1193,7 @@ Show help message.
|
||||
.TP
|
||||
.B \fB\-\-api <simple | record | generic>\fP
|
||||
Specify the API used by the generated code to interface with used\-defined
|
||||
code. Option \fBsimple\fP shold be used in simple cases when there\(aqs no need
|
||||
code. Option \fBsimple\fP should be used in simple cases when there\(aqs no need
|
||||
for buffer refilling and storing lexer state. Option \fBrecord\fP should be
|
||||
used when lexer state needs to be stored in a record (struct, class, etc.).
|
||||
Option \fBgeneric\fP should be used in complex cases when the other two APIs
|
||||
@@ -1318,6 +1330,12 @@ variable \fByystate\fP\&. Transitions between states update \fByystate\fP to the
|
||||
case label of the destination state and continue execution to the head of
|
||||
the loop.
|
||||
.TP
|
||||
.B \fB\-\-computed\-continue\fP
|
||||
This option requires the \fB\-\-loop\-switch\fP code model. It uses computed
|
||||
\fBcontinue\fP statements to select the next switch case directly, enabling
|
||||
jump\-table optimization similar to \fB\-\-computed\-gotos\fP in the goto/label
|
||||
code model.
|
||||
.TP
|
||||
.B \fB\-\-nested\-ifs \-s\fP
|
||||
Use nested \fBif\fP statements instead of \fBswitch\fP statements in conditional
|
||||
jumps. This usually results in more efficient code with non\-optimizing
|
||||
@@ -1581,6 +1599,13 @@ priority, matches any code unit, and always consumes a single code unit.
|
||||
.B \fB\-Wunreachable\-rules\fP
|
||||
Warn about rules that are shadowed by other rules and will never match.
|
||||
.TP
|
||||
.B \fB\-Wdeprecated\-eof_rule\fP
|
||||
Warn about standalone end of input rules \fB$\fP that will be broken by the
|
||||
future changes and require fixing. At the moment these rules take precedence
|
||||
when conflicting with other rules, but after the introduction of generalized
|
||||
end of input symbol \fB$\fP precedence order will change and these rules will
|
||||
become shadowed by other rules.
|
||||
.TP
|
||||
.B \fB\-Wuseless\-escape\fP
|
||||
Warn if a symbol is escaped when it shouldn\(aqt be.
|
||||
By default, re2ocaml silently ignores such escapes, but this may as well
|
||||
@@ -1648,7 +1673,7 @@ A list of supported codegen targets with possible elements \fBcode\fP,
|
||||
.B \fBsupported_features\fP
|
||||
A list of supported features with possible elements \fBnested\-ifs\fP,
|
||||
\fBbitmaps\fP, \fBcomputed\-gotos\fP, \fBcase\-ranges\fP, \fBmonadic\fP, \fBunsafe\fP,
|
||||
\fBtags\fP, \fBcaptures\fP, \fBcaptvars\fP\&.
|
||||
\fBtags\fP, \fBcaptures\fP, \fBcaptvars\fP, \fBcomputed\-continue\fP\&.
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
@@ -1912,12 +1937,15 @@ Default switch case.
|
||||
.TP
|
||||
.B \fBcode:loop\fP
|
||||
A loop that runs forever (unless interrupted from the loop body).
|
||||
Supported variables: \fBlabel\fP (loop label), \fBstmt\fP (a list variable
|
||||
that expands to all statements in the loop body).
|
||||
Supported variables: \fBlabel\fP (loop label), \fBval\fP (initial state),
|
||||
\fBvar\fP (state variable), \fBstate\fP (a list variable that expands to all
|
||||
state names) and \fBstmt\fP (a list variable that expands to all statements
|
||||
in the loop body or the current state).
|
||||
.TP
|
||||
.B \fBcode:continue\fP
|
||||
Continue statement. Supported variables: \fBlabel\fP (label from which to
|
||||
continue execution).
|
||||
continue execution), \fBval\fP (value passed to a labeled switch) and \fBvar\fP
|
||||
(state variable).
|
||||
.TP
|
||||
.B \fBcode:goto\fP
|
||||
Goto statement. Supported variables: \fBlabel\fP (label of the jump
|
||||
@@ -2155,6 +2183,10 @@ Supported variables: \fBYYLESSTHAN\fP, \fBYYCURSOR\fP, \fBYYLIMIT\fP,
|
||||
\fBneed\fP (the number of code units to check against). Conditional:
|
||||
\fB\&.many\fP (true if the \fBneed\fP is more than one).
|
||||
.TP
|
||||
.B \fBcode:yyend\fP
|
||||
\fBYYEND\fP expression, possibly specialized for different APIs.
|
||||
Supported variables: \fBYYEND\fP, \fBYYCURSOR\fP, \fBYYLIMIT\fP\&.
|
||||
.TP
|
||||
.B \fBcode:yybm_filter\fP
|
||||
Condition that is used to filter out \fByych\fP values that are not
|
||||
covered by the \fByybm\fP table (used with \fB\-\-bitmaps\fP option).
|
||||
@@ -2221,6 +2253,10 @@ True if case ranges feature is enabled (\fB\-\-case\-ranges\fP or
|
||||
True if the relative form of computed \fBgoto\fP is used
|
||||
(\fB\-\-computed\-gotos\-relative\fP or \fBre2c:cgoto:relative = 1\fP).
|
||||
.TP
|
||||
.B \fB\&.computed_continue\fP
|
||||
True if loop/switch model uses labeled\-switch transitions
|
||||
(\fB\-\-computed\-continue\fP).
|
||||
.TP
|
||||
.B \fB\&.code_model.goto_label\fP
|
||||
True if code model based on goto/label is used (\fB\-\-goto\-label\fP).
|
||||
.TP
|
||||
@@ -2256,6 +2292,9 @@ languages that have \(dqunsafe\(dq feature.
|
||||
.B \fB\&.version\fP
|
||||
True if the generated fingerprint should contain re2ocaml version.
|
||||
.TP
|
||||
.B \fB\&.yyfill.enable\fP
|
||||
True if \fBYYFILL\fP is enabled (\fBre2c:yyfill:enable = 1\fP).
|
||||
.TP
|
||||
.B \fB\&.yyfn.throw\fP
|
||||
True if \fBre2c:yyfn:throw\fP configuration is defined to a nonempty string.
|
||||
.UNINDENT
|
||||
@@ -3975,8 +4014,9 @@ fixed\-length Unicode encoding with code space \fB[0\-0x10FFFF]\fP and 4\-byte c
|
||||
points and code units.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Include file \fBinclude/unicode_categories.re\fP provides re2ocaml definitions for the
|
||||
standard Unicode categories.
|
||||
Include files \fBinclude/unicode_blocks.re\fP, \fBinclude/unicode_categories.re\fP
|
||||
and \fBinclude/unicode_properties.re\fP provide re2ocaml definitions for blocks,
|
||||
categories and properties described in the Unicode standard.
|
||||
.sp
|
||||
Option \fB\-\-input\-encoding\fP specifies source file encoding, which can be used to
|
||||
enable Unicode literals in regular expressions. For example
|
||||
|
||||
+48
-8
@@ -821,6 +821,9 @@ variable named \fBstag\fP\&.
|
||||
.B \fB#mtag\fP
|
||||
An \fIm\-tag\fP: saves all input positions at which \fB#mtag\fP matches in a
|
||||
variable named \fBmtag\fP\&.
|
||||
.TP
|
||||
.B \fB$\fP
|
||||
End of input.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Character classes and string literals may contain the following escape
|
||||
@@ -929,7 +932,8 @@ It contains primitives for generic operations:
|
||||
\fBYYSHIFT\fP,
|
||||
\fBYYSHIFTSTAG\fP,
|
||||
\fBYYSHIFTMTAG\fP,
|
||||
\fBYYLESSTHAN\fP\&.
|
||||
\fBYYLESSTHAN\fP,
|
||||
\fBYYEND\fP\&.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Here is a full list of API primitives that may be used by the generated code in
|
||||
@@ -998,6 +1002,14 @@ A generic API primitive with one variable \fBlen\fP\&.
|
||||
It should be defined as an r\-value of boolean type that equals \fBtrue\fP if
|
||||
and only if there are less than \fBlen\fP input characters left.
|
||||
.TP
|
||||
.B \fBYYEND\fP
|
||||
A generic API primitive with no variables.
|
||||
It should be defined as an r\-value of boolean type that equals \fBtrue\fP if
|
||||
and only if the \fIlogical\fP end of input has been reached (excluding any
|
||||
padding or sentinel symbols). \fBYYEND\fP is used to implement \fB$\fP symbol in
|
||||
regular expressions. It differs from \fBYYLESSTHAN\fP, which is used to ensure
|
||||
that the lexer won\(aqt read past the end of buffer.
|
||||
.TP
|
||||
.B \fBYYPEEK\fP
|
||||
A generic API primitive with no variables.
|
||||
It should be defined as an r\-value of type \fBYYCTYPE\fP that is equal to the
|
||||
@@ -1181,7 +1193,7 @@ Show help message.
|
||||
.TP
|
||||
.B \fB\-\-api <simple | record | generic>\fP
|
||||
Specify the API used by the generated code to interface with used\-defined
|
||||
code. Option \fBsimple\fP shold be used in simple cases when there\(aqs no need
|
||||
code. Option \fBsimple\fP should be used in simple cases when there\(aqs no need
|
||||
for buffer refilling and storing lexer state. Option \fBrecord\fP should be
|
||||
used when lexer state needs to be stored in a record (struct, class, etc.).
|
||||
Option \fBgeneric\fP should be used in complex cases when the other two APIs
|
||||
@@ -1318,6 +1330,12 @@ variable \fByystate\fP\&. Transitions between states update \fByystate\fP to the
|
||||
case label of the destination state and continue execution to the head of
|
||||
the loop.
|
||||
.TP
|
||||
.B \fB\-\-computed\-continue\fP
|
||||
This option requires the \fB\-\-loop\-switch\fP code model. It uses computed
|
||||
\fBcontinue\fP statements to select the next switch case directly, enabling
|
||||
jump\-table optimization similar to \fB\-\-computed\-gotos\fP in the goto/label
|
||||
code model.
|
||||
.TP
|
||||
.B \fB\-\-nested\-ifs \-s\fP
|
||||
Use nested \fBif\fP statements instead of \fBswitch\fP statements in conditional
|
||||
jumps. This usually results in more efficient code with non\-optimizing
|
||||
@@ -1581,6 +1599,13 @@ priority, matches any code unit, and always consumes a single code unit.
|
||||
.B \fB\-Wunreachable\-rules\fP
|
||||
Warn about rules that are shadowed by other rules and will never match.
|
||||
.TP
|
||||
.B \fB\-Wdeprecated\-eof_rule\fP
|
||||
Warn about standalone end of input rules \fB$\fP that will be broken by the
|
||||
future changes and require fixing. At the moment these rules take precedence
|
||||
when conflicting with other rules, but after the introduction of generalized
|
||||
end of input symbol \fB$\fP precedence order will change and these rules will
|
||||
become shadowed by other rules.
|
||||
.TP
|
||||
.B \fB\-Wuseless\-escape\fP
|
||||
Warn if a symbol is escaped when it shouldn\(aqt be.
|
||||
By default, re2py silently ignores such escapes, but this may as well
|
||||
@@ -1648,7 +1673,7 @@ A list of supported codegen targets with possible elements \fBcode\fP,
|
||||
.B \fBsupported_features\fP
|
||||
A list of supported features with possible elements \fBnested\-ifs\fP,
|
||||
\fBbitmaps\fP, \fBcomputed\-gotos\fP, \fBcase\-ranges\fP, \fBmonadic\fP, \fBunsafe\fP,
|
||||
\fBtags\fP, \fBcaptures\fP, \fBcaptvars\fP\&.
|
||||
\fBtags\fP, \fBcaptures\fP, \fBcaptvars\fP, \fBcomputed\-continue\fP\&.
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
@@ -1912,12 +1937,15 @@ Default switch case.
|
||||
.TP
|
||||
.B \fBcode:loop\fP
|
||||
A loop that runs forever (unless interrupted from the loop body).
|
||||
Supported variables: \fBlabel\fP (loop label), \fBstmt\fP (a list variable
|
||||
that expands to all statements in the loop body).
|
||||
Supported variables: \fBlabel\fP (loop label), \fBval\fP (initial state),
|
||||
\fBvar\fP (state variable), \fBstate\fP (a list variable that expands to all
|
||||
state names) and \fBstmt\fP (a list variable that expands to all statements
|
||||
in the loop body or the current state).
|
||||
.TP
|
||||
.B \fBcode:continue\fP
|
||||
Continue statement. Supported variables: \fBlabel\fP (label from which to
|
||||
continue execution).
|
||||
continue execution), \fBval\fP (value passed to a labeled switch) and \fBvar\fP
|
||||
(state variable).
|
||||
.TP
|
||||
.B \fBcode:goto\fP
|
||||
Goto statement. Supported variables: \fBlabel\fP (label of the jump
|
||||
@@ -2155,6 +2183,10 @@ Supported variables: \fBYYLESSTHAN\fP, \fBYYCURSOR\fP, \fBYYLIMIT\fP,
|
||||
\fBneed\fP (the number of code units to check against). Conditional:
|
||||
\fB\&.many\fP (true if the \fBneed\fP is more than one).
|
||||
.TP
|
||||
.B \fBcode:yyend\fP
|
||||
\fBYYEND\fP expression, possibly specialized for different APIs.
|
||||
Supported variables: \fBYYEND\fP, \fBYYCURSOR\fP, \fBYYLIMIT\fP\&.
|
||||
.TP
|
||||
.B \fBcode:yybm_filter\fP
|
||||
Condition that is used to filter out \fByych\fP values that are not
|
||||
covered by the \fByybm\fP table (used with \fB\-\-bitmaps\fP option).
|
||||
@@ -2221,6 +2253,10 @@ True if case ranges feature is enabled (\fB\-\-case\-ranges\fP or
|
||||
True if the relative form of computed \fBgoto\fP is used
|
||||
(\fB\-\-computed\-gotos\-relative\fP or \fBre2c:cgoto:relative = 1\fP).
|
||||
.TP
|
||||
.B \fB\&.computed_continue\fP
|
||||
True if loop/switch model uses labeled\-switch transitions
|
||||
(\fB\-\-computed\-continue\fP).
|
||||
.TP
|
||||
.B \fB\&.code_model.goto_label\fP
|
||||
True if code model based on goto/label is used (\fB\-\-goto\-label\fP).
|
||||
.TP
|
||||
@@ -2256,6 +2292,9 @@ languages that have \(dqunsafe\(dq feature.
|
||||
.B \fB\&.version\fP
|
||||
True if the generated fingerprint should contain re2py version.
|
||||
.TP
|
||||
.B \fB\&.yyfill.enable\fP
|
||||
True if \fBYYFILL\fP is enabled (\fBre2c:yyfill:enable = 1\fP).
|
||||
.TP
|
||||
.B \fB\&.yyfn.throw\fP
|
||||
True if \fBre2c:yyfn:throw\fP configuration is defined to a nonempty string.
|
||||
.UNINDENT
|
||||
@@ -3853,8 +3892,9 @@ fixed\-length Unicode encoding with code space \fB[0\-0x10FFFF]\fP and 4\-byte c
|
||||
points and code units.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Include file \fBinclude/unicode_categories.re\fP provides re2py definitions for the
|
||||
standard Unicode categories.
|
||||
Include files \fBinclude/unicode_blocks.re\fP, \fBinclude/unicode_categories.re\fP
|
||||
and \fBinclude/unicode_properties.re\fP provide re2py definitions for blocks,
|
||||
categories and properties described in the Unicode standard.
|
||||
.sp
|
||||
Option \fB\-\-input\-encoding\fP specifies source file encoding, which can be used to
|
||||
enable Unicode literals in regular expressions. For example
|
||||
|
||||
+49
-8
@@ -836,6 +836,9 @@ variable named \fBstag\fP\&.
|
||||
.B \fB#mtag\fP
|
||||
An \fIm\-tag\fP: saves all input positions at which \fB#mtag\fP matches in a
|
||||
variable named \fBmtag\fP\&.
|
||||
.TP
|
||||
.B \fB$\fP
|
||||
End of input.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Character classes and string literals may contain the following escape
|
||||
@@ -946,7 +949,8 @@ This API contains primitives for generic operations:
|
||||
\fBYYSHIFT\fP,
|
||||
\fBYYSHIFTSTAG\fP,
|
||||
\fBYYSHIFTMTAG\fP,
|
||||
\fBYYLESSTHAN\fP\&.
|
||||
\fBYYLESSTHAN\fP,
|
||||
\fBYYEND\fP\&.
|
||||
For example, if the input is a byte slice \fBbuffer: &[u8]\fP, variables
|
||||
\fBcursor\fP, \fBlimit\fP, \fBmarker\fP and \fBctxmarker\fP of type \fBusize\fP
|
||||
represent input positions, and a constant \fBNONE\fP represents invalid
|
||||
@@ -965,6 +969,7 @@ position, then generic API can be defined as follows:
|
||||
re2c:YYRESTORECTX = \(dqcursor = ctxmarker;\(dq;
|
||||
re2c:YYRESTORETAG = \(dqcursor = @@{tag};\(dq;
|
||||
re2c:YYLESSTHAN = \(dqlimit \- cursor < @@{len}\(dq;
|
||||
re2c:YYEND = \(dqlimit == cursor\(dq;
|
||||
re2c:YYSTAGP = \(dq@@{tag} = cursor;\(dq;
|
||||
re2c:YYSTAGN = \(dq@@{tag} = NONE;\(dq;
|
||||
re2c:YYSHIFT = \(dqcursor = (cursor as isize + @@{shift}) as usize;\(dq;
|
||||
@@ -1042,6 +1047,14 @@ A generic API primitive with one variable \fBlen\fP\&.
|
||||
It should be defined as an r\-value of boolean type that equals \fBtrue\fP if
|
||||
and only if there are less than \fBlen\fP input characters left.
|
||||
.TP
|
||||
.B \fBYYEND\fP
|
||||
A generic API primitive with no variables.
|
||||
It should be defined as an r\-value of boolean type that equals \fBtrue\fP if
|
||||
and only if the \fIlogical\fP end of input has been reached (excluding any
|
||||
padding or sentinel symbols). \fBYYEND\fP is used to implement \fB$\fP symbol in
|
||||
regular expressions. It differs from \fBYYLESSTHAN\fP, which is used to ensure
|
||||
that the lexer won\(aqt read past the end of buffer.
|
||||
.TP
|
||||
.B \fBYYPEEK\fP
|
||||
A generic API primitive with no variables.
|
||||
It should be defined as an r\-value of type \fBYYCTYPE\fP that is equal to the
|
||||
@@ -1225,7 +1238,7 @@ Show help message.
|
||||
.TP
|
||||
.B \fB\-\-api <simple | record | generic>\fP
|
||||
Specify the API used by the generated code to interface with used\-defined
|
||||
code. Option \fBsimple\fP shold be used in simple cases when there\(aqs no need
|
||||
code. Option \fBsimple\fP should be used in simple cases when there\(aqs no need
|
||||
for buffer refilling and storing lexer state. Option \fBrecord\fP should be
|
||||
used when lexer state needs to be stored in a record (struct, class, etc.).
|
||||
Option \fBgeneric\fP should be used in complex cases when the other two APIs
|
||||
@@ -1362,6 +1375,12 @@ variable \fByystate\fP\&. Transitions between states update \fByystate\fP to the
|
||||
case label of the destination state and continue execution to the head of
|
||||
the loop.
|
||||
.TP
|
||||
.B \fB\-\-computed\-continue\fP
|
||||
This option requires the \fB\-\-loop\-switch\fP code model. It uses computed
|
||||
\fBcontinue\fP statements to select the next switch case directly, enabling
|
||||
jump\-table optimization similar to \fB\-\-computed\-gotos\fP in the goto/label
|
||||
code model.
|
||||
.TP
|
||||
.B \fB\-\-nested\-ifs \-s\fP
|
||||
Use nested \fBif\fP statements instead of \fBswitch\fP statements in conditional
|
||||
jumps. This usually results in more efficient code with non\-optimizing
|
||||
@@ -1625,6 +1644,13 @@ priority, matches any code unit, and always consumes a single code unit.
|
||||
.B \fB\-Wunreachable\-rules\fP
|
||||
Warn about rules that are shadowed by other rules and will never match.
|
||||
.TP
|
||||
.B \fB\-Wdeprecated\-eof_rule\fP
|
||||
Warn about standalone end of input rules \fB$\fP that will be broken by the
|
||||
future changes and require fixing. At the moment these rules take precedence
|
||||
when conflicting with other rules, but after the introduction of generalized
|
||||
end of input symbol \fB$\fP precedence order will change and these rules will
|
||||
become shadowed by other rules.
|
||||
.TP
|
||||
.B \fB\-Wuseless\-escape\fP
|
||||
Warn if a symbol is escaped when it shouldn\(aqt be.
|
||||
By default, re2rust silently ignores such escapes, but this may as well
|
||||
@@ -1692,7 +1718,7 @@ A list of supported codegen targets with possible elements \fBcode\fP,
|
||||
.B \fBsupported_features\fP
|
||||
A list of supported features with possible elements \fBnested\-ifs\fP,
|
||||
\fBbitmaps\fP, \fBcomputed\-gotos\fP, \fBcase\-ranges\fP, \fBmonadic\fP, \fBunsafe\fP,
|
||||
\fBtags\fP, \fBcaptures\fP, \fBcaptvars\fP\&.
|
||||
\fBtags\fP, \fBcaptures\fP, \fBcaptvars\fP, \fBcomputed\-continue\fP\&.
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
@@ -1956,12 +1982,15 @@ Default switch case.
|
||||
.TP
|
||||
.B \fBcode:loop\fP
|
||||
A loop that runs forever (unless interrupted from the loop body).
|
||||
Supported variables: \fBlabel\fP (loop label), \fBstmt\fP (a list variable
|
||||
that expands to all statements in the loop body).
|
||||
Supported variables: \fBlabel\fP (loop label), \fBval\fP (initial state),
|
||||
\fBvar\fP (state variable), \fBstate\fP (a list variable that expands to all
|
||||
state names) and \fBstmt\fP (a list variable that expands to all statements
|
||||
in the loop body or the current state).
|
||||
.TP
|
||||
.B \fBcode:continue\fP
|
||||
Continue statement. Supported variables: \fBlabel\fP (label from which to
|
||||
continue execution).
|
||||
continue execution), \fBval\fP (value passed to a labeled switch) and \fBvar\fP
|
||||
(state variable).
|
||||
.TP
|
||||
.B \fBcode:goto\fP
|
||||
Goto statement. Supported variables: \fBlabel\fP (label of the jump
|
||||
@@ -2199,6 +2228,10 @@ Supported variables: \fBYYLESSTHAN\fP, \fBYYCURSOR\fP, \fBYYLIMIT\fP,
|
||||
\fBneed\fP (the number of code units to check against). Conditional:
|
||||
\fB\&.many\fP (true if the \fBneed\fP is more than one).
|
||||
.TP
|
||||
.B \fBcode:yyend\fP
|
||||
\fBYYEND\fP expression, possibly specialized for different APIs.
|
||||
Supported variables: \fBYYEND\fP, \fBYYCURSOR\fP, \fBYYLIMIT\fP\&.
|
||||
.TP
|
||||
.B \fBcode:yybm_filter\fP
|
||||
Condition that is used to filter out \fByych\fP values that are not
|
||||
covered by the \fByybm\fP table (used with \fB\-\-bitmaps\fP option).
|
||||
@@ -2265,6 +2298,10 @@ True if case ranges feature is enabled (\fB\-\-case\-ranges\fP or
|
||||
True if the relative form of computed \fBgoto\fP is used
|
||||
(\fB\-\-computed\-gotos\-relative\fP or \fBre2c:cgoto:relative = 1\fP).
|
||||
.TP
|
||||
.B \fB\&.computed_continue\fP
|
||||
True if loop/switch model uses labeled\-switch transitions
|
||||
(\fB\-\-computed\-continue\fP).
|
||||
.TP
|
||||
.B \fB\&.code_model.goto_label\fP
|
||||
True if code model based on goto/label is used (\fB\-\-goto\-label\fP).
|
||||
.TP
|
||||
@@ -2300,6 +2337,9 @@ languages that have \(dqunsafe\(dq feature.
|
||||
.B \fB\&.version\fP
|
||||
True if the generated fingerprint should contain re2rust version.
|
||||
.TP
|
||||
.B \fB\&.yyfill.enable\fP
|
||||
True if \fBYYFILL\fP is enabled (\fBre2c:yyfill:enable = 1\fP).
|
||||
.TP
|
||||
.B \fB\&.yyfn.throw\fP
|
||||
True if \fBre2c:yyfn:throw\fP configuration is defined to a nonempty string.
|
||||
.UNINDENT
|
||||
@@ -4092,8 +4132,9 @@ fixed\-length Unicode encoding with code space \fB[0\-0x10FFFF]\fP and 4\-byte c
|
||||
points and code units.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Include file \fBinclude/unicode_categories.re\fP provides re2rust definitions for the
|
||||
standard Unicode categories.
|
||||
Include files \fBinclude/unicode_blocks.re\fP, \fBinclude/unicode_categories.re\fP
|
||||
and \fBinclude/unicode_properties.re\fP provide re2rust definitions for blocks,
|
||||
categories and properties described in the Unicode standard.
|
||||
.sp
|
||||
Option \fB\-\-input\-encoding\fP specifies source file encoding, which can be used to
|
||||
enable Unicode literals in regular expressions. For example
|
||||
|
||||
@@ -822,6 +822,9 @@ variable named \fBstag\fP\&.
|
||||
.B \fB#mtag\fP
|
||||
An \fIm\-tag\fP: saves all input positions at which \fB#mtag\fP matches in a
|
||||
variable named \fBmtag\fP\&.
|
||||
.TP
|
||||
.B \fB$\fP
|
||||
End of input.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Character classes and string literals may contain the following escape
|
||||
@@ -930,7 +933,8 @@ This API contains the following primitives for generic operations:
|
||||
\fBYYSHIFT\fP,
|
||||
\fBYYSHIFTSTAG\fP,
|
||||
\fBYYSHIFTMTAG\fP,
|
||||
\fBYYLESSTHAN\fP\&.
|
||||
\fBYYLESSTHAN\fP,
|
||||
\fBYYEND\fP\&.
|
||||
For example, if the input is a zero\-terminated array of bytes
|
||||
\fBbuffer: [UInt8]\fP, variables \fBcursor\fP, \fBlimit\fP, \fBmarker\fP and
|
||||
\fBctxmarker\fP of type \fBInt\fP represent input positions, and \fB\-1\fP
|
||||
@@ -949,6 +953,7 @@ represents invalid positions, then a generic API can be defined as follows:
|
||||
re2c:YYRESTORECTX = \(dqcursor = ctxmarker\(dq;
|
||||
re2c:YYRESTORETAG = \(dqcursor = ${tag}\(dq;
|
||||
re2c:YYLESSTHAN = \(dqlimit \- cursor < @@{len}\(dq;
|
||||
re2c:YYEND = \(dqlimit == cursor\(dq;
|
||||
re2c:YYSTAGP = \(dq@@{tag} = cursor\(dq;
|
||||
re2c:YYSTAGN = \(dq@@{tag} = \-1\(dq;
|
||||
re2c:YYSHIFT = \(dqcursor += @@{shift}\(dq;
|
||||
@@ -1026,6 +1031,14 @@ A generic API primitive with one variable \fBlen\fP\&.
|
||||
It should be defined as an r\-value of boolean type that equals \fBtrue\fP if
|
||||
and only if there are less than \fBlen\fP input characters left.
|
||||
.TP
|
||||
.B \fBYYEND\fP
|
||||
A generic API primitive with no variables.
|
||||
It should be defined as an r\-value of boolean type that equals \fBtrue\fP if
|
||||
and only if the \fIlogical\fP end of input has been reached (excluding any
|
||||
padding or sentinel symbols). \fBYYEND\fP is used to implement \fB$\fP symbol in
|
||||
regular expressions. It differs from \fBYYLESSTHAN\fP, which is used to ensure
|
||||
that the lexer won\(aqt read past the end of buffer.
|
||||
.TP
|
||||
.B \fBYYPEEK\fP
|
||||
A generic API primitive with no variables.
|
||||
It should be defined as an r\-value of type \fBYYCTYPE\fP that is equal to the
|
||||
@@ -1209,7 +1222,7 @@ Show help message.
|
||||
.TP
|
||||
.B \fB\-\-api <simple | record | generic>\fP
|
||||
Specify the API used by the generated code to interface with used\-defined
|
||||
code. Option \fBsimple\fP shold be used in simple cases when there\(aqs no need
|
||||
code. Option \fBsimple\fP should be used in simple cases when there\(aqs no need
|
||||
for buffer refilling and storing lexer state. Option \fBrecord\fP should be
|
||||
used when lexer state needs to be stored in a record (struct, class, etc.).
|
||||
Option \fBgeneric\fP should be used in complex cases when the other two APIs
|
||||
@@ -1346,6 +1359,12 @@ variable \fByystate\fP\&. Transitions between states update \fByystate\fP to the
|
||||
case label of the destination state and continue execution to the head of
|
||||
the loop.
|
||||
.TP
|
||||
.B \fB\-\-computed\-continue\fP
|
||||
This option requires the \fB\-\-loop\-switch\fP code model. It uses computed
|
||||
\fBcontinue\fP statements to select the next switch case directly, enabling
|
||||
jump\-table optimization similar to \fB\-\-computed\-gotos\fP in the goto/label
|
||||
code model.
|
||||
.TP
|
||||
.B \fB\-\-nested\-ifs \-s\fP
|
||||
Use nested \fBif\fP statements instead of \fBswitch\fP statements in conditional
|
||||
jumps. This usually results in more efficient code with non\-optimizing
|
||||
@@ -1609,6 +1628,13 @@ priority, matches any code unit, and always consumes a single code unit.
|
||||
.B \fB\-Wunreachable\-rules\fP
|
||||
Warn about rules that are shadowed by other rules and will never match.
|
||||
.TP
|
||||
.B \fB\-Wdeprecated\-eof_rule\fP
|
||||
Warn about standalone end of input rules \fB$\fP that will be broken by the
|
||||
future changes and require fixing. At the moment these rules take precedence
|
||||
when conflicting with other rules, but after the introduction of generalized
|
||||
end of input symbol \fB$\fP precedence order will change and these rules will
|
||||
become shadowed by other rules.
|
||||
.TP
|
||||
.B \fB\-Wuseless\-escape\fP
|
||||
Warn if a symbol is escaped when it shouldn\(aqt be.
|
||||
By default, re2swift silently ignores such escapes, but this may as well
|
||||
@@ -1676,7 +1702,7 @@ A list of supported codegen targets with possible elements \fBcode\fP,
|
||||
.B \fBsupported_features\fP
|
||||
A list of supported features with possible elements \fBnested\-ifs\fP,
|
||||
\fBbitmaps\fP, \fBcomputed\-gotos\fP, \fBcase\-ranges\fP, \fBmonadic\fP, \fBunsafe\fP,
|
||||
\fBtags\fP, \fBcaptures\fP, \fBcaptvars\fP\&.
|
||||
\fBtags\fP, \fBcaptures\fP, \fBcaptvars\fP, \fBcomputed\-continue\fP\&.
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
@@ -1940,12 +1966,15 @@ Default switch case.
|
||||
.TP
|
||||
.B \fBcode:loop\fP
|
||||
A loop that runs forever (unless interrupted from the loop body).
|
||||
Supported variables: \fBlabel\fP (loop label), \fBstmt\fP (a list variable
|
||||
that expands to all statements in the loop body).
|
||||
Supported variables: \fBlabel\fP (loop label), \fBval\fP (initial state),
|
||||
\fBvar\fP (state variable), \fBstate\fP (a list variable that expands to all
|
||||
state names) and \fBstmt\fP (a list variable that expands to all statements
|
||||
in the loop body or the current state).
|
||||
.TP
|
||||
.B \fBcode:continue\fP
|
||||
Continue statement. Supported variables: \fBlabel\fP (label from which to
|
||||
continue execution).
|
||||
continue execution), \fBval\fP (value passed to a labeled switch) and \fBvar\fP
|
||||
(state variable).
|
||||
.TP
|
||||
.B \fBcode:goto\fP
|
||||
Goto statement. Supported variables: \fBlabel\fP (label of the jump
|
||||
@@ -2183,6 +2212,10 @@ Supported variables: \fBYYLESSTHAN\fP, \fBYYCURSOR\fP, \fBYYLIMIT\fP,
|
||||
\fBneed\fP (the number of code units to check against). Conditional:
|
||||
\fB\&.many\fP (true if the \fBneed\fP is more than one).
|
||||
.TP
|
||||
.B \fBcode:yyend\fP
|
||||
\fBYYEND\fP expression, possibly specialized for different APIs.
|
||||
Supported variables: \fBYYEND\fP, \fBYYCURSOR\fP, \fBYYLIMIT\fP\&.
|
||||
.TP
|
||||
.B \fBcode:yybm_filter\fP
|
||||
Condition that is used to filter out \fByych\fP values that are not
|
||||
covered by the \fByybm\fP table (used with \fB\-\-bitmaps\fP option).
|
||||
@@ -2249,6 +2282,10 @@ True if case ranges feature is enabled (\fB\-\-case\-ranges\fP or
|
||||
True if the relative form of computed \fBgoto\fP is used
|
||||
(\fB\-\-computed\-gotos\-relative\fP or \fBre2c:cgoto:relative = 1\fP).
|
||||
.TP
|
||||
.B \fB\&.computed_continue\fP
|
||||
True if loop/switch model uses labeled\-switch transitions
|
||||
(\fB\-\-computed\-continue\fP).
|
||||
.TP
|
||||
.B \fB\&.code_model.goto_label\fP
|
||||
True if code model based on goto/label is used (\fB\-\-goto\-label\fP).
|
||||
.TP
|
||||
@@ -2284,6 +2321,9 @@ languages that have \(dqunsafe\(dq feature.
|
||||
.B \fB\&.version\fP
|
||||
True if the generated fingerprint should contain re2swift version.
|
||||
.TP
|
||||
.B \fB\&.yyfill.enable\fP
|
||||
True if \fBYYFILL\fP is enabled (\fBre2c:yyfill:enable = 1\fP).
|
||||
.TP
|
||||
.B \fB\&.yyfn.throw\fP
|
||||
True if \fBre2c:yyfn:throw\fP configuration is defined to a nonempty string.
|
||||
.UNINDENT
|
||||
@@ -4077,8 +4117,9 @@ fixed\-length Unicode encoding with code space \fB[0\-0x10FFFF]\fP and 4\-byte c
|
||||
points and code units.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Include file \fBinclude/unicode_categories.re\fP provides re2swift definitions for the
|
||||
standard Unicode categories.
|
||||
Include files \fBinclude/unicode_blocks.re\fP, \fBinclude/unicode_categories.re\fP
|
||||
and \fBinclude/unicode_properties.re\fP provide re2swift definitions for blocks,
|
||||
categories and properties described in the Unicode standard.
|
||||
.sp
|
||||
Option \fB\-\-input\-encoding\fP specifies source file encoding, which can be used to
|
||||
enable Unicode literals in regular expressions. For example
|
||||
|
||||
+59
-18
@@ -84,7 +84,7 @@ In the output re2v replaced the block in the middle with the generated code:
|
||||
fn lex(yyinput string) {
|
||||
mut yycursor := 0
|
||||
|
||||
mut yych := 0
|
||||
mut yych := u8(0)
|
||||
yych = yyinput[yycursor]
|
||||
match yych {
|
||||
0x31...0x39 { unsafe { goto yy2 } }
|
||||
@@ -813,6 +813,9 @@ variable named \fBstag\fP\&.
|
||||
.B \fB#mtag\fP
|
||||
An \fIm\-tag\fP: saves all input positions at which \fB#mtag\fP matches in a
|
||||
variable named \fBmtag\fP\&.
|
||||
.TP
|
||||
.B \fB$\fP
|
||||
End of input.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Character classes and string literals may contain the following escape
|
||||
@@ -921,7 +924,8 @@ It contains primitives for generic operations:
|
||||
\fBYYSHIFT\fP,
|
||||
\fBYYSHIFTSTAG\fP,
|
||||
\fBYYSHIFTMTAG\fP,
|
||||
\fBYYLESSTHAN\fP\&.
|
||||
\fBYYLESSTHAN\fP,
|
||||
\fBYYEND\fP\&.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Here is a full list of API primitives that may be used by the generated code in
|
||||
@@ -990,6 +994,14 @@ A generic API primitive with one variable \fBlen\fP\&.
|
||||
It should be defined as an r\-value of boolean type that equals \fBtrue\fP if
|
||||
and only if there are less than \fBlen\fP input characters left.
|
||||
.TP
|
||||
.B \fBYYEND\fP
|
||||
A generic API primitive with no variables.
|
||||
It should be defined as an r\-value of boolean type that equals \fBtrue\fP if
|
||||
and only if the \fIlogical\fP end of input has been reached (excluding any
|
||||
padding or sentinel symbols). \fBYYEND\fP is used to implement \fB$\fP symbol in
|
||||
regular expressions. It differs from \fBYYLESSTHAN\fP, which is used to ensure
|
||||
that the lexer won\(aqt read past the end of buffer.
|
||||
.TP
|
||||
.B \fBYYPEEK\fP
|
||||
A generic API primitive with no variables.
|
||||
It should be defined as an r\-value of type \fBYYCTYPE\fP that is equal to the
|
||||
@@ -1173,7 +1185,7 @@ Show help message.
|
||||
.TP
|
||||
.B \fB\-\-api <simple | record | generic>\fP
|
||||
Specify the API used by the generated code to interface with used\-defined
|
||||
code. Option \fBsimple\fP shold be used in simple cases when there\(aqs no need
|
||||
code. Option \fBsimple\fP should be used in simple cases when there\(aqs no need
|
||||
for buffer refilling and storing lexer state. Option \fBrecord\fP should be
|
||||
used when lexer state needs to be stored in a record (struct, class, etc.).
|
||||
Option \fBgeneric\fP should be used in complex cases when the other two APIs
|
||||
@@ -1310,6 +1322,12 @@ variable \fByystate\fP\&. Transitions between states update \fByystate\fP to the
|
||||
case label of the destination state and continue execution to the head of
|
||||
the loop.
|
||||
.TP
|
||||
.B \fB\-\-computed\-continue\fP
|
||||
This option requires the \fB\-\-loop\-switch\fP code model. It uses computed
|
||||
\fBcontinue\fP statements to select the next switch case directly, enabling
|
||||
jump\-table optimization similar to \fB\-\-computed\-gotos\fP in the goto/label
|
||||
code model.
|
||||
.TP
|
||||
.B \fB\-\-nested\-ifs \-s\fP
|
||||
Use nested \fBif\fP statements instead of \fBswitch\fP statements in conditional
|
||||
jumps. This usually results in more efficient code with non\-optimizing
|
||||
@@ -1573,6 +1591,13 @@ priority, matches any code unit, and always consumes a single code unit.
|
||||
.B \fB\-Wunreachable\-rules\fP
|
||||
Warn about rules that are shadowed by other rules and will never match.
|
||||
.TP
|
||||
.B \fB\-Wdeprecated\-eof_rule\fP
|
||||
Warn about standalone end of input rules \fB$\fP that will be broken by the
|
||||
future changes and require fixing. At the moment these rules take precedence
|
||||
when conflicting with other rules, but after the introduction of generalized
|
||||
end of input symbol \fB$\fP precedence order will change and these rules will
|
||||
become shadowed by other rules.
|
||||
.TP
|
||||
.B \fB\-Wuseless\-escape\fP
|
||||
Warn if a symbol is escaped when it shouldn\(aqt be.
|
||||
By default, re2v silently ignores such escapes, but this may as well
|
||||
@@ -1640,7 +1665,7 @@ A list of supported codegen targets with possible elements \fBcode\fP,
|
||||
.B \fBsupported_features\fP
|
||||
A list of supported features with possible elements \fBnested\-ifs\fP,
|
||||
\fBbitmaps\fP, \fBcomputed\-gotos\fP, \fBcase\-ranges\fP, \fBmonadic\fP, \fBunsafe\fP,
|
||||
\fBtags\fP, \fBcaptures\fP, \fBcaptvars\fP\&.
|
||||
\fBtags\fP, \fBcaptures\fP, \fBcaptvars\fP, \fBcomputed\-continue\fP\&.
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
@@ -1904,12 +1929,15 @@ Default switch case.
|
||||
.TP
|
||||
.B \fBcode:loop\fP
|
||||
A loop that runs forever (unless interrupted from the loop body).
|
||||
Supported variables: \fBlabel\fP (loop label), \fBstmt\fP (a list variable
|
||||
that expands to all statements in the loop body).
|
||||
Supported variables: \fBlabel\fP (loop label), \fBval\fP (initial state),
|
||||
\fBvar\fP (state variable), \fBstate\fP (a list variable that expands to all
|
||||
state names) and \fBstmt\fP (a list variable that expands to all statements
|
||||
in the loop body or the current state).
|
||||
.TP
|
||||
.B \fBcode:continue\fP
|
||||
Continue statement. Supported variables: \fBlabel\fP (label from which to
|
||||
continue execution).
|
||||
continue execution), \fBval\fP (value passed to a labeled switch) and \fBvar\fP
|
||||
(state variable).
|
||||
.TP
|
||||
.B \fBcode:goto\fP
|
||||
Goto statement. Supported variables: \fBlabel\fP (label of the jump
|
||||
@@ -2147,6 +2175,10 @@ Supported variables: \fBYYLESSTHAN\fP, \fBYYCURSOR\fP, \fBYYLIMIT\fP,
|
||||
\fBneed\fP (the number of code units to check against). Conditional:
|
||||
\fB\&.many\fP (true if the \fBneed\fP is more than one).
|
||||
.TP
|
||||
.B \fBcode:yyend\fP
|
||||
\fBYYEND\fP expression, possibly specialized for different APIs.
|
||||
Supported variables: \fBYYEND\fP, \fBYYCURSOR\fP, \fBYYLIMIT\fP\&.
|
||||
.TP
|
||||
.B \fBcode:yybm_filter\fP
|
||||
Condition that is used to filter out \fByych\fP values that are not
|
||||
covered by the \fByybm\fP table (used with \fB\-\-bitmaps\fP option).
|
||||
@@ -2213,6 +2245,10 @@ True if case ranges feature is enabled (\fB\-\-case\-ranges\fP or
|
||||
True if the relative form of computed \fBgoto\fP is used
|
||||
(\fB\-\-computed\-gotos\-relative\fP or \fBre2c:cgoto:relative = 1\fP).
|
||||
.TP
|
||||
.B \fB\&.computed_continue\fP
|
||||
True if loop/switch model uses labeled\-switch transitions
|
||||
(\fB\-\-computed\-continue\fP).
|
||||
.TP
|
||||
.B \fB\&.code_model.goto_label\fP
|
||||
True if code model based on goto/label is used (\fB\-\-goto\-label\fP).
|
||||
.TP
|
||||
@@ -2248,6 +2284,9 @@ languages that have \(dqunsafe\(dq feature.
|
||||
.B \fB\&.version\fP
|
||||
True if the generated fingerprint should contain re2v version.
|
||||
.TP
|
||||
.B \fB\&.yyfill.enable\fP
|
||||
True if \fBYYFILL\fP is enabled (\fBre2c:yyfill:enable = 1\fP).
|
||||
.TP
|
||||
.B \fB\&.yyfn.throw\fP
|
||||
True if \fBre2c:yyfn:throw\fP configuration is defined to a nonempty string.
|
||||
.UNINDENT
|
||||
@@ -2738,7 +2777,7 @@ fn main() {
|
||||
}
|
||||
|
||||
// Run the lexer.
|
||||
n := lex(mut st)
|
||||
n := lex(mut &st)
|
||||
if n != count { panic(\(dqexpected $count, got $n\(dq) }
|
||||
|
||||
// Cleanup: remove input file.
|
||||
@@ -2888,7 +2927,7 @@ fn main() {
|
||||
}
|
||||
|
||||
// Run the lexer.
|
||||
n := lex(mut st)
|
||||
n := lex(mut &st)
|
||||
if n != count { panic(\(dqexpected $count, got $n\(dq) }
|
||||
|
||||
// Cleanup: remove input file.
|
||||
@@ -3304,7 +3343,7 @@ fn test(expect Status, packets []string) {
|
||||
mut send := 0
|
||||
mut recv := 0
|
||||
for {
|
||||
status = lex(mut st, mut &recv)
|
||||
status = lex(mut &st, mut &recv)
|
||||
if status == .lex_end {
|
||||
break
|
||||
} else if status == .lex_waiting {
|
||||
@@ -3314,7 +3353,7 @@ fn test(expect Status, packets []string) {
|
||||
fw.flush()
|
||||
send += 1
|
||||
}
|
||||
status = fill(mut st)
|
||||
status = fill(mut &st)
|
||||
log.debug(\(dqfilled buffer $st.yyinput, status $status\(dq)
|
||||
if status != .lex_ready {
|
||||
break
|
||||
@@ -3763,7 +3802,7 @@ fn main() {
|
||||
|
||||
// Run the lexer.
|
||||
expect := []SemVer{len: bufsize, init: SemVer{1, 22, 333}}
|
||||
result := parse(mut st) or { panic(\(dqparse failed\(dq) }
|
||||
result := parse(mut &st) or { panic(\(dqparse failed\(dq) }
|
||||
if result != expect { panic(\(dqerror\(dq) }
|
||||
|
||||
// Cleanup: remove input file.
|
||||
@@ -3866,7 +3905,7 @@ struct MtagElem {
|
||||
type MtagTrie = []MtagElem
|
||||
|
||||
// Append a single value to an m\-tag history.
|
||||
fn add_mtag(mut trie &MtagTrie, mtag int, value int) int {
|
||||
fn add_mtag(mut trie MtagTrie, mtag int, value int) int {
|
||||
trie = arrays.concat(trie, MtagElem{value, mtag})
|
||||
return trie.len \- 1
|
||||
}
|
||||
@@ -3905,7 +3944,8 @@ fn s2n(s string) int { // convert pre\-parsed string to number
|
||||
|
||||
fn parse(yyinput string) ?[]int {
|
||||
mut yycursor, mut yymarker := 0, 0
|
||||
mut trie := []MtagElem{}
|
||||
// mut trie := []MtagElem{}
|
||||
mut trie := MtagTrie{}
|
||||
|
||||
// Final tag variables available in semantic action.
|
||||
/*!svars:re2c format = \(aqmut @@ := tag_none\en\(aq; */
|
||||
@@ -3918,8 +3958,8 @@ fn parse(yyinput string) ?[]int {
|
||||
/*!re2c
|
||||
re2c:tags = 1;
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:YYMTAGP = \(dq@@ = add_mtag(mut &trie, @@, yycursor)\(dq;
|
||||
re2c:YYMTAGN = \(dq@@ = add_mtag(mut &trie, @@, tag_none)\(dq;
|
||||
re2c:YYMTAGP = \(dq@@ = add_mtag(mut trie, @@, yycursor)\(dq;
|
||||
re2c:YYMTAGN = \(dq@@ = add_mtag(mut trie, @@, tag_none)\(dq;
|
||||
|
||||
num = [0\-9]+;
|
||||
|
||||
@@ -3994,8 +4034,9 @@ fixed\-length Unicode encoding with code space \fB[0\-0x10FFFF]\fP and 4\-byte c
|
||||
points and code units.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Include file \fBinclude/unicode_categories.re\fP provides re2v definitions for the
|
||||
standard Unicode categories.
|
||||
Include files \fBinclude/unicode_blocks.re\fP, \fBinclude/unicode_categories.re\fP
|
||||
and \fBinclude/unicode_properties.re\fP provide re2v definitions for blocks,
|
||||
categories and properties described in the Unicode standard.
|
||||
.sp
|
||||
Option \fB\-\-input\-encoding\fP specifies source file encoding, which can be used to
|
||||
enable Unicode literals in regular expressions. For example
|
||||
|
||||
+105
-61
@@ -836,6 +836,9 @@ variable named \fBstag\fP\&.
|
||||
.B \fB#mtag\fP
|
||||
An \fIm\-tag\fP: saves all input positions at which \fB#mtag\fP matches in a
|
||||
variable named \fBmtag\fP\&.
|
||||
.TP
|
||||
.B \fB$\fP
|
||||
End of input.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Character classes and string literals may contain the following escape
|
||||
@@ -944,7 +947,8 @@ It contains primitives for generic operations:
|
||||
\fBYYSHIFT\fP,
|
||||
\fBYYSHIFTSTAG\fP,
|
||||
\fBYYSHIFTMTAG\fP,
|
||||
\fBYYLESSTHAN\fP\&.
|
||||
\fBYYLESSTHAN\fP,
|
||||
\fBYYEND\fP\&.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Here is a full list of API primitives that may be used by the generated code in
|
||||
@@ -1013,6 +1017,14 @@ A generic API primitive with one variable \fBlen\fP\&.
|
||||
It should be defined as an r\-value of boolean type that equals \fBtrue\fP if
|
||||
and only if there are less than \fBlen\fP input characters left.
|
||||
.TP
|
||||
.B \fBYYEND\fP
|
||||
A generic API primitive with no variables.
|
||||
It should be defined as an r\-value of boolean type that equals \fBtrue\fP if
|
||||
and only if the \fIlogical\fP end of input has been reached (excluding any
|
||||
padding or sentinel symbols). \fBYYEND\fP is used to implement \fB$\fP symbol in
|
||||
regular expressions. It differs from \fBYYLESSTHAN\fP, which is used to ensure
|
||||
that the lexer won\(aqt read past the end of buffer.
|
||||
.TP
|
||||
.B \fBYYPEEK\fP
|
||||
A generic API primitive with no variables.
|
||||
It should be defined as an r\-value of type \fBYYCTYPE\fP that is equal to the
|
||||
@@ -1196,7 +1208,7 @@ Show help message.
|
||||
.TP
|
||||
.B \fB\-\-api <simple | record | generic>\fP
|
||||
Specify the API used by the generated code to interface with used\-defined
|
||||
code. Option \fBsimple\fP shold be used in simple cases when there\(aqs no need
|
||||
code. Option \fBsimple\fP should be used in simple cases when there\(aqs no need
|
||||
for buffer refilling and storing lexer state. Option \fBrecord\fP should be
|
||||
used when lexer state needs to be stored in a record (struct, class, etc.).
|
||||
Option \fBgeneric\fP should be used in complex cases when the other two APIs
|
||||
@@ -1333,6 +1345,12 @@ variable \fByystate\fP\&. Transitions between states update \fByystate\fP to the
|
||||
case label of the destination state and continue execution to the head of
|
||||
the loop.
|
||||
.TP
|
||||
.B \fB\-\-computed\-continue\fP
|
||||
This option requires the \fB\-\-loop\-switch\fP code model. It uses computed
|
||||
\fBcontinue\fP statements to select the next switch case directly, enabling
|
||||
jump\-table optimization similar to \fB\-\-computed\-gotos\fP in the goto/label
|
||||
code model.
|
||||
.TP
|
||||
.B \fB\-\-nested\-ifs \-s\fP
|
||||
Use nested \fBif\fP statements instead of \fBswitch\fP statements in conditional
|
||||
jumps. This usually results in more efficient code with non\-optimizing
|
||||
@@ -1596,6 +1614,13 @@ priority, matches any code unit, and always consumes a single code unit.
|
||||
.B \fB\-Wunreachable\-rules\fP
|
||||
Warn about rules that are shadowed by other rules and will never match.
|
||||
.TP
|
||||
.B \fB\-Wdeprecated\-eof_rule\fP
|
||||
Warn about standalone end of input rules \fB$\fP that will be broken by the
|
||||
future changes and require fixing. At the moment these rules take precedence
|
||||
when conflicting with other rules, but after the introduction of generalized
|
||||
end of input symbol \fB$\fP precedence order will change and these rules will
|
||||
become shadowed by other rules.
|
||||
.TP
|
||||
.B \fB\-Wuseless\-escape\fP
|
||||
Warn if a symbol is escaped when it shouldn\(aqt be.
|
||||
By default, re2zig silently ignores such escapes, but this may as well
|
||||
@@ -1663,7 +1688,7 @@ A list of supported codegen targets with possible elements \fBcode\fP,
|
||||
.B \fBsupported_features\fP
|
||||
A list of supported features with possible elements \fBnested\-ifs\fP,
|
||||
\fBbitmaps\fP, \fBcomputed\-gotos\fP, \fBcase\-ranges\fP, \fBmonadic\fP, \fBunsafe\fP,
|
||||
\fBtags\fP, \fBcaptures\fP, \fBcaptvars\fP\&.
|
||||
\fBtags\fP, \fBcaptures\fP, \fBcaptvars\fP, \fBcomputed\-continue\fP\&.
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
@@ -1927,12 +1952,15 @@ Default switch case.
|
||||
.TP
|
||||
.B \fBcode:loop\fP
|
||||
A loop that runs forever (unless interrupted from the loop body).
|
||||
Supported variables: \fBlabel\fP (loop label), \fBstmt\fP (a list variable
|
||||
that expands to all statements in the loop body).
|
||||
Supported variables: \fBlabel\fP (loop label), \fBval\fP (initial state),
|
||||
\fBvar\fP (state variable), \fBstate\fP (a list variable that expands to all
|
||||
state names) and \fBstmt\fP (a list variable that expands to all statements
|
||||
in the loop body or the current state).
|
||||
.TP
|
||||
.B \fBcode:continue\fP
|
||||
Continue statement. Supported variables: \fBlabel\fP (label from which to
|
||||
continue execution).
|
||||
continue execution), \fBval\fP (value passed to a labeled switch) and \fBvar\fP
|
||||
(state variable).
|
||||
.TP
|
||||
.B \fBcode:goto\fP
|
||||
Goto statement. Supported variables: \fBlabel\fP (label of the jump
|
||||
@@ -2170,6 +2198,10 @@ Supported variables: \fBYYLESSTHAN\fP, \fBYYCURSOR\fP, \fBYYLIMIT\fP,
|
||||
\fBneed\fP (the number of code units to check against). Conditional:
|
||||
\fB\&.many\fP (true if the \fBneed\fP is more than one).
|
||||
.TP
|
||||
.B \fBcode:yyend\fP
|
||||
\fBYYEND\fP expression, possibly specialized for different APIs.
|
||||
Supported variables: \fBYYEND\fP, \fBYYCURSOR\fP, \fBYYLIMIT\fP\&.
|
||||
.TP
|
||||
.B \fBcode:yybm_filter\fP
|
||||
Condition that is used to filter out \fByych\fP values that are not
|
||||
covered by the \fByybm\fP table (used with \fB\-\-bitmaps\fP option).
|
||||
@@ -2236,6 +2268,10 @@ True if case ranges feature is enabled (\fB\-\-case\-ranges\fP or
|
||||
True if the relative form of computed \fBgoto\fP is used
|
||||
(\fB\-\-computed\-gotos\-relative\fP or \fBre2c:cgoto:relative = 1\fP).
|
||||
.TP
|
||||
.B \fB\&.computed_continue\fP
|
||||
True if loop/switch model uses labeled\-switch transitions
|
||||
(\fB\-\-computed\-continue\fP).
|
||||
.TP
|
||||
.B \fB\&.code_model.goto_label\fP
|
||||
True if code model based on goto/label is used (\fB\-\-goto\-label\fP).
|
||||
.TP
|
||||
@@ -2271,6 +2307,9 @@ languages that have \(dqunsafe\(dq feature.
|
||||
.B \fB\&.version\fP
|
||||
True if the generated fingerprint should contain re2zig version.
|
||||
.TP
|
||||
.B \fB\&.yyfill.enable\fP
|
||||
True if \fBYYFILL\fP is enabled (\fBre2c:yyfill:enable = 1\fP).
|
||||
.TP
|
||||
.B \fB\&.yyfn.throw\fP
|
||||
True if \fBre2c:yyfn:throw\fP configuration is defined to a nonempty string.
|
||||
.UNINDENT
|
||||
@@ -2692,6 +2731,7 @@ const std = @import(\(dqstd\(dq);
|
||||
const bufsize = 4095;
|
||||
|
||||
const State = struct {
|
||||
file: *std.Io.Reader,
|
||||
yyinput: [bufsize + 1]u8,
|
||||
yycursor: usize,
|
||||
yymarker: usize,
|
||||
@@ -2700,7 +2740,7 @@ const State = struct {
|
||||
eof: bool
|
||||
};
|
||||
|
||||
fn fill(st: *State, file: anytype) i32 {
|
||||
fn fill(st: *State) i32 {
|
||||
if (st.eof) { return \-1; } // unexpected EOF
|
||||
|
||||
// Error: lexeme too long. In real life can reallocate a larger buffer.
|
||||
@@ -2715,7 +2755,7 @@ fn fill(st: *State, file: anytype) i32 {
|
||||
st.token = 0;
|
||||
|
||||
// Fill free space at the end of buffer with new data from file.
|
||||
st.yylimit += file.read(st.yyinput[st.yylimit..bufsize]) catch 0;
|
||||
st.yylimit += st.file.readSliceShort(st.yyinput[st.yylimit..bufsize]) catch 0;
|
||||
st.yyinput[st.yylimit] = 0; // append sentinel symbol
|
||||
|
||||
// If read less than expected, this is the end of input.
|
||||
@@ -2724,14 +2764,14 @@ fn fill(st: *State, file: anytype) i32 {
|
||||
return 0;
|
||||
}
|
||||
|
||||
fn lex(yyrecord: *State, file: anytype) i32 {
|
||||
fn lex(yyrecord: *State) i32 {
|
||||
var count: i32 = 0;
|
||||
loop: while (true) {
|
||||
yyrecord.token = yyrecord.yycursor;
|
||||
%{
|
||||
re2c:api = record;
|
||||
re2c:eof = 0;
|
||||
re2c:YYFILL = \(dqfill(yyrecord, file) == 0\(dq;
|
||||
re2c:YYFILL = \(dqfill(yyrecord) == 0\(dq;
|
||||
|
||||
str = [\(aq] ([^\(aq\e\e] | [\e\e][^])* [\(aq];
|
||||
|
||||
@@ -2755,10 +2795,12 @@ test {
|
||||
fw.close();
|
||||
|
||||
// Prepare lexer state: all offsets are at the end of buffer.
|
||||
var fr = try std.fs.cwd().openFile(fname, .{ .mode = .read_only});
|
||||
// Normally file would be part of the state struct, but BufferedReader type is unclear.
|
||||
var br = std.io.bufferedReader(fr.reader());
|
||||
// Use unbuffered reader \- lexer does its own buffering.
|
||||
const zerobuf: [0]u8 = undefined;
|
||||
var fr = try std.fs.cwd().openFile(fname, .{.mode = .read_only});
|
||||
var reader = fr.reader(&zerobuf);
|
||||
var st = State{
|
||||
.file = &reader.interface,
|
||||
.yyinput = undefined,
|
||||
.yycursor = bufsize,
|
||||
.yymarker = bufsize,
|
||||
@@ -2770,7 +2812,7 @@ test {
|
||||
st.yyinput[st.yylimit] = 0;
|
||||
|
||||
// Run the lexer.
|
||||
try std.testing.expectEqual(lex(&st, &br), count);
|
||||
try std.testing.expectEqual(lex(&st), count);
|
||||
|
||||
// Cleanup: remove input file.
|
||||
fr.close();
|
||||
@@ -2837,6 +2879,7 @@ const std = @import(\(dqstd\(dq);
|
||||
const bufsize = 4096;
|
||||
|
||||
const State = struct {
|
||||
file: *std.Io.Reader,
|
||||
yyinput: [bufsize + yymaxfill]u8,
|
||||
yycursor: usize,
|
||||
yymarker: usize,
|
||||
@@ -2845,7 +2888,7 @@ const State = struct {
|
||||
eof: bool
|
||||
};
|
||||
|
||||
fn fill(st: *State, need: usize, file: anytype) i32 {
|
||||
fn fill(st: *State, need: usize) i32 {
|
||||
if (st.eof) { return \-1; } // unexpected EOF
|
||||
|
||||
// Error: lexeme too long. In real life can reallocate a larger buffer.
|
||||
@@ -2860,7 +2903,7 @@ fn fill(st: *State, need: usize, file: anytype) i32 {
|
||||
st.token = 0;
|
||||
|
||||
// Fill free space at the end of buffer with new data from file.
|
||||
st.yylimit += file.read(st.yyinput[st.yylimit..bufsize]) catch 0;
|
||||
st.yylimit += st.file.readSliceShort(st.yyinput[st.yylimit..bufsize]) catch 0;
|
||||
|
||||
// If read less than expected, this is the end of input.
|
||||
if (st.yylimit < bufsize) {
|
||||
@@ -2872,13 +2915,13 @@ fn fill(st: *State, need: usize, file: anytype) i32 {
|
||||
return 0;
|
||||
}
|
||||
|
||||
fn lex(yyrecord: *State, file: anytype) i32 {
|
||||
fn lex(yyrecord: *State) i32 {
|
||||
var count: i32 = 0;
|
||||
loop: while (true) {
|
||||
yyrecord.token = yyrecord.yycursor;
|
||||
%{
|
||||
re2c:api = record;
|
||||
re2c:YYFILL = \(dq{ if (fill(yyrecord, @@, file) != 0) return \-2; }\(dq;
|
||||
re2c:YYFILL = \(dq{ if (fill(yyrecord, @@) != 0) return \-2; }\(dq;
|
||||
|
||||
str = [\(aq] ([^\(aq\e\e] | [\e\e][^])* [\(aq];
|
||||
|
||||
@@ -2906,10 +2949,12 @@ test {
|
||||
|
||||
// Prepare lexer state: all offsets are at the end of buffer.
|
||||
// This immediately triggers YYFILL, as the YYLESSTHAN condition is true.
|
||||
var fr = try std.fs.cwd().openFile(fname, .{ .mode = .read_only});
|
||||
// Normally file would be part of the state struct, but BufferedReader type is unclear.
|
||||
var br = std.io.bufferedReader(fr.reader());
|
||||
// Use unbuffered reader \- lexer does its own buffering.
|
||||
const zerobuf: [0]u8 = undefined;
|
||||
var fr = try std.fs.cwd().openFile(fname, .{.mode = .read_only});
|
||||
var reader = fr.reader(&zerobuf);
|
||||
var st = State{
|
||||
.file = &reader.interface,
|
||||
.yyinput = undefined,
|
||||
.yycursor = bufsize,
|
||||
.yymarker = bufsize,
|
||||
@@ -2920,7 +2965,7 @@ test {
|
||||
@memset(st.yyinput[st.yylimit..st.yylimit + yymaxfill], 0); // zero\-padding at the end
|
||||
|
||||
// Run the lexer.
|
||||
try std.testing.expectEqual(lex(&st, &br), count);
|
||||
try std.testing.expectEqual(lex(&st), count);
|
||||
|
||||
// Cleanup: remove input file.
|
||||
fr.close();
|
||||
@@ -3261,6 +3306,7 @@ const Status = enum {
|
||||
const bufsize = 10;
|
||||
|
||||
const State = struct {
|
||||
file: std.fs.File.Reader,
|
||||
yyinput: [bufsize + 1]u8,
|
||||
yycursor: usize,
|
||||
yymarker: usize,
|
||||
@@ -3270,7 +3316,7 @@ const State = struct {
|
||||
received: usize,
|
||||
};
|
||||
|
||||
fn fill(st: *State, file: anytype) Status {
|
||||
fn fill(st: *State) Status {
|
||||
// Error: lexeme too long. In real life can reallocate a larger buffer.
|
||||
if (st.token < 1) { return Status.big_packet; }
|
||||
|
||||
@@ -3283,7 +3329,7 @@ fn fill(st: *State, file: anytype) Status {
|
||||
st.token = 0;
|
||||
|
||||
// Fill free space at the end of buffer with new data from file.
|
||||
st.yylimit += file.read(st.yyinput[st.yylimit..bufsize]) catch 0;
|
||||
st.yylimit += st.file.interface.readSliceShort(st.yyinput[st.yylimit..bufsize]) catch 0;
|
||||
st.yyinput[st.yylimit] = 0; // append sentinel symbol
|
||||
|
||||
return Status.ready;
|
||||
@@ -3314,10 +3360,10 @@ fn run(expect: Status, packets: []const []const u8) !void {
|
||||
var fr = try std.fs.cwd().openFile(fname, .{ .mode = .read_only});
|
||||
|
||||
// Initialize lexer state: \(gastate\(ga value is \-1, all offsets are at the end
|
||||
// of buffer. Normally file would be part of the state, but BufferedReader
|
||||
// type is unclear.
|
||||
var br = std.io.bufferedReader(fr.reader());
|
||||
// of buffer. Use unbuffered reader \- lexer does its own buffering.
|
||||
const zerobuf: [0]u8 = undefined;
|
||||
var st = State{
|
||||
.file = fr.reader(&zerobuf),
|
||||
.yyinput = undefined,
|
||||
.yycursor = bufsize,
|
||||
.yymarker = bufsize,
|
||||
@@ -3344,7 +3390,7 @@ fn run(expect: Status, packets: []const []const u8) !void {
|
||||
try fw.writeAll(packets[send]);
|
||||
send += 1;
|
||||
}
|
||||
status = fill(&st, &br);
|
||||
status = fill(&st);
|
||||
std.log.debug(\(dqfilled buffer [{s}], status {}\(dq, .{st.yyinput, status});
|
||||
if (status != Status.ready) {
|
||||
break;
|
||||
@@ -3695,6 +3741,7 @@ fn s2n(str: []const u8) u32 { // convert a pre\-parsed string to a number
|
||||
}
|
||||
|
||||
const State = struct {
|
||||
file: *std.Io.Reader,
|
||||
yyinput: [bufsize + 1]u8,
|
||||
yycursor: usize,
|
||||
yymarker: usize,
|
||||
@@ -3706,7 +3753,7 @@ const State = struct {
|
||||
eof: bool
|
||||
};
|
||||
|
||||
fn fill(st: *State, file: anytype) i32 {
|
||||
fn fill(st: *State) i32 {
|
||||
if (st.eof) { return \-1; } // unexpected EOF
|
||||
|
||||
// Error: lexeme too long. In real life can reallocate a larger buffer.
|
||||
@@ -3725,7 +3772,7 @@ fn fill(st: *State, file: anytype) i32 {
|
||||
st.token = 0;
|
||||
|
||||
// Fill free space at the end of buffer with new data from file.
|
||||
st.yylimit += file.read(st.yyinput[st.yylimit..bufsize]) catch 0;
|
||||
st.yylimit += st.file.readSliceShort(st.yyinput[st.yylimit..bufsize]) catch 0;
|
||||
st.yyinput[st.yylimit] = 0; // append sentinel symbol
|
||||
|
||||
// If read less than expected, this is the end of input.
|
||||
@@ -3734,8 +3781,8 @@ fn fill(st: *State, file: anytype) i32 {
|
||||
return 0;
|
||||
}
|
||||
|
||||
fn parse(st: *State, file: anytype) !std.ArrayList(SemVer) {
|
||||
var vers = std.ArrayList(SemVer).init(std.testing.allocator);
|
||||
fn parse(st: *State) !std.ArrayList(SemVer) {
|
||||
var vers = try std.ArrayList(SemVer).initCapacity(std.testing.allocator, 0);
|
||||
|
||||
// Final tag variables available in semantic action.
|
||||
%{svars format = \(dqvar @@: usize = 0;\en\(dq; %}
|
||||
@@ -3747,12 +3794,12 @@ fn parse(st: *State, file: anytype) !std.ArrayList(SemVer) {
|
||||
re2c:eof = 0;
|
||||
re2c:tags = 1;
|
||||
re2c:yyrecord = st;
|
||||
re2c:YYFILL = \(dqfill(st, file) == 0\(dq;
|
||||
re2c:YYFILL = \(dqfill(st) == 0\(dq;
|
||||
|
||||
num = [0\-9]+;
|
||||
|
||||
num @t1 \(dq.\(dq @t2 num @t3 (\(dq.\(dq @t4 num)? [\en] {
|
||||
try vers.append(SemVer {
|
||||
try vers.append(std.testing.allocator, SemVer {
|
||||
.major = s2n(st.yyinput[st.token..t1]),
|
||||
.minor = s2n(st.yyinput[t2..t3]),
|
||||
.patch = if (t4 == none) 0 else s2n(st.yyinput[t4..st.yycursor \- 1]),
|
||||
@@ -3776,10 +3823,12 @@ test {
|
||||
fw.close();
|
||||
|
||||
// Prepare lexer state: all offsets are at the end of buffer.
|
||||
var fr = try std.fs.cwd().openFile(fname, .{ .mode = .read_only});
|
||||
// Normally file would be part of the state struct, but BufferedReader type is unclear.
|
||||
var br = std.io.bufferedReader(fr.reader());
|
||||
// Use unbuffered reader \- lexer does its own buffering.
|
||||
const zerobuf: [0]u8 = undefined;
|
||||
var fr = try std.fs.cwd().openFile(fname, .{.mode = .read_only});
|
||||
var reader = fr.reader(&zerobuf);
|
||||
var st = State{
|
||||
.file = &reader.interface,
|
||||
.yyinput = undefined,
|
||||
.yycursor = bufsize,
|
||||
.yymarker = bufsize,
|
||||
@@ -3792,16 +3841,14 @@ test {
|
||||
st.yyinput[st.yylimit] = 0;
|
||||
|
||||
// Manually construct expected result.
|
||||
var expect = std.ArrayList(SemVer).init(std.testing.allocator);
|
||||
for (0..bufsize) |_| try expect.append(SemVer{.major = 1, .minor = 22, .patch = 333});
|
||||
var expect = [_]SemVer{SemVer{.major = 1, .minor = 22, .patch = 333}} ** bufsize;
|
||||
|
||||
// Run the lexer.
|
||||
var result = try parse(&st, &br);
|
||||
try std.testing.expectEqualDeep(result, expect);
|
||||
var result = try parse(&st);
|
||||
try std.testing.expectEqualDeep(&expect, result.items);
|
||||
|
||||
// Cleanup: free memory and remove input file.
|
||||
expect.deinit();
|
||||
result.deinit();
|
||||
result.deinit(std.testing.allocator);
|
||||
fr.close();
|
||||
try std.fs.cwd().deleteFile(fname);
|
||||
}
|
||||
@@ -3900,7 +3947,7 @@ const MtagElem = struct {
|
||||
|
||||
// Append a single value to an m\-tag history.
|
||||
fn add_mtag(trie: *std.ArrayList(MtagElem), mtag: usize, value: usize) !usize {
|
||||
try trie.append(MtagElem{.elem = value, .pred = mtag});
|
||||
try trie.append(std.testing.allocator, MtagElem{.elem = value, .pred = mtag});
|
||||
return trie.items.len \- 1;
|
||||
}
|
||||
|
||||
@@ -3923,7 +3970,7 @@ fn unwind(trie: *std.ArrayList(MtagElem),
|
||||
|
||||
if (ex != none and ey != none) {
|
||||
// Both tags are valid string indices, extract component.
|
||||
try ver.append(s2n(str[ex..ey]));
|
||||
try ver.append(std.testing.allocator, s2n(str[ex..ey]));
|
||||
} else {
|
||||
// Both tags are none (this corresponds to zero repetitions).
|
||||
std.debug.assert(ex == none and ey == none);
|
||||
@@ -3939,8 +3986,8 @@ fn s2n(str: []const u8) u32 { // convert a pre\-parsed string to a number
|
||||
fn parse(yyinput: [:0]const u8) !std.ArrayList(u32) {
|
||||
var yycursor: usize = 0;
|
||||
var yymarker: usize = 0;
|
||||
var mt = std.ArrayList(MtagElem).init(std.testing.allocator);
|
||||
defer mt.deinit();
|
||||
var mt = try std.ArrayList(MtagElem).initCapacity(std.testing.allocator, 0);
|
||||
defer mt.deinit(std.testing.allocator);
|
||||
|
||||
// Final tag variables available in semantic action.
|
||||
%{svars format = \(dqvar @@: usize = none;\(dq; %}
|
||||
@@ -3959,8 +4006,8 @@ fn parse(yyinput: [:0]const u8) !std.ArrayList(u32) {
|
||||
num = [0\-9]+;
|
||||
|
||||
@t1 num @t2 (\(dq.\(dq #t3 num #t4)* [\ex00] {
|
||||
var ver = std.ArrayList(u32).init(std.testing.allocator);
|
||||
try ver.append(s2n(yyinput[t1..t2]));
|
||||
var ver = try std.ArrayList(u32).initCapacity(std.testing.allocator, 0);
|
||||
try ver.append(std.testing.allocator, s2n(yyinput[t1..t2]));
|
||||
try unwind(&mt, t3, t4, yyinput, &ver);
|
||||
return ver;
|
||||
}
|
||||
@@ -3970,20 +4017,16 @@ fn parse(yyinput: [:0]const u8) !std.ArrayList(u32) {
|
||||
|
||||
test {
|
||||
var result = try parse(\(dq1\(dq);
|
||||
var expect = std.ArrayList(u32).init(std.testing.allocator);
|
||||
try expect.appendSlice(&[_]u32{1});
|
||||
try std.testing.expectEqualDeep(result, expect);
|
||||
expect.deinit();
|
||||
result.deinit();
|
||||
var expect = [_]u32{1};
|
||||
try std.testing.expectEqualDeep(&expect, result.items);
|
||||
result.deinit(std.testing.allocator);
|
||||
}
|
||||
|
||||
test {
|
||||
var result = try parse(\(dq1.2.3.4.5.6.7\(dq);
|
||||
var expect = std.ArrayList(u32).init(std.testing.allocator);
|
||||
try expect.appendSlice(&[_]u32{1, 2, 3, 4, 5, 6, 7});
|
||||
try std.testing.expectEqualDeep(result, expect);
|
||||
expect.deinit();
|
||||
result.deinit();
|
||||
var expect = [_]u32{1, 2, 3, 4, 5, 6, 7};
|
||||
try std.testing.expectEqualDeep(&expect, result.items);
|
||||
result.deinit(std.testing.allocator);
|
||||
}
|
||||
|
||||
test {
|
||||
@@ -4039,8 +4082,9 @@ fixed\-length Unicode encoding with code space \fB[0\-0x10FFFF]\fP and 4\-byte c
|
||||
points and code units.
|
||||
.UNINDENT
|
||||
.sp
|
||||
Include file \fBinclude/unicode_categories.re\fP provides re2zig definitions for the
|
||||
standard Unicode categories.
|
||||
Include files \fBinclude/unicode_blocks.re\fP, \fBinclude/unicode_categories.re\fP
|
||||
and \fBinclude/unicode_properties.re\fP provide re2zig definitions for blocks,
|
||||
categories and properties described in the Unicode standard.
|
||||
.sp
|
||||
Option \fB\-\-input\-encoding\fP specifies source file encoding, which can be used to
|
||||
enable Unicode literals in regular expressions. For example
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 4.2 */
|
||||
/* Generated by re2c 4.6 */
|
||||
#line 1 "../lib/lex.re"
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 4.2 */
|
||||
/* Generated by re2c 4.6 */
|
||||
#line 1 "../lib/test_helper.re"
|
||||
#include "lib/test_helper.h"
|
||||
|
||||
|
||||
@@ -63,11 +63,11 @@ static constexpr const char* DEFAULT_SYNTAX_C =
|
||||
"re2c:yych:emit = (.code_model.recursive_functions ? 0 : 1);\n"
|
||||
"re2c:yybm = \"yybm\";\n"
|
||||
"re2c:yybm:hex = 0;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yystable = \"\"; // deprecated\n"
|
||||
"re2c:header = \"\";\n"
|
||||
"re2c:eof = -1;\n"
|
||||
"re2c:sentinel = -1;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yyfill:enable = 1;\n"
|
||||
"re2c:yyfill:parameter = 1;\n"
|
||||
"re2c:yyfill:check = 1;\n"
|
||||
@@ -123,6 +123,7 @@ static constexpr const char* DEFAULT_SYNTAX_C =
|
||||
"re2c:YYCTYPE = \"YYCTYPE\";\n"
|
||||
"re2c:YYCURSOR = (.api.record ? yyrecord \"->yycursor\" : \"YYCURSOR\");\n"
|
||||
"re2c:YYDEBUG = \"YYDEBUG\";\n"
|
||||
"re2c:YYEND = \"YYEND\";\n"
|
||||
"re2c:YYFILL = \"YYFILL\";\n"
|
||||
"re2c:YYGETACCEPT = sigil \"{var}\";\n"
|
||||
"re2c:YYGETCOND = \"YYGETCONDITION\"; // historic default\n"
|
||||
@@ -174,8 +175,8 @@ static constexpr const char* DEFAULT_SYNTAX_C =
|
||||
"\n"
|
||||
"code:enum =\n"
|
||||
" \"enum \" type \" {\" nl indent\n"
|
||||
" [elem{0:-2}: topindent elem (.init ? \" = \" init) \",\" nl]\n"
|
||||
" [elem{-1}: topindent elem (.init ? \" = \" init) nl]\n"
|
||||
" [elem{0:-2}: topindent elem (!.code_model.goto_label ? \" = \" init) \",\" nl]\n"
|
||||
" [elem{-1}: topindent elem (!.code_model.goto_label ? \" = \" init) nl]\n"
|
||||
" dedent \"};\" nl;\n"
|
||||
"\n"
|
||||
"code:enum_elem = name;\n"
|
||||
@@ -451,6 +452,11 @@ static constexpr const char* DEFAULT_SYNTAX_C =
|
||||
" ? \"(\" YYLIMIT \" - \" YYCURSOR \") < \" need\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR));\n"
|
||||
"\n"
|
||||
"code:yyend =\n"
|
||||
" (.api.generic | .yyfill.enable\n"
|
||||
" ? YYEND (.api_style.functions ? \"()\")\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR);\n"
|
||||
"\n"
|
||||
"code:yybm_filter = yych \" & ~0xFF\";\n"
|
||||
"\n"
|
||||
"code:yybm_match = yybm \"[\" offset \"+\" yych \"] & \" mask;\n"
|
||||
|
||||
@@ -63,11 +63,11 @@ static constexpr const char* DEFAULT_SYNTAX_D =
|
||||
"re2c:yych:emit = (.code_model.recursive_functions ? 0 : 1);\n"
|
||||
"re2c:yybm = \"yybm\";\n"
|
||||
"re2c:yybm:hex = 0;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yystable = \"\"; // deprecated\n"
|
||||
"re2c:header = \"\";\n"
|
||||
"re2c:eof = -1;\n"
|
||||
"re2c:sentinel = -1;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yyfill:enable = 1;\n"
|
||||
"re2c:yyfill:parameter = 1;\n"
|
||||
"re2c:yyfill:check = 1;\n"
|
||||
@@ -123,6 +123,7 @@ static constexpr const char* DEFAULT_SYNTAX_D =
|
||||
"re2c:YYCTYPE = \"YYChar\";\n"
|
||||
"re2c:YYCURSOR = (.api.record ? yyrecord \".\") \"yycursor\";\n"
|
||||
"re2c:YYDEBUG = \"yydebug\";\n"
|
||||
"re2c:YYEND = \"yyend\";\n"
|
||||
"re2c:YYFILL = \"yyfill\";\n"
|
||||
"re2c:YYGETACCEPT = sigil \"{var}\";\n"
|
||||
"re2c:YYGETCOND = \"yygetcond\";\n"
|
||||
@@ -174,8 +175,8 @@ static constexpr const char* DEFAULT_SYNTAX_D =
|
||||
"\n"
|
||||
"code:enum =\n"
|
||||
" \"enum \" type \" {\" nl indent\n"
|
||||
" [elem{0:-2}: topindent elem (.init ? \" = \" init) \",\" nl]\n"
|
||||
" [elem{-1}: topindent elem (.init ? \" = \" init) nl]\n"
|
||||
" [elem{0:-2}: topindent elem (!.code_model.goto_label ? \" = \" init) \",\" nl]\n"
|
||||
" [elem{-1}: topindent elem (!.code_model.goto_label ? \" = \" init) nl]\n"
|
||||
" dedent \"};\" nl;\n"
|
||||
"\n"
|
||||
"code:enum_elem = type \".\" name;\n"
|
||||
@@ -424,6 +425,11 @@ static constexpr const char* DEFAULT_SYNTAX_D =
|
||||
" ? \"(\" YYLIMIT \" - \" YYCURSOR \") < \" need\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR));\n"
|
||||
"\n"
|
||||
"code:yyend =\n"
|
||||
" (.api.generic | .yyfill.enable\n"
|
||||
" ? YYEND\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR);\n"
|
||||
"\n"
|
||||
"code:yybm_filter = yych \" & ~0xFF\";\n"
|
||||
"\n"
|
||||
"code:yybm_match = \"(\" yybm \"[\" offset \"+\" yych \"] & \" mask \") != 0\";\n"
|
||||
|
||||
@@ -62,11 +62,11 @@ static constexpr const char* DEFAULT_SYNTAX_GO =
|
||||
"re2c:yych:emit = (.code_model.recursive_functions ? 0 : 1);\n"
|
||||
"re2c:yybm = \"yybm\";\n"
|
||||
"re2c:yybm:hex = 0;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yystable = \"\"; // deprecated\n"
|
||||
"re2c:header = \"\";\n"
|
||||
"re2c:eof = -1;\n"
|
||||
"re2c:sentinel = -1;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yyfill:enable = 1;\n"
|
||||
"re2c:yyfill:parameter = 1;\n"
|
||||
"re2c:yyfill:check = 1;\n"
|
||||
@@ -122,6 +122,7 @@ static constexpr const char* DEFAULT_SYNTAX_GO =
|
||||
"re2c:YYCTXMARKER = (.api.generic ? \"YYCTXMARKER\" : (.api.record ? yyrecord \".\") \"yyctxmarker\");\n"
|
||||
"re2c:YYCURSOR = (.api.generic ? \"YYCURSOR\" : (.api.record ? yyrecord \".\") \"yycursor\");\n"
|
||||
"re2c:YYDEBUG = \"YYDEBUG\";\n"
|
||||
"re2c:YYEND = \"YYEND\";\n"
|
||||
"re2c:YYFILL = \"YYFILL\";\n"
|
||||
"re2c:YYGETACCEPT = sigil \"{var}\";\n"
|
||||
"re2c:YYGETCOND = \"YYGETCONDITION\"; // historic default\n"
|
||||
@@ -175,8 +176,8 @@ static constexpr const char* DEFAULT_SYNTAX_GO =
|
||||
"\n"
|
||||
"code:enum =\n"
|
||||
" \"const (\" nl indent\n"
|
||||
" [elem{0}: topindent elem \" = \" (.init ? init : \"iota\") nl]\n"
|
||||
" [elem{1:-1}: topindent elem (.init ? \" = \" init) nl]\n"
|
||||
" [elem{0}: topindent elem \" = \" (!.code_model.goto_label ? init : \"iota\") nl]\n"
|
||||
" [elem{1:-1}: topindent elem (!.code_model.goto_label ? \" = \" init) nl]\n"
|
||||
" dedent \")\" nl;\n"
|
||||
"\n"
|
||||
"code:enum_elem = name;\n"
|
||||
@@ -406,6 +407,11 @@ static constexpr const char* DEFAULT_SYNTAX_GO =
|
||||
" ? \"(\" YYLIMIT \" - \" YYCURSOR \") < \" need\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR));\n"
|
||||
"\n"
|
||||
"code:yyend =\n"
|
||||
" (.api.generic | .yyfill.enable\n"
|
||||
" ? YYEND (.api_style.functions ? \"()\")\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR);\n"
|
||||
"\n"
|
||||
"code:yybm_filter = yych \" & ~0xFF\";\n"
|
||||
"\n"
|
||||
"code:yybm_match = \"(\" yybm \"[\" offset \"+\" yych \"] & \" mask \") != 0\";\n"
|
||||
|
||||
@@ -62,11 +62,11 @@ static constexpr const char* DEFAULT_SYNTAX_HASKELL =
|
||||
"re2c:yych:emit = (.code_model.recursive_functions ? 0 : 1);\n"
|
||||
"re2c:yybm = \"yybm\";\n"
|
||||
"re2c:yybm:hex = 0;\n"
|
||||
"re2c:yyfill = \"yyfill\";\n"
|
||||
"re2c:yystable = \"\"; // deprecated\n"
|
||||
"re2c:header = \"\";\n"
|
||||
"re2c:eof = -1;\n"
|
||||
"re2c:sentinel = -1;\n"
|
||||
"re2c:yyfill = \"yyfill\";\n"
|
||||
"re2c:yyfill:enable = 1;\n"
|
||||
"re2c:yyfill:parameter = 1;\n"
|
||||
"re2c:yyfill:check = 1;\n"
|
||||
@@ -122,6 +122,7 @@ static constexpr const char* DEFAULT_SYNTAX_HASKELL =
|
||||
"re2c:YYCTXMARKER = \"_yyctxmarker\";\n"
|
||||
"re2c:YYCURSOR = \"_yycursor\";\n"
|
||||
"re2c:YYDEBUG = \"yydebug\";\n"
|
||||
"re2c:YYEND = \"yyend\";\n"
|
||||
"re2c:YYFILL = \"yyfill\";\n"
|
||||
"re2c:YYGETACCEPT = \"yygetaccept\";\n"
|
||||
"re2c:YYGETCOND = \"yygetcond\";\n"
|
||||
@@ -415,6 +416,11 @@ static constexpr const char* DEFAULT_SYNTAX_HASKELL =
|
||||
" ? YYCURSOR \" >= \" YYLIMIT // YYFILL check can only be used with EOF rule $\n"
|
||||
" : YYLESSTHAN);\n"
|
||||
"\n"
|
||||
"code:yyend =\n"
|
||||
" (.api.generic | .yyfill.enable\n"
|
||||
" ? YYEND\n"
|
||||
" : YYCURSOR \" >= \" YYLIMIT);\n"
|
||||
"\n"
|
||||
"code:yybm_filter = \"(\" yych \" .&. complement 0xFF) /= 0\";\n"
|
||||
"\n"
|
||||
"code:yybm_match = \"(\" yybm \" ! (\" offset \" + fromIntegral \" yych \") .&. \" mask \") /= 0\";\n"
|
||||
|
||||
@@ -62,11 +62,11 @@ static constexpr const char* DEFAULT_SYNTAX_JAVA =
|
||||
"re2c:yych:emit = 1;\n"
|
||||
"re2c:yybm = \"yybm\";\n"
|
||||
"re2c:yybm:hex = 0;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yystable = \"\"; // deprecated\n"
|
||||
"re2c:header = \"\";\n"
|
||||
"re2c:eof = -1;\n"
|
||||
"re2c:sentinel = -1;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yyfill:enable = 1;\n"
|
||||
"re2c:yyfill:parameter = 1;\n"
|
||||
"re2c:yyfill:check = 1;\n"
|
||||
@@ -122,6 +122,7 @@ static constexpr const char* DEFAULT_SYNTAX_JAVA =
|
||||
"re2c:YYCTXMARKER = (.api.record ? yyrecord \".\") \"yyctxmarker\";\n"
|
||||
"re2c:YYCURSOR = (.api.record ? yyrecord \".\") \"yycursor\";\n"
|
||||
"re2c:YYDEBUG = \"yydebug\";\n"
|
||||
"re2c:YYEND = \"yyend\";\n"
|
||||
"re2c:YYFILL = \"yyfill\";\n"
|
||||
"re2c:YYGETACCEPT = sigil \"{var}\";\n"
|
||||
"re2c:YYGETCOND = \"yygetcond\";\n"
|
||||
@@ -381,6 +382,11 @@ static constexpr const char* DEFAULT_SYNTAX_JAVA =
|
||||
" ? \"(\" YYLIMIT \" - \" YYCURSOR \") < \" need\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR));\n"
|
||||
"\n"
|
||||
"code:yyend =\n"
|
||||
" (.api.generic | .yyfill.enable\n"
|
||||
" ? YYEND\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR);\n"
|
||||
"\n"
|
||||
"code:yybm_filter = yych \" & ~0xFF\";\n"
|
||||
"\n"
|
||||
"code:yybm_match = \"(\" yybm \"[\" offset \"+\" yych \"] & \" mask \") != 0\";\n"
|
||||
|
||||
@@ -62,11 +62,11 @@ static constexpr const char* DEFAULT_SYNTAX_JS =
|
||||
"re2c:yych:emit = 1;\n"
|
||||
"re2c:yybm = \"yybm\";\n"
|
||||
"re2c:yybm:hex = 0;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yystable = \"\"; // deprecated\n"
|
||||
"re2c:header = \"\";\n"
|
||||
"re2c:eof = -1;\n"
|
||||
"re2c:sentinel = -1;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yyfill:enable = 1;\n"
|
||||
"re2c:yyfill:parameter = 1;\n"
|
||||
"re2c:yyfill:check = 1;\n"
|
||||
@@ -122,6 +122,7 @@ static constexpr const char* DEFAULT_SYNTAX_JS =
|
||||
"re2c:YYCTXMARKER = (.api.record ? yyrecord \".\") \"yyctxmarker\";\n"
|
||||
"re2c:YYCURSOR = (.api.record ? yyrecord \".\") \"yycursor\";\n"
|
||||
"re2c:YYDEBUG = \"yydebug\";\n"
|
||||
"re2c:YYEND = \"yyend\";\n"
|
||||
"re2c:YYFILL = \"yyfill\";\n"
|
||||
"re2c:YYGETACCEPT = sigil \"{var}\";\n"
|
||||
"re2c:YYGETCOND = \"yygetcond\";\n"
|
||||
@@ -384,6 +385,11 @@ static constexpr const char* DEFAULT_SYNTAX_JS =
|
||||
" ? \"(\" YYLIMIT \" - \" YYCURSOR \") < \" need\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR));\n"
|
||||
"\n"
|
||||
"code:yyend =\n"
|
||||
" (.api.generic | .yyfill.enable\n"
|
||||
" ? YYEND\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR);\n"
|
||||
"\n"
|
||||
"code:yybm_filter = yych \" & ~0xFF\";\n"
|
||||
"\n"
|
||||
"code:yybm_match = \"(\" yybm \"[\" offset \"+\" yych \"] & \" mask \") !== 0\";\n"
|
||||
|
||||
@@ -63,11 +63,11 @@ static constexpr const char* DEFAULT_SYNTAX_OCAML =
|
||||
"re2c:yych:emit = (.code_model.recursive_functions ? 0 : 1);\n"
|
||||
"re2c:yybm = \"yybm\";\n"
|
||||
"re2c:yybm:hex = 0;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yystable = \"\"; // deprecated\n"
|
||||
"re2c:header = \"\";\n"
|
||||
"re2c:eof = -1;\n"
|
||||
"re2c:sentinel = -1;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yyfill:enable = 1;\n"
|
||||
"re2c:yyfill:parameter = 1;\n"
|
||||
"re2c:yyfill:check = 1;\n"
|
||||
@@ -123,6 +123,7 @@ static constexpr const char* DEFAULT_SYNTAX_OCAML =
|
||||
"re2c:YYCTXMARKER = (.api.record ? yyrecord \".\") \"yyctxmarker\";\n"
|
||||
"re2c:YYCURSOR = (.api.record ? yyrecord \".\") \"yycursor\";\n"
|
||||
"re2c:YYDEBUG = \"yydebug\";\n"
|
||||
"re2c:YYEND = \"yyend\";\n"
|
||||
"re2c:YYFILL = \"yyfill\";\n"
|
||||
"re2c:YYGETACCEPT = sigil \"{var}\";\n"
|
||||
"re2c:YYGETCOND = \"yygetcond\";\n"
|
||||
@@ -394,6 +395,11 @@ static constexpr const char* DEFAULT_SYNTAX_OCAML =
|
||||
" : YYLIMIT \" <= \" YYCURSOR)\n"
|
||||
" : YYLESSTHAN);\n"
|
||||
"\n"
|
||||
"code:yyend =\n"
|
||||
" (.api.generic | .yyfill.enable\n"
|
||||
" ? YYEND\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR);\n"
|
||||
"\n"
|
||||
"code:yybm_filter = yych \" land ~0xFF\";\n"
|
||||
"\n"
|
||||
"code:yybm_match = \"(\" yybm \".(\" offset \" + Char.code \" yych \") land \" mask \") != 0\";\n"
|
||||
|
||||
@@ -63,11 +63,11 @@ static constexpr const char* DEFAULT_SYNTAX_PYTHON =
|
||||
"re2c:yych:emit = 0;\n"
|
||||
"re2c:yybm = \"yybm\";\n"
|
||||
"re2c:yybm:hex = 0;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yystable = \"\"; // deprecated\n"
|
||||
"re2c:header = \"\";\n"
|
||||
"re2c:eof = -1;\n"
|
||||
"re2c:sentinel = -1;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yyfill:enable = 1;\n"
|
||||
"re2c:yyfill:parameter = 1;\n"
|
||||
"re2c:yyfill:check = 1;\n"
|
||||
@@ -123,6 +123,7 @@ static constexpr const char* DEFAULT_SYNTAX_PYTHON =
|
||||
"re2c:YYCTXMARKER = (.api.record ? yyrecord \".\") \"yyctxmarker\";\n"
|
||||
"re2c:YYCURSOR = (.api.record ? yyrecord \".\") \"yycursor\";\n"
|
||||
"re2c:YYDEBUG = \"yydebug\";\n"
|
||||
"re2c:YYEND = \"yyend\";\n"
|
||||
"re2c:YYFILL = \"yyfill\";\n"
|
||||
"re2c:YYGETACCEPT = sigil \"{var}\";\n"
|
||||
"re2c:YYGETCOND = \"yygetcond\";\n"
|
||||
@@ -389,6 +390,11 @@ static constexpr const char* DEFAULT_SYNTAX_PYTHON =
|
||||
" ? \"(\" YYLIMIT \" - \" YYCURSOR \") < \" need\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR));\n"
|
||||
"\n"
|
||||
"code:yyend =\n"
|
||||
" (.api.generic | .yyfill.enable\n"
|
||||
" ? YYEND\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR);\n"
|
||||
"\n"
|
||||
"code:yybm_filter = yych \" & ~0xFF\";\n"
|
||||
"\n"
|
||||
"code:yybm_match = \"(\" yybm \"[\" offset \"+\" yych \"] & \" mask \") != 0\";\n"
|
||||
|
||||
@@ -63,11 +63,11 @@ static constexpr const char* DEFAULT_SYNTAX_RUST =
|
||||
"re2c:yych:emit = (.code_model.recursive_functions ? 0 : 1);\n"
|
||||
"re2c:yybm = \"YYBM\";\n"
|
||||
"re2c:yybm:hex = 0;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yystable = \"\"; // deprecated\n"
|
||||
"re2c:header = \"\";\n"
|
||||
"re2c:eof = -1;\n"
|
||||
"re2c:sentinel = -1;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yyfill:enable = 1;\n"
|
||||
"re2c:yyfill:parameter = 1;\n"
|
||||
"re2c:yyfill:check = 1;\n"
|
||||
@@ -123,6 +123,7 @@ static constexpr const char* DEFAULT_SYNTAX_RUST =
|
||||
"re2c:YYCTXMARKER = (.api.generic ? \"YYCTXMARKER\" : (.api.record ? yyrecord \".\") \"yyctxmarker\");\n"
|
||||
"re2c:YYCURSOR = (.api.generic ? \"YYCURSOR\" : (.api.record ? yyrecord \".\") \"yycursor\");\n"
|
||||
"re2c:YYDEBUG = \"YYDEBUG\";\n"
|
||||
"re2c:YYEND = \"YYEND\";\n"
|
||||
"re2c:YYFILL = \"YYFILL\";\n"
|
||||
"re2c:YYGETACCEPT = sigil \"{var}\";\n"
|
||||
"re2c:YYGETCOND = \"YYGETCONDITION\"; // historic default\n"
|
||||
@@ -407,6 +408,11 @@ static constexpr const char* DEFAULT_SYNTAX_RUST =
|
||||
" ? \"(\" YYLIMIT \" - \" YYCURSOR \") < \" need\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR));\n"
|
||||
"\n"
|
||||
"code:yyend =\n"
|
||||
" (.api.generic | .yyfill.enable\n"
|
||||
" ? YYEND\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR);\n"
|
||||
"\n"
|
||||
"code:yybm_filter = yych \" & ~0xFF\";\n"
|
||||
"\n"
|
||||
"code:yybm_match = \"(\" yybm \"[\" offset \"+\" yych \" as usize] & \" mask \") != 0\";\n"
|
||||
|
||||
@@ -62,11 +62,11 @@ static constexpr const char* DEFAULT_SYNTAX_SWIFT =
|
||||
"re2c:yych:emit = (.code_model.recursive_functions ? 0 : 1);\n"
|
||||
"re2c:yybm = \"yybm\";\n"
|
||||
"re2c:yybm:hex = 0;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yystable = \"\"; // deprecated\n"
|
||||
"re2c:header = \"\";\n"
|
||||
"re2c:eof = -1;\n"
|
||||
"re2c:sentinel = -1;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yyfill:enable = 1;\n"
|
||||
"re2c:yyfill:parameter = 1;\n"
|
||||
"re2c:yyfill:check = 1;\n"
|
||||
@@ -123,6 +123,7 @@ static constexpr const char* DEFAULT_SYNTAX_SWIFT =
|
||||
"re2c:YYCTYPE = \"UInt8\";\n"
|
||||
"re2c:YYCURSOR = (.api.record ? yyrecord \".\") \"yycursor\";\n"
|
||||
"re2c:YYDEBUG = \"yydebug\";\n"
|
||||
"re2c:YYEND = \"yyend\";\n"
|
||||
"re2c:YYFILL = \"yyfill\";\n"
|
||||
"re2c:YYGETACCEPT = sigil \"{var}\";\n"
|
||||
"re2c:YYGETCOND = \"yygetcond\";\n"
|
||||
@@ -409,6 +410,11 @@ static constexpr const char* DEFAULT_SYNTAX_SWIFT =
|
||||
" ? \"(\" YYLIMIT \" - \" YYCURSOR \") < \" need\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR));\n"
|
||||
"\n"
|
||||
"code:yyend =\n"
|
||||
" (.api.generic | .yyfill.enable\n"
|
||||
" ? YYEND\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR);\n"
|
||||
"\n"
|
||||
"code:yybm_filter = yych \" & ~0xFF\";\n"
|
||||
"\n"
|
||||
"code:yybm_match = \"(\" yybm \"[\" offset \" + Int(\" yych \")] & \" mask \") != 0\";\n"
|
||||
|
||||
@@ -63,11 +63,11 @@ static constexpr const char* DEFAULT_SYNTAX_V =
|
||||
"re2c:yych:emit = (.code_model.recursive_functions ? 0 : 1);\n"
|
||||
"re2c:yybm = \"yybm\";\n"
|
||||
"re2c:yybm:hex = 0;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yystable = \"\"; // deprecated\n"
|
||||
"re2c:header = \"\";\n"
|
||||
"re2c:eof = -1;\n"
|
||||
"re2c:sentinel = -1;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yyfill:enable = 1;\n"
|
||||
"re2c:yyfill:parameter = 1;\n"
|
||||
"re2c:yyfill:check = 1;\n"
|
||||
@@ -123,6 +123,7 @@ static constexpr const char* DEFAULT_SYNTAX_V =
|
||||
"re2c:YYCTXMARKER = (.api.record ? yyrecord \".\") \"yyctxmarker\";\n"
|
||||
"re2c:YYCURSOR = (.api.record ? yyrecord \".\") \"yycursor\";\n"
|
||||
"re2c:YYDEBUG = \"yydebug\";\n"
|
||||
"re2c:YYEND = \"yyend\";\n"
|
||||
"re2c:YYFILL = \"yyfill\";\n"
|
||||
"re2c:YYGETACCEPT = sigil \"{var}\";\n"
|
||||
"re2c:YYGETCOND = \"yygetcond\";\n"
|
||||
@@ -156,7 +157,7 @@ static constexpr const char* DEFAULT_SYNTAX_V =
|
||||
"\n"
|
||||
"// code templates --------------------------------------------------------------\n"
|
||||
"\n"
|
||||
"code:var_local = topindent \"mut \" name \" := \" init nl;\n"
|
||||
"code:var_local = topindent \"mut \" name \" := \" type \"(\" init \")\" nl;\n"
|
||||
"code:var_global = <undefined>;\n"
|
||||
"\n"
|
||||
"code:const_local = topindent \"const \" name \" = \" init nl;\n"
|
||||
@@ -176,7 +177,7 @@ static constexpr const char* DEFAULT_SYNTAX_V =
|
||||
"code:enum = (.code_model.loop_switch\n"
|
||||
" ? [elem: \"const \" elem \" = \" init nl]\n"
|
||||
" : \"enum \" type \" {\" nl\n"
|
||||
" indent [elem: topindent elem (.init ? \" = \" init) nl] dedent\n"
|
||||
" indent [elem: topindent elem (!.code_model.goto_label ? \" = \" init) nl] dedent\n"
|
||||
" \"}\" nl);\n"
|
||||
"\n"
|
||||
"code:enum_elem = (!.code_model.loop_switch ? \".\") name;\n"
|
||||
@@ -408,6 +409,11 @@ static constexpr const char* DEFAULT_SYNTAX_V =
|
||||
" ? \"(\" YYLIMIT \" - \" YYCURSOR \") < \" need\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR));\n"
|
||||
"\n"
|
||||
"code:yyend =\n"
|
||||
" (.api.generic | .yyfill.enable\n"
|
||||
" ? YYEND\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR);\n"
|
||||
"\n"
|
||||
"code:yybm_filter = yych \" & ~0xFF\";\n"
|
||||
"\n"
|
||||
"code:yybm_match = \"(\" yybm \"[\" offset \"+\" yych \"] & \" mask \") != 0\";\n"
|
||||
|
||||
@@ -6,7 +6,7 @@ static constexpr const char* DEFAULT_SYNTAX_ZIG =
|
||||
"supported_code_models = [\"loop-switch\", \"recursive-functions\"];\n"
|
||||
"supported_targets = [\"code\", \"dot\"];\n"
|
||||
"supported_features = [\"nested-ifs\", \"bitmaps\", \"case-ranges\",\n"
|
||||
" \"tags\", \"captures\", \"captvars\"];\n"
|
||||
" \"tags\", \"captures\", \"captvars\", \"computed-continue\"];\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// language-specific options ---------------------------------------------------\n"
|
||||
@@ -63,11 +63,11 @@ static constexpr const char* DEFAULT_SYNTAX_ZIG =
|
||||
"re2c:yych:emit = (.code_model.recursive_functions ? 0 : 1);\n"
|
||||
"re2c:yybm = \"yybm\";\n"
|
||||
"re2c:yybm:hex = 0;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yystable = \"\"; // deprecated\n"
|
||||
"re2c:header = \"\";\n"
|
||||
"re2c:eof = -1;\n"
|
||||
"re2c:sentinel = -1;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yyfill:enable = 1;\n"
|
||||
"re2c:yyfill:parameter = 1;\n"
|
||||
"re2c:yyfill:check = 1;\n"
|
||||
@@ -123,6 +123,7 @@ static constexpr const char* DEFAULT_SYNTAX_ZIG =
|
||||
"re2c:YYCTYPE = \"u8\";\n"
|
||||
"re2c:YYCURSOR = (.api.record ? yyrecord \".\") \"yycursor\";\n"
|
||||
"re2c:YYDEBUG = \"yydebug\";\n"
|
||||
"re2c:YYEND = \"yyend\";\n"
|
||||
"re2c:YYFILL = \"yyfill\";\n"
|
||||
"re2c:YYGETACCEPT = sigil \"{var}\";\n"
|
||||
"re2c:YYGETCOND = \"yygetcond\";\n"
|
||||
@@ -220,12 +221,21 @@ static constexpr const char* DEFAULT_SYNTAX_ZIG =
|
||||
"\n"
|
||||
"code:switch_case_default = \"else\";\n"
|
||||
"\n"
|
||||
"code:loop =\n"
|
||||
" topindent (.loop_label ? label \": \") \"while (true) {\" nl\n"
|
||||
"code:loop = (.computed_continue\n"
|
||||
" ? topindent var \": switch (@as(enum {\" nl\n"
|
||||
" indent [state: topindent state \",\" nl] dedent\n"
|
||||
" topindent \"}, .\" val \")) {\" nl\n"
|
||||
" indent [state:\n"
|
||||
" topindent \".\" state \" => {\" nl\n"
|
||||
" indent [stmt: stmt] dedent\n"
|
||||
" topindent \"},\" nl] dedent\n"
|
||||
" topindent \"}\" nl\n"
|
||||
" : topindent (.loop_label ? label \": \") \"while (true) {\" nl\n"
|
||||
" indent [stmt: stmt] dedent\n"
|
||||
" topindent \"}\" nl;\n"
|
||||
" topindent \"}\" nl);\n"
|
||||
"\n"
|
||||
"code:continue = topindent \"continue\" (.loop_label ? \" :\" label) \";\" nl;\n"
|
||||
"code:continue = topindent \"continue\"\n"
|
||||
" (.computed_continue ? \" :\" var \" .\" val : (.loop_label ? \" :\" label)) \";\" nl;\n"
|
||||
"\n"
|
||||
"code:goto = topindent \"goto \" label \";\" nl;\n"
|
||||
"\n"
|
||||
@@ -422,6 +432,11 @@ static constexpr const char* DEFAULT_SYNTAX_ZIG =
|
||||
" ? \"(\" YYLIMIT \" - \" YYCURSOR \") < \" need\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR));\n"
|
||||
"\n"
|
||||
"code:yyend =\n"
|
||||
" (.api.generic | .yyfill.enable\n"
|
||||
" ? YYEND\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR);\n"
|
||||
"\n"
|
||||
"code:yybm_filter = yych \" & ~0xFF\";\n"
|
||||
"\n"
|
||||
"code:yybm_match = \"(\" yybm \"[\" offset \"+\" yych \"] & \" mask \") != 0\";\n"
|
||||
|
||||
@@ -15,7 +15,7 @@ const char* help =
|
||||
" --api <simple | record | generic>\n"
|
||||
"\n"
|
||||
" Specify the API used by the generated code to interface with used-\n"
|
||||
" defined code. Option simple shold be used in simple cases when there's\n"
|
||||
" defined code. Option simple should be used in simple cases when there's\n"
|
||||
" no need for buffer refilling and storing lexer state. Option record\n"
|
||||
" should be used when lexer state needs to be stored in a record (struct,\n"
|
||||
" class, etc.). Option generic should be used in complex cases when the\n"
|
||||
@@ -176,6 +176,13 @@ const char* help =
|
||||
" to the case label of the destination state and continue execution to\n"
|
||||
" the head of the loop.\n"
|
||||
"\n"
|
||||
" --computed-continue\n"
|
||||
"\n"
|
||||
" This option requires the --loop-switch code model. It uses computed\n"
|
||||
" continue statements to select the next switch case directly, enabling\n"
|
||||
" jump-table optimization similar to --computed-gotos in the goto/label\n"
|
||||
" code model.\n"
|
||||
"\n"
|
||||
" --nested-ifs -s\n"
|
||||
"\n"
|
||||
" Use nested if statements instead of switch statements in conditional\n"
|
||||
@@ -489,6 +496,14 @@ const char* help =
|
||||
"\n"
|
||||
" Warn about rules that are shadowed by other rules and will never match.\n"
|
||||
"\n"
|
||||
" -Wdeprecated-eof_rule\n"
|
||||
"\n"
|
||||
" Warn about standalone end of input rules $ that will be broken by the\n"
|
||||
" future changes and require fixing. At the moment these rules take\n"
|
||||
" precedence when conflicting with other rules, but after the\n"
|
||||
" introduction of generalized end of input symbol $ precedence order will\n"
|
||||
" change and these rules will become shadowed by other rules.\n"
|
||||
"\n"
|
||||
" -Wuseless-escape\n"
|
||||
"\n"
|
||||
" Warn if a symbol is escaped when it shouldn't be. By default, re2c\n"
|
||||
|
||||
@@ -15,7 +15,7 @@ const char* help =
|
||||
" --api <simple | record | generic>\n"
|
||||
"\n"
|
||||
" Specify the API used by the generated code to interface with used-\n"
|
||||
" defined code. Option simple shold be used in simple cases when there's\n"
|
||||
" defined code. Option simple should be used in simple cases when there's\n"
|
||||
" no need for buffer refilling and storing lexer state. Option record\n"
|
||||
" should be used when lexer state needs to be stored in a record (struct,\n"
|
||||
" class, etc.). Option generic should be used in complex cases when the\n"
|
||||
@@ -176,6 +176,13 @@ const char* help =
|
||||
" to the case label of the destination state and continue execution to\n"
|
||||
" the head of the loop.\n"
|
||||
"\n"
|
||||
" --computed-continue\n"
|
||||
"\n"
|
||||
" This option requires the --loop-switch code model. It uses computed\n"
|
||||
" continue statements to select the next switch case directly, enabling\n"
|
||||
" jump-table optimization similar to --computed-gotos in the goto/label\n"
|
||||
" code model.\n"
|
||||
"\n"
|
||||
" --nested-ifs -s\n"
|
||||
"\n"
|
||||
" Use nested if statements instead of switch statements in conditional\n"
|
||||
@@ -489,6 +496,14 @@ const char* help =
|
||||
"\n"
|
||||
" Warn about rules that are shadowed by other rules and will never match.\n"
|
||||
"\n"
|
||||
" -Wdeprecated-eof_rule\n"
|
||||
"\n"
|
||||
" Warn about standalone end of input rules $ that will be broken by the\n"
|
||||
" future changes and require fixing. At the moment these rules take\n"
|
||||
" precedence when conflicting with other rules, but after the\n"
|
||||
" introduction of generalized end of input symbol $ precedence order will\n"
|
||||
" change and these rules will become shadowed by other rules.\n"
|
||||
"\n"
|
||||
" -Wuseless-escape\n"
|
||||
"\n"
|
||||
" Warn if a symbol is escaped when it shouldn't be. By default, re2d\n"
|
||||
|
||||
@@ -15,7 +15,7 @@ const char* help =
|
||||
" --api <simple | record | generic>\n"
|
||||
"\n"
|
||||
" Specify the API used by the generated code to interface with used-\n"
|
||||
" defined code. Option simple shold be used in simple cases when there's\n"
|
||||
" defined code. Option simple should be used in simple cases when there's\n"
|
||||
" no need for buffer refilling and storing lexer state. Option record\n"
|
||||
" should be used when lexer state needs to be stored in a record (struct,\n"
|
||||
" class, etc.). Option generic should be used in complex cases when the\n"
|
||||
@@ -176,6 +176,13 @@ const char* help =
|
||||
" to the case label of the destination state and continue execution to\n"
|
||||
" the head of the loop.\n"
|
||||
"\n"
|
||||
" --computed-continue\n"
|
||||
"\n"
|
||||
" This option requires the --loop-switch code model. It uses computed\n"
|
||||
" continue statements to select the next switch case directly, enabling\n"
|
||||
" jump-table optimization similar to --computed-gotos in the goto/label\n"
|
||||
" code model.\n"
|
||||
"\n"
|
||||
" --nested-ifs -s\n"
|
||||
"\n"
|
||||
" Use nested if statements instead of switch statements in conditional\n"
|
||||
@@ -489,6 +496,14 @@ const char* help =
|
||||
"\n"
|
||||
" Warn about rules that are shadowed by other rules and will never match.\n"
|
||||
"\n"
|
||||
" -Wdeprecated-eof_rule\n"
|
||||
"\n"
|
||||
" Warn about standalone end of input rules $ that will be broken by the\n"
|
||||
" future changes and require fixing. At the moment these rules take\n"
|
||||
" precedence when conflicting with other rules, but after the\n"
|
||||
" introduction of generalized end of input symbol $ precedence order will\n"
|
||||
" change and these rules will become shadowed by other rules.\n"
|
||||
"\n"
|
||||
" -Wuseless-escape\n"
|
||||
"\n"
|
||||
" Warn if a symbol is escaped when it shouldn't be. By default, re2go\n"
|
||||
|
||||
@@ -15,7 +15,7 @@ const char* help =
|
||||
" --api <simple | record | generic>\n"
|
||||
"\n"
|
||||
" Specify the API used by the generated code to interface with used-\n"
|
||||
" defined code. Option simple shold be used in simple cases when there's\n"
|
||||
" defined code. Option simple should be used in simple cases when there's\n"
|
||||
" no need for buffer refilling and storing lexer state. Option record\n"
|
||||
" should be used when lexer state needs to be stored in a record (struct,\n"
|
||||
" class, etc.). Option generic should be used in complex cases when the\n"
|
||||
@@ -176,6 +176,13 @@ const char* help =
|
||||
" to the case label of the destination state and continue execution to\n"
|
||||
" the head of the loop.\n"
|
||||
"\n"
|
||||
" --computed-continue\n"
|
||||
"\n"
|
||||
" This option requires the --loop-switch code model. It uses computed\n"
|
||||
" continue statements to select the next switch case directly, enabling\n"
|
||||
" jump-table optimization similar to --computed-gotos in the goto/label\n"
|
||||
" code model.\n"
|
||||
"\n"
|
||||
" --nested-ifs -s\n"
|
||||
"\n"
|
||||
" Use nested if statements instead of switch statements in conditional\n"
|
||||
@@ -489,6 +496,14 @@ const char* help =
|
||||
"\n"
|
||||
" Warn about rules that are shadowed by other rules and will never match.\n"
|
||||
"\n"
|
||||
" -Wdeprecated-eof_rule\n"
|
||||
"\n"
|
||||
" Warn about standalone end of input rules $ that will be broken by the\n"
|
||||
" future changes and require fixing. At the moment these rules take\n"
|
||||
" precedence when conflicting with other rules, but after the\n"
|
||||
" introduction of generalized end of input symbol $ precedence order will\n"
|
||||
" change and these rules will become shadowed by other rules.\n"
|
||||
"\n"
|
||||
" -Wuseless-escape\n"
|
||||
"\n"
|
||||
" Warn if a symbol is escaped when it shouldn't be. By default, re2hs\n"
|
||||
|
||||
@@ -15,7 +15,7 @@ const char* help =
|
||||
" --api <simple | record | generic>\n"
|
||||
"\n"
|
||||
" Specify the API used by the generated code to interface with used-\n"
|
||||
" defined code. Option simple shold be used in simple cases when there's\n"
|
||||
" defined code. Option simple should be used in simple cases when there's\n"
|
||||
" no need for buffer refilling and storing lexer state. Option record\n"
|
||||
" should be used when lexer state needs to be stored in a record (struct,\n"
|
||||
" class, etc.). Option generic should be used in complex cases when the\n"
|
||||
@@ -177,6 +177,13 @@ const char* help =
|
||||
" to the case label of the destination state and continue execution to\n"
|
||||
" the head of the loop.\n"
|
||||
"\n"
|
||||
" --computed-continue\n"
|
||||
"\n"
|
||||
" This option requires the --loop-switch code model. It uses computed\n"
|
||||
" continue statements to select the next switch case directly, enabling\n"
|
||||
" jump-table optimization similar to --computed-gotos in the goto/label\n"
|
||||
" code model.\n"
|
||||
"\n"
|
||||
" --nested-ifs -s\n"
|
||||
"\n"
|
||||
" Use nested if statements instead of switch statements in conditional\n"
|
||||
@@ -490,6 +497,14 @@ const char* help =
|
||||
"\n"
|
||||
" Warn about rules that are shadowed by other rules and will never match.\n"
|
||||
"\n"
|
||||
" -Wdeprecated-eof_rule\n"
|
||||
"\n"
|
||||
" Warn about standalone end of input rules $ that will be broken by the\n"
|
||||
" future changes and require fixing. At the moment these rules take\n"
|
||||
" precedence when conflicting with other rules, but after the\n"
|
||||
" introduction of generalized end of input symbol $ precedence order will\n"
|
||||
" change and these rules will become shadowed by other rules.\n"
|
||||
"\n"
|
||||
" -Wuseless-escape\n"
|
||||
"\n"
|
||||
" Warn if a symbol is escaped when it shouldn't be. By default, re2java\n"
|
||||
|
||||
@@ -15,7 +15,7 @@ const char* help =
|
||||
" --api <simple | record | generic>\n"
|
||||
"\n"
|
||||
" Specify the API used by the generated code to interface with used-\n"
|
||||
" defined code. Option simple shold be used in simple cases when there's\n"
|
||||
" defined code. Option simple should be used in simple cases when there's\n"
|
||||
" no need for buffer refilling and storing lexer state. Option record\n"
|
||||
" should be used when lexer state needs to be stored in a record (struct,\n"
|
||||
" class, etc.). Option generic should be used in complex cases when the\n"
|
||||
@@ -176,6 +176,13 @@ const char* help =
|
||||
" to the case label of the destination state and continue execution to\n"
|
||||
" the head of the loop.\n"
|
||||
"\n"
|
||||
" --computed-continue\n"
|
||||
"\n"
|
||||
" This option requires the --loop-switch code model. It uses computed\n"
|
||||
" continue statements to select the next switch case directly, enabling\n"
|
||||
" jump-table optimization similar to --computed-gotos in the goto/label\n"
|
||||
" code model.\n"
|
||||
"\n"
|
||||
" --nested-ifs -s\n"
|
||||
"\n"
|
||||
" Use nested if statements instead of switch statements in conditional\n"
|
||||
@@ -489,6 +496,14 @@ const char* help =
|
||||
"\n"
|
||||
" Warn about rules that are shadowed by other rules and will never match.\n"
|
||||
"\n"
|
||||
" -Wdeprecated-eof_rule\n"
|
||||
"\n"
|
||||
" Warn about standalone end of input rules $ that will be broken by the\n"
|
||||
" future changes and require fixing. At the moment these rules take\n"
|
||||
" precedence when conflicting with other rules, but after the\n"
|
||||
" introduction of generalized end of input symbol $ precedence order will\n"
|
||||
" change and these rules will become shadowed by other rules.\n"
|
||||
"\n"
|
||||
" -Wuseless-escape\n"
|
||||
"\n"
|
||||
" Warn if a symbol is escaped when it shouldn't be. By default, re2js\n"
|
||||
|
||||
@@ -15,7 +15,7 @@ const char* help =
|
||||
" --api <simple | record | generic>\n"
|
||||
"\n"
|
||||
" Specify the API used by the generated code to interface with used-\n"
|
||||
" defined code. Option simple shold be used in simple cases when there's\n"
|
||||
" defined code. Option simple should be used in simple cases when there's\n"
|
||||
" no need for buffer refilling and storing lexer state. Option record\n"
|
||||
" should be used when lexer state needs to be stored in a record (struct,\n"
|
||||
" class, etc.). Option generic should be used in complex cases when the\n"
|
||||
@@ -178,6 +178,13 @@ const char* help =
|
||||
" to the case label of the destination state and continue execution to\n"
|
||||
" the head of the loop.\n"
|
||||
"\n"
|
||||
" --computed-continue\n"
|
||||
"\n"
|
||||
" This option requires the --loop-switch code model. It uses computed\n"
|
||||
" continue statements to select the next switch case directly, enabling\n"
|
||||
" jump-table optimization similar to --computed-gotos in the goto/label\n"
|
||||
" code model.\n"
|
||||
"\n"
|
||||
" --nested-ifs -s\n"
|
||||
"\n"
|
||||
" Use nested if statements instead of switch statements in conditional\n"
|
||||
@@ -491,6 +498,14 @@ const char* help =
|
||||
"\n"
|
||||
" Warn about rules that are shadowed by other rules and will never match.\n"
|
||||
"\n"
|
||||
" -Wdeprecated-eof_rule\n"
|
||||
"\n"
|
||||
" Warn about standalone end of input rules $ that will be broken by the\n"
|
||||
" future changes and require fixing. At the moment these rules take\n"
|
||||
" precedence when conflicting with other rules, but after the\n"
|
||||
" introduction of generalized end of input symbol $ precedence order will\n"
|
||||
" change and these rules will become shadowed by other rules.\n"
|
||||
"\n"
|
||||
" -Wuseless-escape\n"
|
||||
"\n"
|
||||
" Warn if a symbol is escaped when it shouldn't be. By default, re2ocaml\n"
|
||||
|
||||
@@ -15,7 +15,7 @@ const char* help =
|
||||
" --api <simple | record | generic>\n"
|
||||
"\n"
|
||||
" Specify the API used by the generated code to interface with used-\n"
|
||||
" defined code. Option simple shold be used in simple cases when there's\n"
|
||||
" defined code. Option simple should be used in simple cases when there's\n"
|
||||
" no need for buffer refilling and storing lexer state. Option record\n"
|
||||
" should be used when lexer state needs to be stored in a record (struct,\n"
|
||||
" class, etc.). Option generic should be used in complex cases when the\n"
|
||||
@@ -176,6 +176,13 @@ const char* help =
|
||||
" to the case label of the destination state and continue execution to\n"
|
||||
" the head of the loop.\n"
|
||||
"\n"
|
||||
" --computed-continue\n"
|
||||
"\n"
|
||||
" This option requires the --loop-switch code model. It uses computed\n"
|
||||
" continue statements to select the next switch case directly, enabling\n"
|
||||
" jump-table optimization similar to --computed-gotos in the goto/label\n"
|
||||
" code model.\n"
|
||||
"\n"
|
||||
" --nested-ifs -s\n"
|
||||
"\n"
|
||||
" Use nested if statements instead of switch statements in conditional\n"
|
||||
@@ -489,6 +496,14 @@ const char* help =
|
||||
"\n"
|
||||
" Warn about rules that are shadowed by other rules and will never match.\n"
|
||||
"\n"
|
||||
" -Wdeprecated-eof_rule\n"
|
||||
"\n"
|
||||
" Warn about standalone end of input rules $ that will be broken by the\n"
|
||||
" future changes and require fixing. At the moment these rules take\n"
|
||||
" precedence when conflicting with other rules, but after the\n"
|
||||
" introduction of generalized end of input symbol $ precedence order will\n"
|
||||
" change and these rules will become shadowed by other rules.\n"
|
||||
"\n"
|
||||
" -Wuseless-escape\n"
|
||||
"\n"
|
||||
" Warn if a symbol is escaped when it shouldn't be. By default, re2py\n"
|
||||
|
||||
@@ -15,7 +15,7 @@ const char* help =
|
||||
" --api <simple | record | generic>\n"
|
||||
"\n"
|
||||
" Specify the API used by the generated code to interface with used-\n"
|
||||
" defined code. Option simple shold be used in simple cases when there's\n"
|
||||
" defined code. Option simple should be used in simple cases when there's\n"
|
||||
" no need for buffer refilling and storing lexer state. Option record\n"
|
||||
" should be used when lexer state needs to be stored in a record (struct,\n"
|
||||
" class, etc.). Option generic should be used in complex cases when the\n"
|
||||
@@ -177,6 +177,13 @@ const char* help =
|
||||
" to the case label of the destination state and continue execution to\n"
|
||||
" the head of the loop.\n"
|
||||
"\n"
|
||||
" --computed-continue\n"
|
||||
"\n"
|
||||
" This option requires the --loop-switch code model. It uses computed\n"
|
||||
" continue statements to select the next switch case directly, enabling\n"
|
||||
" jump-table optimization similar to --computed-gotos in the goto/label\n"
|
||||
" code model.\n"
|
||||
"\n"
|
||||
" --nested-ifs -s\n"
|
||||
"\n"
|
||||
" Use nested if statements instead of switch statements in conditional\n"
|
||||
@@ -490,6 +497,14 @@ const char* help =
|
||||
"\n"
|
||||
" Warn about rules that are shadowed by other rules and will never match.\n"
|
||||
"\n"
|
||||
" -Wdeprecated-eof_rule\n"
|
||||
"\n"
|
||||
" Warn about standalone end of input rules $ that will be broken by the\n"
|
||||
" future changes and require fixing. At the moment these rules take\n"
|
||||
" precedence when conflicting with other rules, but after the\n"
|
||||
" introduction of generalized end of input symbol $ precedence order will\n"
|
||||
" change and these rules will become shadowed by other rules.\n"
|
||||
"\n"
|
||||
" -Wuseless-escape\n"
|
||||
"\n"
|
||||
" Warn if a symbol is escaped when it shouldn't be. By default, re2rust\n"
|
||||
|
||||
@@ -15,7 +15,7 @@ const char* help =
|
||||
" --api <simple | record | generic>\n"
|
||||
"\n"
|
||||
" Specify the API used by the generated code to interface with used-\n"
|
||||
" defined code. Option simple shold be used in simple cases when there's\n"
|
||||
" defined code. Option simple should be used in simple cases when there's\n"
|
||||
" no need for buffer refilling and storing lexer state. Option record\n"
|
||||
" should be used when lexer state needs to be stored in a record (struct,\n"
|
||||
" class, etc.). Option generic should be used in complex cases when the\n"
|
||||
@@ -178,6 +178,13 @@ const char* help =
|
||||
" to the case label of the destination state and continue execution to\n"
|
||||
" the head of the loop.\n"
|
||||
"\n"
|
||||
" --computed-continue\n"
|
||||
"\n"
|
||||
" This option requires the --loop-switch code model. It uses computed\n"
|
||||
" continue statements to select the next switch case directly, enabling\n"
|
||||
" jump-table optimization similar to --computed-gotos in the goto/label\n"
|
||||
" code model.\n"
|
||||
"\n"
|
||||
" --nested-ifs -s\n"
|
||||
"\n"
|
||||
" Use nested if statements instead of switch statements in conditional\n"
|
||||
@@ -491,6 +498,14 @@ const char* help =
|
||||
"\n"
|
||||
" Warn about rules that are shadowed by other rules and will never match.\n"
|
||||
"\n"
|
||||
" -Wdeprecated-eof_rule\n"
|
||||
"\n"
|
||||
" Warn about standalone end of input rules $ that will be broken by the\n"
|
||||
" future changes and require fixing. At the moment these rules take\n"
|
||||
" precedence when conflicting with other rules, but after the\n"
|
||||
" introduction of generalized end of input symbol $ precedence order will\n"
|
||||
" change and these rules will become shadowed by other rules.\n"
|
||||
"\n"
|
||||
" -Wuseless-escape\n"
|
||||
"\n"
|
||||
" Warn if a symbol is escaped when it shouldn't be. By default, re2swift\n"
|
||||
|
||||
@@ -15,7 +15,7 @@ const char* help =
|
||||
" --api <simple | record | generic>\n"
|
||||
"\n"
|
||||
" Specify the API used by the generated code to interface with used-\n"
|
||||
" defined code. Option simple shold be used in simple cases when there's\n"
|
||||
" defined code. Option simple should be used in simple cases when there's\n"
|
||||
" no need for buffer refilling and storing lexer state. Option record\n"
|
||||
" should be used when lexer state needs to be stored in a record (struct,\n"
|
||||
" class, etc.). Option generic should be used in complex cases when the\n"
|
||||
@@ -176,6 +176,13 @@ const char* help =
|
||||
" to the case label of the destination state and continue execution to\n"
|
||||
" the head of the loop.\n"
|
||||
"\n"
|
||||
" --computed-continue\n"
|
||||
"\n"
|
||||
" This option requires the --loop-switch code model. It uses computed\n"
|
||||
" continue statements to select the next switch case directly, enabling\n"
|
||||
" jump-table optimization similar to --computed-gotos in the goto/label\n"
|
||||
" code model.\n"
|
||||
"\n"
|
||||
" --nested-ifs -s\n"
|
||||
"\n"
|
||||
" Use nested if statements instead of switch statements in conditional\n"
|
||||
@@ -489,6 +496,14 @@ const char* help =
|
||||
"\n"
|
||||
" Warn about rules that are shadowed by other rules and will never match.\n"
|
||||
"\n"
|
||||
" -Wdeprecated-eof_rule\n"
|
||||
"\n"
|
||||
" Warn about standalone end of input rules $ that will be broken by the\n"
|
||||
" future changes and require fixing. At the moment these rules take\n"
|
||||
" precedence when conflicting with other rules, but after the\n"
|
||||
" introduction of generalized end of input symbol $ precedence order will\n"
|
||||
" change and these rules will become shadowed by other rules.\n"
|
||||
"\n"
|
||||
" -Wuseless-escape\n"
|
||||
"\n"
|
||||
" Warn if a symbol is escaped when it shouldn't be. By default, re2v\n"
|
||||
|
||||
@@ -15,7 +15,7 @@ const char* help =
|
||||
" --api <simple | record | generic>\n"
|
||||
"\n"
|
||||
" Specify the API used by the generated code to interface with used-\n"
|
||||
" defined code. Option simple shold be used in simple cases when there's\n"
|
||||
" defined code. Option simple should be used in simple cases when there's\n"
|
||||
" no need for buffer refilling and storing lexer state. Option record\n"
|
||||
" should be used when lexer state needs to be stored in a record (struct,\n"
|
||||
" class, etc.). Option generic should be used in complex cases when the\n"
|
||||
@@ -177,6 +177,13 @@ const char* help =
|
||||
" to the case label of the destination state and continue execution to\n"
|
||||
" the head of the loop.\n"
|
||||
"\n"
|
||||
" --computed-continue\n"
|
||||
"\n"
|
||||
" This option requires the --loop-switch code model. It uses computed\n"
|
||||
" continue statements to select the next switch case directly, enabling\n"
|
||||
" jump-table optimization similar to --computed-gotos in the goto/label\n"
|
||||
" code model.\n"
|
||||
"\n"
|
||||
" --nested-ifs -s\n"
|
||||
"\n"
|
||||
" Use nested if statements instead of switch statements in conditional\n"
|
||||
@@ -490,6 +497,14 @@ const char* help =
|
||||
"\n"
|
||||
" Warn about rules that are shadowed by other rules and will never match.\n"
|
||||
"\n"
|
||||
" -Wdeprecated-eof_rule\n"
|
||||
"\n"
|
||||
" Warn about standalone end of input rules $ that will be broken by the\n"
|
||||
" future changes and require fixing. At the moment these rules take\n"
|
||||
" precedence when conflicting with other rules, but after the\n"
|
||||
" introduction of generalized end of input symbol $ precedence order will\n"
|
||||
" change and these rules will become shadowed by other rules.\n"
|
||||
"\n"
|
||||
" -Wuseless-escape\n"
|
||||
"\n"
|
||||
" Warn if a symbol is escaped when it shouldn't be. By default, re2zig\n"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 4.2 */
|
||||
/* Generated by re2c 4.6 */
|
||||
#line 1 "../src/msg/ver_to_vernum.re"
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
+3403
-3283
File diff suppressed because it is too large
Load Diff
+6834
-6673
File diff suppressed because it is too large
Load Diff
+2227
-2219
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 4.2 */
|
||||
/* Generated by re2c 4.6 */
|
||||
|
||||
#ifndef _RE2C_PARSE_LEX_
|
||||
#define _RE2C_PARSE_LEX_
|
||||
|
||||
+178
-201
@@ -147,28 +147,27 @@ enum yysymbol_kind_t
|
||||
YYSYMBOL_23_ = 23, /* '=' */
|
||||
YYSYMBOL_24_ = 24, /* ';' */
|
||||
YYSYMBOL_25_ = 25, /* '*' */
|
||||
YYSYMBOL_26_ = 26, /* '$' */
|
||||
YYSYMBOL_27_ = 27, /* '|' */
|
||||
YYSYMBOL_28_ = 28, /* '\\' */
|
||||
YYSYMBOL_29_ = 29, /* '+' */
|
||||
YYSYMBOL_30_ = 30, /* '?' */
|
||||
YYSYMBOL_31_ = 31, /* '(' */
|
||||
YYSYMBOL_32_ = 32, /* ')' */
|
||||
YYSYMBOL_YYACCEPT = 33, /* $accept */
|
||||
YYSYMBOL_spec = 34, /* spec */
|
||||
YYSYMBOL_def = 35, /* def */
|
||||
YYSYMBOL_name = 36, /* name */
|
||||
YYSYMBOL_enddef = 37, /* enddef */
|
||||
YYSYMBOL_rule = 38, /* rule */
|
||||
YYSYMBOL_ccode = 39, /* ccode */
|
||||
YYSYMBOL_trailexpr = 40, /* trailexpr */
|
||||
YYSYMBOL_expr = 41, /* expr */
|
||||
YYSYMBOL_diff = 42, /* diff */
|
||||
YYSYMBOL_term = 43, /* term */
|
||||
YYSYMBOL_factor = 44, /* factor */
|
||||
YYSYMBOL_closes = 45, /* closes */
|
||||
YYSYMBOL_close = 46, /* close */
|
||||
YYSYMBOL_primary = 47 /* primary */
|
||||
YYSYMBOL_26_ = 26, /* '|' */
|
||||
YYSYMBOL_27_ = 27, /* '\\' */
|
||||
YYSYMBOL_28_ = 28, /* '+' */
|
||||
YYSYMBOL_29_ = 29, /* '?' */
|
||||
YYSYMBOL_30_ = 30, /* '(' */
|
||||
YYSYMBOL_31_ = 31, /* ')' */
|
||||
YYSYMBOL_YYACCEPT = 32, /* $accept */
|
||||
YYSYMBOL_spec = 33, /* spec */
|
||||
YYSYMBOL_def = 34, /* def */
|
||||
YYSYMBOL_name = 35, /* name */
|
||||
YYSYMBOL_enddef = 36, /* enddef */
|
||||
YYSYMBOL_rule = 37, /* rule */
|
||||
YYSYMBOL_ccode = 38, /* ccode */
|
||||
YYSYMBOL_trailexpr = 39, /* trailexpr */
|
||||
YYSYMBOL_expr = 40, /* expr */
|
||||
YYSYMBOL_diff = 41, /* diff */
|
||||
YYSYMBOL_term = 42, /* term */
|
||||
YYSYMBOL_factor = 43, /* factor */
|
||||
YYSYMBOL_closes = 44, /* closes */
|
||||
YYSYMBOL_close = 45, /* close */
|
||||
YYSYMBOL_primary = 46 /* primary */
|
||||
};
|
||||
typedef enum yysymbol_kind_t yysymbol_kind_t;
|
||||
|
||||
@@ -496,16 +495,16 @@ union yyalloc
|
||||
/* YYFINAL -- State number of the termination state. */
|
||||
#define YYFINAL 2
|
||||
/* YYLAST -- Last index in YYTABLE. */
|
||||
#define YYLAST 75
|
||||
#define YYLAST 71
|
||||
|
||||
/* YYNTOKENS -- Number of terminals. */
|
||||
#define YYNTOKENS 33
|
||||
#define YYNTOKENS 32
|
||||
/* YYNNTS -- Number of nonterminals. */
|
||||
#define YYNNTS 15
|
||||
/* YYNRULES -- Number of rules. */
|
||||
#define YYNRULES 50
|
||||
#define YYNRULES 48
|
||||
/* YYNSTATES -- Number of states. */
|
||||
#define YYNSTATES 77
|
||||
#define YYNSTATES 73
|
||||
|
||||
/* YYMAXUTOK -- Last valid token kind. */
|
||||
#define YYMAXUTOK 276
|
||||
@@ -525,16 +524,16 @@ static const yytype_int8 yytranslate[] =
|
||||
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 26, 2, 2, 2,
|
||||
31, 32, 25, 29, 2, 2, 2, 22, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
30, 31, 25, 28, 2, 2, 2, 22, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 24,
|
||||
2, 23, 2, 30, 2, 2, 2, 2, 2, 2,
|
||||
2, 23, 2, 29, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 28, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 27, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 27, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 26, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
@@ -558,10 +557,9 @@ static const yytype_uint8 yyrline[] =
|
||||
{
|
||||
0, 81, 81, 82, 86, 90, 91, 92, 96, 99,
|
||||
105, 106, 109, 109, 112, 115, 118, 121, 124, 127,
|
||||
130, 136, 142, 148, 154, 160, 166, 172, 179, 180,
|
||||
185, 190, 191, 197, 198, 202, 203, 207, 209, 213,
|
||||
214, 227, 233, 234, 238, 239, 240, 244, 245, 254,
|
||||
255
|
||||
133, 139, 145, 151, 157, 163, 170, 171, 176, 181,
|
||||
182, 188, 189, 193, 194, 198, 200, 204, 205, 218,
|
||||
224, 225, 229, 230, 231, 235, 236, 245, 246
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -582,8 +580,8 @@ static const char *const yytname[] =
|
||||
"TOKEN_CLOSESIZE", "TOKEN_CODE", "TOKEN_CONF", "TOKEN_ID", "TOKEN_FID",
|
||||
"TOKEN_FID_END", "TOKEN_LINE_INFO", "TOKEN_REGEXP", "TOKEN_BLOCK",
|
||||
"TOKEN_ENTRY", "TOKEN_PRE_RULE", "TOKEN_POST_RULE", "TOKEN_LPAREN_NEG",
|
||||
"TOKEN_ERROR", "'/'", "'='", "';'", "'*'", "'$'", "'|'", "'\\\\'", "'+'",
|
||||
"'?'", "'('", "')'", "$accept", "spec", "def", "name", "enddef", "rule",
|
||||
"TOKEN_ERROR", "'/'", "'='", "';'", "'*'", "'|'", "'\\\\'", "'+'", "'?'",
|
||||
"'('", "')'", "$accept", "spec", "def", "name", "enddef", "rule",
|
||||
"ccode", "trailexpr", "expr", "diff", "term", "factor", "closes",
|
||||
"close", "primary", YY_NULLPTR
|
||||
};
|
||||
@@ -595,7 +593,7 @@ yysymbol_name (yysymbol_kind_t yysymbol)
|
||||
}
|
||||
#endif
|
||||
|
||||
#define YYPACT_NINF (-25)
|
||||
#define YYPACT_NINF (-23)
|
||||
|
||||
#define yypact_value_is_default(Yyn) \
|
||||
((Yyn) == YYPACT_NINF)
|
||||
@@ -609,14 +607,14 @@ yysymbol_name (yysymbol_kind_t yysymbol)
|
||||
STATE-NUM. */
|
||||
static const yytype_int8 yypact[] =
|
||||
{
|
||||
-25, 1, -25, 30, 5, 20, -25, -13, -25, -25,
|
||||
-25, -25, 25, 31, 43, 22, 48, 54, 22, -25,
|
||||
22, -25, 55, -18, 10, -25, 22, 14, -25, 20,
|
||||
20, 20, 20, 20, 20, -25, -25, 63, -25, -25,
|
||||
-25, -25, -25, -25, -2, -25, -25, 4, 38, -25,
|
||||
22, 22, 22, -25, -25, -25, -25, -25, 29, -25,
|
||||
-25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
|
||||
-25, -25, -25, 19, 10, -25, -25
|
||||
-23, 1, -23, 29, 42, 26, -23, -13, -23, -23,
|
||||
-23, -23, 44, 48, 49, -6, 56, -6, -23, -6,
|
||||
-23, 57, 11, 40, -23, -6, 14, -23, 26, 26,
|
||||
26, 26, 26, -23, -23, 59, -23, -23, -23, -23,
|
||||
-23, -23, -3, -23, 19, 12, -23, -6, -6, -6,
|
||||
-23, -23, -23, -23, -23, 27, -23, -23, -23, -23,
|
||||
-23, -23, -23, -23, -23, -23, -23, -23, -23, 15,
|
||||
40, -23, -23
|
||||
};
|
||||
|
||||
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
|
||||
@@ -624,28 +622,28 @@ static const yytype_int8 yypact[] =
|
||||
means the default is an error. */
|
||||
static const yytype_int8 yydefact[] =
|
||||
{
|
||||
2, 0, 1, 0, 0, 0, 4, 48, 11, 7,
|
||||
47, 3, 0, 0, 0, 0, 0, 0, 0, 5,
|
||||
0, 6, 0, 31, 33, 35, 37, 39, 48, 0,
|
||||
0, 0, 0, 0, 0, 26, 30, 0, 28, 27,
|
||||
10, 17, 18, 19, 0, 15, 16, 0, 0, 14,
|
||||
0, 0, 0, 38, 41, 44, 45, 46, 40, 42,
|
||||
23, 24, 25, 21, 22, 20, 29, 50, 49, 13,
|
||||
9, 12, 8, 32, 34, 36, 43
|
||||
2, 0, 1, 0, 0, 0, 4, 46, 11, 7,
|
||||
45, 3, 0, 0, 0, 0, 0, 0, 5, 0,
|
||||
6, 0, 29, 31, 33, 35, 37, 46, 0, 0,
|
||||
0, 0, 0, 24, 28, 0, 26, 25, 10, 16,
|
||||
17, 18, 0, 15, 0, 0, 14, 0, 0, 0,
|
||||
36, 39, 42, 43, 44, 38, 40, 21, 22, 23,
|
||||
20, 19, 27, 48, 47, 13, 9, 12, 8, 30,
|
||||
32, 34, 41
|
||||
};
|
||||
|
||||
/* YYPGOTO[NTERM-NUM]. */
|
||||
static const yytype_int8 yypgoto[] =
|
||||
{
|
||||
-25, -25, -25, -25, -25, -25, 37, 70, -15, 23,
|
||||
-24, -25, -25, 17, -25
|
||||
-23, -23, -23, -23, -23, -23, 32, 66, -15, 22,
|
||||
-22, -23, -23, 16, -23
|
||||
};
|
||||
|
||||
/* YYDEFGOTO[NTERM-NUM]. */
|
||||
static const yytype_int8 yydefgoto[] =
|
||||
{
|
||||
0, 1, 19, 20, 72, 21, 39, 22, 23, 24,
|
||||
25, 26, 58, 59, 27
|
||||
0, 1, 18, 19, 68, 20, 37, 21, 22, 23,
|
||||
24, 25, 55, 56, 26
|
||||
};
|
||||
|
||||
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
|
||||
@@ -653,62 +651,60 @@ static const yytype_int8 yydefgoto[] =
|
||||
number is the opposite. If YYTABLE_NINF, syntax error. */
|
||||
static const yytype_int8 yytable[] =
|
||||
{
|
||||
44, 2, 53, 47, 50, 48, 3, 4, 5, 51,
|
||||
40, 6, 7, 8, 35, 9, 10, 11, 12, 13,
|
||||
14, 15, 54, 36, 37, 51, 16, 17, 75, 38,
|
||||
67, 51, 18, 28, 41, 73, 68, 10, 52, 55,
|
||||
42, 28, 15, 56, 57, 10, 51, 29, 30, 31,
|
||||
15, 69, 43, 18, 55, 32, 33, 45, 56, 57,
|
||||
70, 18, 71, 46, 49, 51, 60, 61, 62, 63,
|
||||
64, 65, 66, 34, 74, 76
|
||||
42, 2, 44, 50, 45, 27, 3, 4, 5, 10,
|
||||
38, 6, 7, 8, 15, 9, 10, 11, 12, 13,
|
||||
14, 15, 51, 48, 17, 65, 16, 71, 63, 34,
|
||||
35, 17, 69, 47, 66, 36, 67, 48, 48, 52,
|
||||
27, 48, 53, 54, 10, 48, 28, 29, 30, 15,
|
||||
64, 33, 52, 39, 31, 53, 54, 40, 41, 17,
|
||||
57, 58, 59, 60, 61, 43, 46, 49, 62, 32,
|
||||
70, 72
|
||||
};
|
||||
|
||||
static const yytype_int8 yycheck[] =
|
||||
{
|
||||
15, 0, 26, 18, 22, 20, 5, 6, 7, 27,
|
||||
23, 10, 11, 12, 9, 14, 15, 16, 17, 18,
|
||||
19, 20, 8, 3, 4, 27, 25, 26, 52, 9,
|
||||
32, 27, 31, 11, 9, 50, 32, 15, 28, 25,
|
||||
9, 11, 20, 29, 30, 15, 27, 17, 18, 19,
|
||||
20, 13, 9, 31, 25, 25, 26, 9, 29, 30,
|
||||
22, 31, 24, 9, 9, 27, 29, 30, 31, 32,
|
||||
33, 34, 9, 3, 51, 58
|
||||
15, 0, 17, 25, 19, 11, 5, 6, 7, 15,
|
||||
23, 10, 11, 12, 20, 14, 15, 16, 17, 18,
|
||||
19, 20, 8, 26, 30, 13, 25, 49, 31, 3,
|
||||
4, 30, 47, 22, 22, 9, 24, 26, 26, 25,
|
||||
11, 26, 28, 29, 15, 26, 17, 18, 19, 20,
|
||||
31, 9, 25, 9, 25, 28, 29, 9, 9, 30,
|
||||
28, 29, 30, 31, 32, 9, 9, 27, 9, 3,
|
||||
48, 55
|
||||
};
|
||||
|
||||
/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
|
||||
state STATE-NUM. */
|
||||
static const yytype_int8 yystos[] =
|
||||
{
|
||||
0, 34, 0, 5, 6, 7, 10, 11, 12, 14,
|
||||
15, 16, 17, 18, 19, 20, 25, 26, 31, 35,
|
||||
36, 38, 40, 41, 42, 43, 44, 47, 11, 17,
|
||||
18, 19, 25, 26, 40, 9, 3, 4, 9, 39,
|
||||
23, 9, 9, 9, 41, 9, 9, 41, 41, 9,
|
||||
22, 27, 28, 43, 8, 25, 29, 30, 45, 46,
|
||||
39, 39, 39, 39, 39, 39, 9, 32, 32, 13,
|
||||
22, 24, 37, 41, 42, 43, 46
|
||||
0, 33, 0, 5, 6, 7, 10, 11, 12, 14,
|
||||
15, 16, 17, 18, 19, 20, 25, 30, 34, 35,
|
||||
37, 39, 40, 41, 42, 43, 46, 11, 17, 18,
|
||||
19, 25, 39, 9, 3, 4, 9, 38, 23, 9,
|
||||
9, 9, 40, 9, 40, 40, 9, 22, 26, 27,
|
||||
42, 8, 25, 28, 29, 44, 45, 38, 38, 38,
|
||||
38, 38, 9, 31, 31, 13, 22, 24, 36, 40,
|
||||
41, 42, 45
|
||||
};
|
||||
|
||||
/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
|
||||
static const yytype_int8 yyr1[] =
|
||||
{
|
||||
0, 33, 34, 34, 34, 34, 34, 34, 35, 35,
|
||||
36, 36, 37, 37, 38, 38, 38, 38, 38, 38,
|
||||
38, 38, 38, 38, 38, 38, 38, 38, 39, 39,
|
||||
39, 40, 40, 41, 41, 42, 42, 43, 43, 44,
|
||||
44, 44, 45, 45, 46, 46, 46, 47, 47, 47,
|
||||
47
|
||||
0, 32, 33, 33, 33, 33, 33, 33, 34, 34,
|
||||
35, 35, 36, 36, 37, 37, 37, 37, 37, 37,
|
||||
37, 37, 37, 37, 37, 37, 38, 38, 38, 39,
|
||||
39, 40, 40, 41, 41, 42, 42, 43, 43, 43,
|
||||
44, 44, 45, 45, 45, 46, 46, 46, 46
|
||||
};
|
||||
|
||||
/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
|
||||
static const yytype_int8 yyr2[] =
|
||||
{
|
||||
0, 2, 0, 2, 2, 2, 2, 2, 3, 3,
|
||||
2, 1, 1, 1, 2, 2, 2, 2, 2, 2,
|
||||
3, 3, 3, 3, 3, 3, 2, 2, 1, 2,
|
||||
1, 1, 3, 1, 3, 1, 3, 1, 2, 1,
|
||||
2, 2, 1, 2, 1, 1, 1, 1, 1, 3,
|
||||
3
|
||||
2, 1, 1, 1, 2, 2, 2, 2, 2, 3,
|
||||
3, 3, 3, 3, 2, 2, 1, 2, 1, 1,
|
||||
3, 1, 3, 1, 3, 1, 2, 1, 2, 2,
|
||||
1, 2, 1, 1, 1, 1, 1, 3, 3
|
||||
};
|
||||
|
||||
|
||||
@@ -1191,7 +1187,7 @@ yyreduce:
|
||||
if (use_block(input, ast, opts, grams, ast.temp_blockname) != Ret::OK) YYABORT;
|
||||
ast.temp_blockname.clear();
|
||||
}
|
||||
#line 1195 "src/parse/parser.cc"
|
||||
#line 1191 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 4: /* spec: spec TOKEN_CONF */
|
||||
@@ -1200,7 +1196,7 @@ yyreduce:
|
||||
// Handled here, as the main lexer should not get access to opts under construction.
|
||||
if (input.lex_conf(opts) != Ret::OK) YYABORT;
|
||||
}
|
||||
#line 1204 "src/parse/parser.cc"
|
||||
#line 1200 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 8: /* def: name expr enddef */
|
||||
@@ -1208,7 +1204,7 @@ yyreduce:
|
||||
{
|
||||
if (add_named_def(opts.symtab, (yyvsp[-2].cstr), (yyvsp[-1].regexp), input) != Ret::OK) YYABORT;
|
||||
}
|
||||
#line 1212 "src/parse/parser.cc"
|
||||
#line 1208 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 9: /* def: name expr '/' */
|
||||
@@ -1217,21 +1213,21 @@ yyreduce:
|
||||
input.error_at_tok("trailing contexts are not allowed in named definitions");
|
||||
YYABORT;
|
||||
}
|
||||
#line 1221 "src/parse/parser.cc"
|
||||
#line 1217 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 10: /* name: TOKEN_ID '=' */
|
||||
#line 105 "../src/parse/parser.ypp"
|
||||
{ (yyval.cstr) = (yyvsp[-1].cstr); }
|
||||
#line 1227 "src/parse/parser.cc"
|
||||
#line 1223 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 14: /* rule: trailexpr TOKEN_CODE */
|
||||
#line 112 "../src/parse/parser.ypp"
|
||||
{
|
||||
find_or_add_gram(grams, "").rules.push_back(AstRule((yyvsp[-1].regexp), (yyvsp[0].semact)));
|
||||
find_or_add_gram(grams, "").rules.push_back({(yyvsp[-1].regexp), (yyvsp[0].semact)});
|
||||
}
|
||||
#line 1235 "src/parse/parser.cc"
|
||||
#line 1231 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 15: /* rule: '*' TOKEN_CODE */
|
||||
@@ -1239,181 +1235,162 @@ yyreduce:
|
||||
{
|
||||
find_or_add_gram(grams, "").defs.push_back((yyvsp[0].semact));
|
||||
}
|
||||
#line 1243 "src/parse/parser.cc"
|
||||
#line 1239 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 16: /* rule: '$' TOKEN_CODE */
|
||||
case 16: /* rule: TOKEN_ENTRY TOKEN_CODE */
|
||||
#line 118 "../src/parse/parser.ypp"
|
||||
{
|
||||
find_or_add_gram(grams, "").eofs.push_back((yyvsp[0].semact));
|
||||
}
|
||||
#line 1251 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 17: /* rule: TOKEN_ENTRY TOKEN_CODE */
|
||||
#line 121 "../src/parse/parser.ypp"
|
||||
{
|
||||
find_or_add_gram(grams, "").entry.push_back((yyvsp[0].semact));
|
||||
}
|
||||
#line 1259 "src/parse/parser.cc"
|
||||
#line 1247 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 18: /* rule: TOKEN_PRE_RULE TOKEN_CODE */
|
||||
#line 124 "../src/parse/parser.ypp"
|
||||
case 17: /* rule: TOKEN_PRE_RULE TOKEN_CODE */
|
||||
#line 121 "../src/parse/parser.ypp"
|
||||
{
|
||||
find_or_add_gram(grams, "").pre_rule.push_back((yyvsp[0].semact));
|
||||
}
|
||||
#line 1267 "src/parse/parser.cc"
|
||||
#line 1255 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 19: /* rule: TOKEN_POST_RULE TOKEN_CODE */
|
||||
#line 127 "../src/parse/parser.ypp"
|
||||
case 18: /* rule: TOKEN_POST_RULE TOKEN_CODE */
|
||||
#line 124 "../src/parse/parser.ypp"
|
||||
{
|
||||
find_or_add_gram(grams, "").post_rule.push_back((yyvsp[0].semact));
|
||||
}
|
||||
#line 1275 "src/parse/parser.cc"
|
||||
#line 1263 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 20: /* rule: TOKEN_CLIST trailexpr ccode */
|
||||
#line 130 "../src/parse/parser.ypp"
|
||||
case 19: /* rule: TOKEN_CLIST trailexpr ccode */
|
||||
#line 127 "../src/parse/parser.ypp"
|
||||
{
|
||||
for (const std::string& cond : ast.temp_condlist) {
|
||||
find_or_add_gram(grams, cond).rules.push_back(AstRule((yyvsp[-1].regexp), (yyvsp[0].semact)));
|
||||
find_or_add_gram(grams, cond).rules.push_back({(yyvsp[-1].regexp), (yyvsp[0].semact)});
|
||||
}
|
||||
ast.temp_condlist.clear();
|
||||
}
|
||||
#line 1286 "src/parse/parser.cc"
|
||||
#line 1274 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 21: /* rule: TOKEN_CLIST '*' ccode */
|
||||
#line 136 "../src/parse/parser.ypp"
|
||||
case 20: /* rule: TOKEN_CLIST '*' ccode */
|
||||
#line 133 "../src/parse/parser.ypp"
|
||||
{
|
||||
for (const std::string& cond : ast.temp_condlist) {
|
||||
find_or_add_gram(grams, cond).defs.push_back((yyvsp[0].semact));
|
||||
}
|
||||
ast.temp_condlist.clear();
|
||||
}
|
||||
#line 1297 "src/parse/parser.cc"
|
||||
#line 1285 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 22: /* rule: TOKEN_CLIST '$' ccode */
|
||||
#line 142 "../src/parse/parser.ypp"
|
||||
{
|
||||
for (const std::string& cond : ast.temp_condlist) {
|
||||
find_or_add_gram(grams, cond).eofs.push_back((yyvsp[0].semact));
|
||||
}
|
||||
ast.temp_condlist.clear();
|
||||
}
|
||||
#line 1308 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 23: /* rule: TOKEN_CLIST TOKEN_ENTRY ccode */
|
||||
#line 148 "../src/parse/parser.ypp"
|
||||
case 21: /* rule: TOKEN_CLIST TOKEN_ENTRY ccode */
|
||||
#line 139 "../src/parse/parser.ypp"
|
||||
{
|
||||
for (const std::string& cond : ast.temp_condlist) {
|
||||
find_or_add_gram(grams, cond).entry.push_back((yyvsp[0].semact));
|
||||
}
|
||||
ast.temp_condlist.clear();
|
||||
}
|
||||
#line 1319 "src/parse/parser.cc"
|
||||
#line 1296 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 24: /* rule: TOKEN_CLIST TOKEN_PRE_RULE ccode */
|
||||
#line 154 "../src/parse/parser.ypp"
|
||||
case 22: /* rule: TOKEN_CLIST TOKEN_PRE_RULE ccode */
|
||||
#line 145 "../src/parse/parser.ypp"
|
||||
{
|
||||
for (const std::string& cond : ast.temp_condlist) {
|
||||
find_or_add_gram(grams, cond).pre_rule.push_back((yyvsp[0].semact));
|
||||
}
|
||||
ast.temp_condlist.clear();
|
||||
}
|
||||
#line 1330 "src/parse/parser.cc"
|
||||
#line 1307 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 25: /* rule: TOKEN_CLIST TOKEN_POST_RULE ccode */
|
||||
#line 160 "../src/parse/parser.ypp"
|
||||
case 23: /* rule: TOKEN_CLIST TOKEN_POST_RULE ccode */
|
||||
#line 151 "../src/parse/parser.ypp"
|
||||
{
|
||||
for (const std::string& cond : ast.temp_condlist) {
|
||||
find_or_add_gram(grams, cond).post_rule.push_back((yyvsp[0].semact));
|
||||
}
|
||||
ast.temp_condlist.clear();
|
||||
}
|
||||
#line 1341 "src/parse/parser.cc"
|
||||
#line 1318 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 26: /* rule: TOKEN_CPRE_RULE TOKEN_CODE */
|
||||
#line 166 "../src/parse/parser.ypp"
|
||||
case 24: /* rule: TOKEN_CPRE_RULE TOKEN_CODE */
|
||||
#line 157 "../src/parse/parser.ypp"
|
||||
{
|
||||
for (const std::string& cond : ast.temp_condlist) {
|
||||
find_or_add_gram(grams, cond).pre_rule.push_back((yyvsp[0].semact));
|
||||
}
|
||||
ast.temp_condlist.clear();
|
||||
}
|
||||
#line 1352 "src/parse/parser.cc"
|
||||
#line 1329 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 27: /* rule: TOKEN_CZERO ccode */
|
||||
#line 172 "../src/parse/parser.ypp"
|
||||
case 25: /* rule: TOKEN_CZERO ccode */
|
||||
#line 163 "../src/parse/parser.ypp"
|
||||
{
|
||||
const AstNode* r = ast.nil(input.tok_loc());
|
||||
find_or_add_gram(grams, ZERO_COND).rules.push_back(AstRule(r, (yyvsp[0].semact)));
|
||||
find_or_add_gram(grams, ZERO_COND).rules.push_back({r, (yyvsp[0].semact)});
|
||||
ast.temp_condlist.clear();
|
||||
}
|
||||
#line 1362 "src/parse/parser.cc"
|
||||
#line 1339 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 29: /* ccode: TOKEN_CNEXT TOKEN_CODE */
|
||||
#line 180 "../src/parse/parser.ypp"
|
||||
case 27: /* ccode: TOKEN_CNEXT TOKEN_CODE */
|
||||
#line 171 "../src/parse/parser.ypp"
|
||||
{
|
||||
(yyval.semact) = (yyvsp[0].semact);
|
||||
// parser needs to to update condition, but for the rest of the code actions are immutable
|
||||
const_cast<SemAct*>((yyval.semact))->cond = (yyvsp[-1].cstr);
|
||||
}
|
||||
#line 1372 "src/parse/parser.cc"
|
||||
#line 1349 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 30: /* ccode: TOKEN_CJUMP */
|
||||
#line 185 "../src/parse/parser.ypp"
|
||||
case 28: /* ccode: TOKEN_CJUMP */
|
||||
#line 176 "../src/parse/parser.ypp"
|
||||
{
|
||||
(yyval.semact) = ast.sem_act(input.tok_loc(), nullptr, (yyvsp[0].cstr), true);
|
||||
}
|
||||
#line 1380 "src/parse/parser.cc"
|
||||
#line 1357 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 31: /* trailexpr: expr */
|
||||
#line 190 "../src/parse/parser.ypp"
|
||||
case 29: /* trailexpr: expr */
|
||||
#line 181 "../src/parse/parser.ypp"
|
||||
{ (yyval.regexp) = ast.cap((yyvsp[0].regexp), CAPTURE_IF_NOT_INVERTED); }
|
||||
#line 1386 "src/parse/parser.cc"
|
||||
#line 1363 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 32: /* trailexpr: expr '/' expr */
|
||||
#line 191 "../src/parse/parser.ypp"
|
||||
case 30: /* trailexpr: expr '/' expr */
|
||||
#line 182 "../src/parse/parser.ypp"
|
||||
{
|
||||
(yyval.regexp) = ast.cat(ast.cap((yyvsp[-2].regexp), CAPTURE_IF_NOT_INVERTED),
|
||||
ast.cat(ast.tag(input.tok_loc(), nullptr, false), (yyvsp[0].regexp)));
|
||||
}
|
||||
#line 1395 "src/parse/parser.cc"
|
||||
#line 1372 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 34: /* expr: expr '|' diff */
|
||||
#line 198 "../src/parse/parser.ypp"
|
||||
case 32: /* expr: expr '|' diff */
|
||||
#line 189 "../src/parse/parser.ypp"
|
||||
{ (yyval.regexp) = ast.alt((yyvsp[-2].regexp), (yyvsp[0].regexp)); }
|
||||
#line 1401 "src/parse/parser.cc"
|
||||
#line 1378 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 36: /* diff: diff '\\' term */
|
||||
#line 203 "../src/parse/parser.ypp"
|
||||
case 34: /* diff: diff '\\' term */
|
||||
#line 194 "../src/parse/parser.ypp"
|
||||
{ (yyval.regexp) = ast.diff((yyvsp[-2].regexp), (yyvsp[0].regexp)); }
|
||||
#line 1407 "src/parse/parser.cc"
|
||||
#line 1384 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 38: /* term: factor term */
|
||||
#line 209 "../src/parse/parser.ypp"
|
||||
case 36: /* term: factor term */
|
||||
#line 200 "../src/parse/parser.ypp"
|
||||
{ (yyval.regexp) = ast.cat((yyvsp[-1].regexp), (yyvsp[0].regexp)); }
|
||||
#line 1413 "src/parse/parser.cc"
|
||||
#line 1390 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 40: /* factor: primary closes */
|
||||
#line 214 "../src/parse/parser.ypp"
|
||||
case 38: /* factor: primary closes */
|
||||
#line 205 "../src/parse/parser.ypp"
|
||||
{
|
||||
switch((yyvsp[0].op)) {
|
||||
case '*':
|
||||
@@ -1427,43 +1404,43 @@ yyreduce:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#line 1431 "src/parse/parser.cc"
|
||||
#line 1408 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 41: /* factor: primary TOKEN_CLOSESIZE */
|
||||
#line 227 "../src/parse/parser.ypp"
|
||||
case 39: /* factor: primary TOKEN_CLOSESIZE */
|
||||
#line 218 "../src/parse/parser.ypp"
|
||||
{
|
||||
(yyval.regexp) = ast.iter((yyvsp[-1].regexp), (yyvsp[0].bounds).min, (yyvsp[0].bounds).max);
|
||||
}
|
||||
#line 1439 "src/parse/parser.cc"
|
||||
#line 1416 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 43: /* closes: closes close */
|
||||
#line 234 "../src/parse/parser.ypp"
|
||||
case 41: /* closes: closes close */
|
||||
#line 225 "../src/parse/parser.ypp"
|
||||
{ (yyval.op) = ((yyvsp[-1].op) == (yyvsp[0].op)) ? (yyvsp[-1].op) : '*'; }
|
||||
#line 1445 "src/parse/parser.cc"
|
||||
#line 1422 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 44: /* close: '*' */
|
||||
#line 238 "../src/parse/parser.ypp"
|
||||
case 42: /* close: '*' */
|
||||
#line 229 "../src/parse/parser.ypp"
|
||||
{ (yyval.op) = '*'; }
|
||||
#line 1451 "src/parse/parser.cc"
|
||||
#line 1428 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 45: /* close: '+' */
|
||||
#line 239 "../src/parse/parser.ypp"
|
||||
case 43: /* close: '+' */
|
||||
#line 230 "../src/parse/parser.ypp"
|
||||
{ (yyval.op) = '+'; }
|
||||
#line 1457 "src/parse/parser.cc"
|
||||
#line 1434 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 46: /* close: '?' */
|
||||
#line 240 "../src/parse/parser.ypp"
|
||||
case 44: /* close: '?' */
|
||||
#line 231 "../src/parse/parser.ypp"
|
||||
{ (yyval.op) = '?'; }
|
||||
#line 1463 "src/parse/parser.cc"
|
||||
#line 1440 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 48: /* primary: TOKEN_ID */
|
||||
#line 245 "../src/parse/parser.ypp"
|
||||
case 46: /* primary: TOKEN_ID */
|
||||
#line 236 "../src/parse/parser.ypp"
|
||||
{
|
||||
(yyval.regexp) = find_def(opts.symtab, (yyvsp[0].cstr));
|
||||
if ((yyval.regexp) == nullptr) {
|
||||
@@ -1473,23 +1450,23 @@ yyreduce:
|
||||
(yyval.regexp) = ast.cap((yyval.regexp), NO_CAPTURE);
|
||||
}
|
||||
}
|
||||
#line 1477 "src/parse/parser.cc"
|
||||
#line 1454 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 49: /* primary: '(' expr ')' */
|
||||
#line 254 "../src/parse/parser.ypp"
|
||||
case 47: /* primary: '(' expr ')' */
|
||||
#line 245 "../src/parse/parser.ypp"
|
||||
{ (yyval.regexp) = ast.cap((yyvsp[-1].regexp), CAPTURE_IF_NOT_INVERTED); }
|
||||
#line 1483 "src/parse/parser.cc"
|
||||
#line 1460 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 50: /* primary: TOKEN_LPAREN_NEG expr ')' */
|
||||
#line 255 "../src/parse/parser.ypp"
|
||||
case 48: /* primary: TOKEN_LPAREN_NEG expr ')' */
|
||||
#line 246 "../src/parse/parser.ypp"
|
||||
{ (yyval.regexp) = ast.cap((yyvsp[-1].regexp), CAPTURE_IF_INVERTED); }
|
||||
#line 1489 "src/parse/parser.cc"
|
||||
#line 1466 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
|
||||
#line 1493 "src/parse/parser.cc"
|
||||
#line 1470 "src/parse/parser.cc"
|
||||
|
||||
default: break;
|
||||
}
|
||||
@@ -1682,7 +1659,7 @@ yyreturnlab:
|
||||
return yyresult;
|
||||
}
|
||||
|
||||
#line 258 "../src/parse/parser.ypp"
|
||||
#line 249 "../src/parse/parser.ypp"
|
||||
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
AC_INIT([re2c],[4.2],[re2c-general@lists.sourceforge.net])
|
||||
AC_INIT([re2c],[4.6],[re2c-general@lists.sourceforge.net])
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AM_INIT_AUTOMAKE([foreign subdir-objects dist-xz dist-lzip no-dist-gzip])
|
||||
AM_SILENT_RULES([yes])
|
||||
|
||||
@@ -41,6 +41,7 @@ program:
|
||||
``YYSHIFTSTAG``,
|
||||
``YYSHIFTMTAG``,
|
||||
``YYLESSTHAN``.
|
||||
``YYEND``.
|
||||
Generic API supports two styles that determine the form in which the
|
||||
primitives should be defined:
|
||||
|
||||
@@ -67,6 +68,7 @@ program:
|
||||
re2c:YYRESTORECTX = "cursor = ctxmarker;";
|
||||
re2c:YYRESTORETAG = "cursor = ${tag};";
|
||||
re2c:YYLESSTHAN = "limit - cursor < @@{len}";
|
||||
re2c:YYEND = "limit == cursor";
|
||||
re2c:YYSTAGP = "@@{tag} = cursor;";
|
||||
re2c:YYSTAGN = "@@{tag} = NULL;";
|
||||
re2c:YYSHIFT = "cursor += @@{shift};";
|
||||
@@ -93,6 +95,7 @@ program:
|
||||
#define YYRESTORECTX() cursor = ctxmarker
|
||||
#define YYRESTORETAG(tag) cursor = tag
|
||||
#define YYLESSTHAN(len) limit - cursor < len
|
||||
#define YYEND() limit == cursor
|
||||
#define YYSTAGP(tag) tag = cursor
|
||||
#define YYSTAGN(tag) tag = NULL
|
||||
#define YYSHIFT(shift) cursor += shift
|
||||
|
||||
@@ -38,4 +38,5 @@ program:
|
||||
``YYSHIFT``,
|
||||
``YYSHIFTSTAG``,
|
||||
``YYSHIFTMTAG``,
|
||||
``YYLESSTHAN``.
|
||||
``YYLESSTHAN``,
|
||||
``YYEND``.
|
||||
|
||||
@@ -41,7 +41,8 @@ program:
|
||||
``YYSHIFT``,
|
||||
``YYSHIFTSTAG``,
|
||||
``YYSHIFTMTAG``,
|
||||
``YYLESSTHAN``.
|
||||
``YYLESSTHAN``,
|
||||
``YYEND``.
|
||||
Generic API supports two styles that determine the form in which the
|
||||
primitives should be defined:
|
||||
|
||||
@@ -68,6 +69,7 @@ program:
|
||||
re2c:YYRESTORECTX = "cursor = ctxmarker";
|
||||
re2c:YYRESTORETAG = "cursor = ${tag}";
|
||||
re2c:YYLESSTHAN = "limit - cursor < @@{len}";
|
||||
re2c:YYEND = "limit == cursor";
|
||||
re2c:YYSTAGP = "@@{tag} = cursor";
|
||||
re2c:YYSTAGN = "@@{tag} = -1";
|
||||
re2c:YYSHIFT = "cursor += @@{shift}";
|
||||
@@ -93,4 +95,5 @@ program:
|
||||
YYBACKUPCTX := func() { ctxmarker = cursor }
|
||||
YYRESTORECTX := func() { cursor = ctxmarker }
|
||||
YYLESSTHAN := func(n int) bool { return limit-cursor < n }
|
||||
YYEND := func(n int) bool { return limit == cursor }
|
||||
YYSHIFT := func(n int) { cursor += n }
|
||||
|
||||
@@ -32,4 +32,5 @@ program:
|
||||
``YYSHIFT``,
|
||||
``YYSHIFTSTAG``,
|
||||
``YYSHIFTMTAG``,
|
||||
``YYLESSTHAN``.
|
||||
``YYLESSTHAN``,
|
||||
``YYEND``.
|
||||
|
||||
@@ -39,4 +39,5 @@ program:
|
||||
``YYSHIFT``,
|
||||
``YYSHIFTSTAG``,
|
||||
``YYSHIFTMTAG``,
|
||||
``YYLESSTHAN``.
|
||||
``YYLESSTHAN``,
|
||||
``YYEND``.
|
||||
|
||||
@@ -39,4 +39,5 @@ program:
|
||||
``YYSHIFT``,
|
||||
``YYSHIFTSTAG``,
|
||||
``YYSHIFTMTAG``,
|
||||
``YYLESSTHAN``.
|
||||
``YYLESSTHAN``,
|
||||
``YYEND``.
|
||||
|
||||
@@ -30,4 +30,5 @@ program:
|
||||
``YYSHIFT``,
|
||||
``YYSHIFTSTAG``,
|
||||
``YYSHIFTMTAG``,
|
||||
``YYLESSTHAN``.
|
||||
``YYLESSTHAN``,
|
||||
``YYEND``.
|
||||
|
||||
@@ -39,4 +39,5 @@ program:
|
||||
``YYSHIFT``,
|
||||
``YYSHIFTSTAG``,
|
||||
``YYSHIFTMTAG``,
|
||||
``YYLESSTHAN``.
|
||||
``YYLESSTHAN``,
|
||||
``YYEND``.
|
||||
|
||||
@@ -41,7 +41,8 @@ program:
|
||||
``YYSHIFT``,
|
||||
``YYSHIFTSTAG``,
|
||||
``YYSHIFTMTAG``,
|
||||
``YYLESSTHAN``.
|
||||
``YYLESSTHAN``,
|
||||
``YYEND``.
|
||||
For example, if the input is a byte slice ``buffer: &[u8]``, variables
|
||||
``cursor``, ``limit``, ``marker`` and ``ctxmarker`` of type ``usize``
|
||||
represent input positions, and a constant ``NONE`` represents invalid
|
||||
@@ -58,6 +59,7 @@ program:
|
||||
re2c:YYRESTORECTX = "cursor = ctxmarker;";
|
||||
re2c:YYRESTORETAG = "cursor = @@{tag};";
|
||||
re2c:YYLESSTHAN = "limit - cursor < @@{len}";
|
||||
re2c:YYEND = "limit == cursor";
|
||||
re2c:YYSTAGP = "@@{tag} = cursor;";
|
||||
re2c:YYSTAGN = "@@{tag} = NONE;";
|
||||
re2c:YYSHIFT = "cursor = (cursor as isize + @@{shift}) as usize;";
|
||||
|
||||
@@ -39,7 +39,8 @@ program:
|
||||
``YYSHIFT``,
|
||||
``YYSHIFTSTAG``,
|
||||
``YYSHIFTMTAG``,
|
||||
``YYLESSTHAN``.
|
||||
``YYLESSTHAN``,
|
||||
``YYEND``.
|
||||
For example, if the input is a zero-terminated array of bytes
|
||||
``buffer: [UInt8]``, variables ``cursor``, ``limit``, ``marker`` and
|
||||
``ctxmarker`` of type ``Int`` represent input positions, and ``-1``
|
||||
@@ -56,6 +57,7 @@ program:
|
||||
re2c:YYRESTORECTX = "cursor = ctxmarker";
|
||||
re2c:YYRESTORETAG = "cursor = ${tag}";
|
||||
re2c:YYLESSTHAN = "limit - cursor < @@{len}";
|
||||
re2c:YYEND = "limit == cursor";
|
||||
re2c:YYSTAGP = "@@{tag} = cursor";
|
||||
re2c:YYSTAGN = "@@{tag} = -1";
|
||||
re2c:YYSHIFT = "cursor += @@{shift}";
|
||||
|
||||
@@ -39,4 +39,5 @@ program:
|
||||
``YYSHIFT``,
|
||||
``YYSHIFTSTAG``,
|
||||
``YYSHIFTMTAG``,
|
||||
``YYLESSTHAN``.
|
||||
``YYLESSTHAN``,
|
||||
``YYEND``.
|
||||
|
||||
@@ -39,4 +39,5 @@ program:
|
||||
``YYSHIFT``,
|
||||
``YYSHIFTSTAG``,
|
||||
``YYSHIFTMTAG``,
|
||||
``YYLESSTHAN``.
|
||||
``YYLESSTHAN``,
|
||||
``YYEND``.
|
||||
|
||||
@@ -63,6 +63,14 @@ order to interface with the outer program.
|
||||
It should be defined as an r-value of boolean type that equals ``true`` if
|
||||
and only if there are less than ``len`` input characters left.
|
||||
|
||||
``YYEND``
|
||||
A generic API primitive with no variables.
|
||||
It should be defined as an r-value of boolean type that equals ``true`` if
|
||||
and only if the *logical* end of input has been reached (excluding any
|
||||
padding or sentinel symbols). ``YYEND`` is used to implement ``$`` symbol in
|
||||
regular expressions. It differs from ``YYLESSTHAN``, which is used to ensure
|
||||
that the lexer won't read past the end of buffer.
|
||||
|
||||
``YYPEEK``
|
||||
A generic API primitive with no variables.
|
||||
It should be defined as an r-value of type ``YYCTYPE`` that is equal to the
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
``--api <simple | record | generic>``
|
||||
Specify the API used by the generated code to interface with used-defined
|
||||
code. Option ``simple`` shold be used in simple cases when there's no need
|
||||
code. Option ``simple`` should be used in simple cases when there's no need
|
||||
for buffer refilling and storing lexer state. Option ``record`` should be
|
||||
used when lexer state needs to be stored in a record (struct, class, etc.).
|
||||
Option ``generic`` should be used in complex cases when the other two APIs
|
||||
@@ -141,6 +141,12 @@
|
||||
case label of the destination state and continue execution to the head of
|
||||
the loop.
|
||||
|
||||
``--computed-continue``
|
||||
This option requires the ``--loop-switch`` code model. It uses computed
|
||||
``continue`` statements to select the next switch case directly, enabling
|
||||
jump-table optimization similar to ``--computed-gotos`` in the goto/label
|
||||
code model.
|
||||
|
||||
``--nested-ifs -s``
|
||||
Use nested ``if`` statements instead of ``switch`` statements in conditional
|
||||
jumps. This usually results in more efficient code with non-optimizing
|
||||
|
||||
@@ -66,6 +66,9 @@
|
||||
An *m-tag*: saves all input positions at which ``#mtag`` matches in a
|
||||
variable named ``mtag``.
|
||||
|
||||
``$``
|
||||
End of input.
|
||||
|
||||
Character classes and string literals may contain the following escape
|
||||
sequences: ``\a``, ``\b``, ``\f``, ``\n``, ``\r``, ``\t``, ``\v``, ``\\``,
|
||||
octal escapes ``\ooo`` and hexadecimal escapes ``\xhh``, ``\uhhhh`` and
|
||||
|
||||
@@ -37,7 +37,7 @@ language configurations, inplace configurations and code templates.
|
||||
``supported_features``
|
||||
A list of supported features with possible elements ``nested-ifs``,
|
||||
``bitmaps``, ``computed-gotos``, ``case-ranges``, ``monadic``, ``unsafe``,
|
||||
``tags``, ``captures``, ``captvars``.
|
||||
``tags``, ``captures``, ``captvars``, ``computed-continue``.
|
||||
|
||||
**Language configurations**
|
||||
|
||||
@@ -270,12 +270,15 @@ language configurations, inplace configurations and code templates.
|
||||
|
||||
``code:loop``
|
||||
A loop that runs forever (unless interrupted from the loop body).
|
||||
Supported variables: ``label`` (loop label), ``stmt`` (a list variable
|
||||
that expands to all statements in the loop body).
|
||||
Supported variables: ``label`` (loop label), ``val`` (initial state),
|
||||
``var`` (state variable), ``state`` (a list variable that expands to all
|
||||
state names) and ``stmt`` (a list variable that expands to all statements
|
||||
in the loop body or the current state).
|
||||
|
||||
``code:continue``
|
||||
Continue statement. Supported variables: ``label`` (label from which to
|
||||
continue execution).
|
||||
continue execution), ``val`` (value passed to a labeled switch) and ``var``
|
||||
(state variable).
|
||||
|
||||
``code:goto``
|
||||
Goto statement. Supported variables: ``label`` (label of the jump
|
||||
@@ -513,6 +516,10 @@ language configurations, inplace configurations and code templates.
|
||||
``need`` (the number of code units to check against). Conditional:
|
||||
``.many`` (true if the ``need`` is more than one).
|
||||
|
||||
``code:yyend``
|
||||
``YYEND`` expression, possibly specialized for different APIs.
|
||||
Supported variables: ``YYEND``, ``YYCURSOR``, ``YYLIMIT``.
|
||||
|
||||
``code:yybm_filter``
|
||||
Condition that is used to filter out ``yych`` values that are not
|
||||
covered by the ``yybm`` table (used with ``--bitmaps`` option).
|
||||
@@ -575,6 +582,10 @@ language configurations, inplace configurations and code templates.
|
||||
True if the relative form of computed ``goto`` is used
|
||||
(``--computed-gotos-relative`` or ``re2c:cgoto:relative = 1``).
|
||||
|
||||
``.computed_continue``
|
||||
True if loop/switch model uses labeled-switch transitions
|
||||
(``--computed-continue``).
|
||||
|
||||
``.code_model.goto_label``
|
||||
True if code model based on goto/label is used (``--goto-label``).
|
||||
|
||||
@@ -610,6 +621,8 @@ language configurations, inplace configurations and code templates.
|
||||
``.version``
|
||||
True if the generated fingerprint should contain |re2c| version.
|
||||
|
||||
``.yyfill.enable``
|
||||
True if ``YYFILL`` is enabled (``re2c:yyfill:enable = 1``).
|
||||
|
||||
``.yyfn.throw``
|
||||
True if ``re2c:yyfn:throw`` configuration is defined to a nonempty string.
|
||||
|
||||
|
||||
@@ -30,6 +30,13 @@
|
||||
``-Wunreachable-rules``
|
||||
Warn about rules that are shadowed by other rules and will never match.
|
||||
|
||||
``-Wdeprecated-eof_rule``
|
||||
Warn about standalone end of input rules ``$`` that will be broken by the
|
||||
future changes and require fixing. At the moment these rules take precedence
|
||||
when conflicting with other rules, but after the introduction of generalized
|
||||
end of input symbol ``$`` precedence order will change and these rules will
|
||||
become shadowed by other rules.
|
||||
|
||||
``-Wuseless-escape``
|
||||
Warn if a symbol is escaped when it shouldn't be.
|
||||
By default, |re2c| silently ignores such escapes, but this may as well
|
||||
|
||||
@@ -38,8 +38,9 @@ The following encodings are supported:
|
||||
fixed-length Unicode encoding with code space ``[0-0x10FFFF]`` and 4-byte code
|
||||
points and code units.
|
||||
|
||||
Include file ``include/unicode_categories.re`` provides |re2c| definitions for the
|
||||
standard Unicode categories.
|
||||
Include files ``include/unicode_blocks.re``, ``include/unicode_categories.re``
|
||||
and ``include/unicode_properties.re`` provide |re2c| definitions for blocks,
|
||||
categories and properties described in the Unicode standard.
|
||||
|
||||
Option ``--input-encoding`` specifies source file encoding, which can be used to
|
||||
enable Unicode literals in regular expressions. For example
|
||||
|
||||
+17
-16
@@ -466,7 +466,7 @@ Figure \ref{fig:tdfa} in section \ref{section_tdfa} shows an example of TNFA sim
|
||||
\ElseIf {$e = e_1 \mid e_2$} {
|
||||
$(\Sigma, T_2, Q_2, q_2, q_f, \Delta_2) = \retonfa (e_2, q_f)$ \;
|
||||
$(\Sigma, T_2, Q'_2, q'_2, q_f, \Delta'_2) = \ntag (T_2, q_f)$ \;
|
||||
$(\Sigma, T_1, Q_1, q_1, q'_2, \Delta_1) = \retonfa (e_2, q'_2)$ \;
|
||||
$(\Sigma, T_1, Q_1, q_1, q'_2, \Delta_1) = \retonfa (e_1, q'_2)$ \;
|
||||
$(\Sigma, T_1, Q'_1, q'_1, q_2, \Delta'_1) = \ntag (T_1, q_2)$ \;
|
||||
$Q = Q_1 \cup Q'_1 \cup Q_2 \cup Q'_2 \cup \{q_0\}$ \;
|
||||
$\Delta = \Delta_1 \cup \Delta'_1 \cup \Delta_2 \cup \Delta'_2 \cup \{ (q_0,1,\epsilon,q_1), (q_0,2,\epsilon,q'_1) \}$ \;
|
||||
@@ -722,7 +722,6 @@ and $l$ is the new sequence constructed by the $\epsilon$-closure.
|
||||
|
||||
\nonl\Fn {$\underline{step \Xund on \Xund symbol \big( (X, P), a \big)} \smallskip$} {
|
||||
$B:$ empty sequence of configurations \;
|
||||
\BlankLine
|
||||
\For {$(q, r, l) \in X$ ordered by $q$ in the order of $P$} {
|
||||
\If {$\exists (q, a, p) \in \Delta \mid a \in \Sigma$} {
|
||||
append $(p, r, l, \epsilon)$ to $B$
|
||||
@@ -758,45 +757,44 @@ and $l$ is the new sequence constructed by the $\epsilon$-closure.
|
||||
|
||||
\nonl\Fn {$\underline{transition \Xund regops \big( C, R, V \big)} \smallskip$} {
|
||||
$O:$ empty list of operations \;
|
||||
\BlankLine
|
||||
\For {each $(q, r, h, l) \in C$} {
|
||||
\For {each tag $t \in T$} {
|
||||
\If {$h_t = history(h, t) \neq \epsilon$} {
|
||||
\If {$h_t = history(h, t) \neq \epsilon$ and \;
|
||||
\quad\quad $(history(l, t) = \epsilon$ or $t$ is a multi-tag$)$} {
|
||||
$v = regop \Xund rhs(r, h_t, t)$ \;
|
||||
\BlankLine
|
||||
\If {$V[t][v]$ is undefined } {
|
||||
$i = max \{R\} + 1$ \;
|
||||
$i = V[t][v]$ \;
|
||||
\If {$i$ is undefined } {
|
||||
$V[t][v] = i = max \{R\} + 1$ \;
|
||||
$R = R \cup \{i\}$ \;
|
||||
$V[t][v] = i$ \;
|
||||
}
|
||||
\If {operation $i \leftarrow v$ is not in $O$} {
|
||||
append operation $i \leftarrow v$ to $O$ \;
|
||||
}
|
||||
\BlankLine
|
||||
$r[t] = V[t][v]$ \;
|
||||
$r[t] = i$ \;
|
||||
}
|
||||
}
|
||||
}
|
||||
\BlankLine
|
||||
\Return $O$ \;
|
||||
}
|
||||
\vspace{2em}
|
||||
|
||||
\nonl\Fn {$\underline{final \Xund regops \big( R_f, r, l \big)} \smallskip$} {
|
||||
$O:$ empty list of operations \;
|
||||
\BlankLine
|
||||
\For {each tag $t \in T$} {
|
||||
\If {$l_t = history(l, t) \neq \epsilon$} {
|
||||
append $R_f[t] \leftarrow regop \Xund rhs(r, l_t, t)$ to $O$ \;
|
||||
} \Else {
|
||||
append $R_f[t] \leftarrow r[t]$ to $O$ \;
|
||||
}
|
||||
}
|
||||
\BlankLine
|
||||
\Return $O$ \;
|
||||
}
|
||||
\vspace{2em}
|
||||
|
||||
\nonl\Fn {$\underline{regop \Xund rhs \big( r, h_t, t \big)} \smallskip$} {
|
||||
\If {$t$ is a multi-valued tag} {
|
||||
\lIf {$t$ is a multi-tag} {
|
||||
\Return $r[t] \cdot h_t$
|
||||
} \Else {
|
||||
} \lElse {
|
||||
\Return the last element of $h_t$
|
||||
}
|
||||
}
|
||||
@@ -1380,7 +1378,7 @@ RE2C uses the following optimization passes for the number of repetitions $N=2$
|
||||
\For {each operation in $b$} {
|
||||
\If {copy or append $i \leftarrow j ...$ and $i \neq j$} {
|
||||
$x = B[i], \; y = B[j]$ \;
|
||||
\If {$x = -1$ and $y = -1$} {
|
||||
\If {$x = -1$ and $y = -1$ and $\neg I[i][j]$} {
|
||||
$B[i] = B[j] = i$ \;
|
||||
$S[i] = \{i, j\}$ \;
|
||||
} \ElseIf {$x \neq -1$ and $y = -1$} {
|
||||
@@ -1412,6 +1410,9 @@ RE2C uses the following optimization passes for the number of repetitions $N=2$
|
||||
\If {$\exists j$ in $G: B[j] = j$ and $\forall k \in S[j]: \neg I[i][k]$} {
|
||||
$B[i] = j$ \;
|
||||
$S[j] = S[j] \cup \{i\}$ \;
|
||||
} \Else {
|
||||
$B[i] = i$ \;
|
||||
$S[i] = \{i\}$ \;
|
||||
}
|
||||
}
|
||||
\BlankLine
|
||||
|
||||
@@ -268,17 +268,17 @@
|
||||
\multicolumn{12}{c}{Interference} \\[0.3em]
|
||||
& $r_1$ & $r_2$ & $r_3$ & $r_4$ & $r_5$ & $r_6$ & $r_7$ & $r_8$ & $r_9$ & $\!r_{10}\!$ & $\!r_{11}\!$ \\
|
||||
\hline
|
||||
$r_1$ & $.$ & $*$ & $*$ & $*$ & $*$ & $.$ & $.$ & $.$ & $.$ & $.$ & $.$ \\
|
||||
$r_2$ & $*$ & $.$ & $*$ & $*$ & $*$ & $.$ & $*$ & $.$ & $.$ & $.$ & $.$ \\
|
||||
$r_3$ & $*$ & $*$ & $.$ & $*$ & $*$ & $.$ & $*$ & $*$ & $.$ & $.$ & $.$ \\
|
||||
$r_4$ & $*$ & $*$ & $*$ & $.$ & $*$ & $.$ & $*$ & $*$ & $*$ & $.$ & $.$ \\
|
||||
$r_5$ & $*$ & $*$ & $*$ & $*$ & $.$ & $.$ & $*$ & $*$ & $*$ & $*$ & $.$ \\
|
||||
$r_1$ & $.$ & $*$ & $*$ & $*$ & $*$ & $.$ & $.$ & $*$ & $*$ & $*$ & $*$ \\
|
||||
$r_2$ & $*$ & $.$ & $*$ & $*$ & $*$ & $.$ & $.$ & $.$ & $*$ & $*$ & $*$ \\
|
||||
$r_3$ & $*$ & $*$ & $.$ & $*$ & $*$ & $.$ & $.$ & $.$ & $.$ & $*$ & $*$ \\
|
||||
$r_4$ & $*$ & $*$ & $*$ & $.$ & $*$ & $.$ & $.$ & $.$ & $.$ & $.$ & $*$ \\
|
||||
$r_5$ & $*$ & $*$ & $*$ & $*$ & $.$ & $.$ & $.$ & $.$ & $.$ & $.$ & $.$ \\
|
||||
$r_6$ & $.$ & $.$ & $.$ & $.$ & $.$ & $.$ & $*$ & $*$ & $.$ & $.$ & $.$ \\
|
||||
$r_7$ & $.$ & $*$ & $*$ & $*$ & $*$ & $*$ & $.$ & $*$ & $*$ & $*$ & $*$ \\
|
||||
$r_8$ & $.$ & $.$ & $*$ & $*$ & $*$ & $*$ & $*$ & $.$ & $*$ & $*$ & $*$ \\
|
||||
$r_9$ & $.$ & $.$ & $.$ & $*$ & $*$ & $.$ & $*$ & $*$ & $.$ & $.$ & $*$ \\
|
||||
$r_{10}$ & $.$ & $.$ & $.$ & $.$ & $*$ & $.$ & $*$ & $*$ & $.$ & $.$ & $*$ \\
|
||||
$r_{11}$ & $.$ & $.$ & $.$ & $.$ & $.$ & $.$ & $*$ & $*$ & $*$ & $*$ & $.$ \\
|
||||
$r_7$ & $.$ & $.$ & $.$ & $.$ & $.$ & $*$ & $.$ & $*$ & $*$ & $*$ & $*$ \\
|
||||
$r_8$ & $*$ & $.$ & $.$ & $.$ & $.$ & $*$ & $*$ & $.$ & $*$ & $*$ & $*$ \\
|
||||
$r_9$ & $*$ & $*$ & $.$ & $.$ & $.$ & $.$ & $*$ & $*$ & $.$ & $.$ & $*$ \\
|
||||
$r_{10}$ & $*$ & $*$ & $*$ & $.$ & $.$ & $.$ & $*$ & $*$ & $.$ & $.$ & $*$ \\
|
||||
$r_{11}$ & $*$ & $*$ & $*$ & $*$ & $.$ & $.$ & $*$ & $*$ & $*$ & $*$ & $.$ \\
|
||||
\end{tabular}
|
||||
$};
|
||||
\end{scope}
|
||||
@@ -307,8 +307,8 @@
|
||||
\begin{aligned}
|
||||
& \underline{live\!: r_1\, r_2\, r_3} \\[-0.5em]
|
||||
& r_{1} \leftarrow r_{3} \\[-0.6em]
|
||||
& r_{1} \leftarrow \pos \\[-0.6em]
|
||||
& r_{2} \leftarrow \pos
|
||||
& r_{2} \leftarrow \pos \\[-0.6em]
|
||||
& r_{3} \leftarrow \pos
|
||||
\end{aligned}
|
||||
$};
|
||||
\draw [rounded corners=0.5em] (x3.north west) rectangle (x3.south east);
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
// re2c $INPUT -o $OUTPUT -i --case-ranges
|
||||
#include <assert.h>
|
||||
|
||||
int lex(const char *s) {
|
||||
const char *YYCURSOR = s;
|
||||
int lex(const char* YYCURSOR) {
|
||||
|
||||
{
|
||||
char yych;
|
||||
unsigned char yych;
|
||||
yych = *YYCURSOR;
|
||||
switch (yych) {
|
||||
case '1' ... '9': goto yy2;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
// re2c $INPUT -o $OUTPUT -i --case-ranges
|
||||
#include <assert.h>
|
||||
|
||||
int lex(const char *s) {
|
||||
const char *YYCURSOR = s;
|
||||
int lex(const char* YYCURSOR) {
|
||||
/*!re2c
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:define:YYCTYPE = char;
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
|
||||
[1-9][0-9]* { return 0; }
|
||||
* { return 1; }
|
||||
|
||||
@@ -22,7 +22,7 @@ for f in $(find -name '*.re'); do
|
||||
head -n $l "$ctest" > "$ctest".mod && mv "$ctest".mod "$ctest"
|
||||
fi
|
||||
|
||||
g++ -fsanitize=leak -fsanitize=address -g -Wall -oexample "$ctest" \
|
||||
g++ -fsanitize=leak -fsanitize=address -g -Wall -Wextra -oexample "$ctest" \
|
||||
&& ./example 2>/dev/null || { echo "*** error ***"; exit 1; }
|
||||
|
||||
rm -f "$ctest" example
|
||||
|
||||
@@ -14,7 +14,7 @@ static uint64_t parse_u32(const char *s) {
|
||||
|
||||
|
||||
{
|
||||
char yych;
|
||||
unsigned char yych;
|
||||
yych = *YYCURSOR;
|
||||
switch (yych) {
|
||||
case '0': goto yy2;
|
||||
@@ -97,7 +97,7 @@ yy9:
|
||||
bin:
|
||||
|
||||
{
|
||||
char yych;
|
||||
unsigned char yych;
|
||||
yych = *YYCURSOR;
|
||||
switch (yych) {
|
||||
case 0x00: goto yy11;
|
||||
@@ -119,7 +119,7 @@ yy13:
|
||||
oct:
|
||||
|
||||
{
|
||||
char yych;
|
||||
unsigned char yych;
|
||||
yych = *YYCURSOR;
|
||||
switch (yych) {
|
||||
case 0x00: goto yy15;
|
||||
@@ -147,7 +147,7 @@ yy17:
|
||||
dec:
|
||||
|
||||
{
|
||||
char yych;
|
||||
unsigned char yych;
|
||||
yych = *YYCURSOR;
|
||||
switch (yych) {
|
||||
case 0x00: goto yy19;
|
||||
@@ -177,7 +177,7 @@ yy21:
|
||||
hex:
|
||||
|
||||
{
|
||||
char yych;
|
||||
unsigned char yych;
|
||||
yych = *YYCURSOR;
|
||||
switch (yych) {
|
||||
case 0x00: goto yy23;
|
||||
|
||||
@@ -13,7 +13,7 @@ static uint64_t parse_u32(const char *s) {
|
||||
|
||||
/*!re2c
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:define:YYCTYPE = char;
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
|
||||
end = "\x00";
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ static uint64_t parse_u32(const char *s) {
|
||||
|
||||
|
||||
{
|
||||
char yych;
|
||||
unsigned char yych;
|
||||
switch (c) {
|
||||
case yycinit: goto yyc_init;
|
||||
case yycbin: goto yyc_bin;
|
||||
|
||||
@@ -13,9 +13,9 @@ static uint64_t parse_u32(const char *s) {
|
||||
|
||||
/*!re2c
|
||||
re2c:api:style = free-form;
|
||||
re2c:define:YYCTYPE = char;
|
||||
re2c:define:YYGETCONDITION = "c";
|
||||
re2c:define:YYSETCONDITION = "c = @@;";
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
re2c:YYGETCOND = "c";
|
||||
re2c:YYSETCOND = "c = @@;";
|
||||
re2c:yyfill:enable = 0;
|
||||
|
||||
<*> * { return ERROR; }
|
||||
|
||||
+2025
-1485
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,7 @@
|
||||
static int lex(const char *s) {
|
||||
const char *YYCURSOR = s, *YYMARKER;
|
||||
/*!re2c
|
||||
re2c:define:YYCTYPE = 'unsigned char';
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
re2c:yyfill:enable = 0;
|
||||
|
||||
// Simplified "Unicode Identifier and Pattern Syntax"
|
||||
|
||||
@@ -11,7 +11,7 @@ static int lex(const char *YYCURSOR) {
|
||||
|
||||
#line 13 "c/eof/01_sentinel.c"
|
||||
{
|
||||
char yych;
|
||||
unsigned char yych;
|
||||
yych = *YYCURSOR;
|
||||
switch (yych) {
|
||||
case 0x00: goto yy1;
|
||||
|
||||
@@ -7,7 +7,7 @@ static int lex(const char *YYCURSOR) {
|
||||
|
||||
for (;;) {
|
||||
/*!re2c
|
||||
re2c:define:YYCTYPE = char;
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
re2c:yyfill:enable = 0;
|
||||
|
||||
* { return -1; }
|
||||
|
||||
@@ -23,7 +23,7 @@ loop:
|
||||
|
||||
#line 25 "c/eof/02_bounds_checking.c"
|
||||
{
|
||||
char yych;
|
||||
unsigned char yych;
|
||||
if (YYLIMIT <= YYCURSOR) goto fail;
|
||||
yych = *YYCURSOR;
|
||||
switch (yych) {
|
||||
|
||||
@@ -17,8 +17,8 @@ static int lex(const char *str, unsigned int len) {
|
||||
loop:
|
||||
/*!re2c
|
||||
re2c:api:style = free-form;
|
||||
re2c:define:YYCTYPE = char;
|
||||
re2c:define:YYFILL = "goto fail;";
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
re2c:YYFILL = "goto fail;";
|
||||
|
||||
str = ['] ([^'\\] | [\\][^])* ['];
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ static int lex(const char *str, unsigned int len) {
|
||||
|
||||
#line 14 "c/eof/03_eof_rule.c"
|
||||
{
|
||||
char yych;
|
||||
unsigned char yych;
|
||||
yych = *YYCURSOR;
|
||||
switch (yych) {
|
||||
case ' ': goto yy3;
|
||||
|
||||
@@ -8,7 +8,7 @@ static int lex(const char *str, unsigned int len) {
|
||||
|
||||
for (;;) {
|
||||
/*!re2c
|
||||
re2c:define:YYCTYPE = char;
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:eof = 0;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ static int lex(const char *str, unsigned int len) {
|
||||
|
||||
#line 19 "c/eof/04_fake_sentinel.c"
|
||||
{
|
||||
char yych;
|
||||
unsigned char yych;
|
||||
yych = cur < lim ? *cur : 0;
|
||||
switch (yych) {
|
||||
case 0x00: goto yy1;
|
||||
|
||||
@@ -14,11 +14,11 @@ static int lex(const char *str, unsigned int len) {
|
||||
for (;;) {
|
||||
/*!re2c
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:api = custom;
|
||||
re2c:api = generic;
|
||||
re2c:api:style = free-form;
|
||||
re2c:define:YYCTYPE = char;
|
||||
re2c:define:YYPEEK = "cur < lim ? *cur : 0"; // fake null
|
||||
re2c:define:YYSKIP = "++cur;";
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
re2c:YYPEEK = "cur < lim ? *cur : 0"; // fake null
|
||||
re2c:YYSKIP = "++cur;";
|
||||
|
||||
* { count = -1; break; }
|
||||
[\x00] { break;; }
|
||||
|
||||
@@ -17,7 +17,7 @@ static int lex(const char *str, unsigned int len) {
|
||||
|
||||
#line 19 "c/eof/05_fake_sentinel_eof_rule.c"
|
||||
{
|
||||
char yych;
|
||||
unsigned char yych;
|
||||
yych = cur < lim ? *cur : 0;
|
||||
switch (yych) {
|
||||
case ' ': goto yy3;
|
||||
|
||||
@@ -15,14 +15,14 @@ static int lex(const char *str, unsigned int len) {
|
||||
/*!re2c
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:eof = 0;
|
||||
re2c:api = custom;
|
||||
re2c:api = generic;
|
||||
re2c:api:style = free-form;
|
||||
re2c:define:YYCTYPE = char;
|
||||
re2c:define:YYLESSTHAN = "cur >= lim";
|
||||
re2c:define:YYPEEK = "cur < lim ? *cur : 0"; // fake null
|
||||
re2c:define:YYSKIP = "++cur;";
|
||||
re2c:define:YYBACKUP = "mar = cur;";
|
||||
re2c:define:YYRESTORE = "cur = mar;";
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
re2c:YYLESSTHAN = "cur >= lim";
|
||||
re2c:YYPEEK = "cur < lim ? *cur : 0"; // fake null
|
||||
re2c:YYSKIP = "++cur;";
|
||||
re2c:YYBACKUP = "mar = cur;";
|
||||
re2c:YYRESTORE = "cur = mar;";
|
||||
|
||||
str = ['] ([^'\\] | [\\][^])* ['];
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ loop:
|
||||
|
||||
#line 45 "c/fill/01_fill.c"
|
||||
{
|
||||
char yych;
|
||||
unsigned char yych;
|
||||
yyFillLabel0:
|
||||
yych = *in->cur;
|
||||
switch (yych) {
|
||||
|
||||
@@ -40,11 +40,11 @@ loop:
|
||||
in->tok = in->cur;
|
||||
/*!re2c
|
||||
re2c:api:style = free-form;
|
||||
re2c:define:YYCTYPE = char;
|
||||
re2c:define:YYCURSOR = in->cur;
|
||||
re2c:define:YYMARKER = in->mar;
|
||||
re2c:define:YYLIMIT = in->lim;
|
||||
re2c:define:YYFILL = "fill(in) == 0";
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
re2c:YYCURSOR = in->cur;
|
||||
re2c:YYMARKER = in->mar;
|
||||
re2c:YYLIMIT = in->lim;
|
||||
re2c:YYFILL = "fill(in) == 0";
|
||||
re2c:eof = 0;
|
||||
|
||||
str = ['] ([^'\\] | [\\][^])* ['];
|
||||
|
||||
@@ -53,7 +53,7 @@ loop:
|
||||
|
||||
#line 55 "c/fill/02_fill.c"
|
||||
{
|
||||
char yych;
|
||||
unsigned char yych;
|
||||
if (in->lim <= in->cur) if (fill(in, 1) != 0) return -1;
|
||||
yych = *in->cur;
|
||||
switch (yych) {
|
||||
|
||||
@@ -47,10 +47,10 @@ loop:
|
||||
in->tok = in->cur;
|
||||
/*!re2c
|
||||
re2c:api:style = free-form;
|
||||
re2c:define:YYCTYPE = char;
|
||||
re2c:define:YYCURSOR = in->cur;
|
||||
re2c:define:YYLIMIT = in->lim;
|
||||
re2c:define:YYFILL = "if (fill(in, @@) != 0) return -1;";
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
re2c:YYCURSOR = in->cur;
|
||||
re2c:YYLIMIT = in->lim;
|
||||
re2c:YYFILL = "if (fill(in, @@) != 0) return -1;";
|
||||
|
||||
str = ['] ([^'\\] | [\\][^])* ['];
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ static void convert_newlines(std::ifstream &in, std::ostringstream &out) {
|
||||
|
||||
#line 14 "c/generic_api/ifstream.c"
|
||||
{
|
||||
char yych;
|
||||
unsigned char yych;
|
||||
yych = in.peek();
|
||||
switch (yych) {
|
||||
case '\r': goto yy3;
|
||||
|
||||
@@ -8,13 +8,13 @@ static void convert_newlines(std::ifstream &in, std::ostringstream &out) {
|
||||
std::streampos mar;
|
||||
for (;;) {
|
||||
/*!re2c
|
||||
re2c:api= custom;
|
||||
re2c:api = generic;
|
||||
re2c:api:style = free-form;
|
||||
re2c:define:YYCTYPE = char;
|
||||
re2c:define:YYPEEK = "in.peek()";
|
||||
re2c:define:YYSKIP = "{ in.ignore(); if (in.eof()) return; }";
|
||||
re2c:define:YYBACKUP = "mar = in.tellg();";
|
||||
re2c:define:YYRESTORE = "in.seekg(mar);";
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
re2c:YYPEEK = "in.peek()";
|
||||
re2c:YYSKIP = "{ in.ignore(); if (in.eof()) return; }";
|
||||
re2c:YYBACKUP = "mar = in.tellg();";
|
||||
re2c:YYRESTORE = "in.seekg(mar);";
|
||||
re2c:yyfill:enable = 0;
|
||||
|
||||
* { out.put(yych); continue; }
|
||||
|
||||
@@ -10,7 +10,7 @@ long lex(LexerState* st) {
|
||||
const char *t;
|
||||
|
||||
{
|
||||
char yych;
|
||||
unsigned char yych;
|
||||
goto yy0;
|
||||
yy1:
|
||||
++st->cur;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user