Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9682dcd2b2 | ||
|
|
745a042652 | ||
|
|
b1720e831c | ||
|
|
1022a1cb0f | ||
|
|
e485c5d572 | ||
|
|
957bc5359b | ||
|
|
c117b7d1c9 | ||
|
|
bda3544af9 | ||
|
|
dcc7411099 | ||
|
|
9baaabbf4a | ||
|
|
f1a46ca73a | ||
|
|
fccdffc979 | ||
|
|
ae610e4ecf | ||
|
|
86137ce914 | ||
|
|
c028cdd42b | ||
|
|
8a44906f5c | ||
|
|
3122b9a415 | ||
|
|
2ab394e9d5 | ||
|
|
e63ad223f5 |
@@ -33,18 +33,20 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v6
|
||||
uses: actions/setup-python@v7
|
||||
with:
|
||||
python-version: '3.8'
|
||||
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v5
|
||||
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: |
|
||||
|
||||
@@ -36,11 +36,11 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Setup apt cache (Linux)
|
||||
if: startsWith(runner.os, 'Linux')
|
||||
uses: actions/cache@v5
|
||||
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@v6
|
||||
uses: actions/setup-python@v7
|
||||
with:
|
||||
python-version: 3.x
|
||||
architecture: x64
|
||||
|
||||
@@ -62,11 +62,11 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Setup chocolatey Cache (Windows)
|
||||
if: startsWith(runner.os, 'Windows')
|
||||
uses: actions/cache@v5
|
||||
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@v5
|
||||
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@v6
|
||||
uses: actions/setup-python@v7
|
||||
with:
|
||||
python-version: 3.x
|
||||
architecture: x64
|
||||
|
||||
@@ -2,6 +2,24 @@ 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)
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(re2c VERSION 4.5 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")
|
||||
|
||||
@@ -471,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
|
||||
|
||||
+1
-1
@@ -308,7 +308,7 @@
|
||||
{
|
||||
"name": "windows-config-base",
|
||||
"hidden": true,
|
||||
"generator": "Visual Studio 17 2022",
|
||||
"generator": "Visual Studio 18 2026",
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
|
||||
+3
-1
@@ -629,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 \
|
||||
|
||||
+68
-54
@@ -59,7 +59,7 @@ decimal number:
|
||||
int lex(const char* YYCURSOR) {
|
||||
/*!re2c
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:define:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
|
||||
[1\-9][0\-9]* { return 0; }
|
||||
* { return 1; }
|
||||
@@ -1405,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
|
||||
@@ -1742,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
|
||||
@@ -2006,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
|
||||
@@ -2319,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
|
||||
@@ -2479,7 +2492,7 @@ static int lex(const char *YYCURSOR) {
|
||||
|
||||
for (;;) {
|
||||
/*!re2c
|
||||
re2c:define:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:yyfill:enable = 0;
|
||||
|
||||
* { return \-1; }
|
||||
@@ -2535,7 +2548,7 @@ static int lex(const char *str, unsigned int len) {
|
||||
|
||||
for (;;) {
|
||||
/*!re2c
|
||||
re2c:define:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:eof = 0;
|
||||
|
||||
@@ -2607,8 +2620,8 @@ static int lex(const char *str, unsigned int len) {
|
||||
loop:
|
||||
/*!re2c
|
||||
re2c:api:style = free\-form;
|
||||
re2c:define:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:define:YYFILL = \(dqgoto fail;\(dq;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:YYFILL = \(dqgoto fail;\(dq;
|
||||
|
||||
str = [\(aq] ([^\(aq\e\e] | [\e\e][^])* [\(aq];
|
||||
|
||||
@@ -2673,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 = \(dqunsigned char\(dq;
|
||||
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;; }
|
||||
@@ -2832,11 +2845,11 @@ loop:
|
||||
in\->tok = in\->cur;
|
||||
/*!re2c
|
||||
re2c:api:style = free\-form;
|
||||
re2c:define:YYCTYPE = \(dqunsigned char\(dq;
|
||||
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];
|
||||
@@ -2979,10 +2992,10 @@ loop:
|
||||
in\->tok = in\->cur;
|
||||
/*!re2c
|
||||
re2c:api:style = free\-form;
|
||||
re2c:define:YYCTYPE = \(dqunsigned char\(dq;
|
||||
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];
|
||||
|
||||
@@ -3070,7 +3083,7 @@ static uint64_t parse_u32(const char *s) {
|
||||
|
||||
/*!re2c
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:define:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
|
||||
end = \(dq\ex00\(dq;
|
||||
|
||||
@@ -3232,9 +3245,9 @@ static uint64_t parse_u32(const char *s) {
|
||||
|
||||
/*!re2c
|
||||
re2c:api:style = free\-form;
|
||||
re2c:define:YYCTYPE = \(dqunsigned char\(dq;
|
||||
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; }
|
||||
@@ -3372,13 +3385,13 @@ static Status lex(State *st, unsigned int *recv) {
|
||||
st\->tok = st\->cur;
|
||||
/*!re2c
|
||||
re2c:api:style = free\-form;
|
||||
re2c:define:YYCTYPE = \(dqunsigned char\(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]+[;];
|
||||
@@ -3527,7 +3540,7 @@ static What lex(const char *s) {
|
||||
const char *YYCURSOR = s, *YYMARKER;
|
||||
/*!re2c
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:define:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
|
||||
!use:fish;
|
||||
!use:colors;
|
||||
@@ -3568,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;
|
||||
*/
|
||||
}
|
||||
@@ -3576,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;
|
||||
*/
|
||||
}
|
||||
@@ -3721,7 +3734,7 @@ static int lex(const char *str, SemVer *ver) {
|
||||
|
||||
/*!re2c
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:define:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:tags = 1;
|
||||
|
||||
num = [0\-9]+;
|
||||
@@ -3828,11 +3841,11 @@ static bool lex(Input &in, std::vector<SemVer> &vers) {
|
||||
/*!re2c
|
||||
re2c:eof = 0;
|
||||
re2c:api:style = free\-form;
|
||||
re2c:define:YYCTYPE = \(dqunsigned char\(dq;
|
||||
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]+;
|
||||
@@ -3915,7 +3928,7 @@ static int lex(const char *str, SemVer *ver) {
|
||||
|
||||
/*!re2c
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:define:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:captvars = 1;
|
||||
|
||||
num = [0\-9]+;
|
||||
@@ -4018,11 +4031,11 @@ static bool parse(const char *str, Ver &ver) {
|
||||
|
||||
/*!re2c
|
||||
re2c:api:style = free\-form;
|
||||
re2c:define:YYCTYPE = \(dqunsigned char\(dq;
|
||||
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;
|
||||
|
||||
@@ -4094,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
|
||||
@@ -4119,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 = \(dqunsigned char\(dq;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:yyfill:enable = 0;
|
||||
|
||||
// Simplified \(dqUnicode Identifier and Pattern Syntax\(dq
|
||||
@@ -4203,7 +4217,7 @@ float { return OK; }
|
||||
Result lex(const char *s) {
|
||||
const char *YYCURSOR = s, *YYMARKER;
|
||||
/*!re2c
|
||||
re2c:define:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:yyfill:enable = 0;
|
||||
|
||||
* { return FAIL; }
|
||||
@@ -4261,8 +4275,8 @@ long lex(LexerState* st) {
|
||||
/*!re2c
|
||||
re2c:header = \(dqlexer/state.h\(dq;
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:define:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:define:YYCURSOR = \(dqst\->cur\(dq;
|
||||
re2c:YYCTYPE = \(dqunsigned char\(dq;
|
||||
re2c:YYCURSOR = \(dqst\->cur\(dq;
|
||||
re2c:tags = 1;
|
||||
re2c:tags:expression = \(dqst\->@@\(dq;
|
||||
|
||||
|
||||
+20
-6
@@ -1323,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
|
||||
@@ -1660,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
|
||||
@@ -1924,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
|
||||
@@ -2237,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
|
||||
@@ -3984,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
|
||||
|
||||
+20
-6
@@ -1405,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
|
||||
@@ -1742,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
|
||||
@@ -2006,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
|
||||
@@ -2319,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
|
||||
@@ -4137,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
|
||||
|
||||
+20
-6
@@ -1343,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
|
||||
@@ -1680,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
|
||||
@@ -1944,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
|
||||
@@ -2257,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
|
||||
@@ -4038,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
|
||||
|
||||
+20
-6
@@ -1365,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
|
||||
@@ -1702,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
|
||||
@@ -1966,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
|
||||
@@ -2279,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
|
||||
@@ -4067,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
|
||||
|
||||
+20
-6
@@ -1357,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
|
||||
@@ -1694,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
|
||||
@@ -1958,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
|
||||
@@ -2271,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
|
||||
@@ -3868,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
|
||||
|
||||
@@ -1330,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
|
||||
@@ -1667,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
|
||||
@@ -1931,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
|
||||
@@ -2244,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
|
||||
@@ -4001,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
|
||||
|
||||
+20
-6
@@ -1330,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
|
||||
@@ -1667,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
|
||||
@@ -1931,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
|
||||
@@ -2244,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
|
||||
@@ -3879,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
|
||||
|
||||
+20
-6
@@ -1375,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
|
||||
@@ -1712,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
|
||||
@@ -1976,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
|
||||
@@ -2289,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
|
||||
@@ -4119,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
|
||||
|
||||
@@ -1359,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
|
||||
@@ -1696,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
|
||||
@@ -1960,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
|
||||
@@ -2273,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
|
||||
@@ -4104,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
|
||||
|
||||
+20
-6
@@ -1322,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
|
||||
@@ -1659,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
|
||||
@@ -1923,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
|
||||
@@ -2236,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
|
||||
@@ -4021,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
|
||||
|
||||
+20
-6
@@ -1345,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
|
||||
@@ -1682,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
|
||||
@@ -1946,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
|
||||
@@ -2259,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
|
||||
@@ -4069,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.5 */
|
||||
/* Generated by re2c 4.6 */
|
||||
#line 1 "../lib/lex.re"
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 4.5 */
|
||||
/* Generated by re2c 4.6 */
|
||||
#line 1 "../lib/test_helper.re"
|
||||
#include "lib/test_helper.h"
|
||||
|
||||
|
||||
@@ -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"
|
||||
@@ -221,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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 4.5 */
|
||||
/* Generated by re2c 4.6 */
|
||||
#line 1 "../src/msg/ver_to_vernum.re"
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
+1400
-1362
File diff suppressed because it is too large
Load Diff
+3287
-3220
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 4.5 */
|
||||
/* Generated by re2c 4.6 */
|
||||
#line 1 "../src/parse/lexer.re"
|
||||
#include <ctype.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 4.5 */
|
||||
/* Generated by re2c 4.6 */
|
||||
|
||||
#ifndef _RE2C_PARSE_LEX_
|
||||
#define _RE2C_PARSE_LEX_
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
AC_INIT([re2c],[4.5],[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])
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -579,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``).
|
||||
|
||||
@@ -619,4 +626,3 @@ language configurations, inplace configurations and code templates.
|
||||
|
||||
``.yyfn.throw``
|
||||
True if ``re2c:yyfn:throw`` configuration is defined to a nonempty string.
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
+8
-4
@@ -759,7 +759,8 @@ and $l$ is the new sequence constructed by the $\epsilon$-closure.
|
||||
$O:$ empty list of operations \;
|
||||
\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)$ \;
|
||||
$i = V[t][v]$ \;
|
||||
\If {$i$ is undefined } {
|
||||
@@ -791,9 +792,9 @@ and $l$ is the new sequence constructed by the $\epsilon$-closure.
|
||||
\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$
|
||||
}
|
||||
}
|
||||
@@ -1377,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$} {
|
||||
@@ -1409,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);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
int lex(const char* YYCURSOR) {
|
||||
/*!re2c
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:define:YYCTYPE = "unsigned char";
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
|
||||
[1-9][0-9]* { return 0; }
|
||||
* { return 1; }
|
||||
|
||||
@@ -13,7 +13,7 @@ static uint64_t parse_u32(const char *s) {
|
||||
|
||||
/*!re2c
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:define:YYCTYPE = "unsigned char";
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
|
||||
end = "\x00";
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@ static uint64_t parse_u32(const char *s) {
|
||||
|
||||
/*!re2c
|
||||
re2c:api:style = free-form;
|
||||
re2c:define:YYCTYPE = "unsigned 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; }
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -7,7 +7,7 @@ static int lex(const char *YYCURSOR) {
|
||||
|
||||
for (;;) {
|
||||
/*!re2c
|
||||
re2c:define:YYCTYPE = "unsigned char";
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
re2c:yyfill:enable = 0;
|
||||
|
||||
* { return -1; }
|
||||
|
||||
@@ -17,8 +17,8 @@ static int lex(const char *str, unsigned int len) {
|
||||
loop:
|
||||
/*!re2c
|
||||
re2c:api:style = free-form;
|
||||
re2c:define:YYCTYPE = "unsigned char";
|
||||
re2c:define:YYFILL = "goto fail;";
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
re2c:YYFILL = "goto fail;";
|
||||
|
||||
str = ['] ([^'\\] | [\\][^])* ['];
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ static int lex(const char *str, unsigned int len) {
|
||||
|
||||
for (;;) {
|
||||
/*!re2c
|
||||
re2c:define:YYCTYPE = "unsigned char";
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:eof = 0;
|
||||
|
||||
|
||||
@@ -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 = "unsigned 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;; }
|
||||
|
||||
@@ -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 = "unsigned 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 = ['] ([^'\\] | [\\][^])* ['];
|
||||
|
||||
|
||||
@@ -40,11 +40,11 @@ loop:
|
||||
in->tok = in->cur;
|
||||
/*!re2c
|
||||
re2c:api:style = free-form;
|
||||
re2c:define:YYCTYPE = "unsigned 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 = ['] ([^'\\] | [\\][^])* ['];
|
||||
|
||||
@@ -47,10 +47,10 @@ loop:
|
||||
in->tok = in->cur;
|
||||
/*!re2c
|
||||
re2c:api:style = free-form;
|
||||
re2c:define:YYCTYPE = "unsigned 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 = ['] ([^'\\] | [\\][^])* ['];
|
||||
|
||||
|
||||
@@ -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 = "unsigned 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; }
|
||||
|
||||
@@ -15,8 +15,8 @@ long lex(LexerState* st) {
|
||||
/*!re2c
|
||||
re2c:header = "lexer/state.h";
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:define:YYCTYPE = "unsigned char";
|
||||
re2c:define:YYCURSOR = "st->cur";
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
re2c:YYCURSOR = "st->cur";
|
||||
re2c:tags = 1;
|
||||
re2c:tags:expression = "st->@@";
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
Result lex(const char *s) {
|
||||
const char *YYCURSOR = s, *YYMARKER;
|
||||
/*!re2c
|
||||
re2c:define:YYCTYPE = "unsigned char";
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
re2c:yyfill:enable = 0;
|
||||
|
||||
* { return FAIL; }
|
||||
|
||||
@@ -51,7 +51,7 @@ struct input_t {
|
||||
}
|
||||
};
|
||||
|
||||
/*!re2c re2c:define:YYCTYPE = "unsigned char"; */
|
||||
/*!re2c re2c:YYCTYPE = "unsigned char"; */
|
||||
|
||||
template<int base>
|
||||
static bool adddgt(unsigned long &u, unsigned long d)
|
||||
@@ -88,7 +88,7 @@ static bool lex_hex(const unsigned char *s, const unsigned char *e, unsigned lon
|
||||
for (u = 0, s += 2; s < e;) {
|
||||
/*!re2c
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:define:YYCURSOR = s;
|
||||
re2c:YYCURSOR = s;
|
||||
* { if (!adddgt<16>(u, s[-1] - 0x30u)) return false; continue; }
|
||||
[a-f] { if (!adddgt<16>(u, s[-1] - 0x61u + 10)) return false; continue; }
|
||||
[A-F] { if (!adddgt<16>(u, s[-1] - 0x41u + 10)) return false; continue; }
|
||||
@@ -104,11 +104,11 @@ static bool lex_str(input_t &in, unsigned char q)
|
||||
in.tok = in.cur;
|
||||
/*!re2c
|
||||
re2c:yyfill:enable = 1;
|
||||
re2c:define:YYCURSOR = in.cur;
|
||||
re2c:define:YYMARKER = in.mar;
|
||||
re2c:define:YYLIMIT = in.lim;
|
||||
re2c:define:YYFILL = "if (!in.fill(@@)) return false;";
|
||||
re2c:define:YYFILL:naked = 1;
|
||||
re2c:YYCURSOR = in.cur;
|
||||
re2c:YYMARKER = in.mar;
|
||||
re2c:YYLIMIT = in.lim;
|
||||
re2c:YYFILL = "if (!in.fill(@@)) return false;";
|
||||
re2c:YYFILL:naked = 1;
|
||||
* { return false; }
|
||||
[^\n\\] { u = in.tok[0]; if (u == q) break; continue; }
|
||||
"\\a" { u = '\a'; continue; }
|
||||
@@ -139,7 +139,7 @@ static bool lex_flt(const unsigned char *s)
|
||||
int e = 0;
|
||||
/*!re2c
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:define:YYCURSOR = s;
|
||||
re2c:YYCURSOR = s;
|
||||
*/
|
||||
mant_int:
|
||||
/*!re2c
|
||||
@@ -180,11 +180,11 @@ static bool lex(input_t &in)
|
||||
in.tok = in.cur;
|
||||
/*!re2c
|
||||
re2c:yyfill:enable = 1;
|
||||
re2c:define:YYCURSOR = in.cur;
|
||||
re2c:define:YYMARKER = in.mar;
|
||||
re2c:define:YYLIMIT = in.lim;
|
||||
re2c:define:YYFILL = "if (!in.fill(@@)) return false;";
|
||||
re2c:define:YYFILL:naked = 1;
|
||||
re2c:YYCURSOR = in.cur;
|
||||
re2c:YYMARKER = in.mar;
|
||||
re2c:YYLIMIT = in.lim;
|
||||
re2c:YYFILL = "if (!in.fill(@@)) return false;";
|
||||
re2c:YYFILL:naked = 1;
|
||||
|
||||
end = "\x00";
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@ struct out_t {
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:api:style = free-form;
|
||||
re2c:encoding:utf8 = 1;
|
||||
re2c:define:YYGETCONDITION = "c";
|
||||
re2c:define:YYSETCONDITION = "c = @@;";
|
||||
re2c:YYGETCOND = "c";
|
||||
re2c:YYSETCOND = "c = @@;";
|
||||
|
||||
// letters
|
||||
l = "\u2830";
|
||||
@@ -135,7 +135,7 @@ static void lex_utf8(const iutf8_t & in)
|
||||
int c = yycl;
|
||||
out_t out;
|
||||
/*!use:re2c
|
||||
re2c:define:YYCTYPE = "unsigned char";
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
re2c:encoding:utf8 = 1;
|
||||
*/
|
||||
}
|
||||
@@ -146,7 +146,7 @@ static void lex_utf16(const iutf16_t & in)
|
||||
int c = yycl;
|
||||
out_t out;
|
||||
/*!use:re2c
|
||||
re2c:define:YYCTYPE = "unsigned int";
|
||||
re2c:YYCTYPE = "unsigned int";
|
||||
re2c:encoding:utf16 = 1;
|
||||
*/
|
||||
}
|
||||
@@ -157,7 +157,7 @@ static void lex_utf32(const iutf32_t & in)
|
||||
int c = yycl;
|
||||
out_t out;
|
||||
/*!use:re2c
|
||||
re2c:define:YYCTYPE = "unsigned int";
|
||||
re2c:YYCTYPE = "unsigned int";
|
||||
re2c:encoding:utf32 = 1;
|
||||
*/
|
||||
}
|
||||
@@ -168,7 +168,7 @@ static void lex_ucs2(const iucs2_t & in)
|
||||
int c = yycl;
|
||||
out_t out;
|
||||
/*!use:re2c
|
||||
re2c:define:YYCTYPE = "unsigned int";
|
||||
re2c:YYCTYPE = "unsigned int";
|
||||
re2c:encoding:ucs2 = 1;
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
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;
|
||||
*/
|
||||
}
|
||||
@@ -23,7 +23,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;
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ static What lex(const char *s) {
|
||||
const char *YYCURSOR = s, *YYMARKER;
|
||||
/*!re2c
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:define:YYCTYPE = "unsigned char";
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
|
||||
!use:fish;
|
||||
!use:colors;
|
||||
|
||||
@@ -49,13 +49,13 @@ static Status lex(State *st, unsigned int *recv) {
|
||||
st->tok = st->cur;
|
||||
/*!re2c
|
||||
re2c:api:style = free-form;
|
||||
re2c:define:YYCTYPE = "unsigned char";
|
||||
re2c:define:YYCURSOR = "st->cur";
|
||||
re2c:define:YYMARKER = "st->mar";
|
||||
re2c:define:YYLIMIT = "st->lim";
|
||||
re2c:define:YYGETSTATE = "st->state";
|
||||
re2c:define:YYSETSTATE = "st->state = @@;";
|
||||
re2c:define:YYFILL = "return WAITING;";
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
re2c:YYCURSOR = "st->cur";
|
||||
re2c:YYMARKER = "st->mar";
|
||||
re2c:YYLIMIT = "st->lim";
|
||||
re2c:YYGETSTATE = "st->state";
|
||||
re2c:YYSETSTATE = "st->state = @@;";
|
||||
re2c:YYFILL = "return WAITING;";
|
||||
re2c:eof = 0;
|
||||
|
||||
packet = [a-z]+[;];
|
||||
|
||||
@@ -21,7 +21,7 @@ static int lex(const char *str, SemVer *ver) {
|
||||
|
||||
/*!re2c
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:define:YYCTYPE = "unsigned char";
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
re2c:tags = 1;
|
||||
|
||||
num = [0-9]+;
|
||||
|
||||
@@ -65,11 +65,11 @@ static bool lex(Input &in, std::vector<SemVer> &vers) {
|
||||
/*!re2c
|
||||
re2c:eof = 0;
|
||||
re2c:api:style = free-form;
|
||||
re2c:define:YYCTYPE = "unsigned 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:tags:expression = "in.@@";
|
||||
|
||||
num = [0-9]+;
|
||||
|
||||
@@ -65,11 +65,11 @@ static bool parse(const char *str, Ver &ver) {
|
||||
|
||||
/*!re2c
|
||||
re2c:api:style = free-form;
|
||||
re2c:define:YYCTYPE = "unsigned char";
|
||||
re2c:define:YYSTAGP = "@@ = YYCURSOR;";
|
||||
re2c:define:YYSTAGN = "@@ = NULL;";
|
||||
re2c:define:YYMTAGP = "add_mtag(mt, @@, YYCURSOR);";
|
||||
re2c:define:YYMTAGN = "add_mtag(mt, @@, NULL);";
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
re2c:YYSTAGP = "@@ = YYCURSOR;";
|
||||
re2c:YYSTAGN = "@@ = NULL;";
|
||||
re2c:YYMTAGP = "add_mtag(mt, @@, YYCURSOR);";
|
||||
re2c:YYMTAGN = "add_mtag(mt, @@, NULL);";
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:tags = 1;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ static int lex(const char *str, SemVer *ver) {
|
||||
|
||||
/*!re2c
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:define:YYCTYPE = "unsigned char";
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
re2c:captvars = 1;
|
||||
|
||||
num = [0-9]+;
|
||||
|
||||
@@ -25,7 +25,7 @@ static int lex(const char *str, SemVer *ver) {
|
||||
|
||||
/*!re2c
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:define:YYCTYPE = "unsigned char";
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
re2c:posix-captures = 1;
|
||||
|
||||
num = [0-9]+;
|
||||
|
||||
@@ -259,20 +259,51 @@ static void print_headers(const char *tok,
|
||||
|
||||
static int lex(input_t *in, long *count)
|
||||
{
|
||||
const char *of, *au, *at,
|
||||
*hs1, *hs3, *m1, *p1, *p3, *p5, *q1, *q3,
|
||||
*hs2, *hs4, *m2, *p2, *p4, *p6, *q2, *q4,
|
||||
*r1, *r3, *rp1, *s1, *st1, *u1, *u3, *v1, *v3,
|
||||
*r2, *r4, *rp2, *s2, *st2, *u2, *u4, *v2, *v4;
|
||||
mtag_t *h1, *h2, *h3, *h4, *h5;
|
||||
long c;
|
||||
const char *at = NULL;
|
||||
const char *au = NULL;
|
||||
const char *hs1 = NULL;
|
||||
const char *hs2 = NULL;
|
||||
const char *hs3 = NULL;
|
||||
const char *hs4 = NULL;
|
||||
const char *m1 = NULL;
|
||||
const char *m2 = NULL;
|
||||
const char *of = NULL;
|
||||
const char *p1 = NULL;
|
||||
const char *p2 = NULL;
|
||||
const char *p3 = NULL;
|
||||
const char *p4 = NULL;
|
||||
const char *p5 = NULL;
|
||||
const char *p6 = NULL;
|
||||
const char *q1 = NULL;
|
||||
const char *q2 = NULL;
|
||||
const char *q3 = NULL;
|
||||
const char *q4 = NULL;
|
||||
const char *r1 = NULL;
|
||||
const char *r2 = NULL;
|
||||
const char *r3 = NULL;
|
||||
const char *r4 = NULL;
|
||||
const char *rp1 = NULL;
|
||||
const char *rp2 = NULL;
|
||||
const char *s1 = NULL;
|
||||
const char *s2 = NULL;
|
||||
const char *st1 = NULL;
|
||||
const char *st2 = NULL;
|
||||
const char *u1 = NULL;
|
||||
const char *u2 = NULL;
|
||||
const char *u3 = NULL;
|
||||
const char *u4 = NULL;
|
||||
const char *v1 = NULL;
|
||||
const char *v2 = NULL;
|
||||
const char *v3 = NULL;
|
||||
const char *v4 = NULL;
|
||||
|
||||
c = 0;;
|
||||
of = au = at
|
||||
= hs1 = hs3 = m1 = p1 = p3 = p5 = q1 = q3
|
||||
= hs2 = hs4 = m2 = p2 = p4 = p6 = q2 = q4
|
||||
= r1 = r3 = rp1 = s1 = st1 = u1 = u3 = v1 = v3
|
||||
= r2 = r4 = rp2 = s2 = st2 = u2 = u4 = v2 = v4 = NULL;
|
||||
mtag_t *h1;
|
||||
mtag_t *h2;
|
||||
mtag_t *h3;
|
||||
mtag_t *h4;
|
||||
mtag_t *h5;
|
||||
|
||||
long c = 0;
|
||||
loop:
|
||||
in->tok = in->cur;
|
||||
|
||||
@@ -14045,21 +14076,21 @@ int main()
|
||||
free_input(&in);
|
||||
return 0;
|
||||
}
|
||||
c/submatch/http_rfc7230.re:247:17: warning: tag `m1` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:247:17: warning: tag `at` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:247:17: warning: tag `u3` has 3rd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:247:17: warning: tag `u4` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:247:17: warning: tag `hs3` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:247:17: warning: tag `hs4` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:247:17: warning: tag `r3` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:247:17: warning: tag `s1` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:247:17: warning: tag `s2` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:247:17: warning: tag `u1` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:247:17: warning: tag `u2` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:247:17: warning: tag `hs1` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:247:17: warning: tag `hs2` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:247:17: warning: tag `r1` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:247:17: warning: tag `p3` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:247:17: warning: tag `h3` has 3rd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:247:17: warning: tag `h4` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:247:17: warning: tag `h5` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:236:17: warning: tag `m1` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:236:17: warning: tag `at` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:236:17: warning: tag `u3` has 3rd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:236:17: warning: tag `u4` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:236:17: warning: tag `hs3` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:236:17: warning: tag `hs4` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:236:17: warning: tag `r3` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:236:17: warning: tag `s1` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:236:17: warning: tag `s2` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:236:17: warning: tag `u1` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:236:17: warning: tag `u2` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:236:17: warning: tag `hs1` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:236:17: warning: tag `hs2` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:236:17: warning: tag `r1` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:236:17: warning: tag `p3` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:236:17: warning: tag `h3` has 3rd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:236:17: warning: tag `h4` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
c/submatch/http_rfc7230.re:236:17: warning: tag `h5` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
|
||||
|
||||
@@ -146,20 +146,9 @@ static void print_headers(const char *tok,
|
||||
|
||||
static int lex(input_t *in, long *count)
|
||||
{
|
||||
const char *of, *au, *at,
|
||||
*hs1, *hs3, *m1, *p1, *p3, *p5, *q1, *q3,
|
||||
*hs2, *hs4, *m2, *p2, *p4, *p6, *q2, *q4,
|
||||
*r1, *r3, *rp1, *s1, *st1, *u1, *u3, *v1, *v3,
|
||||
*r2, *r4, *rp2, *s2, *st2, *u2, *u4, *v2, *v4;
|
||||
mtag_t *h1, *h2, *h3, *h4, *h5;
|
||||
long c;
|
||||
|
||||
c = 0;;
|
||||
of = au = at
|
||||
= hs1 = hs3 = m1 = p1 = p3 = p5 = q1 = q3
|
||||
= hs2 = hs4 = m2 = p2 = p4 = p6 = q2 = q4
|
||||
= r1 = r3 = rp1 = s1 = st1 = u1 = u3 = v1 = v3
|
||||
= r2 = r4 = rp2 = s2 = st2 = u2 = u4 = v2 = v4 = NULL;
|
||||
/*!svars:re2c format = 'const char *@@ = NULL;\n'; */
|
||||
/*!mvars:re2c format = 'mtag_t *@@;\n'; */
|
||||
long c = 0;
|
||||
loop:
|
||||
in->tok = in->cur;
|
||||
/*!re2c
|
||||
|
||||
@@ -11,7 +11,7 @@ static int lex(const char *YYCURSOR) {
|
||||
|
||||
for (;;) {
|
||||
/*!re2c
|
||||
re2c:define:YYCTYPE = "unsigned char";
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:tags = 1;
|
||||
|
||||
|
||||
@@ -42,9 +42,9 @@ static int lex(const char *s) {
|
||||
|
||||
for (;;) {
|
||||
/*!re2c
|
||||
re2c:define:YYCTYPE = "unsigned char";
|
||||
re2c:define:YYCURSOR = s;
|
||||
re2c:define:YYMARKER = m;
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
re2c:YYCURSOR = s;
|
||||
re2c:YYMARKER = m;
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:tags = 1;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ static int lex(const char *YYCURSOR) {
|
||||
tp.clear();
|
||||
/*!mtags:re2c format = "@@ = -1;"; */
|
||||
/*!re2c
|
||||
re2c:define:YYCTYPE = "unsigned char";
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:tags = 1;
|
||||
|
||||
|
||||
@@ -72,12 +72,12 @@ loop:
|
||||
in->tok = in->cur;
|
||||
/*!re2c
|
||||
|
||||
re2c:define:YYCTYPE = "unsigned char";
|
||||
re2c:define:YYCURSOR = in->cur;
|
||||
re2c:define:YYMARKER = in->mar;
|
||||
re2c:define:YYLIMIT = in->lim;
|
||||
re2c:define:YYFILL = "if (fill(in, @@) != 0) return 2;";
|
||||
re2c:define:YYFILL:naked = 1;
|
||||
re2c:YYCTYPE = "unsigned char";
|
||||
re2c:YYCURSOR = in->cur;
|
||||
re2c:YYMARKER = in->mar;
|
||||
re2c:YYLIMIT = in->lim;
|
||||
re2c:YYFILL = "if (fill(in, @@) != 0) return 2;";
|
||||
re2c:YYFILL:naked = 1;
|
||||
re2c:tags:expression = "in->@@";
|
||||
|
||||
end = "\x00";
|
||||
|
||||
+14
-5
@@ -5,7 +5,7 @@ supported_api_styles = ["free-form"];
|
||||
supported_code_models = ["loop-switch", "recursive-functions"];
|
||||
supported_targets = ["code", "dot"];
|
||||
supported_features = ["nested-ifs", "bitmaps", "case-ranges",
|
||||
"tags", "captures", "captvars"];
|
||||
"tags", "captures", "captvars", "computed-continue"];
|
||||
|
||||
|
||||
// language-specific options ---------------------------------------------------
|
||||
@@ -220,12 +220,21 @@ code:switch_case_range = [val{0}: val] (.many ? "..." [val{-1}: val]);
|
||||
|
||||
code:switch_case_default = "else";
|
||||
|
||||
code:loop =
|
||||
topindent (.loop_label ? label ": ") "while (true) {" nl
|
||||
code:loop = (.computed_continue
|
||||
? topindent var ": switch (@as(enum {" nl
|
||||
indent [state: topindent state "," nl] dedent
|
||||
topindent "}, ." val ")) {" nl
|
||||
indent [state:
|
||||
topindent "." state " => {" nl
|
||||
indent [stmt: stmt] dedent
|
||||
topindent "}," nl] dedent
|
||||
topindent "}" nl
|
||||
: topindent (.loop_label ? label ": ") "while (true) {" nl
|
||||
indent [stmt: stmt] dedent
|
||||
topindent "}" nl;
|
||||
topindent "}" nl);
|
||||
|
||||
code:continue = topindent "continue" (.loop_label ? " :" label) ";" nl;
|
||||
code:continue = topindent "continue"
|
||||
(.computed_continue ? " :" var " ." val : (.loop_label ? " :" label)) ";" nl;
|
||||
|
||||
code:goto = topindent "goto " label ";" nl;
|
||||
|
||||
|
||||
+2
-2
@@ -35,7 +35,7 @@ int regexec_dfa(
|
||||
|
||||
for (;;) {
|
||||
s = dfa->states[i];
|
||||
const int32_t c = *p++;
|
||||
const size_t c = static_cast<uint8_t>(*p++);
|
||||
const size_t j = preg->char2class[c];
|
||||
i = s->arcs[j];
|
||||
|
||||
@@ -102,7 +102,7 @@ subhistory_t* regparse_dfa(const regex_t* preg, const char* string, size_t nmatc
|
||||
|
||||
for (;;) {
|
||||
s = dfa->states[i];
|
||||
const int32_t c = *p++;
|
||||
const size_t c = static_cast<uint8_t>(*p++);
|
||||
const size_t j = preg->char2class[c];
|
||||
i = s->arcs[j];
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ static MpTdfaBacklink forward_pass(const regex_t* preg, const char* string, size
|
||||
|
||||
log.clear();
|
||||
for (size_t stidx = 0;;) {
|
||||
const int32_t chr = *strptr++;
|
||||
const size_t chr = static_cast<uint8_t>(*strptr++);
|
||||
const size_t cls = preg->char2class[chr];
|
||||
|
||||
const MpTdfaState* state = states[stidx];
|
||||
|
||||
+24
-5
@@ -199,6 +199,12 @@ struct CodeSwitch {
|
||||
CodeCases* cases;
|
||||
};
|
||||
|
||||
struct CodeLoop {
|
||||
const char* init;
|
||||
CodeCases* cases;
|
||||
CodeList* body;
|
||||
};
|
||||
|
||||
struct CodeBlock {
|
||||
enum class Kind: uint32_t {
|
||||
WRAPPED,
|
||||
@@ -245,6 +251,11 @@ struct CodeCgoto {
|
||||
const char* index;
|
||||
};
|
||||
|
||||
struct CodeContinue {
|
||||
const char* label;
|
||||
const char* value;
|
||||
};
|
||||
|
||||
struct CodeParam {
|
||||
const char* name;
|
||||
const char* type;
|
||||
@@ -324,6 +335,7 @@ struct Code {
|
||||
CodeSwitch swch;
|
||||
CodeBlock block;
|
||||
CodeCgoto cgoto;
|
||||
CodeContinue cont;
|
||||
CodeFnDef fndef;
|
||||
CodeFnCall fncall;
|
||||
CodeRaw raw;
|
||||
@@ -335,7 +347,7 @@ struct Code {
|
||||
CodeLabel label;
|
||||
CodeDebug debug;
|
||||
CodeTag tag;
|
||||
CodeList* loop;
|
||||
CodeLoop loop;
|
||||
CodeList* rfuncs;
|
||||
loc_t loc;
|
||||
size_t accept;
|
||||
@@ -383,15 +395,22 @@ inline Code* code_cgoto(OutAllocator& alc, const char* array, const char* base,
|
||||
return x;
|
||||
}
|
||||
|
||||
inline Code* code_continue(OutAllocator& alc, const char* target) {
|
||||
inline Code* code_continue(OutAllocator& alc, const char* label, const char* value = nullptr) {
|
||||
Code* x = new_code(alc, CodeKind::CONTINUE);
|
||||
x->target = target;
|
||||
x->cont.label = label;
|
||||
x->cont.value = value;
|
||||
return x;
|
||||
}
|
||||
|
||||
inline Code* code_loop(OutAllocator& alc, CodeList* loop) {
|
||||
inline Code* code_loop(
|
||||
OutAllocator& alc,
|
||||
CodeList* body,
|
||||
const char* init = nullptr,
|
||||
CodeCases* cases = nullptr) {
|
||||
Code* x = new_code(alc, CodeKind::LOOP);
|
||||
x->loop = loop;
|
||||
x->loop.init = init;
|
||||
x->loop.cases = cases;
|
||||
x->loop.body = body;
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
@@ -478,14 +478,33 @@ void expand_fintags(Output& output, const Tag& tag, std::vector<const char*>& fi
|
||||
}
|
||||
}
|
||||
|
||||
static void gen_continue_yyloop(Output& output, CodeList* stmts, const char* next) {
|
||||
static void gen_continue_yyswitch(Output& output, CodeList* stmts, const char* next) {
|
||||
const opt_t* opts = output.block().opts;
|
||||
OutAllocator& alc = output.allocator;
|
||||
|
||||
append(stmts, code_assign(alc, opts->var_state.c_str(), next));
|
||||
|
||||
const char* label = opts->label_loop.empty() ? nullptr : opts->label_loop.c_str();
|
||||
append(stmts, code_continue(alc, label));
|
||||
if (opts->computed_continue) {
|
||||
append(stmts, code_continue(alc, label, next));
|
||||
} else {
|
||||
append(stmts, code_assign(alc, opts->var_state.c_str(), next));
|
||||
append(stmts, code_continue(alc, label));
|
||||
}
|
||||
}
|
||||
|
||||
static const char* gen_yyswitch_state(Output& output, const Label& label) {
|
||||
const opt_t* opts = output.block().opts;
|
||||
Scratchbuf& o = output.scratchbuf;
|
||||
|
||||
if (opts->computed_continue) {
|
||||
// Computed-continue uses state labels as enum fields, so prefix them to
|
||||
// turn the numeric labels into valid identifiers.
|
||||
o.str(opts->label_prefix);
|
||||
}
|
||||
return o.label(label).flush();
|
||||
}
|
||||
|
||||
static void gen_continue_yyswitch(Output& output, CodeList* stmts, const Label& next) {
|
||||
gen_continue_yyswitch(output, stmts, gen_yyswitch_state(output, next));
|
||||
}
|
||||
|
||||
static CodeList* gen_fill_falllback(
|
||||
@@ -524,8 +543,7 @@ static CodeList* gen_fill_falllback(
|
||||
append(fallback_trans, code_goto(alc, buf.flush()));
|
||||
break;
|
||||
case CodeModel::LOOP_SWITCH:
|
||||
buf.label(*fallback->label);
|
||||
gen_continue_yyloop(output, fallback_trans, buf.flush());
|
||||
gen_continue_yyswitch(output, fallback_trans, *fallback->label);
|
||||
break;
|
||||
case CodeModel::REC_FUNC: {
|
||||
const CodeFnCommon* fn = output.block().fn_common;
|
||||
@@ -575,8 +593,7 @@ CodeList* gen_goto_after_fill(
|
||||
}
|
||||
break;
|
||||
case CodeModel::LOOP_SWITCH:
|
||||
o.u32(s->label->index);
|
||||
gen_continue_yyloop(output, resume, o.flush());
|
||||
gen_continue_yyswitch(output, resume, *s->label);
|
||||
break;
|
||||
case CodeModel::REC_FUNC: {
|
||||
const CodeFnCommon* fn = output.block().fn_common;
|
||||
@@ -704,8 +721,7 @@ static void gen_goto(
|
||||
append(transition, code_goto(alc, o.flush()));
|
||||
break;
|
||||
case CodeModel::LOOP_SWITCH:
|
||||
o.label(*jump.to->label);
|
||||
gen_continue_yyloop(output, transition, o.flush());
|
||||
gen_continue_yyswitch(output, transition, *jump.to->label);
|
||||
break;
|
||||
case CodeModel::REC_FUNC: {
|
||||
const CodeFnCommon* fn = output.block().fn_common;
|
||||
@@ -1099,9 +1115,10 @@ static void emit_rule(Output& output, CodeList* stmts, const Adfa& dfa, size_t r
|
||||
append(stmts, code_text(alc, o.flush()));
|
||||
break;
|
||||
case CodeModel::LOOP_SWITCH:
|
||||
CHECK(!opts->computed_continue);
|
||||
// loop/switch mode: set `yystate` to the start DFA state of the next condition and
|
||||
// continue to the head of the loop.
|
||||
gen_continue_yyloop(output, stmts, next_cond);
|
||||
gen_continue_yyswitch(output, stmts, next_cond);
|
||||
break;
|
||||
case CodeModel::REC_FUNC: {
|
||||
// func/rec mode: emit function call to the start of the next condition
|
||||
@@ -1875,11 +1892,10 @@ void gen_dfa_as_switch_cases(Output& output, Adfa& dfa, CodeCases* cases) {
|
||||
for (State* s = dfa.head; s; s = s->next) {
|
||||
CodeList* body = code_list(alc);
|
||||
|
||||
uint32_t label = s->label->index;
|
||||
DCHECK(label != Label::NONE);
|
||||
|
||||
const Label& state_label = *s->label;
|
||||
DCHECK(state_label.index != Label::NONE);
|
||||
// Emit current state.
|
||||
if (opts->debug) append(body, code_debug(alc, label));
|
||||
if (opts->debug) append(body, code_debug(alc, state_label.index));
|
||||
emit_state(output, dfa, s, body, nullptr);
|
||||
|
||||
// As long as the following state has no incoming transitions (its label is unused),
|
||||
@@ -1890,7 +1906,13 @@ void gen_dfa_as_switch_cases(Output& output, Adfa& dfa, CodeCases* cases) {
|
||||
emit_state(output, dfa, s, body, nullptr);
|
||||
}
|
||||
|
||||
append(cases, code_case_number(alc, body, static_cast<int32_t>(label)));
|
||||
if (opts->computed_continue) {
|
||||
const char* switch_label = gen_yyswitch_state(output, state_label);
|
||||
append(cases, code_case_string(alc, body, switch_label));
|
||||
} else {
|
||||
append(cases,
|
||||
code_case_number(alc, body, static_cast<int32_t>(state_label.index)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1899,13 +1921,19 @@ void wrap_dfas_in_loop_switch(Output& output, CodeList* stmts, CodeCases* cases)
|
||||
OutAllocator& alc = output.allocator;
|
||||
DCHECK(opts->code_model == CodeModel::LOOP_SWITCH);
|
||||
|
||||
CodeList* loop = code_list(alc);
|
||||
gen_storable_state_cases(output, cases);
|
||||
if (opts->state_abort) {
|
||||
append(cases, code_case_default(alc, gen_abort(alc)));
|
||||
if (opts->computed_continue) {
|
||||
DCHECK(!output.block().dfas.empty());
|
||||
const Label& start = *output.block().dfas[0]->head->label;
|
||||
append(stmts, code_loop(alc, nullptr, gen_yyswitch_state(output, start), cases));
|
||||
} else {
|
||||
CodeList* loop = code_list(alc);
|
||||
gen_storable_state_cases(output, cases);
|
||||
if (opts->state_abort) {
|
||||
append(cases, code_case_default(alc, gen_abort(alc)));
|
||||
}
|
||||
append(loop, code_switch(alc, opts->var_state.c_str(), cases));
|
||||
append(stmts, code_loop(alc, loop));
|
||||
}
|
||||
append(loop, code_switch(alc, opts->var_state.c_str(), cases));
|
||||
append(stmts, code_loop(alc, loop));
|
||||
}
|
||||
|
||||
static void gen_dfa_as_recursive_functions(Output& output, const Adfa& dfa, CodeList* code) {
|
||||
@@ -2075,7 +2103,11 @@ LOCAL_NODISCARD(Ret gen_block_code(Output& output, const Adfas& dfas, CodeList*
|
||||
// In the loop/switch mode append all DFA states as cases of the `yystate` switch.
|
||||
// Merge DFAs for different conditions together in one switch.
|
||||
local_decls = true;
|
||||
append(code, gen_yystate_def(output, is_cond_block));
|
||||
if (!opts->computed_continue) {
|
||||
// Computed-continue passes the next state directly to the labeled switch,
|
||||
// so the yystate variable is not needed.
|
||||
append(code, gen_yystate_def(output, is_cond_block));
|
||||
}
|
||||
|
||||
local_decls |= gen_bitmaps(output, code);
|
||||
|
||||
|
||||
+94
-20
@@ -549,49 +549,103 @@ class RenderSwitch : public RenderCallback {
|
||||
|
||||
class RenderLoop : public RenderCallback {
|
||||
RenderContext& rctx;
|
||||
const CodeList* code;
|
||||
const CodeLoop* code;
|
||||
const CodeCase* curr_case;
|
||||
const CodeCase* last_case;
|
||||
const Code* curr_stmt;
|
||||
const Code* last_stmt;
|
||||
size_t ncases;
|
||||
size_t nstmts;
|
||||
|
||||
public:
|
||||
RenderLoop(RenderContext& rctx, const CodeList* code)
|
||||
: rctx(rctx), code(code), curr_stmt(nullptr), last_stmt(nullptr), nstmts(0) {
|
||||
for (const Code* s = code->head; s; s = s->next) ++nstmts;
|
||||
RenderLoop(RenderContext& rctx, const CodeLoop* code)
|
||||
: rctx(rctx)
|
||||
, code(code)
|
||||
, curr_case(nullptr)
|
||||
, last_case(nullptr)
|
||||
, curr_stmt(nullptr)
|
||||
, last_stmt(nullptr)
|
||||
, ncases(0)
|
||||
, nstmts(0) {
|
||||
if (code->cases) {
|
||||
for (const CodeCase* c = code->cases->head; c; c = c->next) ++ncases;
|
||||
}
|
||||
if (code->body) {
|
||||
for (const Code* s = code->body->head; s; s = s->next) ++nstmts;
|
||||
}
|
||||
}
|
||||
|
||||
void render_var(StxVarId var) override {
|
||||
switch (var) {
|
||||
case StxVarId::LABEL: rctx.os << rctx.opts->label_loop; break;
|
||||
case StxVarId::STMT: render(rctx, curr_stmt); break;
|
||||
default: render_global_var(rctx, var); break;
|
||||
case StxVarId::LABEL:
|
||||
rctx.os << rctx.opts->label_loop;
|
||||
break;
|
||||
case StxVarId::STATE:
|
||||
DCHECK(curr_case->kind == CodeCase::Kind::STRING);
|
||||
rctx.os << curr_case->string;
|
||||
break;
|
||||
case StxVarId::VAL:
|
||||
rctx.os << code->init;
|
||||
break;
|
||||
case StxVarId::VAR:
|
||||
rctx.os << rctx.opts->var_state;
|
||||
break;
|
||||
case StxVarId::STMT:
|
||||
render(rctx, curr_stmt);
|
||||
break;
|
||||
default:
|
||||
render_global_var(rctx, var);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
size_t get_list_size(StxVarId var) const override {
|
||||
if (var == StxVarId::STMT) {
|
||||
return nstmts;
|
||||
switch (var) {
|
||||
case StxVarId::STATE:
|
||||
return ncases;
|
||||
case StxVarId::STMT: {
|
||||
if (!curr_case) return nstmts;
|
||||
size_t n = 0;
|
||||
for (const Code* s = curr_case->body->head; s; s = s->next) ++n;
|
||||
return n;
|
||||
}
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return 0;
|
||||
}
|
||||
UNREACHABLE();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void start_list(StxVarId var, size_t lbound, size_t rbound) override {
|
||||
if (var == StxVarId::STMT) {
|
||||
DCHECK(rbound < nstmts);
|
||||
find_list_bounds(code->head, lbound, rbound, &curr_stmt, &last_stmt);
|
||||
} else {
|
||||
switch (var) {
|
||||
case StxVarId::STATE:
|
||||
DCHECK(rbound < ncases);
|
||||
find_list_bounds(code->cases->head, lbound, rbound, &curr_case, &last_case);
|
||||
break;
|
||||
case StxVarId::STMT: {
|
||||
const CodeList* stmts = curr_case ? curr_case->body : code->body;
|
||||
DCHECK(stmts);
|
||||
DCHECK(rbound < get_list_size(var));
|
||||
find_list_bounds(stmts->head, lbound, rbound, &curr_stmt, &last_stmt);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool next_in_list(StxVarId var) override {
|
||||
if (var == StxVarId::STMT) {
|
||||
switch (var) {
|
||||
case StxVarId::STATE:
|
||||
curr_case = curr_case->next;
|
||||
return curr_case != last_case;
|
||||
case StxVarId::STMT:
|
||||
curr_stmt = curr_stmt->next;
|
||||
return curr_stmt != last_stmt;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return false;
|
||||
}
|
||||
UNREACHABLE();
|
||||
return false;
|
||||
}
|
||||
|
||||
FORBID_COPY(RenderLoop);
|
||||
@@ -615,6 +669,26 @@ class RenderJmp : public RenderCallback {
|
||||
FORBID_COPY(RenderJmp);
|
||||
};
|
||||
|
||||
class RenderContinue : public RenderCallback {
|
||||
RenderContext& rctx;
|
||||
const CodeContinue* code;
|
||||
|
||||
public:
|
||||
RenderContinue(RenderContext& rctx, const CodeContinue* code)
|
||||
: rctx(rctx), code(code) {}
|
||||
|
||||
void render_var(StxVarId var) override {
|
||||
switch (var) {
|
||||
case StxVarId::LABEL: rctx.os << code->label; break;
|
||||
case StxVarId::VAL: rctx.os << code->value; break;
|
||||
case StxVarId::VAR: rctx.os << rctx.opts->var_state; break;
|
||||
default: render_global_var(rctx, var); break;
|
||||
}
|
||||
}
|
||||
|
||||
FORBID_COPY(RenderContinue);
|
||||
};
|
||||
|
||||
class RenderCgoto : public RenderCallback {
|
||||
RenderContext& rctx;
|
||||
const CodeCgoto* code;
|
||||
@@ -1435,7 +1509,7 @@ static void render(RenderContext& rctx, const Code* code) {
|
||||
break;
|
||||
}
|
||||
case CodeKind::LOOP: {
|
||||
RenderLoop callback(rctx, code->loop);
|
||||
RenderLoop callback(rctx, &code->loop);
|
||||
rctx.opts->render_code_loop(rctx.os, callback);
|
||||
break;
|
||||
}
|
||||
@@ -1450,7 +1524,7 @@ static void render(RenderContext& rctx, const Code* code) {
|
||||
break;
|
||||
}
|
||||
case CodeKind::CONTINUE: {
|
||||
RenderJmp callback(rctx, code->target);
|
||||
RenderContinue callback(rctx, &code->cont);
|
||||
rctx.opts->render_code_continue(rctx.os, callback);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -196,6 +196,7 @@ enum class StxGOpt {
|
||||
CODE_MODEL_GOTO_LABEL,
|
||||
CODE_MODEL_LOOP_SWITCH,
|
||||
CODE_MODEL_REC_FUNC,
|
||||
COMPUTED_CONTINUE,
|
||||
START_CONDITIONS,
|
||||
STORABLE_STATE,
|
||||
DATE,
|
||||
|
||||
@@ -41,6 +41,21 @@ LOCAL_NODISCARD(Ret fix_conopt(conopt_t& glob)) {
|
||||
glob.set_eager_skip(true);
|
||||
}
|
||||
|
||||
if (glob.computed_continue) {
|
||||
if (glob.code_model != CodeModel::LOOP_SWITCH) {
|
||||
RET_FAIL(error("--computed-continue requires --loop-switch code model"));
|
||||
}
|
||||
if (glob.storable_state) {
|
||||
RET_FAIL(error("storable state is not supported with --computed-continue"));
|
||||
}
|
||||
if (glob.start_conditions) {
|
||||
RET_FAIL(error("conditions are not supported with --computed-continue"));
|
||||
}
|
||||
if (!glob.supported_features_contains("computed-continue")) {
|
||||
RET_FAIL(error("--computed-continue is not supported for this backend"));
|
||||
}
|
||||
}
|
||||
|
||||
if (glob.target == Target::SKELETON) {
|
||||
if (!glob.supported_targets_contains("skeleton")) {
|
||||
RET_FAIL(error("skeleton is not supported for this backend"));
|
||||
@@ -836,6 +851,8 @@ static bool eval_cond(
|
||||
return opts->code_model == CodeModel::LOOP_SWITCH;
|
||||
case StxGOpt::CODE_MODEL_REC_FUNC:
|
||||
return opts->code_model == CodeModel::REC_FUNC;
|
||||
case StxGOpt::COMPUTED_CONTINUE:
|
||||
return opts->computed_continue;
|
||||
case StxGOpt::START_CONDITIONS:
|
||||
return opts->start_conditions;
|
||||
case StxGOpt::STORABLE_STATE:
|
||||
|
||||
+6
-3
@@ -66,7 +66,7 @@ using StxCodes = list_t<StxCode>;
|
||||
({"code", "dot", "skeleton"})) \
|
||||
CHECKED_LIST(supported_features, \
|
||||
({"nested-ifs", "bitmaps", "computed-gotos", "case-ranges", "unsafe", "monadic", \
|
||||
"tags", "captures", "captvars"}))
|
||||
"tags", "captures", "captvars", "computed-continue"}))
|
||||
|
||||
#define RE2C_STX_OPTS \
|
||||
STX_OPT(bool, semicolons, false) \
|
||||
@@ -164,10 +164,12 @@ using StxCodes = list_t<StxCode>;
|
||||
({}), ({}), ({}) \
|
||||
) \
|
||||
CODE_TEMPLATE(loop, \
|
||||
({StxVarId::LABEL}), ({StxVarId::STMT}), ({}) \
|
||||
({StxVarId::LABEL, StxVarId::VAL, StxVarId::VAR}), \
|
||||
({StxVarId::STATE, StxVarId::STMT}), ({}) \
|
||||
) \
|
||||
CODE_TEMPLATE(continue, \
|
||||
({StxVarId::LABEL}), ({}), ({}) \
|
||||
({StxVarId::LABEL, StxVarId::VAL, StxVarId::VAR}), \
|
||||
({}), ({}) \
|
||||
) \
|
||||
CODE_TEMPLATE(goto, \
|
||||
({StxVarId::LABEL}), ({}), ({}) \
|
||||
@@ -428,6 +430,7 @@ enum class StxVarId : uint32_t {
|
||||
CONSTOPT(bool, version, true) \
|
||||
CONSTOPT(bool, start_conditions, false) \
|
||||
CONSTOPT(bool, storable_state, false) \
|
||||
CONSTOPT(bool, computed_continue, false) \
|
||||
CONSTOPT(bool, flex_syntax, false) \
|
||||
CONSTOPT(bool, verbose, false) \
|
||||
CONSTOPT(bool, line_dirs, true) \
|
||||
|
||||
@@ -154,6 +154,7 @@ opt_long: /*!local:re2c
|
||||
"eager-skip" end { global.set_eager_skip(true); goto opt; }
|
||||
"goto-label" end { global.set_code_model(CodeModel::GOTO_LABEL); goto opt; }
|
||||
"loop-switch" end { global.set_code_model(CodeModel::LOOP_SWITCH); goto opt; }
|
||||
"computed-continue" end { global.set_computed_continue(true); goto opt; }
|
||||
"recursive-functions" end { global.set_code_model(CodeModel::REC_FUNC); goto opt; }
|
||||
|
||||
"bit-vectors" end { opts.set_bitmaps(true); goto opt; }
|
||||
|
||||
@@ -784,6 +784,7 @@ start:
|
||||
".case_ranges" { RET_GOPT(StxGOpt::CASE_RANGES); }
|
||||
".unsafe" { RET_GOPT(StxGOpt::UNSAFE); }
|
||||
".monadic" { RET_GOPT(StxGOpt::MONADIC); }
|
||||
".computed_continue" { RET_GOPT(StxGOpt::COMPUTED_CONTINUE); }
|
||||
".loop_label" { RET_GOPT(StxGOpt::LOOP_LABEL); }
|
||||
".cgoto.relative" { RET_GOPT(StxGOpt::CGOTO_RELATIVE); }
|
||||
".yyfill.enable" { RET_GOPT(StxGOpt::FILL_ENABLE); }
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <cstddef>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
@@ -82,7 +82,7 @@ class slab_allocator_t {
|
||||
// Use alignment based on pointer size: 32-bit platforms need stronger alignment
|
||||
// for 64-bit types (double, long long), while 64-bit platforms are already
|
||||
// sufficiently aligned with pointer-sized alignment.
|
||||
constexpr size_t ALLOCATOR_ALIGNMENT = (sizeof(void*) == 4) ? alignof(max_align_t) : sizeof(void*);
|
||||
constexpr size_t ALLOCATOR_ALIGNMENT = (sizeof(void*) == 4) ? alignof(std::max_align_t) : sizeof(void*);
|
||||
|
||||
// Use different types to prevent accidentally mixing allocators for data with different life spans.
|
||||
using AstAllocator = slab_allocator_t<AllocatorKind::AST, 16 * 4096, ALLOCATOR_ALIGNMENT>;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
re2c: error: --computed-continue is not supported for this backend
|
||||
@@ -0,0 +1 @@
|
||||
// re2c $INPUT -o $OUTPUT --loop-switch --computed-continue
|
||||
@@ -0,0 +1,25 @@
|
||||
// re2zig $INPUT -o $OUTPUT --loop-switch --computed-continue --no-generation-date --no-version
|
||||
|
||||
const std = @import("std");
|
||||
|
||||
const Token = enum {
|
||||
identifier,
|
||||
invalid,
|
||||
};
|
||||
|
||||
fn lex(yyinput: [:0]const u8) Token {
|
||||
var yycursor: u32 = 0;
|
||||
/*!re2c
|
||||
re2c:yyfill:enable = 0;
|
||||
|
||||
ident = [a-z]+;
|
||||
|
||||
ident { return .identifier; }
|
||||
* { return .invalid; }
|
||||
*/
|
||||
}
|
||||
|
||||
test {
|
||||
try std.testing.expectEqual(Token.identifier, lex("abc"));
|
||||
try std.testing.expectEqual(Token.invalid, lex("123"));
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
// Generated by re2zig
|
||||
// re2zig $INPUT -o $OUTPUT --loop-switch --computed-continue --no-generation-date --no-version
|
||||
|
||||
const std = @import("std");
|
||||
|
||||
const Token = enum {
|
||||
identifier,
|
||||
invalid,
|
||||
};
|
||||
|
||||
fn lex(yyinput: [:0]const u8) Token {
|
||||
var yycursor: u32 = 0;
|
||||
|
||||
var yych: u8 = 0;
|
||||
yystate: switch (@as(enum {
|
||||
yy0,
|
||||
yy1,
|
||||
yy2,
|
||||
yy3,
|
||||
}, .yy0)) {
|
||||
.yy0 => {
|
||||
yych = yyinput[yycursor];
|
||||
yycursor += 1;
|
||||
switch (yych) {
|
||||
0x61...0x7A => {
|
||||
continue :yystate .yy2;
|
||||
},
|
||||
else => {
|
||||
continue :yystate .yy1;
|
||||
},
|
||||
}
|
||||
},
|
||||
.yy1 => {
|
||||
return .invalid;
|
||||
},
|
||||
.yy2 => {
|
||||
yych = yyinput[yycursor];
|
||||
switch (yych) {
|
||||
0x61...0x7A => {
|
||||
yycursor += 1;
|
||||
continue :yystate .yy2;
|
||||
},
|
||||
else => {
|
||||
continue :yystate .yy3;
|
||||
},
|
||||
}
|
||||
},
|
||||
.yy3 => {
|
||||
return .identifier;
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
test {
|
||||
try std.testing.expectEqual(Token.identifier, lex("abc"));
|
||||
try std.testing.expectEqual(Token.invalid, lex("123"));
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// re2zig $INPUT -o $OUTPUT --loop-switch --computed-continue --no-generation-date --no-version
|
||||
|
||||
const std = @import("std");
|
||||
|
||||
fn lex(yyinput: [:0]const u8) u8 {
|
||||
var yycursor: usize = 0;
|
||||
/*!re2c
|
||||
re2c:yyfill:enable = 0;
|
||||
re2c:label:prefix = "node";
|
||||
re2c:variable:yystate = "lexer_state";
|
||||
|
||||
[a]+ { return 1; }
|
||||
[b]+ { return 2; }
|
||||
* { return 0; }
|
||||
*/
|
||||
}
|
||||
|
||||
test "computed-continue custom state and DFA labels" {
|
||||
const Case = struct { input: [:0]const u8, expected: u8 };
|
||||
const cases = [_]Case{
|
||||
.{ .input = "aaa", .expected = 1 },
|
||||
.{ .input = "bbb", .expected = 2 },
|
||||
.{ .input = "123", .expected = 0 },
|
||||
};
|
||||
|
||||
for (cases) |case| {
|
||||
try std.testing.expectEqual(case.expected, lex(case.input));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
// Generated by re2zig
|
||||
// re2zig $INPUT -o $OUTPUT --loop-switch --computed-continue --no-generation-date --no-version
|
||||
|
||||
const std = @import("std");
|
||||
|
||||
fn lex(yyinput: [:0]const u8) u8 {
|
||||
var yycursor: usize = 0;
|
||||
|
||||
var yych: u8 = 0;
|
||||
lexer_state: switch (@as(enum {
|
||||
node0,
|
||||
node1,
|
||||
node2,
|
||||
node3,
|
||||
node4,
|
||||
node5,
|
||||
}, .node0)) {
|
||||
.node0 => {
|
||||
yych = yyinput[yycursor];
|
||||
yycursor += 1;
|
||||
switch (yych) {
|
||||
0x61 => {
|
||||
continue :lexer_state .node2;
|
||||
},
|
||||
0x62 => {
|
||||
continue :lexer_state .node4;
|
||||
},
|
||||
else => {
|
||||
continue :lexer_state .node1;
|
||||
},
|
||||
}
|
||||
},
|
||||
.node1 => {
|
||||
return 0;
|
||||
},
|
||||
.node2 => {
|
||||
yych = yyinput[yycursor];
|
||||
switch (yych) {
|
||||
0x61 => {
|
||||
yycursor += 1;
|
||||
continue :lexer_state .node2;
|
||||
},
|
||||
else => {
|
||||
continue :lexer_state .node3;
|
||||
},
|
||||
}
|
||||
},
|
||||
.node3 => {
|
||||
return 1;
|
||||
},
|
||||
.node4 => {
|
||||
yych = yyinput[yycursor];
|
||||
switch (yych) {
|
||||
0x62 => {
|
||||
yycursor += 1;
|
||||
continue :lexer_state .node4;
|
||||
},
|
||||
else => {
|
||||
continue :lexer_state .node5;
|
||||
},
|
||||
}
|
||||
},
|
||||
.node5 => {
|
||||
return 2;
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
test "computed-continue custom state and DFA labels" {
|
||||
const Case = struct { input: [:0]const u8, expected: u8 };
|
||||
const cases = [_]Case{
|
||||
.{ .input = "aaa", .expected = 1 },
|
||||
.{ .input = "bbb", .expected = 2 },
|
||||
.{ .input = "123", .expected = 0 },
|
||||
};
|
||||
|
||||
for (cases) |case| {
|
||||
try std.testing.expectEqual(case.expected, lex(case.input));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
// re2zig $INPUT -o $OUTPUT --loop-switch --computed-continue --no-generation-date --no-version
|
||||
|
||||
const std = @import("std");
|
||||
|
||||
%{rules:x
|
||||
$ { return 0; }
|
||||
* { return 1; }
|
||||
[a] $ { return 2; }
|
||||
[a] { return 3; }
|
||||
[b] $ | [b] { return 4; }
|
||||
[c]+ $ { return 5; }
|
||||
%}
|
||||
|
||||
fn lex_simple(yyinput: [:0]const u8) i32 {
|
||||
var yycursor: usize = 0;
|
||||
var yymarker: usize = 0;
|
||||
const yylimit: usize = yyinput.len;
|
||||
|
||||
%{use:x
|
||||
re2c:yyfill:enable = 0;
|
||||
%}
|
||||
}
|
||||
|
||||
fn lex_eof(yyinput: [:0]const u8) i32 {
|
||||
var yycursor: usize = 0;
|
||||
var yymarker: usize = 0;
|
||||
const yylimit: usize = yyinput.len;
|
||||
|
||||
%{use:x
|
||||
re2c:eof = 0;
|
||||
re2c:YYFILL = "false";
|
||||
re2c:YYEND = "yycursor == yylimit";
|
||||
%}
|
||||
}
|
||||
|
||||
%{max %}
|
||||
|
||||
fn lex_scc(str: [:0]const u8) !i32 {
|
||||
var yycursor: usize = 0;
|
||||
var yymarker: usize = 0;
|
||||
const end: usize = str.len;
|
||||
const yylimit: usize = end + yymaxfill;
|
||||
|
||||
var yyinput = try std.testing.allocator.alloc(u8, yylimit);
|
||||
defer std.testing.allocator.free(yyinput);
|
||||
std.mem.copyForwards(u8, yyinput[0..], str);
|
||||
std.mem.copyForwards(u8, yyinput[end..], &[_]u8{0} ** yymaxfill);
|
||||
|
||||
%{use:x
|
||||
re2c:YYFILL = "return -1;";
|
||||
re2c:YYEND = "yycursor == end";
|
||||
%}
|
||||
}
|
||||
|
||||
test "computed-continue fill and EOF transitions" {
|
||||
const Case = struct { input: [:0]const u8, expected: i32 };
|
||||
const cases = [_]Case{
|
||||
.{ .input = "", .expected = 0 },
|
||||
.{ .input = "a", .expected = 2 },
|
||||
.{ .input = "ax", .expected = 3 },
|
||||
.{ .input = "b", .expected = 4 },
|
||||
.{ .input = "bx", .expected = 4 },
|
||||
.{ .input = "ccc", .expected = 5 },
|
||||
};
|
||||
|
||||
for (cases) |case| {
|
||||
try std.testing.expectEqual(case.expected, lex_simple(case.input));
|
||||
try std.testing.expectEqual(case.expected, lex_eof(case.input));
|
||||
try std.testing.expectEqual(case.expected, try lex_scc(case.input));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,359 @@
|
||||
// Generated by re2zig
|
||||
// re2zig $INPUT -o $OUTPUT --loop-switch --computed-continue --no-generation-date --no-version
|
||||
|
||||
const std = @import("std");
|
||||
|
||||
|
||||
|
||||
fn lex_simple(yyinput: [:0]const u8) i32 {
|
||||
var yycursor: usize = 0;
|
||||
var yymarker: usize = 0;
|
||||
const yylimit: usize = yyinput.len;
|
||||
|
||||
|
||||
var yych: u8 = 0;
|
||||
yystate: switch (@as(enum {
|
||||
yy0,
|
||||
yy1,
|
||||
yy2,
|
||||
yy3,
|
||||
yy4,
|
||||
yy5,
|
||||
yy6,
|
||||
yy7,
|
||||
yy8,
|
||||
yy9,
|
||||
yy10,
|
||||
}, .yy0)) {
|
||||
.yy0 => {
|
||||
if (yylimit <= yycursor) {
|
||||
continue :yystate .yy8;
|
||||
}
|
||||
yych = yyinput[yycursor];
|
||||
yycursor += 1;
|
||||
switch (yych) {
|
||||
0x61 => {
|
||||
continue :yystate .yy3;
|
||||
},
|
||||
0x62 => {
|
||||
continue :yystate .yy4;
|
||||
},
|
||||
0x63 => {
|
||||
continue :yystate .yy5;
|
||||
},
|
||||
else => {
|
||||
continue :yystate .yy1;
|
||||
},
|
||||
}
|
||||
},
|
||||
.yy1 => {
|
||||
continue :yystate .yy2;
|
||||
},
|
||||
.yy2 => {
|
||||
return 1;
|
||||
},
|
||||
.yy3 => {
|
||||
if (yylimit <= yycursor) {
|
||||
continue :yystate .yy9;
|
||||
}
|
||||
return 3;
|
||||
},
|
||||
.yy4 => {
|
||||
return 4;
|
||||
},
|
||||
.yy5 => {
|
||||
yymarker = yycursor;
|
||||
if (yylimit <= yycursor) {
|
||||
continue :yystate .yy10;
|
||||
}
|
||||
yych = yyinput[yycursor];
|
||||
switch (yych) {
|
||||
0x63 => {
|
||||
yycursor += 1;
|
||||
continue :yystate .yy6;
|
||||
},
|
||||
else => {
|
||||
continue :yystate .yy2;
|
||||
},
|
||||
}
|
||||
},
|
||||
.yy6 => {
|
||||
if (yylimit <= yycursor) {
|
||||
continue :yystate .yy10;
|
||||
}
|
||||
yych = yyinput[yycursor];
|
||||
switch (yych) {
|
||||
0x63 => {
|
||||
yycursor += 1;
|
||||
continue :yystate .yy6;
|
||||
},
|
||||
else => {
|
||||
continue :yystate .yy7;
|
||||
},
|
||||
}
|
||||
},
|
||||
.yy7 => {
|
||||
yycursor = yymarker;
|
||||
continue :yystate .yy2;
|
||||
},
|
||||
.yy8 => {
|
||||
return 0;
|
||||
},
|
||||
.yy9 => {
|
||||
return 2;
|
||||
},
|
||||
.yy10 => {
|
||||
return 5;
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fn lex_eof(yyinput: [:0]const u8) i32 {
|
||||
var yycursor: usize = 0;
|
||||
var yymarker: usize = 0;
|
||||
const yylimit: usize = yyinput.len;
|
||||
|
||||
|
||||
var yych: u8 = 0;
|
||||
yystate: switch (@as(enum {
|
||||
yy0,
|
||||
yy1,
|
||||
yy2,
|
||||
yy3,
|
||||
yy4,
|
||||
yy5,
|
||||
yy6,
|
||||
yy7,
|
||||
yy8,
|
||||
yy9,
|
||||
yy10,
|
||||
}, .yy0)) {
|
||||
.yy0 => {
|
||||
yych = yyinput[yycursor];
|
||||
switch (yych) {
|
||||
0x61 => {
|
||||
yycursor += 1;
|
||||
continue :yystate .yy3;
|
||||
},
|
||||
0x62 => {
|
||||
yycursor += 1;
|
||||
continue :yystate .yy4;
|
||||
},
|
||||
0x63 => {
|
||||
yycursor += 1;
|
||||
continue :yystate .yy5;
|
||||
},
|
||||
else => {
|
||||
if (yylimit <= yycursor) {
|
||||
if (false) {
|
||||
continue :yystate .yy0;
|
||||
}
|
||||
continue :yystate .yy8;
|
||||
}
|
||||
yycursor += 1;
|
||||
continue :yystate .yy1;
|
||||
},
|
||||
}
|
||||
},
|
||||
.yy1 => {
|
||||
continue :yystate .yy2;
|
||||
},
|
||||
.yy2 => {
|
||||
return 1;
|
||||
},
|
||||
.yy3 => {
|
||||
if (yycursor == yylimit) {
|
||||
continue :yystate .yy9;
|
||||
}
|
||||
return 3;
|
||||
},
|
||||
.yy4 => {
|
||||
return 4;
|
||||
},
|
||||
.yy5 => {
|
||||
yymarker = yycursor;
|
||||
yych = yyinput[yycursor];
|
||||
switch (yych) {
|
||||
0x63 => {
|
||||
yycursor += 1;
|
||||
continue :yystate .yy6;
|
||||
},
|
||||
else => {
|
||||
if (yylimit <= yycursor) {
|
||||
if (false) {
|
||||
continue :yystate .yy5;
|
||||
}
|
||||
continue :yystate .yy10;
|
||||
}
|
||||
continue :yystate .yy2;
|
||||
},
|
||||
}
|
||||
},
|
||||
.yy6 => {
|
||||
yych = yyinput[yycursor];
|
||||
switch (yych) {
|
||||
0x63 => {
|
||||
yycursor += 1;
|
||||
continue :yystate .yy6;
|
||||
},
|
||||
else => {
|
||||
if (yylimit <= yycursor) {
|
||||
if (false) {
|
||||
continue :yystate .yy6;
|
||||
}
|
||||
continue :yystate .yy10;
|
||||
}
|
||||
continue :yystate .yy7;
|
||||
},
|
||||
}
|
||||
},
|
||||
.yy7 => {
|
||||
yycursor = yymarker;
|
||||
continue :yystate .yy2;
|
||||
},
|
||||
.yy8 => {
|
||||
return 0;
|
||||
},
|
||||
.yy9 => {
|
||||
return 2;
|
||||
},
|
||||
.yy10 => {
|
||||
return 5;
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const yymaxfill = 2;
|
||||
|
||||
|
||||
fn lex_scc(str: [:0]const u8) !i32 {
|
||||
var yycursor: usize = 0;
|
||||
var yymarker: usize = 0;
|
||||
const end: usize = str.len;
|
||||
const yylimit: usize = end + yymaxfill;
|
||||
|
||||
var yyinput = try std.testing.allocator.alloc(u8, yylimit);
|
||||
defer std.testing.allocator.free(yyinput);
|
||||
std.mem.copyForwards(u8, yyinput[0..], str);
|
||||
std.mem.copyForwards(u8, yyinput[end..], &[_]u8{0} ** yymaxfill);
|
||||
|
||||
|
||||
var yych: u8 = 0;
|
||||
yystate: switch (@as(enum {
|
||||
yy0,
|
||||
yy1,
|
||||
yy2,
|
||||
yy3,
|
||||
yy4,
|
||||
yy5,
|
||||
yy6,
|
||||
yy7,
|
||||
yy8,
|
||||
yy9,
|
||||
yy10,
|
||||
}, .yy0)) {
|
||||
.yy0 => {
|
||||
if (yycursor == end) {
|
||||
continue :yystate .yy8;
|
||||
}
|
||||
if ((yylimit - yycursor) < 2) { return -1; }
|
||||
yych = yyinput[yycursor];
|
||||
yycursor += 1;
|
||||
switch (yych) {
|
||||
0x61 => {
|
||||
continue :yystate .yy3;
|
||||
},
|
||||
0x62 => {
|
||||
continue :yystate .yy4;
|
||||
},
|
||||
0x63 => {
|
||||
continue :yystate .yy5;
|
||||
},
|
||||
else => {
|
||||
continue :yystate .yy1;
|
||||
},
|
||||
}
|
||||
},
|
||||
.yy1 => {
|
||||
continue :yystate .yy2;
|
||||
},
|
||||
.yy2 => {
|
||||
return 1;
|
||||
},
|
||||
.yy3 => {
|
||||
if (yycursor == end) {
|
||||
continue :yystate .yy9;
|
||||
}
|
||||
return 3;
|
||||
},
|
||||
.yy4 => {
|
||||
return 4;
|
||||
},
|
||||
.yy5 => {
|
||||
yymarker = yycursor;
|
||||
if (yycursor == end) {
|
||||
continue :yystate .yy10;
|
||||
}
|
||||
yych = yyinput[yycursor];
|
||||
switch (yych) {
|
||||
0x63 => {
|
||||
yycursor += 1;
|
||||
continue :yystate .yy6;
|
||||
},
|
||||
else => {
|
||||
continue :yystate .yy2;
|
||||
},
|
||||
}
|
||||
},
|
||||
.yy6 => {
|
||||
if (yycursor == end) {
|
||||
continue :yystate .yy10;
|
||||
}
|
||||
if (yylimit <= yycursor) { return -1; }
|
||||
yych = yyinput[yycursor];
|
||||
switch (yych) {
|
||||
0x63 => {
|
||||
yycursor += 1;
|
||||
continue :yystate .yy6;
|
||||
},
|
||||
else => {
|
||||
continue :yystate .yy7;
|
||||
},
|
||||
}
|
||||
},
|
||||
.yy7 => {
|
||||
yycursor = yymarker;
|
||||
continue :yystate .yy2;
|
||||
},
|
||||
.yy8 => {
|
||||
return 0;
|
||||
},
|
||||
.yy9 => {
|
||||
return 2;
|
||||
},
|
||||
.yy10 => {
|
||||
return 5;
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
test "computed-continue fill and EOF transitions" {
|
||||
const Case = struct { input: [:0]const u8, expected: i32 };
|
||||
const cases = [_]Case{
|
||||
.{ .input = "", .expected = 0 },
|
||||
.{ .input = "a", .expected = 2 },
|
||||
.{ .input = "ax", .expected = 3 },
|
||||
.{ .input = "b", .expected = 4 },
|
||||
.{ .input = "bx", .expected = 4 },
|
||||
.{ .input = "ccc", .expected = 5 },
|
||||
};
|
||||
|
||||
for (cases) |case| {
|
||||
try std.testing.expectEqual(case.expected, lex_simple(case.input));
|
||||
try std.testing.expectEqual(case.expected, lex_eof(case.input));
|
||||
try std.testing.expectEqual(case.expected, try lex_scc(case.input));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
// re2zig $INPUT -o $OUTPUT --recursive-functions --computed-continue
|
||||
@@ -0,0 +1 @@
|
||||
re2c: error: --computed-continue requires --loop-switch code model
|
||||
@@ -0,0 +1 @@
|
||||
// re2zig $INPUT -o $OUTPUT --loop-switch --computed-continue --start-conditions
|
||||
@@ -0,0 +1 @@
|
||||
re2c: error: conditions are not supported with --computed-continue
|
||||
@@ -0,0 +1 @@
|
||||
// re2zig $INPUT -o $OUTPUT --loop-switch --computed-continue --storable-state
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user