Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8a4cddf80 | ||
|
|
7f26edd716 | ||
|
|
cf7e2c7639 | ||
|
|
555331f6e7 | ||
|
|
efc527c2ac | ||
|
|
a5e37dcb8a | ||
|
|
bce5d21288 | ||
|
|
d85f08ac1f | ||
|
|
01b78d8db7 | ||
|
|
91f265b9f3 | ||
|
|
61c14ce5e5 | ||
|
|
c4e779cab5 | ||
|
|
a2d5361545 | ||
|
|
0dfc64d6ff | ||
|
|
59bec481e3 | ||
|
|
cffecf2bc5 | ||
|
|
04eb0ae86d | ||
|
|
2228e8f6d0 | ||
|
|
d85e7e97fd | ||
|
|
2bbd803796 | ||
|
|
1a050e0eb8 | ||
|
|
8571400c7f | ||
|
|
a73bb4cddd | ||
|
|
181bfe95cc | ||
|
|
73637f91a8 | ||
|
|
d6c2a60f88 | ||
|
|
48435b5a1b | ||
|
|
103271952c | ||
|
|
27e0855534 | ||
|
|
cec1803ac0 | ||
|
|
06c0ffa90d | ||
|
|
960cd7dee5 | ||
|
|
f3f3194a35 | ||
|
|
25b3626c38 | ||
|
|
9218113a8e | ||
|
|
f3ecbb16ae | ||
|
|
fea7f92b2a | ||
|
|
2c5c5003e8 | ||
|
|
85f7d36227 | ||
|
|
77735b9f67 | ||
|
|
d7c0cc09bc | ||
|
|
2b349129eb | ||
|
|
2027021c1a | ||
|
|
650c4bc0c2 | ||
|
|
77eb8fbaa1 | ||
|
|
ff9f27c6f7 | ||
|
|
b6803c4a88 | ||
|
|
f310f6d635 | ||
|
|
db1a4d6951 | ||
|
|
c03459572b | ||
|
|
0936b3aa72 | ||
|
|
c641280e1c | ||
|
|
a543138bd1 | ||
|
|
3f0f46ff75 | ||
|
|
c8e8ab51dd | ||
|
|
7aba30555d | ||
|
|
95dde201b8 | ||
|
|
10bd44025e | ||
|
|
5c84dfc5aa | ||
|
|
ddb1add809 | ||
|
|
dfae2f2361 | ||
|
|
08ce33838b | ||
|
|
409dcabf7d | ||
|
|
da97854a4a | ||
|
|
eac735f66d | ||
|
|
5a4afb1bfb | ||
|
|
5830f0387e | ||
|
|
da5e4c947c | ||
|
|
4103ae3737 | ||
|
|
e045138660 | ||
|
|
0d25d42c03 | ||
|
|
a0c1968ede | ||
|
|
8c3d145276 | ||
|
|
4bcbd2a60a | ||
|
|
1d8320afe2 | ||
|
|
319da16127 | ||
|
|
d885f95f23 | ||
|
|
e4566bc7ce | ||
|
|
0f79acd852 | ||
|
|
98f2a41393 | ||
|
|
11b400ac0e | ||
|
|
377758aa1e | ||
|
|
399be1f9df | ||
|
|
205ad4e098 | ||
|
|
223dbc9599 | ||
|
|
aca50bb123 | ||
|
|
d539bc3da2 | ||
|
|
5fc38030e1 | ||
|
|
6246dbde8f | ||
|
|
d360fb41e8 | ||
|
|
87a031fc85 | ||
|
|
497fedc5c9 | ||
|
|
a3f619e6ab | ||
|
|
e256f5012e | ||
|
|
ed0f2124ff | ||
|
|
1b5ae59fa5 | ||
|
|
ffb70cfa47 | ||
|
|
675e94eaf7 | ||
|
|
82e91b6646 | ||
|
|
2d773639be | ||
|
|
8e9bfda737 | ||
|
|
1fb357c20f | ||
|
|
0efd012137 | ||
|
|
9714371ecb | ||
|
|
67e2f080b0 | ||
|
|
c76135cd6b | ||
|
|
7fd5ec66fb | ||
|
|
29d5c87957 | ||
|
|
e7de8841fd | ||
|
|
da8d553052 | ||
|
|
1f644a0438 | ||
|
|
02a133fba1 | ||
|
|
13249489b2 | ||
|
|
fff50f785f | ||
|
|
39f1becb62 | ||
|
|
b609e814b3 | ||
|
|
7dfe119353 | ||
|
|
bf61e090d3 | ||
|
|
f06c17ef32 | ||
|
|
f2395c2998 | ||
|
|
d4df07f7ce | ||
|
|
1c27fd45d4 | ||
|
|
940349f50a | ||
|
|
a5e547794e | ||
|
|
dd7a7a2044 | ||
|
|
d3f727cd8c | ||
|
|
11075509c6 | ||
|
|
ba9cfabc49 | ||
|
|
f6c7f3a8e3 | ||
|
|
d3b83eb329 | ||
|
|
e64c45ba83 | ||
|
|
b2e11e1e64 | ||
|
|
7e924d6e9b | ||
|
|
8197f6d5b8 | ||
|
|
d1732352f1 | ||
|
|
8a632a3d69 | ||
|
|
7ef8e672e2 | ||
|
|
49c5388b2f | ||
|
|
a33065033d | ||
|
|
fbd5a8621e | ||
|
|
2e3a312466 | ||
|
|
7dddb5843a | ||
|
|
c5493a3e4d | ||
|
|
a3c9b1963d | ||
|
|
77503713d3 | ||
|
|
a65cde175a | ||
|
|
a44f902312 | ||
|
|
2cb7706148 | ||
|
|
9aa7766037 | ||
|
|
608910d419 | ||
|
|
ab8a5f0098 | ||
|
|
7df5fe0994 | ||
|
|
d2a7b9320b | ||
|
|
736f608e3e | ||
|
|
1d931b7a23 | ||
|
|
7d0e7a725f | ||
|
|
6b93da5c82 | ||
|
|
066e2b7d7e | ||
|
|
753ffe4622 | ||
|
|
07f7532567 | ||
|
|
7c16c52239 | ||
|
|
99c5a7a3a6 | ||
|
|
b53103c9d4 | ||
|
|
60ba7d8ec0 | ||
|
|
74e510800a | ||
|
|
457092c89a | ||
|
|
cd4e9be142 | ||
|
|
9d5091b3e3 | ||
|
|
8e3f03cdb9 | ||
|
|
8a51834851 | ||
|
|
44a091a18f | ||
|
|
a12eb0f5c6 | ||
|
|
e67b1afb2e | ||
|
|
b1b797a866 | ||
|
|
7e316e1b8a | ||
|
|
0ad6a8205c | ||
|
|
49faa46c38 | ||
|
|
b27dbc9be7 | ||
|
|
653bb7440e | ||
|
|
d1424e57bd | ||
|
|
1a1ce4bf3b | ||
|
|
a6e8bca983 | ||
|
|
9b9d762de6 | ||
|
|
60b167b710 | ||
|
|
9415c7ab1b | ||
|
|
637110ada6 | ||
|
|
2a4b846696 | ||
|
|
b0f43dec71 | ||
|
|
fb450d3054 | ||
|
|
c536ef0770 | ||
|
|
1311331e0a | ||
|
|
0bb4569f33 | ||
|
|
73fb142345 | ||
|
|
b4537dbed3 | ||
|
|
c27f521f3d | ||
|
|
197ff08f00 | ||
|
|
42b50636d3 | ||
|
|
c0721980e1 | ||
|
|
9703f0088b | ||
|
|
c5b5ed735e | ||
|
|
1da9c2eb64 | ||
|
|
c490dfda00 | ||
|
|
47527697e7 | ||
|
|
321e57917f | ||
|
|
8f1f11def4 | ||
|
|
8592b84deb | ||
|
|
ff3350e51a | ||
|
|
2703a077d6 | ||
|
|
85d8b5b560 | ||
|
|
a3b9f460ca | ||
|
|
76b3938ddc | ||
|
|
a4545f966c | ||
|
|
89d1fa1767 | ||
|
|
3d2c1c2c07 | ||
|
|
a84087bc02 | ||
|
|
5dc4461d04 | ||
|
|
5ed9d68cda | ||
|
|
aff269bc12 | ||
|
|
5ef3d700b2 | ||
|
|
c8bacb2dc0 | ||
|
|
80030878f9 | ||
|
|
07b0148337 | ||
|
|
5afd992238 | ||
|
|
283d970655 | ||
|
|
62cb5b2cdd | ||
|
|
4b149addab | ||
|
|
ebbf84f9f3 | ||
|
|
e3670059f6 | ||
|
|
04725305d2 | ||
|
|
231bc8e25a | ||
|
|
364fed920f | ||
|
|
abf813d324 | ||
|
|
c418aa1717 | ||
|
|
a3deb57658 | ||
|
|
688565f922 | ||
|
|
d015911fb7 | ||
|
|
3631e7ed3a | ||
|
|
a664f57331 | ||
|
|
52ce445326 | ||
|
|
1840d22061 | ||
|
|
8072b3acc6 | ||
|
|
751358f5cf | ||
|
|
ca01df5bde | ||
|
|
621f29c918 | ||
|
|
42fe7163cb | ||
|
|
892359a77c | ||
|
|
2d575a3907 | ||
|
|
883b7008ba | ||
|
|
ef86a22304 | ||
|
|
e0c1fffee6 | ||
|
|
b7597813e9 | ||
|
|
977b0a2c52 | ||
|
|
46882167bc | ||
|
|
8aed8322e8 | ||
|
|
3aadda2292 | ||
|
|
df692885a9 | ||
|
|
1ad3831c4d | ||
|
|
e509ed1cc7 | ||
|
|
895c3f33fe | ||
|
|
0a8629dbf0 | ||
|
|
71294d38f6 | ||
|
|
2c4e48aa4b | ||
|
|
90cc00e333 | ||
|
|
a793a3f59d | ||
|
|
0f29e41d45 | ||
|
|
739c509ac6 | ||
|
|
891b109abf | ||
|
|
ad1d82bd26 | ||
|
|
8ab63d0805 | ||
|
|
17a435e953 | ||
|
|
a522ee160f | ||
|
|
7a53cb2a73 | ||
|
|
af618f6481 | ||
|
|
5a341e25a9 | ||
|
|
bc6c23c02f | ||
|
|
163d32b6e3 | ||
|
|
fee0446b48 | ||
|
|
63c77e8528 | ||
|
|
42c93b3684 | ||
|
|
fbd146465e | ||
|
|
9a3904265f | ||
|
|
15ea590914 | ||
|
|
da4a307a96 | ||
|
|
6b16784a25 | ||
|
|
67620440d3 | ||
|
|
af410c7065 | ||
|
|
e1878caf9f | ||
|
|
01e9d8adab | ||
|
|
8013918c11 | ||
|
|
b9f9872990 | ||
|
|
e0ad5b1218 | ||
|
|
e46f998c95 | ||
|
|
c00ea29161 | ||
|
|
271746cdbe | ||
|
|
279c4e20f3 | ||
|
|
e6057e22b5 | ||
|
|
4e330457e7 | ||
|
|
82577ce06d | ||
|
|
7e43200796 | ||
|
|
b1a7a11d28 | ||
|
|
b2701c7f4c | ||
|
|
c30fe1e7b7 | ||
|
|
2aaf2b329a | ||
|
|
472373796c | ||
|
|
62afc3674d | ||
|
|
2f6c71a38c | ||
|
|
67f6680ce5 | ||
|
|
0d5fe165b3 | ||
|
|
0621b973ed | ||
|
|
762ced0a3c | ||
|
|
d6e2ca3316 | ||
|
|
4f7ad682f5 | ||
|
|
cf1b735fdb | ||
|
|
a08cdec815 | ||
|
|
39cfb282e9 | ||
|
|
7ddb79a70a | ||
|
|
539c99ea2a | ||
|
|
20ff170efb | ||
|
|
2b7945a75e | ||
|
|
776397ccb0 | ||
|
|
f013593448 | ||
|
|
02bae836a2 | ||
|
|
0872f12815 | ||
|
|
d535fee6ed | ||
|
|
1ba6cdd6a5 | ||
|
|
b51d2b67ab | ||
|
|
06f72154ef | ||
|
|
8ac61bb6d9 | ||
|
|
215ef38d7f | ||
|
|
320f319faa | ||
|
|
8428bfa82d | ||
|
|
911cfa494d | ||
|
|
91dee4a860 | ||
|
|
d51775c857 | ||
|
|
09ffa6a3ab | ||
|
|
2c70bf5da2 | ||
|
|
f83f3903e0 | ||
|
|
c3bb892add | ||
|
|
752c499714 | ||
|
|
b684f22fd0 | ||
|
|
305b0d497a | ||
|
|
0ea51ba272 | ||
|
|
994d4ae525 | ||
|
|
3e274664b8 | ||
|
|
15a5971468 | ||
|
|
f85fa16c4b | ||
|
|
3645616065 | ||
|
|
f5f559df8b | ||
|
|
bb0bfa189f | ||
|
|
a65d0ad67b | ||
|
|
9e0cf884bb | ||
|
|
a5531ecd7b | ||
|
|
7f40ae1780 | ||
|
|
bdc040e986 | ||
|
|
4812be8b9f | ||
|
|
f143b2dc1c | ||
|
|
af3c3ca319 | ||
|
|
88e2223326 | ||
|
|
8a219d3d7b | ||
|
|
ce8f4a7b5b | ||
|
|
0bb7705981 | ||
|
|
872d601c42 | ||
|
|
e027b25abd | ||
|
|
0bd9783532 | ||
|
|
5f90615f63 | ||
|
|
cac96326a3 | ||
|
|
5f8b5a443b | ||
|
|
a9988c4e46 | ||
|
|
03d110f45d | ||
|
|
e5a0fe4880 | ||
|
|
fd26a6e16b | ||
|
|
d3ffadb7bf | ||
|
|
9b3c4e3af9 | ||
|
|
0aba0ed97c | ||
|
|
cffdfd3e87 | ||
|
|
90142297ff | ||
|
|
9ccd146f79 | ||
|
|
94db280d2b | ||
|
|
88d33f439a | ||
|
|
48b05810c3 | ||
|
|
d4c186b642 | ||
|
|
1bbcf89767 | ||
|
|
6f6c0fba7b | ||
|
|
be6f7e2a23 | ||
|
|
074250e210 | ||
|
|
97fa5ad3e9 | ||
|
|
41c563c50b | ||
|
|
1ebe649de8 | ||
|
|
2fb4f360a3 | ||
|
|
66e08da942 | ||
|
|
8c24b9a09f | ||
|
|
ca2e0ce183 | ||
|
|
0cdd39e79c | ||
|
|
3885b0da1b | ||
|
|
4a05f11eb6 | ||
|
|
1dcbfee713 | ||
|
|
eebdfddb57 | ||
|
|
1b878f6682 | ||
|
|
0f27e43f24 | ||
|
|
b30bccb4d3 | ||
|
|
80e6339242 | ||
|
|
045752dc73 | ||
|
|
4e955f25aa | ||
|
|
8cc3315138 | ||
|
|
5acb29fea4 | ||
|
|
30fa370ee1 | ||
|
|
c9c3dc699e | ||
|
|
652f7e3a6d | ||
|
|
1f5ec6cad7 | ||
|
|
a760f723e7 | ||
|
|
4fbf0847dc | ||
|
|
6841306953 | ||
|
|
671fc0bc08 | ||
|
|
75fa3dbef8 | ||
|
|
08d414b8b2 | ||
|
|
0fe50b3165 | ||
|
|
15f503c97f | ||
|
|
9885ee7119 | ||
|
|
1655c7f9a3 | ||
|
|
1630149d14 | ||
|
|
bfa77bc471 | ||
|
|
0ea38276d5 | ||
|
|
22721f0b0e | ||
|
|
0b6d0b510e | ||
|
|
96104a6526 | ||
|
|
59c56044b9 | ||
|
|
3841e83f85 | ||
|
|
7d6641778c | ||
|
|
ece4bb76e3 | ||
|
|
c3f267b248 | ||
|
|
60b40d94bd | ||
|
|
5abc35226b | ||
|
|
e868cc58b9 | ||
|
|
c633d5de3e | ||
|
|
c86a8bcf5d | ||
|
|
3a98b54363 | ||
|
|
0384cffd9f | ||
|
|
a303a8500d | ||
|
|
8c2127d420 | ||
|
|
54ffc58440 | ||
|
|
00cbfe90af | ||
|
|
bb143b980c | ||
|
|
fce87b493f | ||
|
|
d87f86ed71 | ||
|
|
d7c697138a | ||
|
|
580ab173dd | ||
|
|
6e844850bb | ||
|
|
3205c867bd | ||
|
|
2dda36aa66 | ||
|
|
f807f7636e | ||
|
|
ce75619557 | ||
|
|
dedd72dd66 | ||
|
|
bf3ff8f3ab | ||
|
|
20030ff194 | ||
|
|
338806b96c |
@@ -1,2 +1,3 @@
|
||||
* text=auto
|
||||
test/newlines/** -text
|
||||
test/codegen/python/indentation_sensitive_crlf.re -text
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
version: 2
|
||||
updates:
|
||||
|
||||
- package-ecosystem: "github-actions"
|
||||
commit-message:
|
||||
include: "scope"
|
||||
prefix: "Actions"
|
||||
directory: "/"
|
||||
labels:
|
||||
- "enhancement"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
@@ -33,15 +33,15 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v3
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.8'
|
||||
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
java-version: '11'
|
||||
@@ -71,8 +71,16 @@ jobs:
|
||||
cmake -S . -B .build \
|
||||
-G "Unix Makefiles" \
|
||||
-DRE2C_BUILD_LIBS=ON \
|
||||
-DRE2C_BUILD_RE2D=OFF \
|
||||
-DRE2C_BUILD_RE2GO=OFF \
|
||||
-DRE2C_BUILD_RE2HS=OFF \
|
||||
-DRE2C_BUILD_RE2JAVA=OFF \
|
||||
-DRE2C_BUILD_RE2JS=OFF \
|
||||
-DRE2C_BUILD_RE2OCAML=OFF \
|
||||
-DRE2C_BUILD_RE2PY=OFF \
|
||||
-DRE2C_BUILD_RE2RUST=OFF \
|
||||
-DRE2C_BUILD_RE2V=OFF \
|
||||
-DRE2C_BUILD_RE2ZIG=OFF \
|
||||
-DRE2C_BUILD_BENCHMARKS=ON \
|
||||
-DCMAKE_CXX_FLAGS="-O3"
|
||||
|
||||
|
||||
@@ -36,16 +36,13 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup apt cache (Linux)
|
||||
if: startsWith(runner.os, 'Linux')
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
/var/cache/apt
|
||||
!/var/cache/apt/archives/lock
|
||||
!/var/cache/apt/archives/partial
|
||||
path: /var/cache/apt
|
||||
key: ${{ runner.os }}-apt-cache-${{ matrix.os }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-apt-cache-${{ matrix.os }}-
|
||||
@@ -72,7 +69,7 @@ jobs:
|
||||
esac
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v3
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.x
|
||||
architecture: x64
|
||||
@@ -149,7 +146,7 @@ jobs:
|
||||
- name: Archive test artifacts
|
||||
# Run this step only if tests failed (otherwise there is nothing to upload).
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
# To ensure that jobs don't overwrite existing artifacts,
|
||||
# use a different name per job.
|
||||
|
||||
@@ -62,11 +62,11 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup chocolatey Cache (Windows)
|
||||
if: startsWith(runner.os, 'Windows')
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: C:\Users\runneradmin\AppData\Local\Temp\chocolatey
|
||||
key: ${{ runner.os }}-chocolatey-${{ matrix.os }}-${{ github.sha }}
|
||||
@@ -76,12 +76,9 @@ jobs:
|
||||
|
||||
- name: Setup apt cache (Linux)
|
||||
if: startsWith(runner.os, 'Linux')
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
/var/cache/apt
|
||||
!/var/cache/apt/archives/lock
|
||||
!/var/cache/apt/archives/partial
|
||||
path: /var/cache/apt
|
||||
key: ${{ runner.os }}-apt-cache-${{ matrix.os }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-apt-cache-${{ matrix.os }}-
|
||||
@@ -108,7 +105,7 @@ jobs:
|
||||
esac
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v3
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.x
|
||||
architecture: x64
|
||||
@@ -138,9 +135,9 @@ jobs:
|
||||
id: build-info
|
||||
run: |
|
||||
if echo "${{ matrix.name }}" | grep -q "ootree"; then
|
||||
BUILD_DIR="$(pwd)/.build/${{ matrix.name }}-full"
|
||||
BUILD_DIR="${{ github.workspace }}/.build/${{ matrix.name }}-full"
|
||||
else
|
||||
BUILD_DIR="$(pwd)"
|
||||
BUILD_DIR="${{ github.workspace }}"
|
||||
fi
|
||||
echo "BUILD_DIR=$BUILD_DIR" >> $GITHUB_OUTPUT
|
||||
|
||||
@@ -168,13 +165,17 @@ jobs:
|
||||
- name: Archive test artifacts
|
||||
# Run this step only if tests failed (otherwise there is nothing to upload).
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
# To ensure that jobs don't overwrite existing artifacts,
|
||||
# use a different name per job.
|
||||
name: test-${{ matrix.name }}
|
||||
# Tests run in a temporary directory that has a name test_<timestamp>.
|
||||
path: ${{ steps.build-info.outputs.BUILD_DIR }}/test_[0-9]*
|
||||
# Provide both relative and absolute paths. Absolute path should work for all builds,
|
||||
# but it doesn't work on Windows. Relative path works for in-tree Windows builds.
|
||||
path: |
|
||||
test_[0-9]*
|
||||
${{ steps.build-info.outputs.BUILD_DIR }}/test_[0-9]*
|
||||
# Artifacts are retained for 90 days by default.
|
||||
# In fact, we don't need such long period.
|
||||
retention-days: 30
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
/m4
|
||||
/test_*
|
||||
/.build*
|
||||
/bazel-*
|
||||
|
||||
# Ignore user defined CMake presets
|
||||
CMakeUserPresets.json
|
||||
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package(default_visibility = ["//visibility:private"])
|
||||
|
||||
genrule(
|
||||
name = "re2c_config",
|
||||
srcs = [
|
||||
"CMakeLists.txt",
|
||||
"//bazel:re2c_config.h",
|
||||
],
|
||||
outs = ["config.h"],
|
||||
cmd = """
|
||||
cat $(location //:CMakeLists.txt) |\\
|
||||
sed -rne 's/project\\(re2c VERSION ([^ ]+).*/#define PACKAGE_VERSION "\\1-bootstrap"/p' >> "$@"
|
||||
cat $(location //bazel:re2c_config.h) >> "$@"
|
||||
""",
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "re2c_config_cc",
|
||||
hdrs = ["config.h"],
|
||||
defines = ["""RE2C_STDLIB_DIR='"$(BINDIR)/re2c.runfiles/re2c/include"'"""],
|
||||
data = ["include/unicode_categories.re"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "re2c_bootstrap_cc",
|
||||
includes = ["bootstrap"],
|
||||
hdrs = glob([
|
||||
"bootstrap/src/**/*.h",
|
||||
"src/**/*.h",
|
||||
]),
|
||||
srcs = glob([
|
||||
"bootstrap/src/**/*.cc",
|
||||
"src/**/*.cc",
|
||||
]),
|
||||
deps = [
|
||||
"re2c_config_cc", # Needed for 're2c_config_cc' data files
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "re2c",
|
||||
srcs = ["src/main.cc"],
|
||||
deps = [":re2c_bootstrap_cc"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
@@ -5,9 +5,9 @@ How to build
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
To build re2c from a release tarball one needs only a C++ compiler and Python 3
|
||||
(for build-time scripts and for testing). Building on Windows additionally
|
||||
requires either CMake or a Mingw build environment.
|
||||
To build re2c from a release tarball one needs only a C++ compiler (supporting
|
||||
at least C++11) and Python 3 for build-time scripts and for testing. Building on
|
||||
Windows additionally requires either CMake or a Mingw build environment.
|
||||
|
||||
To develop re2c one also needs CMake or Autotools (both build systems are
|
||||
maintained). Other dependencies include Bison (to rebuild parsers), Python 3
|
||||
@@ -45,16 +45,48 @@ The configure script has many options (to see them all, run
|
||||
* `--enable-debug`
|
||||
Enable debug checks in the re2c source code. Also enables debug options.
|
||||
|
||||
* `--enable-dlang`
|
||||
Build re2d (identical to `re2c --lang d`). This is on by default.
|
||||
|
||||
* `--enable-golang`
|
||||
Build re2go (identical to `re2c --lang go`). This is on by default.
|
||||
|
||||
* `--enable-haskell`
|
||||
Build re2hs (identical to `re2c --lang haskell`). This is on by default.
|
||||
|
||||
* `--enable-java`
|
||||
Build re2java (identical to `re2c --lang java`). This is on by default.
|
||||
|
||||
* `--enable-js`
|
||||
Build re2js (identical to `re2c --lang js`). This is on by default.
|
||||
|
||||
* `--enable-ocaml`
|
||||
Build re2ocaml (identical to `re2c --lang ocaml`). This is on by default.
|
||||
|
||||
* `--enable-python`
|
||||
Build re2py (identical to `re2c --lang python`). This is on by default.
|
||||
|
||||
* `--enable-rust`
|
||||
Build re2rust (identical to `re2c --lang rust`). This is on by default.
|
||||
|
||||
* `--enable-vlang`
|
||||
Build re2v (identical to `re2c --lang v`). This is on by default.
|
||||
|
||||
* `--enable-zig`
|
||||
Build re2zig (identical to `re2c --lang zig`). This is on by default.
|
||||
|
||||
* `--enable-lexers`
|
||||
Enable regeneration of *.re* files (as opposed to using bootstrap files).
|
||||
This requires setting `RE2C_FOR_BUILD` to an existing re2c executable
|
||||
path.
|
||||
Enable regeneration of lexers from *.re* files (as opposed to using
|
||||
pre-generated bootstrap files). This requires setting `RE2C_FOR_BUILD` to
|
||||
an existing re2c executable path.
|
||||
|
||||
* `--enable-parsers`
|
||||
Enable regeneration of parsers from *.ypp* files with bison (as opposed to
|
||||
using pre-generated bootstrap files).
|
||||
|
||||
* `--enable-syntax`
|
||||
Enable regeneration of default syntax files from the ones provided in
|
||||
include/ directory (as opposed to using pre-generated bootstrap files).
|
||||
|
||||
* `--enable-docs`
|
||||
Enable regeneration of documentation (requires Python 3 Docutils).
|
||||
@@ -144,21 +176,53 @@ A simple build (objects are generated in a separate build directory):
|
||||
CMake supports a lot of configuration options. Here is the list of options
|
||||
specific to re2c:
|
||||
|
||||
* `-DRE2C_BUILD_RE2D=yes`
|
||||
Build re2d executable (an alias to `re2c --lang d`). Enabled by default.
|
||||
|
||||
* `-DRE2C_BUILD_RE2GO=yes`
|
||||
Build re2go executable (an alias to `re2c --lang go`). Enabled by default.
|
||||
|
||||
* `-DRE2C_BUILD_RE2HS=yes`
|
||||
Build re2hs executable (an alias to `re2c --lang haskell`). Enabled by
|
||||
default.
|
||||
|
||||
* `-DRE2C_BUILD_RE2JAVA=yes`
|
||||
Build re2java executable (an alias to `re2c --lang java`). Enabled by
|
||||
default.
|
||||
|
||||
* `-DRE2C_BUILD_RE2JS=yes`
|
||||
Build re2js executable (an alias to `re2c --lang js`). Enabled by default.
|
||||
|
||||
* `-DRE2C_BUILD_RE2OCAML=yes`
|
||||
Build re2ocaml executable (an alias to `re2c --lang ocaml`). Enabled by
|
||||
default.
|
||||
|
||||
* `-DRE2C_BUILD_RE2PY=yes`
|
||||
Build re2py executable (an alias to `re2c --lang python`). Enabled by
|
||||
default.
|
||||
|
||||
* `-DRE2C_BUILD_RE2RUST=yes`
|
||||
Build re2rust executable (an alias to `re2c --lang rust`). Enabled by
|
||||
default.
|
||||
|
||||
* `-DRE2C_BUILD_RE2V=yes`
|
||||
Build re2v executable (an alias to `re2c --lang v`). Enabled by default.
|
||||
|
||||
* `-DRE2C_BUILD_RE2ZIG=yes`
|
||||
Build re2zig executable (an alias to `re2c --lang zig`). Enabled by default.
|
||||
|
||||
* `-DRE2C_REBUILD_LEXERS=yes`
|
||||
Enable regeneration of *.re* files (as opposed to using bootstrap files).
|
||||
This requires setting `-DRE2C_FOR_BUILD` to an existing re2c executable
|
||||
path.
|
||||
Enable regeneration of lexers from *.re* files (as opposed to using
|
||||
pre-generated bootstrap files). This requires setting `-DRE2C_FOR_BUILD` to
|
||||
an existing re2c executable path.
|
||||
|
||||
* `-DRE2C_REBUILD_PARSERS=yes`
|
||||
Enable regeneration of `parser.cc` and `parser.h` files (as opposed to
|
||||
using bootstrap files). This requires an available Bison parser generator.
|
||||
Enable regeneration of parsers from *.ypp* files with bison (as opposed to
|
||||
using pre-generated bootstrap files).
|
||||
|
||||
* `-DRE2C_REBUILD_SYNTAX=yes`
|
||||
Enable regeneration of default syntax files from the ones provided in
|
||||
include/ directory (as opposed to using pre-generated bootstrap files).
|
||||
|
||||
* `-DRE2C_REBUILD_DOCS=yes`
|
||||
Enable regeneration of documentation (requires Python 3 Docutils).
|
||||
|
||||
@@ -2,10 +2,337 @@ Changelog
|
||||
=========
|
||||
|
||||
|
||||
----
|
||||
4.0x
|
||||
----
|
||||
|
||||
4.0 (2024-11-19)
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
- Added a generic technique for describing language backends based on the idea
|
||||
of syntax files (`#450 <https://github.com/skvadrik/re2c/issues/450>`_).
|
||||
|
||||
- Added support for new languages: D, Haskell, Java, JavaScript, OCaml, Python,
|
||||
V, Zig.
|
||||
|
||||
- Added new record API for all languages (enabled with ``--api record``,
|
||||
``re2c:api = record``) and made it the default API for Haskell and OCaml.
|
||||
|
||||
- Renamed former "default API" to "simple API", implemented it for all backends
|
||||
except Haskell and OCaml, and enabled by default API for C, D, Java,
|
||||
JavaScript, Python, V and Zig.
|
||||
|
||||
- Added new code generation model - recursive functions (enabled with
|
||||
``--recursive-functions``), primarily to be used for functional languages.
|
||||
|
||||
- Added options:
|
||||
|
||||
+ ``--syntax <file>``
|
||||
+ ``--api simple``
|
||||
+ ``--api generic``
|
||||
+ ``--api record``
|
||||
+ ``--goto-label``
|
||||
+ ``--recursive-functions``
|
||||
+ ``--lang none``
|
||||
+ ``--lang d``
|
||||
+ ``--lang haskell``
|
||||
+ ``--lang java``
|
||||
+ ``--lang js``
|
||||
+ ``--lang ocaml``
|
||||
+ ``--lang python``
|
||||
+ ``--lang v``
|
||||
+ ``--lang zig``
|
||||
+ ``--leftmost-captvars``
|
||||
+ ``--posix-captvars``
|
||||
+ ``--captvars`` (alias for ``--leftmost-captvars``)
|
||||
+ ``--captures`` (alias for ``--leftmost-captures``)
|
||||
|
||||
- Added configurations:
|
||||
|
||||
+ ``re2c:api = simple`` (alias for ``re2c:api = default``)
|
||||
+ ``re2c:api = generic`` (alias for ``re2c:api = custom``)
|
||||
+ ``re2c:api = record``
|
||||
+ ``re2c:computed-gotos`` (alias for ``re2c:cgoto``)
|
||||
+ ``re2c:cond:abort``
|
||||
+ ``re2c:tags:negative``
|
||||
+ ``re2c:leftmost-captvars``
|
||||
+ ``re2c:posix-captvars``
|
||||
+ ``re2c:captvars`` (alias for ``re2c:leftmost-captvars``)
|
||||
+ ``re2c:captures`` (alias for ``re2c:leftmost-captures``)
|
||||
+ ``re2c:monadic``
|
||||
+ ``re2c:fn:sep``
|
||||
+ ``re2c:[define:]YYFN``
|
||||
+ ``re2c:[define:]YYINPUT``
|
||||
+ ``re2c:[define:]YYGETACCEPT``
|
||||
+ ``re2c:[define:]YYSETACCEPT``
|
||||
+ ``re2c:[define:]YYCOPYSTAG``
|
||||
+ ``re2c:[define:]YYCOPYMTAG``
|
||||
+ ``re2c:[define:]YYGETCOND`` (alias for ``re2c:[define:]YYGETCONDITION``)
|
||||
+ ``re2c:[define:]YYSETCOND`` (alias for ``re2c:[define:]YYSETCONDITION``)
|
||||
+ ``re2c:[variable:]yyfill``
|
||||
+ ``re2c:[variable:]yynmatch``
|
||||
+ ``re2c:[variable:]yypmatch``
|
||||
+ ``re2c:[variable:]yych:literals``
|
||||
|
||||
- All configurations that have ``define:`` or ``variable:`` part in their name
|
||||
now have an alias without this part.
|
||||
|
||||
- Added new block types:
|
||||
|
||||
+ ``/*!svars:re2c ... */``
|
||||
+ ``/*!mvars:re2c ... */``
|
||||
|
||||
- Flex-style opening/closing braces ``%{`` and ``%}`` for block start/end
|
||||
markers now work for all block types.
|
||||
|
||||
- Added syntax file feature lists:
|
||||
|
||||
+ ``supported_apis`` with values from the list:
|
||||
``simple``, ``generic``, ``record``
|
||||
|
||||
+ ``supported_api_styles`` with values from the list:
|
||||
``free-form``, ``functions``
|
||||
|
||||
+ ``supported_code_models`` with values from the list:
|
||||
``goto-label``, ``loop-switch``, ``recursive-functions``
|
||||
|
||||
+ ``supported_targets`` with values from the list:
|
||||
``code``, ``dot``, ``skeleton``
|
||||
|
||||
+ ``supported_features`` with values from the list:
|
||||
``nested-ifs``, ``bitmaps``, ``computed-gotos``, ``case-ranges``,
|
||||
``tags``, ``captures``, ``captvars``, ``monadic``, ``unsafe``
|
||||
|
||||
- Added syntax file language-specific options:
|
||||
|
||||
+ ``semicolons``
|
||||
+ ``backtick_quoted_strings``
|
||||
+ ``single_quoted_strings``
|
||||
+ ``indentation_sensitive``
|
||||
+ ``wrap_blocks_in_braces``
|
||||
|
||||
- Added syntax file code templates:
|
||||
|
||||
+ ``code:var_local``
|
||||
+ ``code:var_global``
|
||||
+ ``code:const_local``
|
||||
+ ``code:const_global``
|
||||
+ ``code:array_local``
|
||||
+ ``code:array_global``
|
||||
+ ``code:array_elem``
|
||||
+ ``code:enum``
|
||||
+ ``code:enum_elem``
|
||||
+ ``code:assign``
|
||||
+ ``code:type_int``
|
||||
+ ``code:type_uint``
|
||||
+ ``code:type_cond_enum``
|
||||
+ ``code:type_yybm``
|
||||
+ ``code:type_yytarget``
|
||||
+ ``code:cmp_eq``
|
||||
+ ``code:cmp_ne``
|
||||
+ ``code:cmp_lt``
|
||||
+ ``code:cmp_gt``
|
||||
+ ``code:cmp_le``
|
||||
+ ``code:cmp_ge``
|
||||
+ ``code:if_then_else``
|
||||
+ ``code:if_then_else_oneline``
|
||||
+ ``code:switch``
|
||||
+ ``code:switch_cases``
|
||||
+ ``code:switch_cases_oneline``
|
||||
+ ``code:switch_case_range``
|
||||
+ ``code:switch_case_default``
|
||||
+ ``code:loop``
|
||||
+ ``code:continue``
|
||||
+ ``code:goto``
|
||||
+ ``code:fndecl``
|
||||
+ ``code:fndef``
|
||||
+ ``code:fncall``
|
||||
+ ``code:tailcall``
|
||||
+ ``code:recursive_functions``
|
||||
+ ``code:fingerprint``
|
||||
+ ``code:line_info``
|
||||
+ ``code:abort``
|
||||
+ ``code:yydebug``
|
||||
+ ``code:yypeek``
|
||||
+ ``code:yyskip``
|
||||
+ ``code:yybackup``
|
||||
+ ``code:yybackupctx``
|
||||
+ ``code:yyskip_yypeek``
|
||||
+ ``code:yypeek_yyskip``
|
||||
+ ``code:yyskip_yybackup``
|
||||
+ ``code:yybackup_yyskip``
|
||||
+ ``code:yybackup_yypeek``
|
||||
+ ``code:yyskip_yybackup_yypeek``
|
||||
+ ``code:yybackup_yypeek_yyskip``
|
||||
+ ``code:yyrestore``
|
||||
+ ``code:yyrestorectx``
|
||||
+ ``code:yyrestoretag``
|
||||
+ ``code:yyshift``
|
||||
+ ``code:yyshiftstag``
|
||||
+ ``code:yyshiftmtag``
|
||||
+ ``code:yystagp``
|
||||
+ ``code:yymtagp``
|
||||
+ ``code:yystagn``
|
||||
+ ``code:yymtagn``
|
||||
+ ``code:yycopystag``
|
||||
+ ``code:yycopymtag``
|
||||
+ ``code:yygetaccept``
|
||||
+ ``code:yysetaccept``
|
||||
+ ``code:yygetcond``
|
||||
+ ``code:yysetcond``
|
||||
+ ``code:yygetstate``
|
||||
+ ``code:yysetstate``
|
||||
+ ``code:yylessthan``
|
||||
+ ``code:yybm_filter``
|
||||
+ ``code:yybm_match``
|
||||
|
||||
- Added global variables in syntax files:
|
||||
|
||||
+ ``nl``
|
||||
+ ``indent``
|
||||
+ ``dedent``
|
||||
+ ``topindent``
|
||||
|
||||
- Added global conditionals in syntax files:
|
||||
|
||||
+ ``.api.simple``
|
||||
+ ``.api.generic``
|
||||
+ ``.api.record``
|
||||
+ ``.api_style.functions``
|
||||
+ ``.api_style.freeform``
|
||||
+ ``.case_ranges``
|
||||
+ ``.code_model.goto_label``
|
||||
+ ``.code_model.loop_switch``
|
||||
+ ``.code_model.recursive_functions``
|
||||
+ ``.date``
|
||||
+ ``.loop_label``
|
||||
+ ``.monadic``
|
||||
+ ``.start_conditions``
|
||||
+ ``.storable_state``
|
||||
+ ``.unsafe``
|
||||
+ ``.version``
|
||||
|
||||
- Added warning ``-Wundefined-syntax-config``.
|
||||
|
||||
- Warnings that indicate serious issues are now turned on by default
|
||||
(and can be disabled with ``-Wno-<warning>`` options.
|
||||
|
||||
- Added configure options:
|
||||
|
||||
+ ``--enable-syntax`` (Autoconf)
|
||||
+ ``RE2C_REBUILD_SYNTAX`` (CMake)
|
||||
|
||||
- Dropped support for function-like API style for Rust.
|
||||
(it was hard to use, if at all possible)
|
||||
|
||||
- Added online playground that allows one to run re2c in a web browser:
|
||||
https://re2c.org/playground.
|
||||
|
||||
- Infra work on Github Actions CI.
|
||||
|
||||
|
||||
----
|
||||
3.0x
|
||||
----
|
||||
|
||||
3.1 (2023-07-19)
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
- Added capturing groups with leftmost greedy semantics:
|
||||
|
||||
+ Enabled with ``--leftmost-captures`` option or ``re2c:leftmost_captures``
|
||||
configuration
|
||||
(`55de79d8 <https://github.com/skvadrik/re2c/commit/55de79d8>`_,
|
||||
`3a98b543 <https://github.com/skvadrik/re2c/commit/3a98b543>`_).
|
||||
|
||||
- Added non-capturing groups:
|
||||
|
||||
+ Added new syntax ``(! ...)`` for non-capturing groups
|
||||
(`1edd25d3 <https://github.com/skvadrik/re2c/commit/1edd25d3>`_,
|
||||
`b813c9b4 <https://github.com/skvadrik/re2c/commit/b813c9b4>`_,
|
||||
`338806b9 <https://github.com/skvadrik/re2c/commit/338806b9>`_).
|
||||
|
||||
+ Added the ability to flip defaults: make ``(...)`` capturing and ``(! ...)``
|
||||
non-capturing with ``--invert-captures`` option or ``re2c:invert_captures``
|
||||
configuration
|
||||
(`20030ff1 <https://github.com/skvadrik/re2c/commit/20030ff1>`_,
|
||||
`ce756195 <https://github.com/skvadrik/re2c/commit/ce756195>`_).
|
||||
|
||||
- Regenerated Unicode include header to support a newer standard
|
||||
(`e3ec2597 <https://github.com/skvadrik/re2c/commit/e3ec2597>`_).
|
||||
|
||||
- Published TDFA paper: https://arxiv.org/abs/2206.01398, co-authored with
|
||||
Angelo Borsotti
|
||||
(`fa94d9c7 <https://github.com/skvadrik/re2c/commit/fa94d9c7>`_).
|
||||
|
||||
- Removed experimental algorithms that are superseded by TDFA(1) and
|
||||
generally less efficient:
|
||||
|
||||
+ Removed staDFA algorithm and deprecated ``--stadfa`` option
|
||||
(`ac5c06cc <https://github.com/skvadrik/re2c/commit/ac5c06cc>`_).
|
||||
|
||||
+ Removed TDFA(0) algorithm and deprecated ``--no-lookahead`` option
|
||||
(`dc8f264a <https://github.com/skvadrik/re2c/commit/dc8f264a>`_).
|
||||
|
||||
+ (libre2c) Removed backward-matching algorithm
|
||||
(`27256be1 <https://github.com/skvadrik/re2c/commit/27256be1>`_).
|
||||
|
||||
+ (libre2c) Removed Kuklewicz POSIX disambiguation algorithm
|
||||
(`aa97b014 <https://github.com/skvadrik/re2c/commit/aa97b014>`_).
|
||||
|
||||
+ (libre2c) Removed GTOP shortest path finding algorithm
|
||||
(`511a030c <https://github.com/skvadrik/re2c/commit/511a030c>`_).
|
||||
|
||||
- Bug fixes:
|
||||
|
||||
+ Fixed parsing of raw UTF-8 characters in Flex compatibility mode
|
||||
(`d87f86ed <https://github.com/skvadrik/re2c/commit/d87f86ed>`_).
|
||||
|
||||
+ Added header file to the dependencies generated with ``--depfile`` option
|
||||
(`f807f763 <https://github.com/skvadrik/re2c/commit/f807f763>`_
|
||||
and `2dda36aa <https://github.com/skvadrik/re2c/commit/2dda36aa>`_).
|
||||
|
||||
+ Fixed stack overflow on large regular expressions by rewriting recursive
|
||||
functions in iterative form
|
||||
(`46a9b4c4 <https://github.com/skvadrik/re2c/commit/46a9b4c4>`_,
|
||||
`aaf68292 <https://github.com/skvadrik/re2c/commit/aaf68292>`_,
|
||||
`02e5d797 <https://github.com/skvadrik/re2c/commit/02e5d797>`_,
|
||||
`5fffb187 <https://github.com/skvadrik/re2c/commit/5fffb187>`_)
|
||||
and limited stack to 256K on GithubActions CI
|
||||
(`111ee5da <https://github.com/skvadrik/re2c/commit/111ee5da>`_).
|
||||
|
||||
- Build system:
|
||||
|
||||
+ Added minimal http://bazel.build integration
|
||||
(`3205c867 <https://github.com/skvadrik/re2c/commit/3205c867>`_).
|
||||
|
||||
+ Added configure option ``--enable-parsers`` that regenerates bison parsers
|
||||
(`9e0dbd3c <https://github.com/skvadrik/re2c/commit/9e0dbd3c>`_).
|
||||
|
||||
+ Added CMake option ``RE2C_REBUILD_PARSERS``
|
||||
(`6e91c22d <https://github.com/skvadrik/re2c/commit/6e91c22d>`_).
|
||||
|
||||
+ With CMake, fixed documentation generation on Windows.
|
||||
|
||||
- Codebase improvements:
|
||||
|
||||
+ Moved the entire codebase to C++11.
|
||||
+ Added uniform error handling (return codes are now properly checked and
|
||||
returned to the caller).
|
||||
+ Reorganized codegen subsystem in four well-defined phases (analyze,
|
||||
generate, fixup, render) and separated codegen from parsing phase.
|
||||
+ Improved memory allocation by using slab allocators instead of global free
|
||||
lists.
|
||||
+ Moved to pure API for bison parsers.
|
||||
+ Unified code style.
|
||||
|
||||
- Testing:
|
||||
|
||||
+ Added ``--verbose`` flag to run_tests.py and suppressed verbose output by
|
||||
default.
|
||||
+ Multiple improvements of continuous testing with GithubActions.
|
||||
|
||||
|
||||
3.0 (2022-01-27)
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
+285
-167
@@ -1,17 +1,25 @@
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
project(re2c VERSION 3.0 HOMEPAGE_URL "https://re2c.org/")
|
||||
project(re2c VERSION 4.0 HOMEPAGE_URL "https://re2c.org/")
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
|
||||
include(Re2cAutotoolsHelpers)
|
||||
include(Re2cBootstrapLexer)
|
||||
include(Re2cBootstrapParser)
|
||||
include(Re2cBootstrapSyntax)
|
||||
include(Re2cBuildType)
|
||||
include(Re2cGenDocs)
|
||||
include(Re2cCompilerFlags)
|
||||
|
||||
ac_subst(PACKAGE_VERSION "${PROJECT_VERSION}")
|
||||
|
||||
# check whether re2c is the root project
|
||||
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
|
||||
set(RE2C_IS_ROOT_PROJECT TRUE)
|
||||
else()
|
||||
set(RE2C_IS_ROOT_PROJECT FALSE)
|
||||
endif()
|
||||
|
||||
option(RE2C_REBUILD_LEXERS "Regenerate lexers" OFF)
|
||||
if(RE2C_REBUILD_LEXERS AND NOT RE2C_FOR_BUILD)
|
||||
message(FATAL_ERROR "option RE2C_FOR_BUILD is required for RE2C_REBUILD_LEXERS")
|
||||
@@ -22,22 +30,32 @@ if(RE2C_REBUILD_PARSERS AND NOT RE2C_FOR_BUILD)
|
||||
find_package(BISON REQUIRED)
|
||||
endif()
|
||||
|
||||
option(RE2C_REBUILD_SYNTAX "Regenerate default syntax files" OFF)
|
||||
option(RE2C_REBUILD_DOCS "Regenerate manpage" OFF)
|
||||
option(RE2C_BUILD_LIBS "Build libraries" OFF)
|
||||
|
||||
|
||||
option(RE2C_BUILD_RE2D "Build re2d executable (an alias for `re2c --lang d`)" ON)
|
||||
option(RE2C_BUILD_RE2GO "Build re2go executable (an alias for `re2c --lang go`)" ON)
|
||||
option(RE2C_BUILD_RE2HS "Build re2hs executable (an alias for `re2c --lang haskell`)" ON)
|
||||
option(RE2C_BUILD_RE2JAVA "Build re2java executable (an alias for `re2c --lang java`)" ON)
|
||||
option(RE2C_BUILD_RE2JS "Build re2js executable (an alias for `re2c --lang js`)" ON)
|
||||
option(RE2C_BUILD_RE2OCAML "Build re2ocaml executable (an alias for `re2c --lang ocaml`)" ON)
|
||||
option(RE2C_BUILD_RE2PY "Build re2py executable (an alias for `re2c --lang python`)" ON)
|
||||
option(RE2C_BUILD_RE2RUST "Build re2rust executable (an alias for `re2c --lang rust`)" ON)
|
||||
option(RE2C_BUILD_RE2V "Build re2v executable (an alias for `re2c --lang v`)" ON)
|
||||
option(RE2C_BUILD_RE2ZIG "Build re2zig executable (an alias for `re2c --lang zig`)" ON)
|
||||
|
||||
option(RE2C_BUILD_BENCHMARKS "Build benchmarks" OFF)
|
||||
option(RE2C_REGEN_BENCHMARKS "Regenerate C code for benchmarks" OFF)
|
||||
|
||||
# test targets are enabled by default only if re2c is the root project
|
||||
option(RE2C_BUILD_TESTS "Build tests" "${RE2C_IS_ROOT_PROJECT}")
|
||||
|
||||
# checks for programs
|
||||
find_package(Python3 COMPONENTS Interpreter)
|
||||
# starting from cmake 3.19 find_package can do version check, but we are on 3.12
|
||||
if(Python3_VERSION VERSION_LESS 3.7)
|
||||
message(FATAL_ERROR "python version 3.7 or higher is required")
|
||||
if(RE2C_REBUILD_DOCS OR RE2C_BUILD_TESTS OR RE2C_BUILD_BENCHMARKS)
|
||||
find_package(Python3 3.7 REQUIRED COMPONENTS Interpreter)
|
||||
endif()
|
||||
|
||||
if(RE2C_REBUILD_DOCS)
|
||||
execute_process(
|
||||
COMMAND "${Python3_EXECUTABLE}" -c "import docutils"
|
||||
@@ -49,9 +67,11 @@ if(RE2C_REBUILD_DOCS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# checks for C++ compiler flags
|
||||
# Use C++11 standard. Note that without `set(CMAKE_CXX_EXTENSIONS OFF)` this enables
|
||||
# -std=gnu++11, not -std=c++11. Extensions are needed to enable POSIX functions on
|
||||
# Cygwin and NetBSD.
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON) # fail if the C++ compiler does not support this standard
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON) # make sure object libraries work with shared libraries
|
||||
|
||||
# needed for POSIX file API
|
||||
@@ -63,26 +83,50 @@ ac_check_headers("unistd.h")
|
||||
ac_check_headers("io.h")
|
||||
|
||||
# docs (manpages and help)
|
||||
set(re2c_manpage_source "${CMAKE_CURRENT_BINARY_DIR}/doc/manpage.rst")
|
||||
set(re2c_help_source "${CMAKE_CURRENT_BINARY_DIR}/doc/help.rst")
|
||||
set(re2c_manpage_bootstrap_c "${CMAKE_CURRENT_SOURCE_DIR}/bootstrap/doc/re2c.1")
|
||||
set(re2c_manpage_bootstrap_go "${CMAKE_CURRENT_SOURCE_DIR}/bootstrap/doc/re2go.1")
|
||||
set(re2c_manpage_bootstrap_rust "${CMAKE_CURRENT_SOURCE_DIR}/bootstrap/doc/re2rust.1")
|
||||
set(re2c_help_bootstrap "${CMAKE_CURRENT_SOURCE_DIR}/bootstrap/src/msg/help.cc")
|
||||
set(re2c_manpage_c "${CMAKE_CURRENT_BINARY_DIR}/doc/re2c.1")
|
||||
set(re2c_manpage_go "${CMAKE_CURRENT_BINARY_DIR}/doc/re2go.1")
|
||||
set(re2c_manpage_rust "${CMAKE_CURRENT_BINARY_DIR}/doc/re2rust.1")
|
||||
set(re2c_help "${CMAKE_CURRENT_BINARY_DIR}/src/msg/help.cc")
|
||||
set(re2c_rst2man "${CMAKE_CURRENT_SOURCE_DIR}/build/rst2man.py")
|
||||
set(re2c_rst2txt "${CMAKE_CURRENT_SOURCE_DIR}/build/rst2txt.py")
|
||||
set(re2c_splitman "${CMAKE_CURRENT_SOURCE_DIR}/build/split_man.py")
|
||||
set(re2c_manpage_source "${CMAKE_CURRENT_BINARY_DIR}/doc/manpage.rst")
|
||||
set(re2c_help_source "${CMAKE_CURRENT_BINARY_DIR}/doc/help.rst")
|
||||
set(re2c_manpage_c "${CMAKE_CURRENT_BINARY_DIR}/doc/re2c.1")
|
||||
set(re2c_manpage_d "${CMAKE_CURRENT_BINARY_DIR}/doc/re2d.1")
|
||||
set(re2c_manpage_go "${CMAKE_CURRENT_BINARY_DIR}/doc/re2go.1")
|
||||
set(re2c_manpage_haskell "${CMAKE_CURRENT_BINARY_DIR}/doc/re2hs.1")
|
||||
set(re2c_manpage_java "${CMAKE_CURRENT_BINARY_DIR}/doc/re2java.1")
|
||||
set(re2c_manpage_js "${CMAKE_CURRENT_BINARY_DIR}/doc/re2js.1")
|
||||
set(re2c_manpage_ocaml "${CMAKE_CURRENT_BINARY_DIR}/doc/re2ocaml.1")
|
||||
set(re2c_manpage_python "${CMAKE_CURRENT_BINARY_DIR}/doc/re2py.1")
|
||||
set(re2c_manpage_rust "${CMAKE_CURRENT_BINARY_DIR}/doc/re2rust.1")
|
||||
set(re2c_manpage_v "${CMAKE_CURRENT_BINARY_DIR}/doc/re2v.1")
|
||||
set(re2c_manpage_zig "${CMAKE_CURRENT_BINARY_DIR}/doc/re2zig.1")
|
||||
set(re2c_help_c "${CMAKE_CURRENT_BINARY_DIR}/src/msg/help_re2c.cc")
|
||||
set(re2c_help_d "${CMAKE_CURRENT_BINARY_DIR}/src/msg/help_re2d.cc")
|
||||
set(re2c_help_go "${CMAKE_CURRENT_BINARY_DIR}/src/msg/help_re2go.cc")
|
||||
set(re2c_help_haskell "${CMAKE_CURRENT_BINARY_DIR}/src/msg/help_re2hs.cc")
|
||||
set(re2c_help_java "${CMAKE_CURRENT_BINARY_DIR}/src/msg/help_re2java.cc")
|
||||
set(re2c_help_js "${CMAKE_CURRENT_BINARY_DIR}/src/msg/help_re2js.cc")
|
||||
set(re2c_help_ocaml "${CMAKE_CURRENT_BINARY_DIR}/src/msg/help_re2ocaml.cc")
|
||||
set(re2c_help_python "${CMAKE_CURRENT_BINARY_DIR}/src/msg/help_re2py.cc")
|
||||
set(re2c_help_rust "${CMAKE_CURRENT_BINARY_DIR}/src/msg/help_re2rust.cc")
|
||||
set(re2c_help_v "${CMAKE_CURRENT_BINARY_DIR}/src/msg/help_re2v.cc")
|
||||
set(re2c_help_zig "${CMAKE_CURRENT_BINARY_DIR}/src/msg/help_re2zig.cc")
|
||||
set(re2c_rst2man "${CMAKE_CURRENT_SOURCE_DIR}/build/rst2man.py")
|
||||
set(re2c_rst2txt "${CMAKE_CURRENT_SOURCE_DIR}/build/rst2txt.py")
|
||||
set(re2c_splitman "${CMAKE_CURRENT_SOURCE_DIR}/build/split_man.py")
|
||||
set(re2c_docs
|
||||
"${re2c_help}"
|
||||
"${re2c_manpage_c}"
|
||||
"$<$<BOOL:${RE2C_BUILD_RE2D}>:${re2c_manpage_d}>"
|
||||
"$<$<BOOL:${RE2C_BUILD_RE2GO}>:${re2c_manpage_go}>"
|
||||
"$<$<BOOL:${RE2C_BUILD_RE2HS}>:${re2c_manpage_haskell}>"
|
||||
"$<$<BOOL:${RE2C_BUILD_RE2JAVA}>:${re2c_manpage_java}>"
|
||||
"$<$<BOOL:${RE2C_BUILD_RE2JS}>:${re2c_manpage_js}>"
|
||||
"$<$<BOOL:${RE2C_BUILD_RE2OCAML}>:${re2c_manpage_ocaml}>"
|
||||
"$<$<BOOL:${RE2C_BUILD_RE2PY}>:${re2c_manpage_python}>"
|
||||
"$<$<BOOL:${RE2C_BUILD_RE2RUST}>:${re2c_manpage_rust}>"
|
||||
"$<$<BOOL:${RE2C_BUILD_RE2V}>:${re2c_manpage_v}>"
|
||||
"$<$<BOOL:${RE2C_BUILD_RE2ZIG}>:${re2c_manpage_zig}>"
|
||||
)
|
||||
|
||||
# syntax files
|
||||
set(re2c_stx2cpp "${CMAKE_CURRENT_SOURCE_DIR}/build/stx2cpp.py")
|
||||
|
||||
set(top_srcdir "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set(top_builddir "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
set(PYTHON "${Python3_EXECUTABLE}")
|
||||
@@ -90,10 +134,12 @@ set(PYTHON "${Python3_EXECUTABLE}")
|
||||
configure_file(doc/manpage.rst.in doc/manpage.rst @ONLY)
|
||||
configure_file(doc/help.rst.in doc/help.rst @ONLY)
|
||||
|
||||
configure_file(run_tests.py.in run_tests.py @ONLY)
|
||||
set(RE2C_RUN_TESTS "${CMAKE_CURRENT_BINARY_DIR}/run_tests.py")
|
||||
if(CMAKE_HOST_UNIX)
|
||||
execute_process(COMMAND chmod +x "${RE2C_RUN_TESTS}")
|
||||
if(RE2C_BUILD_TESTS)
|
||||
configure_file(run_tests.py.in run_tests.py @ONLY)
|
||||
set(RE2C_RUN_TESTS "${CMAKE_CURRENT_BINARY_DIR}/run_tests.py")
|
||||
if(CMAKE_HOST_UNIX)
|
||||
execute_process(COMMAND chmod +x "${RE2C_RUN_TESTS}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
ac_config_headers("config.h")
|
||||
@@ -111,12 +157,25 @@ include_directories(. "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
# WARNING: custom target that depends on autogenerated sources won't do here
|
||||
# as its dependencies get built multiple times, which ruins parallel builds.
|
||||
add_library(re2c_objects_autogen OBJECT
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/src/options/parse_opts.cc"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/src/parse/lexer.cc"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/src/parse/lexer.h"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/src/parse/parser.cc"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/src/parse/parser.h"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/src/parse/lex.cc"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/src/parse/lex.h"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/src/parse/lex_conf.cc"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/src/options/parse_opts.cc"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/src/parse/conf_lexer.cc"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/src/parse/conf_parser.cc"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/src/parse/conf_parser.h"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/src/default_syntax_c.cc"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/src/default_syntax_d.cc"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/src/default_syntax_go.cc"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/src/default_syntax_haskell.cc"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/src/default_syntax_java.cc"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/src/default_syntax_js.cc"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/src/default_syntax_ocaml.cc"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/src/default_syntax_python.cc"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/src/default_syntax_rust.cc"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/src/default_syntax_v.cc"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/src/default_syntax_zig.cc"
|
||||
"${re2c_docs}"
|
||||
)
|
||||
add_library(re2c_objects_autogen_ver_to_vernum OBJECT
|
||||
@@ -187,156 +246,207 @@ set(re2c_sources
|
||||
$<TARGET_OBJECTS:re2c_objects_autogen_ver_to_vernum>
|
||||
)
|
||||
|
||||
re2c_bootstrap_lexer("src/msg/ver_to_vernum.re" "src/msg/ver_to_vernum.cc")
|
||||
re2c_bootstrap_lexer("src/options/parse_opts.re" "src/options/parse_opts.cc")
|
||||
re2c_bootstrap_lexer("src/parse/lexer.re" "src/parse/lexer.cc" "src/parse/lexer.h")
|
||||
re2c_bootstrap_parser("src/parse/parser.ypp" "src/parse/parser.cc" "src/parse/parser.h")
|
||||
re2c_bootstrap_lexer("src/parse/conf_lexer.re" "src/parse/conf_lexer.cc")
|
||||
re2c_bootstrap_parser("src/parse/conf_parser.ypp" "src/parse/conf_parser.cc" "src/parse/conf_parser.h")
|
||||
|
||||
re2c_bootstrap_syntax("include/syntax/c" "src/default_syntax_c.cc")
|
||||
re2c_bootstrap_syntax("include/syntax/d" "src/default_syntax_d.cc")
|
||||
re2c_bootstrap_syntax("include/syntax/go" "src/default_syntax_go.cc")
|
||||
re2c_bootstrap_syntax("include/syntax/haskell" "src/default_syntax_haskell.cc")
|
||||
re2c_bootstrap_syntax("include/syntax/java" "src/default_syntax_java.cc")
|
||||
re2c_bootstrap_syntax("include/syntax/js" "src/default_syntax_js.cc")
|
||||
re2c_bootstrap_syntax("include/syntax/ocaml" "src/default_syntax_ocaml.cc")
|
||||
re2c_bootstrap_syntax("include/syntax/python" "src/default_syntax_python.cc")
|
||||
re2c_bootstrap_syntax("include/syntax/rust" "src/default_syntax_rust.cc")
|
||||
re2c_bootstrap_syntax("include/syntax/v" "src/default_syntax_v.cc")
|
||||
re2c_bootstrap_syntax("include/syntax/zig" "src/default_syntax_zig.cc")
|
||||
|
||||
# docs
|
||||
file(GLOB_RECURSE re2c_docs_sources CONFIGURE_DEPENDS
|
||||
"examples/*"
|
||||
"doc/manual/*"
|
||||
"${re2c_manpage_source}"
|
||||
)
|
||||
re2c_gen_help("${re2c_help_source}" "${re2c_help_c}")
|
||||
re2c_gen_manpage("${re2c_manpage_source}" "${re2c_manpage_c}")
|
||||
add_custom_target(docs DEPENDS "${re2c_docs}")
|
||||
|
||||
# re2c
|
||||
add_executable(re2c ${re2c_sources})
|
||||
add_executable(re2c ${re2c_sources} "${re2c_help_c}")
|
||||
|
||||
# re2d
|
||||
if (RE2C_BUILD_RE2D)
|
||||
re2c_gen_help("${re2c_help_source}" "${re2c_help_d}")
|
||||
re2c_gen_manpage("${re2c_manpage_source}" "${re2c_manpage_d}")
|
||||
add_executable(re2d ${re2c_sources} "${re2c_help_d}")
|
||||
target_compile_definitions(re2d PUBLIC
|
||||
"RE2C_LANG=Lang::D"
|
||||
"RE2C_PROG=\"re2d\""
|
||||
)
|
||||
endif()
|
||||
|
||||
# re2go
|
||||
if (RE2C_BUILD_RE2GO)
|
||||
add_executable(re2go ${re2c_sources})
|
||||
target_compile_definitions(re2go PUBLIC "RE2C_LANG=Lang::GO")
|
||||
re2c_gen_help("${re2c_help_source}" "${re2c_help_go}")
|
||||
re2c_gen_manpage("${re2c_manpage_source}" "${re2c_manpage_go}")
|
||||
add_executable(re2go ${re2c_sources} "${re2c_help_go}")
|
||||
target_compile_definitions(re2go PUBLIC
|
||||
"RE2C_LANG=Lang::GO"
|
||||
"RE2C_PROG=\"re2go\""
|
||||
)
|
||||
endif()
|
||||
|
||||
# re2hs
|
||||
if (RE2C_BUILD_RE2HS)
|
||||
re2c_gen_help("${re2c_help_source}" "${re2c_help_haskell}")
|
||||
re2c_gen_manpage("${re2c_manpage_source}" "${re2c_manpage_haskell}")
|
||||
add_executable(re2hs ${re2c_sources} "${re2c_help_haskell}")
|
||||
target_compile_definitions(re2hs PUBLIC
|
||||
"RE2C_LANG=Lang::HASKELL"
|
||||
"RE2C_PROG=\"re2hs\""
|
||||
)
|
||||
endif()
|
||||
|
||||
# re2java
|
||||
if (RE2C_BUILD_RE2JAVA)
|
||||
re2c_gen_help("${re2c_help_source}" "${re2c_help_java}")
|
||||
re2c_gen_manpage("${re2c_manpage_source}" "${re2c_manpage_java}")
|
||||
add_executable(re2java ${re2c_sources} "${re2c_help_java}")
|
||||
target_compile_definitions(re2java PUBLIC
|
||||
"RE2C_LANG=Lang::JAVA"
|
||||
"RE2C_PROG=\"re2java\""
|
||||
)
|
||||
endif()
|
||||
|
||||
# re2js
|
||||
if (RE2C_BUILD_RE2JS)
|
||||
re2c_gen_help("${re2c_help_source}" "${re2c_help_js}")
|
||||
re2c_gen_manpage("${re2c_manpage_source}" "${re2c_manpage_js}")
|
||||
add_executable(re2js ${re2c_sources} "${re2c_help_js}")
|
||||
target_compile_definitions(re2js PUBLIC
|
||||
"RE2C_LANG=Lang::JS"
|
||||
"RE2C_PROG=\"re2js\""
|
||||
)
|
||||
endif()
|
||||
|
||||
# re2ocaml
|
||||
if (RE2C_BUILD_RE2OCAML)
|
||||
re2c_gen_help("${re2c_help_source}" "${re2c_help_ocaml}")
|
||||
re2c_gen_manpage("${re2c_manpage_source}" "${re2c_manpage_ocaml}")
|
||||
add_executable(re2ocaml ${re2c_sources} "${re2c_help_ocaml}")
|
||||
target_compile_definitions(re2ocaml PUBLIC
|
||||
"RE2C_LANG=Lang::OCAML"
|
||||
"RE2C_PROG=\"re2ocaml\""
|
||||
)
|
||||
endif()
|
||||
|
||||
# re2py
|
||||
if (RE2C_BUILD_RE2PY)
|
||||
re2c_gen_help("${re2c_help_source}" "${re2c_help_python}")
|
||||
re2c_gen_manpage("${re2c_manpage_source}" "${re2c_manpage_python}")
|
||||
add_executable(re2py ${re2c_sources} "${re2c_help_python}")
|
||||
target_compile_definitions(re2py PUBLIC
|
||||
"RE2C_LANG=Lang::PYTHON"
|
||||
"RE2C_PROG=\"re2py\""
|
||||
)
|
||||
endif()
|
||||
|
||||
# re2rust
|
||||
if (RE2C_BUILD_RE2RUST)
|
||||
add_executable(re2rust ${re2c_sources})
|
||||
target_compile_definitions(re2rust PUBLIC "RE2C_LANG=Lang::RUST")
|
||||
re2c_gen_help("${re2c_help_source}" "${re2c_help_rust}")
|
||||
re2c_gen_manpage("${re2c_manpage_source}" "${re2c_manpage_rust}")
|
||||
add_executable(re2rust ${re2c_sources} "${re2c_help_rust}")
|
||||
target_compile_definitions(re2rust PUBLIC
|
||||
"RE2C_LANG=Lang::RUST"
|
||||
"RE2C_PROG=\"re2rust\""
|
||||
)
|
||||
endif()
|
||||
|
||||
re2c_bootstrap_lexer("src/parse/lex.re" "src/parse/lex.cc" "src/parse/lex.h")
|
||||
re2c_bootstrap_lexer("src/parse/lex_conf.re" "src/parse/lex_conf.cc")
|
||||
re2c_bootstrap_lexer("src/options/parse_opts.re" "src/options/parse_opts.cc")
|
||||
re2c_bootstrap_lexer("src/msg/ver_to_vernum.re" "src/msg/ver_to_vernum.cc")
|
||||
re2c_bootstrap_parser("src/parse/parser.ypp" "src/parse/parser.cc" "src/parse/parser.h")
|
||||
# re2v
|
||||
if (RE2C_BUILD_RE2V)
|
||||
re2c_gen_help("${re2c_help_source}" "${re2c_help_v}")
|
||||
re2c_gen_manpage("${re2c_manpage_source}" "${re2c_manpage_v}")
|
||||
add_executable(re2v ${re2c_sources} "${re2c_help_v}")
|
||||
target_compile_definitions(re2v PUBLIC
|
||||
"RE2C_LANG=Lang::V"
|
||||
"RE2C_PROG=\"re2v\""
|
||||
)
|
||||
endif()
|
||||
|
||||
# docs
|
||||
set(re2c_docs_sources
|
||||
"${re2c_manpage_source}"
|
||||
"doc/manual/api/interface.rst_"
|
||||
"doc/manual/conditions/blocks.rst_"
|
||||
"doc/manual/conditions/conditions.rst_"
|
||||
"doc/manual/configurations/configurations.rst_"
|
||||
"doc/manual/directives/directives.rst_"
|
||||
"doc/manual/dot/dot.rst_"
|
||||
"doc/manual/encodings/encodings.rst_"
|
||||
"doc/manual/eof/01_sentinel.rst_"
|
||||
"doc/manual/eof/02_bounds_checking.rst_"
|
||||
"doc/manual/eof/03_eof_rule.rst_"
|
||||
"doc/manual/eof/04_generic_api.rst_"
|
||||
"doc/manual/eof/eof.rst_"
|
||||
"doc/manual/fill/01_fill.rst_"
|
||||
"doc/manual/fill/02_fill.rst_"
|
||||
"doc/manual/fill/fill.rst_"
|
||||
"doc/manual/headers/headers.rst_"
|
||||
"doc/manual/includes/includes.rst_"
|
||||
"doc/manual/options/debug.rst_"
|
||||
"doc/manual/options/internal.rst_"
|
||||
"doc/manual/options/options.rst_"
|
||||
"doc/manual/regexps/regular_expressions.rst_"
|
||||
"doc/manual/reuse/reuse.rst_"
|
||||
"doc/manual/skeleton/skeleton.rst_"
|
||||
"doc/manual/state/state.rst_"
|
||||
"doc/manual/submatch/submatch_example_mtags.rst_"
|
||||
"doc/manual/submatch/submatch_example_posix.rst_"
|
||||
"doc/manual/submatch/submatch_example_stags_fill.rst_"
|
||||
"doc/manual/submatch/submatch_example_stags.rst_"
|
||||
"doc/manual/submatch/submatch.rst_"
|
||||
"doc/manual/synopsis.rst_"
|
||||
"doc/manual/syntax/api1.rst_"
|
||||
"doc/manual/syntax/api2_c.rst_"
|
||||
"doc/manual/syntax/api2_go.rst_"
|
||||
"doc/manual/syntax/api2_rust.rst_"
|
||||
"doc/manual/syntax/api3.rst_"
|
||||
"doc/manual/syntax/intro.rst_"
|
||||
"doc/manual/syntax/syntax.rst_"
|
||||
"doc/manual/warnings/warnings_general.rst_"
|
||||
"doc/manual/warnings/warnings_list.rst_"
|
||||
"examples/c/01_basic.re"
|
||||
"examples/c/01_basic.c"
|
||||
"examples/c/conditions/parse_u32_blocks.re"
|
||||
"examples/c/conditions/parse_u32_conditions.re"
|
||||
"examples/c/encodings/unicode_identifier.re"
|
||||
"examples/c/eof/01_sentinel.re"
|
||||
"examples/c/eof/02_bounds_checking.re"
|
||||
"examples/c/eof/03_eof_rule.re"
|
||||
"examples/c/eof/05_generic_api_eof_rule.re"
|
||||
"examples/c/fill/01_fill.re"
|
||||
"examples/c/fill/02_fill.re"
|
||||
"examples/c/headers/header.re"
|
||||
"examples/c/headers/lexer/state.h"
|
||||
"examples/c/includes/include.re"
|
||||
"examples/c/includes/definitions.h"
|
||||
"examples/c/reuse/reuse.re"
|
||||
"examples/c/reuse/usedir.re"
|
||||
"examples/c/state/push.re"
|
||||
"examples/c/submatch/01_stags_fill.re"
|
||||
"examples/c/submatch/01_stags.re"
|
||||
"examples/c/submatch/02_mtags.re"
|
||||
"examples/c/submatch/03_posix.re"
|
||||
"examples/go/01_basic.re"
|
||||
"examples/go/01_basic.go"
|
||||
"examples/go/conditions/parse_u32_blocks.re"
|
||||
"examples/go/conditions/parse_u32_conditions.re"
|
||||
"examples/go/encodings/unicode_identifier.re"
|
||||
"examples/go/eof/01_sentinel.re"
|
||||
"examples/go/eof/02_bounds_checking.re"
|
||||
"examples/go/eof/03_eof_rule.re"
|
||||
"examples/go/eof/05_generic_api_eof_rule.re"
|
||||
"examples/go/fill/01_fill.re"
|
||||
"examples/go/fill/02_fill.re"
|
||||
"examples/go/headers/header.re"
|
||||
"examples/go/headers/lexer/state.go"
|
||||
"examples/go/includes/include.re"
|
||||
"examples/go/includes/definitions.go"
|
||||
"examples/go/reuse/reuse.re"
|
||||
"examples/go/reuse/usedir.re"
|
||||
"examples/go/state/push.re"
|
||||
"examples/go/submatch/01_stags_fill.re"
|
||||
"examples/go/submatch/01_stags.re"
|
||||
"examples/go/submatch/02_mtags.re"
|
||||
"examples/go/submatch/03_posix.re"
|
||||
"examples/rust/01_basic.re"
|
||||
"examples/rust/01_basic.rs"
|
||||
"examples/rust/conditions/parse_u32_blocks.re"
|
||||
"examples/rust/conditions/parse_u32_conditions.re"
|
||||
"examples/rust/encodings/unicode_identifier.re"
|
||||
"examples/rust/eof/01_sentinel.re"
|
||||
"examples/rust/eof/02_bounds_checking.re"
|
||||
"examples/rust/eof/03_eof_rule.re"
|
||||
"examples/rust/eof/05_generic_api_eof_rule.re"
|
||||
"examples/rust/fill/01_fill.re"
|
||||
"examples/rust/fill/02_fill.re"
|
||||
"examples/rust/headers/header.re"
|
||||
"examples/rust/headers/lexer/state.rs"
|
||||
"examples/rust/includes/include.re"
|
||||
"examples/rust/includes/definitions.rs"
|
||||
"examples/rust/reuse/reuse.re"
|
||||
"examples/rust/reuse/usedir.re"
|
||||
"examples/rust/state/push.re"
|
||||
"examples/rust/submatch/01_stags_fill.re"
|
||||
"examples/rust/submatch/01_stags.re"
|
||||
"examples/rust/submatch/02_mtags.re"
|
||||
"examples/rust/submatch/03_posix.re"
|
||||
)
|
||||
re2c_gen_manpage("${re2c_manpage_source}" "${re2c_manpage_c}" "${re2c_manpage_bootstrap_c}" "c")
|
||||
re2c_gen_manpage("${re2c_manpage_source}" "${re2c_manpage_go}" "${re2c_manpage_bootstrap_go}" "go")
|
||||
re2c_gen_manpage("${re2c_manpage_source}" "${re2c_manpage_rust}" "${re2c_manpage_bootstrap_rust}" "rust")
|
||||
re2c_gen_help("${re2c_help_source}" "${re2c_help}" "${re2c_help_bootstrap}")
|
||||
add_custom_target(docs DEPENDS "${re2c_docs}")
|
||||
# re2zig
|
||||
if (RE2C_BUILD_RE2ZIG)
|
||||
re2c_gen_help("${re2c_help_source}" "${re2c_help_zig}")
|
||||
re2c_gen_manpage("${re2c_manpage_source}" "${re2c_manpage_zig}")
|
||||
add_executable(re2zig ${re2c_sources} "${re2c_help_zig}")
|
||||
target_compile_definitions(re2zig PUBLIC
|
||||
"RE2C_LANG=Lang::ZIG"
|
||||
"RE2C_PROG=\"re2zig\""
|
||||
)
|
||||
endif()
|
||||
|
||||
# install and test targets are enabled only if re2c is the root project
|
||||
if (CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
|
||||
# install targets are enabled only if re2c is the root project
|
||||
if(RE2C_IS_ROOT_PROJECT)
|
||||
# install
|
||||
install(TARGETS re2c RUNTIME DESTINATION bin)
|
||||
install(FILES "${re2c_manpage_c}" DESTINATION "share/man/man1")
|
||||
if(RE2C_BUILD_RE2D)
|
||||
install(TARGETS re2d RUNTIME DESTINATION bin)
|
||||
install(FILES "${re2c_manpage_d}" DESTINATION "share/man/man1")
|
||||
endif()
|
||||
if(RE2C_BUILD_RE2GO)
|
||||
install(TARGETS re2go RUNTIME DESTINATION bin)
|
||||
install(FILES "${re2c_manpage_go}" DESTINATION "share/man/man1")
|
||||
endif()
|
||||
if(RE2C_BUILD_RE2HS)
|
||||
install(TARGETS re2hs RUNTIME DESTINATION bin)
|
||||
install(FILES "${re2c_manpage_haskell}" DESTINATION "share/man/man1")
|
||||
endif()
|
||||
if(RE2C_BUILD_RE2JAVA)
|
||||
install(TARGETS re2java RUNTIME DESTINATION bin)
|
||||
install(FILES "${re2c_manpage_java}" DESTINATION "share/man/man1")
|
||||
endif()
|
||||
if(RE2C_BUILD_RE2JS)
|
||||
install(TARGETS re2js RUNTIME DESTINATION bin)
|
||||
install(FILES "${re2c_manpage_js}" DESTINATION "share/man/man1")
|
||||
endif()
|
||||
if(RE2C_BUILD_RE2OCAML)
|
||||
install(TARGETS re2ocaml RUNTIME DESTINATION bin)
|
||||
install(FILES "${re2c_manpage_ocaml}" DESTINATION "share/man/man1")
|
||||
endif()
|
||||
if(RE2C_BUILD_RE2PY)
|
||||
install(TARGETS re2py RUNTIME DESTINATION bin)
|
||||
install(FILES "${re2c_manpage_python}" DESTINATION "share/man/man1")
|
||||
endif()
|
||||
if(RE2C_BUILD_RE2RUST)
|
||||
install(TARGETS re2rust RUNTIME DESTINATION bin)
|
||||
install(FILES "${re2c_manpage_rust}" DESTINATION "share/man/man1")
|
||||
endif()
|
||||
install(FILES include/unicode_categories.re DESTINATION "${RE2C_STDLIB_DIR}")
|
||||
if(RE2C_BUILD_RE2V)
|
||||
install(TARGETS re2v RUNTIME DESTINATION bin)
|
||||
install(FILES "${re2c_manpage_v}" DESTINATION "share/man/man1")
|
||||
endif()
|
||||
if(RE2C_BUILD_RE2ZIG)
|
||||
install(TARGETS re2zig RUNTIME DESTINATION bin)
|
||||
install(FILES "${re2c_manpage_zig}" DESTINATION "share/man/man1")
|
||||
endif()
|
||||
install(FILES
|
||||
include/syntax/c
|
||||
include/syntax/d
|
||||
include/syntax/go
|
||||
include/syntax/haskell
|
||||
include/syntax/java
|
||||
include/syntax/js
|
||||
include/syntax/ocaml
|
||||
include/syntax/python
|
||||
include/syntax/rust
|
||||
include/syntax/v
|
||||
include/syntax/zig
|
||||
include/unicode_categories.re
|
||||
DESTINATION "${RE2C_STDLIB_DIR}")
|
||||
|
||||
# rebuild all re2c sources using newly built re2c
|
||||
add_custom_target(bootstrap
|
||||
@@ -344,7 +454,9 @@ if (CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
|
||||
COMMAND "${CMAKE_COMMAND}" -E remove_directory "doc"
|
||||
COMMAND "${CMAKE_COMMAND}" --build "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(RE2C_BUILD_TESTS)
|
||||
# tests
|
||||
add_custom_target(tests
|
||||
DEPENDS "${RE2C_RUN_TESTS}"
|
||||
@@ -364,6 +476,9 @@ if (CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
|
||||
COMMAND "${Python3_EXECUTABLE}" "${RE2C_RUN_TESTS}" --wine -j1
|
||||
)
|
||||
add_dependencies(wtests re2c)
|
||||
add_executable(re2c_test_list
|
||||
src/test/list/test.cc
|
||||
)
|
||||
add_executable(re2c_test_range
|
||||
src/test/range/test-impl.h
|
||||
src/test/range/test.cc
|
||||
@@ -381,9 +496,9 @@ if (CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
|
||||
)
|
||||
add_executable(re2c_test_argsubst
|
||||
src/test/argsubst/test.cc
|
||||
src/codegen/helpers.cc
|
||||
)
|
||||
add_custom_target(check_re2c
|
||||
COMMAND ./re2c_test_list
|
||||
COMMAND ./re2c_test_range
|
||||
COMMAND ./re2c_test_s_to_n32_unsafe
|
||||
COMMAND ./re2c_test_ver_to_vernum
|
||||
@@ -508,12 +623,14 @@ if (RE2C_BUILD_LIBS)
|
||||
endif()
|
||||
|
||||
# libre2c test
|
||||
add_executable(test_libre2c lib/test.cc)
|
||||
target_link_libraries(test_libre2c libre2c)
|
||||
target_link_libraries(test_libre2c test_libre2c_objects_autogen)
|
||||
add_custom_target(check_libre2c
|
||||
COMMAND ./test_libre2c
|
||||
)
|
||||
if(RE2C_BUILD_TESTS)
|
||||
add_executable(test_libre2c lib/test.cc)
|
||||
target_link_libraries(test_libre2c libre2c)
|
||||
target_link_libraries(test_libre2c test_libre2c_objects_autogen)
|
||||
add_custom_target(check_libre2c
|
||||
COMMAND ./test_libre2c
|
||||
)
|
||||
endif()
|
||||
|
||||
if(RE2C_BUILD_BENCHMARKS)
|
||||
add_subdirectory(benchmarks/submatch_nfa)
|
||||
@@ -522,15 +639,16 @@ if (RE2C_BUILD_LIBS)
|
||||
endif()
|
||||
else()
|
||||
# empty check target
|
||||
add_custom_target(check_libre2c)
|
||||
if(RE2C_BUILD_TESTS)
|
||||
add_custom_target(check_libre2c)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(RE2C_BUILD_BENCHMARKS)
|
||||
add_subdirectory(benchmarks/submatch_dfa_aot)
|
||||
endif()
|
||||
|
||||
# only add check target if toplevel project
|
||||
if (CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
|
||||
if(RE2C_BUILD_TESTS)
|
||||
add_custom_target(check)
|
||||
add_dependencies(check check_re2c check_libre2c)
|
||||
endif()
|
||||
|
||||
+107
-11
@@ -11,8 +11,16 @@
|
||||
"hidden": true,
|
||||
"installDir": "${sourceDir}/install-2",
|
||||
"cacheVariables": {
|
||||
"RE2C_BUILD_RE2D": true,
|
||||
"RE2C_BUILD_RE2GO": true,
|
||||
"RE2C_BUILD_RE2HS": true,
|
||||
"RE2C_BUILD_RE2JAVA": true,
|
||||
"RE2C_BUILD_RE2JS": true,
|
||||
"RE2C_BUILD_RE2OCAML": true,
|
||||
"RE2C_BUILD_RE2PY": true,
|
||||
"RE2C_BUILD_RE2RUST": true,
|
||||
"RE2C_BUILD_RE2V": true,
|
||||
"RE2C_BUILD_RE2ZIG": true,
|
||||
"RE2C_BUILD_LIBS": true,
|
||||
"RE2C_REBUILD_LEXERS": true,
|
||||
"RE2C_REBUILD_DOCS": true,
|
||||
@@ -48,8 +56,16 @@
|
||||
"CMAKE_BUILD_TYPE": "Ubsan",
|
||||
"CMAKE_C_FLAGS": "-O2",
|
||||
"CMAKE_CXX_FLAGS": "-O2",
|
||||
"RE2C_BUILD_RE2D": false,
|
||||
"RE2C_BUILD_RE2GO": false,
|
||||
"RE2C_BUILD_RE2RUST": false
|
||||
"RE2C_BUILD_RE2HS": false,
|
||||
"RE2C_BUILD_RE2JAVA": false,
|
||||
"RE2C_BUILD_RE2JS": false,
|
||||
"RE2C_BUILD_RE2OCAML": false,
|
||||
"RE2C_BUILD_RE2PY": false,
|
||||
"RE2C_BUILD_RE2RUST": false,
|
||||
"RE2C_BUILD_RE2V": false,
|
||||
"RE2C_BUILD_RE2ZIG": false
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -67,8 +83,16 @@
|
||||
"CMAKE_BUILD_TYPE": "Asan",
|
||||
"CMAKE_C_FLAGS": "-O2",
|
||||
"CMAKE_CXX_FLAGS": "-O2",
|
||||
"RE2C_BUILD_RE2D": false,
|
||||
"RE2C_BUILD_RE2GO": false,
|
||||
"RE2C_BUILD_RE2RUST": false
|
||||
"RE2C_BUILD_RE2HS": false,
|
||||
"RE2C_BUILD_RE2JAVA": false,
|
||||
"RE2C_BUILD_RE2JS": false,
|
||||
"RE2C_BUILD_RE2OCAML": false,
|
||||
"RE2C_BUILD_RE2PY": false,
|
||||
"RE2C_BUILD_RE2RUST": false,
|
||||
"RE2C_BUILD_RE2V": false,
|
||||
"RE2C_BUILD_RE2ZIG": false
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -86,8 +110,16 @@
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"CMAKE_C_FLAGS": "-O2",
|
||||
"CMAKE_CXX_FLAGS": "-O2",
|
||||
"RE2C_BUILD_RE2D": false,
|
||||
"RE2C_BUILD_RE2GO": false,
|
||||
"RE2C_BUILD_RE2RUST": false
|
||||
"RE2C_BUILD_RE2HS": false,
|
||||
"RE2C_BUILD_RE2JAVA": false,
|
||||
"RE2C_BUILD_RE2JS": false,
|
||||
"RE2C_BUILD_RE2OCAML": false,
|
||||
"RE2C_BUILD_RE2PY": false,
|
||||
"RE2C_BUILD_RE2RUST": false,
|
||||
"RE2C_BUILD_RE2V": false,
|
||||
"RE2C_BUILD_RE2ZIG": false
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -111,8 +143,16 @@
|
||||
"CMAKE_CXX_FLAGS": "-O2 -m32",
|
||||
"CMAKE_EXE_LINKER_FLAGS": "-m32",
|
||||
"CMAKE_SHARED_LINKER_FLAGS": "-m32",
|
||||
"RE2C_BUILD_RE2D": false,
|
||||
"RE2C_BUILD_RE2GO": false,
|
||||
"RE2C_BUILD_RE2RUST": false
|
||||
"RE2C_BUILD_RE2HS": false,
|
||||
"RE2C_BUILD_RE2JAVA": false,
|
||||
"RE2C_BUILD_RE2JS": false,
|
||||
"RE2C_BUILD_RE2OCAML": false,
|
||||
"RE2C_BUILD_RE2PY": false,
|
||||
"RE2C_BUILD_RE2RUST": false,
|
||||
"RE2C_BUILD_RE2V": false,
|
||||
"RE2C_BUILD_RE2ZIG": false
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -128,8 +168,16 @@
|
||||
"installDir": "${sourceDir}/install",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"RE2C_BUILD_RE2D": false,
|
||||
"RE2C_BUILD_RE2GO": false,
|
||||
"RE2C_BUILD_RE2RUST": false
|
||||
"RE2C_BUILD_RE2HS": false,
|
||||
"RE2C_BUILD_RE2JAVA": false,
|
||||
"RE2C_BUILD_RE2JS": false,
|
||||
"RE2C_BUILD_RE2OCAML": false,
|
||||
"RE2C_BUILD_RE2PY": false,
|
||||
"RE2C_BUILD_RE2RUST": false,
|
||||
"RE2C_BUILD_RE2V": false,
|
||||
"RE2C_BUILD_RE2ZIG": false
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -177,8 +225,16 @@
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"CMAKE_C_FLAGS": "-O2",
|
||||
"CMAKE_CXX_FLAGS": "-O2",
|
||||
"RE2C_BUILD_RE2D": false,
|
||||
"RE2C_BUILD_RE2GO": false,
|
||||
"RE2C_BUILD_RE2RUST": false
|
||||
"RE2C_BUILD_RE2HS": false,
|
||||
"RE2C_BUILD_RE2JAVA": false,
|
||||
"RE2C_BUILD_RE2JS": false,
|
||||
"RE2C_BUILD_RE2OCAML": false,
|
||||
"RE2C_BUILD_RE2PY": false,
|
||||
"RE2C_BUILD_RE2RUST": false,
|
||||
"RE2C_BUILD_RE2V": false,
|
||||
"RE2C_BUILD_RE2ZIG": false
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -196,8 +252,16 @@
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"CMAKE_C_FLAGS": "-O2",
|
||||
"CMAKE_CXX_FLAGS": "-O2",
|
||||
"RE2C_BUILD_RE2D": false,
|
||||
"RE2C_BUILD_RE2GO": false,
|
||||
"RE2C_BUILD_RE2RUST": false
|
||||
"RE2C_BUILD_RE2HS": false,
|
||||
"RE2C_BUILD_RE2JAVA": false,
|
||||
"RE2C_BUILD_RE2JS": false,
|
||||
"RE2C_BUILD_RE2OCAML": false,
|
||||
"RE2C_BUILD_RE2PY": false,
|
||||
"RE2C_BUILD_RE2RUST": false,
|
||||
"RE2C_BUILD_RE2V": false,
|
||||
"RE2C_BUILD_RE2ZIG": false
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -213,8 +277,16 @@
|
||||
"installDir": "${sourceDir}/install",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"RE2C_BUILD_RE2D": false,
|
||||
"RE2C_BUILD_RE2GO": false,
|
||||
"RE2C_BUILD_RE2RUST": false
|
||||
"RE2C_BUILD_RE2HS": false,
|
||||
"RE2C_BUILD_RE2JAVA": false,
|
||||
"RE2C_BUILD_RE2JS": false,
|
||||
"RE2C_BUILD_RE2OCAML": false,
|
||||
"RE2C_BUILD_RE2PY": false,
|
||||
"RE2C_BUILD_RE2RUST": false,
|
||||
"RE2C_BUILD_RE2V": false,
|
||||
"RE2C_BUILD_RE2ZIG": false
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -250,8 +322,16 @@
|
||||
"installDir": "${sourceDir}/install",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"RE2C_BUILD_RE2D": false,
|
||||
"RE2C_BUILD_RE2GO": false,
|
||||
"RE2C_BUILD_RE2RUST": false
|
||||
"RE2C_BUILD_RE2HS": false,
|
||||
"RE2C_BUILD_RE2JAVA": false,
|
||||
"RE2C_BUILD_RE2JS": false,
|
||||
"RE2C_BUILD_RE2OCAML": false,
|
||||
"RE2C_BUILD_RE2PY": false,
|
||||
"RE2C_BUILD_RE2RUST": false,
|
||||
"RE2C_BUILD_RE2V": false,
|
||||
"RE2C_BUILD_RE2ZIG": false
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -267,8 +347,16 @@
|
||||
"installDir": "${sourceDir}/install",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"RE2C_BUILD_RE2D": false,
|
||||
"RE2C_BUILD_RE2GO": false,
|
||||
"RE2C_BUILD_RE2RUST": false
|
||||
"RE2C_BUILD_RE2HS": false,
|
||||
"RE2C_BUILD_RE2JAVA": false,
|
||||
"RE2C_BUILD_RE2JS": false,
|
||||
"RE2C_BUILD_RE2OCAML": false,
|
||||
"RE2C_BUILD_RE2PY": false,
|
||||
"RE2C_BUILD_RE2RUST": false,
|
||||
"RE2C_BUILD_RE2V": false,
|
||||
"RE2C_BUILD_RE2ZIG": false
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -284,8 +372,16 @@
|
||||
"installDir": "${sourceDir}/install",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"RE2C_BUILD_RE2D": false,
|
||||
"RE2C_BUILD_RE2GO": false,
|
||||
"RE2C_BUILD_RE2RUST": false
|
||||
"RE2C_BUILD_RE2HS": false,
|
||||
"RE2C_BUILD_RE2JAVA": false,
|
||||
"RE2C_BUILD_RE2JS": false,
|
||||
"RE2C_BUILD_RE2OCAML": false,
|
||||
"RE2C_BUILD_RE2PY": false,
|
||||
"RE2C_BUILD_RE2RUST": false,
|
||||
"RE2C_BUILD_RE2V": false,
|
||||
"RE2C_BUILD_RE2ZIG": false
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -47,6 +47,10 @@ with options `--enable-parsers` (Autotools) or `-DRE2C_REBUILD_PARSERS=ON`
|
||||
(CMake). In this case `bison` must be installed on the system. Otherwise
|
||||
Autoconf or CMake will fail at configuration stage.
|
||||
|
||||
For changes that affect syntax files, regeneration mode is configured
|
||||
with options `--enable-syntax` (Autotools) or `-DRE2C_REBUILD_SYNTAX=ON`
|
||||
(CMake).
|
||||
|
||||
For changes that update documentation, it is necessary to rebuild the bootstrap
|
||||
manpages by reconfiguring and rebuilding re2c with options `--enable-docs`
|
||||
(Autotools) or `-DRE2C_REBUILD_DOCS=ON` (CMake).
|
||||
|
||||
@@ -41,6 +41,6 @@ requires some research. Does TDFA present any special difficulties?
|
||||
## Location support
|
||||
|
||||
It would be good to have something like Bison locations (automatic tracking of
|
||||
line/column/filename inforamtion). This is primarily useful for tokenizers and
|
||||
line/column/filename information). This is primarily useful for tokenizers and
|
||||
large lexers.
|
||||
|
||||
|
||||
+487
-138
@@ -130,146 +130,329 @@ re2c_SOURCES = \
|
||||
$(re2c_SRC)
|
||||
|
||||
# autogenerated sources
|
||||
re2c_GEN_HELP = src/msg/help.cc
|
||||
re2c_GEN_LEX = src/parse/lex.cc
|
||||
re2c_GEN_PARSER = src/parse/parser.cc
|
||||
re2c_GEN_PARSER_HDR = src/parse/parser.h
|
||||
re2c_GEN_VER_TO_VERNUM = src/msg/ver_to_vernum.cc
|
||||
re2c_GEN_SRC = \
|
||||
$(re2c_GEN_HELP) \
|
||||
$(re2c_GEN_LEX) \
|
||||
$(re2c_GEN_PARSER) \
|
||||
$(re2c_GEN_VER_TO_VERNUM) \
|
||||
src/parse/lex_conf.cc \
|
||||
src/options/parse_opts.cc
|
||||
src/default_syntax_c.cc \
|
||||
src/default_syntax_d.cc \
|
||||
src/default_syntax_go.cc \
|
||||
src/default_syntax_haskell.cc \
|
||||
src/default_syntax_java.cc \
|
||||
src/default_syntax_js.cc \
|
||||
src/default_syntax_ocaml.cc \
|
||||
src/default_syntax_python.cc \
|
||||
src/default_syntax_rust.cc \
|
||||
src/default_syntax_v.cc \
|
||||
src/default_syntax_zig.cc \
|
||||
src/msg/ver_to_vernum.cc \
|
||||
src/options/parse_opts.cc \
|
||||
src/parse/lexer.cc \
|
||||
src/parse/parser.cc \
|
||||
src/parse/conf_lexer.cc \
|
||||
src/parse/conf_parser.cc
|
||||
re2c_GEN_HDR = \
|
||||
src/parse/lex.h \
|
||||
$(re2c_GEN_PARSER_HDR)
|
||||
src/parse/parser.h \
|
||||
src/parse/conf_parser.h \
|
||||
src/parse/lexer.h
|
||||
re2c_GEN = \
|
||||
$(re2c_GEN_SRC) \
|
||||
$(re2c_GEN_HDR)
|
||||
nodist_re2c_SOURCES = $(re2c_GEN)
|
||||
nodist_re2c_SOURCES = \
|
||||
$(re2c_GEN) \
|
||||
src/msg/help_re2c.cc
|
||||
|
||||
# custom rules create headers and must go before normal rules
|
||||
BUILT_SOURCES = $(re2c_GEN_SRC)
|
||||
|
||||
# bootstrap sources
|
||||
re2c_BOOT_PARSER = bootstrap/src/parse/parser.cc
|
||||
re2c_BOOT_PARSER_HDR = bootstrap/src/parse/parser.h
|
||||
re2c_BOOT_DOC_C = bootstrap/doc/re2c.1
|
||||
re2c_BOOT_DOC_GO = bootstrap/doc/re2go.1
|
||||
re2c_BOOT_DOC_RUST = bootstrap/doc/re2rust.1
|
||||
re2c_BOOT_HELP = bootstrap/src/msg/help.cc
|
||||
re2c_BOOT = \
|
||||
$(re2c_BOOT_DOC_C) \
|
||||
$(re2c_BOOT_DOC_GO) \
|
||||
$(re2c_BOOT_DOC_RUST) \
|
||||
$(re2c_BOOT_HELP) \
|
||||
$(re2c_BOOT_PARSER) \
|
||||
$(re2c_BOOT_PARSER_HDR) \
|
||||
bootstrap/src/parse/lex.cc \
|
||||
bootstrap/src/parse/lex.h \
|
||||
bootstrap/src/parse/lex_conf.cc \
|
||||
bootstrap/doc/re2c.1 \
|
||||
bootstrap/doc/re2d.1 \
|
||||
bootstrap/doc/re2go.1 \
|
||||
bootstrap/doc/re2hs.1 \
|
||||
bootstrap/doc/re2java.1 \
|
||||
bootstrap/doc/re2js.1 \
|
||||
bootstrap/doc/re2ocaml.1 \
|
||||
bootstrap/doc/re2py.1 \
|
||||
bootstrap/doc/re2rust.1 \
|
||||
bootstrap/doc/re2v.1 \
|
||||
bootstrap/doc/re2zig.1 \
|
||||
bootstrap/src/default_syntax_c.cc \
|
||||
bootstrap/src/default_syntax_d.cc \
|
||||
bootstrap/src/default_syntax_go.cc \
|
||||
bootstrap/src/default_syntax_haskell.cc \
|
||||
bootstrap/src/default_syntax_java.cc \
|
||||
bootstrap/src/default_syntax_js.cc \
|
||||
bootstrap/src/default_syntax_ocaml.cc \
|
||||
bootstrap/src/default_syntax_python.cc \
|
||||
bootstrap/src/default_syntax_rust.cc \
|
||||
bootstrap/src/default_syntax_v.cc \
|
||||
bootstrap/src/default_syntax_zig.cc \
|
||||
bootstrap/src/msg/help_re2c.cc \
|
||||
bootstrap/src/msg/help_re2d.cc \
|
||||
bootstrap/src/msg/help_re2go.cc \
|
||||
bootstrap/src/msg/help_re2hs.cc \
|
||||
bootstrap/src/msg/help_re2java.cc \
|
||||
bootstrap/src/msg/help_re2js.cc \
|
||||
bootstrap/src/msg/help_re2ocaml.cc \
|
||||
bootstrap/src/msg/help_re2py.cc \
|
||||
bootstrap/src/msg/help_re2rust.cc \
|
||||
bootstrap/src/msg/help_re2v.cc \
|
||||
bootstrap/src/msg/help_re2zig.cc \
|
||||
bootstrap/src/msg/ver_to_vernum.cc \
|
||||
bootstrap/src/options/parse_opts.cc \
|
||||
bootstrap/src/msg/ver_to_vernum.cc
|
||||
bootstrap/src/parse/lexer.cc \
|
||||
bootstrap/src/parse/lexer.h \
|
||||
bootstrap/src/parse/parser.cc \
|
||||
bootstrap/src/parse/parser.h \
|
||||
bootstrap/src/parse/conf_lexer.cc \
|
||||
bootstrap/src/parse/conf_parser.h \
|
||||
bootstrap/src/parse/conf_parser.cc
|
||||
|
||||
# custom sources
|
||||
re2c_CUSTOM_PARSER = src/parse/parser.ypp
|
||||
re2c_CUSTOM_HELP = doc/help.rst
|
||||
re2c_CUSTOM = \
|
||||
$(re2c_CUSTOM_PARSER) \
|
||||
$(re2c_CUSTOM_HELP) \
|
||||
src/parse/lex.re \
|
||||
src/parse/lex_conf.re \
|
||||
src/msg/ver_to_vernum.re \
|
||||
src/options/parse_opts.re \
|
||||
src/msg/ver_to_vernum.re
|
||||
src/parse/lexer.re \
|
||||
src/parse/parser.ypp \
|
||||
src/parse/conf_lexer.re \
|
||||
src/parse/conf_parser.ypp
|
||||
|
||||
# docs
|
||||
re2c_SRC_DOC = doc/manpage.rst
|
||||
# To build the list of examples for all backends, run:
|
||||
# find examples -regex '.*\.re\|.*\(state\|01_basic\|definitions\)\..*' -printf '\t%p \\\n' | sort
|
||||
re2c_SRC_DOC_EXT = \
|
||||
doc/manual/api/interface.rst_ \
|
||||
doc/manual/conditions/blocks.rst_ \
|
||||
doc/manual/conditions/conditions.rst_ \
|
||||
doc/manual/configurations/configurations.rst_ \
|
||||
doc/manual/directives/directives.rst_ \
|
||||
doc/manual/dot/dot.rst_ \
|
||||
doc/manual/encodings/encodings.rst_ \
|
||||
doc/manual/basics/api/api1.rst_ \
|
||||
doc/manual/basics/api/api2_c.rst_ \
|
||||
doc/manual/basics/api/api2_go.rst_ \
|
||||
doc/manual/basics/api/api2_rust.rst_ \
|
||||
doc/manual/basics/api/api3.rst_ \
|
||||
doc/manual/basics/blocks.rst_ \
|
||||
doc/manual/basics/directives.rst_ \
|
||||
doc/manual/basics/configurations.rst_ \
|
||||
doc/manual/basics/regular_expressions.rst_ \
|
||||
doc/manual/basics/syntax.rst_ \
|
||||
doc/manual/basics/syntax_files.rst_ \
|
||||
doc/manual/basics/options/debug.rst_ \
|
||||
doc/manual/basics/options/internal.rst_ \
|
||||
doc/manual/basics/options/options.rst_ \
|
||||
doc/manual/basics/warnings/warnings_general.rst_ \
|
||||
doc/manual/basics/warnings/warnings_list.rst_ \
|
||||
doc/manual/eof/01_sentinel.rst_ \
|
||||
doc/manual/eof/02_bounds_checking.rst_ \
|
||||
doc/manual/eof/03_eof_rule.rst_ \
|
||||
doc/manual/eof/04_generic_api.rst_ \
|
||||
doc/manual/eof/04_fake_sentinel.rst_ \
|
||||
doc/manual/eof/eof.rst_ \
|
||||
doc/manual/features/conditions/blocks.rst_ \
|
||||
doc/manual/features/conditions/conditions.rst_ \
|
||||
doc/manual/features/dot/dot.rst_ \
|
||||
doc/manual/features/encodings/encodings.rst_ \
|
||||
doc/manual/features/headers/headers.rst_ \
|
||||
doc/manual/features/includes/includes.rst_ \
|
||||
doc/manual/features/reuse/reuse.rst_ \
|
||||
doc/manual/features/skeleton/skeleton.rst_ \
|
||||
doc/manual/features/state/state.rst_ \
|
||||
doc/manual/features/submatch/submatch_example_mtags.rst_ \
|
||||
doc/manual/features/submatch/submatch_example_captures.rst_ \
|
||||
doc/manual/features/submatch/submatch_example_stags_fill.rst_ \
|
||||
doc/manual/features/submatch/submatch_example_stags.rst_ \
|
||||
doc/manual/features/submatch/submatch.rst_ \
|
||||
doc/manual/fill/01_fill.rst_ \
|
||||
doc/manual/fill/02_fill.rst_ \
|
||||
doc/manual/fill/fill.rst_ \
|
||||
doc/manual/headers/headers.rst_ \
|
||||
doc/manual/includes/includes.rst_ \
|
||||
doc/manual/options/debug.rst_ \
|
||||
doc/manual/options/internal.rst_ \
|
||||
doc/manual/options/options.rst_ \
|
||||
doc/manual/regexps/regular_expressions.rst_ \
|
||||
doc/manual/reuse/reuse.rst_ \
|
||||
doc/manual/skeleton/skeleton.rst_ \
|
||||
doc/manual/state/state.rst_ \
|
||||
doc/manual/submatch/submatch_example_mtags.rst_ \
|
||||
doc/manual/submatch/submatch_example_posix.rst_ \
|
||||
doc/manual/submatch/submatch_example_stags_fill.rst_ \
|
||||
doc/manual/submatch/submatch_example_stags.rst_ \
|
||||
doc/manual/submatch/submatch.rst_ \
|
||||
doc/manual/authors.rst_ \
|
||||
doc/manual/intro.rst_ \
|
||||
doc/manual/synopsis.rst_ \
|
||||
doc/manual/syntax/api1.rst_ \
|
||||
doc/manual/syntax/api2_c.rst_ \
|
||||
doc/manual/syntax/api2_go.rst_ \
|
||||
doc/manual/syntax/api2_rust.rst_ \
|
||||
doc/manual/syntax/api3.rst_ \
|
||||
doc/manual/syntax/intro.rst_ \
|
||||
doc/manual/syntax/syntax.rst_ \
|
||||
doc/manual/warnings/warnings_general.rst_ \
|
||||
doc/manual/warnings/warnings_list.rst_ \
|
||||
examples/c/01_basic.re \
|
||||
examples/c/01_basic.c \
|
||||
examples/c/01_basic.re \
|
||||
examples/c/conditions/parse_u32_blocks.re \
|
||||
examples/c/conditions/parse_u32_conditions.re \
|
||||
examples/c/encodings/unicode_identifier.re \
|
||||
examples/c/eof/01_sentinel.re \
|
||||
examples/c/eof/02_bounds_checking.re \
|
||||
examples/c/eof/03_eof_rule.re \
|
||||
examples/c/eof/05_generic_api_eof_rule.re \
|
||||
examples/c/eof/04_fake_sentinel.re \
|
||||
examples/c/eof/05_fake_sentinel_eof_rule.re \
|
||||
examples/c/fill/01_fill.re \
|
||||
examples/c/fill/02_fill.re \
|
||||
examples/c/generic_api/ifstream.re \
|
||||
examples/c/headers/header.re \
|
||||
examples/c/headers/lexer/state.h \
|
||||
examples/c/includes/include.re \
|
||||
examples/c/includes/definitions.h \
|
||||
examples/c/includes/include.re \
|
||||
examples/c/real_world/cxx98.re \
|
||||
examples/c/reuse/braille.re \
|
||||
examples/c/reuse/reuse.re \
|
||||
examples/c/reuse/usedir.re \
|
||||
examples/c/state/push.re \
|
||||
examples/c/submatch/01_stags_fill.re \
|
||||
examples/c/submatch/01_stags.re \
|
||||
examples/c/submatch/02_mtags.re \
|
||||
examples/c/submatch/03_posix.re \
|
||||
examples/go/01_basic.re \
|
||||
examples/c/submatch/03_captures.re \
|
||||
examples/c/submatch/04_posix_captures.re \
|
||||
examples/c/submatch/http_rfc7230.re \
|
||||
examples/c/submatch/parse_etc_passwd.re \
|
||||
examples/c/submatch/parse_options.re \
|
||||
examples/c/submatch/parse_records.re \
|
||||
examples/c/submatch/uri_rfc3986.re \
|
||||
examples/d/01_basic.d \
|
||||
examples/d/01_basic.re \
|
||||
examples/d/conditions/parse_u32_blocks.re \
|
||||
examples/d/conditions/parse_u32_conditions.re \
|
||||
examples/d/encodings/unicode_identifier.re \
|
||||
examples/d/eof/01_sentinel.re \
|
||||
examples/d/eof/02_bounds_checking.re \
|
||||
examples/d/eof/03_eof_rule.re \
|
||||
examples/d/eof/04_fake_sentinel.re \
|
||||
examples/d/fill/01_fill.re \
|
||||
examples/d/fill/02_fill.re \
|
||||
examples/d/headers/header.re \
|
||||
examples/d/headers/lexer/state.d \
|
||||
examples/d/includes/definitions.d \
|
||||
examples/d/includes/include.re \
|
||||
examples/d/reuse/reuse.re \
|
||||
examples/d/reuse/usedir.re \
|
||||
examples/d/state/push.re \
|
||||
examples/d/submatch/01_stags_fill.re \
|
||||
examples/d/submatch/01_stags.re \
|
||||
examples/d/submatch/02_mtags.re \
|
||||
examples/d/submatch/03_captures.re \
|
||||
examples/d/submatch/04_posix_captures.re \
|
||||
examples/go/01_basic.go \
|
||||
examples/go/01_basic.re \
|
||||
examples/go/conditions/parse_u32_blocks.re \
|
||||
examples/go/conditions/parse_u32_conditions.re \
|
||||
examples/go/encodings/unicode_identifier.re \
|
||||
examples/go/eof/01_sentinel.re \
|
||||
examples/go/eof/02_bounds_checking.re \
|
||||
examples/go/eof/03_eof_rule.re \
|
||||
examples/go/eof/05_generic_api_eof_rule.re \
|
||||
examples/go/eof/04_fake_sentinel.re \
|
||||
examples/go/fill/01_fill.re \
|
||||
examples/go/fill/02_fill.re \
|
||||
examples/go/headers/header.re \
|
||||
examples/go/headers/lexer/state.go \
|
||||
examples/go/includes/include.re \
|
||||
examples/go/includes/definitions.go \
|
||||
examples/go/includes/include.re \
|
||||
examples/go/reuse/reuse.re \
|
||||
examples/go/reuse/usedir.re \
|
||||
examples/go/state/push.re \
|
||||
examples/go/submatch/01_stags_fill.re \
|
||||
examples/go/submatch/01_stags.re \
|
||||
examples/go/submatch/02_mtags.re \
|
||||
examples/go/submatch/03_posix.re \
|
||||
examples/go/submatch/03_captures.re \
|
||||
examples/go/submatch/04_posix_captures.re \
|
||||
examples/haskell/01_basic.hs \
|
||||
examples/haskell/01_basic.re \
|
||||
examples/haskell/conditions/parse_u32_blocks.re \
|
||||
examples/haskell/conditions/parse_u32_conditions.re \
|
||||
examples/haskell/encodings/unicode_identifier.re \
|
||||
examples/haskell/eof/01_sentinel.re \
|
||||
examples/haskell/eof/02_bounds_checking.re \
|
||||
examples/haskell/eof/03_eof_rule.re \
|
||||
examples/haskell/eof/04_fake_sentinel.re \
|
||||
examples/haskell/fill/01_fill.re \
|
||||
examples/haskell/fill/02_fill.re \
|
||||
examples/haskell/headers/header.re \
|
||||
examples/haskell/headers/lexer/state.hs \
|
||||
examples/haskell/includes/definitions.hs \
|
||||
examples/haskell/includes/include.re \
|
||||
examples/haskell/reuse/reuse.re \
|
||||
examples/haskell/reuse/usedir.re \
|
||||
examples/haskell/state/push.re \
|
||||
examples/haskell/submatch/01_stags_fill.re \
|
||||
examples/haskell/submatch/01_stags.re \
|
||||
examples/haskell/submatch/02_mtags.re \
|
||||
examples/haskell/submatch/03_captures.re \
|
||||
examples/java/01_basic.java \
|
||||
examples/java/01_basic.re \
|
||||
examples/java/conditions/parse_u32_blocks.re \
|
||||
examples/java/conditions/parse_u32_conditions.re \
|
||||
examples/java/encodings/unicode_identifier.re \
|
||||
examples/java/eof/01_sentinel.re \
|
||||
examples/java/eof/02_bounds_checking.re \
|
||||
examples/java/eof/03_eof_rule.re \
|
||||
examples/java/eof/04_fake_sentinel.re \
|
||||
examples/java/fill/01_fill.re \
|
||||
examples/java/fill/02_fill.re \
|
||||
examples/java/headers/header.re \
|
||||
examples/java/headers/lexer/state.java \
|
||||
examples/java/includes/definitions.java \
|
||||
examples/java/includes/include.re \
|
||||
examples/java/reuse/reuse.re \
|
||||
examples/java/reuse/usedir.re \
|
||||
examples/java/state/push.re \
|
||||
examples/java/submatch/01_stags_fill.re \
|
||||
examples/java/submatch/01_stags.re \
|
||||
examples/java/submatch/02_mtags.re \
|
||||
examples/java/submatch/03_captures.re \
|
||||
examples/java/submatch/04_posix_captures.re \
|
||||
examples/js/01_basic.js \
|
||||
examples/js/01_basic.re \
|
||||
examples/js/conditions/parse_u32_blocks.re \
|
||||
examples/js/conditions/parse_u32_conditions.re \
|
||||
examples/js/encodings/unicode_identifier.re \
|
||||
examples/js/eof/01_sentinel.re \
|
||||
examples/js/eof/02_bounds_checking.re \
|
||||
examples/js/eof/03_eof_rule.re \
|
||||
examples/js/eof/04_fake_sentinel.re \
|
||||
examples/js/fill/01_fill.re \
|
||||
examples/js/fill/02_fill.re \
|
||||
examples/js/headers/header.re \
|
||||
examples/js/headers/lexer/state.js \
|
||||
examples/js/includes/definitions.js \
|
||||
examples/js/includes/include.re \
|
||||
examples/js/reuse/reuse.re \
|
||||
examples/js/reuse/usedir.re \
|
||||
examples/js/state/push.re \
|
||||
examples/js/submatch/01_stags_fill.re \
|
||||
examples/js/submatch/01_stags.re \
|
||||
examples/js/submatch/02_mtags.re \
|
||||
examples/js/submatch/03_captures.re \
|
||||
examples/js/submatch/04_posix_captures.re \
|
||||
examples/ocaml/01_basic.ml \
|
||||
examples/ocaml/01_basic.re \
|
||||
examples/ocaml/conditions/parse_u32_blocks.re \
|
||||
examples/ocaml/conditions/parse_u32_conditions.re \
|
||||
examples/ocaml/encodings/unicode_identifier.re \
|
||||
examples/ocaml/eof/01_sentinel.re \
|
||||
examples/ocaml/eof/02_bounds_checking.re \
|
||||
examples/ocaml/eof/03_eof_rule.re \
|
||||
examples/ocaml/eof/04_fake_sentinel.re \
|
||||
examples/ocaml/fill/01_fill.re \
|
||||
examples/ocaml/fill/02_fill.re \
|
||||
examples/ocaml/headers/header.re \
|
||||
examples/ocaml/headers/lexer/state.ml \
|
||||
examples/ocaml/includes/definitions.ml \
|
||||
examples/ocaml/includes/include.re \
|
||||
examples/ocaml/reuse/reuse.re \
|
||||
examples/ocaml/reuse/usedir.re \
|
||||
examples/ocaml/state/push.re \
|
||||
examples/ocaml/submatch/01_stags_fill.re \
|
||||
examples/ocaml/submatch/01_stags.re \
|
||||
examples/ocaml/submatch/02_mtags.re \
|
||||
examples/ocaml/submatch/03_captures.re \
|
||||
examples/ocaml/submatch/04_posix_captures.re \
|
||||
examples/python/01_basic.py \
|
||||
examples/python/01_basic.re \
|
||||
examples/python/conditions/parse_u32_blocks.re \
|
||||
examples/python/conditions/parse_u32_conditions.re \
|
||||
examples/python/encodings/unicode_identifier.re \
|
||||
examples/python/eof/01_sentinel.re \
|
||||
examples/python/eof/02_bounds_checking.re \
|
||||
examples/python/eof/03_eof_rule.re \
|
||||
examples/python/eof/04_fake_sentinel.re \
|
||||
examples/python/fill/01_fill.re \
|
||||
examples/python/fill/02_fill.re \
|
||||
examples/python/headers/header.re \
|
||||
examples/python/headers/lexer/state.py \
|
||||
examples/python/includes/definitions.py \
|
||||
examples/python/includes/include.re \
|
||||
examples/python/reuse/reuse.re \
|
||||
examples/python/reuse/usedir.re \
|
||||
examples/python/state/push.re \
|
||||
examples/python/submatch/01_stags_fill.re \
|
||||
examples/python/submatch/01_stags.re \
|
||||
examples/python/submatch/02_mtags.re \
|
||||
examples/python/submatch/03_captures.re \
|
||||
examples/python/submatch/04_posix_captures.re \
|
||||
examples/rust/01_basic.re \
|
||||
examples/rust/01_basic.rs \
|
||||
examples/rust/conditions/parse_u32_blocks.re \
|
||||
@@ -278,50 +461,152 @@ re2c_SRC_DOC_EXT = \
|
||||
examples/rust/eof/01_sentinel.re \
|
||||
examples/rust/eof/02_bounds_checking.re \
|
||||
examples/rust/eof/03_eof_rule.re \
|
||||
examples/rust/eof/05_generic_api_eof_rule.re \
|
||||
examples/rust/eof/04_fake_sentinel.re \
|
||||
examples/rust/fill/01_fill.re \
|
||||
examples/rust/fill/02_fill.re \
|
||||
examples/rust/headers/header.re \
|
||||
examples/rust/headers/lexer/state.rs \
|
||||
examples/rust/includes/include.re \
|
||||
examples/rust/includes/definitions.rs \
|
||||
examples/rust/includes/include.re \
|
||||
examples/rust/real_world/c.re \
|
||||
examples/rust/reuse/reuse.re \
|
||||
examples/rust/reuse/usedir.re \
|
||||
examples/rust/state/push.re \
|
||||
examples/rust/submatch/01_stags_fill.re \
|
||||
examples/rust/submatch/01_stags.re \
|
||||
examples/rust/submatch/02_mtags.re \
|
||||
examples/rust/submatch/03_posix.re
|
||||
|
||||
DOC_C = doc/re2c.1
|
||||
DOCS = $(DOC_C)
|
||||
examples/rust/submatch/03_captures.re \
|
||||
examples/rust/submatch/04_posix_captures.re \
|
||||
examples/v/01_basic.re \
|
||||
examples/v/01_basic.v \
|
||||
examples/v/conditions/parse_u32_blocks.re \
|
||||
examples/v/conditions/parse_u32_conditions.re \
|
||||
examples/v/encodings/unicode_identifier.re \
|
||||
examples/v/eof/01_sentinel.re \
|
||||
examples/v/eof/02_bounds_checking.re \
|
||||
examples/v/eof/03_eof_rule.re \
|
||||
examples/v/eof/04_fake_sentinel.re \
|
||||
examples/v/fill/01_fill.re \
|
||||
examples/v/fill/02_fill.re \
|
||||
examples/v/headers/header.re \
|
||||
examples/v/headers/lexer/state.v \
|
||||
examples/v/includes/definitions.v \
|
||||
examples/v/includes/include.re \
|
||||
examples/v/reuse/reuse.re \
|
||||
examples/v/reuse/usedir.re \
|
||||
examples/v/state/push.re \
|
||||
examples/v/submatch/01_stags_fill.re \
|
||||
examples/v/submatch/01_stags.re \
|
||||
examples/v/submatch/02_mtags.re \
|
||||
examples/v/submatch/03_captures.re \
|
||||
examples/v/submatch/04_posix_captures.re \
|
||||
examples/zig/01_basic.re \
|
||||
examples/zig/01_basic.zig \
|
||||
examples/zig/conditions/parse_u32_blocks.re \
|
||||
examples/zig/conditions/parse_u32_conditions.re \
|
||||
examples/zig/encodings/unicode_identifier.re \
|
||||
examples/zig/eof/01_sentinel.re \
|
||||
examples/zig/eof/02_bounds_checking.re \
|
||||
examples/zig/eof/03_eof_rule.re \
|
||||
examples/zig/eof/04_fake_sentinel.re \
|
||||
examples/zig/fill/01_fill.re \
|
||||
examples/zig/fill/02_fill.re \
|
||||
examples/zig/headers/header.re \
|
||||
examples/zig/headers/lexer/state.zig \
|
||||
examples/zig/includes/definitions.zig \
|
||||
examples/zig/includes/include.re \
|
||||
examples/zig/reuse/reuse.re \
|
||||
examples/zig/reuse/usedir.re \
|
||||
examples/zig/state/push.re \
|
||||
examples/zig/submatch/01_stags_fill.re \
|
||||
examples/zig/submatch/01_stags.re \
|
||||
examples/zig/submatch/02_mtags.re \
|
||||
examples/zig/submatch/03_captures.re \
|
||||
examples/zig/submatch/04_posix_captures.re
|
||||
|
||||
DOCS = doc/re2c.1
|
||||
HELP = src/msg/help_re2c.cc
|
||||
if WITH_DLANG
|
||||
DOCS += doc/re2d.1
|
||||
HELP += src/msg/help_re2d.cc
|
||||
endif
|
||||
if WITH_GOLANG
|
||||
DOC_GO = doc/re2go.1
|
||||
DOCS += $(DOC_GO)
|
||||
DOCS += doc/re2go.1
|
||||
HELP += src/msg/help_re2go.cc
|
||||
endif
|
||||
if WITH_HASKELL
|
||||
DOCS += doc/re2hs.1
|
||||
HELP += src/msg/help_re2hs.cc
|
||||
endif
|
||||
if WITH_JAVA
|
||||
DOCS += doc/re2java.1
|
||||
HELP += src/msg/help_re2java.cc
|
||||
endif
|
||||
if WITH_JS
|
||||
DOCS += doc/re2js.1
|
||||
HELP += src/msg/help_re2js.cc
|
||||
endif
|
||||
if WITH_OCAML
|
||||
DOCS += doc/re2ocaml.1
|
||||
HELP += src/msg/help_re2ocaml.cc
|
||||
endif
|
||||
if WITH_PYTHON
|
||||
DOCS += doc/re2py.1
|
||||
HELP += src/msg/help_re2py.cc
|
||||
endif
|
||||
|
||||
if WITH_RUST
|
||||
DOC_RUST = doc/re2rust.1
|
||||
DOCS += $(DOC_RUST)
|
||||
DOCS += doc/re2rust.1
|
||||
HELP += src/msg/help_re2rust.cc
|
||||
endif
|
||||
if WITH_VLANG
|
||||
DOCS += doc/re2v.1
|
||||
HELP += src/msg/help_re2v.cc
|
||||
endif
|
||||
if WITH_ZIG
|
||||
DOCS += doc/re2zig.1
|
||||
HELP += src/msg/help_re2zig.cc
|
||||
endif
|
||||
BUILT_SOURCES += $(HELP)
|
||||
|
||||
man_MANS = $(DOCS)
|
||||
|
||||
# include files (stdlib)
|
||||
dist_stdlib_DATA = include/unicode_categories.re
|
||||
dist_stdlib_DATA = \
|
||||
include/syntax/c \
|
||||
include/syntax/d \
|
||||
include/syntax/go \
|
||||
include/syntax/haskell \
|
||||
include/syntax/java \
|
||||
include/syntax/js \
|
||||
include/syntax/ocaml \
|
||||
include/syntax/python \
|
||||
include/syntax/rust \
|
||||
include/syntax/v \
|
||||
include/syntax/zig \
|
||||
include/unicode_categories.re
|
||||
|
||||
BAZELFILES := \
|
||||
BUILD.bazel \
|
||||
WORKSPACE \
|
||||
bazel
|
||||
|
||||
CMAKEFILES := \
|
||||
CMakeLists.txt \
|
||||
CMakePresets.json \
|
||||
cmake
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(re2c_BOOT) \
|
||||
$(re2c_CUSTOM) \
|
||||
$(re2c_SRC_DOC_EXT) \
|
||||
$(BAZELFILES) \
|
||||
$(CMAKEFILES) \
|
||||
BUILD.md \
|
||||
CHANGELOG \
|
||||
CONTRIBUTING.md \
|
||||
IDEAS.md \
|
||||
LICENSE \
|
||||
MAINTAINERS.md \
|
||||
NO_WARRANTY \
|
||||
README.md \
|
||||
autogen.sh \
|
||||
@@ -331,14 +616,31 @@ EXTRA_DIST = \
|
||||
|
||||
CLEANFILES = \
|
||||
$(re2c_GEN) \
|
||||
$(DOCS)
|
||||
$(re2c_GEN_HELP) \
|
||||
$(DOCS) \
|
||||
$(HELP)
|
||||
|
||||
if REBUILD_SYNTAX
|
||||
STX2CPP = $(top_srcdir)/build/stx2cpp.py
|
||||
# generate C++ sources from syntax configs and update bootstrap files
|
||||
.stx.cc:
|
||||
$(AM_V_at)$(MKDIR_P) $(@D)
|
||||
$(AM_V_GEN)$(PYTHON) $(STX2CPP) $< $@
|
||||
$(AM_V_GEN)cp -f $@ $(top_srcdir)/bootstrap/$@
|
||||
else
|
||||
# copy bootstrap files
|
||||
.stx.cc:
|
||||
$(AM_V_at)$(MKDIR_P) $(@D)
|
||||
$(AM_V_GEN)cp $(top_srcdir)/bootstrap/$@ $(@D)
|
||||
$(AM_V_at)echo "Reconfigure with --enable-syntax to regenerate $@"
|
||||
endif
|
||||
|
||||
if REBUILD_LEXERS
|
||||
# generate lexer and update bootstrap files
|
||||
.re.cc:
|
||||
$(AM_V_at)$(MKDIR_P) $(@D)
|
||||
$(AM_V_GEN)$(RE2C_FOR_BUILD) $(RE2CFLAGS) -o $@ $<
|
||||
$(AM_V_GEN)cp $(@:cc=[ch]*) $(top_srcdir)/bootstrap/$(@D);
|
||||
$(AM_V_GEN)cp $(@:cc=[ch]*) $(top_srcdir)/bootstrap/$(@D)
|
||||
else
|
||||
# copy bootstrap files
|
||||
.re.cc:
|
||||
@@ -352,17 +654,18 @@ if REBUILD_PARSERS
|
||||
.ypp.cc:
|
||||
$(AM_V_at)$(MKDIR_P) $(@D)
|
||||
$(AM_V_GEN)$(BISON) --warnings --output=$@ --defines=$(@:cc=h) $<
|
||||
$(AM_V_GEN)cp $@ $(@:cc=h) $(top_srcdir)/bootstrap/$(@D);
|
||||
$(AM_V_GEN)cp $@ $(@:cc=h) $(top_srcdir)/bootstrap/$(@D)
|
||||
else
|
||||
# copy bootstrap files
|
||||
.ypp.cc:
|
||||
$(AM_V_at)$(MKDIR_P) $(@D)
|
||||
$(AM_V_GEN)cp $(top_srcdir)/bootstrap/$(@:cc=*) $(@D);
|
||||
$(AM_V_GEN)cp $(top_srcdir)/bootstrap/$(@:cc=*) $(@D)
|
||||
$(AM_V_at)echo "Reconfigure with --enable-parsers to regenerate $@"
|
||||
endif
|
||||
|
||||
# lexer depends on bison-generated header
|
||||
$(re2c_GEN_LEX): $(re2c_GEN_PARSER)
|
||||
# re2c-generated lexer depends on bison-generated parser header (generated by the parser rule)
|
||||
src/parse/lexer.cc : src/parse/parser.cc
|
||||
src/parse/conf_lexer.cc : src/parse/conf_parser.cc
|
||||
|
||||
# rebuild all re2c sources using newly built re2c
|
||||
.PHONY: bootstrap
|
||||
@@ -372,55 +675,33 @@ bootstrap: all
|
||||
|
||||
.PHONY: docs
|
||||
if REBUILD_DOCS
|
||||
docs: $(DOCS) $(re2c_GEN_HELP)
|
||||
RST2TXT = $(top_srcdir)/build/rst2txt.py
|
||||
RST2MAN = $(top_srcdir)/build/rst2man.py
|
||||
SPLITMAN = $(top_srcdir)/build/split_man.py
|
||||
# generate manpage for C
|
||||
$(DOC_C): $(re2c_SRC_DOC) $(re2c_SRC_DOC_EXT) $(SPLITMAN) $(RST2MAN)
|
||||
docs: $(DOCS) $(HELP) $(SPLITMAN) $(RST2MAN) $(RST2TXT)
|
||||
# generate manpage
|
||||
.rst.1:
|
||||
$(AM_V_at)$(MKDIR_P) $(@D)
|
||||
$(AM_V_GEN)$(PYTHON) $(SPLITMAN) $(top_builddir)/$(re2c_SRC_DOC) $(top_builddir)/$(re2c_SRC_DOC).c c \
|
||||
&& $(PYTHON) $(RST2MAN) --tab-width=4 $(top_builddir)/$(re2c_SRC_DOC).c > $@ \
|
||||
&& cp $@ $(top_srcdir)/$(re2c_BOOT_DOC_C) \
|
||||
&& rm $(top_builddir)/$(re2c_SRC_DOC).c
|
||||
# generate manpage for Go
|
||||
$(DOC_GO): $(re2c_SRC_DOC) $(re2c_SRC_DOC_EXT) $(SPLITMAN) $(RST2MAN)
|
||||
$(AM_V_at)$(MKDIR_P) $(@D)
|
||||
$(AM_V_GEN)$(PYTHON) $(SPLITMAN) $(top_builddir)/$(re2c_SRC_DOC) $(top_builddir)/$(re2c_SRC_DOC).go go \
|
||||
&& $(PYTHON) $(RST2MAN) --tab-width=4 $(top_builddir)/$(re2c_SRC_DOC).go > $@ \
|
||||
&& cp $@ $(top_srcdir)/$(re2c_BOOT_DOC_GO) \
|
||||
&& rm $(top_builddir)/$(re2c_SRC_DOC).go
|
||||
# generate manpage for Rust
|
||||
$(DOC_RUST): $(re2c_SRC_DOC) $(re2c_SRC_DOC_EXT) $(SPLITMAN) $(RST2MAN)
|
||||
$(AM_V_at)$(MKDIR_P) $(@D)
|
||||
$(AM_V_GEN)$(PYTHON) $(SPLITMAN) $(top_builddir)/$(re2c_SRC_DOC) $(top_builddir)/$(re2c_SRC_DOC).rust rust \
|
||||
&& $(PYTHON) $(RST2MAN) --tab-width=4 $(top_builddir)/$(re2c_SRC_DOC).rust > $@ \
|
||||
&& cp $@ $(top_srcdir)/$(re2c_BOOT_DOC_RUST) \
|
||||
&& rm $(top_builddir)/$(re2c_SRC_DOC).rust
|
||||
$(AM_V_GEN)$(PYTHON) $(SPLITMAN) $(top_builddir)/$< $(top_builddir)/$< \
|
||||
&& $(PYTHON) $(RST2MAN) --tab-width=4 $(top_builddir)/$< > $@ \
|
||||
&& cp $@ $(top_srcdir)/bootstrap/$@
|
||||
# generate help
|
||||
$(re2c_GEN_HELP): $(re2c_CUSTOM_HELP) $(re2c_SRC_DOC_EXT) $(RST2TXT)
|
||||
.rst.cc:
|
||||
$(AM_V_at)$(MKDIR_P) $(@D)
|
||||
$(AM_V_GEN)$(PYTHON) $(RST2TXT) --variable-name=help $(top_builddir)/$(re2c_CUSTOM_HELP) $@ \
|
||||
&& cp $@ $(top_srcdir)/$(re2c_BOOT_HELP)
|
||||
$(AM_V_GEN)$(PYTHON) $(SPLITMAN) $(top_builddir)/$< $(top_builddir)/$< \
|
||||
&& $(PYTHON) $(RST2TXT) --variable-name=help $(top_builddir)/$< $@ \
|
||||
&& cp $@ $(top_srcdir)/bootstrap/$@
|
||||
else
|
||||
docs: $(DOCS) $(re2c_GEN_HELP)
|
||||
docs: $(DOCS) $(HELP)
|
||||
$(AM_V_at)echo "Reconfigure with --enable-docs to rebuild docs"
|
||||
# copy bootstrap manpage for C
|
||||
$(DOC_C): $(re2c_BOOT_DOC_C)
|
||||
# copy bootstrap manpage
|
||||
.rst.1:
|
||||
$(AM_V_at)$(MKDIR_P) $(@D)
|
||||
$(AM_V_GEN)cp $(top_srcdir)/$(re2c_BOOT_DOC_C) $@
|
||||
# copy bootstrap manpage for Go
|
||||
$(DOC_GO): $(re2c_BOOT_DOC_GO)
|
||||
$(AM_V_at)$(MKDIR_P) $(@D)
|
||||
$(AM_V_GEN)cp $(top_srcdir)/$(re2c_BOOT_DOC_GO) $@
|
||||
# copy bootstrap manpage for Rust
|
||||
$(DOC_RUST): $(re2c_BOOT_DOC_RUST)
|
||||
$(AM_V_at)$(MKDIR_P) $(@D)
|
||||
$(AM_V_GEN)cp $(top_srcdir)/$(re2c_BOOT_DOC_RUST) $@
|
||||
$(AM_V_GEN)cp $(top_srcdir)/bootstrap/$@ $@
|
||||
# copy bootstrap help
|
||||
$(re2c_GEN_HELP): $(re2c_BOOT_HELP)
|
||||
.rst.cc:
|
||||
$(AM_V_at)$(MKDIR_P) $(@D)
|
||||
$(AM_V_GEN)cp $(top_srcdir)/$(re2c_BOOT_HELP) $@
|
||||
$(AM_V_GEN)cp $(top_srcdir)/bootstrap/$@ $@
|
||||
endif
|
||||
|
||||
all-local: docs $(re2c_BOOT_PARSER)
|
||||
@@ -437,6 +718,9 @@ vtests: all $(re2c_TESTSUITE)
|
||||
wtests: all $(re2c_TESTSUITE)
|
||||
$(PYTHON) $(top_builddir)/$(re2c_TESTSUITE) --wine -j1
|
||||
|
||||
re2c_test_list_SOURCES = \
|
||||
src/test/list/test.cc
|
||||
|
||||
re2c_test_range_SOURCES = \
|
||||
src/test/range/test-impl.h \
|
||||
src/test/range/test.cc \
|
||||
@@ -450,12 +734,13 @@ re2c_test_s_to_n32_unsafe_SOURCES = \
|
||||
|
||||
re2c_test_ver_to_vernum_SOURCES = \
|
||||
src/test/ver_to_vernum/test.cc \
|
||||
$(re2c_GEN_VER_TO_VERNUM)
|
||||
src/msg/ver_to_vernum.cc
|
||||
|
||||
re2c_test_argsubst_SOURCES = \
|
||||
src/test/argsubst/test.cc
|
||||
|
||||
check_PROGRAMS = \
|
||||
re2c_test_list \
|
||||
re2c_test_range \
|
||||
re2c_test_s_to_n32_unsafe \
|
||||
re2c_test_ver_to_vernum \
|
||||
@@ -478,18 +763,82 @@ lib_LTLIBRARIES =
|
||||
include $(top_srcdir)/Makefile.lib.am
|
||||
endif
|
||||
|
||||
# re2d
|
||||
if WITH_DLANG
|
||||
bin_PROGRAMS += re2d
|
||||
re2d_CXXFLAGS = $(AM_CXXFLAGS) -DRE2C_LANG=Lang::D -DRE2C_PROG=\"re2d\"
|
||||
re2d_SOURCES = $(re2c_SOURCES)
|
||||
nodist_re2d_SOURCES = $(re2c_GEN) src/msg/help_re2d.cc
|
||||
endif
|
||||
|
||||
# re2go
|
||||
if WITH_GOLANG
|
||||
bin_PROGRAMS += re2go
|
||||
re2go_CXXFLAGS = $(AM_CXXFLAGS) -DRE2C_LANG=Lang::GO
|
||||
re2go_CXXFLAGS = $(AM_CXXFLAGS) -DRE2C_LANG=Lang::GO -DRE2C_PROG=\"re2go\"
|
||||
re2go_SOURCES = $(re2c_SOURCES)
|
||||
nodist_re2go_SOURCES = $(nodist_re2c_SOURCES)
|
||||
nodist_re2go_SOURCES = $(re2c_GEN) src/msg/help_re2go.cc
|
||||
endif
|
||||
|
||||
# re2hs
|
||||
if WITH_HASKELL
|
||||
bin_PROGRAMS += re2hs
|
||||
re2hs_CXXFLAGS = $(AM_CXXFLAGS) -DRE2C_LANG=Lang::HASKELL -DRE2C_PROG=\"re2hs\"
|
||||
re2hs_SOURCES = $(re2c_SOURCES)
|
||||
nodist_re2hs_SOURCES = $(re2c_GEN) src/msg/help_re2hs.cc
|
||||
endif
|
||||
|
||||
# re2java
|
||||
if WITH_JAVA
|
||||
bin_PROGRAMS += re2java
|
||||
re2java_CXXFLAGS = $(AM_CXXFLAGS) -DRE2C_LANG=Lang::JAVA -DRE2C_PROG=\"re2java\"
|
||||
re2java_SOURCES = $(re2c_SOURCES)
|
||||
nodist_re2java_SOURCES = $(re2c_GEN) src/msg/help_re2java.cc
|
||||
endif
|
||||
|
||||
# re2js
|
||||
if WITH_JS
|
||||
bin_PROGRAMS += re2js
|
||||
re2js_CXXFLAGS = $(AM_CXXFLAGS) -DRE2C_LANG=Lang::JS -DRE2C_PROG=\"re2js\"
|
||||
re2js_SOURCES = $(re2c_SOURCES)
|
||||
nodist_re2js_SOURCES = $(re2c_GEN) src/msg/help_re2js.cc
|
||||
endif
|
||||
|
||||
# re2ocaml
|
||||
if WITH_OCAML
|
||||
bin_PROGRAMS += re2ocaml
|
||||
re2ocaml_CXXFLAGS = $(AM_CXXFLAGS) -DRE2C_LANG=Lang::OCAML -DRE2C_PROG=\"re2ocaml\"
|
||||
re2ocaml_SOURCES = $(re2c_SOURCES)
|
||||
nodist_re2ocaml_SOURCES = $(re2c_GEN) src/msg/help_re2ocaml.cc
|
||||
endif
|
||||
|
||||
# re2py
|
||||
if WITH_PYTHON
|
||||
bin_PROGRAMS += re2py
|
||||
re2py_CXXFLAGS = $(AM_CXXFLAGS) -DRE2C_LANG=Lang::PYTHON -DRE2C_PROG=\"re2py\"
|
||||
re2py_SOURCES = $(re2c_SOURCES)
|
||||
nodist_re2py_SOURCES = $(re2c_GEN) src/msg/help_re2py.cc
|
||||
endif
|
||||
|
||||
# re2rust
|
||||
if WITH_RUST
|
||||
bin_PROGRAMS += re2rust
|
||||
re2rust_CXXFLAGS = $(AM_CXXFLAGS) -DRE2C_LANG=Lang::RUST
|
||||
re2rust_CXXFLAGS = $(AM_CXXFLAGS) -DRE2C_LANG=Lang::RUST -DRE2C_PROG=\"re2rust\"
|
||||
re2rust_SOURCES = $(re2c_SOURCES)
|
||||
nodist_re2rust_SOURCES = $(nodist_re2c_SOURCES)
|
||||
nodist_re2rust_SOURCES = $(re2c_GEN) src/msg/help_re2rust.cc
|
||||
endif
|
||||
|
||||
# re2v
|
||||
if WITH_VLANG
|
||||
bin_PROGRAMS += re2v
|
||||
re2v_CXXFLAGS = $(AM_CXXFLAGS) -DRE2C_LANG=Lang::V -DRE2C_PROG=\"re2v\"
|
||||
re2v_SOURCES = $(re2c_SOURCES)
|
||||
nodist_re2v_SOURCES = $(re2c_GEN) src/msg/help_re2v.cc
|
||||
endif
|
||||
|
||||
# re2zig
|
||||
if WITH_ZIG
|
||||
bin_PROGRAMS += re2zig
|
||||
re2zig_CXXFLAGS = $(AM_CXXFLAGS) -DRE2C_LANG=Lang::ZIG -DRE2C_PROG=\"re2zig\"
|
||||
re2zig_SOURCES = $(re2c_SOURCES)
|
||||
nodist_re2zig_SOURCES = $(re2c_GEN) src/msg/help_re2zig.cc
|
||||
endif
|
||||
|
||||
@@ -38,7 +38,6 @@ libre2c_la_HDR = \
|
||||
src/regexp/regexp.h \
|
||||
src/regexp/rule.h \
|
||||
src/regexp/tag.h \
|
||||
src/compile.h \
|
||||
src/skeleton/path.h \
|
||||
src/skeleton/skeleton.h \
|
||||
src/parse/ast.h \
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
workspace(name = "re2c")
|
||||
|
||||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
|
||||
http_archive(
|
||||
name = "bazel_skylib",
|
||||
urls = [
|
||||
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
|
||||
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
|
||||
],
|
||||
sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506",
|
||||
)
|
||||
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
|
||||
bazel_skylib_workspace()
|
||||
@@ -0,0 +1,13 @@
|
||||
package(default_visibility = ["//visibility:private"])
|
||||
|
||||
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
|
||||
|
||||
exports_files([
|
||||
"re2c_config.h",
|
||||
])
|
||||
|
||||
bzl_library(
|
||||
name = "re2c_bzl",
|
||||
srcs = ["re2c.bzl"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
@@ -0,0 +1,70 @@
|
||||
# re2c generator rules - assuming that re2c is available as '@re2c//:re2c'.
|
||||
|
||||
load("@bazel_skylib//lib:paths.bzl", "paths")
|
||||
|
||||
visibility("public")
|
||||
|
||||
# Define supported extensions as defined by:
|
||||
# . https://bazel.build/reference/be/c-cpp#cc_library_args
|
||||
# . https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/rules/cpp/CppFileTypes.java
|
||||
_C_SRC_EXT = [".c", ".cc", ".cpp", ".cxx", ".c++", ".C", ".cu", ".cl"]
|
||||
_C_HDR_EXT = [".h", ".hh", ".hpp", ".ipp", ".hxx", ".h++", ".inc", ".inl", ".tlh", ".tli", ".H", ".tcc"]
|
||||
_RE2C_EXT = [".re", ".re2c"]
|
||||
|
||||
def _re2c_impl(ctx):
|
||||
srcs = ctx.files.srcs
|
||||
if len(srcs) != 1:
|
||||
fail("Attribute `srcs` must contain exactly 1 re2c source file ({exts}).".format(exts = ", ".join(_RE2C_EXT)))
|
||||
outs = ctx.outputs.outs
|
||||
if not outs or [o for o in outs if paths.split_extension(o.path)[1] not in _C_SRC_EXT + _C_HDR_EXT]:
|
||||
fail("Attribute `outs` must contain at least 1 C/C++ shource or header file ({exts}).".format(exts = ", ".join(_C_SRC_EXT + _C_HDR_EXT)))
|
||||
ctx.actions.run_shell(
|
||||
outputs = outs,
|
||||
tools = [ctx.executable._re2c_tool],
|
||||
inputs = ctx.files.srcs + ctx.files.data,
|
||||
command = """
|
||||
"{re2c}" "{src}" -o "{out}" {re2c_args} {includes}
|
||||
""".format(
|
||||
re2c = ctx.executable._re2c_tool.path,
|
||||
src = srcs[0].path,
|
||||
out = outs[0].path,
|
||||
includes = " ".join(list(dict([("-I" + f.dirname, 1) for f in ctx.files.data]))),
|
||||
re2c_args = " ".join(ctx.attr.re2c_args),
|
||||
),
|
||||
mnemonic = "RE2C",
|
||||
progress_message = "Generating re2c %{label}",
|
||||
)
|
||||
|
||||
_re2c_attr = {
|
||||
"srcs": attr.label_list(
|
||||
doc = "The re2c source.",
|
||||
allow_files = _RE2C_EXT,
|
||||
mandatory = True,
|
||||
),
|
||||
"data": attr.label_list(
|
||||
doc = "Other input data files (e.g. include files).",
|
||||
allow_files = _C_SRC_EXT + _C_HDR_EXT,
|
||||
mandatory = False,
|
||||
),
|
||||
"outs": attr.output_list(
|
||||
doc = "The generated output source.",
|
||||
mandatory = True,
|
||||
),
|
||||
"re2c_args": attr.string_list(
|
||||
doc = "Arguments to re2c invocation.",
|
||||
),
|
||||
"_re2c_tool": attr.label(
|
||||
doc = "The target of the 're2c' executable.",
|
||||
default = Label("//:re2c"),
|
||||
allow_single_file = True,
|
||||
executable = True,
|
||||
cfg = "exec",
|
||||
),
|
||||
}
|
||||
|
||||
re2c_gen = rule(
|
||||
attrs = _re2c_attr,
|
||||
doc = """Use re2c tool to create an output file (e.g. '.cc') from a '.re' input.""",
|
||||
output_to_genfiles = True,
|
||||
implementation = _re2c_impl,
|
||||
)
|
||||
@@ -0,0 +1,4 @@
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
#define HAVE_FCNTL_H 1
|
||||
#define HAVE_UNISTD_H 1
|
||||
@@ -12,6 +12,9 @@ target_link_libraries(bench_submatch_dfa_jit benchmark::benchmark)
|
||||
find_path(RE2_INCLUDE_DIRECTORY "re2/re2.h")
|
||||
find_library(RE2_LIBRARY re2)
|
||||
if(RE2_INCLUDE_DIRECTORY AND RE2_LIBRARY)
|
||||
set_target_properties(bench_submatch_dfa_jit PROPERTIES
|
||||
CXX_STANDARD 17
|
||||
CXX_STANDARD_REQUIRED ON)
|
||||
target_compile_definitions(bench_submatch_dfa_jit PRIVATE "HAVE_RE2_RE2_H=1")
|
||||
target_include_directories(bench_submatch_dfa_jit PRIVATE "${RE2_INCLUDE_DIRECTORY}")
|
||||
target_link_libraries(bench_submatch_dfa_jit "${RE2_LIBRARY}")
|
||||
|
||||
@@ -12,6 +12,9 @@ target_link_libraries(bench_submatch_nfa benchmark::benchmark)
|
||||
find_path(RE2_INCLUDE_DIRECTORY "re2/re2.h")
|
||||
find_library(RE2_LIBRARY re2)
|
||||
if(RE2_INCLUDE_DIRECTORY AND RE2_LIBRARY)
|
||||
set_target_properties(bench_submatch_nfa PROPERTIES
|
||||
CXX_STANDARD 17
|
||||
CXX_STANDARD_REQUIRED ON)
|
||||
target_compile_definitions(bench_submatch_nfa PRIVATE "HAVE_RE2_RE2_H=1")
|
||||
target_include_directories(bench_submatch_nfa PRIVATE "${RE2_INCLUDE_DIRECTORY}")
|
||||
target_link_libraries(bench_submatch_nfa "${RE2_LIBRARY}")
|
||||
|
||||
+1953
-1209
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+2124
-1461
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+2140
-1501
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+62
-64
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 3.0 */
|
||||
/* Generated by re2c 4.0 */
|
||||
#line 1 "../lib/lex.re"
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
@@ -20,7 +20,7 @@ static int32_t lex_cls_chr(const uint8_t*&, uint32_t&);
|
||||
#line 27 "../lib/lex.re"
|
||||
|
||||
|
||||
int lex(YYSTYPE* yylval, const uint8_t*& cur, Ast& ast) {
|
||||
int lex(RE2C_LIB_STYPE* yylval, const uint8_t*& cur, Ast& ast) {
|
||||
|
||||
#line 26 "lib/lex.cc"
|
||||
const uint8_t* yyt1;const uint8_t* yyt2;
|
||||
@@ -34,39 +34,39 @@ const uint8_t* yyt1;const uint8_t* yyt2;
|
||||
#line 35 "lib/lex.cc"
|
||||
{
|
||||
uint8_t yych;
|
||||
static const unsigned char yybm[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
128, 128, 128, 128, 128, 128, 128, 128,
|
||||
128, 128, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
static const unsigned char yybm[256] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
128, 128, 128, 128, 128, 128, 128, 128,
|
||||
128, 128, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
yych = *cur;
|
||||
if (yych <= '>') {
|
||||
@@ -152,9 +152,7 @@ yy9:
|
||||
#line 153 "lib/lex.cc"
|
||||
yy10:
|
||||
yych = *++cur;
|
||||
if (yybm[0+yych] & 128) {
|
||||
goto yy10;
|
||||
}
|
||||
if (yybm[0+yych] & 128) goto yy10;
|
||||
if (yych == ',') goto yy12;
|
||||
if (yych == '}') goto yy13;
|
||||
yy11:
|
||||
@@ -178,7 +176,7 @@ yy13:
|
||||
yylval->bounds.max = yylval->bounds.min;
|
||||
return TOKEN_COUNT;
|
||||
}
|
||||
#line 182 "lib/lex.cc"
|
||||
#line 180 "lib/lex.cc"
|
||||
yy14:
|
||||
yych = *++cur;
|
||||
if (yych <= '/') goto yy11;
|
||||
@@ -194,7 +192,7 @@ yy15:
|
||||
yylval->bounds.max = Ast::MANY;
|
||||
return TOKEN_COUNT;
|
||||
}
|
||||
#line 198 "lib/lex.cc"
|
||||
#line 196 "lib/lex.cc"
|
||||
yy16:
|
||||
++cur;
|
||||
x = yyt1;
|
||||
@@ -205,7 +203,7 @@ yy16:
|
||||
|| !s_to_u32_unsafe(y, cur - 1, yylval->bounds.max)) goto err_cnt;
|
||||
return TOKEN_COUNT;
|
||||
}
|
||||
#line 209 "lib/lex.cc"
|
||||
#line 207 "lib/lex.cc"
|
||||
}
|
||||
#line 78 "../lib/lex.re"
|
||||
|
||||
@@ -213,7 +211,7 @@ yy16:
|
||||
cls:
|
||||
if (lex_cls_chr(cur, l) != 0) goto err;
|
||||
|
||||
#line 217 "lib/lex.cc"
|
||||
#line 215 "lib/lex.cc"
|
||||
{
|
||||
uint8_t yych;
|
||||
yych = *(mar = cur);
|
||||
@@ -221,7 +219,7 @@ cls:
|
||||
yy18:
|
||||
#line 83 "../lib/lex.re"
|
||||
{ u = l; goto add; }
|
||||
#line 225 "lib/lex.cc"
|
||||
#line 223 "lib/lex.cc"
|
||||
yy19:
|
||||
yych = *++cur;
|
||||
if (yych != ']') goto yy20;
|
||||
@@ -232,7 +230,7 @@ yy20:
|
||||
cur -= 1;
|
||||
#line 84 "../lib/lex.re"
|
||||
{ if (lex_cls_chr(cur, u) != 0) goto err; goto add; }
|
||||
#line 236 "lib/lex.cc"
|
||||
#line 234 "lib/lex.cc"
|
||||
}
|
||||
#line 85 "../lib/lex.re"
|
||||
|
||||
@@ -240,14 +238,14 @@ add:
|
||||
if (l > u) goto err;
|
||||
ast.temp_ranges.push_back(AstRange(l, u, NOWHERE));
|
||||
|
||||
#line 244 "lib/lex.cc"
|
||||
#line 242 "lib/lex.cc"
|
||||
{
|
||||
uint8_t yych;
|
||||
yych = *cur;
|
||||
if (yych == ']') goto yy22;
|
||||
#line 90 "../lib/lex.re"
|
||||
{ goto cls; }
|
||||
#line 251 "lib/lex.cc"
|
||||
#line 249 "lib/lex.cc"
|
||||
yy22:
|
||||
++cur;
|
||||
#line 91 "../lib/lex.re"
|
||||
@@ -255,7 +253,7 @@ yy22:
|
||||
yylval->regexp = ast.cls(NOWHERE, neg);
|
||||
return TOKEN_REGEXP;
|
||||
}
|
||||
#line 259 "lib/lex.cc"
|
||||
#line 257 "lib/lex.cc"
|
||||
}
|
||||
#line 95 "../lib/lex.re"
|
||||
|
||||
@@ -272,7 +270,7 @@ err_cnt:
|
||||
int32_t lex_cls_chr(const uint8_t*& cur, uint32_t& c) {
|
||||
const uint8_t* mar, *p = cur;
|
||||
|
||||
#line 276 "lib/lex.cc"
|
||||
#line 274 "lib/lex.cc"
|
||||
{
|
||||
uint8_t yych;
|
||||
yych = *cur;
|
||||
@@ -285,13 +283,13 @@ yy24:
|
||||
++cur;
|
||||
#line 109 "../lib/lex.re"
|
||||
{ return 1; }
|
||||
#line 289 "lib/lex.cc"
|
||||
#line 287 "lib/lex.cc"
|
||||
yy25:
|
||||
++cur;
|
||||
yy26:
|
||||
#line 127 "../lib/lex.re"
|
||||
{ c = cur[-1]; return 0; }
|
||||
#line 295 "lib/lex.cc"
|
||||
#line 293 "lib/lex.cc"
|
||||
yy27:
|
||||
yych = *++cur;
|
||||
if (yych <= '9') {
|
||||
@@ -320,67 +318,67 @@ yy28:
|
||||
yy29:
|
||||
#line 116 "../lib/lex.re"
|
||||
{ c = '\\'_u8; return 0; }
|
||||
#line 324 "lib/lex.cc"
|
||||
#line 322 "lib/lex.cc"
|
||||
yy30:
|
||||
++cur;
|
||||
#line 110 "../lib/lex.re"
|
||||
{ error("collating characters not supported"); return 1; }
|
||||
#line 329 "lib/lex.cc"
|
||||
#line 327 "lib/lex.cc"
|
||||
yy31:
|
||||
++cur;
|
||||
#line 111 "../lib/lex.re"
|
||||
{ error("character classes not supported"); return 1; }
|
||||
#line 334 "lib/lex.cc"
|
||||
#line 332 "lib/lex.cc"
|
||||
yy32:
|
||||
++cur;
|
||||
#line 112 "../lib/lex.re"
|
||||
{ error("equivalence classes not supported"); return 1; }
|
||||
#line 339 "lib/lex.cc"
|
||||
#line 337 "lib/lex.cc"
|
||||
yy33:
|
||||
++cur;
|
||||
#line 124 "../lib/lex.re"
|
||||
{ c = '\\'_u8; return 0; }
|
||||
#line 344 "lib/lex.cc"
|
||||
#line 342 "lib/lex.cc"
|
||||
yy34:
|
||||
++cur;
|
||||
#line 125 "../lib/lex.re"
|
||||
{ c = ']'_u8; return 0; }
|
||||
#line 349 "lib/lex.cc"
|
||||
#line 347 "lib/lex.cc"
|
||||
yy35:
|
||||
++cur;
|
||||
#line 117 "../lib/lex.re"
|
||||
{ c = '\a'_u8; return 0; }
|
||||
#line 354 "lib/lex.cc"
|
||||
#line 352 "lib/lex.cc"
|
||||
yy36:
|
||||
++cur;
|
||||
#line 118 "../lib/lex.re"
|
||||
{ c = '\b'_u8; return 0; }
|
||||
#line 359 "lib/lex.cc"
|
||||
#line 357 "lib/lex.cc"
|
||||
yy37:
|
||||
++cur;
|
||||
#line 119 "../lib/lex.re"
|
||||
{ c = '\f'_u8; return 0; }
|
||||
#line 364 "lib/lex.cc"
|
||||
#line 362 "lib/lex.cc"
|
||||
yy38:
|
||||
++cur;
|
||||
#line 120 "../lib/lex.re"
|
||||
{ c = '\n'_u8; return 0; }
|
||||
#line 369 "lib/lex.cc"
|
||||
#line 367 "lib/lex.cc"
|
||||
yy39:
|
||||
++cur;
|
||||
#line 121 "../lib/lex.re"
|
||||
{ c = '\r'_u8; return 0; }
|
||||
#line 374 "lib/lex.cc"
|
||||
#line 372 "lib/lex.cc"
|
||||
yy40:
|
||||
++cur;
|
||||
#line 122 "../lib/lex.re"
|
||||
{ c = '\t'_u8; return 0; }
|
||||
#line 379 "lib/lex.cc"
|
||||
#line 377 "lib/lex.cc"
|
||||
yy41:
|
||||
++cur;
|
||||
#line 123 "../lib/lex.re"
|
||||
{ c = '\v'_u8; return 0; }
|
||||
#line 384 "lib/lex.cc"
|
||||
#line 382 "lib/lex.cc"
|
||||
yy42:
|
||||
yych = *++cur;
|
||||
if (yych <= '@') {
|
||||
@@ -408,7 +406,7 @@ yy45:
|
||||
++cur;
|
||||
#line 114 "../lib/lex.re"
|
||||
{ c = unesc_hex(p, cur); return 0; }
|
||||
#line 412 "lib/lex.cc"
|
||||
#line 410 "lib/lex.cc"
|
||||
}
|
||||
#line 128 "../lib/lex.re"
|
||||
|
||||
|
||||
+61
-55
@@ -63,8 +63,14 @@
|
||||
/* Pull parsers. */
|
||||
#define YYPULL 1
|
||||
|
||||
|
||||
|
||||
/* Substitute the type names. */
|
||||
#define YYSTYPE RE2C_LIB_STYPE
|
||||
/* Substitute the variable and function names. */
|
||||
#define yyparse re2c_lib_parse
|
||||
#define yylex re2c_lib_lex
|
||||
#define yyerror re2c_lib_error
|
||||
#define yydebug re2c_lib_debug
|
||||
#define yynerrs re2c_lib_nerrs
|
||||
|
||||
/* First part of user prologue. */
|
||||
#line 9 "../lib/parse.ypp"
|
||||
@@ -83,7 +89,7 @@
|
||||
|
||||
using namespace re2c;
|
||||
|
||||
#line 87 "lib/parse.cc"
|
||||
#line 93 "lib/parse.cc"
|
||||
|
||||
# ifndef YY_CAST
|
||||
# ifdef __cplusplus
|
||||
@@ -134,7 +140,7 @@ typedef enum yysymbol_kind_t yysymbol_kind_t;
|
||||
|
||||
|
||||
/* Second part of user prologue. */
|
||||
#line 38 "../lib/parse.ypp"
|
||||
#line 39 "../lib/parse.ypp"
|
||||
|
||||
extern "C" {
|
||||
static int yylex(YYSTYPE* yylval, const uint8_t*& pattern, Ast& ast);
|
||||
@@ -142,7 +148,7 @@ extern "C" {
|
||||
}
|
||||
|
||||
|
||||
#line 146 "lib/parse.cc"
|
||||
#line 152 "lib/parse.cc"
|
||||
|
||||
|
||||
#ifdef short
|
||||
@@ -405,7 +411,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
|
||||
|
||||
#if (! defined yyoverflow \
|
||||
&& (! defined __cplusplus \
|
||||
|| (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
|
||||
|| (defined RE2C_LIB_STYPE_IS_TRIVIAL && RE2C_LIB_STYPE_IS_TRIVIAL)))
|
||||
|
||||
/* A type that is properly aligned for any stack member. */
|
||||
union yyalloc
|
||||
@@ -521,19 +527,19 @@ static const yytype_int8 yytranslate[] =
|
||||
5
|
||||
};
|
||||
|
||||
#if YYDEBUG
|
||||
#if RE2C_LIB_DEBUG
|
||||
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
|
||||
static const yytype_int8 yyrline[] =
|
||||
{
|
||||
0, 55, 55, 58, 59, 63, 64, 68, 69, 70,
|
||||
71, 72, 76, 77, 78
|
||||
0, 56, 56, 59, 60, 64, 65, 69, 70, 71,
|
||||
72, 73, 77, 78, 79
|
||||
};
|
||||
#endif
|
||||
|
||||
/** Accessing symbol of state STATE. */
|
||||
#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
|
||||
|
||||
#if YYDEBUG || 0
|
||||
#if RE2C_LIB_DEBUG || 0
|
||||
/* The user-facing name of the symbol whose (internal) number is
|
||||
YYSYMBOL. No bounds checking. */
|
||||
static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
|
||||
@@ -634,7 +640,7 @@ static const yytype_int8 yyr2[] =
|
||||
enum { YYENOMEM = -2 };
|
||||
|
||||
#define yyerrok (yyerrstatus = 0)
|
||||
#define yyclearin (yychar = YYEMPTY)
|
||||
#define yyclearin (yychar = RE2C_LIB_EMPTY)
|
||||
|
||||
#define YYACCEPT goto yyacceptlab
|
||||
#define YYABORT goto yyabortlab
|
||||
@@ -646,7 +652,7 @@ enum { YYENOMEM = -2 };
|
||||
|
||||
#define YYBACKUP(Token, Value) \
|
||||
do \
|
||||
if (yychar == YYEMPTY) \
|
||||
if (yychar == RE2C_LIB_EMPTY) \
|
||||
{ \
|
||||
yychar = (Token); \
|
||||
yylval = (Value); \
|
||||
@@ -662,12 +668,12 @@ enum { YYENOMEM = -2 };
|
||||
while (0)
|
||||
|
||||
/* Backward compatibility with an undocumented macro.
|
||||
Use YYerror or YYUNDEF. */
|
||||
#define YYERRCODE YYUNDEF
|
||||
Use RE2C_LIB_error or RE2C_LIB_UNDEF. */
|
||||
#define YYERRCODE RE2C_LIB_UNDEF
|
||||
|
||||
|
||||
/* Enable debugging if requested. */
|
||||
#if YYDEBUG
|
||||
#if RE2C_LIB_DEBUG
|
||||
|
||||
# ifndef YYFPRINTF
|
||||
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
|
||||
@@ -787,12 +793,12 @@ do { \
|
||||
/* Nonzero means print parse trace. It is left uninitialized so that
|
||||
multiple parsers can coexist. */
|
||||
int yydebug;
|
||||
#else /* !YYDEBUG */
|
||||
#else /* !RE2C_LIB_DEBUG */
|
||||
# define YYDPRINTF(Args) ((void) 0)
|
||||
# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
|
||||
# define YY_STACK_PRINT(Bottom, Top)
|
||||
# define YY_REDUCE_PRINT(Rule)
|
||||
#endif /* !YYDEBUG */
|
||||
#endif /* !RE2C_LIB_DEBUG */
|
||||
|
||||
|
||||
/* YYINITDEPTH -- initial size of the parser's stacks. */
|
||||
@@ -900,7 +906,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
|
||||
|
||||
YYDPRINTF ((stderr, "Starting parse\n"));
|
||||
|
||||
yychar = YYEMPTY; /* Cause a token to be read. */
|
||||
yychar = RE2C_LIB_EMPTY; /* Cause a token to be read. */
|
||||
|
||||
goto yysetstate;
|
||||
|
||||
@@ -1010,25 +1016,25 @@ yybackup:
|
||||
/* Not known => get a lookahead token if don't already have one. */
|
||||
|
||||
/* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
|
||||
if (yychar == YYEMPTY)
|
||||
if (yychar == RE2C_LIB_EMPTY)
|
||||
{
|
||||
YYDPRINTF ((stderr, "Reading a token\n"));
|
||||
yychar = yylex (&yylval, pattern, ast);
|
||||
}
|
||||
|
||||
if (yychar <= YYEOF)
|
||||
if (yychar <= RE2C_LIB_EOF)
|
||||
{
|
||||
yychar = YYEOF;
|
||||
yychar = RE2C_LIB_EOF;
|
||||
yytoken = YYSYMBOL_YYEOF;
|
||||
YYDPRINTF ((stderr, "Now at end of input.\n"));
|
||||
}
|
||||
else if (yychar == YYerror)
|
||||
else if (yychar == RE2C_LIB_error)
|
||||
{
|
||||
/* The scanner already issued an error message, process directly
|
||||
to error recovery. But do not keep the error token as
|
||||
lookahead, it is too special and may lead us to an endless
|
||||
loop in error recovery. */
|
||||
yychar = YYUNDEF;
|
||||
yychar = RE2C_LIB_UNDEF;
|
||||
yytoken = YYSYMBOL_YYerror;
|
||||
goto yyerrlab1;
|
||||
}
|
||||
@@ -1065,7 +1071,7 @@ yybackup:
|
||||
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
||||
|
||||
/* Discard the shifted token. */
|
||||
yychar = YYEMPTY;
|
||||
yychar = RE2C_LIB_EMPTY;
|
||||
goto yynewstate;
|
||||
|
||||
|
||||
@@ -1101,61 +1107,61 @@ yyreduce:
|
||||
switch (yyn)
|
||||
{
|
||||
case 2: /* regexp: expr */
|
||||
#line 55 "../lib/parse.ypp"
|
||||
#line 56 "../lib/parse.ypp"
|
||||
{ regexp = (yyval.regexp); }
|
||||
#line 1107 "lib/parse.cc"
|
||||
break;
|
||||
|
||||
case 4: /* expr: expr '|' term */
|
||||
#line 59 "../lib/parse.ypp"
|
||||
{ (yyval.regexp) = ast.alt((yyvsp[-2].regexp), (yyvsp[0].regexp)); }
|
||||
#line 1113 "lib/parse.cc"
|
||||
break;
|
||||
|
||||
case 6: /* term: factor term */
|
||||
#line 64 "../lib/parse.ypp"
|
||||
{ (yyval.regexp) = ast.cat((yyvsp[-1].regexp), (yyvsp[0].regexp)); }
|
||||
case 4: /* expr: expr '|' term */
|
||||
#line 60 "../lib/parse.ypp"
|
||||
{ (yyval.regexp) = ast.alt((yyvsp[-2].regexp), (yyvsp[0].regexp)); }
|
||||
#line 1119 "lib/parse.cc"
|
||||
break;
|
||||
|
||||
case 8: /* factor: primary '*' */
|
||||
#line 69 "../lib/parse.ypp"
|
||||
{ (yyval.regexp) = ast.iter((yyvsp[-1].regexp), 0, Ast::MANY); }
|
||||
case 6: /* term: factor term */
|
||||
#line 65 "../lib/parse.ypp"
|
||||
{ (yyval.regexp) = ast.cat((yyvsp[-1].regexp), (yyvsp[0].regexp)); }
|
||||
#line 1125 "lib/parse.cc"
|
||||
break;
|
||||
|
||||
case 9: /* factor: primary '+' */
|
||||
case 8: /* factor: primary '*' */
|
||||
#line 70 "../lib/parse.ypp"
|
||||
{ (yyval.regexp) = ast.iter((yyvsp[-1].regexp), 1, Ast::MANY); }
|
||||
{ (yyval.regexp) = ast.iter((yyvsp[-1].regexp), 0, Ast::MANY); }
|
||||
#line 1131 "lib/parse.cc"
|
||||
break;
|
||||
|
||||
case 10: /* factor: primary '?' */
|
||||
case 9: /* factor: primary '+' */
|
||||
#line 71 "../lib/parse.ypp"
|
||||
{ (yyval.regexp) = ast.iter((yyvsp[-1].regexp), 0, 1); }
|
||||
{ (yyval.regexp) = ast.iter((yyvsp[-1].regexp), 1, Ast::MANY); }
|
||||
#line 1137 "lib/parse.cc"
|
||||
break;
|
||||
|
||||
case 11: /* factor: primary TOKEN_COUNT */
|
||||
case 10: /* factor: primary '?' */
|
||||
#line 72 "../lib/parse.ypp"
|
||||
{ (yyval.regexp) = ast.iter((yyvsp[-1].regexp), (yyvsp[0].bounds).min, (yyvsp[0].bounds).max); }
|
||||
{ (yyval.regexp) = ast.iter((yyvsp[-1].regexp), 0, 1); }
|
||||
#line 1143 "lib/parse.cc"
|
||||
break;
|
||||
|
||||
case 13: /* primary: '(' ')' */
|
||||
#line 77 "../lib/parse.ypp"
|
||||
{ (yyval.regexp) = ast.cap(ast.nil(NOWHERE)); }
|
||||
case 11: /* factor: primary TOKEN_COUNT */
|
||||
#line 73 "../lib/parse.ypp"
|
||||
{ (yyval.regexp) = ast.iter((yyvsp[-1].regexp), (yyvsp[0].bounds).min, (yyvsp[0].bounds).max); }
|
||||
#line 1149 "lib/parse.cc"
|
||||
break;
|
||||
|
||||
case 14: /* primary: '(' expr ')' */
|
||||
case 13: /* primary: '(' ')' */
|
||||
#line 78 "../lib/parse.ypp"
|
||||
{ (yyval.regexp) = ast.cap((yyvsp[-1].regexp)); }
|
||||
{ (yyval.regexp) = ast.cap(ast.nil(NOWHERE), CAPTURE); }
|
||||
#line 1155 "lib/parse.cc"
|
||||
break;
|
||||
|
||||
case 14: /* primary: '(' expr ')' */
|
||||
#line 79 "../lib/parse.ypp"
|
||||
{ (yyval.regexp) = ast.cap((yyvsp[-1].regexp), CAPTURE); }
|
||||
#line 1161 "lib/parse.cc"
|
||||
break;
|
||||
|
||||
#line 1159 "lib/parse.cc"
|
||||
|
||||
#line 1165 "lib/parse.cc"
|
||||
|
||||
default: break;
|
||||
}
|
||||
@@ -1197,7 +1203,7 @@ yyreduce:
|
||||
yyerrlab:
|
||||
/* Make sure we have latest lookahead translation. See comments at
|
||||
user semantic actions for why this is necessary. */
|
||||
yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
|
||||
yytoken = yychar == RE2C_LIB_EMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
|
||||
/* If not already recovering from an error, report this error. */
|
||||
if (!yyerrstatus)
|
||||
{
|
||||
@@ -1210,17 +1216,17 @@ yyerrlab:
|
||||
/* If just tried and failed to reuse lookahead token after an
|
||||
error, discard it. */
|
||||
|
||||
if (yychar <= YYEOF)
|
||||
if (yychar <= RE2C_LIB_EOF)
|
||||
{
|
||||
/* Return failure if at end of input. */
|
||||
if (yychar == YYEOF)
|
||||
if (yychar == RE2C_LIB_EOF)
|
||||
YYABORT;
|
||||
}
|
||||
else
|
||||
{
|
||||
yydestruct ("Error: discarding",
|
||||
yytoken, &yylval, pattern, ast);
|
||||
yychar = YYEMPTY;
|
||||
yychar = RE2C_LIB_EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1322,7 +1328,7 @@ yyexhaustedlab:
|
||||
| yyreturnlab -- parsing is finished, clean up and return. |
|
||||
`----------------------------------------------------------*/
|
||||
yyreturnlab:
|
||||
if (yychar != YYEMPTY)
|
||||
if (yychar != RE2C_LIB_EMPTY)
|
||||
{
|
||||
/* Make sure we have latest lookahead translation. See comments at
|
||||
user semantic actions for why this is necessary. */
|
||||
@@ -1348,7 +1354,7 @@ yyreturnlab:
|
||||
return yyresult;
|
||||
}
|
||||
|
||||
#line 81 "../lib/parse.ypp"
|
||||
#line 82 "../lib/parse.ypp"
|
||||
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
+33
-25
@@ -35,14 +35,22 @@
|
||||
especially those whose name start with YY_ or yy_. They are
|
||||
private implementation details that can be changed or removed. */
|
||||
|
||||
#ifndef YY_YY_LIB_PARSE_H_INCLUDED
|
||||
# define YY_YY_LIB_PARSE_H_INCLUDED
|
||||
#ifndef YY_RE2C_LIB_LIB_PARSE_H_INCLUDED
|
||||
# define YY_RE2C_LIB_LIB_PARSE_H_INCLUDED
|
||||
/* Debug traces. */
|
||||
#ifndef YYDEBUG
|
||||
# define YYDEBUG 0
|
||||
#endif
|
||||
#ifndef RE2C_LIB_DEBUG
|
||||
# if defined YYDEBUG
|
||||
#if YYDEBUG
|
||||
extern int yydebug;
|
||||
# define RE2C_LIB_DEBUG 1
|
||||
# else
|
||||
# define RE2C_LIB_DEBUG 0
|
||||
# endif
|
||||
# else /* ! defined YYDEBUG */
|
||||
# define RE2C_LIB_DEBUG 0
|
||||
# endif /* ! defined YYDEBUG */
|
||||
#endif /* ! defined RE2C_LIB_DEBUG */
|
||||
#if RE2C_LIB_DEBUG
|
||||
extern int re2c_lib_debug;
|
||||
#endif
|
||||
/* "%code requires" blocks. */
|
||||
#line 1 "../lib/parse.ypp"
|
||||
@@ -51,47 +59,47 @@ extern int yydebug;
|
||||
#include "src/parse/ast.h"
|
||||
namespace re2c {
|
||||
struct AstNode;
|
||||
};
|
||||
}
|
||||
|
||||
#line 57 "lib/parse.h"
|
||||
#line 65 "lib/parse.h"
|
||||
|
||||
/* Token kinds. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
enum yytokentype
|
||||
#ifndef RE2C_LIB_TOKENTYPE
|
||||
# define RE2C_LIB_TOKENTYPE
|
||||
enum re2c_lib_tokentype
|
||||
{
|
||||
YYEMPTY = -2,
|
||||
YYEOF = 0, /* "end of file" */
|
||||
YYerror = 256, /* error */
|
||||
YYUNDEF = 257, /* "invalid token" */
|
||||
RE2C_LIB_EMPTY = -2,
|
||||
RE2C_LIB_EOF = 0, /* "end of file" */
|
||||
RE2C_LIB_error = 256, /* error */
|
||||
RE2C_LIB_UNDEF = 257, /* "invalid token" */
|
||||
TOKEN_COUNT = 258, /* TOKEN_COUNT */
|
||||
TOKEN_ERROR = 259, /* TOKEN_ERROR */
|
||||
TOKEN_REGEXP = 260 /* TOKEN_REGEXP */
|
||||
};
|
||||
typedef enum yytokentype yytoken_kind_t;
|
||||
typedef enum re2c_lib_tokentype re2c_lib_token_kind_t;
|
||||
#endif
|
||||
|
||||
/* Value type. */
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
union YYSTYPE
|
||||
#if ! defined RE2C_LIB_STYPE && ! defined RE2C_LIB_STYPE_IS_DECLARED
|
||||
union RE2C_LIB_STYPE
|
||||
{
|
||||
#line 33 "../lib/parse.ypp"
|
||||
#line 34 "../lib/parse.ypp"
|
||||
|
||||
const re2c::AstNode* regexp;
|
||||
re2c::AstBounds bounds;
|
||||
|
||||
#line 84 "lib/parse.h"
|
||||
#line 92 "lib/parse.h"
|
||||
|
||||
};
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
typedef union RE2C_LIB_STYPE RE2C_LIB_STYPE;
|
||||
# define RE2C_LIB_STYPE_IS_TRIVIAL 1
|
||||
# define RE2C_LIB_STYPE_IS_DECLARED 1
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
int yyparse (const uint8_t*& pattern, re2c::Ast& ast);
|
||||
int re2c_lib_parse (const uint8_t*& pattern, re2c::Ast& ast);
|
||||
|
||||
|
||||
#endif /* !YY_YY_LIB_PARSE_H_INCLUDED */
|
||||
#endif /* !YY_RE2C_LIB_LIB_PARSE_H_INCLUDED */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 3.0 */
|
||||
/* Generated by re2c 4.0 */
|
||||
#line 1 "../lib/test_helper.re"
|
||||
#include "lib/test_helper.h"
|
||||
|
||||
@@ -30,39 +30,39 @@ loop:
|
||||
#line 31 "lib/test_helper.cc"
|
||||
{
|
||||
char yych;
|
||||
static const unsigned char yybm[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
128, 128, 128, 128, 128, 128, 128, 128,
|
||||
128, 128, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
static const unsigned char yybm[256] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
128, 128, 128, 128, 128, 128, 128, 128,
|
||||
128, 128, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
yych = *YYCURSOR;
|
||||
if (yych <= '(') {
|
||||
@@ -100,9 +100,7 @@ yy5:
|
||||
#line 101 "lib/test_helper.cc"
|
||||
yy6:
|
||||
yych = *++YYCURSOR;
|
||||
if (yybm[0+yych] & 128) {
|
||||
goto yy6;
|
||||
}
|
||||
if (yybm[0+yych] & 128) goto yy6;
|
||||
if (yych == ',') goto yy9;
|
||||
yy7:
|
||||
YYCURSOR = YYMARKER;
|
||||
@@ -137,8 +135,10 @@ yy13:
|
||||
++YYCURSOR;
|
||||
n1 = yyt1;
|
||||
m1 = yyt2;
|
||||
n2 = yyt2 - 1;
|
||||
m2 = YYCURSOR - 1;
|
||||
n2 = yyt2;
|
||||
n2 -= 1;
|
||||
m2 = YYCURSOR;
|
||||
m2 -= 1;
|
||||
#line 38 "../lib/test_helper.re"
|
||||
{
|
||||
v->push_back(parse_offset(n1, n2));
|
||||
|
||||
@@ -0,0 +1,444 @@
|
||||
#include "src/parse/conf_parser.h"
|
||||
const char* DEFAULT_SYNTAX_C =
|
||||
"// supported feature lists -----------------------------------------------------\n"
|
||||
"\n"
|
||||
"supported_apis = [\"simple\", \"generic\", \"record\"];\n"
|
||||
"supported_api_styles = [\"functions\", \"free-form\"];\n"
|
||||
"supported_code_models = [\"goto-label\", \"loop-switch\", \"recursive-functions\"];\n"
|
||||
"supported_targets = [\"code\", \"dot\", \"skeleton\"];\n"
|
||||
"supported_features = [\"nested-ifs\", \"bitmaps\", \"computed-gotos\", \"case-ranges\",\n"
|
||||
" \"tags\", \"captures\", \"captvars\"];\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// language-specific options ---------------------------------------------------\n"
|
||||
"\n"
|
||||
"semicolons = 1;\n"
|
||||
"backtick_quoted_strings = 0;\n"
|
||||
"single_quoted_strings = 0;\n"
|
||||
"indentation_sensitive = 0;\n"
|
||||
"wrap_blocks_in_braces = 1;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// immutable configurations (command-line only options) ------------------------\n"
|
||||
"\n"
|
||||
"re2c:target = code;\n"
|
||||
"re2c:code-model = goto-label;\n"
|
||||
"re2c:input-encoding = ascii;\n"
|
||||
"re2c:date = 1;\n"
|
||||
"re2c:version = 1;\n"
|
||||
"re2c:conditions = 0;\n"
|
||||
"re2c:storable-state = 0;\n"
|
||||
"re2c:flex-syntax = 0;\n"
|
||||
"re2c:verbose = 0;\n"
|
||||
"re2c:line-dirs = 1;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// mutable configurations ------------------------------------------------------\n"
|
||||
"\n"
|
||||
"re2c:api = simple;\n"
|
||||
"re2c:api:style = functions;\n"
|
||||
"re2c:api:sigil = \"@@\";\n"
|
||||
"re2c:YYGETCOND:naked = 0;\n"
|
||||
"re2c:YYSETCOND:naked = 0;\n"
|
||||
"re2c:YYSETCOND@cond = \"@@\";\n"
|
||||
"re2c:YYGETSTATE:naked = 0;\n"
|
||||
"re2c:YYSETSTATE:naked = 0;\n"
|
||||
"re2c:YYSETSTATE@state = \"@@\";\n"
|
||||
"re2c:YYFILL@len = \"@@\";\n"
|
||||
"re2c:YYFILL:naked = 0;\n"
|
||||
"re2c:YYFN = [\"<undefined-function-name>;<undefined-function-type>\"];\n"
|
||||
"re2c:yyfn:sep = \";\";\n"
|
||||
"re2c:yycond = \"yycond\";\n"
|
||||
"re2c:yyctable = \"yyctable\";\n"
|
||||
"re2c:yyaccept = \"yyaccept\";\n"
|
||||
"re2c:yytarget = \"yytarget\";\n"
|
||||
"re2c:yystate = \"yystate\";\n"
|
||||
"re2c:yynmatch = \"yynmatch\";\n"
|
||||
"re2c:yypmatch = \"yypmatch\";\n"
|
||||
"re2c:yyrecord = \"yyrecord\";\n"
|
||||
"re2c:yych = \"yych\";\n"
|
||||
"re2c:yych:conversion = 0;\n"
|
||||
"re2c:yych:literals = char-or-hex;\n"
|
||||
"re2c:yych:emit = (.code_model.recursive_functions ? 0 : 1);\n"
|
||||
"re2c:yybm = \"yybm\";\n"
|
||||
"re2c:yybm:hex = 0;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yystable = \"\"; // deprecated\n"
|
||||
"re2c:header = \"\";\n"
|
||||
"re2c:eof = -1;\n"
|
||||
"re2c:sentinel = -1;\n"
|
||||
"re2c:yyfill:enable = 1;\n"
|
||||
"re2c:yyfill:parameter = 1;\n"
|
||||
"re2c:yyfill:check = 1;\n"
|
||||
"re2c:tags = 0;\n"
|
||||
"re2c:tags:prefix = \"yyt\";\n"
|
||||
"re2c:captures = 0;\n"
|
||||
"re2c:captvars = 0;\n"
|
||||
"re2c:posix-captures = 0;\n"
|
||||
"re2c:posix-captvars = 0;\n"
|
||||
"re2c:invert-captures = 0;\n"
|
||||
"re2c:cond:abort = (.code_model.recursive_functions ? 1 : 0); // `abort()` requires include\n"
|
||||
"re2c:cond:prefix = \"yyc_\";\n"
|
||||
"re2c:cond:enumprefix = \"yyc\";\n"
|
||||
"re2c:cond:divider@cond = \"@@\";\n"
|
||||
"re2c:cond:goto@cond = \"@@\";\n"
|
||||
"re2c:state:abort = (.code_model.recursive_functions ? 1 : 0); // `abort()` requires include\n"
|
||||
"re2c:state:nextlabel = 0;\n"
|
||||
"re2c:bit-vectors = 0;\n"
|
||||
"re2c:debug-output = 0;\n"
|
||||
"re2c:computed-gotos = 0;\n"
|
||||
"re2c:computed-gotos:threshold = 9;\n"
|
||||
"re2c:nested-ifs = 0;\n"
|
||||
"re2c:case-insensitive = 0;\n"
|
||||
"re2c:case-inverted = 0;\n"
|
||||
"re2c:case-ranges = 0;\n"
|
||||
"re2c:unsafe = 0;\n"
|
||||
"re2c:monadic = 0;\n"
|
||||
"re2c:encoding:ebcdic = 0;\n"
|
||||
"re2c:encoding:utf32 = 0;\n"
|
||||
"re2c:encoding:ucs2 = 0;\n"
|
||||
"re2c:encoding:utf16 = 0;\n"
|
||||
"re2c:encoding:utf8 = 0;\n"
|
||||
"re2c:encoding-policy = ignore;\n"
|
||||
"re2c:empty-class = match-empty;\n"
|
||||
"re2c:indent:string = \"\\t\";\n"
|
||||
"re2c:indent:top = 0;\n"
|
||||
"re2c:label:prefix = \"yy\";\n"
|
||||
"re2c:label:yyfill = \"yyFillLabel\";\n"
|
||||
"re2c:label:yyloop = \"\";\n"
|
||||
"re2c:label:yyNext = \"yyNext\";\n"
|
||||
"re2c:label:start = 0;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// mutable code configuration --------------------------------------------------\n"
|
||||
"\n"
|
||||
"re2c:YYBACKUP = \"YYBACKUP\";\n"
|
||||
"re2c:YYBACKUPCTX = \"YYBACKUPCTX\";\n"
|
||||
"re2c:YYCONDTYPE = \"YYCONDTYPE\";\n"
|
||||
"re2c:YYCOPYMTAG = sigil \"{lhs} = \" sigil \"{rhs};\";\n"
|
||||
"re2c:YYCOPYSTAG = sigil \"{lhs} = \" sigil \"{rhs};\";\n"
|
||||
"re2c:YYCTXMARKER = (.api.record ? yyrecord \"->yyctxmarker\" : \"YYCTXMARKER\");\n"
|
||||
"re2c:YYCTYPE = \"YYCTYPE\";\n"
|
||||
"re2c:YYCURSOR = (.api.record ? yyrecord \"->yycursor\" : \"YYCURSOR\");\n"
|
||||
"re2c:YYDEBUG = \"YYDEBUG\";\n"
|
||||
"re2c:YYFILL = \"YYFILL\";\n"
|
||||
"re2c:YYGETACCEPT = sigil \"{var}\";\n"
|
||||
"re2c:YYGETCOND = \"YYGETCONDITION\"; // historic default\n"
|
||||
"re2c:YYGETSTATE = \"YYGETSTATE\";\n"
|
||||
"re2c:YYINPUT = (.api.record ? yyrecord \"->yyinput\" : \"YYINPUT\");\n"
|
||||
"re2c:YYLESSTHAN = \"YYLESSTHAN\";\n"
|
||||
"re2c:YYLIMIT = (.api.record ? yyrecord \"->yylimit\" : \"YYLIMIT\");\n"
|
||||
"re2c:YYMARKER = (.api.record ? yyrecord \"->yymarker\" : \"YYMARKER\");\n"
|
||||
"re2c:YYMAXFILL = \"YYMAXFILL\";\n"
|
||||
"re2c:YYMAXNMATCH = \"YYMAXNMATCH\";\n"
|
||||
"re2c:YYMTAGN = \"YYMTAGN\";\n"
|
||||
"re2c:YYMTAGP = \"YYMTAGP\";\n"
|
||||
"re2c:YYPEEK = \"YYPEEK\";\n"
|
||||
"re2c:YYRESTORE = \"YYRESTORE\";\n"
|
||||
"re2c:YYRESTORECTX = \"YYRESTORECTX\";\n"
|
||||
"re2c:YYRESTORETAG = \"YYRESTORETAG\";\n"
|
||||
"re2c:YYSETACCEPT = sigil \"{var} = \" sigil \"{val};\";\n"
|
||||
"re2c:YYSETCOND = \"YYSETCONDITION\"; // historic default\n"
|
||||
"re2c:YYSETSTATE = \"YYSETSTATE\";\n"
|
||||
"re2c:YYSHIFT = \"YYSHIFT\";\n"
|
||||
"re2c:YYSHIFTSTAG = \"YYSHIFTSTAG\";\n"
|
||||
"re2c:YYSHIFTMTAG = \"YYSHIFTMTAG\";\n"
|
||||
"re2c:YYSKIP = \"YYSKIP\";\n"
|
||||
"re2c:YYSTAGN = \"YYSTAGN\";\n"
|
||||
"re2c:YYSTAGP = \"YYSTAGP\";\n"
|
||||
"re2c:tags:expression = (.api.record ? yyrecord \"->\") sigil;\n"
|
||||
"re2c:tags:negative = (.api.generic ? \"@@\" : \"NULL\");\n"
|
||||
"re2c:cond:divider = \"/* *********************************** */\";\n"
|
||||
"re2c:cond:goto = \"goto \" sigil \";\";\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// code templates --------------------------------------------------------------\n"
|
||||
"\n"
|
||||
"code:var_local = topindent type \" \" name (.init ? \" = \" init) \";\" nl;\n"
|
||||
"code:var_global = code:var_local;\n"
|
||||
"\n"
|
||||
"code:const_local = topindent type \" \" name \" = \" init \";\" nl;\n"
|
||||
"code:const_global = topindent \"#define \" name \" \" init nl;\n"
|
||||
"\n"
|
||||
"code:array_local =\n"
|
||||
" topindent type \" \" name \"[\" size \"] = {\" nl indent\n"
|
||||
" [row{0:-2}: topindent [elem{0:-2}: elem \", \"] [elem{-1}: elem \",\"] nl]\n"
|
||||
" [row{-1}: topindent [elem{0:-2}: elem \", \"] [elem{-1}: elem] nl]\n"
|
||||
" dedent topindent \"};\" nl;\n"
|
||||
"\n"
|
||||
"code:array_global = code:array_local;\n"
|
||||
"\n"
|
||||
"code:array_elem = array \"[\" index \"]\";\n"
|
||||
"\n"
|
||||
"code:enum =\n"
|
||||
" \"enum \" type \" {\" nl indent\n"
|
||||
" [elem{0:-2}: topindent elem (.init ? \" = \" init) \",\" nl]\n"
|
||||
" [elem{-1}: topindent elem (.init ? \" = \" init) nl]\n"
|
||||
" dedent \"};\" nl;\n"
|
||||
"\n"
|
||||
"code:enum_elem = name;\n"
|
||||
"\n"
|
||||
"code:assign = topindent lhs \" = \" rhs \";\" nl;\n"
|
||||
"\n"
|
||||
"code:type_int = \"int\";\n"
|
||||
"code:type_uint = \"unsigned int\";\n"
|
||||
"code:type_yybm = \"static const unsigned char\";\n"
|
||||
"code:type_yytarget = \"static const void*\";\n"
|
||||
"\n"
|
||||
"code:cmp_eq = \"==\";\n"
|
||||
"code:cmp_ne = \"!=\";\n"
|
||||
"code:cmp_lt = \"<\";\n"
|
||||
"code:cmp_gt = \">\";\n"
|
||||
"code:cmp_le = \"<=\";\n"
|
||||
"code:cmp_ge = \">=\";\n"
|
||||
"\n"
|
||||
"code:if_then_else =\n"
|
||||
" [branch{0}: topindent \"if (\" cond \") {\" nl\n"
|
||||
" indent [stmt: stmt] dedent]\n"
|
||||
" [branch{1:-1}: topindent \"} else \" (.cond ? \"if (\" cond \") \") \"{\" nl\n"
|
||||
" indent [stmt: stmt] dedent]\n"
|
||||
" topindent \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:if_then_else_oneline =\n"
|
||||
" [branch{0}: topindent \"if (\" cond \") \" [stmt: stmt] nl]\n"
|
||||
" [branch{1:-1}: topindent \"else \" (.cond ? \"if (\" cond \") \") [stmt: stmt] nl];\n"
|
||||
"\n"
|
||||
"code:switch =\n"
|
||||
" topindent \"switch (\" expr \") {\" nl\n"
|
||||
" indent [case: case] dedent\n"
|
||||
" topindent \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:switch_cases =\n"
|
||||
" [case: case nl]\n"
|
||||
" indent [stmt: stmt] dedent;\n"
|
||||
"\n"
|
||||
"code:switch_cases_oneline =\n"
|
||||
" [case{0:-2}: case nl]\n"
|
||||
" [case{-1}: case \" \" [stmt: stmt] nl];\n"
|
||||
"\n"
|
||||
"code:switch_case_range = (.case_ranges\n"
|
||||
" ? topindent \"case \" [val{0}: val] (.many ? \" ... \" [val{-1}: val]) \":\"\n"
|
||||
" : [val{0:-2}: topindent \"case \" val \":\" nl]\n"
|
||||
" [val{-1}: topindent \"case \" val \":\"]);\n"
|
||||
"\n"
|
||||
"code:switch_case_default =\n"
|
||||
" topindent \"default:\";\n"
|
||||
"\n"
|
||||
"code:loop =\n"
|
||||
" topindent \"for (;;) {\" nl\n"
|
||||
" indent [stmt: stmt] dedent\n"
|
||||
" topindent \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:continue = topindent \"continue;\" nl;\n"
|
||||
"\n"
|
||||
"code:goto = topindent \"goto \" label \";\" nl;\n"
|
||||
"\n"
|
||||
"code:fndecl =\n"
|
||||
" topindent type \" \" name \"(\"\n"
|
||||
" [arg{0:-2}: argtype \" \" argname \", \"]\n"
|
||||
" [arg{-1}: argtype \" \" argname]\n"
|
||||
" \");\" nl;\n"
|
||||
"\n"
|
||||
"code:fndef =\n"
|
||||
" topindent type \" \" name \"(\"\n"
|
||||
" [arg{0:-2}: argtype \" \" argname \", \"]\n"
|
||||
" [arg{-1}: argtype \" \" argname]\n"
|
||||
" \") {\" nl\n"
|
||||
" indent [stmt: stmt] dedent\n"
|
||||
" \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:fncall =\n"
|
||||
" topindent (.retval ? retval \" = \") name \"(\" [arg{0:-2}: arg \", \"] [arg{-1}: arg] \");\" nl;\n"
|
||||
"\n"
|
||||
"code:tailcall =\n"
|
||||
" topindent (.retval ? \"return \") name \"(\" [arg{0:-2}: arg \", \"] [arg{-1}: arg] \");\" nl;\n"
|
||||
"\n"
|
||||
"code:recursive_functions =\n"
|
||||
" [fn: fndecl] nl\n"
|
||||
" [fn: fndef nl];\n"
|
||||
"\n"
|
||||
"code:fingerprint =\n"
|
||||
" \"/* Generated by re2c\" (.version ? \" \" version) (.date ? \" on \" date) \" */\" nl;\n"
|
||||
"\n"
|
||||
"code:line_info = \"#line \" line \" \\\"\" file \"\\\"\" nl;\n"
|
||||
"\n"
|
||||
"code:abort = topindent \"abort();\" nl;\n"
|
||||
"\n"
|
||||
"code:yydebug =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYDEBUG (.api_style.functions ? \"();\")\n"
|
||||
" : (.api.record\n"
|
||||
" ? YYDEBUG \"(\" yyrecord \");\"\n"
|
||||
" : YYDEBUG \"(\" state \", \" yych \");\"\n"
|
||||
" )) nl;\n"
|
||||
"\n"
|
||||
"code:yypeek =\n"
|
||||
" topindent (.code_model.recursive_functions ? YYCTYPE \" \") yych \" = \" (.api.generic\n"
|
||||
" ? YYPEEK (.api_style.functions ? \"()\")\n"
|
||||
" : (.cast ? \"(\" YYCTYPE \")\") \"*\" YYCURSOR\n"
|
||||
" ) \";\" nl;\n"
|
||||
"\n"
|
||||
"code:yyskip =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSKIP (.api_style.functions ? \"();\")\n"
|
||||
" : \"++\" YYCURSOR \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yybackup =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYBACKUP (.api_style.functions ? \"();\")\n"
|
||||
" : YYMARKER \" = \" YYCURSOR \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yybackupctx =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYBACKUPCTX (.api_style.functions ? \"();\")\n"
|
||||
" : YYCTXMARKER \" = \" YYCURSOR \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyskip_yypeek =\n"
|
||||
" topindent (.code_model.recursive_functions ? YYCTYPE \" \") yych \" = \"\n"
|
||||
" (.cast ? \"(\" YYCTYPE \")\") \"*++\" YYCURSOR \";\" nl;\n"
|
||||
"\n"
|
||||
"code:yypeek_yyskip =\n"
|
||||
" topindent (.code_model.recursive_functions ? YYCTYPE \" \") yych \" = \"\n"
|
||||
" (.cast ? \"(\" YYCTYPE \")\") \"*\" YYCURSOR \"++;\" nl;\n"
|
||||
"\n"
|
||||
"code:yyskip_yybackup =\n"
|
||||
" topindent YYMARKER \" = ++\" YYCURSOR \";\" nl;\n"
|
||||
"\n"
|
||||
"code:yybackup_yyskip =\n"
|
||||
" topindent YYMARKER \" = \" YYCURSOR \"++;\" nl;\n"
|
||||
"\n"
|
||||
"code:yybackup_yypeek =\n"
|
||||
" topindent (.code_model.recursive_functions ? YYCTYPE \" \") yych \" = \"\n"
|
||||
" (.cast ? \"(\" YYCTYPE \")\") \"*(\" YYMARKER \" = \" YYCURSOR \");\" nl;\n"
|
||||
"\n"
|
||||
"code:yyskip_yybackup_yypeek =\n"
|
||||
" topindent (.code_model.recursive_functions ? YYCTYPE \" \") yych \" = \"\n"
|
||||
" (.cast ? \"(\" YYCTYPE \")\") \"*(\" YYMARKER \" = ++\" YYCURSOR \");\" nl;\n"
|
||||
"\n"
|
||||
"code:yybackup_yypeek_yyskip =\n"
|
||||
" topindent (.code_model.recursive_functions ? YYCTYPE \" \") yych \" = \"\n"
|
||||
" (.cast ? \"(\" YYCTYPE \")\") \"*(\" YYMARKER \" = \" YYCURSOR \"++);\" nl;\n"
|
||||
"\n"
|
||||
"code:yyrestore =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYRESTORE (.api_style.functions ? \"();\")\n"
|
||||
" : YYCURSOR \" = \" YYMARKER \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyrestorectx =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYRESTORECTX (.api_style.functions ? \"();\")\n"
|
||||
" : YYCURSOR \" = \" YYCTXMARKER \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyrestoretag =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYRESTORETAG (.api_style.functions ? \"(\" tag \");\")\n"
|
||||
" : YYCURSOR \" = \" tag \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshift =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSHIFT (.api_style.functions ? \"(-\" offset \");\")\n"
|
||||
" : YYCURSOR \" -= \" offset \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshiftstag =\n"
|
||||
" topindent (.nested ? \"if (\" tag \" != \" neg \") \") (.api.generic\n"
|
||||
" ? YYSHIFTSTAG (.api_style.functions ? \"(\" tag \", -\" offset \");\")\n"
|
||||
" : tag \" -= \" offset \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshiftmtag =\n"
|
||||
" topindent YYSHIFTMTAG (.api_style.functions ? \"(\" tag \", -\" offset \");\") nl;\n"
|
||||
"\n"
|
||||
"code:yystagp =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSTAGP (.api_style.functions ? \"(\" tag \");\")\n"
|
||||
" : tag \" = \" YYCURSOR \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yymtagp =\n"
|
||||
" topindent YYMTAGP (.api_style.functions ? \"(\" tag \");\") nl;\n"
|
||||
"\n"
|
||||
"code:yystagn =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSTAGN (.api_style.functions ? \"(\" tag \");\")\n"
|
||||
" : tag \" = \" neg \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yymtagn =\n"
|
||||
" topindent YYMTAGN (.api_style.functions ? \"(\" tag \");\") nl;\n"
|
||||
"\n"
|
||||
"code:yycopystag =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYCOPYSTAG // function style is not supported, as there's no sensible default\n"
|
||||
" : lhs \" = \" rhs \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yycopymtag =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYCOPYMTAG // function style is not supported, as there's no sensible default\n"
|
||||
" : lhs \" = \" rhs \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetaccept =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYGETACCEPT // function style is not supported, as there's no sensible default\n"
|
||||
" : (.api.record & (.storable_state | .code_model.recursive_functions) ? yyrecord \"->\") var);\n"
|
||||
"\n"
|
||||
"code:yysetaccept =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSETACCEPT // function style is not supported, as there's no sensible default\n"
|
||||
" : (.api.record & (.storable_state | .code_model.recursive_functions) ? yyrecord \"->\")\n"
|
||||
" var \" = \" val \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"// Historically simple API did not provide default definition for YYGETCOND.\n"
|
||||
"// Changing it would break backwards compatibility, as there may be a macro definition\n"
|
||||
"// not based on `yycond` that re2c is unable to see, e.g. included from a header file.\n"
|
||||
"code:yygetcond =\n"
|
||||
" (.api.generic | .api.simple\n"
|
||||
" ? YYGETCOND (.api_style.functions ? \"()\")\n"
|
||||
" : yyrecord \"->\" var);\n"
|
||||
"\n"
|
||||
"// Historically simple API did not provide default definition for YYSETCOND.\n"
|
||||
"// Changing it would break backwards compatibility, as there may be a macro definition\n"
|
||||
"// not based on `yycond` that re2c is unable to see, e.g. included from a header file.\n"
|
||||
"code:yysetcond =\n"
|
||||
" topindent (.api.generic | .api.simple\n"
|
||||
" ? YYSETCOND (.api_style.functions ? \"(\" val \");\")\n"
|
||||
" : yyrecord \"->\" var \" = \" val \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"// Historically simple API did not provide default definition for YYGETSTATE.\n"
|
||||
"// Changing it would break backwards compatibility, as there may be a macro definition\n"
|
||||
"// not based on `yystate` that re2c is unable to see, e.g. included from a header file.\n"
|
||||
"code:yygetstate =\n"
|
||||
" (.api.generic | .api.simple\n"
|
||||
" ? YYGETSTATE (.api_style.functions ? \"()\")\n"
|
||||
" : yyrecord \"->\" var);\n"
|
||||
"\n"
|
||||
"// Historically simple API did not provide default definition for YYSETSTATE.\n"
|
||||
"// Changing it would break backwards compatibility, as there may be a macro definition\n"
|
||||
"// not based on `yystate` that re2c is unable to see, e.g. included from a header file.\n"
|
||||
"code:yysetstate =\n"
|
||||
" topindent (.api.generic | .api.simple\n"
|
||||
" ? YYSETSTATE (.api_style.functions ? \"(\" val \");\")\n"
|
||||
" : yyrecord \"->\" var \" = \" val \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yylessthan =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYLESSTHAN (.api_style.functions ? \"(\" need \")\")\n"
|
||||
" : (.many\n"
|
||||
" ? \"(\" YYLIMIT \" - \" YYCURSOR \") < \" need\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR));\n"
|
||||
"\n"
|
||||
"code:yybm_filter = yych \" & ~0xFF\";\n"
|
||||
"\n"
|
||||
"code:yybm_match = yybm \"[\" offset \"+\" yych \"] & \" mask;\n"
|
||||
;
|
||||
@@ -0,0 +1,424 @@
|
||||
#include "src/parse/conf_parser.h"
|
||||
const char* DEFAULT_SYNTAX_D =
|
||||
"// supported feature lists -----------------------------------------------------\n"
|
||||
"\n"
|
||||
"supported_apis = [\"simple\", \"generic\", \"record\"];\n"
|
||||
"supported_api_styles = [\"free-form\"];\n"
|
||||
"supported_code_models = [\"goto-label\", \"loop-switch\", \"recursive-functions\"];\n"
|
||||
"supported_targets = [\"code\", \"dot\"];\n"
|
||||
"supported_features = [\"nested-ifs\", \"bitmaps\", \"case-ranges\",\n"
|
||||
" \"tags\", \"captures\", \"captvars\"];\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// language-specific options ---------------------------------------------------\n"
|
||||
"\n"
|
||||
"semicolons = 1;\n"
|
||||
"backtick_quoted_strings = 1;\n"
|
||||
"single_quoted_strings = 0;\n"
|
||||
"indentation_sensitive = 0;\n"
|
||||
"wrap_blocks_in_braces = 1;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// immutable configurations (command-line only options) ------------------------\n"
|
||||
"\n"
|
||||
"re2c:target = code;\n"
|
||||
"re2c:code-model = goto-label;\n"
|
||||
"re2c:input-encoding = ascii;\n"
|
||||
"re2c:date = 1;\n"
|
||||
"re2c:version = 1;\n"
|
||||
"re2c:conditions = 0;\n"
|
||||
"re2c:storable-state = 0;\n"
|
||||
"re2c:flex-syntax = 0;\n"
|
||||
"re2c:verbose = 0;\n"
|
||||
"re2c:line-dirs = 1;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// mutable configurations ------------------------------------------------------\n"
|
||||
"\n"
|
||||
"re2c:api = simple;\n"
|
||||
"re2c:api:style = free-form;\n"
|
||||
"re2c:api:sigil = \"@@\";\n"
|
||||
"re2c:YYGETCOND:naked = 0;\n"
|
||||
"re2c:YYSETCOND:naked = 0;\n"
|
||||
"re2c:YYSETCOND@cond = \"@@\";\n"
|
||||
"re2c:YYGETSTATE:naked = 0;\n"
|
||||
"re2c:YYSETSTATE:naked = 0;\n"
|
||||
"re2c:YYSETSTATE@state = \"@@\";\n"
|
||||
"re2c:YYFILL@len = \"@@\";\n"
|
||||
"re2c:YYFILL:naked = 0;\n"
|
||||
"re2c:YYFN = [\"<undefined-function-name>;<undefined-function-type>\"];\n"
|
||||
"re2c:yyfn:sep = \";\";\n"
|
||||
"re2c:yycond = \"yycond\";\n"
|
||||
"re2c:yyctable = \"yyctable\";\n"
|
||||
"re2c:yyaccept = \"yyaccept\";\n"
|
||||
"re2c:yytarget = \"yytarget\";\n"
|
||||
"re2c:yystate = \"yystate\";\n"
|
||||
"re2c:yynmatch = \"yynmatch\";\n"
|
||||
"re2c:yypmatch = \"yypmatch\";\n"
|
||||
"re2c:yyrecord = \"yyrecord\";\n"
|
||||
"re2c:yych = \"yych\";\n"
|
||||
"re2c:yych:conversion = 0;\n"
|
||||
"re2c:yych:literals = char-or-hex;\n"
|
||||
"re2c:yych:emit = (.code_model.recursive_functions ? 0 : 1);\n"
|
||||
"re2c:yybm = \"yybm\";\n"
|
||||
"re2c:yybm:hex = 0;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yystable = \"\"; // deprecated\n"
|
||||
"re2c:header = \"\";\n"
|
||||
"re2c:eof = -1;\n"
|
||||
"re2c:sentinel = -1;\n"
|
||||
"re2c:yyfill:enable = 1;\n"
|
||||
"re2c:yyfill:parameter = 1;\n"
|
||||
"re2c:yyfill:check = 1;\n"
|
||||
"re2c:tags = 0;\n"
|
||||
"re2c:tags:prefix = \"yyt\";\n"
|
||||
"re2c:captures = 0;\n"
|
||||
"re2c:captvars = 0;\n"
|
||||
"re2c:posix-captures = 0;\n"
|
||||
"re2c:posix-captvars = 0;\n"
|
||||
"re2c:invert-captures = 0;\n"
|
||||
"re2c:cond:abort = 1;\n"
|
||||
"re2c:cond:prefix = \"yyc_\";\n"
|
||||
"re2c:cond:enumprefix = \"yyc\";\n"
|
||||
"re2c:cond:divider@cond = \"@@\";\n"
|
||||
"re2c:cond:goto@cond = \"@@\";\n"
|
||||
"re2c:state:abort = 1;\n"
|
||||
"re2c:state:nextlabel = 0;\n"
|
||||
"re2c:bit-vectors = 0;\n"
|
||||
"re2c:debug-output = 0;\n"
|
||||
"re2c:computed-gotos = 0;\n"
|
||||
"re2c:computed-gotos:threshold = 9;\n"
|
||||
"re2c:nested-ifs = 0;\n"
|
||||
"re2c:case-insensitive = 0;\n"
|
||||
"re2c:case-inverted = 0;\n"
|
||||
"re2c:case-ranges = 0;\n"
|
||||
"re2c:unsafe = 0;\n"
|
||||
"re2c:monadic = 0;\n"
|
||||
"re2c:encoding:ebcdic = 0;\n"
|
||||
"re2c:encoding:utf32 = 0;\n"
|
||||
"re2c:encoding:ucs2 = 0;\n"
|
||||
"re2c:encoding:utf16 = 0;\n"
|
||||
"re2c:encoding:utf8 = 0;\n"
|
||||
"re2c:encoding-policy = ignore;\n"
|
||||
"re2c:empty-class = match-empty;\n"
|
||||
"re2c:indent:string = \" \";\n"
|
||||
"re2c:indent:top = 0;\n"
|
||||
"re2c:label:prefix = \"yy\";\n"
|
||||
"re2c:label:yyfill = \"yyFillLabel\";\n"
|
||||
"re2c:label:yyloop = \"yyl\";\n"
|
||||
"re2c:label:yyNext = \"yyNext\";\n"
|
||||
"re2c:label:start = 0;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// mutable code configuration --------------------------------------------------\n"
|
||||
"\n"
|
||||
"re2c:YYBACKUP = \"yybackup\";\n"
|
||||
"re2c:YYBACKUPCTX = \"yybackupctx\";\n"
|
||||
"re2c:YYCONDTYPE = \"YYCond\";\n"
|
||||
"re2c:YYCOPYMTAG = sigil \"{lhs} = \" sigil \"{rhs};\";\n"
|
||||
"re2c:YYCOPYSTAG = sigil \"{lhs} = \" sigil \"{rhs};\";\n"
|
||||
"re2c:YYCTXMARKER = (.api.record ? yyrecord \".\") \"yyctxmarker\";\n"
|
||||
"re2c:YYCTYPE = \"YYChar\";\n"
|
||||
"re2c:YYCURSOR = (.api.record ? yyrecord \".\") \"yycursor\";\n"
|
||||
"re2c:YYDEBUG = \"yydebug\";\n"
|
||||
"re2c:YYFILL = \"yyfill\";\n"
|
||||
"re2c:YYGETACCEPT = sigil \"{var}\";\n"
|
||||
"re2c:YYGETCOND = \"yygetcond\";\n"
|
||||
"re2c:YYGETSTATE = \"yygetstate\";\n"
|
||||
"re2c:YYINPUT = (.api.record ? yyrecord \".\") \"yyinput\";\n"
|
||||
"re2c:YYLESSTHAN = \"yylessthan\";\n"
|
||||
"re2c:YYLIMIT = (.api.record ? yyrecord \".\") \"yylimit\";\n"
|
||||
"re2c:YYMARKER = (.api.record ? yyrecord \".\") \"yymarker\";\n"
|
||||
"re2c:YYMAXFILL = \"YYMaxFill\";\n"
|
||||
"re2c:YYMAXNMATCH = \"YYMaxNMatch\";\n"
|
||||
"re2c:YYMTAGN = \"yymtagn\";\n"
|
||||
"re2c:YYMTAGP = \"yymtagp\";\n"
|
||||
"re2c:YYPEEK = \"yypeek\";\n"
|
||||
"re2c:YYRESTORE = \"yyrestore\";\n"
|
||||
"re2c:YYRESTORECTX = \"yyrestorectx\";\n"
|
||||
"re2c:YYRESTORETAG = \"yyrestoretag\";\n"
|
||||
"re2c:YYSETACCEPT = sigil \"{var} = \" sigil \"{val};\";\n"
|
||||
"re2c:YYSETCOND = \"yysetcond\";\n"
|
||||
"re2c:YYSETSTATE = \"yysetstate\";\n"
|
||||
"re2c:YYSHIFT = \"yyshift\";\n"
|
||||
"re2c:YYSHIFTSTAG = \"yyshiftstag\";\n"
|
||||
"re2c:YYSHIFTMTAG = \"yyshiftmtag\";\n"
|
||||
"re2c:YYSKIP = \"yyskip\";\n"
|
||||
"re2c:YYSTAGN = \"yystagn\";\n"
|
||||
"re2c:YYSTAGP = \"yystagp\";\n"
|
||||
"re2c:tags:expression = (.api.record ? yyrecord \".\") sigil;\n"
|
||||
"re2c:tags:negative = (.api.generic ? \"@@\" : \"null\");\n"
|
||||
"re2c:cond:divider = \"/* *********************************** */\";\n"
|
||||
"re2c:cond:goto = \"goto \" sigil \";\";\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// code templates --------------------------------------------------------------\n"
|
||||
"\n"
|
||||
"code:var_local = topindent type \" \" name (.init ? \" = \" init) \";\" nl;\n"
|
||||
"code:var_global = code:var_local;\n"
|
||||
"\n"
|
||||
"code:const_local = topindent \"enum \" name \" = \" init \";\" nl;\n"
|
||||
"code:const_global = code:const_local;\n"
|
||||
"\n"
|
||||
"code:array_local =\n"
|
||||
" topindent type \"[\" size \"] \" name \" = [\" nl indent\n"
|
||||
" [row{0:-2}: topindent [elem{0:-2}: elem \", \"] [elem{-1}: elem \",\"] nl]\n"
|
||||
" [row{-1}: topindent [elem{0:-2}: elem \", \"] [elem{-1}: elem] nl]\n"
|
||||
" dedent topindent \"];\" nl;\n"
|
||||
"\n"
|
||||
"code:array_global = code:array_local;\n"
|
||||
"\n"
|
||||
"code:array_elem = array \"[\" index \"]\";\n"
|
||||
"\n"
|
||||
"code:enum =\n"
|
||||
" \"enum \" type \" {\" nl indent\n"
|
||||
" [elem{0:-2}: topindent elem (.init ? \" = \" init) \",\" nl]\n"
|
||||
" [elem{-1}: topindent elem (.init ? \" = \" init) nl]\n"
|
||||
" dedent \"};\" nl;\n"
|
||||
"\n"
|
||||
"code:enum_elem = type \".\" name;\n"
|
||||
"\n"
|
||||
"code:assign = topindent lhs \" = \" rhs \";\" nl;\n"
|
||||
"\n"
|
||||
"code:type_int = \"int\";\n"
|
||||
"code:type_uint = \"uint\";\n"
|
||||
"code:type_yybm = \"immutable char\";\n"
|
||||
"code:type_yytarget = <undefined>;\n"
|
||||
"\n"
|
||||
"code:cmp_eq = \"==\";\n"
|
||||
"code:cmp_ne = \"!=\";\n"
|
||||
"code:cmp_lt = \"<\";\n"
|
||||
"code:cmp_gt = \">\";\n"
|
||||
"code:cmp_le = \"<=\";\n"
|
||||
"code:cmp_ge = \">=\";\n"
|
||||
"\n"
|
||||
"code:if_then_else =\n"
|
||||
" [branch{0}: topindent \"if (\" cond \") {\" nl\n"
|
||||
" indent [stmt: stmt] dedent]\n"
|
||||
" [branch{1:-1}: topindent \"} else \" (.cond ? \"if (\" cond \") \") \"{\" nl\n"
|
||||
" indent [stmt: stmt] dedent]\n"
|
||||
" topindent \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:if_then_else_oneline =\n"
|
||||
" [branch{0}: topindent \"if (\" cond \") \" [stmt: stmt] nl]\n"
|
||||
" [branch{1:-1}: topindent \"else \" (.cond ? \"if (\" cond \") \") [stmt: stmt] nl];\n"
|
||||
"\n"
|
||||
"code:switch =\n"
|
||||
" topindent \"switch (\" expr \") {\" nl\n"
|
||||
" indent [case: case] dedent\n"
|
||||
" topindent \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:switch_cases =\n"
|
||||
" [case: case nl]\n"
|
||||
" indent [stmt: stmt] dedent;\n"
|
||||
"\n"
|
||||
"code:switch_cases_oneline =\n"
|
||||
" [case{0:-2}: case nl]\n"
|
||||
" [case{-1}: case \" \" [stmt: stmt] nl];\n"
|
||||
"\n"
|
||||
"code:switch_case_range =\n"
|
||||
" topindent \"case \" [val{0}: val] (.many ? \": .. case \" [val{-1}: val]) \":\";\n"
|
||||
"\n"
|
||||
"code:switch_case_default =\n"
|
||||
" topindent \"default:\";\n"
|
||||
"\n"
|
||||
"code:loop =\n"
|
||||
" topindent (.loop_label ? label \": \") \"while (true) {\" nl\n"
|
||||
" indent [stmt: stmt] dedent\n"
|
||||
" topindent \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:continue = topindent \"continue\" (.loop_label ? \" \" label) \";\" nl;\n"
|
||||
"\n"
|
||||
"code:goto = topindent \"goto \" label \";\" nl;\n"
|
||||
"\n"
|
||||
"code:fndecl = <undefined>;\n"
|
||||
"\n"
|
||||
"code:fndef =\n"
|
||||
" topindent type \" \" name \"(\"\n"
|
||||
" [arg{0:-2}: argtype \" \" argname \", \"]\n"
|
||||
" [arg{-1}: argtype \" \" argname]\n"
|
||||
" \") {\" nl\n"
|
||||
" indent [stmt: stmt] dedent\n"
|
||||
" \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:fncall =\n"
|
||||
" topindent (.retval ? retval \" = \" name) \"(\" [arg{0:-2}: arg \", \"] [arg{-1}: arg] \");\" nl;\n"
|
||||
"\n"
|
||||
"code:tailcall =\n"
|
||||
" topindent (.retval ? \"return \" name) \"(\" [arg{0:-2}: arg \", \"] [arg{-1}: arg] \");\" nl;\n"
|
||||
"\n"
|
||||
"code:recursive_functions = [fn: fndef nl];\n"
|
||||
"\n"
|
||||
"code:fingerprint =\n"
|
||||
" \"/* Generated by re2d\" (.version ? \" \" version) (.date ? \" on \" date) \" */\" nl;\n"
|
||||
"\n"
|
||||
"code:line_info = \"#line \" line \" \\\"\" file \"\\\"\" nl;\n"
|
||||
"\n"
|
||||
"code:abort = topindent \"assert(false);\" nl;\n"
|
||||
"\n"
|
||||
"code:yydebug =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYDEBUG\n"
|
||||
" : (.api.record\n"
|
||||
" ? YYDEBUG \"(\" yyrecord \");\"\n"
|
||||
" : YYDEBUG \"(\" state \", \" yych \");\"\n"
|
||||
" )) nl;\n"
|
||||
"\n"
|
||||
"code:yypeek =\n"
|
||||
" topindent (.code_model.recursive_functions ? YYCTYPE \" \") yych \" = \" (.api.generic\n"
|
||||
" ? YYPEEK\n"
|
||||
" : (.cast ? \"cast(\" YYCTYPE \")\") \"*\" YYCURSOR\n"
|
||||
" ) \";\" nl;\n"
|
||||
"\n"
|
||||
"code:yyskip =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSKIP\n"
|
||||
" : \"++\" YYCURSOR \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yybackup =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYBACKUP\n"
|
||||
" : YYMARKER \" = \" YYCURSOR \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yybackupctx =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYBACKUPCTX\n"
|
||||
" : YYCTXMARKER \" = \" YYCURSOR \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyskip_yypeek =\n"
|
||||
" topindent (.code_model.recursive_functions ? YYCTYPE \" \") yych \" = \"\n"
|
||||
" (.cast ? \"cast(\" YYCTYPE \")\") \"*++\" YYCURSOR \";\" nl;\n"
|
||||
"\n"
|
||||
"code:yypeek_yyskip =\n"
|
||||
" topindent (.code_model.recursive_functions ? YYCTYPE \" \") yych \" = \"\n"
|
||||
" (.cast ? \"cast(\" YYCTYPE \")\") \"*\" YYCURSOR \"++;\" nl;\n"
|
||||
"\n"
|
||||
"code:yyskip_yybackup =\n"
|
||||
" topindent YYMARKER \" = ++\" YYCURSOR \";\" nl;\n"
|
||||
"\n"
|
||||
"code:yybackup_yyskip =\n"
|
||||
" topindent YYMARKER \" = \" YYCURSOR \"++;\" nl;\n"
|
||||
"\n"
|
||||
"code:yybackup_yypeek =\n"
|
||||
" topindent (.code_model.recursive_functions ? YYCTYPE \" \") yych \" = \"\n"
|
||||
" (.cast ? \"cast(\" YYCTYPE \")\") \"*(\" YYMARKER \" = \" YYCURSOR \");\" nl;\n"
|
||||
"\n"
|
||||
"code:yyskip_yybackup_yypeek =\n"
|
||||
" topindent (.code_model.recursive_functions ? YYCTYPE \" \") yych \" = \"\n"
|
||||
" (.cast ? \"cast(\" YYCTYPE \")\") \"*(\" YYMARKER \" = ++\" YYCURSOR \");\" nl;\n"
|
||||
"\n"
|
||||
"code:yybackup_yypeek_yyskip =\n"
|
||||
" topindent (.code_model.recursive_functions ? YYCTYPE \" \") yych \" = \"\n"
|
||||
" (.cast ? \"cast(\" YYCTYPE \")\") \"*(\" YYMARKER \" = \" YYCURSOR \"++);\" nl;\n"
|
||||
"\n"
|
||||
"code:yyrestore =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYRESTORE\n"
|
||||
" : YYCURSOR \" = \" YYMARKER \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyrestorectx =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYRESTORECTX\n"
|
||||
" : YYCURSOR \" = \" YYCTXMARKER \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyrestoretag =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYRESTORETAG\n"
|
||||
" : YYCURSOR \" = \" tag \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshift =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSHIFT\n"
|
||||
" : YYCURSOR \" -= \" offset \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshiftstag =\n"
|
||||
" topindent (.nested ? \"if (\" tag \" != \" neg \") \") (.api.generic\n"
|
||||
" ? YYSHIFTSTAG\n"
|
||||
" : tag \" -= \" offset \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshiftmtag =\n"
|
||||
" topindent YYSHIFTMTAG nl;\n"
|
||||
"\n"
|
||||
"code:yystagp =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSTAGP\n"
|
||||
" : tag \" = \" YYCURSOR \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yymtagp =\n"
|
||||
" topindent YYMTAGP nl;\n"
|
||||
"\n"
|
||||
"code:yystagn =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSTAGN\n"
|
||||
" : tag \" = \" neg \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yymtagn =\n"
|
||||
" topindent YYMTAGN nl;\n"
|
||||
"\n"
|
||||
"code:yycopystag =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYCOPYSTAG\n"
|
||||
" : lhs \" = \" rhs \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yycopymtag =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYCOPYMTAG\n"
|
||||
" : lhs \" = \" rhs \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetaccept =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYGETACCEPT\n"
|
||||
" : (.api.record & (.storable_state | .code_model.recursive_functions) ? yyrecord \".\") var);\n"
|
||||
"\n"
|
||||
"code:yysetaccept =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSETACCEPT\n"
|
||||
" : (.api.record & (.storable_state | .code_model.recursive_functions) ? yyrecord \".\")\n"
|
||||
" var \" = \" val \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetcond =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYGETCOND\n"
|
||||
" : (.api.record ? yyrecord \".\") var);\n"
|
||||
"\n"
|
||||
"code:yysetcond =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSETCOND\n"
|
||||
" : (.api.record ? yyrecord \".\") var \" = \" val \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetstate =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYGETSTATE\n"
|
||||
" : (.api.record ? yyrecord \".\") var);\n"
|
||||
"\n"
|
||||
"code:yysetstate =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSETSTATE\n"
|
||||
" : (.api.record ? yyrecord \".\" var) \" = \" val \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yylessthan =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYLESSTHAN\n"
|
||||
" : (.many\n"
|
||||
" ? \"(\" YYLIMIT \" - \" YYCURSOR \") < \" need\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR));\n"
|
||||
"\n"
|
||||
"code:yybm_filter = yych \" & ~0xFF\";\n"
|
||||
"\n"
|
||||
"code:yybm_match = \"(\" yybm \"[\" offset \"+\" yych \"] & \" mask \") != 0\";\n"
|
||||
;
|
||||
@@ -0,0 +1,406 @@
|
||||
#include "src/parse/conf_parser.h"
|
||||
const char* DEFAULT_SYNTAX_GO =
|
||||
"// supported feature lists -----------------------------------------------------\n"
|
||||
"\n"
|
||||
"supported_apis = [\"simple\", \"generic\", \"record\"];\n"
|
||||
"supported_api_styles = [\"free-form\", \"functions\"];\n"
|
||||
"supported_code_models = [\"goto-label\", \"loop-switch\", \"recursive-functions\"];\n"
|
||||
"supported_targets = [\"code\", \"dot\"];\n"
|
||||
"supported_features = [\"nested-ifs\", \"bitmaps\", \"tags\", \"captures\", \"captvars\"];\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// language-specific options ---------------------------------------------------\n"
|
||||
"\n"
|
||||
"semicolons = 0;\n"
|
||||
"backtick_quoted_strings = 1;\n"
|
||||
"single_quoted_strings = 0;\n"
|
||||
"indentation_sensitive = 0;\n"
|
||||
"wrap_blocks_in_braces = 1;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// immutable configurations (command-line only options) ------------------------\n"
|
||||
"\n"
|
||||
"re2c:target = code;\n"
|
||||
"re2c:code-model = goto-label;\n"
|
||||
"re2c:input-encoding = ascii;\n"
|
||||
"re2c:date = 1;\n"
|
||||
"re2c:version = 1;\n"
|
||||
"re2c:conditions = 0;\n"
|
||||
"re2c:storable-state = 0;\n"
|
||||
"re2c:flex-syntax = 0;\n"
|
||||
"re2c:verbose = 0;\n"
|
||||
"re2c:line-dirs = 1;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// mutable configurations ------------------------------------------------------\n"
|
||||
"\n"
|
||||
"re2c:api = generic;\n"
|
||||
"re2c:api:style = free-form;\n"
|
||||
"re2c:api:sigil = \"@@\";\n"
|
||||
"re2c:YYGETCOND:naked = 0;\n"
|
||||
"re2c:YYSETCOND:naked = 0;\n"
|
||||
"re2c:YYSETCOND@cond = \"@@\";\n"
|
||||
"re2c:YYGETSTATE:naked = 0;\n"
|
||||
"re2c:YYSETSTATE:naked = 0;\n"
|
||||
"re2c:YYSETSTATE@state = \"@@\";\n"
|
||||
"re2c:YYFILL@len = \"@@\";\n"
|
||||
"re2c:YYFILL:naked = 0;\n"
|
||||
"re2c:YYFN = [\"<undefined-function-name>;<undefined-function-type>\"];\n"
|
||||
"re2c:yyfn:sep = \";\";\n"
|
||||
"re2c:yycond = \"yycond\";\n"
|
||||
"re2c:yyctable = \"yyctable\";\n"
|
||||
"re2c:yyaccept = \"yyaccept\";\n"
|
||||
"re2c:yytarget = \"yytarget\";\n"
|
||||
"re2c:yystate = \"yystate\";\n"
|
||||
"re2c:yynmatch = \"yynmatch\";\n"
|
||||
"re2c:yypmatch = \"yypmatch\";\n"
|
||||
"re2c:yyrecord = \"yyrecord\";\n"
|
||||
"re2c:yych = \"yych\";\n"
|
||||
"re2c:yych:conversion = 0;\n"
|
||||
"re2c:yych:literals = char-or-hex;\n"
|
||||
"re2c:yych:emit = (.code_model.recursive_functions ? 0 : 1);\n"
|
||||
"re2c:yybm = \"yybm\";\n"
|
||||
"re2c:yybm:hex = 0;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yystable = \"\"; // deprecated\n"
|
||||
"re2c:header = \"\";\n"
|
||||
"re2c:eof = -1;\n"
|
||||
"re2c:sentinel = -1;\n"
|
||||
"re2c:yyfill:enable = 1;\n"
|
||||
"re2c:yyfill:parameter = 1;\n"
|
||||
"re2c:yyfill:check = 1;\n"
|
||||
"re2c:tags = 0;\n"
|
||||
"re2c:tags:prefix = \"yyt\";\n"
|
||||
"re2c:captures = 0;\n"
|
||||
"re2c:captvars = 0;\n"
|
||||
"re2c:posix-captures = 0;\n"
|
||||
"re2c:posix-captvars = 0;\n"
|
||||
"re2c:invert-captures = 0;\n"
|
||||
"re2c:cond:abort = 1;\n"
|
||||
"re2c:cond:prefix = \"yyc_\";\n"
|
||||
"re2c:cond:enumprefix = \"yyc\";\n"
|
||||
"re2c:cond:divider@cond = \"@@\";\n"
|
||||
"re2c:cond:goto@cond = \"@@\";\n"
|
||||
"re2c:state:abort = (.code_model.goto_label ? 0 : 1); // historically disabled for goto/label\n"
|
||||
"re2c:state:nextlabel = 0;\n"
|
||||
"re2c:bit-vectors = 0;\n"
|
||||
"re2c:debug-output = 0;\n"
|
||||
"re2c:computed-gotos = 0;\n"
|
||||
"re2c:computed-gotos:threshold = 9;\n"
|
||||
"re2c:nested-ifs = 0;\n"
|
||||
"re2c:case-insensitive = 0;\n"
|
||||
"re2c:case-inverted = 0;\n"
|
||||
"re2c:case-ranges = 0;\n"
|
||||
"re2c:unsafe = 0;\n"
|
||||
"re2c:monadic = 0;\n"
|
||||
"re2c:encoding:ebcdic = 0;\n"
|
||||
"re2c:encoding:utf32 = 0;\n"
|
||||
"re2c:encoding:ucs2 = 0;\n"
|
||||
"re2c:encoding:utf16 = 0;\n"
|
||||
"re2c:encoding:utf8 = 0;\n"
|
||||
"re2c:encoding-policy = ignore;\n"
|
||||
"re2c:empty-class = match-empty;\n"
|
||||
"re2c:indent:string = \"\\t\";\n"
|
||||
"re2c:indent:top = 0;\n"
|
||||
"re2c:label:prefix = \"yy\";\n"
|
||||
"re2c:label:yyfill = \"yyFillLabel\";\n"
|
||||
"re2c:label:yyloop = \"yyl\";\n"
|
||||
"re2c:label:yyNext = \"yyNext\";\n"
|
||||
"re2c:label:start = 0;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// mutable code configuration --------------------------------------------------\n"
|
||||
"\n"
|
||||
"re2c:YYBACKUP = \"YYBACKUP\";\n"
|
||||
"re2c:YYBACKUPCTX = \"YYBACKUPCTX\";\n"
|
||||
"re2c:YYCONDTYPE = \"YYCONDTYPE\";\n"
|
||||
"re2c:YYCOPYMTAG = sigil \"{lhs} = \" sigil \"{rhs}\";\n"
|
||||
"re2c:YYCOPYSTAG = sigil \"{lhs} = \" sigil \"{rhs}\";\n"
|
||||
"re2c:YYCTYPE = \"YYCTYPE\";\n"
|
||||
"re2c:YYCTXMARKER = (.api.generic ? \"YYCTXMARKER\" : (.api.record ? yyrecord \".\") \"yyctxmarker\");\n"
|
||||
"re2c:YYCURSOR = (.api.generic ? \"YYCURSOR\" : (.api.record ? yyrecord \".\") \"yycursor\");\n"
|
||||
"re2c:YYDEBUG = \"YYDEBUG\";\n"
|
||||
"re2c:YYFILL = \"YYFILL\";\n"
|
||||
"re2c:YYGETACCEPT = sigil \"{var}\";\n"
|
||||
"re2c:YYGETCOND = \"YYGETCONDITION\"; // historic default\n"
|
||||
"re2c:YYGETSTATE = \"YYGETSTATE\";\n"
|
||||
"re2c:YYINPUT = (.api.generic ? \"YYINPUT\" : (.api.record ? yyrecord \".\") \"yyinput\");\n"
|
||||
"re2c:YYLESSTHAN = \"YYLESSTHAN\";\n"
|
||||
"re2c:YYLIMIT = (.api.generic ? \"YYLIMIT\" : (.api.record ? yyrecord \".\") \"yylimit\");\n"
|
||||
"re2c:YYMARKER = (.api.generic ? \"YYMARKER\" : (.api.record ? yyrecord \".\") \"yymarker\");\n"
|
||||
"re2c:YYMAXFILL = \"YYMAXFILL\";\n"
|
||||
"re2c:YYMAXNMATCH = \"YYMAXNMATCH\";\n"
|
||||
"re2c:YYMTAGN = \"YYMTAGN\";\n"
|
||||
"re2c:YYMTAGP = \"YYMTAGP\";\n"
|
||||
"re2c:YYPEEK = \"YYPEEK\";\n"
|
||||
"re2c:YYRESTORE = \"YYRESTORE\";\n"
|
||||
"re2c:YYRESTORECTX = \"YYRESTORECTX\";\n"
|
||||
"re2c:YYRESTORETAG = \"YYRESTORETAG\";\n"
|
||||
"re2c:YYSETACCEPT = sigil \"{var} = \" sigil \"{val}\";\n"
|
||||
"re2c:YYSETCOND = \"YYSETCONDITION\"; // historic default\n"
|
||||
"re2c:YYSETSTATE = \"YYSETSTATE\";\n"
|
||||
"re2c:YYSHIFT = \"YYSHIFT\";\n"
|
||||
"re2c:YYSHIFTSTAG = \"YYSHIFTSTAG\";\n"
|
||||
"re2c:YYSHIFTMTAG = \"YYSHIFTMTAG\";\n"
|
||||
"re2c:YYSKIP = \"YYSKIP\";\n"
|
||||
"re2c:YYSTAGN = \"YYSTAGN\";\n"
|
||||
"re2c:YYSTAGP = \"YYSTAGP\";\n"
|
||||
"re2c:tags:expression = (.api.record ? yyrecord \".\") sigil;\n"
|
||||
"re2c:tags:negative = (.api.generic ? \"@@\" : \"-1\");\n"
|
||||
"re2c:cond:divider = \"/* *********************************** */\";\n"
|
||||
"re2c:cond:goto = \"goto \" sigil;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// code templates --------------------------------------------------------------\n"
|
||||
"\n"
|
||||
"code:var_local = topindent (.init ? name \" := \" init : \"var \" name \" \" type) nl;\n"
|
||||
"code:var_global = topindent \"var \" name \" \" type (.init ? \" = \" init) nl;\n"
|
||||
"\n"
|
||||
"code:const_local = topindent \"const \" name \" = \" init nl;\n"
|
||||
"code:const_global = code:const_local;\n"
|
||||
"\n"
|
||||
"code:array_local =\n"
|
||||
" topindent name \" := [\" size \"]\" type \"{\" nl indent\n"
|
||||
" [row: topindent [elem{0:-2}: elem \", \"] [elem{-1}: elem \",\"] nl]\n"
|
||||
" dedent topindent \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:array_global =\n"
|
||||
" topindent \"var \" name \" = {\" nl indent\n"
|
||||
" [row: topindent [elem{0:-2}: elem \", \"] [elem{-1}: elem \",\"] nl]\n"
|
||||
" dedent topindent \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:array_elem = array \"[\" index \"]\";\n"
|
||||
"\n"
|
||||
"code:enum =\n"
|
||||
" \"const (\" nl indent\n"
|
||||
" [elem{0}: topindent elem \" = \" (.init ? init : \"iota\") nl]\n"
|
||||
" [elem{1:-1}: topindent elem (.init ? \" = \" init) nl]\n"
|
||||
" dedent \")\" nl;\n"
|
||||
"\n"
|
||||
"code:enum_elem = name;\n"
|
||||
"\n"
|
||||
"code:assign = topindent lhs \" = \" rhs nl;\n"
|
||||
"\n"
|
||||
"code:type_int = \"int\";\n"
|
||||
"code:type_uint = \"uint\";\n"
|
||||
"code:type_yybm = \"byte\";\n"
|
||||
"code:type_yytarget = <undefined>;\n"
|
||||
"\n"
|
||||
"code:cmp_eq = \"==\";\n"
|
||||
"code:cmp_ne = \"!=\";\n"
|
||||
"code:cmp_lt = \"<\";\n"
|
||||
"code:cmp_gt = \">\";\n"
|
||||
"code:cmp_le = \"<=\";\n"
|
||||
"code:cmp_ge = \">=\";\n"
|
||||
"\n"
|
||||
"code:if_then_else =\n"
|
||||
" [branch{0}: topindent \"if (\" cond \") {\" nl\n"
|
||||
" indent [stmt: stmt] dedent]\n"
|
||||
" [branch{1:-1}: topindent \"} else \" (.cond ? \"if (\" cond \") \") \"{\" nl\n"
|
||||
" indent [stmt: stmt] dedent]\n"
|
||||
" topindent \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:if_then_else_oneline = <undefined>;\n"
|
||||
"\n"
|
||||
"code:switch =\n"
|
||||
" topindent \"switch (\" expr \") {\" nl\n"
|
||||
" [case: case]\n"
|
||||
" topindent \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:switch_cases =\n"
|
||||
" [case{0:-2}: topindent case nl\n"
|
||||
" indent topindent \"fallthrough\" dedent nl]\n"
|
||||
" [case{-1}: topindent case nl]\n"
|
||||
" indent [stmt: stmt] dedent;\n"
|
||||
"\n"
|
||||
"code:switch_cases_oneline = <undefined>;\n"
|
||||
"\n"
|
||||
"code:switch_case_range = \"case \" [val{0}: val] [val{1:-1}: \",\" val] \":\";\n"
|
||||
"\n"
|
||||
"code:switch_case_default = \"default:\";\n"
|
||||
"\n"
|
||||
"code:loop =\n"
|
||||
" (.loop_label ? label \":\" nl)\n"
|
||||
" topindent \"for {\" nl\n"
|
||||
" indent [stmt: stmt] dedent\n"
|
||||
" topindent \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:continue = topindent \"continue\" (.loop_label ? \" \" label) nl;\n"
|
||||
"\n"
|
||||
"code:goto = topindent \"goto \" label nl;\n"
|
||||
"\n"
|
||||
"code:fndecl = <undefined>;\n"
|
||||
"\n"
|
||||
"code:fndef =\n"
|
||||
" topindent \"func \" name \"(\"\n"
|
||||
" [arg{0:-2}: argname \" \" argtype \", \"]\n"
|
||||
" [arg{-1}: argname \" \" argtype]\n"
|
||||
" \")\" (.type ? \" \" type) \" {\" nl\n"
|
||||
" indent [stmt: stmt] dedent\n"
|
||||
" \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:fncall =\n"
|
||||
" topindent (.retval ? retval \" = \") name \"(\" [arg{0:-2}: arg \", \"] [arg{-1}: arg] \")\" nl;\n"
|
||||
"\n"
|
||||
"code:tailcall =\n"
|
||||
" topindent (.retval ? \"return \") name \"(\" [arg{0:-2}: arg \", \"] [arg{-1}: arg] \")\" nl;\n"
|
||||
"\n"
|
||||
"code:recursive_functions = [fn: fndef nl];\n"
|
||||
"\n"
|
||||
"code:fingerprint =\n"
|
||||
" \"// Code generated by re2go\" (.version ? \" \" version) (.date ? \" on \" date) \", DO NOT EDIT.\" nl;\n"
|
||||
"\n"
|
||||
"code:line_info = \"//line \\\"\" file \"\\\":\" line nl;\n"
|
||||
"\n"
|
||||
"code:abort = topindent \"panic(\\\"internal lexer error\\\")\" nl;\n"
|
||||
"\n"
|
||||
"code:yydebug =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYDEBUG (.api_style.functions ? \"()\")\n"
|
||||
" : (.api.record\n"
|
||||
" ? YYDEBUG \"(\" yyrecord \")\"\n"
|
||||
" : YYDEBUG \"(\" state \", \" yych \")\"\n"
|
||||
" )) nl;\n"
|
||||
"\n"
|
||||
"code:yypeek =\n"
|
||||
" topindent yych (.code_model.recursive_functions ? \" := \" : \" = \") (.api.generic\n"
|
||||
" ? YYPEEK (.api_style.functions ? \"()\")\n"
|
||||
" : (.cast ? YYCTYPE \"(\") YYINPUT \"[\" YYCURSOR \"]\" (.cast ? \")\")\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyskip =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSKIP (.api_style.functions ? \"()\")\n"
|
||||
" : YYCURSOR \" += 1\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yybackup =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYBACKUP (.api_style.functions ? \"()\")\n"
|
||||
" : YYMARKER \" = \" YYCURSOR\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yybackupctx =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYBACKUPCTX (.api_style.functions ? \"()\")\n"
|
||||
" : YYCTXMARKER \" = \" YYCURSOR\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyskip_yypeek = <undefined>;\n"
|
||||
"code:yypeek_yyskip = <undefined>;\n"
|
||||
"code:yyskip_yybackup = <undefined>;\n"
|
||||
"code:yybackup_yyskip = <undefined>;\n"
|
||||
"code:yybackup_yypeek = <undefined>;\n"
|
||||
"code:yyskip_yybackup_yypeek = <undefined>;\n"
|
||||
"code:yybackup_yypeek_yyskip = <undefined>;\n"
|
||||
"\n"
|
||||
"code:yyrestore =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYRESTORE (.api_style.functions ? \"()\")\n"
|
||||
" : YYCURSOR \" = \" YYMARKER\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyrestorectx =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYRESTORECTX (.api_style.functions ? \"()\")\n"
|
||||
" : YYCURSOR \" = \" YYCTXMARKER\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyrestoretag =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYRESTORETAG (.api_style.functions ? \"(\" tag \")\")\n"
|
||||
" : YYCURSOR \" = \" tag\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshift =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSHIFT (.api_style.functions ? \"(-\" offset \")\")\n"
|
||||
" : YYCURSOR \" -= \" offset\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshiftstag =\n"
|
||||
" (.nested ? topindent \"if (\" tag \" != \" neg \") {\" nl indent)\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSHIFTSTAG (.api_style.functions ? \"(\" tag \", -\" offset \")\")\n"
|
||||
" : tag \" -= \" offset\n"
|
||||
" ) nl\n"
|
||||
" (.nested ? dedent topindent \"}\" nl);\n"
|
||||
"\n"
|
||||
"code:yyshiftmtag =\n"
|
||||
" topindent YYSHIFTMTAG (.api_style.functions ? \"(\" tag \", -\" offset \")\") nl;\n"
|
||||
"\n"
|
||||
"code:yystagp =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSTAGP (.api_style.functions ? \"(\" tag \")\")\n"
|
||||
" : tag \" = \" YYCURSOR\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yymtagp =\n"
|
||||
" topindent YYMTAGP (.api_style.functions ? \"(\" tag \")\") nl;\n"
|
||||
"\n"
|
||||
"code:yystagn =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSTAGN (.api_style.functions ? \"(\" tag \")\")\n"
|
||||
" : tag \" = \" neg\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yymtagn =\n"
|
||||
" topindent YYMTAGN (.api_style.functions ? \"(\" tag \")\") nl;\n"
|
||||
"\n"
|
||||
"code:yycopystag =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYCOPYSTAG // function style is not supported, as there's no sensible default\n"
|
||||
" : lhs \" = \" rhs\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yycopymtag =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYCOPYMTAG // function style is not supported, as there's no sensible default\n"
|
||||
" : lhs \" = \" rhs\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetaccept =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYGETACCEPT // function style is not supported, as there's no sensible default\n"
|
||||
" : (.api.record & (.storable_state | .code_model.recursive_functions) ? yyrecord \".\") var);\n"
|
||||
"\n"
|
||||
"code:yysetaccept =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSETACCEPT // function style is not supported, as there's no sensible default\n"
|
||||
" : (.api.record & (.storable_state | .code_model.recursive_functions) ? yyrecord \".\")\n"
|
||||
" var \" = \" val\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetcond =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYGETCOND (.api_style.functions ? \"()\")\n"
|
||||
" : (.api.record ? yyrecord \".\") var);\n"
|
||||
"\n"
|
||||
"code:yysetcond =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSETCOND (.api_style.functions ? \"(\" val \")\")\n"
|
||||
" : (.api.record ? yyrecord \".\") var \" = \" val \n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetstate =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYGETSTATE (.api_style.functions ? \"()\")\n"
|
||||
" : (.api.record ? yyrecord \".\") var);\n"
|
||||
"\n"
|
||||
"code:yysetstate =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSETSTATE (.api_style.functions ? \"(\" val \")\")\n"
|
||||
" : (.api.record ? yyrecord \".\") var \" = \" val\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yylessthan =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYLESSTHAN (.api_style.functions ? \"(\" need \")\")\n"
|
||||
" : (.many\n"
|
||||
" ? \"(\" YYLIMIT \" - \" YYCURSOR \") < \" need\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR));\n"
|
||||
"\n"
|
||||
"code:yybm_filter = yych \" & ~0xFF\";\n"
|
||||
"\n"
|
||||
"code:yybm_match = \"(\" yybm \"[\" offset \"+\" yych \"] & \" mask \") != 0\";\n"
|
||||
;
|
||||
@@ -0,0 +1,418 @@
|
||||
#include "src/parse/conf_parser.h"
|
||||
const char* DEFAULT_SYNTAX_HASKELL =
|
||||
"// supported feature lists -----------------------------------------------------\n"
|
||||
"\n"
|
||||
"supported_apis = [\"record\", \"generic\"];\n"
|
||||
"supported_api_styles = [\"free-form\"];\n"
|
||||
"supported_code_models = [\"recursive-functions\"];\n"
|
||||
"supported_targets = [\"code\", \"dot\"];\n"
|
||||
"supported_features = [\"nested-ifs\", \"bitmaps\", \"monadic\", \"tags\", \"captvars\"];\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// language-specific options ---------------------------------------------------\n"
|
||||
"\n"
|
||||
"semicolons = 0;\n"
|
||||
"backtick_quoted_strings = 0;\n"
|
||||
"single_quoted_strings = 0;\n"
|
||||
"indentation_sensitive = 1;\n"
|
||||
"wrap_blocks_in_braces = 0;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// immutable configurations (command-line only options) ------------------------\n"
|
||||
"\n"
|
||||
"re2c:target = code;\n"
|
||||
"re2c:code-model = recursive-functions;\n"
|
||||
"re2c:input-encoding = ascii;\n"
|
||||
"re2c:date = 1;\n"
|
||||
"re2c:version = 1;\n"
|
||||
"re2c:conditions = 0;\n"
|
||||
"re2c:storable-state = 0;\n"
|
||||
"re2c:flex-syntax = 0;\n"
|
||||
"re2c:verbose = 0;\n"
|
||||
"re2c:line-dirs = 1;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// mutable configurations ------------------------------------------------------\n"
|
||||
"\n"
|
||||
"re2c:api = record;\n"
|
||||
"re2c:api:style = free-form;\n"
|
||||
"re2c:api:sigil = \"@@\";\n"
|
||||
"re2c:YYGETCOND:naked = 0;\n"
|
||||
"re2c:YYSETCOND:naked = 0;\n"
|
||||
"re2c:YYSETCOND@cond = \"@@\";\n"
|
||||
"re2c:YYGETSTATE:naked = 0;\n"
|
||||
"re2c:YYSETSTATE:naked = 0;\n"
|
||||
"re2c:YYSETSTATE@state = \"@@\";\n"
|
||||
"re2c:YYFILL@len = \"@@\";\n"
|
||||
"re2c:YYFILL:naked = 0;\n"
|
||||
"re2c:YYFN = [\"<undefined-function-name>;<undefined-function-type>\"];\n"
|
||||
"re2c:yyfn:sep = \";\";\n"
|
||||
"re2c:yycond = \"_yycond\";\n"
|
||||
"re2c:yyctable = \"\"; // unused\n"
|
||||
"re2c:yyaccept = \"_yyaccept\";\n"
|
||||
"re2c:yytarget = \"\"; // unused\n"
|
||||
"re2c:yystate = \"_yystate\";\n"
|
||||
"re2c:yynmatch = \"yynmatch\";\n"
|
||||
"re2c:yypmatch = \"yypmatch\";\n"
|
||||
"re2c:yyrecord = \"yyrecord\";\n"
|
||||
"re2c:yych = \"yych\";\n"
|
||||
"re2c:yych:conversion = 0;\n"
|
||||
"re2c:yych:literals = hex;\n"
|
||||
"re2c:yych:emit = (.code_model.recursive_functions ? 0 : 1);\n"
|
||||
"re2c:yybm = \"yybm\";\n"
|
||||
"re2c:yybm:hex = 0;\n"
|
||||
"re2c:yyfill = \"yyfill\";\n"
|
||||
"re2c:yystable = \"\"; // deprecated\n"
|
||||
"re2c:header = \"\";\n"
|
||||
"re2c:eof = -1;\n"
|
||||
"re2c:sentinel = -1;\n"
|
||||
"re2c:yyfill:enable = 1;\n"
|
||||
"re2c:yyfill:parameter = 1;\n"
|
||||
"re2c:yyfill:check = 1;\n"
|
||||
"re2c:tags = 0;\n"
|
||||
"re2c:tags:prefix = \"_yyt\";\n"
|
||||
"re2c:captures = 0;\n"
|
||||
"re2c:captvars = 0;\n"
|
||||
"re2c:posix-captures = 0;\n"
|
||||
"re2c:posix-captvars = 0;\n"
|
||||
"re2c:invert-captures = 0;\n"
|
||||
"re2c:cond:abort = 1;\n"
|
||||
"re2c:cond:prefix = \"yyc_\";\n"
|
||||
"re2c:cond:enumprefix = \"YYC_\";\n"
|
||||
"re2c:cond:divider@cond = \"@@\";\n"
|
||||
"re2c:cond:goto@cond = \"@@\";\n"
|
||||
"re2c:state:abort = 1;\n"
|
||||
"re2c:state:nextlabel = 0;\n"
|
||||
"re2c:bit-vectors = 0;\n"
|
||||
"re2c:debug-output = 0;\n"
|
||||
"re2c:computed-gotos = 0;\n"
|
||||
"re2c:computed-gotos:threshold = 9;\n"
|
||||
"re2c:nested-ifs = 0;\n"
|
||||
"re2c:case-insensitive = 0;\n"
|
||||
"re2c:case-inverted = 0;\n"
|
||||
"re2c:case-ranges = 0;\n"
|
||||
"re2c:unsafe = 0;\n"
|
||||
"re2c:monadic = 0;\n"
|
||||
"re2c:encoding:ebcdic = 0;\n"
|
||||
"re2c:encoding:utf32 = 0;\n"
|
||||
"re2c:encoding:ucs2 = 0;\n"
|
||||
"re2c:encoding:utf16 = 0;\n"
|
||||
"re2c:encoding:utf8 = 0;\n"
|
||||
"re2c:encoding-policy = ignore;\n"
|
||||
"re2c:empty-class = match-empty;\n"
|
||||
"re2c:indent:string = \" \";\n"
|
||||
"re2c:indent:top = 0;\n"
|
||||
"re2c:label:prefix = \"yy\"; // used for generating function names\n"
|
||||
"re2c:label:yyfill = \"\";\n"
|
||||
"re2c:label:yyloop = \"\";\n"
|
||||
"re2c:label:yyNext = \"\";\n"
|
||||
"re2c:label:start = 0;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// mutable code configuration --------------------------------------------------\n"
|
||||
"\n"
|
||||
"re2c:YYBACKUP = \"yybackup\";\n"
|
||||
"re2c:YYBACKUPCTX = \"yybackupctx\";\n"
|
||||
"re2c:YYCONDTYPE = \"YYCONDTYPE\";\n"
|
||||
"re2c:YYCOPYMTAG = \"yycopymtag\";\n"
|
||||
"re2c:YYCOPYSTAG = \"yycopystag\";\n"
|
||||
"re2c:YYCTYPE = \"YYCTYPE\";\n"
|
||||
"re2c:YYCTXMARKER = \"_yyctxmarker\";\n"
|
||||
"re2c:YYCURSOR = \"_yycursor\";\n"
|
||||
"re2c:YYDEBUG = \"yydebug\";\n"
|
||||
"re2c:YYFILL = \"yyfill\";\n"
|
||||
"re2c:YYGETACCEPT = \"yygetaccept\";\n"
|
||||
"re2c:YYGETCOND = \"yygetcond\";\n"
|
||||
"re2c:YYGETSTATE = \"yygetstate\";\n"
|
||||
"re2c:YYINPUT = \"_yyinput\";\n"
|
||||
"re2c:YYLESSTHAN = \"yylessthan\";\n"
|
||||
"re2c:YYLIMIT = \"_yylimit\";\n"
|
||||
"re2c:YYMARKER = \"_yymarker\";\n"
|
||||
"re2c:YYMAXFILL = \"yymaxfill\";\n"
|
||||
"re2c:YYMAXNMATCH = \"yymaxnmatch\";\n"
|
||||
"re2c:YYMTAGN = \"yymtagn\";\n"
|
||||
"re2c:YYMTAGP = \"yymtagp\";\n"
|
||||
"re2c:YYPEEK = (.api.record ? \"index\" : \"yypeek\");\n"
|
||||
"re2c:YYRESTORE = \"yyrestore\";\n"
|
||||
"re2c:YYRESTORECTX = \"yyrestorectx\";\n"
|
||||
"re2c:YYRESTORETAG = \"yyrestoretag\";\n"
|
||||
"re2c:YYSETACCEPT = \"yysetaccept\";\n"
|
||||
"re2c:YYSETCOND = \"yysetcond\";\n"
|
||||
"re2c:YYSETSTATE = \"yysetstate\";\n"
|
||||
"re2c:YYSHIFT = \"yyshift\";\n"
|
||||
"re2c:YYSHIFTSTAG = \"yyshiftstag\";\n"
|
||||
"re2c:YYSHIFTMTAG = \"yyshiftmtag\";\n"
|
||||
"re2c:YYSKIP = \"yyskip\";\n"
|
||||
"re2c:YYSTAGN = \"yystagn\";\n"
|
||||
"re2c:YYSTAGP = \"yystagp\";\n"
|
||||
"re2c:tags:expression = sigil;\n"
|
||||
"re2c:tags:negative = (.api.generic ? \"@@\" : \"(-1)\");\n"
|
||||
"re2c:cond:divider = \"\";\n"
|
||||
"re2c:cond:goto = \"\";\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// code templates --------------------------------------------------------------\n"
|
||||
"\n"
|
||||
"code:var_local = topindent \"let \" name \" = \" init \" in\" nl;\n"
|
||||
"code:var_global = topindent \"let \" name \" = \" init nl;\n"
|
||||
"\n"
|
||||
"code:const_local = topindent \"let \" name \" = \" init \" in\" nl;\n"
|
||||
"code:const_global = topindent name \" = \" init nl;\n"
|
||||
"\n"
|
||||
"code:array_local = <undefined>;\n"
|
||||
"\n"
|
||||
"code:array_global =\n"
|
||||
" topindent name \" :: Array Int \" type nl\n"
|
||||
" topindent name \" = array (0, \" size \" - 1) $ Prelude.zip [0 .. \" size \" - 1] [\" nl indent\n"
|
||||
" [row{0:-2}: topindent [elem{0:-2}: elem \", \"] [elem{-1}: elem \",\"] nl]\n"
|
||||
" [row{-1}: topindent [elem{0:-2}: elem \", \"] [elem{-1}: elem \"]\"] nl];\n"
|
||||
"\n"
|
||||
"code:array_elem = array \" ! \" index;\n"
|
||||
"\n"
|
||||
"code:enum =\n"
|
||||
" \"data \" type \" = \"\n"
|
||||
" [elem{0:-2}: elem \" | \"]\n"
|
||||
" [elem{-1}: elem] \" deriving (Eq, Show)\"\n"
|
||||
" nl;\n"
|
||||
"\n"
|
||||
"code:enum_elem = name;\n"
|
||||
"\n"
|
||||
"code:assign = <undefined>;\n"
|
||||
"\n"
|
||||
"code:type_int = <undefined>;\n"
|
||||
"code:type_uint = <undefined>;\n"
|
||||
"code:type_yybm = \"Word8\";\n"
|
||||
"code:type_yytarget = <undefined>;\n"
|
||||
"\n"
|
||||
"code:cmp_eq = \"==\";\n"
|
||||
"code:cmp_ne = \"/=\";\n"
|
||||
"code:cmp_lt = \"<\";\n"
|
||||
"code:cmp_gt = \">\";\n"
|
||||
"code:cmp_le = \"<=\";\n"
|
||||
"code:cmp_ge = \">=\";\n"
|
||||
"\n"
|
||||
"code:if_then_else =\n"
|
||||
" [branch{0}: topindent (.many ? \"if \" cond \" then\" : \"when (\" cond \") $\") (.monadic ? \" do\") nl\n"
|
||||
" indent [stmt: stmt] dedent]\n"
|
||||
" [branch{1:-1}: topindent \"else\" (.cond ? \" if \" cond \" then\") (.monadic ? \" do\") nl\n"
|
||||
" indent [stmt: stmt] dedent];\n"
|
||||
"\n"
|
||||
"code:if_then_else_oneline =\n"
|
||||
" [branch{0}: topindent (.many ? \"if \" cond \" then \" : \"when (\" cond \") $ \") [stmt: stmt] nl]\n"
|
||||
" [branch{1:-1}: topindent \"else \" (.cond ? \"if \" cond \" then \") [stmt: stmt] nl];\n"
|
||||
"\n"
|
||||
"code:switch =\n"
|
||||
" topindent \"case \" expr \" of\" nl\n"
|
||||
" indent [case: case] dedent;\n"
|
||||
"\n"
|
||||
"code:switch_cases = topindent \"_c | \"\n"
|
||||
" [case{0:-2}: case \" || \"]\n"
|
||||
" [case{-1}: case \" ->\" (.monadic ? \" do\") nl\n"
|
||||
" indent [stmt: stmt] dedent\n"
|
||||
" ];\n"
|
||||
"\n"
|
||||
"code:switch_cases_oneline = <undefined>;\n"
|
||||
"\n"
|
||||
"code:switch_case_range = (.many\n"
|
||||
" ? [val{0}: val] \" <= _c && _c <= \" [val{-1}: val]\n"
|
||||
" : [val{0}: val] \" == _c\");\n"
|
||||
"\n"
|
||||
"code:switch_case_default = \"True\";\n"
|
||||
"\n"
|
||||
"code:loop = <undefined>;\n"
|
||||
"\n"
|
||||
"code:continue = <undefined>;\n"
|
||||
"\n"
|
||||
"code:goto = <undefined>;\n"
|
||||
"\n"
|
||||
"code:fndecl = <undefined>;\n"
|
||||
"\n"
|
||||
"code:fndef =\n"
|
||||
" name \" :: \" [arg: argtype \" -> \"] type nl\n"
|
||||
" name [arg: \" \" argname] \" =\" (.monadic ? \" do\") nl\n"
|
||||
" indent [stmt: stmt] dedent;\n"
|
||||
"\n"
|
||||
"code:fncall =\n"
|
||||
" topindent (.retval ? \"let \" retval \" = \")\n"
|
||||
" name (.args ? [arg: \" \" arg] : \" ()\") nl;\n"
|
||||
"\n"
|
||||
"code:tailcall = topindent name (.args ? [arg: \" \" arg] : \" ()\") nl;\n"
|
||||
"\n"
|
||||
"code:recursive_functions = [fn: fndef nl];\n"
|
||||
"\n"
|
||||
"code:fingerprint =\n"
|
||||
" \"-- Generated by re2hs\" (.version ? \" \" version) (.date ? \" on \" date) nl\n"
|
||||
" (.api.record ? \"{-# LANGUAGE RecordWildCards #-}\" nl);\n"
|
||||
"\n"
|
||||
"code:line_info = \"#\" line \" \\\"\" file \"\\\"\" nl;\n"
|
||||
"\n"
|
||||
"code:abort = topindent \"error \\\"internal lexer error\\\"\" nl;\n"
|
||||
"\n"
|
||||
"code:yydebug = topindent YYDEBUG nl;\n"
|
||||
"\n"
|
||||
"code:yypeek =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? (.monadic\n"
|
||||
" ? yych \" <- return $ \" YYPEEK \" \" YYINPUT \" \" YYCURSOR\n"
|
||||
" : \"let \" yych \" = \" YYPEEK \" \" YYINPUT \" \" YYCURSOR \" in\")\n"
|
||||
" : (.monadic\n"
|
||||
" ? yych \" <- \" YYPEEK\n"
|
||||
" : \"let \" yych \" = \" YYPEEK \" in\")\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyskip =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? (.monadic\n"
|
||||
" ? YYCURSOR \" <- return $ \" YYCURSOR \" + 1\"\n"
|
||||
" : \"let __ = \" YYCURSOR \" + 1 in let \" YYCURSOR \" = __ in\")\n"
|
||||
" : YYSKIP\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yybackup =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? (.monadic\n"
|
||||
" ? \"let \" YYMARKER \" = \" YYCURSOR\n"
|
||||
" : \"let \" YYMARKER \" = \" YYCURSOR \" in\")\n"
|
||||
" : YYBACKUP\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yybackupctx =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? (.monadic\n"
|
||||
" ? \"let \" YYCTXMARKER \" = \" YYCURSOR\n"
|
||||
" : \"let \" YYCTXMARKER \" = \" YYCURSOR \" in\")\n"
|
||||
" : YYBACKUPCTX\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyskip_yypeek = <undefined>;\n"
|
||||
"code:yypeek_yyskip = <undefined>;\n"
|
||||
"code:yyskip_yybackup = <undefined>;\n"
|
||||
"code:yybackup_yyskip = <undefined>;\n"
|
||||
"code:yybackup_yypeek = <undefined>;\n"
|
||||
"code:yyskip_yybackup_yypeek = <undefined>;\n"
|
||||
"code:yybackup_yypeek_yyskip = <undefined>;\n"
|
||||
"\n"
|
||||
"code:yyrestore =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? (.monadic\n"
|
||||
" ? \"let \" YYCURSOR \" = \" YYMARKER\n"
|
||||
" : \"let \" YYCURSOR \" = \" YYMARKER \" in\")\n"
|
||||
" : YYRESTORE\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyrestorectx =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? (.monadic\n"
|
||||
" ? \"let \" YYCURSOR \" = \" YYCTXMARKER\n"
|
||||
" : \"let \" YYCURSOR \" = \" YYCTXMARKER \" in\")\n"
|
||||
" : YYRESTORECTX\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyrestoretag =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? (.monadic\n"
|
||||
" ? \"let \" YYCURSOR \" = \" tag\n"
|
||||
" : \"let \" YYCURSOR \" = \" tag \" in\")\n"
|
||||
" : YYRESTORETAG\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshift =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? (.monadic\n"
|
||||
" ? YYCURSOR \" <- return $ \" YYCURSOR \" - \" offset\n"
|
||||
" : \"let __ = \" YYCURSOR \" - \" offset \" in let \" YYCURSOR \" = __ in\")\n"
|
||||
" : YYSHIFT\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshiftstag =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? (.monadic\n"
|
||||
" ? tag \" <- return $ if \" tag \" == \" neg \" then \" neg \" else \" tag \" - \" offset\n"
|
||||
" : \"let __ = if \" tag \" == \" neg \" then \" neg \" else \" tag \" - \" offset\n"
|
||||
" \" in let \" tag \" = __ in\")\n"
|
||||
" : YYSHIFTSTAG\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshiftmtag =\n"
|
||||
" topindent YYSHIFTMTAG nl;\n"
|
||||
"\n"
|
||||
"code:yystagp =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? (.monadic\n"
|
||||
" ? \"let \" tag \" = \" YYCURSOR\n"
|
||||
" : \"let \" tag \" = \" YYCURSOR \" in\")\n"
|
||||
" : YYSTAGP\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yymtagp =\n"
|
||||
" topindent YYMTAGP nl;\n"
|
||||
"\n"
|
||||
"code:yystagn =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? (.monadic\n"
|
||||
" ? \"let \" tag \" = \" neg\n"
|
||||
" : \"let \" tag \" = \" neg \" in\")\n"
|
||||
" : YYSTAGN\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yymtagn =\n"
|
||||
" topindent YYMTAGN nl;\n"
|
||||
"\n"
|
||||
"code:yycopystag =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? (.monadic\n"
|
||||
" ? \"let \" lhs \" = \" rhs\n"
|
||||
" : \"let \" lhs \" = \" rhs \" in\")\n"
|
||||
" : YYCOPYSTAG\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yycopymtag =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? (.monadic\n"
|
||||
" ? \"let \" lhs \" = \" rhs\n"
|
||||
" : \"let \" lhs \" = \" rhs \" in\")\n"
|
||||
" : YYCOPYMTAG\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetaccept =\n"
|
||||
" (.api.record ? var : YYGETACCEPT);\n"
|
||||
"\n"
|
||||
"code:yysetaccept =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? (.monadic\n"
|
||||
" ? \"let \" var \" = \" val\n"
|
||||
" : \"let \" var \" = \" val \" in\")\n"
|
||||
" : YYSETACCEPT\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetcond =\n"
|
||||
" (.api.record ? var : YYGETCOND);\n"
|
||||
"\n"
|
||||
"code:yysetcond =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? (.monadic\n"
|
||||
" ? \"let \" var \" = \" val\n"
|
||||
" : \"let \" var \" = \" val \" in\")\n"
|
||||
" : YYSETCOND\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetstate =\n"
|
||||
" (.api.record ? var : YYGETSTATE);\n"
|
||||
"\n"
|
||||
"code:yysetstate =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? (.monadic\n"
|
||||
" ? \"let \" var \" = \" val\n"
|
||||
" : \"let \" var \" = \" val \" in\")\n"
|
||||
" : YYSETSTATE\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yylessthan =\n"
|
||||
" (.api.record\n"
|
||||
" ? YYCURSOR \" >= \" YYLIMIT // YYFILL check can only be used with EOF rule $\n"
|
||||
" : YYLESSTHAN);\n"
|
||||
"\n"
|
||||
"code:yybm_filter = \"(\" yych \" .&. complement 0xFF) /= 0\";\n"
|
||||
"\n"
|
||||
"code:yybm_match = \"(\" yybm \" ! (\" offset \" + fromIntegral \" yych \") .&. \" mask \") /= 0\";\n"
|
||||
;
|
||||
@@ -0,0 +1,382 @@
|
||||
#include "src/parse/conf_parser.h"
|
||||
const char* DEFAULT_SYNTAX_JAVA =
|
||||
"// supported feature lists -----------------------------------------------------\n"
|
||||
"\n"
|
||||
"supported_apis = [\"simple\", \"generic\", \"record\"];\n"
|
||||
"supported_api_styles = [\"free-form\"];\n"
|
||||
"supported_code_models = [\"loop-switch\"];\n"
|
||||
"supported_targets = [\"code\", \"dot\"];\n"
|
||||
"supported_features = [\"nested-ifs\", \"bitmaps\", \"tags\", \"captures\", \"captvars\"];\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// language-specific options ---------------------------------------------------\n"
|
||||
"\n"
|
||||
"semicolons = 1;\n"
|
||||
"backtick_quoted_strings = 0;\n"
|
||||
"single_quoted_strings = 0;\n"
|
||||
"indentation_sensitive = 0;\n"
|
||||
"wrap_blocks_in_braces = 1;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// immutable configurations (command-line only options) ------------------------\n"
|
||||
"\n"
|
||||
"re2c:target = code;\n"
|
||||
"re2c:code-model = loop-switch;\n"
|
||||
"re2c:input-encoding = ascii;\n"
|
||||
"re2c:date = 1;\n"
|
||||
"re2c:version = 1;\n"
|
||||
"re2c:conditions = 0;\n"
|
||||
"re2c:storable-state = 0;\n"
|
||||
"re2c:flex-syntax = 0;\n"
|
||||
"re2c:verbose = 0;\n"
|
||||
"re2c:line-dirs = 0;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// mutable configurations ------------------------------------------------------\n"
|
||||
"\n"
|
||||
"re2c:api = simple;\n"
|
||||
"re2c:api:style = free-form;\n"
|
||||
"re2c:api:sigil = \"@@\";\n"
|
||||
"re2c:YYGETCOND:naked = 0;\n"
|
||||
"re2c:YYSETCOND:naked = 0;\n"
|
||||
"re2c:YYSETCOND@cond = \"@@\";\n"
|
||||
"re2c:YYGETSTATE:naked = 0;\n"
|
||||
"re2c:YYSETSTATE:naked = 0;\n"
|
||||
"re2c:YYSETSTATE@state = \"@@\";\n"
|
||||
"re2c:YYFILL@len = \"@@\";\n"
|
||||
"re2c:YYFILL:naked = 0;\n"
|
||||
"re2c:YYFN = [\"<undefined-function-name>;<undefined-function-type>\"];\n"
|
||||
"re2c:yyfn:sep = \";\";\n"
|
||||
"re2c:yycond = \"yycond\";\n"
|
||||
"re2c:yyctable = \"yyctable\";\n"
|
||||
"re2c:yyaccept = \"yyaccept\";\n"
|
||||
"re2c:yytarget = \"yytarget\";\n"
|
||||
"re2c:yystate = \"yystate\";\n"
|
||||
"re2c:yynmatch = \"yynmatch\";\n"
|
||||
"re2c:yypmatch = \"yypmatch\";\n"
|
||||
"re2c:yyrecord = \"yyrecord\";\n"
|
||||
"re2c:yych = \"yych\";\n"
|
||||
"re2c:yych:conversion = 0;\n"
|
||||
"re2c:yych:literals = hex;\n"
|
||||
"re2c:yych:emit = 1;\n"
|
||||
"re2c:yybm = \"yybm\";\n"
|
||||
"re2c:yybm:hex = 0;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yystable = \"\"; // deprecated\n"
|
||||
"re2c:header = \"\";\n"
|
||||
"re2c:eof = -1;\n"
|
||||
"re2c:sentinel = -1;\n"
|
||||
"re2c:yyfill:enable = 1;\n"
|
||||
"re2c:yyfill:parameter = 1;\n"
|
||||
"re2c:yyfill:check = 1;\n"
|
||||
"re2c:tags = 0;\n"
|
||||
"re2c:tags:prefix = \"yyt\";\n"
|
||||
"re2c:captures = 0;\n"
|
||||
"re2c:captvars = 0;\n"
|
||||
"re2c:posix-captures = 0;\n"
|
||||
"re2c:posix-captvars = 0;\n"
|
||||
"re2c:invert-captures = 0;\n"
|
||||
"re2c:cond:abort = 0;\n"
|
||||
"re2c:cond:prefix = \"yyc_\";\n"
|
||||
"re2c:cond:enumprefix = \"YYC_\";\n"
|
||||
"re2c:cond:divider@cond = \"@@\";\n"
|
||||
"re2c:cond:goto@cond = \"@@\";\n"
|
||||
"re2c:state:abort = 1;\n"
|
||||
"re2c:state:nextlabel = 0;\n"
|
||||
"re2c:bit-vectors = 0;\n"
|
||||
"re2c:debug-output = 0;\n"
|
||||
"re2c:computed-gotos = 0;\n"
|
||||
"re2c:computed-gotos:threshold = 9;\n"
|
||||
"re2c:nested-ifs = 0;\n"
|
||||
"re2c:case-insensitive = 0;\n"
|
||||
"re2c:case-inverted = 0;\n"
|
||||
"re2c:case-ranges = 0;\n"
|
||||
"re2c:unsafe = 0;\n"
|
||||
"re2c:monadic = 0;\n"
|
||||
"re2c:encoding:ebcdic = 0;\n"
|
||||
"re2c:encoding:utf32 = 0;\n"
|
||||
"re2c:encoding:ucs2 = 0;\n"
|
||||
"re2c:encoding:utf16 = 0;\n"
|
||||
"re2c:encoding:utf8 = 0;\n"
|
||||
"re2c:encoding-policy = ignore;\n"
|
||||
"re2c:empty-class = match-empty;\n"
|
||||
"re2c:indent:string = \" \";\n"
|
||||
"re2c:indent:top = 0;\n"
|
||||
"re2c:label:prefix = \"\";\n"
|
||||
"re2c:label:yyfill = \"\";\n"
|
||||
"re2c:label:yyloop = \"yyl\";\n"
|
||||
"re2c:label:yyNext = \"\";\n"
|
||||
"re2c:label:start = 0;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// mutable code configuration --------------------------------------------------\n"
|
||||
"\n"
|
||||
"re2c:YYBACKUP = \"yybackup\";\n"
|
||||
"re2c:YYBACKUPCTX = \"yybackupctx\";\n"
|
||||
"re2c:YYCONDTYPE = \"int\";\n"
|
||||
"re2c:YYCOPYMTAG = sigil \"{lhs} = \" sigil \"{rhs};\";\n"
|
||||
"re2c:YYCOPYSTAG = sigil \"{lhs} = \" sigil \"{rhs};\";\n"
|
||||
"re2c:YYCTYPE = \"YYChar\";\n"
|
||||
"re2c:YYCTXMARKER = (.api.record ? yyrecord \".\") \"yyctxmarker\";\n"
|
||||
"re2c:YYCURSOR = (.api.record ? yyrecord \".\") \"yycursor\";\n"
|
||||
"re2c:YYDEBUG = \"yydebug\";\n"
|
||||
"re2c:YYFILL = \"yyfill\";\n"
|
||||
"re2c:YYGETACCEPT = sigil \"{var}\";\n"
|
||||
"re2c:YYGETCOND = \"yygetcond\";\n"
|
||||
"re2c:YYGETSTATE = \"yygetstate\";\n"
|
||||
"re2c:YYINPUT = (.api.record ? yyrecord \".\") \"yyinput\";\n"
|
||||
"re2c:YYLESSTHAN = \"yylessthan\";\n"
|
||||
"re2c:YYLIMIT = (.api.record ? yyrecord \".\") \"yylimit\";\n"
|
||||
"re2c:YYMARKER = (.api.record ? yyrecord \".\") \"yymarker\";\n"
|
||||
"re2c:YYMAXFILL = \"YYMAXFILL\";\n"
|
||||
"re2c:YYMAXNMATCH = \"YYMAXNMATCH\";\n"
|
||||
"re2c:YYMTAGN = \"yymtagn\";\n"
|
||||
"re2c:YYMTAGP = \"yymtagp\";\n"
|
||||
"re2c:YYPEEK = \"yypeek\";\n"
|
||||
"re2c:YYRESTORE = \"yyrestore\";\n"
|
||||
"re2c:YYRESTORECTX = \"yyrestorectx\";\n"
|
||||
"re2c:YYRESTORETAG = \"yyrestoretag\";\n"
|
||||
"re2c:YYSETACCEPT = sigil \"{var} = \" sigil \"{val};\";\n"
|
||||
"re2c:YYSETCOND = \"yysetcond\";\n"
|
||||
"re2c:YYSETSTATE = \"yysetstate\";\n"
|
||||
"re2c:YYSHIFT = \"yyshift\";\n"
|
||||
"re2c:YYSHIFTSTAG = \"yyshiftstag\";\n"
|
||||
"re2c:YYSHIFTMTAG = \"yyshiftmtag\";\n"
|
||||
"re2c:YYSKIP = \"yyskip\";\n"
|
||||
"re2c:YYSTAGN = \"yystagn\";\n"
|
||||
"re2c:YYSTAGP = \"yystagp\";\n"
|
||||
"re2c:tags:expression = (.api.record ? yyrecord \".\") sigil;\n"
|
||||
"re2c:tags:negative = (.api.generic ? \"@@\" : \"-1\");\n"
|
||||
"re2c:cond:divider = \"\";\n"
|
||||
"re2c:cond:goto = \"\";\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// code templates --------------------------------------------------------------\n"
|
||||
"\n"
|
||||
"code:var_local = topindent type \" \" name \" = \" init \";\" nl;\n"
|
||||
"code:var_global = code:var_local;\n"
|
||||
"\n"
|
||||
"code:const_local = topindent \"static final \" type \" \" name \" = \" init \";\" nl;\n"
|
||||
"code:const_global = code:const_local;\n"
|
||||
"\n"
|
||||
"code:array_local =\n"
|
||||
" topindent type \"[] \" name \" = new \" type \"[]{\" nl indent\n"
|
||||
" [row: topindent [elem{0:-2}: elem \", \"] [elem{-1}: elem \",\"] nl]\n"
|
||||
" dedent topindent \"};\" nl;\n"
|
||||
"\n"
|
||||
"code:array_global = <undefined>;\n"
|
||||
"\n"
|
||||
"code:array_elem = array \"[\" index \"]\";\n"
|
||||
"\n"
|
||||
"code:enum = [elem: topindent \"public static final \" type \" \" elem \" = \" init \";\" nl];\n"
|
||||
"\n"
|
||||
"code:enum_elem = name;\n"
|
||||
"\n"
|
||||
"code:assign = topindent lhs \" = \" rhs \";\" nl;\n"
|
||||
"\n"
|
||||
"code:type_int = \"int\";\n"
|
||||
"code:type_uint = \"int\";\n"
|
||||
"code:type_yybm = \"int\";\n"
|
||||
"code:type_yytarget = <undefined>;\n"
|
||||
"\n"
|
||||
"code:cmp_eq = \"==\";\n"
|
||||
"code:cmp_ne = \"!=\";\n"
|
||||
"code:cmp_lt = \"<\";\n"
|
||||
"code:cmp_gt = \">\";\n"
|
||||
"code:cmp_le = \"<=\";\n"
|
||||
"code:cmp_ge = \">=\";\n"
|
||||
"\n"
|
||||
"code:if_then_else =\n"
|
||||
" [branch{0}: topindent \"if (\" cond \") {\" nl\n"
|
||||
" indent [stmt: stmt] dedent]\n"
|
||||
" [branch{1:-1}: topindent \"} else \" (.cond ? \"if (\" cond \") \") \"{\" nl\n"
|
||||
" indent [stmt: stmt] dedent]\n"
|
||||
" topindent \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:if_then_else_oneline = <undefined>;\n"
|
||||
"\n"
|
||||
"code:switch =\n"
|
||||
" topindent \"switch (\" expr \") {\" nl\n"
|
||||
" indent [case: case] dedent\n"
|
||||
" topindent \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:switch_cases =\n"
|
||||
" [case: case nl]\n"
|
||||
" indent [stmt: stmt] dedent;\n"
|
||||
"\n"
|
||||
"code:switch_cases_oneline = <undefined>;\n"
|
||||
"\n"
|
||||
"code:switch_case_range =\n"
|
||||
" [val{0:-2}: topindent \"case \" val \":\" nl]\n"
|
||||
" [val{-1}: topindent \"case \" val \":\"];\n"
|
||||
"\n"
|
||||
"code:switch_case_default =\n"
|
||||
" topindent \"default:\";\n"
|
||||
"\n"
|
||||
"code:loop =\n"
|
||||
" topindent (.loop_label ? label \": \") \"while (true) {\" nl\n"
|
||||
" indent [stmt: stmt] dedent\n"
|
||||
" topindent \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:continue = topindent \"continue\" (.loop_label ? \" \" label) \";\" nl;\n"
|
||||
"\n"
|
||||
"code:goto = <undefined>;\n"
|
||||
"\n"
|
||||
"code:fndecl = <undefined>;\n"
|
||||
"code:fndef = <undefined>;\n"
|
||||
"code:fncall = <undefined>;\n"
|
||||
"code:tailcall = <undefined>;\n"
|
||||
"code:recursive_functions = <undefined>;\n"
|
||||
"\n"
|
||||
"code:line_info = <undefined>;\n"
|
||||
"\n"
|
||||
"code:fingerprint =\n"
|
||||
" \"// Generated by re2java\" (.version ? \" \" version) (.date ? \" on \" date) nl;\n"
|
||||
"\n"
|
||||
"code:abort = topindent \"throw new IllegalStateException(\\\"internal lexer error\\\");\" nl;\n"
|
||||
"\n"
|
||||
"code:yydebug =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYDEBUG\n"
|
||||
" : (.api.record\n"
|
||||
" ? YYDEBUG \"(\" yyrecord \");\"\n"
|
||||
" : YYDEBUG \"(\" state \", \" yych \");\"\n"
|
||||
" )) nl;\n"
|
||||
"\n"
|
||||
"// No YYFILL specialization for default/record API,\n"
|
||||
"// as there's no uniform syntax for strings and arrays.\n"
|
||||
"code:yypeek = topindent yych \" = \" YYPEEK \";\" nl;\n"
|
||||
"\n"
|
||||
"code:yyskip =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSKIP\n"
|
||||
" : YYCURSOR \" += 1;\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yybackup =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYBACKUP\n"
|
||||
" : YYMARKER \" = \" YYCURSOR \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yybackupctx =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYBACKUPCTX\n"
|
||||
" : YYCTXMARKER \" = \" YYCURSOR \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyskip_yypeek = <undefined>;\n"
|
||||
"code:yypeek_yyskip = <undefined>;\n"
|
||||
"code:yyskip_yybackup = <undefined>;\n"
|
||||
"code:yybackup_yyskip = <undefined>;\n"
|
||||
"code:yybackup_yypeek = <undefined>;\n"
|
||||
"code:yyskip_yybackup_yypeek = <undefined>;\n"
|
||||
"code:yybackup_yypeek_yyskip = <undefined>;\n"
|
||||
"\n"
|
||||
"code:yyrestore =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYRESTORE\n"
|
||||
" : YYCURSOR \" = \" YYMARKER \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyrestorectx =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYRESTORECTX\n"
|
||||
" : YYCURSOR \" = \" YYCTXMARKER \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyrestoretag =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYRESTORETAG\n"
|
||||
" : YYCURSOR \" = \" tag \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshift =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSHIFT\n"
|
||||
" : YYCURSOR \" -= \" offset \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshiftstag =\n"
|
||||
" topindent (.nested ? \"if (\" tag \" != \" neg \") \") (.api.generic\n"
|
||||
" ? YYSHIFTSTAG\n"
|
||||
" : tag \" -= \" offset \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshiftmtag =\n"
|
||||
" topindent YYSHIFTMTAG nl;\n"
|
||||
"\n"
|
||||
"code:yystagp =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSTAGP\n"
|
||||
" : tag \" = \" YYCURSOR \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yymtagp =\n"
|
||||
" topindent YYMTAGP nl;\n"
|
||||
"\n"
|
||||
"code:yystagn =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSTAGN\n"
|
||||
" : tag \" = \" neg \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yymtagn =\n"
|
||||
" topindent YYMTAGN nl;\n"
|
||||
"\n"
|
||||
"code:yycopystag =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYCOPYSTAG\n"
|
||||
" : lhs \" = \" rhs \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yycopymtag =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYCOPYMTAG\n"
|
||||
" : lhs \" = \" rhs \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetaccept =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYGETACCEPT\n"
|
||||
" : (.api.record & .storable_state ? yyrecord \".\") var);\n"
|
||||
"\n"
|
||||
"code:yysetaccept =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSETACCEPT\n"
|
||||
" : (.api.record & .storable_state ? yyrecord \".\") var \" = \" val \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetcond =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYGETCOND\n"
|
||||
" : (.api.record ? yyrecord \".\") var);\n"
|
||||
"\n"
|
||||
"code:yysetcond =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSETCOND\n"
|
||||
" : (.api.record ? yyrecord \".\") var \" = \" val \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetstate =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYGETSTATE\n"
|
||||
" : (.api.record ? yyrecord \".\") var);\n"
|
||||
"\n"
|
||||
"code:yysetstate =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSETSTATE\n"
|
||||
" : (.api.record ? yyrecord \".\") var \" = \" val \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yylessthan =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYLESSTHAN\n"
|
||||
" : (.many\n"
|
||||
" ? \"(\" YYLIMIT \" - \" YYCURSOR \") < \" need\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR));\n"
|
||||
"\n"
|
||||
"code:yybm_filter = yych \" & ~0xFF\";\n"
|
||||
"\n"
|
||||
"code:yybm_match = \"(\" yybm \"[\" offset \"+\" yych \"] & \" mask \") != 0\";\n"
|
||||
;
|
||||
@@ -0,0 +1,384 @@
|
||||
#include "src/parse/conf_parser.h"
|
||||
const char* DEFAULT_SYNTAX_JS =
|
||||
"// supported feature lists -----------------------------------------------------\n"
|
||||
"\n"
|
||||
"supported_apis = [\"simple\", \"generic\", \"record\"];\n"
|
||||
"supported_api_styles = [\"free-form\"];\n"
|
||||
"supported_code_models = [\"loop-switch\"];\n"
|
||||
"supported_targets = [\"code\", \"dot\"];\n"
|
||||
"supported_features = [\"nested-ifs\", \"bitmaps\", \"tags\", \"captures\", \"captvars\"];\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// language-specific options ---------------------------------------------------\n"
|
||||
"\n"
|
||||
"semicolons = 0;\n"
|
||||
"backtick_quoted_strings = 1;\n"
|
||||
"single_quoted_strings = 1;\n"
|
||||
"indentation_sensitive = 0;\n"
|
||||
"wrap_blocks_in_braces = 1;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// immutable configurations (command-line only options) ------------------------\n"
|
||||
"\n"
|
||||
"re2c:target = code;\n"
|
||||
"re2c:code-model = loop-switch;\n"
|
||||
"re2c:input-encoding = ascii;\n"
|
||||
"re2c:date = 1;\n"
|
||||
"re2c:version = 1;\n"
|
||||
"re2c:conditions = 0;\n"
|
||||
"re2c:storable-state = 0;\n"
|
||||
"re2c:flex-syntax = 0;\n"
|
||||
"re2c:verbose = 0;\n"
|
||||
"re2c:line-dirs = 0;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// mutable configurations ------------------------------------------------------\n"
|
||||
"\n"
|
||||
"re2c:api = simple;\n"
|
||||
"re2c:api:style = free-form;\n"
|
||||
"re2c:api:sigil = \"@@\";\n"
|
||||
"re2c:YYGETCOND:naked = 0;\n"
|
||||
"re2c:YYSETCOND:naked = 0;\n"
|
||||
"re2c:YYSETCOND@cond = \"@@\";\n"
|
||||
"re2c:YYGETSTATE:naked = 0;\n"
|
||||
"re2c:YYSETSTATE:naked = 0;\n"
|
||||
"re2c:YYSETSTATE@state = \"@@\";\n"
|
||||
"re2c:YYFILL@len = \"@@\";\n"
|
||||
"re2c:YYFILL:naked = 0;\n"
|
||||
"re2c:YYFN = [\"<undefined-function-name>;<undefined-function-type>\"];\n"
|
||||
"re2c:yyfn:sep = \";\";\n"
|
||||
"re2c:yycond = \"yycond\";\n"
|
||||
"re2c:yyctable = \"yyctable\";\n"
|
||||
"re2c:yyaccept = \"yyaccept\";\n"
|
||||
"re2c:yytarget = \"yytarget\";\n"
|
||||
"re2c:yystate = \"yystate\";\n"
|
||||
"re2c:yynmatch = \"yynmatch\";\n"
|
||||
"re2c:yypmatch = \"yypmatch\";\n"
|
||||
"re2c:yyrecord = \"yyrecord\";\n"
|
||||
"re2c:yych = \"yych\";\n"
|
||||
"re2c:yych:conversion = 0;\n"
|
||||
"re2c:yych:literals = hex;\n"
|
||||
"re2c:yych:emit = 1;\n"
|
||||
"re2c:yybm = \"yybm\";\n"
|
||||
"re2c:yybm:hex = 0;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yystable = \"\"; // deprecated\n"
|
||||
"re2c:header = \"\";\n"
|
||||
"re2c:eof = -1;\n"
|
||||
"re2c:sentinel = -1;\n"
|
||||
"re2c:yyfill:enable = 1;\n"
|
||||
"re2c:yyfill:parameter = 1;\n"
|
||||
"re2c:yyfill:check = 1;\n"
|
||||
"re2c:tags = 0;\n"
|
||||
"re2c:tags:prefix = \"yyt\";\n"
|
||||
"re2c:captures = 0;\n"
|
||||
"re2c:captvars = 0;\n"
|
||||
"re2c:posix-captures = 0;\n"
|
||||
"re2c:posix-captvars = 0;\n"
|
||||
"re2c:invert-captures = 0;\n"
|
||||
"re2c:cond:abort = 0;\n"
|
||||
"re2c:cond:prefix = \"yyc_\";\n"
|
||||
"re2c:cond:enumprefix = \"YYC_\";\n"
|
||||
"re2c:cond:divider@cond = \"@@\";\n"
|
||||
"re2c:cond:goto@cond = \"@@\";\n"
|
||||
"re2c:state:abort = 1;\n"
|
||||
"re2c:state:nextlabel = 0;\n"
|
||||
"re2c:bit-vectors = 0;\n"
|
||||
"re2c:debug-output = 0;\n"
|
||||
"re2c:computed-gotos = 0;\n"
|
||||
"re2c:computed-gotos:threshold = 9;\n"
|
||||
"re2c:nested-ifs = 0;\n"
|
||||
"re2c:case-insensitive = 0;\n"
|
||||
"re2c:case-inverted = 0;\n"
|
||||
"re2c:case-ranges = 0;\n"
|
||||
"re2c:unsafe = 0;\n"
|
||||
"re2c:monadic = 0;\n"
|
||||
"re2c:encoding:ebcdic = 0;\n"
|
||||
"re2c:encoding:utf32 = 0;\n"
|
||||
"re2c:encoding:ucs2 = 0;\n"
|
||||
"re2c:encoding:utf16 = 0;\n"
|
||||
"re2c:encoding:utf8 = 0;\n"
|
||||
"re2c:encoding-policy = ignore;\n"
|
||||
"re2c:empty-class = match-empty;\n"
|
||||
"re2c:indent:string = \" \";\n"
|
||||
"re2c:indent:top = 0;\n"
|
||||
"re2c:label:prefix = \"\";\n"
|
||||
"re2c:label:yyfill = \"\";\n"
|
||||
"re2c:label:yyloop = \"yyl\";\n"
|
||||
"re2c:label:yyNext = \"\";\n"
|
||||
"re2c:label:start = 0;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// mutable code configuration --------------------------------------------------\n"
|
||||
"\n"
|
||||
"re2c:YYBACKUP = \"yybackup\";\n"
|
||||
"re2c:YYBACKUPCTX = \"yybackupctx\";\n"
|
||||
"re2c:YYCONDTYPE = \"YYCond\";\n"
|
||||
"re2c:YYCOPYMTAG = sigil \"{lhs} = \" sigil \"{rhs}\";\n"
|
||||
"re2c:YYCOPYSTAG = sigil \"{lhs} = \" sigil \"{rhs}\";\n"
|
||||
"re2c:YYCTYPE = \"YYChar\";\n"
|
||||
"re2c:YYCTXMARKER = (.api.record ? yyrecord \".\") \"yyctxmarker\";\n"
|
||||
"re2c:YYCURSOR = (.api.record ? yyrecord \".\") \"yycursor\";\n"
|
||||
"re2c:YYDEBUG = \"yydebug\";\n"
|
||||
"re2c:YYFILL = \"yyfill\";\n"
|
||||
"re2c:YYGETACCEPT = sigil \"{var}\";\n"
|
||||
"re2c:YYGETCOND = \"yygetcond\";\n"
|
||||
"re2c:YYGETSTATE = \"yygetstate\";\n"
|
||||
"re2c:YYINPUT = (.api.record ? yyrecord \".\") \"yyinput\";\n"
|
||||
"re2c:YYLESSTHAN = \"yylessthan\";\n"
|
||||
"re2c:YYLIMIT = (.api.record ? yyrecord \".\") \"yylimit\";\n"
|
||||
"re2c:YYMARKER = (.api.record ? yyrecord \".\") \"yymarker\";\n"
|
||||
"re2c:YYMAXFILL = \"YYMAXFILL\";\n"
|
||||
"re2c:YYMAXNMATCH = \"YYMAXNMATCH\";\n"
|
||||
"re2c:YYMTAGN = \"yymtagn\";\n"
|
||||
"re2c:YYMTAGP = \"yymtagp\";\n"
|
||||
"re2c:YYPEEK = (.api.generic ? \"yypeek\" : \"charCodeAt\");\n"
|
||||
"re2c:YYRESTORE = \"yyrestore\";\n"
|
||||
"re2c:YYRESTORECTX = \"yyrestorectx\";\n"
|
||||
"re2c:YYRESTORETAG = \"yyrestoretag\";\n"
|
||||
"re2c:YYSETACCEPT = sigil \"{var} = \" sigil \"{val}\";\n"
|
||||
"re2c:YYSETCOND = \"yysetcond\";\n"
|
||||
"re2c:YYSETSTATE = \"yysetstate\";\n"
|
||||
"re2c:YYSHIFT = \"yyshift\";\n"
|
||||
"re2c:YYSHIFTSTAG = \"yyshiftstag\";\n"
|
||||
"re2c:YYSHIFTMTAG = \"yyshiftmtag\";\n"
|
||||
"re2c:YYSKIP = \"yyskip\";\n"
|
||||
"re2c:YYSTAGN = \"yystagn\";\n"
|
||||
"re2c:YYSTAGP = \"yystagp\";\n"
|
||||
"re2c:tags:expression = (.api.record ? yyrecord \".\") sigil;\n"
|
||||
"re2c:tags:negative = (.api.generic ? \"@@\" : \"-1\");\n"
|
||||
"re2c:cond:divider = \"\";\n"
|
||||
"re2c:cond:goto = \"\";\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// code templates --------------------------------------------------------------\n"
|
||||
"\n"
|
||||
"code:var_local = topindent \"let \" name \" = \" init nl;\n"
|
||||
"code:var_global = code:var_local;\n"
|
||||
"\n"
|
||||
"code:const_local = topindent \"const \" name \" = \" init nl;\n"
|
||||
"code:const_global = code:const_local;\n"
|
||||
"\n"
|
||||
"code:array_local =\n"
|
||||
" topindent \"const \" name \" = [\" nl indent\n"
|
||||
" [row: topindent [elem{0:-2}: elem \", \"] [elem{-1}: elem \",\"] nl]\n"
|
||||
" dedent topindent \"]\" nl;\n"
|
||||
"\n"
|
||||
"code:array_global = <undefined>;\n"
|
||||
"\n"
|
||||
"code:array_elem = array \"[\" index \"]\";\n"
|
||||
"\n"
|
||||
"code:enum = [elem: topindent \"const \" elem \" = \" init nl];\n"
|
||||
"\n"
|
||||
"code:enum_elem = name;\n"
|
||||
"\n"
|
||||
"code:assign = topindent lhs \" = \" rhs nl;\n"
|
||||
"\n"
|
||||
"code:type_int = <undefined>;\n"
|
||||
"code:type_uint = <undefined>;\n"
|
||||
"code:type_yybm = <undefined>;\n"
|
||||
"code:type_yytarget = <undefined>;\n"
|
||||
"\n"
|
||||
"code:cmp_eq = \"===\";\n"
|
||||
"code:cmp_ne = \"!==\";\n"
|
||||
"code:cmp_lt = \"<\";\n"
|
||||
"code:cmp_gt = \">\";\n"
|
||||
"code:cmp_le = \"<=\";\n"
|
||||
"code:cmp_ge = \">=\";\n"
|
||||
"\n"
|
||||
"code:if_then_else =\n"
|
||||
" [branch{0}: topindent \"if (\" cond \") {\" nl\n"
|
||||
" indent [stmt: stmt] dedent]\n"
|
||||
" [branch{1:-1}: topindent \"} else \" (.cond ? \"if (\" cond \") \") \"{\" nl\n"
|
||||
" indent [stmt: stmt] dedent]\n"
|
||||
" topindent \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:if_then_else_oneline = <undefined>;\n"
|
||||
"\n"
|
||||
"code:switch =\n"
|
||||
" topindent \"switch (\" expr \") {\" nl\n"
|
||||
" indent [case: case] dedent\n"
|
||||
" topindent \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:switch_cases =\n"
|
||||
" [case: case nl]\n"
|
||||
" indent [stmt: stmt] dedent;\n"
|
||||
"\n"
|
||||
"code:switch_cases_oneline = <undefined>;\n"
|
||||
"\n"
|
||||
"code:switch_case_range =\n"
|
||||
" [val{0:-2}: topindent \"case \" val \":\" nl]\n"
|
||||
" [val{-1}: topindent \"case \" val \":\"];\n"
|
||||
"\n"
|
||||
"code:switch_case_default =\n"
|
||||
" topindent \"default:\";\n"
|
||||
"\n"
|
||||
"code:loop =\n"
|
||||
" topindent (.loop_label ? label \": \") \"while (true) {\" nl\n"
|
||||
" indent [stmt: stmt] dedent\n"
|
||||
" topindent \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:continue = topindent \"continue\" (.loop_label ? \" \" label) nl;\n"
|
||||
"\n"
|
||||
"code:goto = <undefined>;\n"
|
||||
"\n"
|
||||
"code:fndecl = <undefined>;\n"
|
||||
"code:fndef = <undefined>;\n"
|
||||
"code:fncall = <undefined>;\n"
|
||||
"code:tailcall = <undefined>;\n"
|
||||
"code:recursive_functions = <undefined>;\n"
|
||||
"\n"
|
||||
"code:line_info = <undefined>;\n"
|
||||
"\n"
|
||||
"code:fingerprint =\n"
|
||||
" \"// Generated by re2js\" (.version ? \" \" version) (.date ? \" on \" date) nl;\n"
|
||||
"\n"
|
||||
"code:abort = topindent \"throw \\\"internal lexer error\\\"\" nl;\n"
|
||||
"\n"
|
||||
"code:yydebug =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYDEBUG\n"
|
||||
" : (.api.record\n"
|
||||
" ? YYDEBUG \"(\" yyrecord \");\"\n"
|
||||
" : YYDEBUG \"(\" state \", \" yych \");\"\n"
|
||||
" )) nl;\n"
|
||||
"\n"
|
||||
"code:yypeek =\n"
|
||||
" topindent (.code_model.recursive_functions ? YYCTYPE \" \") yych \" = \" (.api.generic\n"
|
||||
" ? YYPEEK\n"
|
||||
" : YYINPUT \".\" YYPEEK \"(\" YYCURSOR \")\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyskip =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSKIP\n"
|
||||
" : YYCURSOR \" += 1;\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yybackup =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYBACKUP\n"
|
||||
" : YYMARKER \" = \" YYCURSOR \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yybackupctx =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYBACKUPCTX\n"
|
||||
" : YYCTXMARKER \" = \" YYCURSOR \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyskip_yypeek = <undefined>;\n"
|
||||
"code:yypeek_yyskip = <undefined>;\n"
|
||||
"code:yyskip_yybackup = <undefined>;\n"
|
||||
"code:yybackup_yyskip = <undefined>;\n"
|
||||
"code:yybackup_yypeek = <undefined>;\n"
|
||||
"code:yyskip_yybackup_yypeek = <undefined>;\n"
|
||||
"code:yybackup_yypeek_yyskip = <undefined>;\n"
|
||||
"\n"
|
||||
"code:yyrestore =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYRESTORE\n"
|
||||
" : YYCURSOR \" = \" YYMARKER \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyrestorectx =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYRESTORECTX\n"
|
||||
" : YYCURSOR \" = \" YYCTXMARKER \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyrestoretag =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYRESTORETAG\n"
|
||||
" : YYCURSOR \" = \" tag \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshift =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSHIFT\n"
|
||||
" : YYCURSOR \" -= \" offset \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshiftstag =\n"
|
||||
" topindent (.nested ? \"if (\" tag \" != \" neg \") \") (.api.generic\n"
|
||||
" ? YYSHIFTSTAG\n"
|
||||
" : tag \" -= \" offset \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshiftmtag =\n"
|
||||
" topindent YYSHIFTMTAG nl;\n"
|
||||
"\n"
|
||||
"code:yystagp =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSTAGP\n"
|
||||
" : tag \" = \" YYCURSOR \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yymtagp =\n"
|
||||
" topindent YYMTAGP nl;\n"
|
||||
"\n"
|
||||
"code:yystagn =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSTAGN\n"
|
||||
" : tag \" = \" neg \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yymtagn =\n"
|
||||
" topindent YYMTAGN nl;\n"
|
||||
"\n"
|
||||
"code:yycopystag =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYCOPYSTAG\n"
|
||||
" : lhs \" = \" rhs \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yycopymtag =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYCOPYMTAG\n"
|
||||
" : lhs \" = \" rhs \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetaccept =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYGETACCEPT\n"
|
||||
" : (.api.record & .storable_state ? yyrecord \".\") var);\n"
|
||||
"\n"
|
||||
"code:yysetaccept =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSETACCEPT\n"
|
||||
" : (.api.record & .storable_state ? yyrecord \".\") var \" = \" val \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetcond =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYGETCOND\n"
|
||||
" : (.api.record ? yyrecord \".\") var);\n"
|
||||
"\n"
|
||||
"code:yysetcond =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSETCOND\n"
|
||||
" : (.api.record ? yyrecord \".\") var \" = \" val \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetstate =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYGETSTATE\n"
|
||||
" : (.api.record ? yyrecord \".\") var);\n"
|
||||
"\n"
|
||||
"code:yysetstate =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSETSTATE\n"
|
||||
" : (.api.record ? yyrecord \".\") var \" = \" val \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yylessthan =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYLESSTHAN\n"
|
||||
" : (.many\n"
|
||||
" ? \"(\" YYLIMIT \" - \" YYCURSOR \") < \" need\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR));\n"
|
||||
"\n"
|
||||
"code:yybm_filter = yych \" & ~0xFF\";\n"
|
||||
"\n"
|
||||
"code:yybm_match = \"(\" yybm \"[\" offset \"+\" yych \"] & \" mask \") !== 0\";\n"
|
||||
;
|
||||
@@ -0,0 +1,397 @@
|
||||
#include "src/parse/conf_parser.h"
|
||||
const char* DEFAULT_SYNTAX_OCAML =
|
||||
"// supported feature lists -----------------------------------------------------\n"
|
||||
"\n"
|
||||
"supported_apis = [\"record\", \"generic\"];\n"
|
||||
"supported_api_styles = [\"free-form\"];\n"
|
||||
"supported_code_models = [\"recursive-functions\"];\n"
|
||||
"supported_targets = [\"code\", \"dot\"];\n"
|
||||
"supported_features = [\"nested-ifs\", \"bitmaps\", \"case-ranges\",\n"
|
||||
" \"tags\", \"captures\", \"captvars\"];\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// language-specific options ---------------------------------------------------\n"
|
||||
"\n"
|
||||
"semicolons = 0;\n"
|
||||
"backtick_quoted_strings = 0;\n"
|
||||
"single_quoted_strings = 0;\n"
|
||||
"indentation_sensitive = 0;\n"
|
||||
"wrap_blocks_in_braces = 0;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// immutable configurations (command-line only options) ------------------------\n"
|
||||
"\n"
|
||||
"re2c:target = code;\n"
|
||||
"re2c:code-model = recursive-functions;\n"
|
||||
"re2c:input-encoding = ascii;\n"
|
||||
"re2c:date = 1;\n"
|
||||
"re2c:version = 1;\n"
|
||||
"re2c:conditions = 0;\n"
|
||||
"re2c:storable-state = 0;\n"
|
||||
"re2c:flex-syntax = 0;\n"
|
||||
"re2c:verbose = 0;\n"
|
||||
"re2c:line-dirs = 1;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// mutable configurations ------------------------------------------------------\n"
|
||||
"\n"
|
||||
"re2c:api = record;\n"
|
||||
"re2c:api:style = free-form;\n"
|
||||
"re2c:api:sigil = \"@@\";\n"
|
||||
"re2c:YYGETCOND:naked = 0;\n"
|
||||
"re2c:YYSETCOND:naked = 0;\n"
|
||||
"re2c:YYSETCOND@cond = \"@@\";\n"
|
||||
"re2c:YYGETSTATE:naked = 0;\n"
|
||||
"re2c:YYSETSTATE:naked = 0;\n"
|
||||
"re2c:YYSETSTATE@state = \"@@\";\n"
|
||||
"re2c:YYFILL@len = \"@@\";\n"
|
||||
"re2c:YYFILL:naked = 0;\n"
|
||||
"re2c:YYFN = [\"<undefined-function-name>;<undefined-function-type>\"];\n"
|
||||
"re2c:yyfn:sep = \";\";\n"
|
||||
"re2c:yycond = \"yycond\";\n"
|
||||
"re2c:yyctable = \"yyctable\";\n"
|
||||
"re2c:yyaccept = \"yyaccept\";\n"
|
||||
"re2c:yytarget = \"yytarget\";\n"
|
||||
"re2c:yystate = \"yystate\";\n"
|
||||
"re2c:yynmatch = \"yynmatch\";\n"
|
||||
"re2c:yypmatch = \"yypmatch\";\n"
|
||||
"re2c:yyrecord = \"yyrecord\";\n"
|
||||
"re2c:yych = \"yych\";\n"
|
||||
"re2c:yych:conversion = 0;\n"
|
||||
"re2c:yych:literals = char;\n"
|
||||
"re2c:yych:emit = (.code_model.recursive_functions ? 0 : 1);\n"
|
||||
"re2c:yybm = \"yybm\";\n"
|
||||
"re2c:yybm:hex = 0;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yystable = \"\"; // deprecated\n"
|
||||
"re2c:header = \"\";\n"
|
||||
"re2c:eof = -1;\n"
|
||||
"re2c:sentinel = -1;\n"
|
||||
"re2c:yyfill:enable = 1;\n"
|
||||
"re2c:yyfill:parameter = 1;\n"
|
||||
"re2c:yyfill:check = 1;\n"
|
||||
"re2c:tags = 0;\n"
|
||||
"re2c:tags:prefix = \"yyt\";\n"
|
||||
"re2c:captures = 0;\n"
|
||||
"re2c:captvars = 0;\n"
|
||||
"re2c:posix-captures = 0;\n"
|
||||
"re2c:posix-captvars = 0;\n"
|
||||
"re2c:invert-captures = 0;\n"
|
||||
"re2c:cond:abort = 0; // default case causes [redundant-case] warnings\n"
|
||||
"re2c:cond:prefix = \"yyc_\";\n"
|
||||
"re2c:cond:enumprefix = \"YYC_\";\n"
|
||||
"re2c:cond:divider@cond = \"@@\";\n"
|
||||
"re2c:cond:goto@cond = \"@@\";\n"
|
||||
"re2c:state:abort = 1;\n"
|
||||
"re2c:state:nextlabel = 0;\n"
|
||||
"re2c:bit-vectors = 0;\n"
|
||||
"re2c:debug-output = 0;\n"
|
||||
"re2c:computed-gotos = 0;\n"
|
||||
"re2c:computed-gotos:threshold = 9;\n"
|
||||
"re2c:nested-ifs = 0;\n"
|
||||
"re2c:case-insensitive = 0;\n"
|
||||
"re2c:case-inverted = 0;\n"
|
||||
"re2c:case-ranges = 1;\n"
|
||||
"re2c:unsafe = 0;\n"
|
||||
"re2c:monadic = 0;\n"
|
||||
"re2c:encoding:ebcdic = 0;\n"
|
||||
"re2c:encoding:utf32 = 0;\n"
|
||||
"re2c:encoding:ucs2 = 0;\n"
|
||||
"re2c:encoding:utf16 = 0;\n"
|
||||
"re2c:encoding:utf8 = 0;\n"
|
||||
"re2c:encoding-policy = ignore;\n"
|
||||
"re2c:empty-class = match-empty;\n"
|
||||
"re2c:indent:string = \" \";\n"
|
||||
"re2c:indent:top = 0;\n"
|
||||
"re2c:label:prefix = \"yy\"; // used for generating function names\n"
|
||||
"re2c:label:yyfill = \"\";\n"
|
||||
"re2c:label:yyloop = \"\";\n"
|
||||
"re2c:label:yyNext = \"\";\n"
|
||||
"re2c:label:start = 0;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// mutable code configuration --------------------------------------------------\n"
|
||||
"\n"
|
||||
"re2c:YYBACKUP = \"yybackup\";\n"
|
||||
"re2c:YYBACKUPCTX = \"yybackupctx\";\n"
|
||||
"re2c:YYCONDTYPE = \"yycondtype\";\n"
|
||||
"re2c:YYCOPYMTAG = sigil \"{lhs} <- \" sigil \"{rhs};\";\n"
|
||||
"re2c:YYCOPYSTAG = sigil \"{lhs} <- \" sigil \"{rhs};\";\n"
|
||||
"re2c:YYCTYPE = \"char\";\n"
|
||||
"re2c:YYCTXMARKER = (.api.record ? yyrecord \".\") \"yyctxmarker\";\n"
|
||||
"re2c:YYCURSOR = (.api.record ? yyrecord \".\") \"yycursor\";\n"
|
||||
"re2c:YYDEBUG = \"yydebug\";\n"
|
||||
"re2c:YYFILL = \"yyfill\";\n"
|
||||
"re2c:YYGETACCEPT = sigil \"{var}\";\n"
|
||||
"re2c:YYGETCOND = \"yygetcond\";\n"
|
||||
"re2c:YYGETSTATE = \"yygetstate\";\n"
|
||||
"re2c:YYINPUT = (.api.record ? yyrecord \".\") \"yyinput\";\n"
|
||||
"re2c:YYLESSTHAN = \"yylesthan\";\n"
|
||||
"re2c:YYLIMIT = (.api.record ? yyrecord \".\") \"yylimit\";\n"
|
||||
"re2c:YYMARKER = (.api.record ? yyrecord \".\") \"yymarker\";\n"
|
||||
"re2c:YYMAXFILL = \"yymaxfill\";\n"
|
||||
"re2c:YYMAXNMATCH = \"yymaxnmatch\";\n"
|
||||
"re2c:YYMTAGN = \"yymatgn\";\n"
|
||||
"re2c:YYMTAGP = \"yymtagp\";\n"
|
||||
"re2c:YYPEEK = (.api.record ? \"get\" : \"yypeek\");\n"
|
||||
"re2c:YYRESTORE = \"yyrestore\";\n"
|
||||
"re2c:YYRESTORECTX = \"yyrestorectx\";\n"
|
||||
"re2c:YYRESTORETAG = \"yyrestoretag\";\n"
|
||||
"re2c:YYSETACCEPT = sigil \"{var} <- \" sigil \"{val};\";\n"
|
||||
"re2c:YYSETCOND = \"yysetcond\";\n"
|
||||
"re2c:YYSETSTATE = \"yysetstate\";\n"
|
||||
"re2c:YYSHIFT = \"yyshift\";\n"
|
||||
"re2c:YYSHIFTSTAG = \"yyshiftstag\";\n"
|
||||
"re2c:YYSHIFTMTAG = \"yyshiftmtag\";\n"
|
||||
"re2c:YYSKIP = \"yyskip\";\n"
|
||||
"re2c:YYSTAGN = \"yystagn\";\n"
|
||||
"re2c:YYSTAGP = \"yystagp\";\n"
|
||||
"re2c:tags:expression = (.api.record ? yyrecord \".\") sigil;\n"
|
||||
"re2c:tags:negative = (.api.generic ? \"@@\" : \"-1\");\n"
|
||||
"re2c:cond:divider = \"\";\n"
|
||||
"re2c:cond:goto = \"\";\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// code templates --------------------------------------------------------------\n"
|
||||
"\n"
|
||||
"code:var_local = topindent \"let \" name \" = \" init \" in\" nl;\n"
|
||||
"code:var_global = topindent \"let \" name \" = \" init nl;\n"
|
||||
"\n"
|
||||
"code:const_local = topindent \"let \" name \" = \" init \" in\" nl;\n"
|
||||
"code:const_global = topindent \"let \" name \" = \" init nl;\n"
|
||||
"\n"
|
||||
"code:array_local =\n"
|
||||
" topindent \"and \" name \" = [|\" nl indent\n"
|
||||
" [row: topindent [elem{0:-2}: elem \"; \"] [elem{-1}: elem \";\"] nl]\n"
|
||||
" dedent topindent \"|]\" nl;\n"
|
||||
"\n"
|
||||
"code:array_global = code:array_local;\n"
|
||||
"\n"
|
||||
"code:array_elem = array \".(\" index \")\";\n"
|
||||
"\n"
|
||||
"code:enum =\n"
|
||||
" \"type \" type \" = \"\n"
|
||||
" [elem{0}: elem]\n"
|
||||
" [elem{1:-1}: \" | \" elem]\n"
|
||||
" nl;\n"
|
||||
"\n"
|
||||
"code:enum_elem = name;\n"
|
||||
"\n"
|
||||
"code:assign = topindent lhs \" <- \" rhs \";\" nl;\n"
|
||||
"\n"
|
||||
"code:type_int = \"int\";\n"
|
||||
"code:type_uint = \"uint\";\n"
|
||||
"code:type_yybm = \"int\";\n"
|
||||
"code:type_yytarget = <undefined>;\n"
|
||||
"\n"
|
||||
"code:cmp_eq = \"==\"; // physical equality, as this is used to compare primitive values\n"
|
||||
"code:cmp_ne = \"!=\"; // physical inequality, as this is used to compare primitive values\n"
|
||||
"code:cmp_lt = \"<\";\n"
|
||||
"code:cmp_gt = \">\";\n"
|
||||
"code:cmp_le = \"<=\";\n"
|
||||
"code:cmp_ge = \">=\";\n"
|
||||
"\n"
|
||||
"code:if_then_else =\n"
|
||||
" [branch{0}: topindent \"if (\" cond \") then (\" nl\n"
|
||||
" indent [stmt: stmt] dedent]\n"
|
||||
" [branch{1:-1}: topindent \") else \" (.cond ? \"if (\" cond \") then \") \"(\" nl\n"
|
||||
" indent [stmt: stmt] dedent]\n"
|
||||
" topindent \")\" nl;\n"
|
||||
"\n"
|
||||
"code:if_then_else_oneline =\n"
|
||||
" [branch{0}: topindent \"if (\" cond \") then \" [stmt: stmt] nl]\n"
|
||||
" [branch{1:-1}: topindent \"else \" (.cond ? \"if (\" cond \") then \") [stmt: stmt] nl];\n"
|
||||
"\n"
|
||||
"code:switch =\n"
|
||||
" topindent \"match \" expr \" with\" nl\n"
|
||||
" indent [case: case] dedent;\n"
|
||||
"\n"
|
||||
"code:switch_cases =\n"
|
||||
" [case{0:-2}: topindent \"| \" case nl]\n"
|
||||
" [case{-1}: topindent \"| \" case \" ->\" nl\n"
|
||||
" indent [stmt: stmt] dedent\n"
|
||||
" ];\n"
|
||||
"\n"
|
||||
"code:switch_cases_oneline =\n"
|
||||
" [case{0:-2}: topindent \"| \" case nl]\n"
|
||||
" [case{-1}: topindent \"| \" case \" -> \" [stmt: stmt] nl];\n"
|
||||
"\n"
|
||||
"// In OCaml only literals of type `char` support case ranges.\n"
|
||||
"// For `int`, we have to exlicitly list all range values. We cannot use\n"
|
||||
"// `\"c when \" [val{0}: val] \" <= c && c <= \" [val{-1}: val]`\n"
|
||||
"// as it causes error when there are multiple cases:\n"
|
||||
"// `Error: Variable c must occur on both sides of this | pattern`.\n"
|
||||
"code:switch_case_range = (.char_literals\n"
|
||||
" ? [val{0}: val] (.many ? \"..\" [val{-1}: val])\n"
|
||||
" : [val{0}: val] [val{1:-1}: \"|\" val]);\n"
|
||||
"\n"
|
||||
"code:switch_case_default = \"_\";\n"
|
||||
"\n"
|
||||
"code:loop = <undefined>;\n"
|
||||
"\n"
|
||||
"code:continue = <undefined>;\n"
|
||||
"\n"
|
||||
"code:goto = <undefined>;\n"
|
||||
"\n"
|
||||
"code:fndecl = <undefined>;\n"
|
||||
"\n"
|
||||
"code:fndef =\n"
|
||||
" name [arg: \" (\" argname \" : \" argtype \")\"] \" : \" type \" =\" nl\n"
|
||||
" indent [stmt: stmt] dedent;\n"
|
||||
"\n"
|
||||
"code:fncall =\n"
|
||||
" topindent (.retval ? \"let \" retval \" = \")\n"
|
||||
" \"(\" name \" [@tailcall])\" (.args ? [arg: \" \" arg] : \" ()\") nl;\n"
|
||||
"\n"
|
||||
"code:tailcall = topindent \"(\" name \" [@tailcall])\" (.args ? [arg: \" \" arg] : \" ()\") nl;\n"
|
||||
"\n"
|
||||
"code:recursive_functions =\n"
|
||||
" [fn{0}: \"let rec \" fndef nl]\n"
|
||||
" [fn{1:-1}: \"and \" fndef nl];\n"
|
||||
"\n"
|
||||
"code:fingerprint =\n"
|
||||
" \"(* Generated by re2ocaml\" (.version ? \" \" version) (.date ? \" on \" date) \" *)\" nl;\n"
|
||||
"\n"
|
||||
"code:line_info = \"#\" line \" \\\"\" file \"\\\"\" nl;\n"
|
||||
"\n"
|
||||
"code:abort = topindent \"raise (Failure \\\"internal lexer error\\\")\" nl;\n"
|
||||
"\n"
|
||||
"code:yydebug =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? YYDEBUG \" \" yyrecord\n"
|
||||
" : YYDEBUG\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yypeek =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? \"let \" yych \" = \" YYPEEK \" \" YYINPUT \" \" YYCURSOR \" in\"\n"
|
||||
" : \"let \" yych \" = \" YYPEEK \" in\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyskip =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? YYCURSOR \" <- \" YYCURSOR \" + 1;\"\n"
|
||||
" : YYSKIP\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yybackup =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? YYMARKER \" <- \" YYCURSOR \";\"\n"
|
||||
" : YYBACKUP\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yybackupctx =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? YYCTXMARKER \" <- \" YYCURSOR \";\"\n"
|
||||
" : YYBACKUPCTX\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyskip_yypeek = <undefined>;\n"
|
||||
"code:yypeek_yyskip = <undefined>;\n"
|
||||
"code:yyskip_yybackup = <undefined>;\n"
|
||||
"code:yybackup_yyskip = <undefined>;\n"
|
||||
"code:yybackup_yypeek = <undefined>;\n"
|
||||
"code:yyskip_yybackup_yypeek = <undefined>;\n"
|
||||
"code:yybackup_yypeek_yyskip = <undefined>;\n"
|
||||
"\n"
|
||||
"code:yyrestore =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? YYCURSOR \" <- \" YYMARKER \";\"\n"
|
||||
" : YYRESTORE\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyrestorectx =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? YYCURSOR \" <- \" YYCTXMARKER \";\"\n"
|
||||
" : YYRESTORECTX\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyrestoretag =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? YYCURSOR \" <- \" tag \";\"\n"
|
||||
" : YYRESTORETAG\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshift =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? YYCURSOR \" <- \" YYCURSOR \" - \" offset \";\"\n"
|
||||
" : YYSHIFT\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshiftstag =\n"
|
||||
" topindent (.nested ? \"if \" tag \" <> \" neg \" then \") (.api.record\n"
|
||||
" ? tag \" <- \" tag \" - \" offset \";\"\n"
|
||||
" : YYSHIFTSTAG\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshiftmtag =\n"
|
||||
" topindent YYSHIFTMTAG nl;\n"
|
||||
"\n"
|
||||
"code:yystagp =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? tag \" <- \" YYCURSOR \";\"\n"
|
||||
" : YYSTAGP\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yymtagp =\n"
|
||||
" topindent YYMTAGP nl;\n"
|
||||
"\n"
|
||||
"code:yystagn =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? tag \" <- \" neg \";\"\n"
|
||||
" : YYSTAGN\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yymtagn =\n"
|
||||
" topindent YYMTAGN nl;\n"
|
||||
"\n"
|
||||
"code:yycopystag =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? lhs \" <- \" rhs \";\"\n"
|
||||
" : YYCOPYSTAG\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yycopymtag =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? lhs \" <- \" rhs \";\"\n"
|
||||
" : YYCOPYMTAG\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetaccept =\n"
|
||||
" (.api.record ? yyrecord \".\" var : YYGETACCEPT);\n"
|
||||
"\n"
|
||||
"code:yysetaccept =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? yyrecord \".\" var \" <- \" val \";\"\n"
|
||||
" : YYSETACCEPT\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetcond =\n"
|
||||
" (.api.record ? yyrecord \".\" var : YYGETCOND);\n"
|
||||
"\n"
|
||||
"code:yysetcond =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? yyrecord \".\" var \" <- \" val \";\"\n"
|
||||
" : YYSETCOND\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetstate =\n"
|
||||
" (.api.record ? yyrecord \".\" var : YYGETSTATE);\n"
|
||||
"\n"
|
||||
"code:yysetstate =\n"
|
||||
" topindent (.api.record\n"
|
||||
" ? yyrecord \".\" var \" <- \" val \";\"\n"
|
||||
" : YYSETSTATE\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yylessthan =\n"
|
||||
" (.api.record\n"
|
||||
" ? (.many\n"
|
||||
" ? \"(\" YYLIMIT \" - \" YYCURSOR \") < \" need\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR)\n"
|
||||
" : YYLESSTHAN);\n"
|
||||
"\n"
|
||||
"code:yybm_filter = yych \" land ~0xFF\";\n"
|
||||
"\n"
|
||||
"code:yybm_match = \"(\" yybm \".(\" offset \" + Char.code \" yych \") land \" mask \") != 0\";\n"
|
||||
;
|
||||
@@ -0,0 +1,390 @@
|
||||
#include "src/parse/conf_parser.h"
|
||||
const char* DEFAULT_SYNTAX_PYTHON =
|
||||
"// supported feature lists -----------------------------------------------------\n"
|
||||
"\n"
|
||||
"supported_apis = [\"simple\", \"generic\", \"record\"];\n"
|
||||
"supported_api_styles = [\"free-form\"];\n"
|
||||
"// \"recursive_functions\" works syntactically, but causes stack overflows due to non-tail recusion\n"
|
||||
"supported_code_models = [\"loop-switch\"];\n"
|
||||
"supported_targets = [\"code\", \"dot\"];\n"
|
||||
"supported_features = [\"nested-ifs\", \"bitmaps\", \"tags\", \"captures\", \"captvars\"];\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// language-specific options ---------------------------------------------------\n"
|
||||
"\n"
|
||||
"semicolons = 0;\n"
|
||||
"backtick_quoted_strings = 0;\n"
|
||||
"single_quoted_strings = 1;\n"
|
||||
"indentation_sensitive = 1;\n"
|
||||
"wrap_blocks_in_braces = 0;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// immutable configurations (command-line only options) ------------------------\n"
|
||||
"\n"
|
||||
"re2c:target = code;\n"
|
||||
"re2c:code-model = loop-switch;\n"
|
||||
"re2c:input-encoding = ascii;\n"
|
||||
"re2c:date = 1;\n"
|
||||
"re2c:version = 1;\n"
|
||||
"re2c:conditions = 0;\n"
|
||||
"re2c:storable-state = 0;\n"
|
||||
"re2c:flex-syntax = 0;\n"
|
||||
"re2c:verbose = 0;\n"
|
||||
"re2c:line-dirs = 0;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// mutable configurations ------------------------------------------------------\n"
|
||||
"\n"
|
||||
"re2c:api = simple;\n"
|
||||
"re2c:api:style = free-form;\n"
|
||||
"re2c:api:sigil = \"@@\";\n"
|
||||
"re2c:YYGETCOND:naked = 0;\n"
|
||||
"re2c:YYSETCOND:naked = 0;\n"
|
||||
"re2c:YYSETCOND@cond = \"@@\";\n"
|
||||
"re2c:YYGETSTATE:naked = 0;\n"
|
||||
"re2c:YYSETSTATE:naked = 0;\n"
|
||||
"re2c:YYSETSTATE@state = \"@@\";\n"
|
||||
"re2c:YYFILL@len = \"@@\";\n"
|
||||
"re2c:YYFILL:naked = 0;\n"
|
||||
"re2c:YYFN = [\"<undefined-function-name>;<undefined-function-type>\"];\n"
|
||||
"re2c:yyfn:sep = \";\";\n"
|
||||
"re2c:yycond = \"yycond\";\n"
|
||||
"re2c:yyctable = \"yyctable\";\n"
|
||||
"re2c:yyaccept = \"yyaccept\";\n"
|
||||
"re2c:yytarget = \"yytarget\";\n"
|
||||
"re2c:yystate = \"yystate\";\n"
|
||||
"re2c:yynmatch = \"yynmatch\";\n"
|
||||
"re2c:yypmatch = \"yypmatch\";\n"
|
||||
"re2c:yyrecord = \"yyrecord\";\n"
|
||||
"re2c:yych = \"yych\";\n"
|
||||
"re2c:yych:conversion = 0;\n"
|
||||
"re2c:yych:literals = hex;\n"
|
||||
"re2c:yych:emit = 0;\n"
|
||||
"re2c:yybm = \"yybm\";\n"
|
||||
"re2c:yybm:hex = 0;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yystable = \"\"; // deprecated\n"
|
||||
"re2c:header = \"\";\n"
|
||||
"re2c:eof = -1;\n"
|
||||
"re2c:sentinel = -1;\n"
|
||||
"re2c:yyfill:enable = 1;\n"
|
||||
"re2c:yyfill:parameter = 1;\n"
|
||||
"re2c:yyfill:check = 1;\n"
|
||||
"re2c:tags = 0;\n"
|
||||
"re2c:tags:prefix = \"yyt\";\n"
|
||||
"re2c:captures = 0;\n"
|
||||
"re2c:captvars = 0;\n"
|
||||
"re2c:posix-captures = 0;\n"
|
||||
"re2c:posix-captvars = 0;\n"
|
||||
"re2c:invert-captures = 0;\n"
|
||||
"re2c:cond:abort = 0; // default case causes [redundant-case] warnings\n"
|
||||
"re2c:cond:prefix = \"yyc_\";\n"
|
||||
"re2c:cond:enumprefix = \"YYC_\";\n"
|
||||
"re2c:cond:divider@cond = \"@@\";\n"
|
||||
"re2c:cond:goto@cond = \"@@\";\n"
|
||||
"re2c:state:abort = 1;\n"
|
||||
"re2c:state:nextlabel = 0;\n"
|
||||
"re2c:bit-vectors = 0;\n"
|
||||
"re2c:debug-output = 0;\n"
|
||||
"re2c:computed-gotos = 0;\n"
|
||||
"re2c:computed-gotos:threshold = 9;\n"
|
||||
"re2c:nested-ifs = 1;\n"
|
||||
"re2c:case-insensitive = 0;\n"
|
||||
"re2c:case-inverted = 0;\n"
|
||||
"re2c:case-ranges = 0;\n"
|
||||
"re2c:unsafe = 0;\n"
|
||||
"re2c:monadic = 0;\n"
|
||||
"re2c:encoding:ebcdic = 0;\n"
|
||||
"re2c:encoding:utf32 = 0;\n"
|
||||
"re2c:encoding:ucs2 = 0;\n"
|
||||
"re2c:encoding:utf16 = 0;\n"
|
||||
"re2c:encoding:utf8 = 0;\n"
|
||||
"re2c:encoding-policy = ignore;\n"
|
||||
"re2c:empty-class = match-empty;\n"
|
||||
"re2c:indent:string = \" \";\n"
|
||||
"re2c:indent:top = 0;\n"
|
||||
"re2c:label:prefix = \"\";\n"
|
||||
"re2c:label:yyfill = \"\";\n"
|
||||
"re2c:label:yyloop = \"\";\n"
|
||||
"re2c:label:yyNext = \"\";\n"
|
||||
"re2c:label:start = 0;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// mutable code configuration --------------------------------------------------\n"
|
||||
"\n"
|
||||
"re2c:YYBACKUP = \"yybackup\";\n"
|
||||
"re2c:YYBACKUPCTX = \"yybackupctx\";\n"
|
||||
"re2c:YYCONDTYPE = \"yycondtype\";\n"
|
||||
"re2c:YYCOPYMTAG = sigil \"{lhs} = \" sigil \"{rhs}\";\n"
|
||||
"re2c:YYCOPYSTAG = sigil \"{lhs} = \" sigil \"{rhs}\";\n"
|
||||
"re2c:YYCTYPE = \"yyctype\";\n"
|
||||
"re2c:YYCTXMARKER = (.api.record ? yyrecord \".\") \"yyctxmarker\";\n"
|
||||
"re2c:YYCURSOR = (.api.record ? yyrecord \".\") \"yycursor\";\n"
|
||||
"re2c:YYDEBUG = \"yydebug\";\n"
|
||||
"re2c:YYFILL = \"yyfill\";\n"
|
||||
"re2c:YYGETACCEPT = sigil \"{var}\";\n"
|
||||
"re2c:YYGETCOND = \"yygetcond\";\n"
|
||||
"re2c:YYGETSTATE = \"yygetstate\";\n"
|
||||
"re2c:YYINPUT = (.api.record ? yyrecord \".\") \"yyinput\";\n"
|
||||
"re2c:YYLESSTHAN = \"yylessthan\";\n"
|
||||
"re2c:YYLIMIT = (.api.record ? yyrecord \".\") \"yylimit\";\n"
|
||||
"re2c:YYMARKER = (.api.record ? yyrecord \".\") \"yymarker\";\n"
|
||||
"re2c:YYMAXFILL = \"YYMAXFILL\";\n"
|
||||
"re2c:YYMAXNMATCH = \"YYMAXNMATCH\";\n"
|
||||
"re2c:YYMTAGN = \"yymtagn\";\n"
|
||||
"re2c:YYMTAGP = \"yymtagp\";\n"
|
||||
"re2c:YYPEEK = \"yypeek\";\n"
|
||||
"re2c:YYRESTORE = \"yyrestore\";\n"
|
||||
"re2c:YYRESTORECTX = \"yyrestorectx\";\n"
|
||||
"re2c:YYRESTORETAG = \"yyrestoretag\";\n"
|
||||
"re2c:YYSETACCEPT = sigil \"{var} = \" sigil \"{val}\";\n"
|
||||
"re2c:YYSETCOND = \"yysetcond\";\n"
|
||||
"re2c:YYSETSTATE = \"yysetstate\";\n"
|
||||
"re2c:YYSHIFT = \"yyshift\";\n"
|
||||
"re2c:YYSHIFTSTAG = \"yyshiftstag\";\n"
|
||||
"re2c:YYSHIFTMTAG = \"yyshiftmtag\";\n"
|
||||
"re2c:YYSKIP = \"yyskip\";\n"
|
||||
"re2c:YYSTAGN = \"yystagn\";\n"
|
||||
"re2c:YYSTAGP = \"yystagp\";\n"
|
||||
"re2c:tags:expression = sigil;\n"
|
||||
"re2c:tags:negative = (.api.generic ? \"@@\" : \"-1\");\n"
|
||||
"re2c:cond:divider = \"\";\n"
|
||||
"re2c:cond:goto = \"\";\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// code templates --------------------------------------------------------------\n"
|
||||
"\n"
|
||||
"code:var_local = topindent name (.init ? \" = \" init) nl;\n"
|
||||
"code:var_global = code:var_local;\n"
|
||||
"\n"
|
||||
"code:const_local = topindent name \" = \" init nl;\n"
|
||||
"code:const_global = code:const_local;\n"
|
||||
"\n"
|
||||
"code:array_local =\n"
|
||||
" topindent name \" = [\" nl indent\n"
|
||||
" [row: topindent [elem{0:-2}: elem \", \"] [elem{-1}: elem \",\"] nl]\n"
|
||||
" dedent topindent \"]\" nl;\n"
|
||||
"\n"
|
||||
"code:array_global = <undefined>;\n"
|
||||
"\n"
|
||||
"code:array_elem = array \"[\" index \"]\";\n"
|
||||
"\n"
|
||||
"code:enum = [elem: elem \" = \" init nl];\n"
|
||||
"\n"
|
||||
"code:enum_elem = name;\n"
|
||||
"\n"
|
||||
"code:assign = topindent lhs \" = \" rhs nl;\n"
|
||||
"\n"
|
||||
"code:type_int = <undefined>;\n"
|
||||
"code:type_uint = <undefined>;\n"
|
||||
"code:type_yybm = <undefined>;\n"
|
||||
"code:type_yytarget = <undefined>;\n"
|
||||
"\n"
|
||||
"code:cmp_eq = \"==\";\n"
|
||||
"code:cmp_ne = \"!=\";\n"
|
||||
"code:cmp_lt = \"<\";\n"
|
||||
"code:cmp_gt = \">\";\n"
|
||||
"code:cmp_le = \"<=\";\n"
|
||||
"code:cmp_ge = \">=\";\n"
|
||||
"\n"
|
||||
"code:if_then_else =\n"
|
||||
" [branch{0}: topindent \"if \" cond \":\" nl\n"
|
||||
" indent [stmt: stmt] dedent]\n"
|
||||
" [branch{1:-1}: topindent (.cond ? \"elif \" cond : \"else\") \":\" nl\n"
|
||||
" indent [stmt: stmt] dedent];\n"
|
||||
"\n"
|
||||
"code:if_then_else_oneline = <undefined>;\n"
|
||||
"\n"
|
||||
"code:switch =\n"
|
||||
" topindent \"match \" expr \":\" nl\n"
|
||||
" indent [case: case] dedent;\n"
|
||||
"\n"
|
||||
"code:switch_cases = topindent \"case \"\n"
|
||||
" [case{0:-2}: case \"|\"]\n"
|
||||
" [case{-1}: case \":\" nl]\n"
|
||||
" indent [stmt: stmt] dedent;\n"
|
||||
"\n"
|
||||
"code:switch_cases_oneline = <undefined>;\n"
|
||||
"\n"
|
||||
"code:switch_case_range = (.many\n"
|
||||
" ? [val{0}: val] [val{1:-1}: \"|\" val]\n"
|
||||
" : [val{0}: val]);\n"
|
||||
"\n"
|
||||
"code:switch_case_default = \"_\";\n"
|
||||
"\n"
|
||||
"code:loop =\n"
|
||||
" topindent \"while True:\" nl\n"
|
||||
" indent [stmt: stmt] dedent;\n"
|
||||
"\n"
|
||||
"code:continue = topindent \"continue\" nl;\n"
|
||||
"\n"
|
||||
"code:goto = <undefined>;\n"
|
||||
"\n"
|
||||
"code:fndecl = <undefined>;\n"
|
||||
"\n"
|
||||
"code:fndef =\n"
|
||||
" \"def \" name \"(\" [arg{0}: argname] [arg{1:-1}: \", \" argname] \"):\" nl\n"
|
||||
" indent [stmt: stmt] dedent;\n"
|
||||
"\n"
|
||||
"code:fncall =\n"
|
||||
" topindent (.retval ? retval \" = \") name \"(\" [arg{0:-2}: arg \", \"] [arg{-1}: arg] \")\" nl;\n"
|
||||
"\n"
|
||||
"code:tailcall =\n"
|
||||
" topindent (.retval ? \"return \") name \"(\" [arg{0:-2}: arg \", \"] [arg{-1}: arg] \")\" nl;\n"
|
||||
"\n"
|
||||
"code:recursive_functions = [fn: fndef nl];\n"
|
||||
"\n"
|
||||
"code:fingerprint =\n"
|
||||
" \"# Generated by re2py\" (.version ? \" \" version) (.date ? \" on \" date) nl;\n"
|
||||
"\n"
|
||||
"code:line_info = <undefined>;\n"
|
||||
"\n"
|
||||
"code:abort = topindent \"raise \\\"internal lexer error\\\"\" nl;\n"
|
||||
"\n"
|
||||
"code:yydebug =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYDEBUG\n"
|
||||
" : (.api.record\n"
|
||||
" ? YYDEBUG \"(\" yyrecord \")\"\n"
|
||||
" : YYDEBUG \"(\" state \", \" yych \")\"\n"
|
||||
" )) nl;\n"
|
||||
"\n"
|
||||
"code:yypeek =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? yych \" = \" YYPEEK\n"
|
||||
" : yych \" = \" YYINPUT \"[\" YYCURSOR \"]\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyskip =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSKIP\n"
|
||||
" : YYCURSOR \" += 1\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yybackup =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYBACKUP\n"
|
||||
" : YYMARKER \" = \" YYCURSOR\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yybackupctx =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYBACKUPCTX\n"
|
||||
" : YYCTXMARKER \" = \" YYCURSOR\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyskip_yypeek = <undefined>;\n"
|
||||
"code:yypeek_yyskip = <undefined>;\n"
|
||||
"code:yyskip_yybackup = <undefined>;\n"
|
||||
"code:yybackup_yyskip = <undefined>;\n"
|
||||
"code:yybackup_yypeek = <undefined>;\n"
|
||||
"code:yyskip_yybackup_yypeek = <undefined>;\n"
|
||||
"code:yybackup_yypeek_yyskip = <undefined>;\n"
|
||||
"\n"
|
||||
"code:yyrestore =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYRESTORE\n"
|
||||
" : YYCURSOR \" = \" YYMARKER\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyrestorectx =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYRESTORECTX\n"
|
||||
" : YYCURSOR \" = \" YYCTXMARKER\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyrestoretag =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYRESTORETAG\n"
|
||||
" : YYCURSOR \" = \" tag\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshift =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSHIFT\n"
|
||||
" : YYCURSOR \" -= \" offset\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshiftstag =\n"
|
||||
" topindent (.nested ? \"if \" tag \" != \" neg \": \") (.api.generic\n"
|
||||
" ? YYSHIFTSTAG\n"
|
||||
" : tag \" -= \" offset\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshiftmtag =\n"
|
||||
" topindent YYSHIFTMTAG nl;\n"
|
||||
"\n"
|
||||
"code:yystagp =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSTAGP\n"
|
||||
" : tag \" = \" YYCURSOR\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yymtagp =\n"
|
||||
" topindent YYMTAGP nl;\n"
|
||||
"\n"
|
||||
"code:yystagn =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSTAGN\n"
|
||||
" : tag \" = \" neg\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yymtagn =\n"
|
||||
" topindent YYMTAGN nl;\n"
|
||||
"\n"
|
||||
"code:yycopystag =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYCOPYSTAG\n"
|
||||
" : lhs \" = \" rhs\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yycopymtag =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYCOPYMTAG\n"
|
||||
" : lhs \" = \" rhs\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetaccept =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYGETACCEPT\n"
|
||||
" : (.api.record & .storable_state ? yyrecord \".\") var);\n"
|
||||
"\n"
|
||||
"code:yysetaccept =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSETACCEPT\n"
|
||||
" : (.api.record & .storable_state ? yyrecord \".\") var \" = \" val\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetcond =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYGETCOND\n"
|
||||
" : (.api.record ? yyrecord \".\") var);\n"
|
||||
"\n"
|
||||
"code:yysetcond =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSETCOND\n"
|
||||
" : (.api.record ? yyrecord \".\") var \" = \" val\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetstate =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYGETSTATE\n"
|
||||
" : (.api.record ? yyrecord \".\") var);\n"
|
||||
"\n"
|
||||
"code:yysetstate =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSETSTATE\n"
|
||||
" : (.api.record ? yyrecord \".\") var \" = \" val\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yylessthan =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYLESSTHAN\n"
|
||||
" : (.many\n"
|
||||
" ? \"(\" YYLIMIT \" - \" YYCURSOR \") < \" need\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR));\n"
|
||||
"\n"
|
||||
"code:yybm_filter = yych \" & ~0xFF\";\n"
|
||||
"\n"
|
||||
"code:yybm_match = \"(\" yybm \"[\" offset \"+\" yych \"] & \" mask \") != 0\";\n"
|
||||
;
|
||||
@@ -0,0 +1,408 @@
|
||||
#include "src/parse/conf_parser.h"
|
||||
const char* DEFAULT_SYNTAX_RUST =
|
||||
"// supported feature lists -----------------------------------------------------\n"
|
||||
"\n"
|
||||
"supported_apis = [\"simple\", \"generic\", \"record\"];\n"
|
||||
"supported_api_styles = [\"free-form\"];\n"
|
||||
"supported_code_models = [\"loop-switch\", \"recursive-functions\"];\n"
|
||||
"supported_targets = [\"code\", \"dot\"];\n"
|
||||
"supported_features = [\"nested-ifs\", \"bitmaps\", \"case-ranges\", \"unsafe\",\n"
|
||||
" \"tags\", \"captures\", \"captvars\"];\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// language-specific options ---------------------------------------------------\n"
|
||||
"\n"
|
||||
"semicolons = 1;\n"
|
||||
"backtick_quoted_strings = 0;\n"
|
||||
"single_quoted_strings = 0;\n"
|
||||
"indentation_sensitive = 0;\n"
|
||||
"wrap_blocks_in_braces = 1;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// immutable configurations (command-line only options) ------------------------\n"
|
||||
"\n"
|
||||
"re2c:target = code;\n"
|
||||
"re2c:code-model = loop-switch;\n"
|
||||
"re2c:input-encoding = ascii;\n"
|
||||
"re2c:date = 1;\n"
|
||||
"re2c:version = 1;\n"
|
||||
"re2c:conditions = 0;\n"
|
||||
"re2c:storable-state = 0;\n"
|
||||
"re2c:flex-syntax = 0;\n"
|
||||
"re2c:verbose = 0;\n"
|
||||
"re2c:line-dirs = 0;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// mutable configurations ------------------------------------------------------\n"
|
||||
"\n"
|
||||
"re2c:api = generic;\n"
|
||||
"re2c:api:style = free-form;\n"
|
||||
"re2c:api:sigil = \"@@\";\n"
|
||||
"re2c:YYGETCOND:naked = 0;\n"
|
||||
"re2c:YYSETCOND:naked = 0;\n"
|
||||
"re2c:YYSETCOND@cond = \"@@\";\n"
|
||||
"re2c:YYGETSTATE:naked = 0;\n"
|
||||
"re2c:YYSETSTATE:naked = 0;\n"
|
||||
"re2c:YYSETSTATE@state = \"@@\";\n"
|
||||
"re2c:YYFILL@len = \"@@\";\n"
|
||||
"re2c:YYFILL:naked = 0;\n"
|
||||
"re2c:YYFN = [\"<undefined-function-name>;<undefined-function-type>\"];\n"
|
||||
"re2c:yyfn:sep = \";\";\n"
|
||||
"re2c:yycond = \"yycond\";\n"
|
||||
"re2c:yyctable = \"yyctable\";\n"
|
||||
"re2c:yyaccept = \"yyaccept\";\n"
|
||||
"re2c:yytarget = \"yytarget\";\n"
|
||||
"re2c:yystate = \"yystate\";\n"
|
||||
"re2c:yynmatch = \"yynmatch\";\n"
|
||||
"re2c:yypmatch = \"yypmatch\";\n"
|
||||
"re2c:yyrecord = \"yyrecord\";\n"
|
||||
"re2c:yych = \"yych\";\n"
|
||||
"re2c:yych:conversion = 0;\n"
|
||||
"re2c:yych:literals = hex;\n"
|
||||
"re2c:yych:emit = (.code_model.recursive_functions ? 0 : 1);\n"
|
||||
"re2c:yybm = \"yybm\";\n"
|
||||
"re2c:yybm:hex = 0;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yystable = \"\"; // deprecated\n"
|
||||
"re2c:header = \"\";\n"
|
||||
"re2c:eof = -1;\n"
|
||||
"re2c:sentinel = -1;\n"
|
||||
"re2c:yyfill:enable = 1;\n"
|
||||
"re2c:yyfill:parameter = 1;\n"
|
||||
"re2c:yyfill:check = 1;\n"
|
||||
"re2c:tags = 0;\n"
|
||||
"re2c:tags:prefix = \"yyt\";\n"
|
||||
"re2c:captures = 0;\n"
|
||||
"re2c:captvars = 0;\n"
|
||||
"re2c:posix-captures = 0;\n"
|
||||
"re2c:posix-captvars = 0;\n"
|
||||
"re2c:invert-captures = 0;\n"
|
||||
"re2c:cond:abort = 1;\n"
|
||||
"re2c:cond:prefix = \"yyc_\";\n"
|
||||
"re2c:cond:enumprefix = \"YYC_\";\n"
|
||||
"re2c:cond:divider@cond = \"@@\";\n"
|
||||
"re2c:cond:goto@cond = \"@@\";\n"
|
||||
"re2c:state:abort = 1;\n"
|
||||
"re2c:state:nextlabel = 0;\n"
|
||||
"re2c:bit-vectors = 0;\n"
|
||||
"re2c:debug-output = 0;\n"
|
||||
"re2c:computed-gotos = 0;\n"
|
||||
"re2c:computed-gotos:threshold = 9;\n"
|
||||
"re2c:nested-ifs = 0;\n"
|
||||
"re2c:case-insensitive = 0;\n"
|
||||
"re2c:case-inverted = 0;\n"
|
||||
"re2c:case-ranges = 1;\n"
|
||||
"re2c:unsafe = 1;\n"
|
||||
"re2c:monadic = 0;\n"
|
||||
"re2c:encoding:ebcdic = 0;\n"
|
||||
"re2c:encoding:utf32 = 0;\n"
|
||||
"re2c:encoding:ucs2 = 0;\n"
|
||||
"re2c:encoding:utf16 = 0;\n"
|
||||
"re2c:encoding:utf8 = 0;\n"
|
||||
"re2c:encoding-policy = ignore;\n"
|
||||
"re2c:empty-class = match-empty;\n"
|
||||
"re2c:indent:string = \" \";\n"
|
||||
"re2c:indent:top = 0;\n"
|
||||
"re2c:label:prefix = \"yy\"; // used to generate function names\n"
|
||||
"re2c:label:yyfill = \"\";\n"
|
||||
"re2c:label:yyloop = \"'yyl\";\n"
|
||||
"re2c:label:yyNext = \"\";\n"
|
||||
"re2c:label:start = 0;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// mutable code configuration --------------------------------------------------\n"
|
||||
"\n"
|
||||
"re2c:YYBACKUP = \"YYBACKUP\";\n"
|
||||
"re2c:YYBACKUPCTX = \"YYBACKUPCTX\";\n"
|
||||
"re2c:YYCONDTYPE = (.storable_state ? \"isize\" : \"usize\");\n"
|
||||
"re2c:YYCOPYMTAG = sigil \"{lhs} = \" sigil \"{rhs};\";\n"
|
||||
"re2c:YYCOPYSTAG = sigil \"{lhs} = \" sigil \"{rhs};\";\n"
|
||||
"re2c:YYCTYPE = \"YYCTYPE\";\n"
|
||||
"re2c:YYCTXMARKER = (.api.generic ? \"YYCTXMARKER\" : (.api.record ? yyrecord \".\") \"yyctxmarker\");\n"
|
||||
"re2c:YYCURSOR = (.api.generic ? \"YYCURSOR\" : (.api.record ? yyrecord \".\") \"yycursor\");\n"
|
||||
"re2c:YYDEBUG = \"YYDEBUG\";\n"
|
||||
"re2c:YYFILL = \"YYFILL\";\n"
|
||||
"re2c:YYGETACCEPT = sigil \"{var}\";\n"
|
||||
"re2c:YYGETCOND = \"YYGETCONDITION\"; // historic default\n"
|
||||
"re2c:YYGETSTATE = \"YYGETSTATE\";\n"
|
||||
"re2c:YYINPUT = (.api.generic ? \"YYINPUT\" : (.api.record ? yyrecord \".\") \"yyinput\");\n"
|
||||
"re2c:YYLESSTHAN = \"YYLESSTHAN\";\n"
|
||||
"re2c:YYLIMIT = (.api.generic ? \"YYLIMIT\" : (.api.record ? yyrecord \".\") \"yylimit\");\n"
|
||||
"re2c:YYMARKER = (.api.generic ? \"YYMARKER\" : (.api.record ? yyrecord \".\") \"yymarker\");\n"
|
||||
"re2c:YYMAXFILL = \"YYMAXFILL\";\n"
|
||||
"re2c:YYMAXNMATCH = \"YYMAXNMATCH\";\n"
|
||||
"re2c:YYMTAGN = \"YYMTAGN\";\n"
|
||||
"re2c:YYMTAGP = \"YYMTAGP\";\n"
|
||||
"re2c:YYPEEK = (.api.generic ? \"YYPEEK\" : \"get_unchecked\");\n"
|
||||
"re2c:YYRESTORE = \"YYRESTORE\";\n"
|
||||
"re2c:YYRESTORECTX = \"YYRESTORECTX\";\n"
|
||||
"re2c:YYRESTORETAG = \"YYRESTORETAG\";\n"
|
||||
"re2c:YYSETACCEPT = sigil \"{var} = \" sigil \"{val};\";\n"
|
||||
"re2c:YYSETCOND = \"YYSETCONDITION\"; // historic default\n"
|
||||
"re2c:YYSETSTATE = \"YYSETSTATE\";\n"
|
||||
"re2c:YYSHIFT = \"YYSHIFT\";\n"
|
||||
"re2c:YYSHIFTSTAG = \"YYSHIFTSTAG\";\n"
|
||||
"re2c:YYSHIFTMTAG = \"YYSHIFTMTAG\";\n"
|
||||
"re2c:YYSKIP = \"YYSKIP\";\n"
|
||||
"re2c:YYSTAGN = \"YYSTAGN\";\n"
|
||||
"re2c:YYSTAGP = \"YYSTAGP\";\n"
|
||||
"re2c:tags:expression = (.api.record ? yyrecord \".\") sigil;\n"
|
||||
"re2c:tags:negative = (.api.generic ? \"@@\" : \"usize::MAX\");\n"
|
||||
"re2c:cond:divider = \"\";\n"
|
||||
"re2c:cond:goto = \"\";\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// code templates --------------------------------------------------------------\n"
|
||||
"\n"
|
||||
"code:var_local =\n"
|
||||
" // In Rust uninitialized variable is an error, but if the compiler is able to see\n"
|
||||
" // that all paths overwrite the initial value, it warns about unused assignments.\n"
|
||||
" (!.init ? topindent \"#[allow(unused_assignments)]\" nl)\n"
|
||||
" topindent \"let mut \" name \" : \" type \" = \" init \";\" nl;\n"
|
||||
"code:var_global = topindent \"static mut \" name \" : \" type \" = \" init \";\" nl;\n"
|
||||
"\n"
|
||||
"code:const_local = topindent \"const \" name \": \" type \" = \" init \";\" nl;\n"
|
||||
"code:const_global = code:const_local;\n"
|
||||
"\n"
|
||||
"code:array_local =\n"
|
||||
" topindent \"let \" name \": [\" type \"; \" size \"] = [\" nl indent\n"
|
||||
" [row: topindent [elem{0:-2}: elem \", \"] [elem{-1}: elem \",\"] nl]\n"
|
||||
" dedent topindent \"];\" nl;\n"
|
||||
"\n"
|
||||
"code:array_global = <undefined>;\n"
|
||||
"\n"
|
||||
"code:array_elem = array \"[\" index \"]\";\n"
|
||||
"\n"
|
||||
"code:enum = [elem: topindent \"const \" elem \": \" type \" = \" init \";\" nl];\n"
|
||||
"\n"
|
||||
"code:enum_elem = name;\n"
|
||||
"\n"
|
||||
"code:assign = topindent lhs \" = \" rhs \";\" nl;\n"
|
||||
"\n"
|
||||
"code:type_int = \"isize\";\n"
|
||||
"code:type_uint = \"usize\";\n"
|
||||
"code:type_yybm = \"u8\";\n"
|
||||
"code:type_yytarget = <undefined>;\n"
|
||||
"\n"
|
||||
"code:cmp_eq = \"==\";\n"
|
||||
"code:cmp_ne = \"!=\";\n"
|
||||
"code:cmp_lt = \"<\";\n"
|
||||
"code:cmp_gt = \">\";\n"
|
||||
"code:cmp_le = \"<=\";\n"
|
||||
"code:cmp_ge = \">=\";\n"
|
||||
"\n"
|
||||
"code:if_then_else =\n"
|
||||
" [branch{0}: topindent \"if \" cond \" {\" nl\n"
|
||||
" indent [stmt: stmt] dedent]\n"
|
||||
" [branch{1:-1}: topindent \"} else \" (.cond ? \"if \" cond \" \") \"{\" nl\n"
|
||||
" indent [stmt: stmt] dedent]\n"
|
||||
" topindent \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:if_then_else_oneline = <undefined>;\n"
|
||||
"\n"
|
||||
"code:switch =\n"
|
||||
" topindent \"match \" expr \" {\" nl\n"
|
||||
" indent [case: case] dedent\n"
|
||||
" topindent \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:switch_cases =\n"
|
||||
" [case{0:-2}: topindent case \" |\" nl]\n"
|
||||
" [case{-1}: topindent case \" => {\" nl\n"
|
||||
" indent [stmt: stmt] dedent\n"
|
||||
" topindent \"}\" nl];\n"
|
||||
"\n"
|
||||
"code:switch_cases_oneline =\n"
|
||||
" [case{0:-2}: topindent case \" |\" nl]\n"
|
||||
" [case{-1}: topindent case \" => \" [stmt: stmt] \",\" nl];\n"
|
||||
"\n"
|
||||
"code:switch_case_range = [val{0}: val] (.many ? \" ..= \" [val{-1}: val]);\n"
|
||||
"\n"
|
||||
"code:switch_case_default = \"_\";\n"
|
||||
"\n"
|
||||
"code:loop =\n"
|
||||
" topindent (.loop_label ? label \": \") \"loop {\" nl\n"
|
||||
" indent [stmt: stmt] dedent\n"
|
||||
" topindent \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:continue = topindent \"continue\" (.loop_label ? \" \" label) \";\" nl;\n"
|
||||
"\n"
|
||||
"code:goto = <undefined>;\n"
|
||||
"\n"
|
||||
"code:fndecl = <undefined>;\n"
|
||||
"\n"
|
||||
"code:fndef =\n"
|
||||
" topindent \"fn \" name \"(\"\n"
|
||||
" [arg{0:-2}: argname \": \" argtype \", \"]\n"
|
||||
" [arg{-1}: argname \": \" argtype]\n"
|
||||
" \")\" (.type ? \" -> \" type) \" {\" nl\n"
|
||||
" indent [stmt: stmt] dedent\n"
|
||||
" \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:fncall = topindent name \"(\" [arg{0:-2}: arg \", \"] [arg{-1}: arg] \")\" nl;\n"
|
||||
"\n"
|
||||
"code:tailcall = code:fncall;\n"
|
||||
"\n"
|
||||
"code:recursive_functions = [fn: fndef nl];\n"
|
||||
"\n"
|
||||
"code:fingerprint =\n"
|
||||
" \"/* Generated by re2rust\" (.version ? \" \" version) (.date ? \" on \" date) \" */\" nl;\n"
|
||||
"\n"
|
||||
"// No line directives in Rust: https://github.com/rust-lang/rfcs/issues/1862.\n"
|
||||
"code:line_info = <undefined>;\n"
|
||||
"\n"
|
||||
"code:abort = topindent \"panic!(\\\"internal lexer error\\\")\" nl;\n"
|
||||
"\n"
|
||||
"code:yydebug =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYDEBUG\n"
|
||||
" : (.api.record\n"
|
||||
" ? YYDEBUG \"(\" yyrecord \");\"\n"
|
||||
" : YYDEBUG \"(\" state \", \" yych \");\"\n"
|
||||
" )) nl;\n"
|
||||
"\n"
|
||||
"code:yypeek =\n"
|
||||
" topindent (.code_model.recursive_functions ? \"let \") yych \" = \" (.api.generic\n"
|
||||
" ? (.unsafe\n"
|
||||
" ? \"unsafe {\" YYPEEK \"}\"\n"
|
||||
" : YYPEEK)\n"
|
||||
" : (.unsafe\n"
|
||||
" ? \"unsafe {*\" YYINPUT \".\" YYPEEK \"(\" YYCURSOR \")}\"\n"
|
||||
" : YYINPUT \"[\" YYCURSOR \"]\") (.cast ? \" as \" YYCTYPE)\n"
|
||||
" ) \";\" nl;\n"
|
||||
"\n"
|
||||
"code:yyskip =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSKIP\n"
|
||||
" : YYCURSOR \" += 1;\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yybackup =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYBACKUP\n"
|
||||
" : YYMARKER \" = \" YYCURSOR \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yybackupctx =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYBACKUPCTX\n"
|
||||
" : YYCTXMARKER \" = \" YYCURSOR \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyskip_yypeek = <undefined>;\n"
|
||||
"code:yypeek_yyskip = <undefined>;\n"
|
||||
"code:yyskip_yybackup = <undefined>;\n"
|
||||
"code:yybackup_yyskip = <undefined>;\n"
|
||||
"code:yybackup_yypeek = <undefined>;\n"
|
||||
"code:yyskip_yybackup_yypeek = <undefined>;\n"
|
||||
"code:yybackup_yypeek_yyskip = <undefined>;\n"
|
||||
"\n"
|
||||
"code:yyrestore =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYRESTORE\n"
|
||||
" : YYCURSOR \" = \" YYMARKER \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyrestorectx =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYRESTORECTX\n"
|
||||
" : YYCURSOR \" = \" YYCTXMARKER \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyrestoretag =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYRESTORETAG\n"
|
||||
" : YYCURSOR \" = \" tag \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshift =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSHIFT\n"
|
||||
" : YYCURSOR \" -= \" offset \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshiftstag =\n"
|
||||
" (.nested ? topindent \"if \" tag \" != \" neg \" {\" nl indent)\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSHIFTSTAG\n"
|
||||
" : tag \" -= \" offset \";\"\n"
|
||||
" ) nl\n"
|
||||
" (.nested ? dedent topindent \"}\" nl);\n"
|
||||
"\n"
|
||||
"code:yyshiftmtag =\n"
|
||||
" topindent YYSHIFTMTAG nl;\n"
|
||||
"\n"
|
||||
"code:yystagp =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSTAGP\n"
|
||||
" : tag \" = \" YYCURSOR \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yymtagp =\n"
|
||||
" topindent YYMTAGP nl;\n"
|
||||
"\n"
|
||||
"code:yystagn =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSTAGN\n"
|
||||
" : tag \" = \" neg \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yymtagn =\n"
|
||||
" topindent YYMTAGN nl;\n"
|
||||
"\n"
|
||||
"code:yycopystag =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYCOPYSTAG\n"
|
||||
" : lhs \" = \" rhs \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yycopymtag =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYCOPYMTAG\n"
|
||||
" : lhs \" = \" rhs \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetaccept =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYGETACCEPT\n"
|
||||
" : (.api.record & (.storable_state | .code_model.recursive_functions) ? yyrecord \".\") var);\n"
|
||||
"\n"
|
||||
"code:yysetaccept =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSETACCEPT\n"
|
||||
" : (.api.record & (.storable_state | .code_model.recursive_functions) ? yyrecord \".\")\n"
|
||||
" var \" = \" val \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetcond =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYGETCOND\n"
|
||||
" : (.api.record ? yyrecord \".\") var);\n"
|
||||
"\n"
|
||||
"code:yysetcond =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSETCOND\n"
|
||||
" : (.api.record ? yyrecord \".\") var \" = \" val \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetstate =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYGETSTATE\n"
|
||||
" : (.api.record ? yyrecord \".\") var);\n"
|
||||
"\n"
|
||||
"code:yysetstate =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSETSTATE\n"
|
||||
" : (.api.record ? yyrecord \".\" var) \" = \" val \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yylessthan =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYLESSTHAN\n"
|
||||
" : (.many\n"
|
||||
" ? \"(\" YYLIMIT \" - \" YYCURSOR \") < \" need\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR));\n"
|
||||
"\n"
|
||||
"code:yybm_filter = yych \" & ~0xFF\";\n"
|
||||
"\n"
|
||||
"code:yybm_match = \"(\" yybm \"[\" offset \"+\" yych \" as usize] & \" mask \") != 0\";\n"
|
||||
;
|
||||
@@ -0,0 +1,407 @@
|
||||
#include "src/parse/conf_parser.h"
|
||||
const char* DEFAULT_SYNTAX_V =
|
||||
"// supported feature lists -----------------------------------------------------\n"
|
||||
"\n"
|
||||
"supported_apis = [\"simple\", \"generic\", \"record\"];\n"
|
||||
"supported_api_styles = [\"free-form\"];\n"
|
||||
"supported_code_models = [\"goto-label\", \"loop-switch\", \"recursive-functions\"];\n"
|
||||
"supported_targets = [\"code\", \"dot\"];\n"
|
||||
"supported_features = [\"nested-ifs\", \"bitmaps\", \"case-ranges\", \"unsafe\",\n"
|
||||
" \"tags\", \"captures\", \"captvars\"];\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// language-specific options ---------------------------------------------------\n"
|
||||
"\n"
|
||||
"semicolons = 0;\n"
|
||||
"backtick_quoted_strings = 0;\n"
|
||||
"single_quoted_strings = 0;\n"
|
||||
"indentation_sensitive = 0;\n"
|
||||
"wrap_blocks_in_braces = 0;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// immutable configurations (command-line only options) ------------------------\n"
|
||||
"\n"
|
||||
"re2c:target = code;\n"
|
||||
"re2c:code-model = goto-label;\n"
|
||||
"re2c:input-encoding = ascii;\n"
|
||||
"re2c:date = 1;\n"
|
||||
"re2c:version = 1;\n"
|
||||
"re2c:conditions = 0;\n"
|
||||
"re2c:storable-state = 0;\n"
|
||||
"re2c:flex-syntax = 0;\n"
|
||||
"re2c:verbose = 0;\n"
|
||||
"re2c:line-dirs = 1;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// mutable configurations ------------------------------------------------------\n"
|
||||
"\n"
|
||||
"re2c:api = simple;\n"
|
||||
"re2c:api:style = free-form;\n"
|
||||
"re2c:api:sigil = \"@@\";\n"
|
||||
"re2c:YYGETCOND:naked = 0;\n"
|
||||
"re2c:YYSETCOND:naked = 0;\n"
|
||||
"re2c:YYSETCOND@cond = \"@@\";\n"
|
||||
"re2c:YYGETSTATE:naked = 0;\n"
|
||||
"re2c:YYSETSTATE:naked = 0;\n"
|
||||
"re2c:YYSETSTATE@state = \"@@\";\n"
|
||||
"re2c:YYFILL@len = \"@@\";\n"
|
||||
"re2c:YYFILL:naked = 0;\n"
|
||||
"re2c:YYFN = [\"<undefined-function-name>;<undefined-function-type>\"];\n"
|
||||
"re2c:yyfn:sep = \";\";\n"
|
||||
"re2c:yycond = \"yycond\";\n"
|
||||
"re2c:yyctable = \"yyctable\";\n"
|
||||
"re2c:yyaccept = \"yyaccept\";\n"
|
||||
"re2c:yytarget = \"yytarget\";\n"
|
||||
"re2c:yystate = \"yystate\";\n"
|
||||
"re2c:yynmatch = \"yynmatch\";\n"
|
||||
"re2c:yypmatch = \"yypmatch\";\n"
|
||||
"re2c:yyrecord = \"yyrecord\";\n"
|
||||
"re2c:yych = \"yych\";\n"
|
||||
"re2c:yych:conversion = 0;\n"
|
||||
"re2c:yych:literals = hex;\n"
|
||||
"re2c:yych:emit = (.code_model.recursive_functions ? 0 : 1);\n"
|
||||
"re2c:yybm = \"yybm\";\n"
|
||||
"re2c:yybm:hex = 0;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yystable = \"\"; // deprecated\n"
|
||||
"re2c:header = \"\";\n"
|
||||
"re2c:eof = -1;\n"
|
||||
"re2c:sentinel = -1;\n"
|
||||
"re2c:yyfill:enable = 1;\n"
|
||||
"re2c:yyfill:parameter = 1;\n"
|
||||
"re2c:yyfill:check = 1;\n"
|
||||
"re2c:tags = 0;\n"
|
||||
"re2c:tags:prefix = \"yyt\";\n"
|
||||
"re2c:captures = 0;\n"
|
||||
"re2c:captvars = 0;\n"
|
||||
"re2c:posix-captures = 0;\n"
|
||||
"re2c:posix-captvars = 0;\n"
|
||||
"re2c:invert-captures = 0;\n"
|
||||
"re2c:cond:abort = 0;\n"
|
||||
"re2c:cond:prefix = \"yyc_\";\n"
|
||||
"re2c:cond:enumprefix = \"yyc\";\n"
|
||||
"re2c:cond:divider@cond = \"@@\";\n"
|
||||
"re2c:cond:goto@cond = \"@@\";\n"
|
||||
"re2c:state:abort = (.code_model.goto_label ? 0 : 1); // historically disabled for goto/label\n"
|
||||
"re2c:state:nextlabel = 0;\n"
|
||||
"re2c:bit-vectors = 0;\n"
|
||||
"re2c:debug-output = 0;\n"
|
||||
"re2c:computed-gotos = 0;\n"
|
||||
"re2c:computed-gotos:threshold = 9;\n"
|
||||
"re2c:nested-ifs = 0;\n"
|
||||
"re2c:case-insensitive = 0;\n"
|
||||
"re2c:case-inverted = 0;\n"
|
||||
"re2c:case-ranges = 1;\n"
|
||||
"re2c:unsafe = 0;\n"
|
||||
"re2c:monadic = 0;\n"
|
||||
"re2c:encoding:ebcdic = 0;\n"
|
||||
"re2c:encoding:utf32 = 0;\n"
|
||||
"re2c:encoding:ucs2 = 0;\n"
|
||||
"re2c:encoding:utf16 = 0;\n"
|
||||
"re2c:encoding:utf8 = 0;\n"
|
||||
"re2c:encoding-policy = ignore;\n"
|
||||
"re2c:empty-class = match-empty;\n"
|
||||
"re2c:indent:string = \" \";\n"
|
||||
"re2c:indent:top = 0;\n"
|
||||
"re2c:label:prefix = \"yy\";\n"
|
||||
"re2c:label:yyfill = \"yyFillLabel\";\n"
|
||||
"re2c:label:yyloop = \"yyl\";\n"
|
||||
"re2c:label:yyNext = \"yyNext\";\n"
|
||||
"re2c:label:start = 0;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// mutable code configuration --------------------------------------------------\n"
|
||||
"\n"
|
||||
"re2c:YYBACKUP = \"yybackup\";\n"
|
||||
"re2c:YYBACKUPCTX = \"yybackupctx\";\n"
|
||||
"re2c:YYCONDTYPE = \"YYCONDTYPE\";\n"
|
||||
"re2c:YYCOPYMTAG = sigil \"{lhs} = \" sigil \"{rhs}\";\n"
|
||||
"re2c:YYCOPYSTAG = sigil \"{lhs} = \" sigil \"{rhs}\";\n"
|
||||
"re2c:YYCTYPE = \"u8\";\n"
|
||||
"re2c:YYCTXMARKER = (.api.record ? yyrecord \".\") \"yyctxmarker\";\n"
|
||||
"re2c:YYCURSOR = (.api.record ? yyrecord \".\") \"yycursor\";\n"
|
||||
"re2c:YYDEBUG = \"yydebug\";\n"
|
||||
"re2c:YYFILL = \"yyfill\";\n"
|
||||
"re2c:YYGETACCEPT = sigil \"{var}\";\n"
|
||||
"re2c:YYGETCOND = \"yygetcond\";\n"
|
||||
"re2c:YYGETSTATE = \"yygetstate\";\n"
|
||||
"re2c:YYINPUT = (.api.record ? yyrecord \".\") \"yyinput\";\n"
|
||||
"re2c:YYLESSTHAN = \"yylessthan\";\n"
|
||||
"re2c:YYLIMIT = (.api.record ? yyrecord \".\") \"yylimit\";\n"
|
||||
"re2c:YYMARKER = (.api.record ? yyrecord \".\") \"yymarker\";\n"
|
||||
"re2c:YYMAXFILL = \"yymaxfill\";\n"
|
||||
"re2c:YYMAXNMATCH = \"yymaxnmatch\";\n"
|
||||
"re2c:YYMTAGN = \"yymtagn\";\n"
|
||||
"re2c:YYMTAGP = \"yymtagp\";\n"
|
||||
"re2c:YYPEEK = \"yypeek\";\n"
|
||||
"re2c:YYRESTORE = \"yyrestore\";\n"
|
||||
"re2c:YYRESTORECTX = \"yyrestorectx\";\n"
|
||||
"re2c:YYRESTORETAG = \"yyrestoretag\";\n"
|
||||
"re2c:YYSETACCEPT = sigil \"{var} = \" sigil \"{val}\";\n"
|
||||
"re2c:YYSETCOND = \"yysetcond\";\n"
|
||||
"re2c:YYSETSTATE = \"yysetstate\";\n"
|
||||
"re2c:YYSHIFT = \"yyshift\";\n"
|
||||
"re2c:YYSHIFTSTAG = \"yyshiftstag\";\n"
|
||||
"re2c:YYSHIFTMTAG = \"yyshiftmtag\";\n"
|
||||
"re2c:YYSKIP = \"yyskip\";\n"
|
||||
"re2c:YYSTAGN = \"yystagn\";\n"
|
||||
"re2c:YYSTAGP = \"yystagp\";\n"
|
||||
"re2c:tags:expression = (.api.record ? yyrecord \".\") sigil;\n"
|
||||
"re2c:tags:negative = (.api.generic ? \"@@\" : \"-1\");\n"
|
||||
"re2c:cond:divider = \"/* *********************************** */\";\n"
|
||||
"re2c:cond:goto = \"unsafe { goto \" sigil \" }\";\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// code templates --------------------------------------------------------------\n"
|
||||
"\n"
|
||||
"code:var_local = topindent \"mut \" name \" := \" init nl;\n"
|
||||
"code:var_global = <undefined>;\n"
|
||||
"\n"
|
||||
"code:const_local = topindent \"const \" name \" = \" init nl;\n"
|
||||
"code:const_global = code:const_local;\n"
|
||||
"\n"
|
||||
"code:array_local =\n"
|
||||
" topindent name \" := [\" nl indent\n"
|
||||
" [row: topindent [elem{0:-2}: elem \", \"] [elem{-1}: elem \",\"] nl]\n"
|
||||
" dedent topindent \"]\" nl;\n"
|
||||
"\n"
|
||||
"code:array_global = <undefined>;\n"
|
||||
"\n"
|
||||
"code:array_elem = array \"[\" index \"]\";\n"
|
||||
"\n"
|
||||
"// Don't use enum in loop/switch mode, as conditions are assigned to `yystate`.\n"
|
||||
"code:enum = (.code_model.loop_switch\n"
|
||||
" ? [elem: \"const \" elem \" = \" init nl]\n"
|
||||
" : \"enum \" type \" {\" nl\n"
|
||||
" indent [elem: topindent elem (.init ? \" = \" init) nl] dedent\n"
|
||||
" \"}\" nl);\n"
|
||||
"\n"
|
||||
"code:enum_elem = (!.code_model.loop_switch ? \".\") name;\n"
|
||||
"\n"
|
||||
"code:assign = topindent lhs \" = \" rhs nl;\n"
|
||||
"\n"
|
||||
"code:type_int = \"int\";\n"
|
||||
"code:type_uint = \"u32\";\n"
|
||||
"code:type_yybm = \"u8\";\n"
|
||||
"code:type_yytarget = <undefined>;\n"
|
||||
"\n"
|
||||
"code:cmp_eq = \"==\";\n"
|
||||
"code:cmp_ne = \"!=\";\n"
|
||||
"code:cmp_lt = \"<\";\n"
|
||||
"code:cmp_gt = \">\";\n"
|
||||
"code:cmp_le = \"<=\";\n"
|
||||
"code:cmp_ge = \">=\";\n"
|
||||
"\n"
|
||||
"code:if_then_else =\n"
|
||||
" [branch{0}: topindent \"if \" cond \" {\" nl\n"
|
||||
" indent [stmt: stmt] dedent]\n"
|
||||
" [branch{1:-1}: topindent \"} else \" (.cond ? \"if \" cond \" \") \"{\" nl\n"
|
||||
" indent [stmt: stmt] dedent]\n"
|
||||
" topindent \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:if_then_else_oneline = <undefined>;\n"
|
||||
"\n"
|
||||
"code:switch =\n"
|
||||
" topindent \"match \" expr \" {\" nl\n"
|
||||
" indent [case: case] dedent\n"
|
||||
" topindent \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:switch_cases = topindent\n"
|
||||
" [case{0:-2}: case \", \"]\n"
|
||||
" [case{-1}: case \" {\"] nl\n"
|
||||
" indent [stmt: stmt] dedent\n"
|
||||
" topindent \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:switch_cases_oneline = topindent\n"
|
||||
" [case{0:-2}: case \", \"]\n"
|
||||
" [case{-1}: case \" { \"] [stmt: stmt] \" }\" nl;\n"
|
||||
"\n"
|
||||
"code:switch_case_range = [val{0}: val] (.many ? \"...\" [val{-1}: val]);\n"
|
||||
"\n"
|
||||
"code:switch_case_default = \"else\";\n"
|
||||
"\n"
|
||||
"code:loop =\n"
|
||||
" (.loop_label ? label \":\" nl)\n"
|
||||
" topindent \"for {\" nl\n"
|
||||
" indent [stmt: stmt] dedent\n"
|
||||
" topindent \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:continue = topindent \"continue\" (.loop_label ? \" \" label) nl;\n"
|
||||
"\n"
|
||||
"code:goto = topindent \"unsafe { goto \" label \" }\" nl;\n"
|
||||
"\n"
|
||||
"code:fndecl = <undefined>;\n"
|
||||
"\n"
|
||||
"code:fndef =\n"
|
||||
" topindent \"fn \" name \"(\"\n"
|
||||
" [arg{0:-2}: argname \" \" argtype \", \"]\n"
|
||||
" [arg{-1}: argname \" \" argtype]\n"
|
||||
" \")\" (.type ? \" \" type) \" {\" nl\n"
|
||||
" indent [stmt: stmt] dedent\n"
|
||||
" \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:fncall =\n"
|
||||
" topindent (.retval ? retval \" = \") name \"(\" [arg{0:-2}: arg \", \"] [arg{-1}: arg] \")\" nl;\n"
|
||||
"\n"
|
||||
"code:tailcall =\n"
|
||||
" topindent (.retval ? \"return \") name \"(\" [arg{0:-2}: arg \", \"] [arg{-1}: arg] \")\" nl;\n"
|
||||
"\n"
|
||||
"code:recursive_functions = [fn: fndef nl];\n"
|
||||
"\n"
|
||||
"code:fingerprint =\n"
|
||||
" \"// Code generated by re2v\" (.version ? \" \" version) (.date ? \" on \" date) \", DO NOT EDIT.\" nl;\n"
|
||||
"\n"
|
||||
"code:line_info = \"//line \\\"\" file \"\\\":\" line nl;\n"
|
||||
"\n"
|
||||
"code:abort = topindent \"panic(\\\"internal lexer error\\\")\" nl;\n"
|
||||
"\n"
|
||||
"code:yydebug =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYDEBUG (.api_style.functions ? \"()\")\n"
|
||||
" : (.api.record\n"
|
||||
" ? YYDEBUG \"(\" yyrecord \")\"\n"
|
||||
" : YYDEBUG \"(\" state \", \" yych \")\"\n"
|
||||
" )) nl;\n"
|
||||
"\n"
|
||||
"code:yypeek =\n"
|
||||
" topindent yych (.code_model.recursive_functions ? \" := \" : \" = \") (.api.generic\n"
|
||||
" ? YYPEEK\n"
|
||||
" : YYINPUT \"[\" YYCURSOR \"]\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyskip =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSKIP\n"
|
||||
" : YYCURSOR \" += 1\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yybackup =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYBACKUP\n"
|
||||
" : YYMARKER \" = \" YYCURSOR\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yybackupctx =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYBACKUPCTX\n"
|
||||
" : YYCTXMARKER \" = \" YYCURSOR\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyskip_yypeek = <undefined>;\n"
|
||||
"code:yypeek_yyskip = <undefined>;\n"
|
||||
"code:yyskip_yybackup = <undefined>;\n"
|
||||
"code:yybackup_yyskip = <undefined>;\n"
|
||||
"code:yybackup_yypeek = <undefined>;\n"
|
||||
"code:yyskip_yybackup_yypeek = <undefined>;\n"
|
||||
"code:yybackup_yypeek_yyskip = <undefined>;\n"
|
||||
"\n"
|
||||
"code:yyrestore =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYRESTORE\n"
|
||||
" : YYCURSOR \" = \" YYMARKER\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyrestorectx =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYRESTORECTX\n"
|
||||
" : YYCURSOR \" = \" YYCTXMARKER\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyrestoretag =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYRESTORETAG\n"
|
||||
" : YYCURSOR \" = \" tag\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshift =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSHIFT\n"
|
||||
" : YYCURSOR \" -= \" offset\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshiftstag =\n"
|
||||
" (.nested ? topindent \"if \" tag \" != \" neg \" {\" nl indent)\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSHIFTSTAG\n"
|
||||
" : tag \"-= \" offset\n"
|
||||
" ) nl\n"
|
||||
" (.nested ? dedent topindent \"}\" nl);\n"
|
||||
"\n"
|
||||
"code:yyshiftmtag =\n"
|
||||
" topindent YYSHIFTMTAG nl;\n"
|
||||
"\n"
|
||||
"code:yystagp =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSTAGP\n"
|
||||
" : tag \" = \" YYCURSOR\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yymtagp =\n"
|
||||
" topindent YYMTAGP nl;\n"
|
||||
"\n"
|
||||
"code:yystagn =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSTAGN\n"
|
||||
" : tag \" = \" neg\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yymtagn =\n"
|
||||
" topindent YYMTAGN nl;\n"
|
||||
"\n"
|
||||
"code:yycopystag =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYCOPYSTAG\n"
|
||||
" : lhs \" = \" rhs\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yycopymtag =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYCOPYMTAG\n"
|
||||
" : lhs \" = \" rhs\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetaccept =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYGETACCEPT\n"
|
||||
" : (.api.record & (.storable_state | .code_model.recursive_functions) ? yyrecord \".\") var);\n"
|
||||
"\n"
|
||||
"code:yysetaccept =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSETACCEPT\n"
|
||||
" : (.api.record & (.storable_state | .code_model.recursive_functions) ? yyrecord \".\")\n"
|
||||
" var \" = \" val\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetcond =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYGETCOND\n"
|
||||
" : (.api.record ? yyrecord \".\") var);\n"
|
||||
"\n"
|
||||
"code:yysetcond =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSETCOND\n"
|
||||
" : (.api.record ? yyrecord \".\") var \" = \" val\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetstate =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYGETSTATE\n"
|
||||
" : (.api.record ? yyrecord \".\") var);\n"
|
||||
"\n"
|
||||
"code:yysetstate =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSETSTATE\n"
|
||||
" : (.api.record ? yyrecord \".\") var \" = \" val\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yylessthan =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYLESSTHAN\n"
|
||||
" : (.many\n"
|
||||
" ? \"(\" YYLIMIT \" - \" YYCURSOR \") < \" need\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR));\n"
|
||||
"\n"
|
||||
"code:yybm_filter = yych \" & ~0xFF\";\n"
|
||||
"\n"
|
||||
"code:yybm_match = \"(\" yybm \"[\" offset \"+\" yych \"] & \" mask \") != 0\";\n"
|
||||
;
|
||||
@@ -0,0 +1,420 @@
|
||||
#include "src/parse/conf_parser.h"
|
||||
const char* DEFAULT_SYNTAX_ZIG =
|
||||
"// supported feature lists -----------------------------------------------------\n"
|
||||
"\n"
|
||||
"supported_apis = [\"simple\", \"generic\", \"record\"];\n"
|
||||
"supported_api_styles = [\"free-form\"];\n"
|
||||
"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"
|
||||
"\n"
|
||||
"\n"
|
||||
"// language-specific options ---------------------------------------------------\n"
|
||||
"\n"
|
||||
"semicolons = 1;\n"
|
||||
"backtick_quoted_strings = 0;\n"
|
||||
"single_quoted_strings = 0;\n"
|
||||
"indentation_sensitive = 0;\n"
|
||||
"wrap_blocks_in_braces = 0;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// immutable configurations (command-line only options) ------------------------\n"
|
||||
"\n"
|
||||
"re2c:target = code;\n"
|
||||
"re2c:code-model = loop-switch;\n"
|
||||
"re2c:input-encoding = ascii;\n"
|
||||
"re2c:date = 1;\n"
|
||||
"re2c:version = 1;\n"
|
||||
"re2c:conditions = 0;\n"
|
||||
"re2c:storable-state = 0;\n"
|
||||
"re2c:flex-syntax = 0;\n"
|
||||
"re2c:verbose = 0;\n"
|
||||
"re2c:line-dirs = 0;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// mutable configurations ------------------------------------------------------\n"
|
||||
"\n"
|
||||
"re2c:api = simple;\n"
|
||||
"re2c:api:style = free-form;\n"
|
||||
"re2c:api:sigil = \"@@\";\n"
|
||||
"re2c:YYGETCOND:naked = 0;\n"
|
||||
"re2c:YYSETCOND:naked = 0;\n"
|
||||
"re2c:YYSETCOND@cond = \"@@\";\n"
|
||||
"re2c:YYGETSTATE:naked = 0;\n"
|
||||
"re2c:YYSETSTATE:naked = 0;\n"
|
||||
"re2c:YYSETSTATE@state = \"@@\";\n"
|
||||
"re2c:YYFILL@len = \"@@\";\n"
|
||||
"re2c:YYFILL:naked = 0;\n"
|
||||
"re2c:YYFN = [\"<undefined-function-name>;<undefined-function-type>\"];\n"
|
||||
"re2c:yyfn:sep = \";\";\n"
|
||||
"re2c:yycond = \"yycond\";\n"
|
||||
"re2c:yyctable = \"yyctable\";\n"
|
||||
"re2c:yyaccept = \"yyaccept\";\n"
|
||||
"re2c:yytarget = \"yytarget\";\n"
|
||||
"re2c:yystate = \"yystate\";\n"
|
||||
"re2c:yynmatch = \"yynmatch\";\n"
|
||||
"re2c:yypmatch = \"yypmatch\";\n"
|
||||
"re2c:yyrecord = \"yyrecord\";\n"
|
||||
"re2c:yych = \"yych\";\n"
|
||||
"re2c:yych:conversion = 0;\n"
|
||||
"re2c:yych:literals = hex; // zig does not recognize '\\f' escape sequence => use hex\n"
|
||||
"re2c:yych:emit = (.code_model.recursive_functions ? 0 : 1);\n"
|
||||
"re2c:yybm = \"yybm\";\n"
|
||||
"re2c:yybm:hex = 0;\n"
|
||||
"re2c:yyfill = \"\";\n"
|
||||
"re2c:yystable = \"\"; // deprecated\n"
|
||||
"re2c:header = \"\";\n"
|
||||
"re2c:eof = -1;\n"
|
||||
"re2c:sentinel = -1;\n"
|
||||
"re2c:yyfill:enable = 1;\n"
|
||||
"re2c:yyfill:parameter = 1;\n"
|
||||
"re2c:yyfill:check = 1;\n"
|
||||
"re2c:tags = 0;\n"
|
||||
"re2c:tags:prefix = \"yyt\";\n"
|
||||
"re2c:captures = 0;\n"
|
||||
"re2c:captvars = 0;\n"
|
||||
"re2c:posix-captures = 0;\n"
|
||||
"re2c:posix-captvars = 0;\n"
|
||||
"re2c:invert-captures = 0;\n"
|
||||
"re2c:cond:abort = 1;\n"
|
||||
"re2c:cond:prefix = \"yyc_\";\n"
|
||||
"re2c:cond:enumprefix = \"yyc\";\n"
|
||||
"re2c:cond:divider@cond = \"@@\";\n"
|
||||
"re2c:cond:goto@cond = \"@@\";\n"
|
||||
"re2c:state:abort = 1;\n"
|
||||
"re2c:state:nextlabel = 0;\n"
|
||||
"re2c:bit-vectors = 0;\n"
|
||||
"re2c:debug-output = 0;\n"
|
||||
"re2c:computed-gotos = 0;\n"
|
||||
"re2c:computed-gotos:threshold = 9;\n"
|
||||
"re2c:nested-ifs = 0;\n"
|
||||
"re2c:case-insensitive = 0;\n"
|
||||
"re2c:case-inverted = 0;\n"
|
||||
"re2c:case-ranges = 1;\n"
|
||||
"re2c:unsafe = 0;\n"
|
||||
"re2c:monadic = 0;\n"
|
||||
"re2c:encoding:ebcdic = 0;\n"
|
||||
"re2c:encoding:utf32 = 0;\n"
|
||||
"re2c:encoding:ucs2 = 0;\n"
|
||||
"re2c:encoding:utf16 = 0;\n"
|
||||
"re2c:encoding:utf8 = 0;\n"
|
||||
"re2c:encoding-policy = ignore;\n"
|
||||
"re2c:empty-class = match-empty;\n"
|
||||
"re2c:indent:string = \" \";\n"
|
||||
"re2c:indent:top = 0;\n"
|
||||
"re2c:label:prefix = \"yy\"; // used to generate function names\n"
|
||||
"re2c:label:yyfill = \"\";\n"
|
||||
"re2c:label:yyloop = \"yyl\";\n"
|
||||
"re2c:label:yyNext = \"\";\n"
|
||||
"re2c:label:start = 0;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// mutable code configuration --------------------------------------------------\n"
|
||||
"\n"
|
||||
"re2c:YYBACKUP = \"yybackup\";\n"
|
||||
"re2c:YYBACKUPCTX = \"yybackupctx\";\n"
|
||||
"re2c:YYCONDTYPE = \"u32\";\n"
|
||||
"re2c:YYCOPYMTAG = sigil \"{lhs} = \" sigil \"{rhs};\";\n"
|
||||
"re2c:YYCOPYSTAG = sigil \"{lhs} = \" sigil \"{rhs};\";\n"
|
||||
"re2c:YYCTXMARKER = (.api.record ? yyrecord \".\") \"yyctxmarker\";\n"
|
||||
"re2c:YYCTYPE = \"u8\";\n"
|
||||
"re2c:YYCURSOR = (.api.record ? yyrecord \".\") \"yycursor\";\n"
|
||||
"re2c:YYDEBUG = \"yydebug\";\n"
|
||||
"re2c:YYFILL = \"yyfill\";\n"
|
||||
"re2c:YYGETACCEPT = sigil \"{var}\";\n"
|
||||
"re2c:YYGETCOND = \"yygetcond\";\n"
|
||||
"re2c:YYGETSTATE = \"yygetstate\";\n"
|
||||
"re2c:YYINPUT = (.api.record ? yyrecord \".\") \"yyinput\";\n"
|
||||
"re2c:YYLESSTHAN = \"yylessthan\";\n"
|
||||
"re2c:YYLIMIT = (.api.record ? yyrecord \".\") \"yylimit\";\n"
|
||||
"re2c:YYMARKER = (.api.record ? yyrecord \".\") \"yymarker\";\n"
|
||||
"re2c:YYMAXFILL = \"yymaxfill\";\n"
|
||||
"re2c:YYMAXNMATCH = \"yymaxnmatch\";\n"
|
||||
"re2c:YYMTAGN = \"yymtagn\";\n"
|
||||
"re2c:YYMTAGP = \"yymtagp\";\n"
|
||||
"re2c:YYPEEK = \"yypeek\";\n"
|
||||
"re2c:YYRESTORE = \"yyrestore\";\n"
|
||||
"re2c:YYRESTORECTX = \"yyrestorectx\";\n"
|
||||
"re2c:YYRESTORETAG = \"yyrestoretag\";\n"
|
||||
"re2c:YYSETACCEPT = sigil \"{var} = \" sigil \"{val};\";\n"
|
||||
"re2c:YYSETCOND = \"yysetcond\";\n"
|
||||
"re2c:YYSETSTATE = \"yysetstate\";\n"
|
||||
"re2c:YYSHIFT = \"yyshift\";\n"
|
||||
"re2c:YYSHIFTSTAG = \"yyshiftstag\";\n"
|
||||
"re2c:YYSHIFTMTAG = \"yyshiftmtag\";\n"
|
||||
"re2c:YYSKIP = \"yyskip\";\n"
|
||||
"re2c:YYSTAGN = \"yystagn\";\n"
|
||||
"re2c:YYSTAGP = \"yystagp\";\n"
|
||||
"re2c:tags:expression = (.api.record ? yyrecord \".\") sigil;\n"
|
||||
"re2c:tags:negative = (.api.generic ? \"@@\" : \"std.math.maxInt(usize)\");\n"
|
||||
"re2c:cond:divider = \"/* *********************************** */\";\n"
|
||||
"re2c:cond:goto = \"goto \" sigil \";\";\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"// code templates --------------------------------------------------------------\n"
|
||||
"\n"
|
||||
"code:var_local = topindent \"var \" name \": \" type \" = \" (.init ? init : \"0\") \";\" nl;\n"
|
||||
"code:var_global = code:var_local;\n"
|
||||
"\n"
|
||||
"code:const_local = topindent \"const \" name \" = \" init \";\" nl;\n"
|
||||
"code:const_global = code:const_local;\n"
|
||||
"\n"
|
||||
"code:array_local =\n"
|
||||
" topindent \"const \" name \" = [\" size \"]\" type \"{\" nl indent\n"
|
||||
" [row: topindent [elem{0:-2}: elem \", \"] [elem{-1}: elem \",\"] nl]\n"
|
||||
" dedent topindent \"};\" nl;\n"
|
||||
"\n"
|
||||
"code:array_global = <undefined>;\n"
|
||||
"\n"
|
||||
"code:array_elem = array \"[\" index \"]\";\n"
|
||||
"\n"
|
||||
"code:enum = [elem: topindent \"const \" elem \": \" type \" = \" init \";\" nl];\n"
|
||||
"\n"
|
||||
"code:enum_elem = name;\n"
|
||||
"\n"
|
||||
"code:assign = topindent lhs \" = \" rhs \";\" nl;\n"
|
||||
"\n"
|
||||
"code:type_int = \"i32\";\n"
|
||||
"code:type_uint = \"u32\";\n"
|
||||
"code:type_yybm = \"u8\";\n"
|
||||
"code:type_yytarget = <undefined>;\n"
|
||||
"\n"
|
||||
"code:cmp_eq = \"==\";\n"
|
||||
"code:cmp_ne = \"!=\";\n"
|
||||
"code:cmp_lt = \"<\";\n"
|
||||
"code:cmp_gt = \">\";\n"
|
||||
"code:cmp_le = \"<=\";\n"
|
||||
"code:cmp_ge = \">=\";\n"
|
||||
"\n"
|
||||
"code:if_then_else =\n"
|
||||
" [branch{0}: topindent \"if (\" cond \") {\" nl\n"
|
||||
" indent [stmt: stmt] dedent]\n"
|
||||
" [branch{1:-1}: topindent \"} else \" (.cond ? \"if (\" cond \") \") \"{\" nl\n"
|
||||
" indent [stmt: stmt] dedent]\n"
|
||||
" topindent \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:if_then_else_oneline =\n"
|
||||
" [branch{0}: topindent \"if (\" cond \") { \" [stmt: stmt] \" }\" nl]\n"
|
||||
" [branch{1:-1}: topindent \"else \" (.cond ? \"if (\" cond \") \") \" {\" [stmt: stmt] \" }\" nl];\n"
|
||||
"\n"
|
||||
"code:switch =\n"
|
||||
" topindent \"switch (\" expr \") {\" nl\n"
|
||||
" indent [case: case] dedent\n"
|
||||
" topindent \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:switch_cases =\n"
|
||||
" [case{0:-2}: topindent case \",\" nl]\n"
|
||||
" [case{-1}: topindent case \" => {\" nl\n"
|
||||
" indent [stmt: stmt] dedent\n"
|
||||
" topindent \"},\" nl];\n"
|
||||
"\n"
|
||||
"code:switch_cases_oneline =\n"
|
||||
" [case{0:-2}: topindent case \",\" nl]\n"
|
||||
" [case{-1}: topindent case \" => { \" [stmt: stmt] \" },\" nl];\n"
|
||||
"\n"
|
||||
"code:switch_case_range = [val{0}: val] (.many ? \"...\" [val{-1}: val]);\n"
|
||||
"\n"
|
||||
"code:switch_case_default = \"else\";\n"
|
||||
"\n"
|
||||
"code:loop =\n"
|
||||
" topindent (.loop_label ? label \": \") \"while (true) {\" nl\n"
|
||||
" indent [stmt: stmt] dedent\n"
|
||||
" topindent \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:continue = topindent \"continue\" (.loop_label ? \" :\" label) \";\" nl;\n"
|
||||
"\n"
|
||||
"code:goto = topindent \"goto \" label \";\" nl;\n"
|
||||
"\n"
|
||||
"code:fndecl = <undefined>;\n"
|
||||
"\n"
|
||||
"code:fndef =\n"
|
||||
" topindent \"fn \" name \"(\"\n"
|
||||
" [arg{0:-2}: argname \": \" argtype \", \"]\n"
|
||||
" [arg{-1}: argname \": \" argtype]\n"
|
||||
" \") \" type \" {\" nl\n"
|
||||
" indent [stmt: stmt] dedent\n"
|
||||
" \"}\" nl;\n"
|
||||
"\n"
|
||||
"code:fncall =\n"
|
||||
" topindent (.retval ? retval \" = \" name) \"(\" [arg{0:-2}: arg \", \"] [arg{-1}: arg] \");\" nl;\n"
|
||||
"\n"
|
||||
"code:tailcall =\n"
|
||||
" topindent (.retval ? \"return \" name) \"(\" [arg{0:-2}: arg \", \"] [arg{-1}: arg] \");\" nl;\n"
|
||||
"\n"
|
||||
"code:recursive_functions = [fn: fndef nl];\n"
|
||||
"\n"
|
||||
"code:fingerprint =\n"
|
||||
" \"// Generated by re2zig\" (.version ? \" \" version) (.date ? \" on \" date) nl;\n"
|
||||
"\n"
|
||||
"code:line_info = <undefined>;\n"
|
||||
"\n"
|
||||
"code:abort = topindent \"@panic(\\\"internal lexer error\\\");\" nl;\n"
|
||||
"\n"
|
||||
"code:yydebug =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYDEBUG\n"
|
||||
" : (.api.record\n"
|
||||
" ? YYDEBUG \"(\" yyrecord \");\"\n"
|
||||
" : YYDEBUG \"(\" state \", \" yych \");\"\n"
|
||||
" )) nl;\n"
|
||||
"\n"
|
||||
"code:yypeek =\n"
|
||||
" topindent (.code_model.recursive_functions ? \"var \" yych \": \" YYCTYPE : yych) \" = \" (.api.generic\n"
|
||||
" ? YYPEEK\n"
|
||||
" : (.cast ? \"@intCast(\") YYINPUT \"[\" YYCURSOR \"]\" (.cast ? \")\")\n"
|
||||
" ) \";\" nl;\n"
|
||||
"\n"
|
||||
"code:yyskip =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSKIP\n"
|
||||
" : YYCURSOR \" += 1;\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yybackup =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYBACKUP\n"
|
||||
" : YYMARKER \" = \" YYCURSOR \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yybackupctx =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYBACKUPCTX\n"
|
||||
" : YYCTXMARKER \" = \" YYCURSOR \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyskip_yypeek =\n"
|
||||
" topindent (.code_model.recursive_functions ? YYCTYPE \" \") yych \" = \"\n"
|
||||
" (.cast ? \"@intCast(\") \"*++\" YYCURSOR (.cast ? \")\") \";\" nl;\n"
|
||||
"\n"
|
||||
"code:yypeek_yyskip =\n"
|
||||
" topindent (.code_model.recursive_functions ? YYCTYPE \" \") yych \" = \"\n"
|
||||
" (.cast ? \"@intCast(\") \"*\" YYCURSOR \"++\" (.cast ? \")\") \";\" nl;\n"
|
||||
"\n"
|
||||
"code:yyskip_yybackup =\n"
|
||||
" topindent YYMARKER \" = ++\" YYCURSOR \";\" nl;\n"
|
||||
"\n"
|
||||
"code:yybackup_yyskip =\n"
|
||||
" topindent YYMARKER \" = \" YYCURSOR \"++;\" nl;\n"
|
||||
"\n"
|
||||
"code:yybackup_yypeek =\n"
|
||||
" topindent (.code_model.recursive_functions ? YYCTYPE \" \") yych \" = \"\n"
|
||||
" (.cast ? \"@intCast(\") \"*(\" YYMARKER \" = \" YYCURSOR \")\" (.cast ? \")\") \";\" nl;\n"
|
||||
"\n"
|
||||
"code:yyskip_yybackup_yypeek =\n"
|
||||
" topindent (.code_model.recursive_functions ? YYCTYPE \" \") yych \" = \"\n"
|
||||
" (.cast ? \"@intCast(\") \"*(\" YYMARKER \" = ++\" YYCURSOR \")\" (.cast ? \")\") \";\" nl;\n"
|
||||
"\n"
|
||||
"code:yybackup_yypeek_yyskip =\n"
|
||||
" topindent (.code_model.recursive_functions ? YYCTYPE \" \") yych \" = \"\n"
|
||||
" (.cast ? \"@intCast(\") \"*(\" YYMARKER \" = \" YYCURSOR \"++\" (.cast ? \")\") \");\" nl;\n"
|
||||
"\n"
|
||||
"code:yyrestore =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYRESTORE\n"
|
||||
" : YYCURSOR \" = \" YYMARKER \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyrestorectx =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYRESTORECTX\n"
|
||||
" : YYCURSOR \" = \" YYCTXMARKER \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyrestoretag =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYRESTORETAG\n"
|
||||
" : YYCURSOR \" = \" tag \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshift =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSHIFT\n"
|
||||
" : YYCURSOR \" -= \" offset \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshiftstag =\n"
|
||||
" topindent (.nested ? \"if (\" tag \" != \" neg \") \")\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYSHIFTSTAG\n"
|
||||
" : tag \" -= \" offset \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yyshiftmtag =\n"
|
||||
" topindent YYSHIFTMTAG nl;\n"
|
||||
"\n"
|
||||
"code:yystagp =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSTAGP\n"
|
||||
" : tag \" = \" YYCURSOR \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yymtagp =\n"
|
||||
" topindent YYMTAGP nl;\n"
|
||||
"\n"
|
||||
"code:yystagn =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSTAGN\n"
|
||||
" : tag \" = \" neg \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yymtagn =\n"
|
||||
" topindent YYMTAGN nl;\n"
|
||||
"\n"
|
||||
"code:yycopystag =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYCOPYSTAG\n"
|
||||
" : lhs \" = \" rhs \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yycopymtag =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYCOPYMTAG\n"
|
||||
" : lhs \" = \" rhs \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetaccept =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYGETACCEPT\n"
|
||||
" : (.api.record & (.storable_state | .code_model.recursive_functions) ? yyrecord \".\") var);\n"
|
||||
"\n"
|
||||
"code:yysetaccept =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSETACCEPT\n"
|
||||
" : (.api.record & (.storable_state | .code_model.recursive_functions) ? yyrecord \".\")\n"
|
||||
" var \" = \" val \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetcond =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYGETCOND\n"
|
||||
" : (.api.record ? yyrecord \".\") var);\n"
|
||||
"\n"
|
||||
"code:yysetcond =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSETCOND\n"
|
||||
" : (.api.record ? yyrecord \".\") var \" = \" val \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yygetstate =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYGETSTATE\n"
|
||||
" : (.api.record ? yyrecord \".\") var);\n"
|
||||
"\n"
|
||||
"code:yysetstate =\n"
|
||||
" topindent (.api.generic\n"
|
||||
" ? YYSETSTATE\n"
|
||||
" : (.api.record ? yyrecord \".\" var) \" = \" val \";\"\n"
|
||||
" ) nl;\n"
|
||||
"\n"
|
||||
"code:yylessthan =\n"
|
||||
" (.api.generic\n"
|
||||
" ? YYLESSTHAN\n"
|
||||
" : (.many\n"
|
||||
" ? \"(\" YYLIMIT \" - \" YYCURSOR \") < \" need\n"
|
||||
" : YYLIMIT \" <= \" YYCURSOR));\n"
|
||||
"\n"
|
||||
"code:yybm_filter = yych \" & ~0xFF\";\n"
|
||||
"\n"
|
||||
"code:yybm_match = \"(\" yybm \"[\" offset \"+\" yych \"] & \" mask \") != 0\";\n"
|
||||
;
|
||||
@@ -2,9 +2,7 @@ extern const char* help;
|
||||
const char* help =
|
||||
"USAGE\n"
|
||||
"\n"
|
||||
" re2c [ OPTIONS ] [ WARNINGS ] INPUT\n"
|
||||
" re2go [ OPTIONS ] [ WARNINGS ] INPUT\n"
|
||||
" re2rust [ OPTIONS ] [ WARNINGS ] INPUT\n"
|
||||
" re2c [ OPTIONS ] [ WARNINGS ] INPUT\n"
|
||||
"\n"
|
||||
" Input can be either a file or - for stdin.\n"
|
||||
"\n"
|
||||
@@ -14,18 +12,32 @@ const char* help =
|
||||
"\n"
|
||||
" Show help message.\n"
|
||||
"\n"
|
||||
" --api --input <default | custom>\n"
|
||||
" --api <simple | record | generic>\n"
|
||||
"\n"
|
||||
" Specify the API used by the generated code to interface with used-\n"
|
||||
" defined code: default is the API based on pointer arithmetic (the\n"
|
||||
" default for C), and custom is the generic API (the default for Go and\n"
|
||||
" Rust).\n"
|
||||
" defined code. Option simple shold be used in simple cases when there's\n"
|
||||
" no need for buffer refilling and storing lexer state. Option record\n"
|
||||
" should be used when lexer state needs to be stored in a record (struct,\n"
|
||||
" class, etc.). Option generic should be used in complex cases when the\n"
|
||||
" other two APIs are not flexible enough.\n"
|
||||
"\n"
|
||||
" --bit-vectors -b\n"
|
||||
"\n"
|
||||
" Optimize conditional jumps using bit masks. This option implies\n"
|
||||
" --nested-ifs.\n"
|
||||
"\n"
|
||||
" --captures, --leftmost-captures\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with leftmost greedy capturing groups. The\n"
|
||||
" result is collected into an array yybmatch of capacity 2 * YYMAXNMATCH,\n"
|
||||
" and yynmatch is set to the number of groups for the matching rule.\n"
|
||||
"\n"
|
||||
" --captvars, --leftmost-captvars\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with leftmost greedy capturing groups. The\n"
|
||||
" result is collected into variables yytl<k>, yytr<k> for k-th capturing\n"
|
||||
" group.\n"
|
||||
"\n"
|
||||
" --case-insensitive\n"
|
||||
"\n"
|
||||
" Treat single-quoted and double-quoted strings as case-insensitive.\n"
|
||||
@@ -63,9 +75,9 @@ const char* help =
|
||||
"\n"
|
||||
" Write dependency information to FILE in the form of a Makefile rule\n"
|
||||
" <output-file> : <input-file> [include-file ...]. This allows one to\n"
|
||||
" track build dependencies in the presence of include:re2c directives, so\n"
|
||||
" that updating include files triggers regeneration of the output file.\n"
|
||||
" This option depends on the --output option.\n"
|
||||
" track build dependencies in the presence of include blocks/directives,\n"
|
||||
" so that updating include files triggers regeneration of the output\n"
|
||||
" file. This option depends on the --output option.\n"
|
||||
"\n"
|
||||
" --ebcdic --ecb -e\n"
|
||||
"\n"
|
||||
@@ -95,19 +107,31 @@ const char* help =
|
||||
" must be surrounded with curly braces. Names without curly braces are\n"
|
||||
" treated as double-quoted strings.\n"
|
||||
"\n"
|
||||
" --goto-label\n"
|
||||
"\n"
|
||||
" Use \"goto/label\" code model: encode DFA in form of labeled code blocks\n"
|
||||
" connected with goto transitions across blocks. This is only supported\n"
|
||||
" for languages that have a goto statement.\n"
|
||||
"\n"
|
||||
" --header --type-header -t HEADER\n"
|
||||
"\n"
|
||||
" Generate a HEADER file. The contents of the file can be specified with\n"
|
||||
" directives header:re2c:on and header:re2c:off. If conditions are used\n"
|
||||
" the header will have a condition enum automatically appended to it\n"
|
||||
" (unless there is an explicit conditions:re2c directive).\n"
|
||||
" Generate a HEADER file. The contents of the file can be specified using\n"
|
||||
" special blocks header:on and header:off. If conditions are used, the\n"
|
||||
" generated header will have a condition enum automatically appended to\n"
|
||||
" it (unless there is an explicit conditions block).\n"
|
||||
"\n"
|
||||
" -I PATH\n"
|
||||
"\n"
|
||||
" Add PATH to the list of locations which are used when searching for\n"
|
||||
" include files. This option is useful in combination with include:re2c\n"
|
||||
" directive. re2c looks for FILE in the directory of the parent file and\n"
|
||||
" in the include locations specified with -I option.\n"
|
||||
" include files. This option is useful in combination with include block\n"
|
||||
" or directive. re2c looks for FILE in the directory of the parent file\n"
|
||||
" and in the include locations specified with -I option.\n"
|
||||
"\n"
|
||||
" --input <default | custom>\n"
|
||||
"\n"
|
||||
" Deprecated alias for --api. Option default corresponds to simple (it is\n"
|
||||
" indeed the default for most backends, but not for all). Option custom\n"
|
||||
" corresponds to generic.\n"
|
||||
"\n"
|
||||
" --input-encoding <ascii | utf8>\n"
|
||||
"\n"
|
||||
@@ -116,10 +140,20 @@ const char* help =
|
||||
" units is a sequence of standalone 1-byte characters. With utf8 re2c\n"
|
||||
" handles input as UTF8-encoded and recognizes multibyte characters.\n"
|
||||
"\n"
|
||||
" --lang <c | go | rust>\n"
|
||||
" --invert-captures\n"
|
||||
"\n"
|
||||
" Specify the output language. Supported languages are C, Go and Rust.\n"
|
||||
" The default is C for re2c, Go for re2go and Rust for re2rust.\n"
|
||||
" Invert the meaning of capturing and non-capturing groups. By default\n"
|
||||
" (...) is capturing and (! ...) is non-capturing. With this option (!\n"
|
||||
" ...) is capturing and (...) is non-capturing.\n"
|
||||
"\n"
|
||||
" --lang <none | c | d | go | haskell | java | js | ocaml | python | rust | v\n"
|
||||
" | zig>\n"
|
||||
"\n"
|
||||
" Specify the target language. Supported languages are C, D, Go, Haskell,\n"
|
||||
" Java, JS, OCaml, Python, Rust, V, Zig (more languages can be added via\n"
|
||||
" user-defined syntax files, see the --syntax option). Option none\n"
|
||||
" disables default suntax configs, so that the target language is\n"
|
||||
" undefined.\n"
|
||||
"\n"
|
||||
" --location-format <gnu | msvc>\n"
|
||||
"\n"
|
||||
@@ -129,12 +163,11 @@ const char* help =
|
||||
"\n"
|
||||
" --loop-switch\n"
|
||||
"\n"
|
||||
" Encode DFA in a form of a loop over a switch statement. Individual\n"
|
||||
" states are switch cases. The current state is stored in a variable\n"
|
||||
" yystate. Transitions between states update yystate to the case label of\n"
|
||||
" the destination state and continue to the head of the loop. This option\n"
|
||||
" is always enabled for Rust, as it has no goto statement and cannot use\n"
|
||||
" the goto/label approach which is the default for C and Go backends.\n"
|
||||
" Use \"loop/switch\" code model: encode DFA in form of a loop over a\n"
|
||||
" switch statement, where individual states are switch cases. State is\n"
|
||||
" stored in a variable yystate. Transitions between states update yystate\n"
|
||||
" to the case label of the destination state and continue execution to\n"
|
||||
" the head of the loop.\n"
|
||||
"\n"
|
||||
" --nested-ifs -s\n"
|
||||
"\n"
|
||||
@@ -146,8 +179,7 @@ const char* help =
|
||||
"\n"
|
||||
" Do not output line directives. This may be useful when the generated\n"
|
||||
" code is stored in a version control system (to avoid huge autogenerated\n"
|
||||
" diffs on small changes). This option is on by default for Rust, as it\n"
|
||||
" does not have line directives.\n"
|
||||
" diffs on small changes).\n"
|
||||
"\n"
|
||||
" --no-generation-date\n"
|
||||
"\n"
|
||||
@@ -171,9 +203,22 @@ const char* help =
|
||||
"\n"
|
||||
" Specify the OUTPUT file.\n"
|
||||
"\n"
|
||||
" --posix-captures -P\n"
|
||||
" --posix-captures, -P\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with POSIX-style capturing groups.\n"
|
||||
" Enable submatch extraction with POSIX-style capturing groups. The\n"
|
||||
" result is collected into an array yybmatch of capacity 2 * YYMAXNMATCH,\n"
|
||||
" and yynmatch is set to the number of groups for the matching rule.\n"
|
||||
"\n"
|
||||
" --posix-captvars\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with POSIX-style capturing groups. The\n"
|
||||
" result is collected into variables yytl<k>, yytr<k> for k-th capturing\n"
|
||||
" group.\n"
|
||||
"\n"
|
||||
" --recursive-functions\n"
|
||||
"\n"
|
||||
" Use code model based on co-recursive functions, where each DFA state is\n"
|
||||
" a separate function that may call other state-functions or itself.\n"
|
||||
"\n"
|
||||
" --reusable -r\n"
|
||||
"\n"
|
||||
@@ -198,6 +243,14 @@ const char* help =
|
||||
" primitives, and variables yych, yyaccept and state should be part of\n"
|
||||
" the stored lexer state.\n"
|
||||
"\n"
|
||||
" --syntax FILE\n"
|
||||
"\n"
|
||||
" Load configurations from the specified FILE and apply them on top of\n"
|
||||
" the default syntax file. Note that FILE can define only a few\n"
|
||||
" configurations (if it's used to amend the default syntax file), or it\n"
|
||||
" can define a whole new language backend (in the latter case it is\n"
|
||||
" recommended to use --lang none option).\n"
|
||||
"\n"
|
||||
" --tags -T\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with tags.\n"
|
||||
@@ -394,9 +447,9 @@ const char* help =
|
||||
" -Wcondition-order\n"
|
||||
"\n"
|
||||
" Warn if the generated program makes implicit assumptions about\n"
|
||||
" condition numbering. One should use either the ---header option or the\n"
|
||||
" conditions:re2c directive to generate a mapping of condition names to\n"
|
||||
" numbers and then use the autogenerated condition names.\n"
|
||||
" condition numbering. One should use either --header option or\n"
|
||||
" conditions block to generate a mapping of condition names to numbers\n"
|
||||
" and then use the autogenerated condition names.\n"
|
||||
"\n"
|
||||
" -Wempty-character-class\n"
|
||||
"\n"
|
||||
@@ -447,4 +500,13 @@ const char* help =
|
||||
" generated lexer. This warning is only applicable if the sentinel method\n"
|
||||
" of checking for the end of input is used. It is set to an error if\n"
|
||||
" re2c:sentinel configuration is used.\n"
|
||||
"\n"
|
||||
" -Wundefined-syntax-config\n"
|
||||
"\n"
|
||||
" Warn if the syntax file specified with --syntax option is missing\n"
|
||||
" definitions of some configurations. This helps to maintain user-defined\n"
|
||||
" syntax files: if a new release adds configurations, old syntax file\n"
|
||||
" will raise a warning, and the user will be notified. If some\n"
|
||||
" configurations are unused and do not need a definition, they should be\n"
|
||||
" explicitly set to <undefined>.\n"
|
||||
;
|
||||
@@ -0,0 +1,512 @@
|
||||
extern const char* help;
|
||||
const char* help =
|
||||
"USAGE\n"
|
||||
"\n"
|
||||
" re2d [ OPTIONS ] [ WARNINGS ] INPUT\n"
|
||||
"\n"
|
||||
" Input can be either a file or - for stdin.\n"
|
||||
"\n"
|
||||
"OPTIONS\n"
|
||||
"\n"
|
||||
" -? --help -h\n"
|
||||
"\n"
|
||||
" Show help message.\n"
|
||||
"\n"
|
||||
" --api <simple | record | generic>\n"
|
||||
"\n"
|
||||
" Specify the API used by the generated code to interface with used-\n"
|
||||
" defined code. Option simple shold be used in simple cases when there's\n"
|
||||
" no need for buffer refilling and storing lexer state. Option record\n"
|
||||
" should be used when lexer state needs to be stored in a record (struct,\n"
|
||||
" class, etc.). Option generic should be used in complex cases when the\n"
|
||||
" other two APIs are not flexible enough.\n"
|
||||
"\n"
|
||||
" --bit-vectors -b\n"
|
||||
"\n"
|
||||
" Optimize conditional jumps using bit masks. This option implies\n"
|
||||
" --nested-ifs.\n"
|
||||
"\n"
|
||||
" --captures, --leftmost-captures\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with leftmost greedy capturing groups. The\n"
|
||||
" result is collected into an array yybmatch of capacity 2 * YYMAXNMATCH,\n"
|
||||
" and yynmatch is set to the number of groups for the matching rule.\n"
|
||||
"\n"
|
||||
" --captvars, --leftmost-captvars\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with leftmost greedy capturing groups. The\n"
|
||||
" result is collected into variables yytl<k>, yytr<k> for k-th capturing\n"
|
||||
" group.\n"
|
||||
"\n"
|
||||
" --case-insensitive\n"
|
||||
"\n"
|
||||
" Treat single-quoted and double-quoted strings as case-insensitive.\n"
|
||||
"\n"
|
||||
" --case-inverted\n"
|
||||
"\n"
|
||||
" Invert the meaning of single-quoted and double-quoted strings: treat\n"
|
||||
" single-quoted strings as case-sensitive and double-quoted strings as\n"
|
||||
" case-insensitive.\n"
|
||||
"\n"
|
||||
" --case-ranges\n"
|
||||
"\n"
|
||||
" Collapse consecutive cases in a switch statements into a range of the\n"
|
||||
" form low ... high. This syntax is a C/C++ language extension that is\n"
|
||||
" supported by compilers like GCC, Clang and Tcc. The main advantage over\n"
|
||||
" using single cases is smaller generated code and faster generation\n"
|
||||
" time, although for some compilers like Tcc it also results in smaller\n"
|
||||
" binary size. This option is supported only for C.\n"
|
||||
"\n"
|
||||
" --computed-gotos -g\n"
|
||||
"\n"
|
||||
" Optimize conditional jumps using non-standard \"computed goto\" extension\n"
|
||||
" (which must be supported by the compiler). re2d generates jump tables\n"
|
||||
" only in complex cases with a lot of conditional branches. Complexity\n"
|
||||
" threshold can be configured with cgoto:threshold configuration. This\n"
|
||||
" option implies --bit-vectors. It is supported only for C.\n"
|
||||
"\n"
|
||||
" --conditions --start-conditions -c\n"
|
||||
"\n"
|
||||
" Enable support of Flex-like \"conditions\": multiple interrelated lexers\n"
|
||||
" within one block. This is an alternative to manually specifying\n"
|
||||
" different re2d blocks connected with goto or function calls.\n"
|
||||
"\n"
|
||||
" --depfile FILE\n"
|
||||
"\n"
|
||||
" Write dependency information to FILE in the form of a Makefile rule\n"
|
||||
" <output-file> : <input-file> [include-file ...]. This allows one to\n"
|
||||
" track build dependencies in the presence of include blocks/directives,\n"
|
||||
" so that updating include files triggers regeneration of the output\n"
|
||||
" file. This option depends on the --output option.\n"
|
||||
"\n"
|
||||
" --ebcdic --ecb -e\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads input in EBCDIC encoding. re2d assumes that\n"
|
||||
" the character range is 0 -- 0xFF and character size is 1 byte.\n"
|
||||
"\n"
|
||||
" --empty-class <match-empty | match-none | error>\n"
|
||||
"\n"
|
||||
" Define the way re2d treats empty character classes. With match-empty\n"
|
||||
" (the default) empty class matches empty input (which is illogical, but\n"
|
||||
" backwards-compatible). With match-none empty class always fails to\n"
|
||||
" match. With error empty class raises a compilation error.\n"
|
||||
"\n"
|
||||
" --encoding-policy <fail | substitute | ignore>\n"
|
||||
"\n"
|
||||
" Define the way re2d treats Unicode surrogates. With fail re2d aborts\n"
|
||||
" with an error when a surrogate is encountered. With substitute re2d\n"
|
||||
" silently replaces surrogates with the error code point 0xFFFD. With\n"
|
||||
" ignore (the default) re2d treats surrogates as normal code points. The\n"
|
||||
" Unicode standard says that standalone surrogates are invalid, but real-\n"
|
||||
" world libraries and programs behave in different ways.\n"
|
||||
"\n"
|
||||
" --flex-syntax -F\n"
|
||||
"\n"
|
||||
" Partial support for Flex syntax: in this mode named definitions don't\n"
|
||||
" need the equal sign and the terminating semicolon, and when used they\n"
|
||||
" must be surrounded with curly braces. Names without curly braces are\n"
|
||||
" treated as double-quoted strings.\n"
|
||||
"\n"
|
||||
" --goto-label\n"
|
||||
"\n"
|
||||
" Use \"goto/label\" code model: encode DFA in form of labeled code blocks\n"
|
||||
" connected with goto transitions across blocks. This is only supported\n"
|
||||
" for languages that have a goto statement.\n"
|
||||
"\n"
|
||||
" --header --type-header -t HEADER\n"
|
||||
"\n"
|
||||
" Generate a HEADER file. The contents of the file can be specified using\n"
|
||||
" special blocks header:on and header:off. If conditions are used, the\n"
|
||||
" generated header will have a condition enum automatically appended to\n"
|
||||
" it (unless there is an explicit conditions block).\n"
|
||||
"\n"
|
||||
" -I PATH\n"
|
||||
"\n"
|
||||
" Add PATH to the list of locations which are used when searching for\n"
|
||||
" include files. This option is useful in combination with include block\n"
|
||||
" or directive. re2d looks for FILE in the directory of the parent file\n"
|
||||
" and in the include locations specified with -I option.\n"
|
||||
"\n"
|
||||
" --input <default | custom>\n"
|
||||
"\n"
|
||||
" Deprecated alias for --api. Option default corresponds to simple (it is\n"
|
||||
" indeed the default for most backends, but not for all). Option custom\n"
|
||||
" corresponds to generic.\n"
|
||||
"\n"
|
||||
" --input-encoding <ascii | utf8>\n"
|
||||
"\n"
|
||||
" Specify the way re2d parses regular expressions. With ascii (the\n"
|
||||
" default) re2d handles input as ASCII-encoded: any sequence of code\n"
|
||||
" units is a sequence of standalone 1-byte characters. With utf8 re2d\n"
|
||||
" handles input as UTF8-encoded and recognizes multibyte characters.\n"
|
||||
"\n"
|
||||
" --invert-captures\n"
|
||||
"\n"
|
||||
" Invert the meaning of capturing and non-capturing groups. By default\n"
|
||||
" (...) is capturing and (! ...) is non-capturing. With this option (!\n"
|
||||
" ...) is capturing and (...) is non-capturing.\n"
|
||||
"\n"
|
||||
" --lang <none | c | d | go | haskell | java | js | ocaml | python | rust | v\n"
|
||||
" | zig>\n"
|
||||
"\n"
|
||||
" Specify the target language. Supported languages are C, D, Go, Haskell,\n"
|
||||
" Java, JS, OCaml, Python, Rust, V, Zig (more languages can be added via\n"
|
||||
" user-defined syntax files, see the --syntax option). Option none\n"
|
||||
" disables default suntax configs, so that the target language is\n"
|
||||
" undefined.\n"
|
||||
"\n"
|
||||
" --location-format <gnu | msvc>\n"
|
||||
"\n"
|
||||
" Specify location format in messages. With gnu locations are printed as\n"
|
||||
" 'filename:line:column: ...'. With msvc locations are printed as\n"
|
||||
" 'filename(line,column) ...'. The default is gnu.\n"
|
||||
"\n"
|
||||
" --loop-switch\n"
|
||||
"\n"
|
||||
" Use \"loop/switch\" code model: encode DFA in form of a loop over a\n"
|
||||
" switch statement, where individual states are switch cases. State is\n"
|
||||
" stored in a variable yystate. Transitions between states update yystate\n"
|
||||
" to the case label of the destination state and continue execution to\n"
|
||||
" the head of the loop.\n"
|
||||
"\n"
|
||||
" --nested-ifs -s\n"
|
||||
"\n"
|
||||
" Use nested if statements instead of switch statements in conditional\n"
|
||||
" jumps. This usually results in more efficient code with non-optimizing\n"
|
||||
" compilers.\n"
|
||||
"\n"
|
||||
" --no-debug-info -i\n"
|
||||
"\n"
|
||||
" Do not output line directives. This may be useful when the generated\n"
|
||||
" code is stored in a version control system (to avoid huge autogenerated\n"
|
||||
" diffs on small changes).\n"
|
||||
"\n"
|
||||
" --no-generation-date\n"
|
||||
"\n"
|
||||
" Suppress date output in the generated file.\n"
|
||||
"\n"
|
||||
" --no-version\n"
|
||||
"\n"
|
||||
" Suppress version output in the generated file.\n"
|
||||
"\n"
|
||||
" --no-unsafe\n"
|
||||
"\n"
|
||||
" Do not generate unsafe wrapper over YYPEEK (this option is specific to\n"
|
||||
" Rust). For performance reasons YYPEEK should avoid bounds-checking, as\n"
|
||||
" the lexer already performs end-of-input checks in a more efficient way.\n"
|
||||
" The user may choose to provide a safe YYPEEK definition, or a\n"
|
||||
" definition that is unsafe only in release builds, in which case the\n"
|
||||
" --no-unsafe option helps to avoid warnings about redundant unsafe\n"
|
||||
" blocks.\n"
|
||||
"\n"
|
||||
" --output -o OUTPUT\n"
|
||||
"\n"
|
||||
" Specify the OUTPUT file.\n"
|
||||
"\n"
|
||||
" --posix-captures, -P\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with POSIX-style capturing groups. The\n"
|
||||
" result is collected into an array yybmatch of capacity 2 * YYMAXNMATCH,\n"
|
||||
" and yynmatch is set to the number of groups for the matching rule.\n"
|
||||
"\n"
|
||||
" --posix-captvars\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with POSIX-style capturing groups. The\n"
|
||||
" result is collected into variables yytl<k>, yytr<k> for k-th capturing\n"
|
||||
" group.\n"
|
||||
"\n"
|
||||
" --recursive-functions\n"
|
||||
"\n"
|
||||
" Use code model based on co-recursive functions, where each DFA state is\n"
|
||||
" a separate function that may call other state-functions or itself.\n"
|
||||
"\n"
|
||||
" --reusable -r\n"
|
||||
"\n"
|
||||
" Deprecated since version 2.2 (reusable blocks are allowed by default\n"
|
||||
" now).\n"
|
||||
"\n"
|
||||
" --skeleton -S\n"
|
||||
"\n"
|
||||
" Ignore user-defined interface code and generate a self-contained\n"
|
||||
" \"skeleton\" program. Additionally, generate input files with strings\n"
|
||||
" derived from the regular grammar and compressed match results that are\n"
|
||||
" used to verify \"skeleton\" behavior on all inputs. This option is useful\n"
|
||||
" for finding bugs in optimizations and code generation. This option is\n"
|
||||
" supported only for C.\n"
|
||||
"\n"
|
||||
" --storable-state -f\n"
|
||||
"\n"
|
||||
" Generate a lexer which can store its inner state. This is useful in\n"
|
||||
" push-model lexers which are stopped by an outer program when there is\n"
|
||||
" not enough input, and then resumed when more input becomes available.\n"
|
||||
" In this mode users should additionally define YYGETSTATE and YYSETSTATE\n"
|
||||
" primitives, and variables yych, yyaccept and state should be part of\n"
|
||||
" the stored lexer state.\n"
|
||||
"\n"
|
||||
" --syntax FILE\n"
|
||||
"\n"
|
||||
" Load configurations from the specified FILE and apply them on top of\n"
|
||||
" the default syntax file. Note that FILE can define only a few\n"
|
||||
" configurations (if it's used to amend the default syntax file), or it\n"
|
||||
" can define a whole new language backend (in the latter case it is\n"
|
||||
" recommended to use --lang none option).\n"
|
||||
"\n"
|
||||
" --tags -T\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with tags.\n"
|
||||
"\n"
|
||||
" --ucs2 --wide-chars -w\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UCS2-encoded input. re2d assumes that the\n"
|
||||
" character range is 0 -- 0xFFFF and character size is 2 bytes. This\n"
|
||||
" option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --utf8 --utf-8 -8\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads input in UTF-8 encoding. re2d assumes that\n"
|
||||
" the character range is 0 -- 0x10FFFF and character size is 1 byte.\n"
|
||||
"\n"
|
||||
" --utf16 --utf-16 -x\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UTF16-encoded input. re2d assumes that the\n"
|
||||
" character range is 0 -- 0x10FFFF and character size is 2 bytes. This\n"
|
||||
" option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --utf32 --unicode -u\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UTF32-encoded input. re2d assumes that the\n"
|
||||
" character range is 0 -- 0x10FFFF and character size is 4 bytes. This\n"
|
||||
" option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --verbose\n"
|
||||
"\n"
|
||||
" Output a short message in case of success.\n"
|
||||
"\n"
|
||||
" --vernum -V\n"
|
||||
"\n"
|
||||
" Show version information in MMmmpp format (major, minor, patch).\n"
|
||||
"\n"
|
||||
" --version -v\n"
|
||||
"\n"
|
||||
" Show version information.\n"
|
||||
"\n"
|
||||
" --single-pass -1\n"
|
||||
"\n"
|
||||
" Deprecated. Does nothing (single pass is the default now).\n"
|
||||
"\n"
|
||||
" --debug-output -d\n"
|
||||
"\n"
|
||||
" Emit YYDEBUG invocations in the generated code. This is useful to trace\n"
|
||||
" lexer execution.\n"
|
||||
"\n"
|
||||
" --dump-adfa\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after tunneling (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-cfg\n"
|
||||
"\n"
|
||||
" Debug option: output control flow graph of tag variables (in .dot\n"
|
||||
" format).\n"
|
||||
"\n"
|
||||
" --dump-closure-stats\n"
|
||||
"\n"
|
||||
" Debug option: output statistics on the number of states in closure.\n"
|
||||
"\n"
|
||||
" --dump-dfa-det\n"
|
||||
"\n"
|
||||
" Debug option: output DFA immediately after determinization (in .dot\n"
|
||||
" format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-min\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after minimization (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-tagopt\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after tag optimizations (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-tree\n"
|
||||
"\n"
|
||||
" Debug option: output DFA under construction with states represented as\n"
|
||||
" tag history trees (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-raw\n"
|
||||
"\n"
|
||||
" Debug option: output DFA under construction with expanded state-sets\n"
|
||||
" (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-interf\n"
|
||||
"\n"
|
||||
" Debug option: output interference table produced by liveness analysis\n"
|
||||
" of tag variables.\n"
|
||||
"\n"
|
||||
" --dump-nfa\n"
|
||||
"\n"
|
||||
" Debug option: output NFA (in .dot format).\n"
|
||||
"\n"
|
||||
" --emit-dot -D\n"
|
||||
"\n"
|
||||
" Instead of normal output generate lexer graph in .dot format. The\n"
|
||||
" output can be converted to an image with the help of Graphviz (e.g.\n"
|
||||
" something like dot -Tpng -odfa.png dfa.dot).\n"
|
||||
"\n"
|
||||
" --dfa-minimization <moore | table>\n"
|
||||
"\n"
|
||||
" Internal option: DFA minimization algorithm used by re2d. The moore\n"
|
||||
" option is the Moore algorithm (it is the default). The table option is\n"
|
||||
" the \"table filling\" algorithm. Both algorithms should produce the same\n"
|
||||
" DFA up to states relabeling; table filling is simpler and much slower\n"
|
||||
" and serves as a reference implementation.\n"
|
||||
"\n"
|
||||
" --eager-skip\n"
|
||||
"\n"
|
||||
" Internal option: make the generated lexer advance the input position\n"
|
||||
" eagerly -- immediately after reading the input symbol. This changes the\n"
|
||||
" default behavior when the input position is advanced lazily -- after\n"
|
||||
" transition to the next state.\n"
|
||||
"\n"
|
||||
" --no-lookahead\n"
|
||||
"\n"
|
||||
" Internal option, deprecated. It used to enable TDFA(0) algorithm.\n"
|
||||
" Unlike TDFA(1), TDFA(0) algorithm does not use one-symbol lookahead. It\n"
|
||||
" applies register operations to the incoming transitions rather than the\n"
|
||||
" outgoing ones. Benchmarks showed that TDFA(0) algorithm is less\n"
|
||||
" efficient than TDFA(1).\n"
|
||||
"\n"
|
||||
" --no-optimize-tags\n"
|
||||
"\n"
|
||||
" Internal option: suppress optimization of tag variables (useful for\n"
|
||||
" debugging).\n"
|
||||
"\n"
|
||||
" --posix-closure <gor1 | gtop>\n"
|
||||
"\n"
|
||||
" Internal option: specify shortest-path algorithm used for the\n"
|
||||
" construction of epsilon-closure with POSIX disambiguation semantics:\n"
|
||||
" gor1 (the default) stands for Goldberg-Radzik algorithm, and gtop\n"
|
||||
" stands for \"global topological order\" algorithm.\n"
|
||||
"\n"
|
||||
" --posix-prectable <complex | naive>\n"
|
||||
"\n"
|
||||
" Internal option: specify the algorithm used to compute POSIX precedence\n"
|
||||
" table. The complex algorithm computes precedence table in one traversal\n"
|
||||
" of tag history tree and has quadratic complexity in the number of TNFA\n"
|
||||
" states; it is the default. The naive algorithm has worst-case cubic\n"
|
||||
" complexity in the number of TNFA states, but it is much simpler than\n"
|
||||
" complex and may be slightly faster in non-pathological cases.\n"
|
||||
"\n"
|
||||
" --stadfa\n"
|
||||
"\n"
|
||||
" Internal option, deprecated. It used to enable staDFA algorithm, which\n"
|
||||
" differs from TDFA in that register operations are placed in states\n"
|
||||
" rather than on transitions. Benchmarks showed that staDFA algorithm is\n"
|
||||
" less efficient than TDFA.\n"
|
||||
"\n"
|
||||
" --fixed-tags <none | toplevel | all>\n"
|
||||
"\n"
|
||||
" Internal option: specify whether the fixed-tag optimization should be\n"
|
||||
" applied to all tags (all), none of them (none), or only those in\n"
|
||||
" toplevel concatenation (toplevel). The default is all. \"Fixed\" tags are\n"
|
||||
" those that are located within a fixed distance to some other tag\n"
|
||||
" (called \"base\"). In such cases only the base tag needs to be tracked,\n"
|
||||
" and the value of the fixed tag can be computed as the value of the base\n"
|
||||
" tag plus a static offset. For tags that are under alternative or\n"
|
||||
" repetition it is also necessary to check if the base tag has a no-match\n"
|
||||
" value (in that case fixed tag should also be set to no-match,\n"
|
||||
" disregarding the offset). For tags in top-level concatenation the check\n"
|
||||
" is not needed, because they always match.\n"
|
||||
"\n"
|
||||
"WARNINGS\n"
|
||||
"\n"
|
||||
" -W\n"
|
||||
"\n"
|
||||
" Turn on all warnings.\n"
|
||||
"\n"
|
||||
" -Werror\n"
|
||||
"\n"
|
||||
" Turn warnings into errors. Note that this option alone doesn't turn on\n"
|
||||
" any warnings; it only affects those warnings that have been turned on\n"
|
||||
" so far or will be turned on later.\n"
|
||||
"\n"
|
||||
" -W<warning>\n"
|
||||
"\n"
|
||||
" Turn on warning.\n"
|
||||
"\n"
|
||||
" -Wno-<warning>\n"
|
||||
"\n"
|
||||
" Turn off warning.\n"
|
||||
"\n"
|
||||
" -Werror-<warning>\n"
|
||||
"\n"
|
||||
" Turn on warning and treat it as an error (this implies -W<warning>).\n"
|
||||
"\n"
|
||||
" -Wno-error-<warning>\n"
|
||||
"\n"
|
||||
" Don't treat this particular warning as an error. This doesn't turn off\n"
|
||||
" the warning itself.\n"
|
||||
"\n"
|
||||
" -Wcondition-order\n"
|
||||
"\n"
|
||||
" Warn if the generated program makes implicit assumptions about\n"
|
||||
" condition numbering. One should use either --header option or\n"
|
||||
" conditions block to generate a mapping of condition names to numbers\n"
|
||||
" and then use the autogenerated condition names.\n"
|
||||
"\n"
|
||||
" -Wempty-character-class\n"
|
||||
"\n"
|
||||
" Warn if a regular expression contains an empty character class. Trying\n"
|
||||
" to match an empty character class makes no sense: it should always\n"
|
||||
" fail. However, for backwards compatibility reasons re2d permits empty\n"
|
||||
" character classes and treats them as empty strings. Use the --empty-\n"
|
||||
" class option to change the default behavior.\n"
|
||||
"\n"
|
||||
" -Wmatch-empty-string\n"
|
||||
"\n"
|
||||
" Warn if a rule is nullable (matches an empty string). If the lexer runs\n"
|
||||
" in a loop and the empty match is unintentional, the lexer may\n"
|
||||
" unexpectedly hang in an infinite loop.\n"
|
||||
"\n"
|
||||
" -Wswapped-range\n"
|
||||
"\n"
|
||||
" Warn if the lower bound of a range is greater than its upper bound. The\n"
|
||||
" default behavior is to silently swap the range bounds.\n"
|
||||
"\n"
|
||||
" -Wundefined-control-flow\n"
|
||||
"\n"
|
||||
" Warn if some input strings cause undefined control flow in the lexer\n"
|
||||
" (the faulty patterns are reported). This is a dangerous and common\n"
|
||||
" mistake. It can be easily fixed by adding the default rule * which has\n"
|
||||
" the lowest priority, matches any code unit, and always consumes a\n"
|
||||
" single code unit.\n"
|
||||
"\n"
|
||||
" -Wunreachable-rules\n"
|
||||
"\n"
|
||||
" Warn about rules that are shadowed by other rules and will never match.\n"
|
||||
"\n"
|
||||
" -Wuseless-escape\n"
|
||||
"\n"
|
||||
" Warn if a symbol is escaped when it shouldn't be. By default, re2d\n"
|
||||
" silently ignores such escapes, but this may as well indicate a typo or\n"
|
||||
" an error in the escape sequence.\n"
|
||||
"\n"
|
||||
" -Wnondeterministic-tags\n"
|
||||
"\n"
|
||||
" Warn if a tag has n-th degree of nondeterminism, where n is greater\n"
|
||||
" than 1.\n"
|
||||
"\n"
|
||||
" -Wsentinel-in-midrule\n"
|
||||
"\n"
|
||||
" Warn if the sentinel symbol occurs in the middle of a rule --- this may\n"
|
||||
" cause reads past the end of buffer, crashes or memory corruption in the\n"
|
||||
" generated lexer. This warning is only applicable if the sentinel method\n"
|
||||
" of checking for the end of input is used. It is set to an error if\n"
|
||||
" re2c:sentinel configuration is used.\n"
|
||||
"\n"
|
||||
" -Wundefined-syntax-config\n"
|
||||
"\n"
|
||||
" Warn if the syntax file specified with --syntax option is missing\n"
|
||||
" definitions of some configurations. This helps to maintain user-defined\n"
|
||||
" syntax files: if a new release adds configurations, old syntax file\n"
|
||||
" will raise a warning, and the user will be notified. If some\n"
|
||||
" configurations are unused and do not need a definition, they should be\n"
|
||||
" explicitly set to <undefined>.\n"
|
||||
;
|
||||
@@ -0,0 +1,512 @@
|
||||
extern const char* help;
|
||||
const char* help =
|
||||
"USAGE\n"
|
||||
"\n"
|
||||
" re2go [ OPTIONS ] [ WARNINGS ] INPUT\n"
|
||||
"\n"
|
||||
" Input can be either a file or - for stdin.\n"
|
||||
"\n"
|
||||
"OPTIONS\n"
|
||||
"\n"
|
||||
" -? --help -h\n"
|
||||
"\n"
|
||||
" Show help message.\n"
|
||||
"\n"
|
||||
" --api <simple | record | generic>\n"
|
||||
"\n"
|
||||
" Specify the API used by the generated code to interface with used-\n"
|
||||
" defined code. Option simple shold be used in simple cases when there's\n"
|
||||
" no need for buffer refilling and storing lexer state. Option record\n"
|
||||
" should be used when lexer state needs to be stored in a record (struct,\n"
|
||||
" class, etc.). Option generic should be used in complex cases when the\n"
|
||||
" other two APIs are not flexible enough.\n"
|
||||
"\n"
|
||||
" --bit-vectors -b\n"
|
||||
"\n"
|
||||
" Optimize conditional jumps using bit masks. This option implies\n"
|
||||
" --nested-ifs.\n"
|
||||
"\n"
|
||||
" --captures, --leftmost-captures\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with leftmost greedy capturing groups. The\n"
|
||||
" result is collected into an array yybmatch of capacity 2 * YYMAXNMATCH,\n"
|
||||
" and yynmatch is set to the number of groups for the matching rule.\n"
|
||||
"\n"
|
||||
" --captvars, --leftmost-captvars\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with leftmost greedy capturing groups. The\n"
|
||||
" result is collected into variables yytl<k>, yytr<k> for k-th capturing\n"
|
||||
" group.\n"
|
||||
"\n"
|
||||
" --case-insensitive\n"
|
||||
"\n"
|
||||
" Treat single-quoted and double-quoted strings as case-insensitive.\n"
|
||||
"\n"
|
||||
" --case-inverted\n"
|
||||
"\n"
|
||||
" Invert the meaning of single-quoted and double-quoted strings: treat\n"
|
||||
" single-quoted strings as case-sensitive and double-quoted strings as\n"
|
||||
" case-insensitive.\n"
|
||||
"\n"
|
||||
" --case-ranges\n"
|
||||
"\n"
|
||||
" Collapse consecutive cases in a switch statements into a range of the\n"
|
||||
" form low ... high. This syntax is a C/C++ language extension that is\n"
|
||||
" supported by compilers like GCC, Clang and Tcc. The main advantage over\n"
|
||||
" using single cases is smaller generated code and faster generation\n"
|
||||
" time, although for some compilers like Tcc it also results in smaller\n"
|
||||
" binary size. This option is supported only for C.\n"
|
||||
"\n"
|
||||
" --computed-gotos -g\n"
|
||||
"\n"
|
||||
" Optimize conditional jumps using non-standard \"computed goto\" extension\n"
|
||||
" (which must be supported by the compiler). re2go generates jump tables\n"
|
||||
" only in complex cases with a lot of conditional branches. Complexity\n"
|
||||
" threshold can be configured with cgoto:threshold configuration. This\n"
|
||||
" option implies --bit-vectors. It is supported only for C.\n"
|
||||
"\n"
|
||||
" --conditions --start-conditions -c\n"
|
||||
"\n"
|
||||
" Enable support of Flex-like \"conditions\": multiple interrelated lexers\n"
|
||||
" within one block. This is an alternative to manually specifying\n"
|
||||
" different re2go blocks connected with goto or function calls.\n"
|
||||
"\n"
|
||||
" --depfile FILE\n"
|
||||
"\n"
|
||||
" Write dependency information to FILE in the form of a Makefile rule\n"
|
||||
" <output-file> : <input-file> [include-file ...]. This allows one to\n"
|
||||
" track build dependencies in the presence of include blocks/directives,\n"
|
||||
" so that updating include files triggers regeneration of the output\n"
|
||||
" file. This option depends on the --output option.\n"
|
||||
"\n"
|
||||
" --ebcdic --ecb -e\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads input in EBCDIC encoding. re2go assumes\n"
|
||||
" that the character range is 0 -- 0xFF and character size is 1 byte.\n"
|
||||
"\n"
|
||||
" --empty-class <match-empty | match-none | error>\n"
|
||||
"\n"
|
||||
" Define the way re2go treats empty character classes. With match-empty\n"
|
||||
" (the default) empty class matches empty input (which is illogical, but\n"
|
||||
" backwards-compatible). With match-none empty class always fails to\n"
|
||||
" match. With error empty class raises a compilation error.\n"
|
||||
"\n"
|
||||
" --encoding-policy <fail | substitute | ignore>\n"
|
||||
"\n"
|
||||
" Define the way re2go treats Unicode surrogates. With fail re2go aborts\n"
|
||||
" with an error when a surrogate is encountered. With substitute re2go\n"
|
||||
" silently replaces surrogates with the error code point 0xFFFD. With\n"
|
||||
" ignore (the default) re2go treats surrogates as normal code points. The\n"
|
||||
" Unicode standard says that standalone surrogates are invalid, but real-\n"
|
||||
" world libraries and programs behave in different ways.\n"
|
||||
"\n"
|
||||
" --flex-syntax -F\n"
|
||||
"\n"
|
||||
" Partial support for Flex syntax: in this mode named definitions don't\n"
|
||||
" need the equal sign and the terminating semicolon, and when used they\n"
|
||||
" must be surrounded with curly braces. Names without curly braces are\n"
|
||||
" treated as double-quoted strings.\n"
|
||||
"\n"
|
||||
" --goto-label\n"
|
||||
"\n"
|
||||
" Use \"goto/label\" code model: encode DFA in form of labeled code blocks\n"
|
||||
" connected with goto transitions across blocks. This is only supported\n"
|
||||
" for languages that have a goto statement.\n"
|
||||
"\n"
|
||||
" --header --type-header -t HEADER\n"
|
||||
"\n"
|
||||
" Generate a HEADER file. The contents of the file can be specified using\n"
|
||||
" special blocks header:on and header:off. If conditions are used, the\n"
|
||||
" generated header will have a condition enum automatically appended to\n"
|
||||
" it (unless there is an explicit conditions block).\n"
|
||||
"\n"
|
||||
" -I PATH\n"
|
||||
"\n"
|
||||
" Add PATH to the list of locations which are used when searching for\n"
|
||||
" include files. This option is useful in combination with include block\n"
|
||||
" or directive. re2go looks for FILE in the directory of the parent file\n"
|
||||
" and in the include locations specified with -I option.\n"
|
||||
"\n"
|
||||
" --input <default | custom>\n"
|
||||
"\n"
|
||||
" Deprecated alias for --api. Option default corresponds to simple (it is\n"
|
||||
" indeed the default for most backends, but not for all). Option custom\n"
|
||||
" corresponds to generic.\n"
|
||||
"\n"
|
||||
" --input-encoding <ascii | utf8>\n"
|
||||
"\n"
|
||||
" Specify the way re2go parses regular expressions. With ascii (the\n"
|
||||
" default) re2go handles input as ASCII-encoded: any sequence of code\n"
|
||||
" units is a sequence of standalone 1-byte characters. With utf8 re2go\n"
|
||||
" handles input as UTF8-encoded and recognizes multibyte characters.\n"
|
||||
"\n"
|
||||
" --invert-captures\n"
|
||||
"\n"
|
||||
" Invert the meaning of capturing and non-capturing groups. By default\n"
|
||||
" (...) is capturing and (! ...) is non-capturing. With this option (!\n"
|
||||
" ...) is capturing and (...) is non-capturing.\n"
|
||||
"\n"
|
||||
" --lang <none | c | d | go | haskell | java | js | ocaml | python | rust | v\n"
|
||||
" | zig>\n"
|
||||
"\n"
|
||||
" Specify the target language. Supported languages are C, D, Go, Haskell,\n"
|
||||
" Java, JS, OCaml, Python, Rust, V, Zig (more languages can be added via\n"
|
||||
" user-defined syntax files, see the --syntax option). Option none\n"
|
||||
" disables default suntax configs, so that the target language is\n"
|
||||
" undefined.\n"
|
||||
"\n"
|
||||
" --location-format <gnu | msvc>\n"
|
||||
"\n"
|
||||
" Specify location format in messages. With gnu locations are printed as\n"
|
||||
" 'filename:line:column: ...'. With msvc locations are printed as\n"
|
||||
" 'filename(line,column) ...'. The default is gnu.\n"
|
||||
"\n"
|
||||
" --loop-switch\n"
|
||||
"\n"
|
||||
" Use \"loop/switch\" code model: encode DFA in form of a loop over a\n"
|
||||
" switch statement, where individual states are switch cases. State is\n"
|
||||
" stored in a variable yystate. Transitions between states update yystate\n"
|
||||
" to the case label of the destination state and continue execution to\n"
|
||||
" the head of the loop.\n"
|
||||
"\n"
|
||||
" --nested-ifs -s\n"
|
||||
"\n"
|
||||
" Use nested if statements instead of switch statements in conditional\n"
|
||||
" jumps. This usually results in more efficient code with non-optimizing\n"
|
||||
" compilers.\n"
|
||||
"\n"
|
||||
" --no-debug-info -i\n"
|
||||
"\n"
|
||||
" Do not output line directives. This may be useful when the generated\n"
|
||||
" code is stored in a version control system (to avoid huge autogenerated\n"
|
||||
" diffs on small changes).\n"
|
||||
"\n"
|
||||
" --no-generation-date\n"
|
||||
"\n"
|
||||
" Suppress date output in the generated file.\n"
|
||||
"\n"
|
||||
" --no-version\n"
|
||||
"\n"
|
||||
" Suppress version output in the generated file.\n"
|
||||
"\n"
|
||||
" --no-unsafe\n"
|
||||
"\n"
|
||||
" Do not generate unsafe wrapper over YYPEEK (this option is specific to\n"
|
||||
" Rust). For performance reasons YYPEEK should avoid bounds-checking, as\n"
|
||||
" the lexer already performs end-of-input checks in a more efficient way.\n"
|
||||
" The user may choose to provide a safe YYPEEK definition, or a\n"
|
||||
" definition that is unsafe only in release builds, in which case the\n"
|
||||
" --no-unsafe option helps to avoid warnings about redundant unsafe\n"
|
||||
" blocks.\n"
|
||||
"\n"
|
||||
" --output -o OUTPUT\n"
|
||||
"\n"
|
||||
" Specify the OUTPUT file.\n"
|
||||
"\n"
|
||||
" --posix-captures, -P\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with POSIX-style capturing groups. The\n"
|
||||
" result is collected into an array yybmatch of capacity 2 * YYMAXNMATCH,\n"
|
||||
" and yynmatch is set to the number of groups for the matching rule.\n"
|
||||
"\n"
|
||||
" --posix-captvars\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with POSIX-style capturing groups. The\n"
|
||||
" result is collected into variables yytl<k>, yytr<k> for k-th capturing\n"
|
||||
" group.\n"
|
||||
"\n"
|
||||
" --recursive-functions\n"
|
||||
"\n"
|
||||
" Use code model based on co-recursive functions, where each DFA state is\n"
|
||||
" a separate function that may call other state-functions or itself.\n"
|
||||
"\n"
|
||||
" --reusable -r\n"
|
||||
"\n"
|
||||
" Deprecated since version 2.2 (reusable blocks are allowed by default\n"
|
||||
" now).\n"
|
||||
"\n"
|
||||
" --skeleton -S\n"
|
||||
"\n"
|
||||
" Ignore user-defined interface code and generate a self-contained\n"
|
||||
" \"skeleton\" program. Additionally, generate input files with strings\n"
|
||||
" derived from the regular grammar and compressed match results that are\n"
|
||||
" used to verify \"skeleton\" behavior on all inputs. This option is useful\n"
|
||||
" for finding bugs in optimizations and code generation. This option is\n"
|
||||
" supported only for C.\n"
|
||||
"\n"
|
||||
" --storable-state -f\n"
|
||||
"\n"
|
||||
" Generate a lexer which can store its inner state. This is useful in\n"
|
||||
" push-model lexers which are stopped by an outer program when there is\n"
|
||||
" not enough input, and then resumed when more input becomes available.\n"
|
||||
" In this mode users should additionally define YYGETSTATE and YYSETSTATE\n"
|
||||
" primitives, and variables yych, yyaccept and state should be part of\n"
|
||||
" the stored lexer state.\n"
|
||||
"\n"
|
||||
" --syntax FILE\n"
|
||||
"\n"
|
||||
" Load configurations from the specified FILE and apply them on top of\n"
|
||||
" the default syntax file. Note that FILE can define only a few\n"
|
||||
" configurations (if it's used to amend the default syntax file), or it\n"
|
||||
" can define a whole new language backend (in the latter case it is\n"
|
||||
" recommended to use --lang none option).\n"
|
||||
"\n"
|
||||
" --tags -T\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with tags.\n"
|
||||
"\n"
|
||||
" --ucs2 --wide-chars -w\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UCS2-encoded input. re2go assumes that the\n"
|
||||
" character range is 0 -- 0xFFFF and character size is 2 bytes. This\n"
|
||||
" option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --utf8 --utf-8 -8\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads input in UTF-8 encoding. re2go assumes that\n"
|
||||
" the character range is 0 -- 0x10FFFF and character size is 1 byte.\n"
|
||||
"\n"
|
||||
" --utf16 --utf-16 -x\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UTF16-encoded input. re2go assumes that the\n"
|
||||
" character range is 0 -- 0x10FFFF and character size is 2 bytes. This\n"
|
||||
" option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --utf32 --unicode -u\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UTF32-encoded input. re2go assumes that the\n"
|
||||
" character range is 0 -- 0x10FFFF and character size is 4 bytes. This\n"
|
||||
" option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --verbose\n"
|
||||
"\n"
|
||||
" Output a short message in case of success.\n"
|
||||
"\n"
|
||||
" --vernum -V\n"
|
||||
"\n"
|
||||
" Show version information in MMmmpp format (major, minor, patch).\n"
|
||||
"\n"
|
||||
" --version -v\n"
|
||||
"\n"
|
||||
" Show version information.\n"
|
||||
"\n"
|
||||
" --single-pass -1\n"
|
||||
"\n"
|
||||
" Deprecated. Does nothing (single pass is the default now).\n"
|
||||
"\n"
|
||||
" --debug-output -d\n"
|
||||
"\n"
|
||||
" Emit YYDEBUG invocations in the generated code. This is useful to trace\n"
|
||||
" lexer execution.\n"
|
||||
"\n"
|
||||
" --dump-adfa\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after tunneling (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-cfg\n"
|
||||
"\n"
|
||||
" Debug option: output control flow graph of tag variables (in .dot\n"
|
||||
" format).\n"
|
||||
"\n"
|
||||
" --dump-closure-stats\n"
|
||||
"\n"
|
||||
" Debug option: output statistics on the number of states in closure.\n"
|
||||
"\n"
|
||||
" --dump-dfa-det\n"
|
||||
"\n"
|
||||
" Debug option: output DFA immediately after determinization (in .dot\n"
|
||||
" format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-min\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after minimization (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-tagopt\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after tag optimizations (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-tree\n"
|
||||
"\n"
|
||||
" Debug option: output DFA under construction with states represented as\n"
|
||||
" tag history trees (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-raw\n"
|
||||
"\n"
|
||||
" Debug option: output DFA under construction with expanded state-sets\n"
|
||||
" (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-interf\n"
|
||||
"\n"
|
||||
" Debug option: output interference table produced by liveness analysis\n"
|
||||
" of tag variables.\n"
|
||||
"\n"
|
||||
" --dump-nfa\n"
|
||||
"\n"
|
||||
" Debug option: output NFA (in .dot format).\n"
|
||||
"\n"
|
||||
" --emit-dot -D\n"
|
||||
"\n"
|
||||
" Instead of normal output generate lexer graph in .dot format. The\n"
|
||||
" output can be converted to an image with the help of Graphviz (e.g.\n"
|
||||
" something like dot -Tpng -odfa.png dfa.dot).\n"
|
||||
"\n"
|
||||
" --dfa-minimization <moore | table>\n"
|
||||
"\n"
|
||||
" Internal option: DFA minimization algorithm used by re2go. The moore\n"
|
||||
" option is the Moore algorithm (it is the default). The table option is\n"
|
||||
" the \"table filling\" algorithm. Both algorithms should produce the same\n"
|
||||
" DFA up to states relabeling; table filling is simpler and much slower\n"
|
||||
" and serves as a reference implementation.\n"
|
||||
"\n"
|
||||
" --eager-skip\n"
|
||||
"\n"
|
||||
" Internal option: make the generated lexer advance the input position\n"
|
||||
" eagerly -- immediately after reading the input symbol. This changes the\n"
|
||||
" default behavior when the input position is advanced lazily -- after\n"
|
||||
" transition to the next state.\n"
|
||||
"\n"
|
||||
" --no-lookahead\n"
|
||||
"\n"
|
||||
" Internal option, deprecated. It used to enable TDFA(0) algorithm.\n"
|
||||
" Unlike TDFA(1), TDFA(0) algorithm does not use one-symbol lookahead. It\n"
|
||||
" applies register operations to the incoming transitions rather than the\n"
|
||||
" outgoing ones. Benchmarks showed that TDFA(0) algorithm is less\n"
|
||||
" efficient than TDFA(1).\n"
|
||||
"\n"
|
||||
" --no-optimize-tags\n"
|
||||
"\n"
|
||||
" Internal option: suppress optimization of tag variables (useful for\n"
|
||||
" debugging).\n"
|
||||
"\n"
|
||||
" --posix-closure <gor1 | gtop>\n"
|
||||
"\n"
|
||||
" Internal option: specify shortest-path algorithm used for the\n"
|
||||
" construction of epsilon-closure with POSIX disambiguation semantics:\n"
|
||||
" gor1 (the default) stands for Goldberg-Radzik algorithm, and gtop\n"
|
||||
" stands for \"global topological order\" algorithm.\n"
|
||||
"\n"
|
||||
" --posix-prectable <complex | naive>\n"
|
||||
"\n"
|
||||
" Internal option: specify the algorithm used to compute POSIX precedence\n"
|
||||
" table. The complex algorithm computes precedence table in one traversal\n"
|
||||
" of tag history tree and has quadratic complexity in the number of TNFA\n"
|
||||
" states; it is the default. The naive algorithm has worst-case cubic\n"
|
||||
" complexity in the number of TNFA states, but it is much simpler than\n"
|
||||
" complex and may be slightly faster in non-pathological cases.\n"
|
||||
"\n"
|
||||
" --stadfa\n"
|
||||
"\n"
|
||||
" Internal option, deprecated. It used to enable staDFA algorithm, which\n"
|
||||
" differs from TDFA in that register operations are placed in states\n"
|
||||
" rather than on transitions. Benchmarks showed that staDFA algorithm is\n"
|
||||
" less efficient than TDFA.\n"
|
||||
"\n"
|
||||
" --fixed-tags <none | toplevel | all>\n"
|
||||
"\n"
|
||||
" Internal option: specify whether the fixed-tag optimization should be\n"
|
||||
" applied to all tags (all), none of them (none), or only those in\n"
|
||||
" toplevel concatenation (toplevel). The default is all. \"Fixed\" tags are\n"
|
||||
" those that are located within a fixed distance to some other tag\n"
|
||||
" (called \"base\"). In such cases only the base tag needs to be tracked,\n"
|
||||
" and the value of the fixed tag can be computed as the value of the base\n"
|
||||
" tag plus a static offset. For tags that are under alternative or\n"
|
||||
" repetition it is also necessary to check if the base tag has a no-match\n"
|
||||
" value (in that case fixed tag should also be set to no-match,\n"
|
||||
" disregarding the offset). For tags in top-level concatenation the check\n"
|
||||
" is not needed, because they always match.\n"
|
||||
"\n"
|
||||
"WARNINGS\n"
|
||||
"\n"
|
||||
" -W\n"
|
||||
"\n"
|
||||
" Turn on all warnings.\n"
|
||||
"\n"
|
||||
" -Werror\n"
|
||||
"\n"
|
||||
" Turn warnings into errors. Note that this option alone doesn't turn on\n"
|
||||
" any warnings; it only affects those warnings that have been turned on\n"
|
||||
" so far or will be turned on later.\n"
|
||||
"\n"
|
||||
" -W<warning>\n"
|
||||
"\n"
|
||||
" Turn on warning.\n"
|
||||
"\n"
|
||||
" -Wno-<warning>\n"
|
||||
"\n"
|
||||
" Turn off warning.\n"
|
||||
"\n"
|
||||
" -Werror-<warning>\n"
|
||||
"\n"
|
||||
" Turn on warning and treat it as an error (this implies -W<warning>).\n"
|
||||
"\n"
|
||||
" -Wno-error-<warning>\n"
|
||||
"\n"
|
||||
" Don't treat this particular warning as an error. This doesn't turn off\n"
|
||||
" the warning itself.\n"
|
||||
"\n"
|
||||
" -Wcondition-order\n"
|
||||
"\n"
|
||||
" Warn if the generated program makes implicit assumptions about\n"
|
||||
" condition numbering. One should use either --header option or\n"
|
||||
" conditions block to generate a mapping of condition names to numbers\n"
|
||||
" and then use the autogenerated condition names.\n"
|
||||
"\n"
|
||||
" -Wempty-character-class\n"
|
||||
"\n"
|
||||
" Warn if a regular expression contains an empty character class. Trying\n"
|
||||
" to match an empty character class makes no sense: it should always\n"
|
||||
" fail. However, for backwards compatibility reasons re2go permits empty\n"
|
||||
" character classes and treats them as empty strings. Use the --empty-\n"
|
||||
" class option to change the default behavior.\n"
|
||||
"\n"
|
||||
" -Wmatch-empty-string\n"
|
||||
"\n"
|
||||
" Warn if a rule is nullable (matches an empty string). If the lexer runs\n"
|
||||
" in a loop and the empty match is unintentional, the lexer may\n"
|
||||
" unexpectedly hang in an infinite loop.\n"
|
||||
"\n"
|
||||
" -Wswapped-range\n"
|
||||
"\n"
|
||||
" Warn if the lower bound of a range is greater than its upper bound. The\n"
|
||||
" default behavior is to silently swap the range bounds.\n"
|
||||
"\n"
|
||||
" -Wundefined-control-flow\n"
|
||||
"\n"
|
||||
" Warn if some input strings cause undefined control flow in the lexer\n"
|
||||
" (the faulty patterns are reported). This is a dangerous and common\n"
|
||||
" mistake. It can be easily fixed by adding the default rule * which has\n"
|
||||
" the lowest priority, matches any code unit, and always consumes a\n"
|
||||
" single code unit.\n"
|
||||
"\n"
|
||||
" -Wunreachable-rules\n"
|
||||
"\n"
|
||||
" Warn about rules that are shadowed by other rules and will never match.\n"
|
||||
"\n"
|
||||
" -Wuseless-escape\n"
|
||||
"\n"
|
||||
" Warn if a symbol is escaped when it shouldn't be. By default, re2go\n"
|
||||
" silently ignores such escapes, but this may as well indicate a typo or\n"
|
||||
" an error in the escape sequence.\n"
|
||||
"\n"
|
||||
" -Wnondeterministic-tags\n"
|
||||
"\n"
|
||||
" Warn if a tag has n-th degree of nondeterminism, where n is greater\n"
|
||||
" than 1.\n"
|
||||
"\n"
|
||||
" -Wsentinel-in-midrule\n"
|
||||
"\n"
|
||||
" Warn if the sentinel symbol occurs in the middle of a rule --- this may\n"
|
||||
" cause reads past the end of buffer, crashes or memory corruption in the\n"
|
||||
" generated lexer. This warning is only applicable if the sentinel method\n"
|
||||
" of checking for the end of input is used. It is set to an error if\n"
|
||||
" re2c:sentinel configuration is used.\n"
|
||||
"\n"
|
||||
" -Wundefined-syntax-config\n"
|
||||
"\n"
|
||||
" Warn if the syntax file specified with --syntax option is missing\n"
|
||||
" definitions of some configurations. This helps to maintain user-defined\n"
|
||||
" syntax files: if a new release adds configurations, old syntax file\n"
|
||||
" will raise a warning, and the user will be notified. If some\n"
|
||||
" configurations are unused and do not need a definition, they should be\n"
|
||||
" explicitly set to <undefined>.\n"
|
||||
;
|
||||
@@ -0,0 +1,512 @@
|
||||
extern const char* help;
|
||||
const char* help =
|
||||
"USAGE\n"
|
||||
"\n"
|
||||
" re2hs [ OPTIONS ] [ WARNINGS ] INPUT\n"
|
||||
"\n"
|
||||
" Input can be either a file or - for stdin.\n"
|
||||
"\n"
|
||||
"OPTIONS\n"
|
||||
"\n"
|
||||
" -? --help -h\n"
|
||||
"\n"
|
||||
" Show help message.\n"
|
||||
"\n"
|
||||
" --api <simple | record | generic>\n"
|
||||
"\n"
|
||||
" Specify the API used by the generated code to interface with used-\n"
|
||||
" defined code. Option simple shold be used in simple cases when there's\n"
|
||||
" no need for buffer refilling and storing lexer state. Option record\n"
|
||||
" should be used when lexer state needs to be stored in a record (struct,\n"
|
||||
" class, etc.). Option generic should be used in complex cases when the\n"
|
||||
" other two APIs are not flexible enough.\n"
|
||||
"\n"
|
||||
" --bit-vectors -b\n"
|
||||
"\n"
|
||||
" Optimize conditional jumps using bit masks. This option implies\n"
|
||||
" --nested-ifs.\n"
|
||||
"\n"
|
||||
" --captures, --leftmost-captures\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with leftmost greedy capturing groups. The\n"
|
||||
" result is collected into an array yybmatch of capacity 2 * YYMAXNMATCH,\n"
|
||||
" and yynmatch is set to the number of groups for the matching rule.\n"
|
||||
"\n"
|
||||
" --captvars, --leftmost-captvars\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with leftmost greedy capturing groups. The\n"
|
||||
" result is collected into variables yytl<k>, yytr<k> for k-th capturing\n"
|
||||
" group.\n"
|
||||
"\n"
|
||||
" --case-insensitive\n"
|
||||
"\n"
|
||||
" Treat single-quoted and double-quoted strings as case-insensitive.\n"
|
||||
"\n"
|
||||
" --case-inverted\n"
|
||||
"\n"
|
||||
" Invert the meaning of single-quoted and double-quoted strings: treat\n"
|
||||
" single-quoted strings as case-sensitive and double-quoted strings as\n"
|
||||
" case-insensitive.\n"
|
||||
"\n"
|
||||
" --case-ranges\n"
|
||||
"\n"
|
||||
" Collapse consecutive cases in a switch statements into a range of the\n"
|
||||
" form low ... high. This syntax is a C/C++ language extension that is\n"
|
||||
" supported by compilers like GCC, Clang and Tcc. The main advantage over\n"
|
||||
" using single cases is smaller generated code and faster generation\n"
|
||||
" time, although for some compilers like Tcc it also results in smaller\n"
|
||||
" binary size. This option is supported only for C.\n"
|
||||
"\n"
|
||||
" --computed-gotos -g\n"
|
||||
"\n"
|
||||
" Optimize conditional jumps using non-standard \"computed goto\" extension\n"
|
||||
" (which must be supported by the compiler). re2hs generates jump tables\n"
|
||||
" only in complex cases with a lot of conditional branches. Complexity\n"
|
||||
" threshold can be configured with cgoto:threshold configuration. This\n"
|
||||
" option implies --bit-vectors. It is supported only for C.\n"
|
||||
"\n"
|
||||
" --conditions --start-conditions -c\n"
|
||||
"\n"
|
||||
" Enable support of Flex-like \"conditions\": multiple interrelated lexers\n"
|
||||
" within one block. This is an alternative to manually specifying\n"
|
||||
" different re2hs blocks connected with goto or function calls.\n"
|
||||
"\n"
|
||||
" --depfile FILE\n"
|
||||
"\n"
|
||||
" Write dependency information to FILE in the form of a Makefile rule\n"
|
||||
" <output-file> : <input-file> [include-file ...]. This allows one to\n"
|
||||
" track build dependencies in the presence of include blocks/directives,\n"
|
||||
" so that updating include files triggers regeneration of the output\n"
|
||||
" file. This option depends on the --output option.\n"
|
||||
"\n"
|
||||
" --ebcdic --ecb -e\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads input in EBCDIC encoding. re2hs assumes\n"
|
||||
" that the character range is 0 -- 0xFF and character size is 1 byte.\n"
|
||||
"\n"
|
||||
" --empty-class <match-empty | match-none | error>\n"
|
||||
"\n"
|
||||
" Define the way re2hs treats empty character classes. With match-empty\n"
|
||||
" (the default) empty class matches empty input (which is illogical, but\n"
|
||||
" backwards-compatible). With match-none empty class always fails to\n"
|
||||
" match. With error empty class raises a compilation error.\n"
|
||||
"\n"
|
||||
" --encoding-policy <fail | substitute | ignore>\n"
|
||||
"\n"
|
||||
" Define the way re2hs treats Unicode surrogates. With fail re2hs aborts\n"
|
||||
" with an error when a surrogate is encountered. With substitute re2hs\n"
|
||||
" silently replaces surrogates with the error code point 0xFFFD. With\n"
|
||||
" ignore (the default) re2hs treats surrogates as normal code points. The\n"
|
||||
" Unicode standard says that standalone surrogates are invalid, but real-\n"
|
||||
" world libraries and programs behave in different ways.\n"
|
||||
"\n"
|
||||
" --flex-syntax -F\n"
|
||||
"\n"
|
||||
" Partial support for Flex syntax: in this mode named definitions don't\n"
|
||||
" need the equal sign and the terminating semicolon, and when used they\n"
|
||||
" must be surrounded with curly braces. Names without curly braces are\n"
|
||||
" treated as double-quoted strings.\n"
|
||||
"\n"
|
||||
" --goto-label\n"
|
||||
"\n"
|
||||
" Use \"goto/label\" code model: encode DFA in form of labeled code blocks\n"
|
||||
" connected with goto transitions across blocks. This is only supported\n"
|
||||
" for languages that have a goto statement.\n"
|
||||
"\n"
|
||||
" --header --type-header -t HEADER\n"
|
||||
"\n"
|
||||
" Generate a HEADER file. The contents of the file can be specified using\n"
|
||||
" special blocks header:on and header:off. If conditions are used, the\n"
|
||||
" generated header will have a condition enum automatically appended to\n"
|
||||
" it (unless there is an explicit conditions block).\n"
|
||||
"\n"
|
||||
" -I PATH\n"
|
||||
"\n"
|
||||
" Add PATH to the list of locations which are used when searching for\n"
|
||||
" include files. This option is useful in combination with include block\n"
|
||||
" or directive. re2hs looks for FILE in the directory of the parent file\n"
|
||||
" and in the include locations specified with -I option.\n"
|
||||
"\n"
|
||||
" --input <default | custom>\n"
|
||||
"\n"
|
||||
" Deprecated alias for --api. Option default corresponds to simple (it is\n"
|
||||
" indeed the default for most backends, but not for all). Option custom\n"
|
||||
" corresponds to generic.\n"
|
||||
"\n"
|
||||
" --input-encoding <ascii | utf8>\n"
|
||||
"\n"
|
||||
" Specify the way re2hs parses regular expressions. With ascii (the\n"
|
||||
" default) re2hs handles input as ASCII-encoded: any sequence of code\n"
|
||||
" units is a sequence of standalone 1-byte characters. With utf8 re2hs\n"
|
||||
" handles input as UTF8-encoded and recognizes multibyte characters.\n"
|
||||
"\n"
|
||||
" --invert-captures\n"
|
||||
"\n"
|
||||
" Invert the meaning of capturing and non-capturing groups. By default\n"
|
||||
" (...) is capturing and (! ...) is non-capturing. With this option (!\n"
|
||||
" ...) is capturing and (...) is non-capturing.\n"
|
||||
"\n"
|
||||
" --lang <none | c | d | go | haskell | java | js | ocaml | python | rust | v\n"
|
||||
" | zig>\n"
|
||||
"\n"
|
||||
" Specify the target language. Supported languages are C, D, Go, Haskell,\n"
|
||||
" Java, JS, OCaml, Python, Rust, V, Zig (more languages can be added via\n"
|
||||
" user-defined syntax files, see the --syntax option). Option none\n"
|
||||
" disables default suntax configs, so that the target language is\n"
|
||||
" undefined.\n"
|
||||
"\n"
|
||||
" --location-format <gnu | msvc>\n"
|
||||
"\n"
|
||||
" Specify location format in messages. With gnu locations are printed as\n"
|
||||
" 'filename:line:column: ...'. With msvc locations are printed as\n"
|
||||
" 'filename(line,column) ...'. The default is gnu.\n"
|
||||
"\n"
|
||||
" --loop-switch\n"
|
||||
"\n"
|
||||
" Use \"loop/switch\" code model: encode DFA in form of a loop over a\n"
|
||||
" switch statement, where individual states are switch cases. State is\n"
|
||||
" stored in a variable yystate. Transitions between states update yystate\n"
|
||||
" to the case label of the destination state and continue execution to\n"
|
||||
" the head of the loop.\n"
|
||||
"\n"
|
||||
" --nested-ifs -s\n"
|
||||
"\n"
|
||||
" Use nested if statements instead of switch statements in conditional\n"
|
||||
" jumps. This usually results in more efficient code with non-optimizing\n"
|
||||
" compilers.\n"
|
||||
"\n"
|
||||
" --no-debug-info -i\n"
|
||||
"\n"
|
||||
" Do not output line directives. This may be useful when the generated\n"
|
||||
" code is stored in a version control system (to avoid huge autogenerated\n"
|
||||
" diffs on small changes).\n"
|
||||
"\n"
|
||||
" --no-generation-date\n"
|
||||
"\n"
|
||||
" Suppress date output in the generated file.\n"
|
||||
"\n"
|
||||
" --no-version\n"
|
||||
"\n"
|
||||
" Suppress version output in the generated file.\n"
|
||||
"\n"
|
||||
" --no-unsafe\n"
|
||||
"\n"
|
||||
" Do not generate unsafe wrapper over YYPEEK (this option is specific to\n"
|
||||
" Rust). For performance reasons YYPEEK should avoid bounds-checking, as\n"
|
||||
" the lexer already performs end-of-input checks in a more efficient way.\n"
|
||||
" The user may choose to provide a safe YYPEEK definition, or a\n"
|
||||
" definition that is unsafe only in release builds, in which case the\n"
|
||||
" --no-unsafe option helps to avoid warnings about redundant unsafe\n"
|
||||
" blocks.\n"
|
||||
"\n"
|
||||
" --output -o OUTPUT\n"
|
||||
"\n"
|
||||
" Specify the OUTPUT file.\n"
|
||||
"\n"
|
||||
" --posix-captures, -P\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with POSIX-style capturing groups. The\n"
|
||||
" result is collected into an array yybmatch of capacity 2 * YYMAXNMATCH,\n"
|
||||
" and yynmatch is set to the number of groups for the matching rule.\n"
|
||||
"\n"
|
||||
" --posix-captvars\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with POSIX-style capturing groups. The\n"
|
||||
" result is collected into variables yytl<k>, yytr<k> for k-th capturing\n"
|
||||
" group.\n"
|
||||
"\n"
|
||||
" --recursive-functions\n"
|
||||
"\n"
|
||||
" Use code model based on co-recursive functions, where each DFA state is\n"
|
||||
" a separate function that may call other state-functions or itself.\n"
|
||||
"\n"
|
||||
" --reusable -r\n"
|
||||
"\n"
|
||||
" Deprecated since version 2.2 (reusable blocks are allowed by default\n"
|
||||
" now).\n"
|
||||
"\n"
|
||||
" --skeleton -S\n"
|
||||
"\n"
|
||||
" Ignore user-defined interface code and generate a self-contained\n"
|
||||
" \"skeleton\" program. Additionally, generate input files with strings\n"
|
||||
" derived from the regular grammar and compressed match results that are\n"
|
||||
" used to verify \"skeleton\" behavior on all inputs. This option is useful\n"
|
||||
" for finding bugs in optimizations and code generation. This option is\n"
|
||||
" supported only for C.\n"
|
||||
"\n"
|
||||
" --storable-state -f\n"
|
||||
"\n"
|
||||
" Generate a lexer which can store its inner state. This is useful in\n"
|
||||
" push-model lexers which are stopped by an outer program when there is\n"
|
||||
" not enough input, and then resumed when more input becomes available.\n"
|
||||
" In this mode users should additionally define YYGETSTATE and YYSETSTATE\n"
|
||||
" primitives, and variables yych, yyaccept and state should be part of\n"
|
||||
" the stored lexer state.\n"
|
||||
"\n"
|
||||
" --syntax FILE\n"
|
||||
"\n"
|
||||
" Load configurations from the specified FILE and apply them on top of\n"
|
||||
" the default syntax file. Note that FILE can define only a few\n"
|
||||
" configurations (if it's used to amend the default syntax file), or it\n"
|
||||
" can define a whole new language backend (in the latter case it is\n"
|
||||
" recommended to use --lang none option).\n"
|
||||
"\n"
|
||||
" --tags -T\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with tags.\n"
|
||||
"\n"
|
||||
" --ucs2 --wide-chars -w\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UCS2-encoded input. re2hs assumes that the\n"
|
||||
" character range is 0 -- 0xFFFF and character size is 2 bytes. This\n"
|
||||
" option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --utf8 --utf-8 -8\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads input in UTF-8 encoding. re2hs assumes that\n"
|
||||
" the character range is 0 -- 0x10FFFF and character size is 1 byte.\n"
|
||||
"\n"
|
||||
" --utf16 --utf-16 -x\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UTF16-encoded input. re2hs assumes that the\n"
|
||||
" character range is 0 -- 0x10FFFF and character size is 2 bytes. This\n"
|
||||
" option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --utf32 --unicode -u\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UTF32-encoded input. re2hs assumes that the\n"
|
||||
" character range is 0 -- 0x10FFFF and character size is 4 bytes. This\n"
|
||||
" option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --verbose\n"
|
||||
"\n"
|
||||
" Output a short message in case of success.\n"
|
||||
"\n"
|
||||
" --vernum -V\n"
|
||||
"\n"
|
||||
" Show version information in MMmmpp format (major, minor, patch).\n"
|
||||
"\n"
|
||||
" --version -v\n"
|
||||
"\n"
|
||||
" Show version information.\n"
|
||||
"\n"
|
||||
" --single-pass -1\n"
|
||||
"\n"
|
||||
" Deprecated. Does nothing (single pass is the default now).\n"
|
||||
"\n"
|
||||
" --debug-output -d\n"
|
||||
"\n"
|
||||
" Emit YYDEBUG invocations in the generated code. This is useful to trace\n"
|
||||
" lexer execution.\n"
|
||||
"\n"
|
||||
" --dump-adfa\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after tunneling (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-cfg\n"
|
||||
"\n"
|
||||
" Debug option: output control flow graph of tag variables (in .dot\n"
|
||||
" format).\n"
|
||||
"\n"
|
||||
" --dump-closure-stats\n"
|
||||
"\n"
|
||||
" Debug option: output statistics on the number of states in closure.\n"
|
||||
"\n"
|
||||
" --dump-dfa-det\n"
|
||||
"\n"
|
||||
" Debug option: output DFA immediately after determinization (in .dot\n"
|
||||
" format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-min\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after minimization (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-tagopt\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after tag optimizations (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-tree\n"
|
||||
"\n"
|
||||
" Debug option: output DFA under construction with states represented as\n"
|
||||
" tag history trees (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-raw\n"
|
||||
"\n"
|
||||
" Debug option: output DFA under construction with expanded state-sets\n"
|
||||
" (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-interf\n"
|
||||
"\n"
|
||||
" Debug option: output interference table produced by liveness analysis\n"
|
||||
" of tag variables.\n"
|
||||
"\n"
|
||||
" --dump-nfa\n"
|
||||
"\n"
|
||||
" Debug option: output NFA (in .dot format).\n"
|
||||
"\n"
|
||||
" --emit-dot -D\n"
|
||||
"\n"
|
||||
" Instead of normal output generate lexer graph in .dot format. The\n"
|
||||
" output can be converted to an image with the help of Graphviz (e.g.\n"
|
||||
" something like dot -Tpng -odfa.png dfa.dot).\n"
|
||||
"\n"
|
||||
" --dfa-minimization <moore | table>\n"
|
||||
"\n"
|
||||
" Internal option: DFA minimization algorithm used by re2hs. The moore\n"
|
||||
" option is the Moore algorithm (it is the default). The table option is\n"
|
||||
" the \"table filling\" algorithm. Both algorithms should produce the same\n"
|
||||
" DFA up to states relabeling; table filling is simpler and much slower\n"
|
||||
" and serves as a reference implementation.\n"
|
||||
"\n"
|
||||
" --eager-skip\n"
|
||||
"\n"
|
||||
" Internal option: make the generated lexer advance the input position\n"
|
||||
" eagerly -- immediately after reading the input symbol. This changes the\n"
|
||||
" default behavior when the input position is advanced lazily -- after\n"
|
||||
" transition to the next state.\n"
|
||||
"\n"
|
||||
" --no-lookahead\n"
|
||||
"\n"
|
||||
" Internal option, deprecated. It used to enable TDFA(0) algorithm.\n"
|
||||
" Unlike TDFA(1), TDFA(0) algorithm does not use one-symbol lookahead. It\n"
|
||||
" applies register operations to the incoming transitions rather than the\n"
|
||||
" outgoing ones. Benchmarks showed that TDFA(0) algorithm is less\n"
|
||||
" efficient than TDFA(1).\n"
|
||||
"\n"
|
||||
" --no-optimize-tags\n"
|
||||
"\n"
|
||||
" Internal option: suppress optimization of tag variables (useful for\n"
|
||||
" debugging).\n"
|
||||
"\n"
|
||||
" --posix-closure <gor1 | gtop>\n"
|
||||
"\n"
|
||||
" Internal option: specify shortest-path algorithm used for the\n"
|
||||
" construction of epsilon-closure with POSIX disambiguation semantics:\n"
|
||||
" gor1 (the default) stands for Goldberg-Radzik algorithm, and gtop\n"
|
||||
" stands for \"global topological order\" algorithm.\n"
|
||||
"\n"
|
||||
" --posix-prectable <complex | naive>\n"
|
||||
"\n"
|
||||
" Internal option: specify the algorithm used to compute POSIX precedence\n"
|
||||
" table. The complex algorithm computes precedence table in one traversal\n"
|
||||
" of tag history tree and has quadratic complexity in the number of TNFA\n"
|
||||
" states; it is the default. The naive algorithm has worst-case cubic\n"
|
||||
" complexity in the number of TNFA states, but it is much simpler than\n"
|
||||
" complex and may be slightly faster in non-pathological cases.\n"
|
||||
"\n"
|
||||
" --stadfa\n"
|
||||
"\n"
|
||||
" Internal option, deprecated. It used to enable staDFA algorithm, which\n"
|
||||
" differs from TDFA in that register operations are placed in states\n"
|
||||
" rather than on transitions. Benchmarks showed that staDFA algorithm is\n"
|
||||
" less efficient than TDFA.\n"
|
||||
"\n"
|
||||
" --fixed-tags <none | toplevel | all>\n"
|
||||
"\n"
|
||||
" Internal option: specify whether the fixed-tag optimization should be\n"
|
||||
" applied to all tags (all), none of them (none), or only those in\n"
|
||||
" toplevel concatenation (toplevel). The default is all. \"Fixed\" tags are\n"
|
||||
" those that are located within a fixed distance to some other tag\n"
|
||||
" (called \"base\"). In such cases only the base tag needs to be tracked,\n"
|
||||
" and the value of the fixed tag can be computed as the value of the base\n"
|
||||
" tag plus a static offset. For tags that are under alternative or\n"
|
||||
" repetition it is also necessary to check if the base tag has a no-match\n"
|
||||
" value (in that case fixed tag should also be set to no-match,\n"
|
||||
" disregarding the offset). For tags in top-level concatenation the check\n"
|
||||
" is not needed, because they always match.\n"
|
||||
"\n"
|
||||
"WARNINGS\n"
|
||||
"\n"
|
||||
" -W\n"
|
||||
"\n"
|
||||
" Turn on all warnings.\n"
|
||||
"\n"
|
||||
" -Werror\n"
|
||||
"\n"
|
||||
" Turn warnings into errors. Note that this option alone doesn't turn on\n"
|
||||
" any warnings; it only affects those warnings that have been turned on\n"
|
||||
" so far or will be turned on later.\n"
|
||||
"\n"
|
||||
" -W<warning>\n"
|
||||
"\n"
|
||||
" Turn on warning.\n"
|
||||
"\n"
|
||||
" -Wno-<warning>\n"
|
||||
"\n"
|
||||
" Turn off warning.\n"
|
||||
"\n"
|
||||
" -Werror-<warning>\n"
|
||||
"\n"
|
||||
" Turn on warning and treat it as an error (this implies -W<warning>).\n"
|
||||
"\n"
|
||||
" -Wno-error-<warning>\n"
|
||||
"\n"
|
||||
" Don't treat this particular warning as an error. This doesn't turn off\n"
|
||||
" the warning itself.\n"
|
||||
"\n"
|
||||
" -Wcondition-order\n"
|
||||
"\n"
|
||||
" Warn if the generated program makes implicit assumptions about\n"
|
||||
" condition numbering. One should use either --header option or\n"
|
||||
" conditions block to generate a mapping of condition names to numbers\n"
|
||||
" and then use the autogenerated condition names.\n"
|
||||
"\n"
|
||||
" -Wempty-character-class\n"
|
||||
"\n"
|
||||
" Warn if a regular expression contains an empty character class. Trying\n"
|
||||
" to match an empty character class makes no sense: it should always\n"
|
||||
" fail. However, for backwards compatibility reasons re2hs permits empty\n"
|
||||
" character classes and treats them as empty strings. Use the --empty-\n"
|
||||
" class option to change the default behavior.\n"
|
||||
"\n"
|
||||
" -Wmatch-empty-string\n"
|
||||
"\n"
|
||||
" Warn if a rule is nullable (matches an empty string). If the lexer runs\n"
|
||||
" in a loop and the empty match is unintentional, the lexer may\n"
|
||||
" unexpectedly hang in an infinite loop.\n"
|
||||
"\n"
|
||||
" -Wswapped-range\n"
|
||||
"\n"
|
||||
" Warn if the lower bound of a range is greater than its upper bound. The\n"
|
||||
" default behavior is to silently swap the range bounds.\n"
|
||||
"\n"
|
||||
" -Wundefined-control-flow\n"
|
||||
"\n"
|
||||
" Warn if some input strings cause undefined control flow in the lexer\n"
|
||||
" (the faulty patterns are reported). This is a dangerous and common\n"
|
||||
" mistake. It can be easily fixed by adding the default rule * which has\n"
|
||||
" the lowest priority, matches any code unit, and always consumes a\n"
|
||||
" single code unit.\n"
|
||||
"\n"
|
||||
" -Wunreachable-rules\n"
|
||||
"\n"
|
||||
" Warn about rules that are shadowed by other rules and will never match.\n"
|
||||
"\n"
|
||||
" -Wuseless-escape\n"
|
||||
"\n"
|
||||
" Warn if a symbol is escaped when it shouldn't be. By default, re2hs\n"
|
||||
" silently ignores such escapes, but this may as well indicate a typo or\n"
|
||||
" an error in the escape sequence.\n"
|
||||
"\n"
|
||||
" -Wnondeterministic-tags\n"
|
||||
"\n"
|
||||
" Warn if a tag has n-th degree of nondeterminism, where n is greater\n"
|
||||
" than 1.\n"
|
||||
"\n"
|
||||
" -Wsentinel-in-midrule\n"
|
||||
"\n"
|
||||
" Warn if the sentinel symbol occurs in the middle of a rule --- this may\n"
|
||||
" cause reads past the end of buffer, crashes or memory corruption in the\n"
|
||||
" generated lexer. This warning is only applicable if the sentinel method\n"
|
||||
" of checking for the end of input is used. It is set to an error if\n"
|
||||
" re2c:sentinel configuration is used.\n"
|
||||
"\n"
|
||||
" -Wundefined-syntax-config\n"
|
||||
"\n"
|
||||
" Warn if the syntax file specified with --syntax option is missing\n"
|
||||
" definitions of some configurations. This helps to maintain user-defined\n"
|
||||
" syntax files: if a new release adds configurations, old syntax file\n"
|
||||
" will raise a warning, and the user will be notified. If some\n"
|
||||
" configurations are unused and do not need a definition, they should be\n"
|
||||
" explicitly set to <undefined>.\n"
|
||||
;
|
||||
@@ -0,0 +1,514 @@
|
||||
extern const char* help;
|
||||
const char* help =
|
||||
"USAGE\n"
|
||||
"\n"
|
||||
" re2java [ OPTIONS ] [ WARNINGS ] INPUT\n"
|
||||
"\n"
|
||||
" Input can be either a file or - for stdin.\n"
|
||||
"\n"
|
||||
"OPTIONS\n"
|
||||
"\n"
|
||||
" -? --help -h\n"
|
||||
"\n"
|
||||
" Show help message.\n"
|
||||
"\n"
|
||||
" --api <simple | record | generic>\n"
|
||||
"\n"
|
||||
" Specify the API used by the generated code to interface with used-\n"
|
||||
" defined code. Option simple shold be used in simple cases when there's\n"
|
||||
" no need for buffer refilling and storing lexer state. Option record\n"
|
||||
" should be used when lexer state needs to be stored in a record (struct,\n"
|
||||
" class, etc.). Option generic should be used in complex cases when the\n"
|
||||
" other two APIs are not flexible enough.\n"
|
||||
"\n"
|
||||
" --bit-vectors -b\n"
|
||||
"\n"
|
||||
" Optimize conditional jumps using bit masks. This option implies\n"
|
||||
" --nested-ifs.\n"
|
||||
"\n"
|
||||
" --captures, --leftmost-captures\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with leftmost greedy capturing groups. The\n"
|
||||
" result is collected into an array yybmatch of capacity 2 * YYMAXNMATCH,\n"
|
||||
" and yynmatch is set to the number of groups for the matching rule.\n"
|
||||
"\n"
|
||||
" --captvars, --leftmost-captvars\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with leftmost greedy capturing groups. The\n"
|
||||
" result is collected into variables yytl<k>, yytr<k> for k-th capturing\n"
|
||||
" group.\n"
|
||||
"\n"
|
||||
" --case-insensitive\n"
|
||||
"\n"
|
||||
" Treat single-quoted and double-quoted strings as case-insensitive.\n"
|
||||
"\n"
|
||||
" --case-inverted\n"
|
||||
"\n"
|
||||
" Invert the meaning of single-quoted and double-quoted strings: treat\n"
|
||||
" single-quoted strings as case-sensitive and double-quoted strings as\n"
|
||||
" case-insensitive.\n"
|
||||
"\n"
|
||||
" --case-ranges\n"
|
||||
"\n"
|
||||
" Collapse consecutive cases in a switch statements into a range of the\n"
|
||||
" form low ... high. This syntax is a C/C++ language extension that is\n"
|
||||
" supported by compilers like GCC, Clang and Tcc. The main advantage over\n"
|
||||
" using single cases is smaller generated code and faster generation\n"
|
||||
" time, although for some compilers like Tcc it also results in smaller\n"
|
||||
" binary size. This option is supported only for C.\n"
|
||||
"\n"
|
||||
" --computed-gotos -g\n"
|
||||
"\n"
|
||||
" Optimize conditional jumps using non-standard \"computed goto\" extension\n"
|
||||
" (which must be supported by the compiler). re2java generates jump\n"
|
||||
" tables only in complex cases with a lot of conditional branches.\n"
|
||||
" Complexity threshold can be configured with cgoto:threshold\n"
|
||||
" configuration. This option implies --bit-vectors. It is supported only\n"
|
||||
" for C.\n"
|
||||
"\n"
|
||||
" --conditions --start-conditions -c\n"
|
||||
"\n"
|
||||
" Enable support of Flex-like \"conditions\": multiple interrelated lexers\n"
|
||||
" within one block. This is an alternative to manually specifying\n"
|
||||
" different re2java blocks connected with goto or function calls.\n"
|
||||
"\n"
|
||||
" --depfile FILE\n"
|
||||
"\n"
|
||||
" Write dependency information to FILE in the form of a Makefile rule\n"
|
||||
" <output-file> : <input-file> [include-file ...]. This allows one to\n"
|
||||
" track build dependencies in the presence of include blocks/directives,\n"
|
||||
" so that updating include files triggers regeneration of the output\n"
|
||||
" file. This option depends on the --output option.\n"
|
||||
"\n"
|
||||
" --ebcdic --ecb -e\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads input in EBCDIC encoding. re2java assumes\n"
|
||||
" that the character range is 0 -- 0xFF and character size is 1 byte.\n"
|
||||
"\n"
|
||||
" --empty-class <match-empty | match-none | error>\n"
|
||||
"\n"
|
||||
" Define the way re2java treats empty character classes. With match-empty\n"
|
||||
" (the default) empty class matches empty input (which is illogical, but\n"
|
||||
" backwards-compatible). With match-none empty class always fails to\n"
|
||||
" match. With error empty class raises a compilation error.\n"
|
||||
"\n"
|
||||
" --encoding-policy <fail | substitute | ignore>\n"
|
||||
"\n"
|
||||
" Define the way re2java treats Unicode surrogates. With fail re2java\n"
|
||||
" aborts with an error when a surrogate is encountered. With substitute\n"
|
||||
" re2java silently replaces surrogates with the error code point 0xFFFD.\n"
|
||||
" With ignore (the default) re2java treats surrogates as normal code\n"
|
||||
" points. The Unicode standard says that standalone surrogates are\n"
|
||||
" invalid, but real-world libraries and programs behave in different\n"
|
||||
" ways.\n"
|
||||
"\n"
|
||||
" --flex-syntax -F\n"
|
||||
"\n"
|
||||
" Partial support for Flex syntax: in this mode named definitions don't\n"
|
||||
" need the equal sign and the terminating semicolon, and when used they\n"
|
||||
" must be surrounded with curly braces. Names without curly braces are\n"
|
||||
" treated as double-quoted strings.\n"
|
||||
"\n"
|
||||
" --goto-label\n"
|
||||
"\n"
|
||||
" Use \"goto/label\" code model: encode DFA in form of labeled code blocks\n"
|
||||
" connected with goto transitions across blocks. This is only supported\n"
|
||||
" for languages that have a goto statement.\n"
|
||||
"\n"
|
||||
" --header --type-header -t HEADER\n"
|
||||
"\n"
|
||||
" Generate a HEADER file. The contents of the file can be specified using\n"
|
||||
" special blocks header:on and header:off. If conditions are used, the\n"
|
||||
" generated header will have a condition enum automatically appended to\n"
|
||||
" it (unless there is an explicit conditions block).\n"
|
||||
"\n"
|
||||
" -I PATH\n"
|
||||
"\n"
|
||||
" Add PATH to the list of locations which are used when searching for\n"
|
||||
" include files. This option is useful in combination with include block\n"
|
||||
" or directive. re2java looks for FILE in the directory of the parent\n"
|
||||
" file and in the include locations specified with -I option.\n"
|
||||
"\n"
|
||||
" --input <default | custom>\n"
|
||||
"\n"
|
||||
" Deprecated alias for --api. Option default corresponds to simple (it is\n"
|
||||
" indeed the default for most backends, but not for all). Option custom\n"
|
||||
" corresponds to generic.\n"
|
||||
"\n"
|
||||
" --input-encoding <ascii | utf8>\n"
|
||||
"\n"
|
||||
" Specify the way re2java parses regular expressions. With ascii (the\n"
|
||||
" default) re2java handles input as ASCII-encoded: any sequence of code\n"
|
||||
" units is a sequence of standalone 1-byte characters. With utf8 re2java\n"
|
||||
" handles input as UTF8-encoded and recognizes multibyte characters.\n"
|
||||
"\n"
|
||||
" --invert-captures\n"
|
||||
"\n"
|
||||
" Invert the meaning of capturing and non-capturing groups. By default\n"
|
||||
" (...) is capturing and (! ...) is non-capturing. With this option (!\n"
|
||||
" ...) is capturing and (...) is non-capturing.\n"
|
||||
"\n"
|
||||
" --lang <none | c | d | go | haskell | java | js | ocaml | python | rust | v\n"
|
||||
" | zig>\n"
|
||||
"\n"
|
||||
" Specify the target language. Supported languages are C, D, Go, Haskell,\n"
|
||||
" Java, JS, OCaml, Python, Rust, V, Zig (more languages can be added via\n"
|
||||
" user-defined syntax files, see the --syntax option). Option none\n"
|
||||
" disables default suntax configs, so that the target language is\n"
|
||||
" undefined.\n"
|
||||
"\n"
|
||||
" --location-format <gnu | msvc>\n"
|
||||
"\n"
|
||||
" Specify location format in messages. With gnu locations are printed as\n"
|
||||
" 'filename:line:column: ...'. With msvc locations are printed as\n"
|
||||
" 'filename(line,column) ...'. The default is gnu.\n"
|
||||
"\n"
|
||||
" --loop-switch\n"
|
||||
"\n"
|
||||
" Use \"loop/switch\" code model: encode DFA in form of a loop over a\n"
|
||||
" switch statement, where individual states are switch cases. State is\n"
|
||||
" stored in a variable yystate. Transitions between states update yystate\n"
|
||||
" to the case label of the destination state and continue execution to\n"
|
||||
" the head of the loop.\n"
|
||||
"\n"
|
||||
" --nested-ifs -s\n"
|
||||
"\n"
|
||||
" Use nested if statements instead of switch statements in conditional\n"
|
||||
" jumps. This usually results in more efficient code with non-optimizing\n"
|
||||
" compilers.\n"
|
||||
"\n"
|
||||
" --no-debug-info -i\n"
|
||||
"\n"
|
||||
" Do not output line directives. This may be useful when the generated\n"
|
||||
" code is stored in a version control system (to avoid huge autogenerated\n"
|
||||
" diffs on small changes).\n"
|
||||
"\n"
|
||||
" --no-generation-date\n"
|
||||
"\n"
|
||||
" Suppress date output in the generated file.\n"
|
||||
"\n"
|
||||
" --no-version\n"
|
||||
"\n"
|
||||
" Suppress version output in the generated file.\n"
|
||||
"\n"
|
||||
" --no-unsafe\n"
|
||||
"\n"
|
||||
" Do not generate unsafe wrapper over YYPEEK (this option is specific to\n"
|
||||
" Rust). For performance reasons YYPEEK should avoid bounds-checking, as\n"
|
||||
" the lexer already performs end-of-input checks in a more efficient way.\n"
|
||||
" The user may choose to provide a safe YYPEEK definition, or a\n"
|
||||
" definition that is unsafe only in release builds, in which case the\n"
|
||||
" --no-unsafe option helps to avoid warnings about redundant unsafe\n"
|
||||
" blocks.\n"
|
||||
"\n"
|
||||
" --output -o OUTPUT\n"
|
||||
"\n"
|
||||
" Specify the OUTPUT file.\n"
|
||||
"\n"
|
||||
" --posix-captures, -P\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with POSIX-style capturing groups. The\n"
|
||||
" result is collected into an array yybmatch of capacity 2 * YYMAXNMATCH,\n"
|
||||
" and yynmatch is set to the number of groups for the matching rule.\n"
|
||||
"\n"
|
||||
" --posix-captvars\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with POSIX-style capturing groups. The\n"
|
||||
" result is collected into variables yytl<k>, yytr<k> for k-th capturing\n"
|
||||
" group.\n"
|
||||
"\n"
|
||||
" --recursive-functions\n"
|
||||
"\n"
|
||||
" Use code model based on co-recursive functions, where each DFA state is\n"
|
||||
" a separate function that may call other state-functions or itself.\n"
|
||||
"\n"
|
||||
" --reusable -r\n"
|
||||
"\n"
|
||||
" Deprecated since version 2.2 (reusable blocks are allowed by default\n"
|
||||
" now).\n"
|
||||
"\n"
|
||||
" --skeleton -S\n"
|
||||
"\n"
|
||||
" Ignore user-defined interface code and generate a self-contained\n"
|
||||
" \"skeleton\" program. Additionally, generate input files with strings\n"
|
||||
" derived from the regular grammar and compressed match results that are\n"
|
||||
" used to verify \"skeleton\" behavior on all inputs. This option is useful\n"
|
||||
" for finding bugs in optimizations and code generation. This option is\n"
|
||||
" supported only for C.\n"
|
||||
"\n"
|
||||
" --storable-state -f\n"
|
||||
"\n"
|
||||
" Generate a lexer which can store its inner state. This is useful in\n"
|
||||
" push-model lexers which are stopped by an outer program when there is\n"
|
||||
" not enough input, and then resumed when more input becomes available.\n"
|
||||
" In this mode users should additionally define YYGETSTATE and YYSETSTATE\n"
|
||||
" primitives, and variables yych, yyaccept and state should be part of\n"
|
||||
" the stored lexer state.\n"
|
||||
"\n"
|
||||
" --syntax FILE\n"
|
||||
"\n"
|
||||
" Load configurations from the specified FILE and apply them on top of\n"
|
||||
" the default syntax file. Note that FILE can define only a few\n"
|
||||
" configurations (if it's used to amend the default syntax file), or it\n"
|
||||
" can define a whole new language backend (in the latter case it is\n"
|
||||
" recommended to use --lang none option).\n"
|
||||
"\n"
|
||||
" --tags -T\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with tags.\n"
|
||||
"\n"
|
||||
" --ucs2 --wide-chars -w\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UCS2-encoded input. re2java assumes that\n"
|
||||
" the character range is 0 -- 0xFFFF and character size is 2 bytes. This\n"
|
||||
" option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --utf8 --utf-8 -8\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads input in UTF-8 encoding. re2java assumes\n"
|
||||
" that the character range is 0 -- 0x10FFFF and character size is 1 byte.\n"
|
||||
"\n"
|
||||
" --utf16 --utf-16 -x\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UTF16-encoded input. re2java assumes that\n"
|
||||
" the character range is 0 -- 0x10FFFF and character size is 2 bytes.\n"
|
||||
" This option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --utf32 --unicode -u\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UTF32-encoded input. re2java assumes that\n"
|
||||
" the character range is 0 -- 0x10FFFF and character size is 4 bytes.\n"
|
||||
" This option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --verbose\n"
|
||||
"\n"
|
||||
" Output a short message in case of success.\n"
|
||||
"\n"
|
||||
" --vernum -V\n"
|
||||
"\n"
|
||||
" Show version information in MMmmpp format (major, minor, patch).\n"
|
||||
"\n"
|
||||
" --version -v\n"
|
||||
"\n"
|
||||
" Show version information.\n"
|
||||
"\n"
|
||||
" --single-pass -1\n"
|
||||
"\n"
|
||||
" Deprecated. Does nothing (single pass is the default now).\n"
|
||||
"\n"
|
||||
" --debug-output -d\n"
|
||||
"\n"
|
||||
" Emit YYDEBUG invocations in the generated code. This is useful to trace\n"
|
||||
" lexer execution.\n"
|
||||
"\n"
|
||||
" --dump-adfa\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after tunneling (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-cfg\n"
|
||||
"\n"
|
||||
" Debug option: output control flow graph of tag variables (in .dot\n"
|
||||
" format).\n"
|
||||
"\n"
|
||||
" --dump-closure-stats\n"
|
||||
"\n"
|
||||
" Debug option: output statistics on the number of states in closure.\n"
|
||||
"\n"
|
||||
" --dump-dfa-det\n"
|
||||
"\n"
|
||||
" Debug option: output DFA immediately after determinization (in .dot\n"
|
||||
" format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-min\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after minimization (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-tagopt\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after tag optimizations (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-tree\n"
|
||||
"\n"
|
||||
" Debug option: output DFA under construction with states represented as\n"
|
||||
" tag history trees (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-raw\n"
|
||||
"\n"
|
||||
" Debug option: output DFA under construction with expanded state-sets\n"
|
||||
" (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-interf\n"
|
||||
"\n"
|
||||
" Debug option: output interference table produced by liveness analysis\n"
|
||||
" of tag variables.\n"
|
||||
"\n"
|
||||
" --dump-nfa\n"
|
||||
"\n"
|
||||
" Debug option: output NFA (in .dot format).\n"
|
||||
"\n"
|
||||
" --emit-dot -D\n"
|
||||
"\n"
|
||||
" Instead of normal output generate lexer graph in .dot format. The\n"
|
||||
" output can be converted to an image with the help of Graphviz (e.g.\n"
|
||||
" something like dot -Tpng -odfa.png dfa.dot).\n"
|
||||
"\n"
|
||||
" --dfa-minimization <moore | table>\n"
|
||||
"\n"
|
||||
" Internal option: DFA minimization algorithm used by re2java. The moore\n"
|
||||
" option is the Moore algorithm (it is the default). The table option is\n"
|
||||
" the \"table filling\" algorithm. Both algorithms should produce the same\n"
|
||||
" DFA up to states relabeling; table filling is simpler and much slower\n"
|
||||
" and serves as a reference implementation.\n"
|
||||
"\n"
|
||||
" --eager-skip\n"
|
||||
"\n"
|
||||
" Internal option: make the generated lexer advance the input position\n"
|
||||
" eagerly -- immediately after reading the input symbol. This changes the\n"
|
||||
" default behavior when the input position is advanced lazily -- after\n"
|
||||
" transition to the next state.\n"
|
||||
"\n"
|
||||
" --no-lookahead\n"
|
||||
"\n"
|
||||
" Internal option, deprecated. It used to enable TDFA(0) algorithm.\n"
|
||||
" Unlike TDFA(1), TDFA(0) algorithm does not use one-symbol lookahead. It\n"
|
||||
" applies register operations to the incoming transitions rather than the\n"
|
||||
" outgoing ones. Benchmarks showed that TDFA(0) algorithm is less\n"
|
||||
" efficient than TDFA(1).\n"
|
||||
"\n"
|
||||
" --no-optimize-tags\n"
|
||||
"\n"
|
||||
" Internal option: suppress optimization of tag variables (useful for\n"
|
||||
" debugging).\n"
|
||||
"\n"
|
||||
" --posix-closure <gor1 | gtop>\n"
|
||||
"\n"
|
||||
" Internal option: specify shortest-path algorithm used for the\n"
|
||||
" construction of epsilon-closure with POSIX disambiguation semantics:\n"
|
||||
" gor1 (the default) stands for Goldberg-Radzik algorithm, and gtop\n"
|
||||
" stands for \"global topological order\" algorithm.\n"
|
||||
"\n"
|
||||
" --posix-prectable <complex | naive>\n"
|
||||
"\n"
|
||||
" Internal option: specify the algorithm used to compute POSIX precedence\n"
|
||||
" table. The complex algorithm computes precedence table in one traversal\n"
|
||||
" of tag history tree and has quadratic complexity in the number of TNFA\n"
|
||||
" states; it is the default. The naive algorithm has worst-case cubic\n"
|
||||
" complexity in the number of TNFA states, but it is much simpler than\n"
|
||||
" complex and may be slightly faster in non-pathological cases.\n"
|
||||
"\n"
|
||||
" --stadfa\n"
|
||||
"\n"
|
||||
" Internal option, deprecated. It used to enable staDFA algorithm, which\n"
|
||||
" differs from TDFA in that register operations are placed in states\n"
|
||||
" rather than on transitions. Benchmarks showed that staDFA algorithm is\n"
|
||||
" less efficient than TDFA.\n"
|
||||
"\n"
|
||||
" --fixed-tags <none | toplevel | all>\n"
|
||||
"\n"
|
||||
" Internal option: specify whether the fixed-tag optimization should be\n"
|
||||
" applied to all tags (all), none of them (none), or only those in\n"
|
||||
" toplevel concatenation (toplevel). The default is all. \"Fixed\" tags are\n"
|
||||
" those that are located within a fixed distance to some other tag\n"
|
||||
" (called \"base\"). In such cases only the base tag needs to be tracked,\n"
|
||||
" and the value of the fixed tag can be computed as the value of the base\n"
|
||||
" tag plus a static offset. For tags that are under alternative or\n"
|
||||
" repetition it is also necessary to check if the base tag has a no-match\n"
|
||||
" value (in that case fixed tag should also be set to no-match,\n"
|
||||
" disregarding the offset). For tags in top-level concatenation the check\n"
|
||||
" is not needed, because they always match.\n"
|
||||
"\n"
|
||||
"WARNINGS\n"
|
||||
"\n"
|
||||
" -W\n"
|
||||
"\n"
|
||||
" Turn on all warnings.\n"
|
||||
"\n"
|
||||
" -Werror\n"
|
||||
"\n"
|
||||
" Turn warnings into errors. Note that this option alone doesn't turn on\n"
|
||||
" any warnings; it only affects those warnings that have been turned on\n"
|
||||
" so far or will be turned on later.\n"
|
||||
"\n"
|
||||
" -W<warning>\n"
|
||||
"\n"
|
||||
" Turn on warning.\n"
|
||||
"\n"
|
||||
" -Wno-<warning>\n"
|
||||
"\n"
|
||||
" Turn off warning.\n"
|
||||
"\n"
|
||||
" -Werror-<warning>\n"
|
||||
"\n"
|
||||
" Turn on warning and treat it as an error (this implies -W<warning>).\n"
|
||||
"\n"
|
||||
" -Wno-error-<warning>\n"
|
||||
"\n"
|
||||
" Don't treat this particular warning as an error. This doesn't turn off\n"
|
||||
" the warning itself.\n"
|
||||
"\n"
|
||||
" -Wcondition-order\n"
|
||||
"\n"
|
||||
" Warn if the generated program makes implicit assumptions about\n"
|
||||
" condition numbering. One should use either --header option or\n"
|
||||
" conditions block to generate a mapping of condition names to numbers\n"
|
||||
" and then use the autogenerated condition names.\n"
|
||||
"\n"
|
||||
" -Wempty-character-class\n"
|
||||
"\n"
|
||||
" Warn if a regular expression contains an empty character class. Trying\n"
|
||||
" to match an empty character class makes no sense: it should always\n"
|
||||
" fail. However, for backwards compatibility reasons re2java permits\n"
|
||||
" empty character classes and treats them as empty strings. Use the\n"
|
||||
" --empty-class option to change the default behavior.\n"
|
||||
"\n"
|
||||
" -Wmatch-empty-string\n"
|
||||
"\n"
|
||||
" Warn if a rule is nullable (matches an empty string). If the lexer runs\n"
|
||||
" in a loop and the empty match is unintentional, the lexer may\n"
|
||||
" unexpectedly hang in an infinite loop.\n"
|
||||
"\n"
|
||||
" -Wswapped-range\n"
|
||||
"\n"
|
||||
" Warn if the lower bound of a range is greater than its upper bound. The\n"
|
||||
" default behavior is to silently swap the range bounds.\n"
|
||||
"\n"
|
||||
" -Wundefined-control-flow\n"
|
||||
"\n"
|
||||
" Warn if some input strings cause undefined control flow in the lexer\n"
|
||||
" (the faulty patterns are reported). This is a dangerous and common\n"
|
||||
" mistake. It can be easily fixed by adding the default rule * which has\n"
|
||||
" the lowest priority, matches any code unit, and always consumes a\n"
|
||||
" single code unit.\n"
|
||||
"\n"
|
||||
" -Wunreachable-rules\n"
|
||||
"\n"
|
||||
" Warn about rules that are shadowed by other rules and will never match.\n"
|
||||
"\n"
|
||||
" -Wuseless-escape\n"
|
||||
"\n"
|
||||
" Warn if a symbol is escaped when it shouldn't be. By default, re2java\n"
|
||||
" silently ignores such escapes, but this may as well indicate a typo or\n"
|
||||
" an error in the escape sequence.\n"
|
||||
"\n"
|
||||
" -Wnondeterministic-tags\n"
|
||||
"\n"
|
||||
" Warn if a tag has n-th degree of nondeterminism, where n is greater\n"
|
||||
" than 1.\n"
|
||||
"\n"
|
||||
" -Wsentinel-in-midrule\n"
|
||||
"\n"
|
||||
" Warn if the sentinel symbol occurs in the middle of a rule --- this may\n"
|
||||
" cause reads past the end of buffer, crashes or memory corruption in the\n"
|
||||
" generated lexer. This warning is only applicable if the sentinel method\n"
|
||||
" of checking for the end of input is used. It is set to an error if\n"
|
||||
" re2c:sentinel configuration is used.\n"
|
||||
"\n"
|
||||
" -Wundefined-syntax-config\n"
|
||||
"\n"
|
||||
" Warn if the syntax file specified with --syntax option is missing\n"
|
||||
" definitions of some configurations. This helps to maintain user-defined\n"
|
||||
" syntax files: if a new release adds configurations, old syntax file\n"
|
||||
" will raise a warning, and the user will be notified. If some\n"
|
||||
" configurations are unused and do not need a definition, they should be\n"
|
||||
" explicitly set to <undefined>.\n"
|
||||
;
|
||||
@@ -0,0 +1,512 @@
|
||||
extern const char* help;
|
||||
const char* help =
|
||||
"USAGE\n"
|
||||
"\n"
|
||||
" re2js [ OPTIONS ] [ WARNINGS ] INPUT\n"
|
||||
"\n"
|
||||
" Input can be either a file or - for stdin.\n"
|
||||
"\n"
|
||||
"OPTIONS\n"
|
||||
"\n"
|
||||
" -? --help -h\n"
|
||||
"\n"
|
||||
" Show help message.\n"
|
||||
"\n"
|
||||
" --api <simple | record | generic>\n"
|
||||
"\n"
|
||||
" Specify the API used by the generated code to interface with used-\n"
|
||||
" defined code. Option simple shold be used in simple cases when there's\n"
|
||||
" no need for buffer refilling and storing lexer state. Option record\n"
|
||||
" should be used when lexer state needs to be stored in a record (struct,\n"
|
||||
" class, etc.). Option generic should be used in complex cases when the\n"
|
||||
" other two APIs are not flexible enough.\n"
|
||||
"\n"
|
||||
" --bit-vectors -b\n"
|
||||
"\n"
|
||||
" Optimize conditional jumps using bit masks. This option implies\n"
|
||||
" --nested-ifs.\n"
|
||||
"\n"
|
||||
" --captures, --leftmost-captures\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with leftmost greedy capturing groups. The\n"
|
||||
" result is collected into an array yybmatch of capacity 2 * YYMAXNMATCH,\n"
|
||||
" and yynmatch is set to the number of groups for the matching rule.\n"
|
||||
"\n"
|
||||
" --captvars, --leftmost-captvars\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with leftmost greedy capturing groups. The\n"
|
||||
" result is collected into variables yytl<k>, yytr<k> for k-th capturing\n"
|
||||
" group.\n"
|
||||
"\n"
|
||||
" --case-insensitive\n"
|
||||
"\n"
|
||||
" Treat single-quoted and double-quoted strings as case-insensitive.\n"
|
||||
"\n"
|
||||
" --case-inverted\n"
|
||||
"\n"
|
||||
" Invert the meaning of single-quoted and double-quoted strings: treat\n"
|
||||
" single-quoted strings as case-sensitive and double-quoted strings as\n"
|
||||
" case-insensitive.\n"
|
||||
"\n"
|
||||
" --case-ranges\n"
|
||||
"\n"
|
||||
" Collapse consecutive cases in a switch statements into a range of the\n"
|
||||
" form low ... high. This syntax is a C/C++ language extension that is\n"
|
||||
" supported by compilers like GCC, Clang and Tcc. The main advantage over\n"
|
||||
" using single cases is smaller generated code and faster generation\n"
|
||||
" time, although for some compilers like Tcc it also results in smaller\n"
|
||||
" binary size. This option is supported only for C.\n"
|
||||
"\n"
|
||||
" --computed-gotos -g\n"
|
||||
"\n"
|
||||
" Optimize conditional jumps using non-standard \"computed goto\" extension\n"
|
||||
" (which must be supported by the compiler). re2js generates jump tables\n"
|
||||
" only in complex cases with a lot of conditional branches. Complexity\n"
|
||||
" threshold can be configured with cgoto:threshold configuration. This\n"
|
||||
" option implies --bit-vectors. It is supported only for C.\n"
|
||||
"\n"
|
||||
" --conditions --start-conditions -c\n"
|
||||
"\n"
|
||||
" Enable support of Flex-like \"conditions\": multiple interrelated lexers\n"
|
||||
" within one block. This is an alternative to manually specifying\n"
|
||||
" different re2js blocks connected with goto or function calls.\n"
|
||||
"\n"
|
||||
" --depfile FILE\n"
|
||||
"\n"
|
||||
" Write dependency information to FILE in the form of a Makefile rule\n"
|
||||
" <output-file> : <input-file> [include-file ...]. This allows one to\n"
|
||||
" track build dependencies in the presence of include blocks/directives,\n"
|
||||
" so that updating include files triggers regeneration of the output\n"
|
||||
" file. This option depends on the --output option.\n"
|
||||
"\n"
|
||||
" --ebcdic --ecb -e\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads input in EBCDIC encoding. re2js assumes\n"
|
||||
" that the character range is 0 -- 0xFF and character size is 1 byte.\n"
|
||||
"\n"
|
||||
" --empty-class <match-empty | match-none | error>\n"
|
||||
"\n"
|
||||
" Define the way re2js treats empty character classes. With match-empty\n"
|
||||
" (the default) empty class matches empty input (which is illogical, but\n"
|
||||
" backwards-compatible). With match-none empty class always fails to\n"
|
||||
" match. With error empty class raises a compilation error.\n"
|
||||
"\n"
|
||||
" --encoding-policy <fail | substitute | ignore>\n"
|
||||
"\n"
|
||||
" Define the way re2js treats Unicode surrogates. With fail re2js aborts\n"
|
||||
" with an error when a surrogate is encountered. With substitute re2js\n"
|
||||
" silently replaces surrogates with the error code point 0xFFFD. With\n"
|
||||
" ignore (the default) re2js treats surrogates as normal code points. The\n"
|
||||
" Unicode standard says that standalone surrogates are invalid, but real-\n"
|
||||
" world libraries and programs behave in different ways.\n"
|
||||
"\n"
|
||||
" --flex-syntax -F\n"
|
||||
"\n"
|
||||
" Partial support for Flex syntax: in this mode named definitions don't\n"
|
||||
" need the equal sign and the terminating semicolon, and when used they\n"
|
||||
" must be surrounded with curly braces. Names without curly braces are\n"
|
||||
" treated as double-quoted strings.\n"
|
||||
"\n"
|
||||
" --goto-label\n"
|
||||
"\n"
|
||||
" Use \"goto/label\" code model: encode DFA in form of labeled code blocks\n"
|
||||
" connected with goto transitions across blocks. This is only supported\n"
|
||||
" for languages that have a goto statement.\n"
|
||||
"\n"
|
||||
" --header --type-header -t HEADER\n"
|
||||
"\n"
|
||||
" Generate a HEADER file. The contents of the file can be specified using\n"
|
||||
" special blocks header:on and header:off. If conditions are used, the\n"
|
||||
" generated header will have a condition enum automatically appended to\n"
|
||||
" it (unless there is an explicit conditions block).\n"
|
||||
"\n"
|
||||
" -I PATH\n"
|
||||
"\n"
|
||||
" Add PATH to the list of locations which are used when searching for\n"
|
||||
" include files. This option is useful in combination with include block\n"
|
||||
" or directive. re2js looks for FILE in the directory of the parent file\n"
|
||||
" and in the include locations specified with -I option.\n"
|
||||
"\n"
|
||||
" --input <default | custom>\n"
|
||||
"\n"
|
||||
" Deprecated alias for --api. Option default corresponds to simple (it is\n"
|
||||
" indeed the default for most backends, but not for all). Option custom\n"
|
||||
" corresponds to generic.\n"
|
||||
"\n"
|
||||
" --input-encoding <ascii | utf8>\n"
|
||||
"\n"
|
||||
" Specify the way re2js parses regular expressions. With ascii (the\n"
|
||||
" default) re2js handles input as ASCII-encoded: any sequence of code\n"
|
||||
" units is a sequence of standalone 1-byte characters. With utf8 re2js\n"
|
||||
" handles input as UTF8-encoded and recognizes multibyte characters.\n"
|
||||
"\n"
|
||||
" --invert-captures\n"
|
||||
"\n"
|
||||
" Invert the meaning of capturing and non-capturing groups. By default\n"
|
||||
" (...) is capturing and (! ...) is non-capturing. With this option (!\n"
|
||||
" ...) is capturing and (...) is non-capturing.\n"
|
||||
"\n"
|
||||
" --lang <none | c | d | go | haskell | java | js | ocaml | python | rust | v\n"
|
||||
" | zig>\n"
|
||||
"\n"
|
||||
" Specify the target language. Supported languages are C, D, Go, Haskell,\n"
|
||||
" Java, JS, OCaml, Python, Rust, V, Zig (more languages can be added via\n"
|
||||
" user-defined syntax files, see the --syntax option). Option none\n"
|
||||
" disables default suntax configs, so that the target language is\n"
|
||||
" undefined.\n"
|
||||
"\n"
|
||||
" --location-format <gnu | msvc>\n"
|
||||
"\n"
|
||||
" Specify location format in messages. With gnu locations are printed as\n"
|
||||
" 'filename:line:column: ...'. With msvc locations are printed as\n"
|
||||
" 'filename(line,column) ...'. The default is gnu.\n"
|
||||
"\n"
|
||||
" --loop-switch\n"
|
||||
"\n"
|
||||
" Use \"loop/switch\" code model: encode DFA in form of a loop over a\n"
|
||||
" switch statement, where individual states are switch cases. State is\n"
|
||||
" stored in a variable yystate. Transitions between states update yystate\n"
|
||||
" to the case label of the destination state and continue execution to\n"
|
||||
" the head of the loop.\n"
|
||||
"\n"
|
||||
" --nested-ifs -s\n"
|
||||
"\n"
|
||||
" Use nested if statements instead of switch statements in conditional\n"
|
||||
" jumps. This usually results in more efficient code with non-optimizing\n"
|
||||
" compilers.\n"
|
||||
"\n"
|
||||
" --no-debug-info -i\n"
|
||||
"\n"
|
||||
" Do not output line directives. This may be useful when the generated\n"
|
||||
" code is stored in a version control system (to avoid huge autogenerated\n"
|
||||
" diffs on small changes).\n"
|
||||
"\n"
|
||||
" --no-generation-date\n"
|
||||
"\n"
|
||||
" Suppress date output in the generated file.\n"
|
||||
"\n"
|
||||
" --no-version\n"
|
||||
"\n"
|
||||
" Suppress version output in the generated file.\n"
|
||||
"\n"
|
||||
" --no-unsafe\n"
|
||||
"\n"
|
||||
" Do not generate unsafe wrapper over YYPEEK (this option is specific to\n"
|
||||
" Rust). For performance reasons YYPEEK should avoid bounds-checking, as\n"
|
||||
" the lexer already performs end-of-input checks in a more efficient way.\n"
|
||||
" The user may choose to provide a safe YYPEEK definition, or a\n"
|
||||
" definition that is unsafe only in release builds, in which case the\n"
|
||||
" --no-unsafe option helps to avoid warnings about redundant unsafe\n"
|
||||
" blocks.\n"
|
||||
"\n"
|
||||
" --output -o OUTPUT\n"
|
||||
"\n"
|
||||
" Specify the OUTPUT file.\n"
|
||||
"\n"
|
||||
" --posix-captures, -P\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with POSIX-style capturing groups. The\n"
|
||||
" result is collected into an array yybmatch of capacity 2 * YYMAXNMATCH,\n"
|
||||
" and yynmatch is set to the number of groups for the matching rule.\n"
|
||||
"\n"
|
||||
" --posix-captvars\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with POSIX-style capturing groups. The\n"
|
||||
" result is collected into variables yytl<k>, yytr<k> for k-th capturing\n"
|
||||
" group.\n"
|
||||
"\n"
|
||||
" --recursive-functions\n"
|
||||
"\n"
|
||||
" Use code model based on co-recursive functions, where each DFA state is\n"
|
||||
" a separate function that may call other state-functions or itself.\n"
|
||||
"\n"
|
||||
" --reusable -r\n"
|
||||
"\n"
|
||||
" Deprecated since version 2.2 (reusable blocks are allowed by default\n"
|
||||
" now).\n"
|
||||
"\n"
|
||||
" --skeleton -S\n"
|
||||
"\n"
|
||||
" Ignore user-defined interface code and generate a self-contained\n"
|
||||
" \"skeleton\" program. Additionally, generate input files with strings\n"
|
||||
" derived from the regular grammar and compressed match results that are\n"
|
||||
" used to verify \"skeleton\" behavior on all inputs. This option is useful\n"
|
||||
" for finding bugs in optimizations and code generation. This option is\n"
|
||||
" supported only for C.\n"
|
||||
"\n"
|
||||
" --storable-state -f\n"
|
||||
"\n"
|
||||
" Generate a lexer which can store its inner state. This is useful in\n"
|
||||
" push-model lexers which are stopped by an outer program when there is\n"
|
||||
" not enough input, and then resumed when more input becomes available.\n"
|
||||
" In this mode users should additionally define YYGETSTATE and YYSETSTATE\n"
|
||||
" primitives, and variables yych, yyaccept and state should be part of\n"
|
||||
" the stored lexer state.\n"
|
||||
"\n"
|
||||
" --syntax FILE\n"
|
||||
"\n"
|
||||
" Load configurations from the specified FILE and apply them on top of\n"
|
||||
" the default syntax file. Note that FILE can define only a few\n"
|
||||
" configurations (if it's used to amend the default syntax file), or it\n"
|
||||
" can define a whole new language backend (in the latter case it is\n"
|
||||
" recommended to use --lang none option).\n"
|
||||
"\n"
|
||||
" --tags -T\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with tags.\n"
|
||||
"\n"
|
||||
" --ucs2 --wide-chars -w\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UCS2-encoded input. re2js assumes that the\n"
|
||||
" character range is 0 -- 0xFFFF and character size is 2 bytes. This\n"
|
||||
" option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --utf8 --utf-8 -8\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads input in UTF-8 encoding. re2js assumes that\n"
|
||||
" the character range is 0 -- 0x10FFFF and character size is 1 byte.\n"
|
||||
"\n"
|
||||
" --utf16 --utf-16 -x\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UTF16-encoded input. re2js assumes that the\n"
|
||||
" character range is 0 -- 0x10FFFF and character size is 2 bytes. This\n"
|
||||
" option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --utf32 --unicode -u\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UTF32-encoded input. re2js assumes that the\n"
|
||||
" character range is 0 -- 0x10FFFF and character size is 4 bytes. This\n"
|
||||
" option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --verbose\n"
|
||||
"\n"
|
||||
" Output a short message in case of success.\n"
|
||||
"\n"
|
||||
" --vernum -V\n"
|
||||
"\n"
|
||||
" Show version information in MMmmpp format (major, minor, patch).\n"
|
||||
"\n"
|
||||
" --version -v\n"
|
||||
"\n"
|
||||
" Show version information.\n"
|
||||
"\n"
|
||||
" --single-pass -1\n"
|
||||
"\n"
|
||||
" Deprecated. Does nothing (single pass is the default now).\n"
|
||||
"\n"
|
||||
" --debug-output -d\n"
|
||||
"\n"
|
||||
" Emit YYDEBUG invocations in the generated code. This is useful to trace\n"
|
||||
" lexer execution.\n"
|
||||
"\n"
|
||||
" --dump-adfa\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after tunneling (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-cfg\n"
|
||||
"\n"
|
||||
" Debug option: output control flow graph of tag variables (in .dot\n"
|
||||
" format).\n"
|
||||
"\n"
|
||||
" --dump-closure-stats\n"
|
||||
"\n"
|
||||
" Debug option: output statistics on the number of states in closure.\n"
|
||||
"\n"
|
||||
" --dump-dfa-det\n"
|
||||
"\n"
|
||||
" Debug option: output DFA immediately after determinization (in .dot\n"
|
||||
" format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-min\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after minimization (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-tagopt\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after tag optimizations (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-tree\n"
|
||||
"\n"
|
||||
" Debug option: output DFA under construction with states represented as\n"
|
||||
" tag history trees (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-raw\n"
|
||||
"\n"
|
||||
" Debug option: output DFA under construction with expanded state-sets\n"
|
||||
" (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-interf\n"
|
||||
"\n"
|
||||
" Debug option: output interference table produced by liveness analysis\n"
|
||||
" of tag variables.\n"
|
||||
"\n"
|
||||
" --dump-nfa\n"
|
||||
"\n"
|
||||
" Debug option: output NFA (in .dot format).\n"
|
||||
"\n"
|
||||
" --emit-dot -D\n"
|
||||
"\n"
|
||||
" Instead of normal output generate lexer graph in .dot format. The\n"
|
||||
" output can be converted to an image with the help of Graphviz (e.g.\n"
|
||||
" something like dot -Tpng -odfa.png dfa.dot).\n"
|
||||
"\n"
|
||||
" --dfa-minimization <moore | table>\n"
|
||||
"\n"
|
||||
" Internal option: DFA minimization algorithm used by re2js. The moore\n"
|
||||
" option is the Moore algorithm (it is the default). The table option is\n"
|
||||
" the \"table filling\" algorithm. Both algorithms should produce the same\n"
|
||||
" DFA up to states relabeling; table filling is simpler and much slower\n"
|
||||
" and serves as a reference implementation.\n"
|
||||
"\n"
|
||||
" --eager-skip\n"
|
||||
"\n"
|
||||
" Internal option: make the generated lexer advance the input position\n"
|
||||
" eagerly -- immediately after reading the input symbol. This changes the\n"
|
||||
" default behavior when the input position is advanced lazily -- after\n"
|
||||
" transition to the next state.\n"
|
||||
"\n"
|
||||
" --no-lookahead\n"
|
||||
"\n"
|
||||
" Internal option, deprecated. It used to enable TDFA(0) algorithm.\n"
|
||||
" Unlike TDFA(1), TDFA(0) algorithm does not use one-symbol lookahead. It\n"
|
||||
" applies register operations to the incoming transitions rather than the\n"
|
||||
" outgoing ones. Benchmarks showed that TDFA(0) algorithm is less\n"
|
||||
" efficient than TDFA(1).\n"
|
||||
"\n"
|
||||
" --no-optimize-tags\n"
|
||||
"\n"
|
||||
" Internal option: suppress optimization of tag variables (useful for\n"
|
||||
" debugging).\n"
|
||||
"\n"
|
||||
" --posix-closure <gor1 | gtop>\n"
|
||||
"\n"
|
||||
" Internal option: specify shortest-path algorithm used for the\n"
|
||||
" construction of epsilon-closure with POSIX disambiguation semantics:\n"
|
||||
" gor1 (the default) stands for Goldberg-Radzik algorithm, and gtop\n"
|
||||
" stands for \"global topological order\" algorithm.\n"
|
||||
"\n"
|
||||
" --posix-prectable <complex | naive>\n"
|
||||
"\n"
|
||||
" Internal option: specify the algorithm used to compute POSIX precedence\n"
|
||||
" table. The complex algorithm computes precedence table in one traversal\n"
|
||||
" of tag history tree and has quadratic complexity in the number of TNFA\n"
|
||||
" states; it is the default. The naive algorithm has worst-case cubic\n"
|
||||
" complexity in the number of TNFA states, but it is much simpler than\n"
|
||||
" complex and may be slightly faster in non-pathological cases.\n"
|
||||
"\n"
|
||||
" --stadfa\n"
|
||||
"\n"
|
||||
" Internal option, deprecated. It used to enable staDFA algorithm, which\n"
|
||||
" differs from TDFA in that register operations are placed in states\n"
|
||||
" rather than on transitions. Benchmarks showed that staDFA algorithm is\n"
|
||||
" less efficient than TDFA.\n"
|
||||
"\n"
|
||||
" --fixed-tags <none | toplevel | all>\n"
|
||||
"\n"
|
||||
" Internal option: specify whether the fixed-tag optimization should be\n"
|
||||
" applied to all tags (all), none of them (none), or only those in\n"
|
||||
" toplevel concatenation (toplevel). The default is all. \"Fixed\" tags are\n"
|
||||
" those that are located within a fixed distance to some other tag\n"
|
||||
" (called \"base\"). In such cases only the base tag needs to be tracked,\n"
|
||||
" and the value of the fixed tag can be computed as the value of the base\n"
|
||||
" tag plus a static offset. For tags that are under alternative or\n"
|
||||
" repetition it is also necessary to check if the base tag has a no-match\n"
|
||||
" value (in that case fixed tag should also be set to no-match,\n"
|
||||
" disregarding the offset). For tags in top-level concatenation the check\n"
|
||||
" is not needed, because they always match.\n"
|
||||
"\n"
|
||||
"WARNINGS\n"
|
||||
"\n"
|
||||
" -W\n"
|
||||
"\n"
|
||||
" Turn on all warnings.\n"
|
||||
"\n"
|
||||
" -Werror\n"
|
||||
"\n"
|
||||
" Turn warnings into errors. Note that this option alone doesn't turn on\n"
|
||||
" any warnings; it only affects those warnings that have been turned on\n"
|
||||
" so far or will be turned on later.\n"
|
||||
"\n"
|
||||
" -W<warning>\n"
|
||||
"\n"
|
||||
" Turn on warning.\n"
|
||||
"\n"
|
||||
" -Wno-<warning>\n"
|
||||
"\n"
|
||||
" Turn off warning.\n"
|
||||
"\n"
|
||||
" -Werror-<warning>\n"
|
||||
"\n"
|
||||
" Turn on warning and treat it as an error (this implies -W<warning>).\n"
|
||||
"\n"
|
||||
" -Wno-error-<warning>\n"
|
||||
"\n"
|
||||
" Don't treat this particular warning as an error. This doesn't turn off\n"
|
||||
" the warning itself.\n"
|
||||
"\n"
|
||||
" -Wcondition-order\n"
|
||||
"\n"
|
||||
" Warn if the generated program makes implicit assumptions about\n"
|
||||
" condition numbering. One should use either --header option or\n"
|
||||
" conditions block to generate a mapping of condition names to numbers\n"
|
||||
" and then use the autogenerated condition names.\n"
|
||||
"\n"
|
||||
" -Wempty-character-class\n"
|
||||
"\n"
|
||||
" Warn if a regular expression contains an empty character class. Trying\n"
|
||||
" to match an empty character class makes no sense: it should always\n"
|
||||
" fail. However, for backwards compatibility reasons re2js permits empty\n"
|
||||
" character classes and treats them as empty strings. Use the --empty-\n"
|
||||
" class option to change the default behavior.\n"
|
||||
"\n"
|
||||
" -Wmatch-empty-string\n"
|
||||
"\n"
|
||||
" Warn if a rule is nullable (matches an empty string). If the lexer runs\n"
|
||||
" in a loop and the empty match is unintentional, the lexer may\n"
|
||||
" unexpectedly hang in an infinite loop.\n"
|
||||
"\n"
|
||||
" -Wswapped-range\n"
|
||||
"\n"
|
||||
" Warn if the lower bound of a range is greater than its upper bound. The\n"
|
||||
" default behavior is to silently swap the range bounds.\n"
|
||||
"\n"
|
||||
" -Wundefined-control-flow\n"
|
||||
"\n"
|
||||
" Warn if some input strings cause undefined control flow in the lexer\n"
|
||||
" (the faulty patterns are reported). This is a dangerous and common\n"
|
||||
" mistake. It can be easily fixed by adding the default rule * which has\n"
|
||||
" the lowest priority, matches any code unit, and always consumes a\n"
|
||||
" single code unit.\n"
|
||||
"\n"
|
||||
" -Wunreachable-rules\n"
|
||||
"\n"
|
||||
" Warn about rules that are shadowed by other rules and will never match.\n"
|
||||
"\n"
|
||||
" -Wuseless-escape\n"
|
||||
"\n"
|
||||
" Warn if a symbol is escaped when it shouldn't be. By default, re2js\n"
|
||||
" silently ignores such escapes, but this may as well indicate a typo or\n"
|
||||
" an error in the escape sequence.\n"
|
||||
"\n"
|
||||
" -Wnondeterministic-tags\n"
|
||||
"\n"
|
||||
" Warn if a tag has n-th degree of nondeterminism, where n is greater\n"
|
||||
" than 1.\n"
|
||||
"\n"
|
||||
" -Wsentinel-in-midrule\n"
|
||||
"\n"
|
||||
" Warn if the sentinel symbol occurs in the middle of a rule --- this may\n"
|
||||
" cause reads past the end of buffer, crashes or memory corruption in the\n"
|
||||
" generated lexer. This warning is only applicable if the sentinel method\n"
|
||||
" of checking for the end of input is used. It is set to an error if\n"
|
||||
" re2c:sentinel configuration is used.\n"
|
||||
"\n"
|
||||
" -Wundefined-syntax-config\n"
|
||||
"\n"
|
||||
" Warn if the syntax file specified with --syntax option is missing\n"
|
||||
" definitions of some configurations. This helps to maintain user-defined\n"
|
||||
" syntax files: if a new release adds configurations, old syntax file\n"
|
||||
" will raise a warning, and the user will be notified. If some\n"
|
||||
" configurations are unused and do not need a definition, they should be\n"
|
||||
" explicitly set to <undefined>.\n"
|
||||
;
|
||||
@@ -0,0 +1,515 @@
|
||||
extern const char* help;
|
||||
const char* help =
|
||||
"USAGE\n"
|
||||
"\n"
|
||||
" re2ocaml [ OPTIONS ] [ WARNINGS ] INPUT\n"
|
||||
"\n"
|
||||
" Input can be either a file or - for stdin.\n"
|
||||
"\n"
|
||||
"OPTIONS\n"
|
||||
"\n"
|
||||
" -? --help -h\n"
|
||||
"\n"
|
||||
" Show help message.\n"
|
||||
"\n"
|
||||
" --api <simple | record | generic>\n"
|
||||
"\n"
|
||||
" Specify the API used by the generated code to interface with used-\n"
|
||||
" defined code. Option simple shold be used in simple cases when there's\n"
|
||||
" no need for buffer refilling and storing lexer state. Option record\n"
|
||||
" should be used when lexer state needs to be stored in a record (struct,\n"
|
||||
" class, etc.). Option generic should be used in complex cases when the\n"
|
||||
" other two APIs are not flexible enough.\n"
|
||||
"\n"
|
||||
" --bit-vectors -b\n"
|
||||
"\n"
|
||||
" Optimize conditional jumps using bit masks. This option implies\n"
|
||||
" --nested-ifs.\n"
|
||||
"\n"
|
||||
" --captures, --leftmost-captures\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with leftmost greedy capturing groups. The\n"
|
||||
" result is collected into an array yybmatch of capacity 2 * YYMAXNMATCH,\n"
|
||||
" and yynmatch is set to the number of groups for the matching rule.\n"
|
||||
"\n"
|
||||
" --captvars, --leftmost-captvars\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with leftmost greedy capturing groups. The\n"
|
||||
" result is collected into variables yytl<k>, yytr<k> for k-th capturing\n"
|
||||
" group.\n"
|
||||
"\n"
|
||||
" --case-insensitive\n"
|
||||
"\n"
|
||||
" Treat single-quoted and double-quoted strings as case-insensitive.\n"
|
||||
"\n"
|
||||
" --case-inverted\n"
|
||||
"\n"
|
||||
" Invert the meaning of single-quoted and double-quoted strings: treat\n"
|
||||
" single-quoted strings as case-sensitive and double-quoted strings as\n"
|
||||
" case-insensitive.\n"
|
||||
"\n"
|
||||
" --case-ranges\n"
|
||||
"\n"
|
||||
" Collapse consecutive cases in a switch statements into a range of the\n"
|
||||
" form low ... high. This syntax is a C/C++ language extension that is\n"
|
||||
" supported by compilers like GCC, Clang and Tcc. The main advantage over\n"
|
||||
" using single cases is smaller generated code and faster generation\n"
|
||||
" time, although for some compilers like Tcc it also results in smaller\n"
|
||||
" binary size. This option is supported only for C.\n"
|
||||
"\n"
|
||||
" --computed-gotos -g\n"
|
||||
"\n"
|
||||
" Optimize conditional jumps using non-standard \"computed goto\" extension\n"
|
||||
" (which must be supported by the compiler). re2ocaml generates jump\n"
|
||||
" tables only in complex cases with a lot of conditional branches.\n"
|
||||
" Complexity threshold can be configured with cgoto:threshold\n"
|
||||
" configuration. This option implies --bit-vectors. It is supported only\n"
|
||||
" for C.\n"
|
||||
"\n"
|
||||
" --conditions --start-conditions -c\n"
|
||||
"\n"
|
||||
" Enable support of Flex-like \"conditions\": multiple interrelated lexers\n"
|
||||
" within one block. This is an alternative to manually specifying\n"
|
||||
" different re2ocaml blocks connected with goto or function calls.\n"
|
||||
"\n"
|
||||
" --depfile FILE\n"
|
||||
"\n"
|
||||
" Write dependency information to FILE in the form of a Makefile rule\n"
|
||||
" <output-file> : <input-file> [include-file ...]. This allows one to\n"
|
||||
" track build dependencies in the presence of include blocks/directives,\n"
|
||||
" so that updating include files triggers regeneration of the output\n"
|
||||
" file. This option depends on the --output option.\n"
|
||||
"\n"
|
||||
" --ebcdic --ecb -e\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads input in EBCDIC encoding. re2ocaml assumes\n"
|
||||
" that the character range is 0 -- 0xFF and character size is 1 byte.\n"
|
||||
"\n"
|
||||
" --empty-class <match-empty | match-none | error>\n"
|
||||
"\n"
|
||||
" Define the way re2ocaml treats empty character classes. With match-\n"
|
||||
" empty (the default) empty class matches empty input (which is\n"
|
||||
" illogical, but backwards-compatible). With match-none empty class\n"
|
||||
" always fails to match. With error empty class raises a compilation\n"
|
||||
" error.\n"
|
||||
"\n"
|
||||
" --encoding-policy <fail | substitute | ignore>\n"
|
||||
"\n"
|
||||
" Define the way re2ocaml treats Unicode surrogates. With fail re2ocaml\n"
|
||||
" aborts with an error when a surrogate is encountered. With substitute\n"
|
||||
" re2ocaml silently replaces surrogates with the error code point 0xFFFD.\n"
|
||||
" With ignore (the default) re2ocaml treats surrogates as normal code\n"
|
||||
" points. The Unicode standard says that standalone surrogates are\n"
|
||||
" invalid, but real-world libraries and programs behave in different\n"
|
||||
" ways.\n"
|
||||
"\n"
|
||||
" --flex-syntax -F\n"
|
||||
"\n"
|
||||
" Partial support for Flex syntax: in this mode named definitions don't\n"
|
||||
" need the equal sign and the terminating semicolon, and when used they\n"
|
||||
" must be surrounded with curly braces. Names without curly braces are\n"
|
||||
" treated as double-quoted strings.\n"
|
||||
"\n"
|
||||
" --goto-label\n"
|
||||
"\n"
|
||||
" Use \"goto/label\" code model: encode DFA in form of labeled code blocks\n"
|
||||
" connected with goto transitions across blocks. This is only supported\n"
|
||||
" for languages that have a goto statement.\n"
|
||||
"\n"
|
||||
" --header --type-header -t HEADER\n"
|
||||
"\n"
|
||||
" Generate a HEADER file. The contents of the file can be specified using\n"
|
||||
" special blocks header:on and header:off. If conditions are used, the\n"
|
||||
" generated header will have a condition enum automatically appended to\n"
|
||||
" it (unless there is an explicit conditions block).\n"
|
||||
"\n"
|
||||
" -I PATH\n"
|
||||
"\n"
|
||||
" Add PATH to the list of locations which are used when searching for\n"
|
||||
" include files. This option is useful in combination with include block\n"
|
||||
" or directive. re2ocaml looks for FILE in the directory of the parent\n"
|
||||
" file and in the include locations specified with -I option.\n"
|
||||
"\n"
|
||||
" --input <default | custom>\n"
|
||||
"\n"
|
||||
" Deprecated alias for --api. Option default corresponds to simple (it is\n"
|
||||
" indeed the default for most backends, but not for all). Option custom\n"
|
||||
" corresponds to generic.\n"
|
||||
"\n"
|
||||
" --input-encoding <ascii | utf8>\n"
|
||||
"\n"
|
||||
" Specify the way re2ocaml parses regular expressions. With ascii (the\n"
|
||||
" default) re2ocaml handles input as ASCII-encoded: any sequence of code\n"
|
||||
" units is a sequence of standalone 1-byte characters. With utf8 re2ocaml\n"
|
||||
" handles input as UTF8-encoded and recognizes multibyte characters.\n"
|
||||
"\n"
|
||||
" --invert-captures\n"
|
||||
"\n"
|
||||
" Invert the meaning of capturing and non-capturing groups. By default\n"
|
||||
" (...) is capturing and (! ...) is non-capturing. With this option (!\n"
|
||||
" ...) is capturing and (...) is non-capturing.\n"
|
||||
"\n"
|
||||
" --lang <none | c | d | go | haskell | java | js | ocaml | python | rust | v\n"
|
||||
" | zig>\n"
|
||||
"\n"
|
||||
" Specify the target language. Supported languages are C, D, Go, Haskell,\n"
|
||||
" Java, JS, OCaml, Python, Rust, V, Zig (more languages can be added via\n"
|
||||
" user-defined syntax files, see the --syntax option). Option none\n"
|
||||
" disables default suntax configs, so that the target language is\n"
|
||||
" undefined.\n"
|
||||
"\n"
|
||||
" --location-format <gnu | msvc>\n"
|
||||
"\n"
|
||||
" Specify location format in messages. With gnu locations are printed as\n"
|
||||
" 'filename:line:column: ...'. With msvc locations are printed as\n"
|
||||
" 'filename(line,column) ...'. The default is gnu.\n"
|
||||
"\n"
|
||||
" --loop-switch\n"
|
||||
"\n"
|
||||
" Use \"loop/switch\" code model: encode DFA in form of a loop over a\n"
|
||||
" switch statement, where individual states are switch cases. State is\n"
|
||||
" stored in a variable yystate. Transitions between states update yystate\n"
|
||||
" to the case label of the destination state and continue execution to\n"
|
||||
" the head of the loop.\n"
|
||||
"\n"
|
||||
" --nested-ifs -s\n"
|
||||
"\n"
|
||||
" Use nested if statements instead of switch statements in conditional\n"
|
||||
" jumps. This usually results in more efficient code with non-optimizing\n"
|
||||
" compilers.\n"
|
||||
"\n"
|
||||
" --no-debug-info -i\n"
|
||||
"\n"
|
||||
" Do not output line directives. This may be useful when the generated\n"
|
||||
" code is stored in a version control system (to avoid huge autogenerated\n"
|
||||
" diffs on small changes).\n"
|
||||
"\n"
|
||||
" --no-generation-date\n"
|
||||
"\n"
|
||||
" Suppress date output in the generated file.\n"
|
||||
"\n"
|
||||
" --no-version\n"
|
||||
"\n"
|
||||
" Suppress version output in the generated file.\n"
|
||||
"\n"
|
||||
" --no-unsafe\n"
|
||||
"\n"
|
||||
" Do not generate unsafe wrapper over YYPEEK (this option is specific to\n"
|
||||
" Rust). For performance reasons YYPEEK should avoid bounds-checking, as\n"
|
||||
" the lexer already performs end-of-input checks in a more efficient way.\n"
|
||||
" The user may choose to provide a safe YYPEEK definition, or a\n"
|
||||
" definition that is unsafe only in release builds, in which case the\n"
|
||||
" --no-unsafe option helps to avoid warnings about redundant unsafe\n"
|
||||
" blocks.\n"
|
||||
"\n"
|
||||
" --output -o OUTPUT\n"
|
||||
"\n"
|
||||
" Specify the OUTPUT file.\n"
|
||||
"\n"
|
||||
" --posix-captures, -P\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with POSIX-style capturing groups. The\n"
|
||||
" result is collected into an array yybmatch of capacity 2 * YYMAXNMATCH,\n"
|
||||
" and yynmatch is set to the number of groups for the matching rule.\n"
|
||||
"\n"
|
||||
" --posix-captvars\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with POSIX-style capturing groups. The\n"
|
||||
" result is collected into variables yytl<k>, yytr<k> for k-th capturing\n"
|
||||
" group.\n"
|
||||
"\n"
|
||||
" --recursive-functions\n"
|
||||
"\n"
|
||||
" Use code model based on co-recursive functions, where each DFA state is\n"
|
||||
" a separate function that may call other state-functions or itself.\n"
|
||||
"\n"
|
||||
" --reusable -r\n"
|
||||
"\n"
|
||||
" Deprecated since version 2.2 (reusable blocks are allowed by default\n"
|
||||
" now).\n"
|
||||
"\n"
|
||||
" --skeleton -S\n"
|
||||
"\n"
|
||||
" Ignore user-defined interface code and generate a self-contained\n"
|
||||
" \"skeleton\" program. Additionally, generate input files with strings\n"
|
||||
" derived from the regular grammar and compressed match results that are\n"
|
||||
" used to verify \"skeleton\" behavior on all inputs. This option is useful\n"
|
||||
" for finding bugs in optimizations and code generation. This option is\n"
|
||||
" supported only for C.\n"
|
||||
"\n"
|
||||
" --storable-state -f\n"
|
||||
"\n"
|
||||
" Generate a lexer which can store its inner state. This is useful in\n"
|
||||
" push-model lexers which are stopped by an outer program when there is\n"
|
||||
" not enough input, and then resumed when more input becomes available.\n"
|
||||
" In this mode users should additionally define YYGETSTATE and YYSETSTATE\n"
|
||||
" primitives, and variables yych, yyaccept and state should be part of\n"
|
||||
" the stored lexer state.\n"
|
||||
"\n"
|
||||
" --syntax FILE\n"
|
||||
"\n"
|
||||
" Load configurations from the specified FILE and apply them on top of\n"
|
||||
" the default syntax file. Note that FILE can define only a few\n"
|
||||
" configurations (if it's used to amend the default syntax file), or it\n"
|
||||
" can define a whole new language backend (in the latter case it is\n"
|
||||
" recommended to use --lang none option).\n"
|
||||
"\n"
|
||||
" --tags -T\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with tags.\n"
|
||||
"\n"
|
||||
" --ucs2 --wide-chars -w\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UCS2-encoded input. re2ocaml assumes that\n"
|
||||
" the character range is 0 -- 0xFFFF and character size is 2 bytes. This\n"
|
||||
" option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --utf8 --utf-8 -8\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads input in UTF-8 encoding. re2ocaml assumes\n"
|
||||
" that the character range is 0 -- 0x10FFFF and character size is 1 byte.\n"
|
||||
"\n"
|
||||
" --utf16 --utf-16 -x\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UTF16-encoded input. re2ocaml assumes that\n"
|
||||
" the character range is 0 -- 0x10FFFF and character size is 2 bytes.\n"
|
||||
" This option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --utf32 --unicode -u\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UTF32-encoded input. re2ocaml assumes that\n"
|
||||
" the character range is 0 -- 0x10FFFF and character size is 4 bytes.\n"
|
||||
" This option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --verbose\n"
|
||||
"\n"
|
||||
" Output a short message in case of success.\n"
|
||||
"\n"
|
||||
" --vernum -V\n"
|
||||
"\n"
|
||||
" Show version information in MMmmpp format (major, minor, patch).\n"
|
||||
"\n"
|
||||
" --version -v\n"
|
||||
"\n"
|
||||
" Show version information.\n"
|
||||
"\n"
|
||||
" --single-pass -1\n"
|
||||
"\n"
|
||||
" Deprecated. Does nothing (single pass is the default now).\n"
|
||||
"\n"
|
||||
" --debug-output -d\n"
|
||||
"\n"
|
||||
" Emit YYDEBUG invocations in the generated code. This is useful to trace\n"
|
||||
" lexer execution.\n"
|
||||
"\n"
|
||||
" --dump-adfa\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after tunneling (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-cfg\n"
|
||||
"\n"
|
||||
" Debug option: output control flow graph of tag variables (in .dot\n"
|
||||
" format).\n"
|
||||
"\n"
|
||||
" --dump-closure-stats\n"
|
||||
"\n"
|
||||
" Debug option: output statistics on the number of states in closure.\n"
|
||||
"\n"
|
||||
" --dump-dfa-det\n"
|
||||
"\n"
|
||||
" Debug option: output DFA immediately after determinization (in .dot\n"
|
||||
" format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-min\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after minimization (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-tagopt\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after tag optimizations (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-tree\n"
|
||||
"\n"
|
||||
" Debug option: output DFA under construction with states represented as\n"
|
||||
" tag history trees (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-raw\n"
|
||||
"\n"
|
||||
" Debug option: output DFA under construction with expanded state-sets\n"
|
||||
" (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-interf\n"
|
||||
"\n"
|
||||
" Debug option: output interference table produced by liveness analysis\n"
|
||||
" of tag variables.\n"
|
||||
"\n"
|
||||
" --dump-nfa\n"
|
||||
"\n"
|
||||
" Debug option: output NFA (in .dot format).\n"
|
||||
"\n"
|
||||
" --emit-dot -D\n"
|
||||
"\n"
|
||||
" Instead of normal output generate lexer graph in .dot format. The\n"
|
||||
" output can be converted to an image with the help of Graphviz (e.g.\n"
|
||||
" something like dot -Tpng -odfa.png dfa.dot).\n"
|
||||
"\n"
|
||||
" --dfa-minimization <moore | table>\n"
|
||||
"\n"
|
||||
" Internal option: DFA minimization algorithm used by re2ocaml. The moore\n"
|
||||
" option is the Moore algorithm (it is the default). The table option is\n"
|
||||
" the \"table filling\" algorithm. Both algorithms should produce the same\n"
|
||||
" DFA up to states relabeling; table filling is simpler and much slower\n"
|
||||
" and serves as a reference implementation.\n"
|
||||
"\n"
|
||||
" --eager-skip\n"
|
||||
"\n"
|
||||
" Internal option: make the generated lexer advance the input position\n"
|
||||
" eagerly -- immediately after reading the input symbol. This changes the\n"
|
||||
" default behavior when the input position is advanced lazily -- after\n"
|
||||
" transition to the next state.\n"
|
||||
"\n"
|
||||
" --no-lookahead\n"
|
||||
"\n"
|
||||
" Internal option, deprecated. It used to enable TDFA(0) algorithm.\n"
|
||||
" Unlike TDFA(1), TDFA(0) algorithm does not use one-symbol lookahead. It\n"
|
||||
" applies register operations to the incoming transitions rather than the\n"
|
||||
" outgoing ones. Benchmarks showed that TDFA(0) algorithm is less\n"
|
||||
" efficient than TDFA(1).\n"
|
||||
"\n"
|
||||
" --no-optimize-tags\n"
|
||||
"\n"
|
||||
" Internal option: suppress optimization of tag variables (useful for\n"
|
||||
" debugging).\n"
|
||||
"\n"
|
||||
" --posix-closure <gor1 | gtop>\n"
|
||||
"\n"
|
||||
" Internal option: specify shortest-path algorithm used for the\n"
|
||||
" construction of epsilon-closure with POSIX disambiguation semantics:\n"
|
||||
" gor1 (the default) stands for Goldberg-Radzik algorithm, and gtop\n"
|
||||
" stands for \"global topological order\" algorithm.\n"
|
||||
"\n"
|
||||
" --posix-prectable <complex | naive>\n"
|
||||
"\n"
|
||||
" Internal option: specify the algorithm used to compute POSIX precedence\n"
|
||||
" table. The complex algorithm computes precedence table in one traversal\n"
|
||||
" of tag history tree and has quadratic complexity in the number of TNFA\n"
|
||||
" states; it is the default. The naive algorithm has worst-case cubic\n"
|
||||
" complexity in the number of TNFA states, but it is much simpler than\n"
|
||||
" complex and may be slightly faster in non-pathological cases.\n"
|
||||
"\n"
|
||||
" --stadfa\n"
|
||||
"\n"
|
||||
" Internal option, deprecated. It used to enable staDFA algorithm, which\n"
|
||||
" differs from TDFA in that register operations are placed in states\n"
|
||||
" rather than on transitions. Benchmarks showed that staDFA algorithm is\n"
|
||||
" less efficient than TDFA.\n"
|
||||
"\n"
|
||||
" --fixed-tags <none | toplevel | all>\n"
|
||||
"\n"
|
||||
" Internal option: specify whether the fixed-tag optimization should be\n"
|
||||
" applied to all tags (all), none of them (none), or only those in\n"
|
||||
" toplevel concatenation (toplevel). The default is all. \"Fixed\" tags are\n"
|
||||
" those that are located within a fixed distance to some other tag\n"
|
||||
" (called \"base\"). In such cases only the base tag needs to be tracked,\n"
|
||||
" and the value of the fixed tag can be computed as the value of the base\n"
|
||||
" tag plus a static offset. For tags that are under alternative or\n"
|
||||
" repetition it is also necessary to check if the base tag has a no-match\n"
|
||||
" value (in that case fixed tag should also be set to no-match,\n"
|
||||
" disregarding the offset). For tags in top-level concatenation the check\n"
|
||||
" is not needed, because they always match.\n"
|
||||
"\n"
|
||||
"WARNINGS\n"
|
||||
"\n"
|
||||
" -W\n"
|
||||
"\n"
|
||||
" Turn on all warnings.\n"
|
||||
"\n"
|
||||
" -Werror\n"
|
||||
"\n"
|
||||
" Turn warnings into errors. Note that this option alone doesn't turn on\n"
|
||||
" any warnings; it only affects those warnings that have been turned on\n"
|
||||
" so far or will be turned on later.\n"
|
||||
"\n"
|
||||
" -W<warning>\n"
|
||||
"\n"
|
||||
" Turn on warning.\n"
|
||||
"\n"
|
||||
" -Wno-<warning>\n"
|
||||
"\n"
|
||||
" Turn off warning.\n"
|
||||
"\n"
|
||||
" -Werror-<warning>\n"
|
||||
"\n"
|
||||
" Turn on warning and treat it as an error (this implies -W<warning>).\n"
|
||||
"\n"
|
||||
" -Wno-error-<warning>\n"
|
||||
"\n"
|
||||
" Don't treat this particular warning as an error. This doesn't turn off\n"
|
||||
" the warning itself.\n"
|
||||
"\n"
|
||||
" -Wcondition-order\n"
|
||||
"\n"
|
||||
" Warn if the generated program makes implicit assumptions about\n"
|
||||
" condition numbering. One should use either --header option or\n"
|
||||
" conditions block to generate a mapping of condition names to numbers\n"
|
||||
" and then use the autogenerated condition names.\n"
|
||||
"\n"
|
||||
" -Wempty-character-class\n"
|
||||
"\n"
|
||||
" Warn if a regular expression contains an empty character class. Trying\n"
|
||||
" to match an empty character class makes no sense: it should always\n"
|
||||
" fail. However, for backwards compatibility reasons re2ocaml permits\n"
|
||||
" empty character classes and treats them as empty strings. Use the\n"
|
||||
" --empty-class option to change the default behavior.\n"
|
||||
"\n"
|
||||
" -Wmatch-empty-string\n"
|
||||
"\n"
|
||||
" Warn if a rule is nullable (matches an empty string). If the lexer runs\n"
|
||||
" in a loop and the empty match is unintentional, the lexer may\n"
|
||||
" unexpectedly hang in an infinite loop.\n"
|
||||
"\n"
|
||||
" -Wswapped-range\n"
|
||||
"\n"
|
||||
" Warn if the lower bound of a range is greater than its upper bound. The\n"
|
||||
" default behavior is to silently swap the range bounds.\n"
|
||||
"\n"
|
||||
" -Wundefined-control-flow\n"
|
||||
"\n"
|
||||
" Warn if some input strings cause undefined control flow in the lexer\n"
|
||||
" (the faulty patterns are reported). This is a dangerous and common\n"
|
||||
" mistake. It can be easily fixed by adding the default rule * which has\n"
|
||||
" the lowest priority, matches any code unit, and always consumes a\n"
|
||||
" single code unit.\n"
|
||||
"\n"
|
||||
" -Wunreachable-rules\n"
|
||||
"\n"
|
||||
" Warn about rules that are shadowed by other rules and will never match.\n"
|
||||
"\n"
|
||||
" -Wuseless-escape\n"
|
||||
"\n"
|
||||
" Warn if a symbol is escaped when it shouldn't be. By default, re2ocaml\n"
|
||||
" silently ignores such escapes, but this may as well indicate a typo or\n"
|
||||
" an error in the escape sequence.\n"
|
||||
"\n"
|
||||
" -Wnondeterministic-tags\n"
|
||||
"\n"
|
||||
" Warn if a tag has n-th degree of nondeterminism, where n is greater\n"
|
||||
" than 1.\n"
|
||||
"\n"
|
||||
" -Wsentinel-in-midrule\n"
|
||||
"\n"
|
||||
" Warn if the sentinel symbol occurs in the middle of a rule --- this may\n"
|
||||
" cause reads past the end of buffer, crashes or memory corruption in the\n"
|
||||
" generated lexer. This warning is only applicable if the sentinel method\n"
|
||||
" of checking for the end of input is used. It is set to an error if\n"
|
||||
" re2c:sentinel configuration is used.\n"
|
||||
"\n"
|
||||
" -Wundefined-syntax-config\n"
|
||||
"\n"
|
||||
" Warn if the syntax file specified with --syntax option is missing\n"
|
||||
" definitions of some configurations. This helps to maintain user-defined\n"
|
||||
" syntax files: if a new release adds configurations, old syntax file\n"
|
||||
" will raise a warning, and the user will be notified. If some\n"
|
||||
" configurations are unused and do not need a definition, they should be\n"
|
||||
" explicitly set to <undefined>.\n"
|
||||
;
|
||||
@@ -0,0 +1,512 @@
|
||||
extern const char* help;
|
||||
const char* help =
|
||||
"USAGE\n"
|
||||
"\n"
|
||||
" re2py [ OPTIONS ] [ WARNINGS ] INPUT\n"
|
||||
"\n"
|
||||
" Input can be either a file or - for stdin.\n"
|
||||
"\n"
|
||||
"OPTIONS\n"
|
||||
"\n"
|
||||
" -? --help -h\n"
|
||||
"\n"
|
||||
" Show help message.\n"
|
||||
"\n"
|
||||
" --api <simple | record | generic>\n"
|
||||
"\n"
|
||||
" Specify the API used by the generated code to interface with used-\n"
|
||||
" defined code. Option simple shold be used in simple cases when there's\n"
|
||||
" no need for buffer refilling and storing lexer state. Option record\n"
|
||||
" should be used when lexer state needs to be stored in a record (struct,\n"
|
||||
" class, etc.). Option generic should be used in complex cases when the\n"
|
||||
" other two APIs are not flexible enough.\n"
|
||||
"\n"
|
||||
" --bit-vectors -b\n"
|
||||
"\n"
|
||||
" Optimize conditional jumps using bit masks. This option implies\n"
|
||||
" --nested-ifs.\n"
|
||||
"\n"
|
||||
" --captures, --leftmost-captures\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with leftmost greedy capturing groups. The\n"
|
||||
" result is collected into an array yybmatch of capacity 2 * YYMAXNMATCH,\n"
|
||||
" and yynmatch is set to the number of groups for the matching rule.\n"
|
||||
"\n"
|
||||
" --captvars, --leftmost-captvars\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with leftmost greedy capturing groups. The\n"
|
||||
" result is collected into variables yytl<k>, yytr<k> for k-th capturing\n"
|
||||
" group.\n"
|
||||
"\n"
|
||||
" --case-insensitive\n"
|
||||
"\n"
|
||||
" Treat single-quoted and double-quoted strings as case-insensitive.\n"
|
||||
"\n"
|
||||
" --case-inverted\n"
|
||||
"\n"
|
||||
" Invert the meaning of single-quoted and double-quoted strings: treat\n"
|
||||
" single-quoted strings as case-sensitive and double-quoted strings as\n"
|
||||
" case-insensitive.\n"
|
||||
"\n"
|
||||
" --case-ranges\n"
|
||||
"\n"
|
||||
" Collapse consecutive cases in a switch statements into a range of the\n"
|
||||
" form low ... high. This syntax is a C/C++ language extension that is\n"
|
||||
" supported by compilers like GCC, Clang and Tcc. The main advantage over\n"
|
||||
" using single cases is smaller generated code and faster generation\n"
|
||||
" time, although for some compilers like Tcc it also results in smaller\n"
|
||||
" binary size. This option is supported only for C.\n"
|
||||
"\n"
|
||||
" --computed-gotos -g\n"
|
||||
"\n"
|
||||
" Optimize conditional jumps using non-standard \"computed goto\" extension\n"
|
||||
" (which must be supported by the compiler). re2py generates jump tables\n"
|
||||
" only in complex cases with a lot of conditional branches. Complexity\n"
|
||||
" threshold can be configured with cgoto:threshold configuration. This\n"
|
||||
" option implies --bit-vectors. It is supported only for C.\n"
|
||||
"\n"
|
||||
" --conditions --start-conditions -c\n"
|
||||
"\n"
|
||||
" Enable support of Flex-like \"conditions\": multiple interrelated lexers\n"
|
||||
" within one block. This is an alternative to manually specifying\n"
|
||||
" different re2py blocks connected with goto or function calls.\n"
|
||||
"\n"
|
||||
" --depfile FILE\n"
|
||||
"\n"
|
||||
" Write dependency information to FILE in the form of a Makefile rule\n"
|
||||
" <output-file> : <input-file> [include-file ...]. This allows one to\n"
|
||||
" track build dependencies in the presence of include blocks/directives,\n"
|
||||
" so that updating include files triggers regeneration of the output\n"
|
||||
" file. This option depends on the --output option.\n"
|
||||
"\n"
|
||||
" --ebcdic --ecb -e\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads input in EBCDIC encoding. re2py assumes\n"
|
||||
" that the character range is 0 -- 0xFF and character size is 1 byte.\n"
|
||||
"\n"
|
||||
" --empty-class <match-empty | match-none | error>\n"
|
||||
"\n"
|
||||
" Define the way re2py treats empty character classes. With match-empty\n"
|
||||
" (the default) empty class matches empty input (which is illogical, but\n"
|
||||
" backwards-compatible). With match-none empty class always fails to\n"
|
||||
" match. With error empty class raises a compilation error.\n"
|
||||
"\n"
|
||||
" --encoding-policy <fail | substitute | ignore>\n"
|
||||
"\n"
|
||||
" Define the way re2py treats Unicode surrogates. With fail re2py aborts\n"
|
||||
" with an error when a surrogate is encountered. With substitute re2py\n"
|
||||
" silently replaces surrogates with the error code point 0xFFFD. With\n"
|
||||
" ignore (the default) re2py treats surrogates as normal code points. The\n"
|
||||
" Unicode standard says that standalone surrogates are invalid, but real-\n"
|
||||
" world libraries and programs behave in different ways.\n"
|
||||
"\n"
|
||||
" --flex-syntax -F\n"
|
||||
"\n"
|
||||
" Partial support for Flex syntax: in this mode named definitions don't\n"
|
||||
" need the equal sign and the terminating semicolon, and when used they\n"
|
||||
" must be surrounded with curly braces. Names without curly braces are\n"
|
||||
" treated as double-quoted strings.\n"
|
||||
"\n"
|
||||
" --goto-label\n"
|
||||
"\n"
|
||||
" Use \"goto/label\" code model: encode DFA in form of labeled code blocks\n"
|
||||
" connected with goto transitions across blocks. This is only supported\n"
|
||||
" for languages that have a goto statement.\n"
|
||||
"\n"
|
||||
" --header --type-header -t HEADER\n"
|
||||
"\n"
|
||||
" Generate a HEADER file. The contents of the file can be specified using\n"
|
||||
" special blocks header:on and header:off. If conditions are used, the\n"
|
||||
" generated header will have a condition enum automatically appended to\n"
|
||||
" it (unless there is an explicit conditions block).\n"
|
||||
"\n"
|
||||
" -I PATH\n"
|
||||
"\n"
|
||||
" Add PATH to the list of locations which are used when searching for\n"
|
||||
" include files. This option is useful in combination with include block\n"
|
||||
" or directive. re2py looks for FILE in the directory of the parent file\n"
|
||||
" and in the include locations specified with -I option.\n"
|
||||
"\n"
|
||||
" --input <default | custom>\n"
|
||||
"\n"
|
||||
" Deprecated alias for --api. Option default corresponds to simple (it is\n"
|
||||
" indeed the default for most backends, but not for all). Option custom\n"
|
||||
" corresponds to generic.\n"
|
||||
"\n"
|
||||
" --input-encoding <ascii | utf8>\n"
|
||||
"\n"
|
||||
" Specify the way re2py parses regular expressions. With ascii (the\n"
|
||||
" default) re2py handles input as ASCII-encoded: any sequence of code\n"
|
||||
" units is a sequence of standalone 1-byte characters. With utf8 re2py\n"
|
||||
" handles input as UTF8-encoded and recognizes multibyte characters.\n"
|
||||
"\n"
|
||||
" --invert-captures\n"
|
||||
"\n"
|
||||
" Invert the meaning of capturing and non-capturing groups. By default\n"
|
||||
" (...) is capturing and (! ...) is non-capturing. With this option (!\n"
|
||||
" ...) is capturing and (...) is non-capturing.\n"
|
||||
"\n"
|
||||
" --lang <none | c | d | go | haskell | java | js | ocaml | python | rust | v\n"
|
||||
" | zig>\n"
|
||||
"\n"
|
||||
" Specify the target language. Supported languages are C, D, Go, Haskell,\n"
|
||||
" Java, JS, OCaml, Python, Rust, V, Zig (more languages can be added via\n"
|
||||
" user-defined syntax files, see the --syntax option). Option none\n"
|
||||
" disables default suntax configs, so that the target language is\n"
|
||||
" undefined.\n"
|
||||
"\n"
|
||||
" --location-format <gnu | msvc>\n"
|
||||
"\n"
|
||||
" Specify location format in messages. With gnu locations are printed as\n"
|
||||
" 'filename:line:column: ...'. With msvc locations are printed as\n"
|
||||
" 'filename(line,column) ...'. The default is gnu.\n"
|
||||
"\n"
|
||||
" --loop-switch\n"
|
||||
"\n"
|
||||
" Use \"loop/switch\" code model: encode DFA in form of a loop over a\n"
|
||||
" switch statement, where individual states are switch cases. State is\n"
|
||||
" stored in a variable yystate. Transitions between states update yystate\n"
|
||||
" to the case label of the destination state and continue execution to\n"
|
||||
" the head of the loop.\n"
|
||||
"\n"
|
||||
" --nested-ifs -s\n"
|
||||
"\n"
|
||||
" Use nested if statements instead of switch statements in conditional\n"
|
||||
" jumps. This usually results in more efficient code with non-optimizing\n"
|
||||
" compilers.\n"
|
||||
"\n"
|
||||
" --no-debug-info -i\n"
|
||||
"\n"
|
||||
" Do not output line directives. This may be useful when the generated\n"
|
||||
" code is stored in a version control system (to avoid huge autogenerated\n"
|
||||
" diffs on small changes).\n"
|
||||
"\n"
|
||||
" --no-generation-date\n"
|
||||
"\n"
|
||||
" Suppress date output in the generated file.\n"
|
||||
"\n"
|
||||
" --no-version\n"
|
||||
"\n"
|
||||
" Suppress version output in the generated file.\n"
|
||||
"\n"
|
||||
" --no-unsafe\n"
|
||||
"\n"
|
||||
" Do not generate unsafe wrapper over YYPEEK (this option is specific to\n"
|
||||
" Rust). For performance reasons YYPEEK should avoid bounds-checking, as\n"
|
||||
" the lexer already performs end-of-input checks in a more efficient way.\n"
|
||||
" The user may choose to provide a safe YYPEEK definition, or a\n"
|
||||
" definition that is unsafe only in release builds, in which case the\n"
|
||||
" --no-unsafe option helps to avoid warnings about redundant unsafe\n"
|
||||
" blocks.\n"
|
||||
"\n"
|
||||
" --output -o OUTPUT\n"
|
||||
"\n"
|
||||
" Specify the OUTPUT file.\n"
|
||||
"\n"
|
||||
" --posix-captures, -P\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with POSIX-style capturing groups. The\n"
|
||||
" result is collected into an array yybmatch of capacity 2 * YYMAXNMATCH,\n"
|
||||
" and yynmatch is set to the number of groups for the matching rule.\n"
|
||||
"\n"
|
||||
" --posix-captvars\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with POSIX-style capturing groups. The\n"
|
||||
" result is collected into variables yytl<k>, yytr<k> for k-th capturing\n"
|
||||
" group.\n"
|
||||
"\n"
|
||||
" --recursive-functions\n"
|
||||
"\n"
|
||||
" Use code model based on co-recursive functions, where each DFA state is\n"
|
||||
" a separate function that may call other state-functions or itself.\n"
|
||||
"\n"
|
||||
" --reusable -r\n"
|
||||
"\n"
|
||||
" Deprecated since version 2.2 (reusable blocks are allowed by default\n"
|
||||
" now).\n"
|
||||
"\n"
|
||||
" --skeleton -S\n"
|
||||
"\n"
|
||||
" Ignore user-defined interface code and generate a self-contained\n"
|
||||
" \"skeleton\" program. Additionally, generate input files with strings\n"
|
||||
" derived from the regular grammar and compressed match results that are\n"
|
||||
" used to verify \"skeleton\" behavior on all inputs. This option is useful\n"
|
||||
" for finding bugs in optimizations and code generation. This option is\n"
|
||||
" supported only for C.\n"
|
||||
"\n"
|
||||
" --storable-state -f\n"
|
||||
"\n"
|
||||
" Generate a lexer which can store its inner state. This is useful in\n"
|
||||
" push-model lexers which are stopped by an outer program when there is\n"
|
||||
" not enough input, and then resumed when more input becomes available.\n"
|
||||
" In this mode users should additionally define YYGETSTATE and YYSETSTATE\n"
|
||||
" primitives, and variables yych, yyaccept and state should be part of\n"
|
||||
" the stored lexer state.\n"
|
||||
"\n"
|
||||
" --syntax FILE\n"
|
||||
"\n"
|
||||
" Load configurations from the specified FILE and apply them on top of\n"
|
||||
" the default syntax file. Note that FILE can define only a few\n"
|
||||
" configurations (if it's used to amend the default syntax file), or it\n"
|
||||
" can define a whole new language backend (in the latter case it is\n"
|
||||
" recommended to use --lang none option).\n"
|
||||
"\n"
|
||||
" --tags -T\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with tags.\n"
|
||||
"\n"
|
||||
" --ucs2 --wide-chars -w\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UCS2-encoded input. re2py assumes that the\n"
|
||||
" character range is 0 -- 0xFFFF and character size is 2 bytes. This\n"
|
||||
" option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --utf8 --utf-8 -8\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads input in UTF-8 encoding. re2py assumes that\n"
|
||||
" the character range is 0 -- 0x10FFFF and character size is 1 byte.\n"
|
||||
"\n"
|
||||
" --utf16 --utf-16 -x\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UTF16-encoded input. re2py assumes that the\n"
|
||||
" character range is 0 -- 0x10FFFF and character size is 2 bytes. This\n"
|
||||
" option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --utf32 --unicode -u\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UTF32-encoded input. re2py assumes that the\n"
|
||||
" character range is 0 -- 0x10FFFF and character size is 4 bytes. This\n"
|
||||
" option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --verbose\n"
|
||||
"\n"
|
||||
" Output a short message in case of success.\n"
|
||||
"\n"
|
||||
" --vernum -V\n"
|
||||
"\n"
|
||||
" Show version information in MMmmpp format (major, minor, patch).\n"
|
||||
"\n"
|
||||
" --version -v\n"
|
||||
"\n"
|
||||
" Show version information.\n"
|
||||
"\n"
|
||||
" --single-pass -1\n"
|
||||
"\n"
|
||||
" Deprecated. Does nothing (single pass is the default now).\n"
|
||||
"\n"
|
||||
" --debug-output -d\n"
|
||||
"\n"
|
||||
" Emit YYDEBUG invocations in the generated code. This is useful to trace\n"
|
||||
" lexer execution.\n"
|
||||
"\n"
|
||||
" --dump-adfa\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after tunneling (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-cfg\n"
|
||||
"\n"
|
||||
" Debug option: output control flow graph of tag variables (in .dot\n"
|
||||
" format).\n"
|
||||
"\n"
|
||||
" --dump-closure-stats\n"
|
||||
"\n"
|
||||
" Debug option: output statistics on the number of states in closure.\n"
|
||||
"\n"
|
||||
" --dump-dfa-det\n"
|
||||
"\n"
|
||||
" Debug option: output DFA immediately after determinization (in .dot\n"
|
||||
" format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-min\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after minimization (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-tagopt\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after tag optimizations (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-tree\n"
|
||||
"\n"
|
||||
" Debug option: output DFA under construction with states represented as\n"
|
||||
" tag history trees (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-raw\n"
|
||||
"\n"
|
||||
" Debug option: output DFA under construction with expanded state-sets\n"
|
||||
" (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-interf\n"
|
||||
"\n"
|
||||
" Debug option: output interference table produced by liveness analysis\n"
|
||||
" of tag variables.\n"
|
||||
"\n"
|
||||
" --dump-nfa\n"
|
||||
"\n"
|
||||
" Debug option: output NFA (in .dot format).\n"
|
||||
"\n"
|
||||
" --emit-dot -D\n"
|
||||
"\n"
|
||||
" Instead of normal output generate lexer graph in .dot format. The\n"
|
||||
" output can be converted to an image with the help of Graphviz (e.g.\n"
|
||||
" something like dot -Tpng -odfa.png dfa.dot).\n"
|
||||
"\n"
|
||||
" --dfa-minimization <moore | table>\n"
|
||||
"\n"
|
||||
" Internal option: DFA minimization algorithm used by re2py. The moore\n"
|
||||
" option is the Moore algorithm (it is the default). The table option is\n"
|
||||
" the \"table filling\" algorithm. Both algorithms should produce the same\n"
|
||||
" DFA up to states relabeling; table filling is simpler and much slower\n"
|
||||
" and serves as a reference implementation.\n"
|
||||
"\n"
|
||||
" --eager-skip\n"
|
||||
"\n"
|
||||
" Internal option: make the generated lexer advance the input position\n"
|
||||
" eagerly -- immediately after reading the input symbol. This changes the\n"
|
||||
" default behavior when the input position is advanced lazily -- after\n"
|
||||
" transition to the next state.\n"
|
||||
"\n"
|
||||
" --no-lookahead\n"
|
||||
"\n"
|
||||
" Internal option, deprecated. It used to enable TDFA(0) algorithm.\n"
|
||||
" Unlike TDFA(1), TDFA(0) algorithm does not use one-symbol lookahead. It\n"
|
||||
" applies register operations to the incoming transitions rather than the\n"
|
||||
" outgoing ones. Benchmarks showed that TDFA(0) algorithm is less\n"
|
||||
" efficient than TDFA(1).\n"
|
||||
"\n"
|
||||
" --no-optimize-tags\n"
|
||||
"\n"
|
||||
" Internal option: suppress optimization of tag variables (useful for\n"
|
||||
" debugging).\n"
|
||||
"\n"
|
||||
" --posix-closure <gor1 | gtop>\n"
|
||||
"\n"
|
||||
" Internal option: specify shortest-path algorithm used for the\n"
|
||||
" construction of epsilon-closure with POSIX disambiguation semantics:\n"
|
||||
" gor1 (the default) stands for Goldberg-Radzik algorithm, and gtop\n"
|
||||
" stands for \"global topological order\" algorithm.\n"
|
||||
"\n"
|
||||
" --posix-prectable <complex | naive>\n"
|
||||
"\n"
|
||||
" Internal option: specify the algorithm used to compute POSIX precedence\n"
|
||||
" table. The complex algorithm computes precedence table in one traversal\n"
|
||||
" of tag history tree and has quadratic complexity in the number of TNFA\n"
|
||||
" states; it is the default. The naive algorithm has worst-case cubic\n"
|
||||
" complexity in the number of TNFA states, but it is much simpler than\n"
|
||||
" complex and may be slightly faster in non-pathological cases.\n"
|
||||
"\n"
|
||||
" --stadfa\n"
|
||||
"\n"
|
||||
" Internal option, deprecated. It used to enable staDFA algorithm, which\n"
|
||||
" differs from TDFA in that register operations are placed in states\n"
|
||||
" rather than on transitions. Benchmarks showed that staDFA algorithm is\n"
|
||||
" less efficient than TDFA.\n"
|
||||
"\n"
|
||||
" --fixed-tags <none | toplevel | all>\n"
|
||||
"\n"
|
||||
" Internal option: specify whether the fixed-tag optimization should be\n"
|
||||
" applied to all tags (all), none of them (none), or only those in\n"
|
||||
" toplevel concatenation (toplevel). The default is all. \"Fixed\" tags are\n"
|
||||
" those that are located within a fixed distance to some other tag\n"
|
||||
" (called \"base\"). In such cases only the base tag needs to be tracked,\n"
|
||||
" and the value of the fixed tag can be computed as the value of the base\n"
|
||||
" tag plus a static offset. For tags that are under alternative or\n"
|
||||
" repetition it is also necessary to check if the base tag has a no-match\n"
|
||||
" value (in that case fixed tag should also be set to no-match,\n"
|
||||
" disregarding the offset). For tags in top-level concatenation the check\n"
|
||||
" is not needed, because they always match.\n"
|
||||
"\n"
|
||||
"WARNINGS\n"
|
||||
"\n"
|
||||
" -W\n"
|
||||
"\n"
|
||||
" Turn on all warnings.\n"
|
||||
"\n"
|
||||
" -Werror\n"
|
||||
"\n"
|
||||
" Turn warnings into errors. Note that this option alone doesn't turn on\n"
|
||||
" any warnings; it only affects those warnings that have been turned on\n"
|
||||
" so far or will be turned on later.\n"
|
||||
"\n"
|
||||
" -W<warning>\n"
|
||||
"\n"
|
||||
" Turn on warning.\n"
|
||||
"\n"
|
||||
" -Wno-<warning>\n"
|
||||
"\n"
|
||||
" Turn off warning.\n"
|
||||
"\n"
|
||||
" -Werror-<warning>\n"
|
||||
"\n"
|
||||
" Turn on warning and treat it as an error (this implies -W<warning>).\n"
|
||||
"\n"
|
||||
" -Wno-error-<warning>\n"
|
||||
"\n"
|
||||
" Don't treat this particular warning as an error. This doesn't turn off\n"
|
||||
" the warning itself.\n"
|
||||
"\n"
|
||||
" -Wcondition-order\n"
|
||||
"\n"
|
||||
" Warn if the generated program makes implicit assumptions about\n"
|
||||
" condition numbering. One should use either --header option or\n"
|
||||
" conditions block to generate a mapping of condition names to numbers\n"
|
||||
" and then use the autogenerated condition names.\n"
|
||||
"\n"
|
||||
" -Wempty-character-class\n"
|
||||
"\n"
|
||||
" Warn if a regular expression contains an empty character class. Trying\n"
|
||||
" to match an empty character class makes no sense: it should always\n"
|
||||
" fail. However, for backwards compatibility reasons re2py permits empty\n"
|
||||
" character classes and treats them as empty strings. Use the --empty-\n"
|
||||
" class option to change the default behavior.\n"
|
||||
"\n"
|
||||
" -Wmatch-empty-string\n"
|
||||
"\n"
|
||||
" Warn if a rule is nullable (matches an empty string). If the lexer runs\n"
|
||||
" in a loop and the empty match is unintentional, the lexer may\n"
|
||||
" unexpectedly hang in an infinite loop.\n"
|
||||
"\n"
|
||||
" -Wswapped-range\n"
|
||||
"\n"
|
||||
" Warn if the lower bound of a range is greater than its upper bound. The\n"
|
||||
" default behavior is to silently swap the range bounds.\n"
|
||||
"\n"
|
||||
" -Wundefined-control-flow\n"
|
||||
"\n"
|
||||
" Warn if some input strings cause undefined control flow in the lexer\n"
|
||||
" (the faulty patterns are reported). This is a dangerous and common\n"
|
||||
" mistake. It can be easily fixed by adding the default rule * which has\n"
|
||||
" the lowest priority, matches any code unit, and always consumes a\n"
|
||||
" single code unit.\n"
|
||||
"\n"
|
||||
" -Wunreachable-rules\n"
|
||||
"\n"
|
||||
" Warn about rules that are shadowed by other rules and will never match.\n"
|
||||
"\n"
|
||||
" -Wuseless-escape\n"
|
||||
"\n"
|
||||
" Warn if a symbol is escaped when it shouldn't be. By default, re2py\n"
|
||||
" silently ignores such escapes, but this may as well indicate a typo or\n"
|
||||
" an error in the escape sequence.\n"
|
||||
"\n"
|
||||
" -Wnondeterministic-tags\n"
|
||||
"\n"
|
||||
" Warn if a tag has n-th degree of nondeterminism, where n is greater\n"
|
||||
" than 1.\n"
|
||||
"\n"
|
||||
" -Wsentinel-in-midrule\n"
|
||||
"\n"
|
||||
" Warn if the sentinel symbol occurs in the middle of a rule --- this may\n"
|
||||
" cause reads past the end of buffer, crashes or memory corruption in the\n"
|
||||
" generated lexer. This warning is only applicable if the sentinel method\n"
|
||||
" of checking for the end of input is used. It is set to an error if\n"
|
||||
" re2c:sentinel configuration is used.\n"
|
||||
"\n"
|
||||
" -Wundefined-syntax-config\n"
|
||||
"\n"
|
||||
" Warn if the syntax file specified with --syntax option is missing\n"
|
||||
" definitions of some configurations. This helps to maintain user-defined\n"
|
||||
" syntax files: if a new release adds configurations, old syntax file\n"
|
||||
" will raise a warning, and the user will be notified. If some\n"
|
||||
" configurations are unused and do not need a definition, they should be\n"
|
||||
" explicitly set to <undefined>.\n"
|
||||
;
|
||||
@@ -0,0 +1,514 @@
|
||||
extern const char* help;
|
||||
const char* help =
|
||||
"USAGE\n"
|
||||
"\n"
|
||||
" re2rust [ OPTIONS ] [ WARNINGS ] INPUT\n"
|
||||
"\n"
|
||||
" Input can be either a file or - for stdin.\n"
|
||||
"\n"
|
||||
"OPTIONS\n"
|
||||
"\n"
|
||||
" -? --help -h\n"
|
||||
"\n"
|
||||
" Show help message.\n"
|
||||
"\n"
|
||||
" --api <simple | record | generic>\n"
|
||||
"\n"
|
||||
" Specify the API used by the generated code to interface with used-\n"
|
||||
" defined code. Option simple shold be used in simple cases when there's\n"
|
||||
" no need for buffer refilling and storing lexer state. Option record\n"
|
||||
" should be used when lexer state needs to be stored in a record (struct,\n"
|
||||
" class, etc.). Option generic should be used in complex cases when the\n"
|
||||
" other two APIs are not flexible enough.\n"
|
||||
"\n"
|
||||
" --bit-vectors -b\n"
|
||||
"\n"
|
||||
" Optimize conditional jumps using bit masks. This option implies\n"
|
||||
" --nested-ifs.\n"
|
||||
"\n"
|
||||
" --captures, --leftmost-captures\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with leftmost greedy capturing groups. The\n"
|
||||
" result is collected into an array yybmatch of capacity 2 * YYMAXNMATCH,\n"
|
||||
" and yynmatch is set to the number of groups for the matching rule.\n"
|
||||
"\n"
|
||||
" --captvars, --leftmost-captvars\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with leftmost greedy capturing groups. The\n"
|
||||
" result is collected into variables yytl<k>, yytr<k> for k-th capturing\n"
|
||||
" group.\n"
|
||||
"\n"
|
||||
" --case-insensitive\n"
|
||||
"\n"
|
||||
" Treat single-quoted and double-quoted strings as case-insensitive.\n"
|
||||
"\n"
|
||||
" --case-inverted\n"
|
||||
"\n"
|
||||
" Invert the meaning of single-quoted and double-quoted strings: treat\n"
|
||||
" single-quoted strings as case-sensitive and double-quoted strings as\n"
|
||||
" case-insensitive.\n"
|
||||
"\n"
|
||||
" --case-ranges\n"
|
||||
"\n"
|
||||
" Collapse consecutive cases in a switch statements into a range of the\n"
|
||||
" form low ... high. This syntax is a C/C++ language extension that is\n"
|
||||
" supported by compilers like GCC, Clang and Tcc. The main advantage over\n"
|
||||
" using single cases is smaller generated code and faster generation\n"
|
||||
" time, although for some compilers like Tcc it also results in smaller\n"
|
||||
" binary size. This option is supported only for C.\n"
|
||||
"\n"
|
||||
" --computed-gotos -g\n"
|
||||
"\n"
|
||||
" Optimize conditional jumps using non-standard \"computed goto\" extension\n"
|
||||
" (which must be supported by the compiler). re2rust generates jump\n"
|
||||
" tables only in complex cases with a lot of conditional branches.\n"
|
||||
" Complexity threshold can be configured with cgoto:threshold\n"
|
||||
" configuration. This option implies --bit-vectors. It is supported only\n"
|
||||
" for C.\n"
|
||||
"\n"
|
||||
" --conditions --start-conditions -c\n"
|
||||
"\n"
|
||||
" Enable support of Flex-like \"conditions\": multiple interrelated lexers\n"
|
||||
" within one block. This is an alternative to manually specifying\n"
|
||||
" different re2rust blocks connected with goto or function calls.\n"
|
||||
"\n"
|
||||
" --depfile FILE\n"
|
||||
"\n"
|
||||
" Write dependency information to FILE in the form of a Makefile rule\n"
|
||||
" <output-file> : <input-file> [include-file ...]. This allows one to\n"
|
||||
" track build dependencies in the presence of include blocks/directives,\n"
|
||||
" so that updating include files triggers regeneration of the output\n"
|
||||
" file. This option depends on the --output option.\n"
|
||||
"\n"
|
||||
" --ebcdic --ecb -e\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads input in EBCDIC encoding. re2rust assumes\n"
|
||||
" that the character range is 0 -- 0xFF and character size is 1 byte.\n"
|
||||
"\n"
|
||||
" --empty-class <match-empty | match-none | error>\n"
|
||||
"\n"
|
||||
" Define the way re2rust treats empty character classes. With match-empty\n"
|
||||
" (the default) empty class matches empty input (which is illogical, but\n"
|
||||
" backwards-compatible). With match-none empty class always fails to\n"
|
||||
" match. With error empty class raises a compilation error.\n"
|
||||
"\n"
|
||||
" --encoding-policy <fail | substitute | ignore>\n"
|
||||
"\n"
|
||||
" Define the way re2rust treats Unicode surrogates. With fail re2rust\n"
|
||||
" aborts with an error when a surrogate is encountered. With substitute\n"
|
||||
" re2rust silently replaces surrogates with the error code point 0xFFFD.\n"
|
||||
" With ignore (the default) re2rust treats surrogates as normal code\n"
|
||||
" points. The Unicode standard says that standalone surrogates are\n"
|
||||
" invalid, but real-world libraries and programs behave in different\n"
|
||||
" ways.\n"
|
||||
"\n"
|
||||
" --flex-syntax -F\n"
|
||||
"\n"
|
||||
" Partial support for Flex syntax: in this mode named definitions don't\n"
|
||||
" need the equal sign and the terminating semicolon, and when used they\n"
|
||||
" must be surrounded with curly braces. Names without curly braces are\n"
|
||||
" treated as double-quoted strings.\n"
|
||||
"\n"
|
||||
" --goto-label\n"
|
||||
"\n"
|
||||
" Use \"goto/label\" code model: encode DFA in form of labeled code blocks\n"
|
||||
" connected with goto transitions across blocks. This is only supported\n"
|
||||
" for languages that have a goto statement.\n"
|
||||
"\n"
|
||||
" --header --type-header -t HEADER\n"
|
||||
"\n"
|
||||
" Generate a HEADER file. The contents of the file can be specified using\n"
|
||||
" special blocks header:on and header:off. If conditions are used, the\n"
|
||||
" generated header will have a condition enum automatically appended to\n"
|
||||
" it (unless there is an explicit conditions block).\n"
|
||||
"\n"
|
||||
" -I PATH\n"
|
||||
"\n"
|
||||
" Add PATH to the list of locations which are used when searching for\n"
|
||||
" include files. This option is useful in combination with include block\n"
|
||||
" or directive. re2rust looks for FILE in the directory of the parent\n"
|
||||
" file and in the include locations specified with -I option.\n"
|
||||
"\n"
|
||||
" --input <default | custom>\n"
|
||||
"\n"
|
||||
" Deprecated alias for --api. Option default corresponds to simple (it is\n"
|
||||
" indeed the default for most backends, but not for all). Option custom\n"
|
||||
" corresponds to generic.\n"
|
||||
"\n"
|
||||
" --input-encoding <ascii | utf8>\n"
|
||||
"\n"
|
||||
" Specify the way re2rust parses regular expressions. With ascii (the\n"
|
||||
" default) re2rust handles input as ASCII-encoded: any sequence of code\n"
|
||||
" units is a sequence of standalone 1-byte characters. With utf8 re2rust\n"
|
||||
" handles input as UTF8-encoded and recognizes multibyte characters.\n"
|
||||
"\n"
|
||||
" --invert-captures\n"
|
||||
"\n"
|
||||
" Invert the meaning of capturing and non-capturing groups. By default\n"
|
||||
" (...) is capturing and (! ...) is non-capturing. With this option (!\n"
|
||||
" ...) is capturing and (...) is non-capturing.\n"
|
||||
"\n"
|
||||
" --lang <none | c | d | go | haskell | java | js | ocaml | python | rust | v\n"
|
||||
" | zig>\n"
|
||||
"\n"
|
||||
" Specify the target language. Supported languages are C, D, Go, Haskell,\n"
|
||||
" Java, JS, OCaml, Python, Rust, V, Zig (more languages can be added via\n"
|
||||
" user-defined syntax files, see the --syntax option). Option none\n"
|
||||
" disables default suntax configs, so that the target language is\n"
|
||||
" undefined.\n"
|
||||
"\n"
|
||||
" --location-format <gnu | msvc>\n"
|
||||
"\n"
|
||||
" Specify location format in messages. With gnu locations are printed as\n"
|
||||
" 'filename:line:column: ...'. With msvc locations are printed as\n"
|
||||
" 'filename(line,column) ...'. The default is gnu.\n"
|
||||
"\n"
|
||||
" --loop-switch\n"
|
||||
"\n"
|
||||
" Use \"loop/switch\" code model: encode DFA in form of a loop over a\n"
|
||||
" switch statement, where individual states are switch cases. State is\n"
|
||||
" stored in a variable yystate. Transitions between states update yystate\n"
|
||||
" to the case label of the destination state and continue execution to\n"
|
||||
" the head of the loop.\n"
|
||||
"\n"
|
||||
" --nested-ifs -s\n"
|
||||
"\n"
|
||||
" Use nested if statements instead of switch statements in conditional\n"
|
||||
" jumps. This usually results in more efficient code with non-optimizing\n"
|
||||
" compilers.\n"
|
||||
"\n"
|
||||
" --no-debug-info -i\n"
|
||||
"\n"
|
||||
" Do not output line directives. This may be useful when the generated\n"
|
||||
" code is stored in a version control system (to avoid huge autogenerated\n"
|
||||
" diffs on small changes).\n"
|
||||
"\n"
|
||||
" --no-generation-date\n"
|
||||
"\n"
|
||||
" Suppress date output in the generated file.\n"
|
||||
"\n"
|
||||
" --no-version\n"
|
||||
"\n"
|
||||
" Suppress version output in the generated file.\n"
|
||||
"\n"
|
||||
" --no-unsafe\n"
|
||||
"\n"
|
||||
" Do not generate unsafe wrapper over YYPEEK (this option is specific to\n"
|
||||
" Rust). For performance reasons YYPEEK should avoid bounds-checking, as\n"
|
||||
" the lexer already performs end-of-input checks in a more efficient way.\n"
|
||||
" The user may choose to provide a safe YYPEEK definition, or a\n"
|
||||
" definition that is unsafe only in release builds, in which case the\n"
|
||||
" --no-unsafe option helps to avoid warnings about redundant unsafe\n"
|
||||
" blocks.\n"
|
||||
"\n"
|
||||
" --output -o OUTPUT\n"
|
||||
"\n"
|
||||
" Specify the OUTPUT file.\n"
|
||||
"\n"
|
||||
" --posix-captures, -P\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with POSIX-style capturing groups. The\n"
|
||||
" result is collected into an array yybmatch of capacity 2 * YYMAXNMATCH,\n"
|
||||
" and yynmatch is set to the number of groups for the matching rule.\n"
|
||||
"\n"
|
||||
" --posix-captvars\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with POSIX-style capturing groups. The\n"
|
||||
" result is collected into variables yytl<k>, yytr<k> for k-th capturing\n"
|
||||
" group.\n"
|
||||
"\n"
|
||||
" --recursive-functions\n"
|
||||
"\n"
|
||||
" Use code model based on co-recursive functions, where each DFA state is\n"
|
||||
" a separate function that may call other state-functions or itself.\n"
|
||||
"\n"
|
||||
" --reusable -r\n"
|
||||
"\n"
|
||||
" Deprecated since version 2.2 (reusable blocks are allowed by default\n"
|
||||
" now).\n"
|
||||
"\n"
|
||||
" --skeleton -S\n"
|
||||
"\n"
|
||||
" Ignore user-defined interface code and generate a self-contained\n"
|
||||
" \"skeleton\" program. Additionally, generate input files with strings\n"
|
||||
" derived from the regular grammar and compressed match results that are\n"
|
||||
" used to verify \"skeleton\" behavior on all inputs. This option is useful\n"
|
||||
" for finding bugs in optimizations and code generation. This option is\n"
|
||||
" supported only for C.\n"
|
||||
"\n"
|
||||
" --storable-state -f\n"
|
||||
"\n"
|
||||
" Generate a lexer which can store its inner state. This is useful in\n"
|
||||
" push-model lexers which are stopped by an outer program when there is\n"
|
||||
" not enough input, and then resumed when more input becomes available.\n"
|
||||
" In this mode users should additionally define YYGETSTATE and YYSETSTATE\n"
|
||||
" primitives, and variables yych, yyaccept and state should be part of\n"
|
||||
" the stored lexer state.\n"
|
||||
"\n"
|
||||
" --syntax FILE\n"
|
||||
"\n"
|
||||
" Load configurations from the specified FILE and apply them on top of\n"
|
||||
" the default syntax file. Note that FILE can define only a few\n"
|
||||
" configurations (if it's used to amend the default syntax file), or it\n"
|
||||
" can define a whole new language backend (in the latter case it is\n"
|
||||
" recommended to use --lang none option).\n"
|
||||
"\n"
|
||||
" --tags -T\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with tags.\n"
|
||||
"\n"
|
||||
" --ucs2 --wide-chars -w\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UCS2-encoded input. re2rust assumes that\n"
|
||||
" the character range is 0 -- 0xFFFF and character size is 2 bytes. This\n"
|
||||
" option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --utf8 --utf-8 -8\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads input in UTF-8 encoding. re2rust assumes\n"
|
||||
" that the character range is 0 -- 0x10FFFF and character size is 1 byte.\n"
|
||||
"\n"
|
||||
" --utf16 --utf-16 -x\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UTF16-encoded input. re2rust assumes that\n"
|
||||
" the character range is 0 -- 0x10FFFF and character size is 2 bytes.\n"
|
||||
" This option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --utf32 --unicode -u\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UTF32-encoded input. re2rust assumes that\n"
|
||||
" the character range is 0 -- 0x10FFFF and character size is 4 bytes.\n"
|
||||
" This option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --verbose\n"
|
||||
"\n"
|
||||
" Output a short message in case of success.\n"
|
||||
"\n"
|
||||
" --vernum -V\n"
|
||||
"\n"
|
||||
" Show version information in MMmmpp format (major, minor, patch).\n"
|
||||
"\n"
|
||||
" --version -v\n"
|
||||
"\n"
|
||||
" Show version information.\n"
|
||||
"\n"
|
||||
" --single-pass -1\n"
|
||||
"\n"
|
||||
" Deprecated. Does nothing (single pass is the default now).\n"
|
||||
"\n"
|
||||
" --debug-output -d\n"
|
||||
"\n"
|
||||
" Emit YYDEBUG invocations in the generated code. This is useful to trace\n"
|
||||
" lexer execution.\n"
|
||||
"\n"
|
||||
" --dump-adfa\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after tunneling (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-cfg\n"
|
||||
"\n"
|
||||
" Debug option: output control flow graph of tag variables (in .dot\n"
|
||||
" format).\n"
|
||||
"\n"
|
||||
" --dump-closure-stats\n"
|
||||
"\n"
|
||||
" Debug option: output statistics on the number of states in closure.\n"
|
||||
"\n"
|
||||
" --dump-dfa-det\n"
|
||||
"\n"
|
||||
" Debug option: output DFA immediately after determinization (in .dot\n"
|
||||
" format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-min\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after minimization (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-tagopt\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after tag optimizations (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-tree\n"
|
||||
"\n"
|
||||
" Debug option: output DFA under construction with states represented as\n"
|
||||
" tag history trees (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-raw\n"
|
||||
"\n"
|
||||
" Debug option: output DFA under construction with expanded state-sets\n"
|
||||
" (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-interf\n"
|
||||
"\n"
|
||||
" Debug option: output interference table produced by liveness analysis\n"
|
||||
" of tag variables.\n"
|
||||
"\n"
|
||||
" --dump-nfa\n"
|
||||
"\n"
|
||||
" Debug option: output NFA (in .dot format).\n"
|
||||
"\n"
|
||||
" --emit-dot -D\n"
|
||||
"\n"
|
||||
" Instead of normal output generate lexer graph in .dot format. The\n"
|
||||
" output can be converted to an image with the help of Graphviz (e.g.\n"
|
||||
" something like dot -Tpng -odfa.png dfa.dot).\n"
|
||||
"\n"
|
||||
" --dfa-minimization <moore | table>\n"
|
||||
"\n"
|
||||
" Internal option: DFA minimization algorithm used by re2rust. The moore\n"
|
||||
" option is the Moore algorithm (it is the default). The table option is\n"
|
||||
" the \"table filling\" algorithm. Both algorithms should produce the same\n"
|
||||
" DFA up to states relabeling; table filling is simpler and much slower\n"
|
||||
" and serves as a reference implementation.\n"
|
||||
"\n"
|
||||
" --eager-skip\n"
|
||||
"\n"
|
||||
" Internal option: make the generated lexer advance the input position\n"
|
||||
" eagerly -- immediately after reading the input symbol. This changes the\n"
|
||||
" default behavior when the input position is advanced lazily -- after\n"
|
||||
" transition to the next state.\n"
|
||||
"\n"
|
||||
" --no-lookahead\n"
|
||||
"\n"
|
||||
" Internal option, deprecated. It used to enable TDFA(0) algorithm.\n"
|
||||
" Unlike TDFA(1), TDFA(0) algorithm does not use one-symbol lookahead. It\n"
|
||||
" applies register operations to the incoming transitions rather than the\n"
|
||||
" outgoing ones. Benchmarks showed that TDFA(0) algorithm is less\n"
|
||||
" efficient than TDFA(1).\n"
|
||||
"\n"
|
||||
" --no-optimize-tags\n"
|
||||
"\n"
|
||||
" Internal option: suppress optimization of tag variables (useful for\n"
|
||||
" debugging).\n"
|
||||
"\n"
|
||||
" --posix-closure <gor1 | gtop>\n"
|
||||
"\n"
|
||||
" Internal option: specify shortest-path algorithm used for the\n"
|
||||
" construction of epsilon-closure with POSIX disambiguation semantics:\n"
|
||||
" gor1 (the default) stands for Goldberg-Radzik algorithm, and gtop\n"
|
||||
" stands for \"global topological order\" algorithm.\n"
|
||||
"\n"
|
||||
" --posix-prectable <complex | naive>\n"
|
||||
"\n"
|
||||
" Internal option: specify the algorithm used to compute POSIX precedence\n"
|
||||
" table. The complex algorithm computes precedence table in one traversal\n"
|
||||
" of tag history tree and has quadratic complexity in the number of TNFA\n"
|
||||
" states; it is the default. The naive algorithm has worst-case cubic\n"
|
||||
" complexity in the number of TNFA states, but it is much simpler than\n"
|
||||
" complex and may be slightly faster in non-pathological cases.\n"
|
||||
"\n"
|
||||
" --stadfa\n"
|
||||
"\n"
|
||||
" Internal option, deprecated. It used to enable staDFA algorithm, which\n"
|
||||
" differs from TDFA in that register operations are placed in states\n"
|
||||
" rather than on transitions. Benchmarks showed that staDFA algorithm is\n"
|
||||
" less efficient than TDFA.\n"
|
||||
"\n"
|
||||
" --fixed-tags <none | toplevel | all>\n"
|
||||
"\n"
|
||||
" Internal option: specify whether the fixed-tag optimization should be\n"
|
||||
" applied to all tags (all), none of them (none), or only those in\n"
|
||||
" toplevel concatenation (toplevel). The default is all. \"Fixed\" tags are\n"
|
||||
" those that are located within a fixed distance to some other tag\n"
|
||||
" (called \"base\"). In such cases only the base tag needs to be tracked,\n"
|
||||
" and the value of the fixed tag can be computed as the value of the base\n"
|
||||
" tag plus a static offset. For tags that are under alternative or\n"
|
||||
" repetition it is also necessary to check if the base tag has a no-match\n"
|
||||
" value (in that case fixed tag should also be set to no-match,\n"
|
||||
" disregarding the offset). For tags in top-level concatenation the check\n"
|
||||
" is not needed, because they always match.\n"
|
||||
"\n"
|
||||
"WARNINGS\n"
|
||||
"\n"
|
||||
" -W\n"
|
||||
"\n"
|
||||
" Turn on all warnings.\n"
|
||||
"\n"
|
||||
" -Werror\n"
|
||||
"\n"
|
||||
" Turn warnings into errors. Note that this option alone doesn't turn on\n"
|
||||
" any warnings; it only affects those warnings that have been turned on\n"
|
||||
" so far or will be turned on later.\n"
|
||||
"\n"
|
||||
" -W<warning>\n"
|
||||
"\n"
|
||||
" Turn on warning.\n"
|
||||
"\n"
|
||||
" -Wno-<warning>\n"
|
||||
"\n"
|
||||
" Turn off warning.\n"
|
||||
"\n"
|
||||
" -Werror-<warning>\n"
|
||||
"\n"
|
||||
" Turn on warning and treat it as an error (this implies -W<warning>).\n"
|
||||
"\n"
|
||||
" -Wno-error-<warning>\n"
|
||||
"\n"
|
||||
" Don't treat this particular warning as an error. This doesn't turn off\n"
|
||||
" the warning itself.\n"
|
||||
"\n"
|
||||
" -Wcondition-order\n"
|
||||
"\n"
|
||||
" Warn if the generated program makes implicit assumptions about\n"
|
||||
" condition numbering. One should use either --header option or\n"
|
||||
" conditions block to generate a mapping of condition names to numbers\n"
|
||||
" and then use the autogenerated condition names.\n"
|
||||
"\n"
|
||||
" -Wempty-character-class\n"
|
||||
"\n"
|
||||
" Warn if a regular expression contains an empty character class. Trying\n"
|
||||
" to match an empty character class makes no sense: it should always\n"
|
||||
" fail. However, for backwards compatibility reasons re2rust permits\n"
|
||||
" empty character classes and treats them as empty strings. Use the\n"
|
||||
" --empty-class option to change the default behavior.\n"
|
||||
"\n"
|
||||
" -Wmatch-empty-string\n"
|
||||
"\n"
|
||||
" Warn if a rule is nullable (matches an empty string). If the lexer runs\n"
|
||||
" in a loop and the empty match is unintentional, the lexer may\n"
|
||||
" unexpectedly hang in an infinite loop.\n"
|
||||
"\n"
|
||||
" -Wswapped-range\n"
|
||||
"\n"
|
||||
" Warn if the lower bound of a range is greater than its upper bound. The\n"
|
||||
" default behavior is to silently swap the range bounds.\n"
|
||||
"\n"
|
||||
" -Wundefined-control-flow\n"
|
||||
"\n"
|
||||
" Warn if some input strings cause undefined control flow in the lexer\n"
|
||||
" (the faulty patterns are reported). This is a dangerous and common\n"
|
||||
" mistake. It can be easily fixed by adding the default rule * which has\n"
|
||||
" the lowest priority, matches any code unit, and always consumes a\n"
|
||||
" single code unit.\n"
|
||||
"\n"
|
||||
" -Wunreachable-rules\n"
|
||||
"\n"
|
||||
" Warn about rules that are shadowed by other rules and will never match.\n"
|
||||
"\n"
|
||||
" -Wuseless-escape\n"
|
||||
"\n"
|
||||
" Warn if a symbol is escaped when it shouldn't be. By default, re2rust\n"
|
||||
" silently ignores such escapes, but this may as well indicate a typo or\n"
|
||||
" an error in the escape sequence.\n"
|
||||
"\n"
|
||||
" -Wnondeterministic-tags\n"
|
||||
"\n"
|
||||
" Warn if a tag has n-th degree of nondeterminism, where n is greater\n"
|
||||
" than 1.\n"
|
||||
"\n"
|
||||
" -Wsentinel-in-midrule\n"
|
||||
"\n"
|
||||
" Warn if the sentinel symbol occurs in the middle of a rule --- this may\n"
|
||||
" cause reads past the end of buffer, crashes or memory corruption in the\n"
|
||||
" generated lexer. This warning is only applicable if the sentinel method\n"
|
||||
" of checking for the end of input is used. It is set to an error if\n"
|
||||
" re2c:sentinel configuration is used.\n"
|
||||
"\n"
|
||||
" -Wundefined-syntax-config\n"
|
||||
"\n"
|
||||
" Warn if the syntax file specified with --syntax option is missing\n"
|
||||
" definitions of some configurations. This helps to maintain user-defined\n"
|
||||
" syntax files: if a new release adds configurations, old syntax file\n"
|
||||
" will raise a warning, and the user will be notified. If some\n"
|
||||
" configurations are unused and do not need a definition, they should be\n"
|
||||
" explicitly set to <undefined>.\n"
|
||||
;
|
||||
@@ -0,0 +1,512 @@
|
||||
extern const char* help;
|
||||
const char* help =
|
||||
"USAGE\n"
|
||||
"\n"
|
||||
" re2v [ OPTIONS ] [ WARNINGS ] INPUT\n"
|
||||
"\n"
|
||||
" Input can be either a file or - for stdin.\n"
|
||||
"\n"
|
||||
"OPTIONS\n"
|
||||
"\n"
|
||||
" -? --help -h\n"
|
||||
"\n"
|
||||
" Show help message.\n"
|
||||
"\n"
|
||||
" --api <simple | record | generic>\n"
|
||||
"\n"
|
||||
" Specify the API used by the generated code to interface with used-\n"
|
||||
" defined code. Option simple shold be used in simple cases when there's\n"
|
||||
" no need for buffer refilling and storing lexer state. Option record\n"
|
||||
" should be used when lexer state needs to be stored in a record (struct,\n"
|
||||
" class, etc.). Option generic should be used in complex cases when the\n"
|
||||
" other two APIs are not flexible enough.\n"
|
||||
"\n"
|
||||
" --bit-vectors -b\n"
|
||||
"\n"
|
||||
" Optimize conditional jumps using bit masks. This option implies\n"
|
||||
" --nested-ifs.\n"
|
||||
"\n"
|
||||
" --captures, --leftmost-captures\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with leftmost greedy capturing groups. The\n"
|
||||
" result is collected into an array yybmatch of capacity 2 * YYMAXNMATCH,\n"
|
||||
" and yynmatch is set to the number of groups for the matching rule.\n"
|
||||
"\n"
|
||||
" --captvars, --leftmost-captvars\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with leftmost greedy capturing groups. The\n"
|
||||
" result is collected into variables yytl<k>, yytr<k> for k-th capturing\n"
|
||||
" group.\n"
|
||||
"\n"
|
||||
" --case-insensitive\n"
|
||||
"\n"
|
||||
" Treat single-quoted and double-quoted strings as case-insensitive.\n"
|
||||
"\n"
|
||||
" --case-inverted\n"
|
||||
"\n"
|
||||
" Invert the meaning of single-quoted and double-quoted strings: treat\n"
|
||||
" single-quoted strings as case-sensitive and double-quoted strings as\n"
|
||||
" case-insensitive.\n"
|
||||
"\n"
|
||||
" --case-ranges\n"
|
||||
"\n"
|
||||
" Collapse consecutive cases in a switch statements into a range of the\n"
|
||||
" form low ... high. This syntax is a C/C++ language extension that is\n"
|
||||
" supported by compilers like GCC, Clang and Tcc. The main advantage over\n"
|
||||
" using single cases is smaller generated code and faster generation\n"
|
||||
" time, although for some compilers like Tcc it also results in smaller\n"
|
||||
" binary size. This option is supported only for C.\n"
|
||||
"\n"
|
||||
" --computed-gotos -g\n"
|
||||
"\n"
|
||||
" Optimize conditional jumps using non-standard \"computed goto\" extension\n"
|
||||
" (which must be supported by the compiler). re2v generates jump tables\n"
|
||||
" only in complex cases with a lot of conditional branches. Complexity\n"
|
||||
" threshold can be configured with cgoto:threshold configuration. This\n"
|
||||
" option implies --bit-vectors. It is supported only for C.\n"
|
||||
"\n"
|
||||
" --conditions --start-conditions -c\n"
|
||||
"\n"
|
||||
" Enable support of Flex-like \"conditions\": multiple interrelated lexers\n"
|
||||
" within one block. This is an alternative to manually specifying\n"
|
||||
" different re2v blocks connected with goto or function calls.\n"
|
||||
"\n"
|
||||
" --depfile FILE\n"
|
||||
"\n"
|
||||
" Write dependency information to FILE in the form of a Makefile rule\n"
|
||||
" <output-file> : <input-file> [include-file ...]. This allows one to\n"
|
||||
" track build dependencies in the presence of include blocks/directives,\n"
|
||||
" so that updating include files triggers regeneration of the output\n"
|
||||
" file. This option depends on the --output option.\n"
|
||||
"\n"
|
||||
" --ebcdic --ecb -e\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads input in EBCDIC encoding. re2v assumes that\n"
|
||||
" the character range is 0 -- 0xFF and character size is 1 byte.\n"
|
||||
"\n"
|
||||
" --empty-class <match-empty | match-none | error>\n"
|
||||
"\n"
|
||||
" Define the way re2v treats empty character classes. With match-empty\n"
|
||||
" (the default) empty class matches empty input (which is illogical, but\n"
|
||||
" backwards-compatible). With match-none empty class always fails to\n"
|
||||
" match. With error empty class raises a compilation error.\n"
|
||||
"\n"
|
||||
" --encoding-policy <fail | substitute | ignore>\n"
|
||||
"\n"
|
||||
" Define the way re2v treats Unicode surrogates. With fail re2v aborts\n"
|
||||
" with an error when a surrogate is encountered. With substitute re2v\n"
|
||||
" silently replaces surrogates with the error code point 0xFFFD. With\n"
|
||||
" ignore (the default) re2v treats surrogates as normal code points. The\n"
|
||||
" Unicode standard says that standalone surrogates are invalid, but real-\n"
|
||||
" world libraries and programs behave in different ways.\n"
|
||||
"\n"
|
||||
" --flex-syntax -F\n"
|
||||
"\n"
|
||||
" Partial support for Flex syntax: in this mode named definitions don't\n"
|
||||
" need the equal sign and the terminating semicolon, and when used they\n"
|
||||
" must be surrounded with curly braces. Names without curly braces are\n"
|
||||
" treated as double-quoted strings.\n"
|
||||
"\n"
|
||||
" --goto-label\n"
|
||||
"\n"
|
||||
" Use \"goto/label\" code model: encode DFA in form of labeled code blocks\n"
|
||||
" connected with goto transitions across blocks. This is only supported\n"
|
||||
" for languages that have a goto statement.\n"
|
||||
"\n"
|
||||
" --header --type-header -t HEADER\n"
|
||||
"\n"
|
||||
" Generate a HEADER file. The contents of the file can be specified using\n"
|
||||
" special blocks header:on and header:off. If conditions are used, the\n"
|
||||
" generated header will have a condition enum automatically appended to\n"
|
||||
" it (unless there is an explicit conditions block).\n"
|
||||
"\n"
|
||||
" -I PATH\n"
|
||||
"\n"
|
||||
" Add PATH to the list of locations which are used when searching for\n"
|
||||
" include files. This option is useful in combination with include block\n"
|
||||
" or directive. re2v looks for FILE in the directory of the parent file\n"
|
||||
" and in the include locations specified with -I option.\n"
|
||||
"\n"
|
||||
" --input <default | custom>\n"
|
||||
"\n"
|
||||
" Deprecated alias for --api. Option default corresponds to simple (it is\n"
|
||||
" indeed the default for most backends, but not for all). Option custom\n"
|
||||
" corresponds to generic.\n"
|
||||
"\n"
|
||||
" --input-encoding <ascii | utf8>\n"
|
||||
"\n"
|
||||
" Specify the way re2v parses regular expressions. With ascii (the\n"
|
||||
" default) re2v handles input as ASCII-encoded: any sequence of code\n"
|
||||
" units is a sequence of standalone 1-byte characters. With utf8 re2v\n"
|
||||
" handles input as UTF8-encoded and recognizes multibyte characters.\n"
|
||||
"\n"
|
||||
" --invert-captures\n"
|
||||
"\n"
|
||||
" Invert the meaning of capturing and non-capturing groups. By default\n"
|
||||
" (...) is capturing and (! ...) is non-capturing. With this option (!\n"
|
||||
" ...) is capturing and (...) is non-capturing.\n"
|
||||
"\n"
|
||||
" --lang <none | c | d | go | haskell | java | js | ocaml | python | rust | v\n"
|
||||
" | zig>\n"
|
||||
"\n"
|
||||
" Specify the target language. Supported languages are C, D, Go, Haskell,\n"
|
||||
" Java, JS, OCaml, Python, Rust, V, Zig (more languages can be added via\n"
|
||||
" user-defined syntax files, see the --syntax option). Option none\n"
|
||||
" disables default suntax configs, so that the target language is\n"
|
||||
" undefined.\n"
|
||||
"\n"
|
||||
" --location-format <gnu | msvc>\n"
|
||||
"\n"
|
||||
" Specify location format in messages. With gnu locations are printed as\n"
|
||||
" 'filename:line:column: ...'. With msvc locations are printed as\n"
|
||||
" 'filename(line,column) ...'. The default is gnu.\n"
|
||||
"\n"
|
||||
" --loop-switch\n"
|
||||
"\n"
|
||||
" Use \"loop/switch\" code model: encode DFA in form of a loop over a\n"
|
||||
" switch statement, where individual states are switch cases. State is\n"
|
||||
" stored in a variable yystate. Transitions between states update yystate\n"
|
||||
" to the case label of the destination state and continue execution to\n"
|
||||
" the head of the loop.\n"
|
||||
"\n"
|
||||
" --nested-ifs -s\n"
|
||||
"\n"
|
||||
" Use nested if statements instead of switch statements in conditional\n"
|
||||
" jumps. This usually results in more efficient code with non-optimizing\n"
|
||||
" compilers.\n"
|
||||
"\n"
|
||||
" --no-debug-info -i\n"
|
||||
"\n"
|
||||
" Do not output line directives. This may be useful when the generated\n"
|
||||
" code is stored in a version control system (to avoid huge autogenerated\n"
|
||||
" diffs on small changes).\n"
|
||||
"\n"
|
||||
" --no-generation-date\n"
|
||||
"\n"
|
||||
" Suppress date output in the generated file.\n"
|
||||
"\n"
|
||||
" --no-version\n"
|
||||
"\n"
|
||||
" Suppress version output in the generated file.\n"
|
||||
"\n"
|
||||
" --no-unsafe\n"
|
||||
"\n"
|
||||
" Do not generate unsafe wrapper over YYPEEK (this option is specific to\n"
|
||||
" Rust). For performance reasons YYPEEK should avoid bounds-checking, as\n"
|
||||
" the lexer already performs end-of-input checks in a more efficient way.\n"
|
||||
" The user may choose to provide a safe YYPEEK definition, or a\n"
|
||||
" definition that is unsafe only in release builds, in which case the\n"
|
||||
" --no-unsafe option helps to avoid warnings about redundant unsafe\n"
|
||||
" blocks.\n"
|
||||
"\n"
|
||||
" --output -o OUTPUT\n"
|
||||
"\n"
|
||||
" Specify the OUTPUT file.\n"
|
||||
"\n"
|
||||
" --posix-captures, -P\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with POSIX-style capturing groups. The\n"
|
||||
" result is collected into an array yybmatch of capacity 2 * YYMAXNMATCH,\n"
|
||||
" and yynmatch is set to the number of groups for the matching rule.\n"
|
||||
"\n"
|
||||
" --posix-captvars\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with POSIX-style capturing groups. The\n"
|
||||
" result is collected into variables yytl<k>, yytr<k> for k-th capturing\n"
|
||||
" group.\n"
|
||||
"\n"
|
||||
" --recursive-functions\n"
|
||||
"\n"
|
||||
" Use code model based on co-recursive functions, where each DFA state is\n"
|
||||
" a separate function that may call other state-functions or itself.\n"
|
||||
"\n"
|
||||
" --reusable -r\n"
|
||||
"\n"
|
||||
" Deprecated since version 2.2 (reusable blocks are allowed by default\n"
|
||||
" now).\n"
|
||||
"\n"
|
||||
" --skeleton -S\n"
|
||||
"\n"
|
||||
" Ignore user-defined interface code and generate a self-contained\n"
|
||||
" \"skeleton\" program. Additionally, generate input files with strings\n"
|
||||
" derived from the regular grammar and compressed match results that are\n"
|
||||
" used to verify \"skeleton\" behavior on all inputs. This option is useful\n"
|
||||
" for finding bugs in optimizations and code generation. This option is\n"
|
||||
" supported only for C.\n"
|
||||
"\n"
|
||||
" --storable-state -f\n"
|
||||
"\n"
|
||||
" Generate a lexer which can store its inner state. This is useful in\n"
|
||||
" push-model lexers which are stopped by an outer program when there is\n"
|
||||
" not enough input, and then resumed when more input becomes available.\n"
|
||||
" In this mode users should additionally define YYGETSTATE and YYSETSTATE\n"
|
||||
" primitives, and variables yych, yyaccept and state should be part of\n"
|
||||
" the stored lexer state.\n"
|
||||
"\n"
|
||||
" --syntax FILE\n"
|
||||
"\n"
|
||||
" Load configurations from the specified FILE and apply them on top of\n"
|
||||
" the default syntax file. Note that FILE can define only a few\n"
|
||||
" configurations (if it's used to amend the default syntax file), or it\n"
|
||||
" can define a whole new language backend (in the latter case it is\n"
|
||||
" recommended to use --lang none option).\n"
|
||||
"\n"
|
||||
" --tags -T\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with tags.\n"
|
||||
"\n"
|
||||
" --ucs2 --wide-chars -w\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UCS2-encoded input. re2v assumes that the\n"
|
||||
" character range is 0 -- 0xFFFF and character size is 2 bytes. This\n"
|
||||
" option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --utf8 --utf-8 -8\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads input in UTF-8 encoding. re2v assumes that\n"
|
||||
" the character range is 0 -- 0x10FFFF and character size is 1 byte.\n"
|
||||
"\n"
|
||||
" --utf16 --utf-16 -x\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UTF16-encoded input. re2v assumes that the\n"
|
||||
" character range is 0 -- 0x10FFFF and character size is 2 bytes. This\n"
|
||||
" option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --utf32 --unicode -u\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UTF32-encoded input. re2v assumes that the\n"
|
||||
" character range is 0 -- 0x10FFFF and character size is 4 bytes. This\n"
|
||||
" option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --verbose\n"
|
||||
"\n"
|
||||
" Output a short message in case of success.\n"
|
||||
"\n"
|
||||
" --vernum -V\n"
|
||||
"\n"
|
||||
" Show version information in MMmmpp format (major, minor, patch).\n"
|
||||
"\n"
|
||||
" --version -v\n"
|
||||
"\n"
|
||||
" Show version information.\n"
|
||||
"\n"
|
||||
" --single-pass -1\n"
|
||||
"\n"
|
||||
" Deprecated. Does nothing (single pass is the default now).\n"
|
||||
"\n"
|
||||
" --debug-output -d\n"
|
||||
"\n"
|
||||
" Emit YYDEBUG invocations in the generated code. This is useful to trace\n"
|
||||
" lexer execution.\n"
|
||||
"\n"
|
||||
" --dump-adfa\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after tunneling (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-cfg\n"
|
||||
"\n"
|
||||
" Debug option: output control flow graph of tag variables (in .dot\n"
|
||||
" format).\n"
|
||||
"\n"
|
||||
" --dump-closure-stats\n"
|
||||
"\n"
|
||||
" Debug option: output statistics on the number of states in closure.\n"
|
||||
"\n"
|
||||
" --dump-dfa-det\n"
|
||||
"\n"
|
||||
" Debug option: output DFA immediately after determinization (in .dot\n"
|
||||
" format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-min\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after minimization (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-tagopt\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after tag optimizations (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-tree\n"
|
||||
"\n"
|
||||
" Debug option: output DFA under construction with states represented as\n"
|
||||
" tag history trees (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-raw\n"
|
||||
"\n"
|
||||
" Debug option: output DFA under construction with expanded state-sets\n"
|
||||
" (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-interf\n"
|
||||
"\n"
|
||||
" Debug option: output interference table produced by liveness analysis\n"
|
||||
" of tag variables.\n"
|
||||
"\n"
|
||||
" --dump-nfa\n"
|
||||
"\n"
|
||||
" Debug option: output NFA (in .dot format).\n"
|
||||
"\n"
|
||||
" --emit-dot -D\n"
|
||||
"\n"
|
||||
" Instead of normal output generate lexer graph in .dot format. The\n"
|
||||
" output can be converted to an image with the help of Graphviz (e.g.\n"
|
||||
" something like dot -Tpng -odfa.png dfa.dot).\n"
|
||||
"\n"
|
||||
" --dfa-minimization <moore | table>\n"
|
||||
"\n"
|
||||
" Internal option: DFA minimization algorithm used by re2v. The moore\n"
|
||||
" option is the Moore algorithm (it is the default). The table option is\n"
|
||||
" the \"table filling\" algorithm. Both algorithms should produce the same\n"
|
||||
" DFA up to states relabeling; table filling is simpler and much slower\n"
|
||||
" and serves as a reference implementation.\n"
|
||||
"\n"
|
||||
" --eager-skip\n"
|
||||
"\n"
|
||||
" Internal option: make the generated lexer advance the input position\n"
|
||||
" eagerly -- immediately after reading the input symbol. This changes the\n"
|
||||
" default behavior when the input position is advanced lazily -- after\n"
|
||||
" transition to the next state.\n"
|
||||
"\n"
|
||||
" --no-lookahead\n"
|
||||
"\n"
|
||||
" Internal option, deprecated. It used to enable TDFA(0) algorithm.\n"
|
||||
" Unlike TDFA(1), TDFA(0) algorithm does not use one-symbol lookahead. It\n"
|
||||
" applies register operations to the incoming transitions rather than the\n"
|
||||
" outgoing ones. Benchmarks showed that TDFA(0) algorithm is less\n"
|
||||
" efficient than TDFA(1).\n"
|
||||
"\n"
|
||||
" --no-optimize-tags\n"
|
||||
"\n"
|
||||
" Internal option: suppress optimization of tag variables (useful for\n"
|
||||
" debugging).\n"
|
||||
"\n"
|
||||
" --posix-closure <gor1 | gtop>\n"
|
||||
"\n"
|
||||
" Internal option: specify shortest-path algorithm used for the\n"
|
||||
" construction of epsilon-closure with POSIX disambiguation semantics:\n"
|
||||
" gor1 (the default) stands for Goldberg-Radzik algorithm, and gtop\n"
|
||||
" stands for \"global topological order\" algorithm.\n"
|
||||
"\n"
|
||||
" --posix-prectable <complex | naive>\n"
|
||||
"\n"
|
||||
" Internal option: specify the algorithm used to compute POSIX precedence\n"
|
||||
" table. The complex algorithm computes precedence table in one traversal\n"
|
||||
" of tag history tree and has quadratic complexity in the number of TNFA\n"
|
||||
" states; it is the default. The naive algorithm has worst-case cubic\n"
|
||||
" complexity in the number of TNFA states, but it is much simpler than\n"
|
||||
" complex and may be slightly faster in non-pathological cases.\n"
|
||||
"\n"
|
||||
" --stadfa\n"
|
||||
"\n"
|
||||
" Internal option, deprecated. It used to enable staDFA algorithm, which\n"
|
||||
" differs from TDFA in that register operations are placed in states\n"
|
||||
" rather than on transitions. Benchmarks showed that staDFA algorithm is\n"
|
||||
" less efficient than TDFA.\n"
|
||||
"\n"
|
||||
" --fixed-tags <none | toplevel | all>\n"
|
||||
"\n"
|
||||
" Internal option: specify whether the fixed-tag optimization should be\n"
|
||||
" applied to all tags (all), none of them (none), or only those in\n"
|
||||
" toplevel concatenation (toplevel). The default is all. \"Fixed\" tags are\n"
|
||||
" those that are located within a fixed distance to some other tag\n"
|
||||
" (called \"base\"). In such cases only the base tag needs to be tracked,\n"
|
||||
" and the value of the fixed tag can be computed as the value of the base\n"
|
||||
" tag plus a static offset. For tags that are under alternative or\n"
|
||||
" repetition it is also necessary to check if the base tag has a no-match\n"
|
||||
" value (in that case fixed tag should also be set to no-match,\n"
|
||||
" disregarding the offset). For tags in top-level concatenation the check\n"
|
||||
" is not needed, because they always match.\n"
|
||||
"\n"
|
||||
"WARNINGS\n"
|
||||
"\n"
|
||||
" -W\n"
|
||||
"\n"
|
||||
" Turn on all warnings.\n"
|
||||
"\n"
|
||||
" -Werror\n"
|
||||
"\n"
|
||||
" Turn warnings into errors. Note that this option alone doesn't turn on\n"
|
||||
" any warnings; it only affects those warnings that have been turned on\n"
|
||||
" so far or will be turned on later.\n"
|
||||
"\n"
|
||||
" -W<warning>\n"
|
||||
"\n"
|
||||
" Turn on warning.\n"
|
||||
"\n"
|
||||
" -Wno-<warning>\n"
|
||||
"\n"
|
||||
" Turn off warning.\n"
|
||||
"\n"
|
||||
" -Werror-<warning>\n"
|
||||
"\n"
|
||||
" Turn on warning and treat it as an error (this implies -W<warning>).\n"
|
||||
"\n"
|
||||
" -Wno-error-<warning>\n"
|
||||
"\n"
|
||||
" Don't treat this particular warning as an error. This doesn't turn off\n"
|
||||
" the warning itself.\n"
|
||||
"\n"
|
||||
" -Wcondition-order\n"
|
||||
"\n"
|
||||
" Warn if the generated program makes implicit assumptions about\n"
|
||||
" condition numbering. One should use either --header option or\n"
|
||||
" conditions block to generate a mapping of condition names to numbers\n"
|
||||
" and then use the autogenerated condition names.\n"
|
||||
"\n"
|
||||
" -Wempty-character-class\n"
|
||||
"\n"
|
||||
" Warn if a regular expression contains an empty character class. Trying\n"
|
||||
" to match an empty character class makes no sense: it should always\n"
|
||||
" fail. However, for backwards compatibility reasons re2v permits empty\n"
|
||||
" character classes and treats them as empty strings. Use the --empty-\n"
|
||||
" class option to change the default behavior.\n"
|
||||
"\n"
|
||||
" -Wmatch-empty-string\n"
|
||||
"\n"
|
||||
" Warn if a rule is nullable (matches an empty string). If the lexer runs\n"
|
||||
" in a loop and the empty match is unintentional, the lexer may\n"
|
||||
" unexpectedly hang in an infinite loop.\n"
|
||||
"\n"
|
||||
" -Wswapped-range\n"
|
||||
"\n"
|
||||
" Warn if the lower bound of a range is greater than its upper bound. The\n"
|
||||
" default behavior is to silently swap the range bounds.\n"
|
||||
"\n"
|
||||
" -Wundefined-control-flow\n"
|
||||
"\n"
|
||||
" Warn if some input strings cause undefined control flow in the lexer\n"
|
||||
" (the faulty patterns are reported). This is a dangerous and common\n"
|
||||
" mistake. It can be easily fixed by adding the default rule * which has\n"
|
||||
" the lowest priority, matches any code unit, and always consumes a\n"
|
||||
" single code unit.\n"
|
||||
"\n"
|
||||
" -Wunreachable-rules\n"
|
||||
"\n"
|
||||
" Warn about rules that are shadowed by other rules and will never match.\n"
|
||||
"\n"
|
||||
" -Wuseless-escape\n"
|
||||
"\n"
|
||||
" Warn if a symbol is escaped when it shouldn't be. By default, re2v\n"
|
||||
" silently ignores such escapes, but this may as well indicate a typo or\n"
|
||||
" an error in the escape sequence.\n"
|
||||
"\n"
|
||||
" -Wnondeterministic-tags\n"
|
||||
"\n"
|
||||
" Warn if a tag has n-th degree of nondeterminism, where n is greater\n"
|
||||
" than 1.\n"
|
||||
"\n"
|
||||
" -Wsentinel-in-midrule\n"
|
||||
"\n"
|
||||
" Warn if the sentinel symbol occurs in the middle of a rule --- this may\n"
|
||||
" cause reads past the end of buffer, crashes or memory corruption in the\n"
|
||||
" generated lexer. This warning is only applicable if the sentinel method\n"
|
||||
" of checking for the end of input is used. It is set to an error if\n"
|
||||
" re2c:sentinel configuration is used.\n"
|
||||
"\n"
|
||||
" -Wundefined-syntax-config\n"
|
||||
"\n"
|
||||
" Warn if the syntax file specified with --syntax option is missing\n"
|
||||
" definitions of some configurations. This helps to maintain user-defined\n"
|
||||
" syntax files: if a new release adds configurations, old syntax file\n"
|
||||
" will raise a warning, and the user will be notified. If some\n"
|
||||
" configurations are unused and do not need a definition, they should be\n"
|
||||
" explicitly set to <undefined>.\n"
|
||||
;
|
||||
@@ -0,0 +1,513 @@
|
||||
extern const char* help;
|
||||
const char* help =
|
||||
"USAGE\n"
|
||||
"\n"
|
||||
" re2zig [ OPTIONS ] [ WARNINGS ] INPUT\n"
|
||||
"\n"
|
||||
" Input can be either a file or - for stdin.\n"
|
||||
"\n"
|
||||
"OPTIONS\n"
|
||||
"\n"
|
||||
" -? --help -h\n"
|
||||
"\n"
|
||||
" Show help message.\n"
|
||||
"\n"
|
||||
" --api <simple | record | generic>\n"
|
||||
"\n"
|
||||
" Specify the API used by the generated code to interface with used-\n"
|
||||
" defined code. Option simple shold be used in simple cases when there's\n"
|
||||
" no need for buffer refilling and storing lexer state. Option record\n"
|
||||
" should be used when lexer state needs to be stored in a record (struct,\n"
|
||||
" class, etc.). Option generic should be used in complex cases when the\n"
|
||||
" other two APIs are not flexible enough.\n"
|
||||
"\n"
|
||||
" --bit-vectors -b\n"
|
||||
"\n"
|
||||
" Optimize conditional jumps using bit masks. This option implies\n"
|
||||
" --nested-ifs.\n"
|
||||
"\n"
|
||||
" --captures, --leftmost-captures\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with leftmost greedy capturing groups. The\n"
|
||||
" result is collected into an array yybmatch of capacity 2 * YYMAXNMATCH,\n"
|
||||
" and yynmatch is set to the number of groups for the matching rule.\n"
|
||||
"\n"
|
||||
" --captvars, --leftmost-captvars\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with leftmost greedy capturing groups. The\n"
|
||||
" result is collected into variables yytl<k>, yytr<k> for k-th capturing\n"
|
||||
" group.\n"
|
||||
"\n"
|
||||
" --case-insensitive\n"
|
||||
"\n"
|
||||
" Treat single-quoted and double-quoted strings as case-insensitive.\n"
|
||||
"\n"
|
||||
" --case-inverted\n"
|
||||
"\n"
|
||||
" Invert the meaning of single-quoted and double-quoted strings: treat\n"
|
||||
" single-quoted strings as case-sensitive and double-quoted strings as\n"
|
||||
" case-insensitive.\n"
|
||||
"\n"
|
||||
" --case-ranges\n"
|
||||
"\n"
|
||||
" Collapse consecutive cases in a switch statements into a range of the\n"
|
||||
" form low ... high. This syntax is a C/C++ language extension that is\n"
|
||||
" supported by compilers like GCC, Clang and Tcc. The main advantage over\n"
|
||||
" using single cases is smaller generated code and faster generation\n"
|
||||
" time, although for some compilers like Tcc it also results in smaller\n"
|
||||
" binary size. This option is supported only for C.\n"
|
||||
"\n"
|
||||
" --computed-gotos -g\n"
|
||||
"\n"
|
||||
" Optimize conditional jumps using non-standard \"computed goto\" extension\n"
|
||||
" (which must be supported by the compiler). re2zig generates jump tables\n"
|
||||
" only in complex cases with a lot of conditional branches. Complexity\n"
|
||||
" threshold can be configured with cgoto:threshold configuration. This\n"
|
||||
" option implies --bit-vectors. It is supported only for C.\n"
|
||||
"\n"
|
||||
" --conditions --start-conditions -c\n"
|
||||
"\n"
|
||||
" Enable support of Flex-like \"conditions\": multiple interrelated lexers\n"
|
||||
" within one block. This is an alternative to manually specifying\n"
|
||||
" different re2zig blocks connected with goto or function calls.\n"
|
||||
"\n"
|
||||
" --depfile FILE\n"
|
||||
"\n"
|
||||
" Write dependency information to FILE in the form of a Makefile rule\n"
|
||||
" <output-file> : <input-file> [include-file ...]. This allows one to\n"
|
||||
" track build dependencies in the presence of include blocks/directives,\n"
|
||||
" so that updating include files triggers regeneration of the output\n"
|
||||
" file. This option depends on the --output option.\n"
|
||||
"\n"
|
||||
" --ebcdic --ecb -e\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads input in EBCDIC encoding. re2zig assumes\n"
|
||||
" that the character range is 0 -- 0xFF and character size is 1 byte.\n"
|
||||
"\n"
|
||||
" --empty-class <match-empty | match-none | error>\n"
|
||||
"\n"
|
||||
" Define the way re2zig treats empty character classes. With match-empty\n"
|
||||
" (the default) empty class matches empty input (which is illogical, but\n"
|
||||
" backwards-compatible). With match-none empty class always fails to\n"
|
||||
" match. With error empty class raises a compilation error.\n"
|
||||
"\n"
|
||||
" --encoding-policy <fail | substitute | ignore>\n"
|
||||
"\n"
|
||||
" Define the way re2zig treats Unicode surrogates. With fail re2zig\n"
|
||||
" aborts with an error when a surrogate is encountered. With substitute\n"
|
||||
" re2zig silently replaces surrogates with the error code point 0xFFFD.\n"
|
||||
" With ignore (the default) re2zig treats surrogates as normal code\n"
|
||||
" points. The Unicode standard says that standalone surrogates are\n"
|
||||
" invalid, but real-world libraries and programs behave in different\n"
|
||||
" ways.\n"
|
||||
"\n"
|
||||
" --flex-syntax -F\n"
|
||||
"\n"
|
||||
" Partial support for Flex syntax: in this mode named definitions don't\n"
|
||||
" need the equal sign and the terminating semicolon, and when used they\n"
|
||||
" must be surrounded with curly braces. Names without curly braces are\n"
|
||||
" treated as double-quoted strings.\n"
|
||||
"\n"
|
||||
" --goto-label\n"
|
||||
"\n"
|
||||
" Use \"goto/label\" code model: encode DFA in form of labeled code blocks\n"
|
||||
" connected with goto transitions across blocks. This is only supported\n"
|
||||
" for languages that have a goto statement.\n"
|
||||
"\n"
|
||||
" --header --type-header -t HEADER\n"
|
||||
"\n"
|
||||
" Generate a HEADER file. The contents of the file can be specified using\n"
|
||||
" special blocks header:on and header:off. If conditions are used, the\n"
|
||||
" generated header will have a condition enum automatically appended to\n"
|
||||
" it (unless there is an explicit conditions block).\n"
|
||||
"\n"
|
||||
" -I PATH\n"
|
||||
"\n"
|
||||
" Add PATH to the list of locations which are used when searching for\n"
|
||||
" include files. This option is useful in combination with include block\n"
|
||||
" or directive. re2zig looks for FILE in the directory of the parent file\n"
|
||||
" and in the include locations specified with -I option.\n"
|
||||
"\n"
|
||||
" --input <default | custom>\n"
|
||||
"\n"
|
||||
" Deprecated alias for --api. Option default corresponds to simple (it is\n"
|
||||
" indeed the default for most backends, but not for all). Option custom\n"
|
||||
" corresponds to generic.\n"
|
||||
"\n"
|
||||
" --input-encoding <ascii | utf8>\n"
|
||||
"\n"
|
||||
" Specify the way re2zig parses regular expressions. With ascii (the\n"
|
||||
" default) re2zig handles input as ASCII-encoded: any sequence of code\n"
|
||||
" units is a sequence of standalone 1-byte characters. With utf8 re2zig\n"
|
||||
" handles input as UTF8-encoded and recognizes multibyte characters.\n"
|
||||
"\n"
|
||||
" --invert-captures\n"
|
||||
"\n"
|
||||
" Invert the meaning of capturing and non-capturing groups. By default\n"
|
||||
" (...) is capturing and (! ...) is non-capturing. With this option (!\n"
|
||||
" ...) is capturing and (...) is non-capturing.\n"
|
||||
"\n"
|
||||
" --lang <none | c | d | go | haskell | java | js | ocaml | python | rust | v\n"
|
||||
" | zig>\n"
|
||||
"\n"
|
||||
" Specify the target language. Supported languages are C, D, Go, Haskell,\n"
|
||||
" Java, JS, OCaml, Python, Rust, V, Zig (more languages can be added via\n"
|
||||
" user-defined syntax files, see the --syntax option). Option none\n"
|
||||
" disables default suntax configs, so that the target language is\n"
|
||||
" undefined.\n"
|
||||
"\n"
|
||||
" --location-format <gnu | msvc>\n"
|
||||
"\n"
|
||||
" Specify location format in messages. With gnu locations are printed as\n"
|
||||
" 'filename:line:column: ...'. With msvc locations are printed as\n"
|
||||
" 'filename(line,column) ...'. The default is gnu.\n"
|
||||
"\n"
|
||||
" --loop-switch\n"
|
||||
"\n"
|
||||
" Use \"loop/switch\" code model: encode DFA in form of a loop over a\n"
|
||||
" switch statement, where individual states are switch cases. State is\n"
|
||||
" stored in a variable yystate. Transitions between states update yystate\n"
|
||||
" to the case label of the destination state and continue execution to\n"
|
||||
" the head of the loop.\n"
|
||||
"\n"
|
||||
" --nested-ifs -s\n"
|
||||
"\n"
|
||||
" Use nested if statements instead of switch statements in conditional\n"
|
||||
" jumps. This usually results in more efficient code with non-optimizing\n"
|
||||
" compilers.\n"
|
||||
"\n"
|
||||
" --no-debug-info -i\n"
|
||||
"\n"
|
||||
" Do not output line directives. This may be useful when the generated\n"
|
||||
" code is stored in a version control system (to avoid huge autogenerated\n"
|
||||
" diffs on small changes).\n"
|
||||
"\n"
|
||||
" --no-generation-date\n"
|
||||
"\n"
|
||||
" Suppress date output in the generated file.\n"
|
||||
"\n"
|
||||
" --no-version\n"
|
||||
"\n"
|
||||
" Suppress version output in the generated file.\n"
|
||||
"\n"
|
||||
" --no-unsafe\n"
|
||||
"\n"
|
||||
" Do not generate unsafe wrapper over YYPEEK (this option is specific to\n"
|
||||
" Rust). For performance reasons YYPEEK should avoid bounds-checking, as\n"
|
||||
" the lexer already performs end-of-input checks in a more efficient way.\n"
|
||||
" The user may choose to provide a safe YYPEEK definition, or a\n"
|
||||
" definition that is unsafe only in release builds, in which case the\n"
|
||||
" --no-unsafe option helps to avoid warnings about redundant unsafe\n"
|
||||
" blocks.\n"
|
||||
"\n"
|
||||
" --output -o OUTPUT\n"
|
||||
"\n"
|
||||
" Specify the OUTPUT file.\n"
|
||||
"\n"
|
||||
" --posix-captures, -P\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with POSIX-style capturing groups. The\n"
|
||||
" result is collected into an array yybmatch of capacity 2 * YYMAXNMATCH,\n"
|
||||
" and yynmatch is set to the number of groups for the matching rule.\n"
|
||||
"\n"
|
||||
" --posix-captvars\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with POSIX-style capturing groups. The\n"
|
||||
" result is collected into variables yytl<k>, yytr<k> for k-th capturing\n"
|
||||
" group.\n"
|
||||
"\n"
|
||||
" --recursive-functions\n"
|
||||
"\n"
|
||||
" Use code model based on co-recursive functions, where each DFA state is\n"
|
||||
" a separate function that may call other state-functions or itself.\n"
|
||||
"\n"
|
||||
" --reusable -r\n"
|
||||
"\n"
|
||||
" Deprecated since version 2.2 (reusable blocks are allowed by default\n"
|
||||
" now).\n"
|
||||
"\n"
|
||||
" --skeleton -S\n"
|
||||
"\n"
|
||||
" Ignore user-defined interface code and generate a self-contained\n"
|
||||
" \"skeleton\" program. Additionally, generate input files with strings\n"
|
||||
" derived from the regular grammar and compressed match results that are\n"
|
||||
" used to verify \"skeleton\" behavior on all inputs. This option is useful\n"
|
||||
" for finding bugs in optimizations and code generation. This option is\n"
|
||||
" supported only for C.\n"
|
||||
"\n"
|
||||
" --storable-state -f\n"
|
||||
"\n"
|
||||
" Generate a lexer which can store its inner state. This is useful in\n"
|
||||
" push-model lexers which are stopped by an outer program when there is\n"
|
||||
" not enough input, and then resumed when more input becomes available.\n"
|
||||
" In this mode users should additionally define YYGETSTATE and YYSETSTATE\n"
|
||||
" primitives, and variables yych, yyaccept and state should be part of\n"
|
||||
" the stored lexer state.\n"
|
||||
"\n"
|
||||
" --syntax FILE\n"
|
||||
"\n"
|
||||
" Load configurations from the specified FILE and apply them on top of\n"
|
||||
" the default syntax file. Note that FILE can define only a few\n"
|
||||
" configurations (if it's used to amend the default syntax file), or it\n"
|
||||
" can define a whole new language backend (in the latter case it is\n"
|
||||
" recommended to use --lang none option).\n"
|
||||
"\n"
|
||||
" --tags -T\n"
|
||||
"\n"
|
||||
" Enable submatch extraction with tags.\n"
|
||||
"\n"
|
||||
" --ucs2 --wide-chars -w\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UCS2-encoded input. re2zig assumes that the\n"
|
||||
" character range is 0 -- 0xFFFF and character size is 2 bytes. This\n"
|
||||
" option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --utf8 --utf-8 -8\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads input in UTF-8 encoding. re2zig assumes\n"
|
||||
" that the character range is 0 -- 0x10FFFF and character size is 1 byte.\n"
|
||||
"\n"
|
||||
" --utf16 --utf-16 -x\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UTF16-encoded input. re2zig assumes that\n"
|
||||
" the character range is 0 -- 0x10FFFF and character size is 2 bytes.\n"
|
||||
" This option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --utf32 --unicode -u\n"
|
||||
"\n"
|
||||
" Generate a lexer that reads UTF32-encoded input. re2zig assumes that\n"
|
||||
" the character range is 0 -- 0x10FFFF and character size is 4 bytes.\n"
|
||||
" This option implies --nested-ifs.\n"
|
||||
"\n"
|
||||
" --verbose\n"
|
||||
"\n"
|
||||
" Output a short message in case of success.\n"
|
||||
"\n"
|
||||
" --vernum -V\n"
|
||||
"\n"
|
||||
" Show version information in MMmmpp format (major, minor, patch).\n"
|
||||
"\n"
|
||||
" --version -v\n"
|
||||
"\n"
|
||||
" Show version information.\n"
|
||||
"\n"
|
||||
" --single-pass -1\n"
|
||||
"\n"
|
||||
" Deprecated. Does nothing (single pass is the default now).\n"
|
||||
"\n"
|
||||
" --debug-output -d\n"
|
||||
"\n"
|
||||
" Emit YYDEBUG invocations in the generated code. This is useful to trace\n"
|
||||
" lexer execution.\n"
|
||||
"\n"
|
||||
" --dump-adfa\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after tunneling (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-cfg\n"
|
||||
"\n"
|
||||
" Debug option: output control flow graph of tag variables (in .dot\n"
|
||||
" format).\n"
|
||||
"\n"
|
||||
" --dump-closure-stats\n"
|
||||
"\n"
|
||||
" Debug option: output statistics on the number of states in closure.\n"
|
||||
"\n"
|
||||
" --dump-dfa-det\n"
|
||||
"\n"
|
||||
" Debug option: output DFA immediately after determinization (in .dot\n"
|
||||
" format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-min\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after minimization (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-tagopt\n"
|
||||
"\n"
|
||||
" Debug option: output DFA after tag optimizations (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-tree\n"
|
||||
"\n"
|
||||
" Debug option: output DFA under construction with states represented as\n"
|
||||
" tag history trees (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-dfa-raw\n"
|
||||
"\n"
|
||||
" Debug option: output DFA under construction with expanded state-sets\n"
|
||||
" (in .dot format).\n"
|
||||
"\n"
|
||||
" --dump-interf\n"
|
||||
"\n"
|
||||
" Debug option: output interference table produced by liveness analysis\n"
|
||||
" of tag variables.\n"
|
||||
"\n"
|
||||
" --dump-nfa\n"
|
||||
"\n"
|
||||
" Debug option: output NFA (in .dot format).\n"
|
||||
"\n"
|
||||
" --emit-dot -D\n"
|
||||
"\n"
|
||||
" Instead of normal output generate lexer graph in .dot format. The\n"
|
||||
" output can be converted to an image with the help of Graphviz (e.g.\n"
|
||||
" something like dot -Tpng -odfa.png dfa.dot).\n"
|
||||
"\n"
|
||||
" --dfa-minimization <moore | table>\n"
|
||||
"\n"
|
||||
" Internal option: DFA minimization algorithm used by re2zig. The moore\n"
|
||||
" option is the Moore algorithm (it is the default). The table option is\n"
|
||||
" the \"table filling\" algorithm. Both algorithms should produce the same\n"
|
||||
" DFA up to states relabeling; table filling is simpler and much slower\n"
|
||||
" and serves as a reference implementation.\n"
|
||||
"\n"
|
||||
" --eager-skip\n"
|
||||
"\n"
|
||||
" Internal option: make the generated lexer advance the input position\n"
|
||||
" eagerly -- immediately after reading the input symbol. This changes the\n"
|
||||
" default behavior when the input position is advanced lazily -- after\n"
|
||||
" transition to the next state.\n"
|
||||
"\n"
|
||||
" --no-lookahead\n"
|
||||
"\n"
|
||||
" Internal option, deprecated. It used to enable TDFA(0) algorithm.\n"
|
||||
" Unlike TDFA(1), TDFA(0) algorithm does not use one-symbol lookahead. It\n"
|
||||
" applies register operations to the incoming transitions rather than the\n"
|
||||
" outgoing ones. Benchmarks showed that TDFA(0) algorithm is less\n"
|
||||
" efficient than TDFA(1).\n"
|
||||
"\n"
|
||||
" --no-optimize-tags\n"
|
||||
"\n"
|
||||
" Internal option: suppress optimization of tag variables (useful for\n"
|
||||
" debugging).\n"
|
||||
"\n"
|
||||
" --posix-closure <gor1 | gtop>\n"
|
||||
"\n"
|
||||
" Internal option: specify shortest-path algorithm used for the\n"
|
||||
" construction of epsilon-closure with POSIX disambiguation semantics:\n"
|
||||
" gor1 (the default) stands for Goldberg-Radzik algorithm, and gtop\n"
|
||||
" stands for \"global topological order\" algorithm.\n"
|
||||
"\n"
|
||||
" --posix-prectable <complex | naive>\n"
|
||||
"\n"
|
||||
" Internal option: specify the algorithm used to compute POSIX precedence\n"
|
||||
" table. The complex algorithm computes precedence table in one traversal\n"
|
||||
" of tag history tree and has quadratic complexity in the number of TNFA\n"
|
||||
" states; it is the default. The naive algorithm has worst-case cubic\n"
|
||||
" complexity in the number of TNFA states, but it is much simpler than\n"
|
||||
" complex and may be slightly faster in non-pathological cases.\n"
|
||||
"\n"
|
||||
" --stadfa\n"
|
||||
"\n"
|
||||
" Internal option, deprecated. It used to enable staDFA algorithm, which\n"
|
||||
" differs from TDFA in that register operations are placed in states\n"
|
||||
" rather than on transitions. Benchmarks showed that staDFA algorithm is\n"
|
||||
" less efficient than TDFA.\n"
|
||||
"\n"
|
||||
" --fixed-tags <none | toplevel | all>\n"
|
||||
"\n"
|
||||
" Internal option: specify whether the fixed-tag optimization should be\n"
|
||||
" applied to all tags (all), none of them (none), or only those in\n"
|
||||
" toplevel concatenation (toplevel). The default is all. \"Fixed\" tags are\n"
|
||||
" those that are located within a fixed distance to some other tag\n"
|
||||
" (called \"base\"). In such cases only the base tag needs to be tracked,\n"
|
||||
" and the value of the fixed tag can be computed as the value of the base\n"
|
||||
" tag plus a static offset. For tags that are under alternative or\n"
|
||||
" repetition it is also necessary to check if the base tag has a no-match\n"
|
||||
" value (in that case fixed tag should also be set to no-match,\n"
|
||||
" disregarding the offset). For tags in top-level concatenation the check\n"
|
||||
" is not needed, because they always match.\n"
|
||||
"\n"
|
||||
"WARNINGS\n"
|
||||
"\n"
|
||||
" -W\n"
|
||||
"\n"
|
||||
" Turn on all warnings.\n"
|
||||
"\n"
|
||||
" -Werror\n"
|
||||
"\n"
|
||||
" Turn warnings into errors. Note that this option alone doesn't turn on\n"
|
||||
" any warnings; it only affects those warnings that have been turned on\n"
|
||||
" so far or will be turned on later.\n"
|
||||
"\n"
|
||||
" -W<warning>\n"
|
||||
"\n"
|
||||
" Turn on warning.\n"
|
||||
"\n"
|
||||
" -Wno-<warning>\n"
|
||||
"\n"
|
||||
" Turn off warning.\n"
|
||||
"\n"
|
||||
" -Werror-<warning>\n"
|
||||
"\n"
|
||||
" Turn on warning and treat it as an error (this implies -W<warning>).\n"
|
||||
"\n"
|
||||
" -Wno-error-<warning>\n"
|
||||
"\n"
|
||||
" Don't treat this particular warning as an error. This doesn't turn off\n"
|
||||
" the warning itself.\n"
|
||||
"\n"
|
||||
" -Wcondition-order\n"
|
||||
"\n"
|
||||
" Warn if the generated program makes implicit assumptions about\n"
|
||||
" condition numbering. One should use either --header option or\n"
|
||||
" conditions block to generate a mapping of condition names to numbers\n"
|
||||
" and then use the autogenerated condition names.\n"
|
||||
"\n"
|
||||
" -Wempty-character-class\n"
|
||||
"\n"
|
||||
" Warn if a regular expression contains an empty character class. Trying\n"
|
||||
" to match an empty character class makes no sense: it should always\n"
|
||||
" fail. However, for backwards compatibility reasons re2zig permits empty\n"
|
||||
" character classes and treats them as empty strings. Use the --empty-\n"
|
||||
" class option to change the default behavior.\n"
|
||||
"\n"
|
||||
" -Wmatch-empty-string\n"
|
||||
"\n"
|
||||
" Warn if a rule is nullable (matches an empty string). If the lexer runs\n"
|
||||
" in a loop and the empty match is unintentional, the lexer may\n"
|
||||
" unexpectedly hang in an infinite loop.\n"
|
||||
"\n"
|
||||
" -Wswapped-range\n"
|
||||
"\n"
|
||||
" Warn if the lower bound of a range is greater than its upper bound. The\n"
|
||||
" default behavior is to silently swap the range bounds.\n"
|
||||
"\n"
|
||||
" -Wundefined-control-flow\n"
|
||||
"\n"
|
||||
" Warn if some input strings cause undefined control flow in the lexer\n"
|
||||
" (the faulty patterns are reported). This is a dangerous and common\n"
|
||||
" mistake. It can be easily fixed by adding the default rule * which has\n"
|
||||
" the lowest priority, matches any code unit, and always consumes a\n"
|
||||
" single code unit.\n"
|
||||
"\n"
|
||||
" -Wunreachable-rules\n"
|
||||
"\n"
|
||||
" Warn about rules that are shadowed by other rules and will never match.\n"
|
||||
"\n"
|
||||
" -Wuseless-escape\n"
|
||||
"\n"
|
||||
" Warn if a symbol is escaped when it shouldn't be. By default, re2zig\n"
|
||||
" silently ignores such escapes, but this may as well indicate a typo or\n"
|
||||
" an error in the escape sequence.\n"
|
||||
"\n"
|
||||
" -Wnondeterministic-tags\n"
|
||||
"\n"
|
||||
" Warn if a tag has n-th degree of nondeterminism, where n is greater\n"
|
||||
" than 1.\n"
|
||||
"\n"
|
||||
" -Wsentinel-in-midrule\n"
|
||||
"\n"
|
||||
" Warn if the sentinel symbol occurs in the middle of a rule --- this may\n"
|
||||
" cause reads past the end of buffer, crashes or memory corruption in the\n"
|
||||
" generated lexer. This warning is only applicable if the sentinel method\n"
|
||||
" of checking for the end of input is used. It is set to an error if\n"
|
||||
" re2c:sentinel configuration is used.\n"
|
||||
"\n"
|
||||
" -Wundefined-syntax-config\n"
|
||||
"\n"
|
||||
" Warn if the syntax file specified with --syntax option is missing\n"
|
||||
" definitions of some configurations. This helps to maintain user-defined\n"
|
||||
" syntax files: if a new release adds configurations, old syntax file\n"
|
||||
" will raise a warning, and the user will be notified. If some\n"
|
||||
" configurations are unused and do not need a definition, they should be\n"
|
||||
" explicitly set to <undefined>.\n"
|
||||
;
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 3.0 */
|
||||
/* Generated by re2c 4.0 */
|
||||
#line 1 "../src/msg/ver_to_vernum.re"
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
@@ -32,39 +32,39 @@ const char *yyt6;
|
||||
#line 33 "src/msg/ver_to_vernum.cc"
|
||||
{
|
||||
YYCTYPE yych;
|
||||
static const unsigned char yybm[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 128, 128, 128, 128, 128, 128, 128,
|
||||
128, 128, 128, 128, 128, 128, 128, 128,
|
||||
128, 128, 128, 128, 128, 128, 128, 128,
|
||||
128, 128, 128, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
static const unsigned char yybm[256] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 128, 128, 128, 128, 128, 128, 128,
|
||||
128, 128, 128, 128, 128, 128, 128, 128,
|
||||
128, 128, 128, 128, 128, 128, 128, 128,
|
||||
128, 128, 128, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
yych = *YYCURSOR;
|
||||
if (yych <= '/') goto yy1;
|
||||
@@ -82,13 +82,19 @@ yy3:
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
if (yych <= '.') {
|
||||
if (yych <= 0x00) {
|
||||
yyt3 = yyt4 = yyt5 = yyt6 = NULL;
|
||||
yyt2 = YYCURSOR;
|
||||
yyt3 = NULL;
|
||||
yyt4 = NULL;
|
||||
yyt5 = NULL;
|
||||
yyt6 = NULL;
|
||||
goto yy4;
|
||||
}
|
||||
if (yych <= '-') goto yy2;
|
||||
yyt3 = yyt4 = yyt5 = yyt6 = NULL;
|
||||
yyt2 = YYCURSOR;
|
||||
yyt3 = NULL;
|
||||
yyt4 = NULL;
|
||||
yyt5 = NULL;
|
||||
yyt6 = NULL;
|
||||
goto yy5;
|
||||
} else {
|
||||
if (yych <= '/') goto yy2;
|
||||
@@ -120,7 +126,7 @@ yy4:
|
||||
|
||||
return std::string(buffer, SIZE);
|
||||
}
|
||||
#line 124 "src/msg/ver_to_vernum.cc"
|
||||
#line 130 "src/msg/ver_to_vernum.cc"
|
||||
yy5:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= 0x00) goto yy6;
|
||||
@@ -136,13 +142,19 @@ yy6:
|
||||
yy7:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= 0x00) {
|
||||
yyt3 = yyt4 = yyt5 = yyt6 = NULL;
|
||||
yyt2 = YYCURSOR;
|
||||
yyt3 = NULL;
|
||||
yyt4 = NULL;
|
||||
yyt5 = NULL;
|
||||
yyt6 = NULL;
|
||||
goto yy4;
|
||||
}
|
||||
if (yych == '.') {
|
||||
yyt3 = yyt4 = yyt5 = yyt6 = NULL;
|
||||
yyt2 = YYCURSOR;
|
||||
yyt3 = NULL;
|
||||
yyt4 = NULL;
|
||||
yyt5 = NULL;
|
||||
yyt6 = NULL;
|
||||
goto yy5;
|
||||
}
|
||||
goto yy6;
|
||||
@@ -150,13 +162,15 @@ yy8:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '.') {
|
||||
if (yych <= 0x00) {
|
||||
yyt5 = yyt6 = NULL;
|
||||
yyt4 = YYCURSOR;
|
||||
yyt5 = NULL;
|
||||
yyt6 = NULL;
|
||||
goto yy4;
|
||||
}
|
||||
if (yych <= '-') goto yy6;
|
||||
yyt5 = yyt6 = NULL;
|
||||
yyt4 = YYCURSOR;
|
||||
yyt5 = NULL;
|
||||
yyt6 = NULL;
|
||||
goto yy11;
|
||||
} else {
|
||||
if (yych <= '/') goto yy6;
|
||||
@@ -166,9 +180,7 @@ yy8:
|
||||
yy9:
|
||||
yych = *++YYCURSOR;
|
||||
yy10:
|
||||
if (yybm[0+yych] & 128) {
|
||||
goto yy9;
|
||||
}
|
||||
if (yybm[0+yych] & 128) goto yy9;
|
||||
if (yych <= 0x00) goto yy4;
|
||||
goto yy6;
|
||||
yy11:
|
||||
@@ -183,13 +195,15 @@ yy11:
|
||||
yy12:
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= 0x00) {
|
||||
yyt5 = yyt6 = NULL;
|
||||
yyt4 = YYCURSOR;
|
||||
yyt5 = NULL;
|
||||
yyt6 = NULL;
|
||||
goto yy4;
|
||||
}
|
||||
if (yych == '.') {
|
||||
yyt5 = yyt6 = NULL;
|
||||
yyt4 = YYCURSOR;
|
||||
yyt5 = NULL;
|
||||
yyt6 = NULL;
|
||||
goto yy11;
|
||||
}
|
||||
goto yy6;
|
||||
@@ -209,9 +223,7 @@ yy13:
|
||||
}
|
||||
yy14:
|
||||
yych = *++YYCURSOR;
|
||||
if (yybm[0+yych] & 128) {
|
||||
goto yy9;
|
||||
}
|
||||
if (yybm[0+yych] & 128) goto yy9;
|
||||
if (yych <= '/') goto yy6;
|
||||
if (yych <= '9') goto yy16;
|
||||
goto yy6;
|
||||
|
||||
+3397
-2800
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,130 @@
|
||||
/* A Bison parser, made by GNU Bison 3.8.2. */
|
||||
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
/* As a special exception, you may create a larger work that contains
|
||||
part or all of the Bison parser skeleton and distribute that work
|
||||
under terms of your choice, so long as that work isn't itself a
|
||||
parser generator using the skeleton or a modified version thereof
|
||||
as a parser skeleton. Alternatively, if you modify or redistribute
|
||||
the parser skeleton itself, you may (at your option) remove this
|
||||
special exception, which will cause the skeleton and the resulting
|
||||
Bison output files to be licensed under the GNU General Public
|
||||
License without this special exception.
|
||||
|
||||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
|
||||
especially those whose name start with YY_ or yy_. They are
|
||||
private implementation details that can be changed or removed. */
|
||||
|
||||
#ifndef YY_CONF_SRC_PARSE_CONF_PARSER_H_INCLUDED
|
||||
# define YY_CONF_SRC_PARSE_CONF_PARSER_H_INCLUDED
|
||||
/* Debug traces. */
|
||||
#ifndef CONF_DEBUG
|
||||
# if defined YYDEBUG
|
||||
#if YYDEBUG
|
||||
# define CONF_DEBUG 1
|
||||
# else
|
||||
# define CONF_DEBUG 0
|
||||
# endif
|
||||
# else /* ! defined YYDEBUG */
|
||||
# define CONF_DEBUG 0
|
||||
# endif /* ! defined YYDEBUG */
|
||||
#endif /* ! defined CONF_DEBUG */
|
||||
#if CONF_DEBUG
|
||||
extern int conf_debug;
|
||||
#endif
|
||||
/* "%code requires" blocks. */
|
||||
#line 1 "../src/parse/conf_parser.ypp"
|
||||
|
||||
|
||||
#include "src/constants.h"
|
||||
#include "src/options/opt.h"
|
||||
|
||||
extern const char* DEFAULT_SYNTAX_C;
|
||||
extern const char* DEFAULT_SYNTAX_D;
|
||||
extern const char* DEFAULT_SYNTAX_GO;
|
||||
extern const char* DEFAULT_SYNTAX_HASKELL;
|
||||
extern const char* DEFAULT_SYNTAX_JAVA;
|
||||
extern const char* DEFAULT_SYNTAX_JS;
|
||||
extern const char* DEFAULT_SYNTAX_OCAML;
|
||||
extern const char* DEFAULT_SYNTAX_PYTHON;
|
||||
extern const char* DEFAULT_SYNTAX_RUST;
|
||||
extern const char* DEFAULT_SYNTAX_V;
|
||||
extern const char* DEFAULT_SYNTAX_ZIG;
|
||||
|
||||
|
||||
#line 76 "src/parse/conf_parser.h"
|
||||
|
||||
/* Token kinds. */
|
||||
#ifndef CONF_TOKENTYPE
|
||||
# define CONF_TOKENTYPE
|
||||
enum conf_tokentype
|
||||
{
|
||||
CONF_EMPTY = -2,
|
||||
CONF_EOF = 0, /* "end of file" */
|
||||
CONF_error = 256, /* error */
|
||||
CONF_UNDEF = 257, /* "invalid token" */
|
||||
CONF_NUMBER = 258, /* CONF_NUMBER */
|
||||
CONF_STRING = 259, /* CONF_STRING */
|
||||
CONF_COND = 260, /* CONF_COND */
|
||||
CONF_VAR = 261, /* CONF_VAR */
|
||||
CONF_CODE = 262, /* CONF_CODE */
|
||||
CONF_GOPT = 263, /* CONF_GOPT */
|
||||
CONF_LOPT = 264, /* CONF_LOPT */
|
||||
CONF_UD = 265 /* CONF_UD */
|
||||
};
|
||||
typedef enum conf_tokentype conf_token_kind_t;
|
||||
#endif
|
||||
|
||||
/* Value type. */
|
||||
#if ! defined CONF_STYPE && ! defined CONF_STYPE_IS_DECLARED
|
||||
union CONF_STYPE
|
||||
{
|
||||
#line 48 "../src/parse/conf_parser.ypp"
|
||||
|
||||
const char* str;
|
||||
int32_t num;
|
||||
bool cond;
|
||||
std::vector<std::string>* list;
|
||||
re2c::StxVarId var;
|
||||
re2c::StxCode* code;
|
||||
re2c::StxCodes* codes;
|
||||
const re2c::StxCodes** codeptr;
|
||||
re2c::StxOpt* opt;
|
||||
re2c::StxGOpt gopt;
|
||||
re2c::StxLOpt lopt;
|
||||
|
||||
#line 117 "src/parse/conf_parser.h"
|
||||
|
||||
};
|
||||
typedef union CONF_STYPE CONF_STYPE;
|
||||
# define CONF_STYPE_IS_TRIVIAL 1
|
||||
# define CONF_STYPE_IS_DECLARED 1
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
int conf_parse (re2c::Input& in, re2c::Opt& opts);
|
||||
|
||||
|
||||
#endif /* !YY_CONF_SRC_PARSE_CONF_PARSER_H_INCLUDED */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 3.0 */
|
||||
/* Generated by re2c 4.0 */
|
||||
|
||||
#ifndef _RE2C_PARSE_LEX_
|
||||
#define _RE2C_PARSE_LEX_
|
||||
@@ -9,11 +9,6 @@
|
||||
|
||||
namespace re2c {
|
||||
|
||||
#line 13 "src/parse/lex.h"
|
||||
#define YYMAXFILL 18
|
||||
#line 68 "../src/parse/lex.re"
|
||||
|
||||
|
||||
struct LexerState {
|
||||
enum class LexMode: uint32_t { NORMAL, FLEX_NAME };
|
||||
|
||||
@@ -21,15 +16,15 @@ struct LexerState {
|
||||
size_t BSIZE;
|
||||
uint8_t* bot, *lim, *cur, *mar, *ctx, *tok, *ptr, *pos, *eof;
|
||||
|
||||
#line 25 "src/parse/lex.h"
|
||||
#line 20 "src/parse/lexer.h"
|
||||
uint8_t* yyt1;uint8_t* yyt2;uint8_t* yyt3;
|
||||
#line 76 "../src/parse/lex.re"
|
||||
#line 78 "../src/parse/lexer.re"
|
||||
|
||||
|
||||
inline LexerState()
|
||||
: mode(LexMode::NORMAL),
|
||||
BSIZE(8192),
|
||||
bot(new uint8_t[BSIZE + YYMAXFILL]),
|
||||
bot(new uint8_t[BSIZE + maxfill()]),
|
||||
lim(bot + BSIZE),
|
||||
cur(lim),
|
||||
mar(lim),
|
||||
@@ -39,17 +34,24 @@ uint8_t* yyt1;uint8_t* yyt2;uint8_t* yyt3;
|
||||
pos(lim),
|
||||
eof(nullptr)
|
||||
|
||||
#line 43 "src/parse/lex.h"
|
||||
#line 38 "src/parse/lexer.h"
|
||||
, yyt1(lim), yyt2(lim), yyt3(lim)
|
||||
#line 90 "../src/parse/lex.re"
|
||||
#line 92 "../src/parse/lexer.re"
|
||||
{
|
||||
memset(lim, 0, YYMAXFILL);
|
||||
memset(lim, 0, maxfill());
|
||||
}
|
||||
|
||||
inline ~LexerState() {
|
||||
delete[] bot;
|
||||
}
|
||||
|
||||
inline void reset_ptrs() {
|
||||
// reset lexer back to its initial state
|
||||
cur = mar = ctx = tok = ptr = pos = lim = bot + BSIZE;
|
||||
memset(lim, 0, maxfill());
|
||||
eof = nullptr;
|
||||
}
|
||||
|
||||
inline void shift_ptrs(ptrdiff_t offs) {
|
||||
lim += offs;
|
||||
cur += offs;
|
||||
@@ -59,12 +61,20 @@ uint8_t* yyt1;uint8_t* yyt2;uint8_t* yyt3;
|
||||
ptr += offs;
|
||||
pos += offs;
|
||||
|
||||
#line 63 "src/parse/lex.h"
|
||||
#line 65 "src/parse/lexer.h"
|
||||
if (yyt1) { yyt1 += offs; }if (yyt2) { yyt2 += offs; }if (yyt3) { yyt3 += offs; }
|
||||
#line 106 "../src/parse/lex.re"
|
||||
#line 115 "../src/parse/lexer.re"
|
||||
|
||||
}
|
||||
|
||||
static size_t maxfill() {
|
||||
return std::max(maxfill_main(), maxfill_conf());
|
||||
}
|
||||
|
||||
private:
|
||||
static size_t maxfill_main();
|
||||
static size_t maxfill_conf();
|
||||
|
||||
FORBID_COPY(LexerState);
|
||||
};
|
||||
|
||||
+165
-157
@@ -63,8 +63,14 @@
|
||||
/* Pull parsers. */
|
||||
#define YYPULL 1
|
||||
|
||||
|
||||
|
||||
/* Substitute the type names. */
|
||||
#define YYSTYPE RE2C_STYPE
|
||||
/* Substitute the variable and function names. */
|
||||
#define yyparse re2c_parse
|
||||
#define yylex re2c_lex
|
||||
#define yyerror re2c_error
|
||||
#define yydebug re2c_debug
|
||||
#define yynerrs re2c_nerrs
|
||||
|
||||
/* First part of user prologue. */
|
||||
#line 10 "../src/parse/parser.ypp"
|
||||
@@ -87,7 +93,7 @@ extern "C" {
|
||||
}
|
||||
|
||||
|
||||
#line 91 "src/parse/parser.cc"
|
||||
#line 97 "src/parse/parser.cc"
|
||||
|
||||
# ifndef YY_CAST
|
||||
# ifdef __cplusplus
|
||||
@@ -144,21 +150,22 @@ enum yysymbol_kind_t
|
||||
YYSYMBOL_26_ = 26, /* '?' */
|
||||
YYSYMBOL_27_ = 27, /* '(' */
|
||||
YYSYMBOL_28_ = 28, /* ')' */
|
||||
YYSYMBOL_YYACCEPT = 29, /* $accept */
|
||||
YYSYMBOL_spec = 30, /* spec */
|
||||
YYSYMBOL_def = 31, /* def */
|
||||
YYSYMBOL_name = 32, /* name */
|
||||
YYSYMBOL_enddef = 33, /* enddef */
|
||||
YYSYMBOL_rule = 34, /* rule */
|
||||
YYSYMBOL_ccode = 35, /* ccode */
|
||||
YYSYMBOL_trailexpr = 36, /* trailexpr */
|
||||
YYSYMBOL_expr = 37, /* expr */
|
||||
YYSYMBOL_diff = 38, /* diff */
|
||||
YYSYMBOL_term = 39, /* term */
|
||||
YYSYMBOL_factor = 40, /* factor */
|
||||
YYSYMBOL_closes = 41, /* closes */
|
||||
YYSYMBOL_close = 42, /* close */
|
||||
YYSYMBOL_primary = 43 /* primary */
|
||||
YYSYMBOL_29_ = 29, /* '!' */
|
||||
YYSYMBOL_YYACCEPT = 30, /* $accept */
|
||||
YYSYMBOL_spec = 31, /* spec */
|
||||
YYSYMBOL_def = 32, /* def */
|
||||
YYSYMBOL_name = 33, /* name */
|
||||
YYSYMBOL_enddef = 34, /* enddef */
|
||||
YYSYMBOL_rule = 35, /* rule */
|
||||
YYSYMBOL_ccode = 36, /* ccode */
|
||||
YYSYMBOL_trailexpr = 37, /* trailexpr */
|
||||
YYSYMBOL_expr = 38, /* expr */
|
||||
YYSYMBOL_diff = 39, /* diff */
|
||||
YYSYMBOL_term = 40, /* term */
|
||||
YYSYMBOL_factor = 41, /* factor */
|
||||
YYSYMBOL_closes = 42, /* closes */
|
||||
YYSYMBOL_close = 43, /* close */
|
||||
YYSYMBOL_primary = 44 /* primary */
|
||||
};
|
||||
typedef enum yysymbol_kind_t yysymbol_kind_t;
|
||||
|
||||
@@ -425,7 +432,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
|
||||
|
||||
#if (! defined yyoverflow \
|
||||
&& (! defined __cplusplus \
|
||||
|| (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
|
||||
|| (defined RE2C_STYPE_IS_TRIVIAL && RE2C_STYPE_IS_TRIVIAL)))
|
||||
|
||||
/* A type that is properly aligned for any stack member. */
|
||||
union yyalloc
|
||||
@@ -486,10 +493,10 @@ union yyalloc
|
||||
/* YYFINAL -- State number of the termination state. */
|
||||
#define YYFINAL 2
|
||||
/* YYLAST -- Last index in YYTABLE. */
|
||||
#define YYLAST 64
|
||||
#define YYLAST 67
|
||||
|
||||
/* YYNTOKENS -- Number of terminals. */
|
||||
#define YYNTOKENS 29
|
||||
#define YYNTOKENS 30
|
||||
/* YYNNTS -- Number of nonterminals. */
|
||||
#define YYNNTS 15
|
||||
/* YYNRULES -- Number of rules. */
|
||||
@@ -515,7 +522,7 @@ static const yytype_int8 yytranslate[] =
|
||||
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 22, 2, 2, 2,
|
||||
2, 2, 2, 29, 2, 2, 22, 2, 2, 2,
|
||||
27, 28, 21, 25, 2, 2, 2, 18, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 20,
|
||||
2, 19, 2, 26, 2, 2, 2, 2, 2, 2,
|
||||
@@ -542,22 +549,22 @@ static const yytype_int8 yytranslate[] =
|
||||
15, 16, 17
|
||||
};
|
||||
|
||||
#if YYDEBUG
|
||||
#if RE2C_DEBUG
|
||||
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
|
||||
static const yytype_uint8 yyrline[] =
|
||||
{
|
||||
0, 76, 76, 77, 81, 85, 86, 87, 91, 94,
|
||||
100, 101, 104, 104, 107, 110, 113, 116, 122, 128,
|
||||
134, 140, 147, 148, 153, 158, 159, 164, 165, 169,
|
||||
170, 174, 176, 180, 181, 194, 200, 201, 205, 206,
|
||||
207, 211, 212, 221, 222
|
||||
0, 77, 77, 78, 82, 86, 87, 88, 92, 95,
|
||||
101, 102, 105, 105, 108, 111, 114, 117, 123, 129,
|
||||
135, 141, 148, 149, 154, 159, 160, 166, 167, 171,
|
||||
172, 176, 178, 182, 183, 196, 202, 203, 207, 208,
|
||||
209, 213, 214, 223, 224
|
||||
};
|
||||
#endif
|
||||
|
||||
/** Accessing symbol of state STATE. */
|
||||
#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
|
||||
|
||||
#if YYDEBUG || 0
|
||||
#if RE2C_DEBUG || 0
|
||||
/* The user-facing name of the symbol whose (internal) number is
|
||||
YYSYMBOL. No bounds checking. */
|
||||
static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
|
||||
@@ -571,8 +578,8 @@ static const char *const yytname[] =
|
||||
"TOKEN_CLOSESIZE", "TOKEN_CODE", "TOKEN_CONF", "TOKEN_ID", "TOKEN_FID",
|
||||
"TOKEN_FID_END", "TOKEN_LINE_INFO", "TOKEN_REGEXP", "TOKEN_BLOCK",
|
||||
"TOKEN_ERROR", "'/'", "'='", "';'", "'*'", "'$'", "'|'", "'\\\\'", "'+'",
|
||||
"'?'", "'('", "')'", "$accept", "spec", "def", "name", "enddef", "rule",
|
||||
"ccode", "trailexpr", "expr", "diff", "term", "factor", "closes",
|
||||
"'?'", "'('", "')'", "'!'", "$accept", "spec", "def", "name", "enddef",
|
||||
"rule", "ccode", "trailexpr", "expr", "diff", "term", "factor", "closes",
|
||||
"close", "primary", YY_NULLPTR
|
||||
};
|
||||
|
||||
@@ -597,13 +604,13 @@ yysymbol_name (yysymbol_kind_t yysymbol)
|
||||
STATE-NUM. */
|
||||
static const yytype_int8 yypact[] =
|
||||
{
|
||||
-20, 0, -20, 14, -1, 36, -20, -18, -20, -20,
|
||||
-20, -20, 11, 45, 22, -20, 23, -20, 52, 24,
|
||||
-15, -20, 23, 5, -20, 36, 36, 36, -20, -20,
|
||||
53, -20, -20, -20, -20, -20, 23, 29, 33, -20,
|
||||
23, 23, 23, -20, -20, -20, -20, -20, 34, -20,
|
||||
-20, -20, -20, -20, 35, -20, -20, -20, -20, -20,
|
||||
9, -15, -20, -20, -20
|
||||
-20, 0, -20, 19, -8, 46, -20, -11, -20, -20,
|
||||
-20, -20, 9, 17, 2, -20, 24, -20, 33, 35,
|
||||
-15, -20, 24, 11, -20, 46, 46, 46, -20, -20,
|
||||
38, -20, -20, -20, -20, -20, 24, -3, 25, -20,
|
||||
24, 24, 24, -20, -20, -20, -20, -20, 31, -20,
|
||||
-20, -20, -20, -20, 36, -20, -20, -20, -20, -20,
|
||||
10, -15, -20, -20, -20
|
||||
};
|
||||
|
||||
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
|
||||
@@ -623,8 +630,8 @@ static const yytype_int8 yydefact[] =
|
||||
/* YYPGOTO[NTERM-NUM]. */
|
||||
static const yytype_int8 yypgoto[] =
|
||||
{
|
||||
-20, -20, -20, -20, -20, -20, -8, 40, -12, 3,
|
||||
-19, -20, -20, 16, -20
|
||||
-20, -20, -20, -20, -20, -20, 40, 41, -12, 13,
|
||||
-19, -20, -20, 12, -20
|
||||
};
|
||||
|
||||
/* YYDEFGOTO[NTERM-NUM]. */
|
||||
@@ -639,47 +646,47 @@ static const yytype_int8 yydefgoto[] =
|
||||
number is the opposite. If YYTABLE_NINF, syntax error. */
|
||||
static const yytype_int8 yytable[] =
|
||||
{
|
||||
2, 33, 37, 43, 38, 3, 4, 5, 28, 42,
|
||||
6, 7, 8, 44, 9, 10, 11, 50, 51, 52,
|
||||
34, 12, 13, 62, 54, 24, 45, 14, 60, 10,
|
||||
46, 47, 41, 24, 24, 25, 26, 10, 10, 29,
|
||||
30, 14, 40, 27, 61, 31, 56, 41, 36, 14,
|
||||
14, 57, 41, 58, 35, 45, 41, 55, 41, 46,
|
||||
47, 39, 53, 64, 63
|
||||
2, 28, 37, 43, 38, 3, 4, 5, 33, 42,
|
||||
6, 7, 8, 24, 9, 10, 11, 10, 34, 44,
|
||||
41, 12, 13, 62, 54, 55, 35, 14, 60, 14,
|
||||
24, 36, 45, 41, 10, 24, 46, 47, 56, 10,
|
||||
25, 26, 39, 57, 27, 58, 14, 53, 41, 29,
|
||||
30, 14, 45, 40, 61, 31, 46, 47, 41, 41,
|
||||
63, 0, 0, 0, 64, 50, 51, 52
|
||||
};
|
||||
|
||||
static const yytype_int8 yycheck[] =
|
||||
{
|
||||
0, 19, 14, 22, 16, 5, 6, 7, 9, 24,
|
||||
10, 11, 12, 8, 14, 15, 16, 25, 26, 27,
|
||||
9, 21, 22, 42, 36, 11, 21, 27, 40, 15,
|
||||
25, 26, 23, 11, 11, 21, 22, 15, 15, 3,
|
||||
4, 27, 18, 3, 41, 9, 13, 23, 26, 27,
|
||||
27, 18, 23, 20, 9, 21, 23, 28, 23, 25,
|
||||
26, 9, 9, 28, 48
|
||||
0, 9, 14, 22, 16, 5, 6, 7, 19, 24,
|
||||
10, 11, 12, 11, 14, 15, 16, 15, 9, 8,
|
||||
23, 21, 22, 42, 36, 28, 9, 27, 40, 27,
|
||||
11, 29, 21, 23, 15, 11, 25, 26, 13, 15,
|
||||
21, 22, 9, 18, 3, 20, 27, 9, 23, 3,
|
||||
4, 27, 21, 18, 41, 9, 25, 26, 23, 23,
|
||||
48, -1, -1, -1, 28, 25, 26, 27
|
||||
};
|
||||
|
||||
/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
|
||||
state STATE-NUM. */
|
||||
static const yytype_int8 yystos[] =
|
||||
{
|
||||
0, 30, 0, 5, 6, 7, 10, 11, 12, 14,
|
||||
15, 16, 21, 22, 27, 31, 32, 34, 36, 37,
|
||||
38, 39, 40, 43, 11, 21, 22, 36, 9, 3,
|
||||
4, 9, 35, 19, 9, 9, 26, 37, 37, 9,
|
||||
18, 23, 24, 39, 8, 21, 25, 26, 41, 42,
|
||||
35, 35, 35, 9, 37, 28, 13, 18, 20, 33,
|
||||
37, 38, 39, 42, 28
|
||||
0, 31, 0, 5, 6, 7, 10, 11, 12, 14,
|
||||
15, 16, 21, 22, 27, 32, 33, 35, 37, 38,
|
||||
39, 40, 41, 44, 11, 21, 22, 37, 9, 3,
|
||||
4, 9, 36, 19, 9, 9, 29, 38, 38, 9,
|
||||
18, 23, 24, 40, 8, 21, 25, 26, 42, 43,
|
||||
36, 36, 36, 9, 38, 28, 13, 18, 20, 34,
|
||||
38, 39, 40, 43, 28
|
||||
};
|
||||
|
||||
/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
|
||||
static const yytype_int8 yyr1[] =
|
||||
{
|
||||
0, 29, 30, 30, 30, 30, 30, 30, 31, 31,
|
||||
32, 32, 33, 33, 34, 34, 34, 34, 34, 34,
|
||||
34, 34, 35, 35, 35, 36, 36, 37, 37, 38,
|
||||
38, 39, 39, 40, 40, 40, 41, 41, 42, 42,
|
||||
42, 43, 43, 43, 43
|
||||
0, 30, 31, 31, 31, 31, 31, 31, 32, 32,
|
||||
33, 33, 34, 34, 35, 35, 35, 35, 35, 35,
|
||||
35, 35, 36, 36, 36, 37, 37, 38, 38, 39,
|
||||
39, 40, 40, 41, 41, 41, 42, 42, 43, 43,
|
||||
43, 44, 44, 44, 44
|
||||
};
|
||||
|
||||
/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
|
||||
@@ -696,7 +703,7 @@ static const yytype_int8 yyr2[] =
|
||||
enum { YYENOMEM = -2 };
|
||||
|
||||
#define yyerrok (yyerrstatus = 0)
|
||||
#define yyclearin (yychar = YYEMPTY)
|
||||
#define yyclearin (yychar = RE2C_EMPTY)
|
||||
|
||||
#define YYACCEPT goto yyacceptlab
|
||||
#define YYABORT goto yyabortlab
|
||||
@@ -708,7 +715,7 @@ enum { YYENOMEM = -2 };
|
||||
|
||||
#define YYBACKUP(Token, Value) \
|
||||
do \
|
||||
if (yychar == YYEMPTY) \
|
||||
if (yychar == RE2C_EMPTY) \
|
||||
{ \
|
||||
yychar = (Token); \
|
||||
yylval = (Value); \
|
||||
@@ -724,12 +731,12 @@ enum { YYENOMEM = -2 };
|
||||
while (0)
|
||||
|
||||
/* Backward compatibility with an undocumented macro.
|
||||
Use YYerror or YYUNDEF. */
|
||||
#define YYERRCODE YYUNDEF
|
||||
Use RE2C_error or RE2C_UNDEF. */
|
||||
#define YYERRCODE RE2C_UNDEF
|
||||
|
||||
|
||||
/* Enable debugging if requested. */
|
||||
#if YYDEBUG
|
||||
#if RE2C_DEBUG
|
||||
|
||||
# ifndef YYFPRINTF
|
||||
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
|
||||
@@ -851,12 +858,12 @@ do { \
|
||||
/* Nonzero means print parse trace. It is left uninitialized so that
|
||||
multiple parsers can coexist. */
|
||||
int yydebug;
|
||||
#else /* !YYDEBUG */
|
||||
#else /* !RE2C_DEBUG */
|
||||
# define YYDPRINTF(Args) ((void) 0)
|
||||
# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
|
||||
# define YY_STACK_PRINT(Bottom, Top)
|
||||
# define YY_REDUCE_PRINT(Rule)
|
||||
#endif /* !YYDEBUG */
|
||||
#endif /* !RE2C_DEBUG */
|
||||
|
||||
|
||||
/* YYINITDEPTH -- initial size of the parser's stacks. */
|
||||
@@ -966,7 +973,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
|
||||
|
||||
YYDPRINTF ((stderr, "Starting parse\n"));
|
||||
|
||||
yychar = YYEMPTY; /* Cause a token to be read. */
|
||||
yychar = RE2C_EMPTY; /* Cause a token to be read. */
|
||||
|
||||
goto yysetstate;
|
||||
|
||||
@@ -1076,25 +1083,25 @@ yybackup:
|
||||
/* Not known => get a lookahead token if don't already have one. */
|
||||
|
||||
/* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
|
||||
if (yychar == YYEMPTY)
|
||||
if (yychar == RE2C_EMPTY)
|
||||
{
|
||||
YYDPRINTF ((stderr, "Reading a token\n"));
|
||||
yychar = yylex (&yylval, input, ast, opts, grams);
|
||||
}
|
||||
|
||||
if (yychar <= YYEOF)
|
||||
if (yychar <= RE2C_EOF)
|
||||
{
|
||||
yychar = YYEOF;
|
||||
yychar = RE2C_EOF;
|
||||
yytoken = YYSYMBOL_YYEOF;
|
||||
YYDPRINTF ((stderr, "Now at end of input.\n"));
|
||||
}
|
||||
else if (yychar == YYerror)
|
||||
else if (yychar == RE2C_error)
|
||||
{
|
||||
/* The scanner already issued an error message, process directly
|
||||
to error recovery. But do not keep the error token as
|
||||
lookahead, it is too special and may lead us to an endless
|
||||
loop in error recovery. */
|
||||
yychar = YYUNDEF;
|
||||
yychar = RE2C_UNDEF;
|
||||
yytoken = YYSYMBOL_YYerror;
|
||||
goto yyerrlab1;
|
||||
}
|
||||
@@ -1131,7 +1138,7 @@ yybackup:
|
||||
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
||||
|
||||
/* Discard the shifted token. */
|
||||
yychar = YYEMPTY;
|
||||
yychar = RE2C_EMPTY;
|
||||
goto yynewstate;
|
||||
|
||||
|
||||
@@ -1167,176 +1174,177 @@ yyreduce:
|
||||
switch (yyn)
|
||||
{
|
||||
case 3: /* spec: spec TOKEN_BLOCK */
|
||||
#line 77 "../src/parse/parser.ypp"
|
||||
#line 78 "../src/parse/parser.ypp"
|
||||
{
|
||||
if (use_block(input, ast, opts, grams, ast.temp_blockname) != Ret::OK) YYABORT;
|
||||
ast.temp_blockname.clear();
|
||||
}
|
||||
#line 1176 "src/parse/parser.cc"
|
||||
#line 1183 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 4: /* spec: spec TOKEN_CONF */
|
||||
#line 81 "../src/parse/parser.ypp"
|
||||
#line 82 "../src/parse/parser.ypp"
|
||||
{
|
||||
// Handled here, as the main lexer should not get access to opts under construction.
|
||||
if (input.lex_conf(opts) != Ret::OK) YYABORT;
|
||||
}
|
||||
#line 1185 "src/parse/parser.cc"
|
||||
#line 1192 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 8: /* def: name expr enddef */
|
||||
#line 91 "../src/parse/parser.ypp"
|
||||
#line 92 "../src/parse/parser.ypp"
|
||||
{
|
||||
if (add_named_def(opts.symtab, (yyvsp[-2].cstr), (yyvsp[-1].regexp), input) != Ret::OK) YYABORT;
|
||||
}
|
||||
#line 1193 "src/parse/parser.cc"
|
||||
#line 1200 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 9: /* def: name expr '/' */
|
||||
#line 94 "../src/parse/parser.ypp"
|
||||
#line 95 "../src/parse/parser.ypp"
|
||||
{
|
||||
input.error_at_tok("trailing contexts are not allowed in named definitions");
|
||||
YYABORT;
|
||||
}
|
||||
#line 1202 "src/parse/parser.cc"
|
||||
#line 1209 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 10: /* name: TOKEN_ID '=' */
|
||||
#line 100 "../src/parse/parser.ypp"
|
||||
#line 101 "../src/parse/parser.ypp"
|
||||
{ (yyval.cstr) = (yyvsp[-1].cstr); }
|
||||
#line 1208 "src/parse/parser.cc"
|
||||
#line 1215 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 14: /* rule: trailexpr TOKEN_CODE */
|
||||
#line 107 "../src/parse/parser.ypp"
|
||||
#line 108 "../src/parse/parser.ypp"
|
||||
{
|
||||
find_or_add_gram(grams, "").rules.push_back(AstRule((yyvsp[-1].regexp), (yyvsp[0].semact)));
|
||||
}
|
||||
#line 1216 "src/parse/parser.cc"
|
||||
#line 1223 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 15: /* rule: '*' TOKEN_CODE */
|
||||
#line 110 "../src/parse/parser.ypp"
|
||||
#line 111 "../src/parse/parser.ypp"
|
||||
{
|
||||
find_or_add_gram(grams, "").defs.push_back((yyvsp[0].semact));
|
||||
}
|
||||
#line 1224 "src/parse/parser.cc"
|
||||
#line 1231 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 16: /* rule: '$' TOKEN_CODE */
|
||||
#line 113 "../src/parse/parser.ypp"
|
||||
#line 114 "../src/parse/parser.ypp"
|
||||
{
|
||||
find_or_add_gram(grams, "").eofs.push_back((yyvsp[0].semact));
|
||||
}
|
||||
#line 1232 "src/parse/parser.cc"
|
||||
#line 1239 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 17: /* rule: TOKEN_CLIST trailexpr ccode */
|
||||
#line 116 "../src/parse/parser.ypp"
|
||||
#line 117 "../src/parse/parser.ypp"
|
||||
{
|
||||
for (const std::string& cond : ast.temp_condlist) {
|
||||
find_or_add_gram(grams, cond).rules.push_back(AstRule((yyvsp[-1].regexp), (yyvsp[0].semact)));
|
||||
}
|
||||
ast.temp_condlist.clear();
|
||||
}
|
||||
#line 1243 "src/parse/parser.cc"
|
||||
#line 1250 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 18: /* rule: TOKEN_CLIST '*' ccode */
|
||||
#line 122 "../src/parse/parser.ypp"
|
||||
#line 123 "../src/parse/parser.ypp"
|
||||
{
|
||||
for (const std::string& cond : ast.temp_condlist) {
|
||||
find_or_add_gram(grams, cond).defs.push_back((yyvsp[0].semact));
|
||||
}
|
||||
ast.temp_condlist.clear();
|
||||
}
|
||||
#line 1254 "src/parse/parser.cc"
|
||||
#line 1261 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 19: /* rule: TOKEN_CLIST '$' ccode */
|
||||
#line 128 "../src/parse/parser.ypp"
|
||||
#line 129 "../src/parse/parser.ypp"
|
||||
{
|
||||
for (const std::string& cond : ast.temp_condlist) {
|
||||
find_or_add_gram(grams, cond).eofs.push_back((yyvsp[0].semact));
|
||||
}
|
||||
ast.temp_condlist.clear();
|
||||
}
|
||||
#line 1265 "src/parse/parser.cc"
|
||||
#line 1272 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 20: /* rule: TOKEN_CSETUP TOKEN_CODE */
|
||||
#line 134 "../src/parse/parser.ypp"
|
||||
#line 135 "../src/parse/parser.ypp"
|
||||
{
|
||||
for (const std::string& cond : ast.temp_condlist) {
|
||||
find_or_add_gram(grams, cond).setup.push_back((yyvsp[0].semact));
|
||||
}
|
||||
ast.temp_condlist.clear();
|
||||
}
|
||||
#line 1276 "src/parse/parser.cc"
|
||||
#line 1283 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 21: /* rule: TOKEN_CZERO ccode */
|
||||
#line 140 "../src/parse/parser.ypp"
|
||||
#line 141 "../src/parse/parser.ypp"
|
||||
{
|
||||
const AstNode* r = ast.nil(input.tok_loc());
|
||||
find_or_add_gram(grams, "0").rules.push_back(AstRule(r, (yyvsp[0].semact)));
|
||||
ast.temp_condlist.clear();
|
||||
}
|
||||
#line 1286 "src/parse/parser.cc"
|
||||
#line 1293 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 23: /* ccode: TOKEN_CNEXT TOKEN_CODE */
|
||||
#line 148 "../src/parse/parser.ypp"
|
||||
#line 149 "../src/parse/parser.ypp"
|
||||
{
|
||||
(yyval.semact) = (yyvsp[0].semact);
|
||||
// parser needs to to update condition, but for the rest of the code actions are immutable
|
||||
const_cast<SemAct*>((yyval.semact))->cond = (yyvsp[-1].cstr);
|
||||
}
|
||||
#line 1296 "src/parse/parser.cc"
|
||||
#line 1303 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 24: /* ccode: TOKEN_CJUMP */
|
||||
#line 153 "../src/parse/parser.ypp"
|
||||
#line 154 "../src/parse/parser.ypp"
|
||||
{
|
||||
(yyval.semact) = ast.sem_act(input.tok_loc(), nullptr, (yyvsp[0].cstr), true);
|
||||
}
|
||||
#line 1304 "src/parse/parser.cc"
|
||||
#line 1311 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 25: /* trailexpr: expr */
|
||||
#line 158 "../src/parse/parser.ypp"
|
||||
{ (yyval.regexp) = ast.cap((yyvsp[0].regexp)); }
|
||||
#line 1310 "src/parse/parser.cc"
|
||||
#line 159 "../src/parse/parser.ypp"
|
||||
{ (yyval.regexp) = ast.cap((yyvsp[0].regexp), CAPTURE_IF_NOT_INVERTED); }
|
||||
#line 1317 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 26: /* trailexpr: expr '/' expr */
|
||||
#line 159 "../src/parse/parser.ypp"
|
||||
#line 160 "../src/parse/parser.ypp"
|
||||
{
|
||||
(yyval.regexp) = ast.cat(ast.cap((yyvsp[-2].regexp)), ast.cat(ast.tag(input.tok_loc(), nullptr, false), (yyvsp[0].regexp)));
|
||||
(yyval.regexp) = ast.cat(ast.cap((yyvsp[-2].regexp), CAPTURE_IF_NOT_INVERTED),
|
||||
ast.cat(ast.tag(input.tok_loc(), nullptr, false), (yyvsp[0].regexp)));
|
||||
}
|
||||
#line 1318 "src/parse/parser.cc"
|
||||
#line 1326 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 28: /* expr: expr '|' diff */
|
||||
#line 165 "../src/parse/parser.ypp"
|
||||
#line 167 "../src/parse/parser.ypp"
|
||||
{ (yyval.regexp) = ast.alt((yyvsp[-2].regexp), (yyvsp[0].regexp)); }
|
||||
#line 1324 "src/parse/parser.cc"
|
||||
#line 1332 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 30: /* diff: diff '\\' term */
|
||||
#line 170 "../src/parse/parser.ypp"
|
||||
#line 172 "../src/parse/parser.ypp"
|
||||
{ (yyval.regexp) = ast.diff((yyvsp[-2].regexp), (yyvsp[0].regexp)); }
|
||||
#line 1330 "src/parse/parser.cc"
|
||||
#line 1338 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 32: /* term: factor term */
|
||||
#line 176 "../src/parse/parser.ypp"
|
||||
#line 178 "../src/parse/parser.ypp"
|
||||
{ (yyval.regexp) = ast.cat((yyvsp[-1].regexp), (yyvsp[0].regexp)); }
|
||||
#line 1336 "src/parse/parser.cc"
|
||||
#line 1344 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 34: /* factor: primary closes */
|
||||
#line 181 "../src/parse/parser.ypp"
|
||||
#line 183 "../src/parse/parser.ypp"
|
||||
{
|
||||
switch((yyvsp[0].op)) {
|
||||
case '*':
|
||||
@@ -1350,69 +1358,69 @@ yyreduce:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#line 1354 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 35: /* factor: primary TOKEN_CLOSESIZE */
|
||||
#line 194 "../src/parse/parser.ypp"
|
||||
{
|
||||
(yyval.regexp) = ast.iter((yyvsp[-1].regexp), (yyvsp[0].bounds).min, (yyvsp[0].bounds).max);
|
||||
}
|
||||
#line 1362 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 35: /* factor: primary TOKEN_CLOSESIZE */
|
||||
#line 196 "../src/parse/parser.ypp"
|
||||
{
|
||||
(yyval.regexp) = ast.iter((yyvsp[-1].regexp), (yyvsp[0].bounds).min, (yyvsp[0].bounds).max);
|
||||
}
|
||||
#line 1370 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 37: /* closes: closes close */
|
||||
#line 201 "../src/parse/parser.ypp"
|
||||
#line 203 "../src/parse/parser.ypp"
|
||||
{ (yyval.op) = ((yyvsp[-1].op) == (yyvsp[0].op)) ? (yyvsp[-1].op) : '*'; }
|
||||
#line 1368 "src/parse/parser.cc"
|
||||
#line 1376 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 38: /* close: '*' */
|
||||
#line 205 "../src/parse/parser.ypp"
|
||||
#line 207 "../src/parse/parser.ypp"
|
||||
{ (yyval.op) = '*'; }
|
||||
#line 1374 "src/parse/parser.cc"
|
||||
#line 1382 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 39: /* close: '+' */
|
||||
#line 206 "../src/parse/parser.ypp"
|
||||
#line 208 "../src/parse/parser.ypp"
|
||||
{ (yyval.op) = '+'; }
|
||||
#line 1380 "src/parse/parser.cc"
|
||||
#line 1388 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 40: /* close: '?' */
|
||||
#line 207 "../src/parse/parser.ypp"
|
||||
#line 209 "../src/parse/parser.ypp"
|
||||
{ (yyval.op) = '?'; }
|
||||
#line 1386 "src/parse/parser.cc"
|
||||
#line 1394 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 42: /* primary: TOKEN_ID */
|
||||
#line 212 "../src/parse/parser.ypp"
|
||||
#line 214 "../src/parse/parser.ypp"
|
||||
{
|
||||
(yyval.regexp) = find_def(opts.symtab, (yyvsp[0].cstr));
|
||||
if ((yyval.regexp) == nullptr) {
|
||||
input.error_at_tok("undefined symbol '%s'", (yyvsp[0].cstr));
|
||||
YYABORT;
|
||||
} else if (Ast::needs_wrap((yyval.regexp))) {
|
||||
(yyval.regexp) = ast.ref((yyval.regexp));
|
||||
(yyval.regexp) = ast.cap((yyval.regexp), NO_CAPTURE);
|
||||
}
|
||||
}
|
||||
#line 1400 "src/parse/parser.cc"
|
||||
#line 1408 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 43: /* primary: '(' expr ')' */
|
||||
#line 221 "../src/parse/parser.ypp"
|
||||
{ (yyval.regexp) = ast.cap((yyvsp[-1].regexp)); }
|
||||
#line 1406 "src/parse/parser.cc"
|
||||
#line 223 "../src/parse/parser.ypp"
|
||||
{ (yyval.regexp) = ast.cap((yyvsp[-1].regexp), CAPTURE_IF_NOT_INVERTED); }
|
||||
#line 1414 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
case 44: /* primary: '(' '?' expr ')' */
|
||||
#line 222 "../src/parse/parser.ypp"
|
||||
{ (yyval.regexp) = ast.ref((yyvsp[-1].regexp)); }
|
||||
#line 1412 "src/parse/parser.cc"
|
||||
case 44: /* primary: '(' '!' expr ')' */
|
||||
#line 224 "../src/parse/parser.ypp"
|
||||
{ (yyval.regexp) = ast.cap((yyvsp[-1].regexp), CAPTURE_IF_INVERTED); }
|
||||
#line 1420 "src/parse/parser.cc"
|
||||
break;
|
||||
|
||||
|
||||
#line 1416 "src/parse/parser.cc"
|
||||
#line 1424 "src/parse/parser.cc"
|
||||
|
||||
default: break;
|
||||
}
|
||||
@@ -1454,7 +1462,7 @@ yyreduce:
|
||||
yyerrlab:
|
||||
/* Make sure we have latest lookahead translation. See comments at
|
||||
user semantic actions for why this is necessary. */
|
||||
yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
|
||||
yytoken = yychar == RE2C_EMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
|
||||
/* If not already recovering from an error, report this error. */
|
||||
if (!yyerrstatus)
|
||||
{
|
||||
@@ -1467,17 +1475,17 @@ yyerrlab:
|
||||
/* If just tried and failed to reuse lookahead token after an
|
||||
error, discard it. */
|
||||
|
||||
if (yychar <= YYEOF)
|
||||
if (yychar <= RE2C_EOF)
|
||||
{
|
||||
/* Return failure if at end of input. */
|
||||
if (yychar == YYEOF)
|
||||
if (yychar == RE2C_EOF)
|
||||
YYABORT;
|
||||
}
|
||||
else
|
||||
{
|
||||
yydestruct ("Error: discarding",
|
||||
yytoken, &yylval, input, ast, opts, grams);
|
||||
yychar = YYEMPTY;
|
||||
yychar = RE2C_EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1579,7 +1587,7 @@ yyexhaustedlab:
|
||||
| yyreturnlab -- parsing is finished, clean up and return. |
|
||||
`----------------------------------------------------------*/
|
||||
yyreturnlab:
|
||||
if (yychar != YYEMPTY)
|
||||
if (yychar != RE2C_EMPTY)
|
||||
{
|
||||
/* Make sure we have latest lookahead translation. See comments at
|
||||
user semantic actions for why this is necessary. */
|
||||
@@ -1605,14 +1613,14 @@ yyreturnlab:
|
||||
return yyresult;
|
||||
}
|
||||
|
||||
#line 225 "../src/parse/parser.ypp"
|
||||
#line 227 "../src/parse/parser.ypp"
|
||||
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
extern "C" {
|
||||
static void yyerror(Input& input, Ast&, Opt&, AstGrams&, const char* s) {
|
||||
input.error_at_tok("%s", s);
|
||||
input.error_at_cur("%s", s);
|
||||
}
|
||||
|
||||
static int yylex(YYSTYPE* yylval, Input& input, Ast& ast, Opt&, AstGrams&) {
|
||||
|
||||
@@ -35,14 +35,22 @@
|
||||
especially those whose name start with YY_ or yy_. They are
|
||||
private implementation details that can be changed or removed. */
|
||||
|
||||
#ifndef YY_YY_SRC_PARSE_PARSER_H_INCLUDED
|
||||
# define YY_YY_SRC_PARSE_PARSER_H_INCLUDED
|
||||
#ifndef YY_RE2C_SRC_PARSE_PARSER_H_INCLUDED
|
||||
# define YY_RE2C_SRC_PARSE_PARSER_H_INCLUDED
|
||||
/* Debug traces. */
|
||||
#ifndef YYDEBUG
|
||||
# define YYDEBUG 0
|
||||
#endif
|
||||
#ifndef RE2C_DEBUG
|
||||
# if defined YYDEBUG
|
||||
#if YYDEBUG
|
||||
extern int yydebug;
|
||||
# define RE2C_DEBUG 1
|
||||
# else
|
||||
# define RE2C_DEBUG 0
|
||||
# endif
|
||||
# else /* ! defined YYDEBUG */
|
||||
# define RE2C_DEBUG 0
|
||||
# endif /* ! defined YYDEBUG */
|
||||
#endif /* ! defined RE2C_DEBUG */
|
||||
#if RE2C_DEBUG
|
||||
extern int re2c_debug;
|
||||
#endif
|
||||
/* "%code requires" blocks. */
|
||||
#line 1 "../src/parse/parser.ypp"
|
||||
@@ -52,19 +60,19 @@ extern int yydebug;
|
||||
namespace re2c {
|
||||
struct AstNode;
|
||||
struct SemAct;
|
||||
};
|
||||
}
|
||||
|
||||
#line 58 "src/parse/parser.h"
|
||||
#line 66 "src/parse/parser.h"
|
||||
|
||||
/* Token kinds. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
enum yytokentype
|
||||
#ifndef RE2C_TOKENTYPE
|
||||
# define RE2C_TOKENTYPE
|
||||
enum re2c_tokentype
|
||||
{
|
||||
YYEMPTY = -2,
|
||||
YYEOF = 0, /* "end of file" */
|
||||
YYerror = 256, /* error */
|
||||
YYUNDEF = 257, /* "invalid token" */
|
||||
RE2C_EMPTY = -2,
|
||||
RE2C_EOF = 0, /* "end of file" */
|
||||
RE2C_error = 256, /* error */
|
||||
RE2C_UNDEF = 257, /* "invalid token" */
|
||||
TOKEN_CJUMP = 258, /* TOKEN_CJUMP */
|
||||
TOKEN_CNEXT = 259, /* TOKEN_CNEXT */
|
||||
TOKEN_CLIST = 260, /* TOKEN_CLIST */
|
||||
@@ -81,14 +89,14 @@ namespace re2c {
|
||||
TOKEN_BLOCK = 271, /* TOKEN_BLOCK */
|
||||
TOKEN_ERROR = 272 /* TOKEN_ERROR */
|
||||
};
|
||||
typedef enum yytokentype yytoken_kind_t;
|
||||
typedef enum re2c_tokentype re2c_token_kind_t;
|
||||
#endif
|
||||
|
||||
/* Value type. */
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
union YYSTYPE
|
||||
#if ! defined RE2C_STYPE && ! defined RE2C_STYPE_IS_DECLARED
|
||||
union RE2C_STYPE
|
||||
{
|
||||
#line 42 "../src/parse/parser.ypp"
|
||||
#line 43 "../src/parse/parser.ypp"
|
||||
|
||||
const re2c::AstNode* regexp;
|
||||
const re2c::SemAct* semact;
|
||||
@@ -97,18 +105,18 @@ union YYSTYPE
|
||||
const char* cstr;
|
||||
std::string* str;
|
||||
|
||||
#line 101 "src/parse/parser.h"
|
||||
#line 109 "src/parse/parser.h"
|
||||
|
||||
};
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
typedef union RE2C_STYPE RE2C_STYPE;
|
||||
# define RE2C_STYPE_IS_TRIVIAL 1
|
||||
# define RE2C_STYPE_IS_DECLARED 1
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
int yyparse (re2c::Input& input, re2c::Ast& ast, re2c::Opt& opts, re2c::AstGrams& grams);
|
||||
int re2c_parse (re2c::Input& input, re2c::Ast& ast, re2c::Opt& opts, re2c::AstGrams& grams);
|
||||
|
||||
|
||||
#endif /* !YY_YY_SRC_PARSE_PARSER_H_INCLUDED */
|
||||
#endif /* !YY_RE2C_SRC_PARSE_PARSER_H_INCLUDED */
|
||||
|
||||
@@ -12,5 +12,6 @@ cd $builddir
|
||||
--enable-debug \
|
||||
--enable-libs \
|
||||
--host i686-w64-mingw32 \
|
||||
&& make -j$(nproc)
|
||||
&& make -j$(nproc) \
|
||||
&& ../build/copy_wine_libs_on_nixos.sh
|
||||
cd ..
|
||||
|
||||
@@ -16,5 +16,6 @@ cd $builddir
|
||||
--enable-debug \
|
||||
--enable-libs \
|
||||
--host i686-w64-mingw32 \
|
||||
&& make -j$(nproc) LIBTOOL="slibtool"
|
||||
&& make -j$(nproc) LIBTOOL="slibtool" \
|
||||
&& ../build/copy_wine_libs_on_nixos.sh
|
||||
cd ..
|
||||
|
||||
@@ -12,5 +12,6 @@ cmake .. \
|
||||
-DBUILD_SHARED_LIBS=no \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="-static -static-libstdc++ -static-libgcc" \
|
||||
-DCMAKE_TOOLCHAIN_FILE=cmake/Toolchain-cross-mingw32-linux.cmake \
|
||||
&& cmake --build . -j$(nproc)
|
||||
&& cmake --build . -j$(nproc) \
|
||||
&& ../build/copy_wine_libs_on_nixos.sh
|
||||
cd ..
|
||||
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
# On NixOS, Wine cannot find DLLs by their absolute paths in /nix/store,
|
||||
# so find and copy them in the same directory with re2c.exe.
|
||||
|
||||
uname -a | grep -q NixOS || exit 0
|
||||
|
||||
test -e re2c.exe || \
|
||||
{ echo "$0 must be ran from the build directory containing re2c.exe"; exit 1; }
|
||||
|
||||
nix_wine="$(nix-build --no-link '<nixpkgs>' -A wine)"
|
||||
nix_mcfgthreads="$(nix-build --no-link '<nixpkgs>' -A pkgsCross.mingw32.windows.mcfgthreads)"
|
||||
|
||||
uname -a | grep -q NixOS && (
|
||||
cp -f "$nix_mcfgthreads/bin/mcfgthread"*".dll" .
|
||||
cp -f "$nix_wine/lib/wine/i386-windows/win32u.dll" .
|
||||
cp -f "$nix_wine/lib/wine/i386-windows/user32.dll" .
|
||||
cp -f "$nix_wine/lib/wine/i386-windows/gdi32.dll" .
|
||||
)
|
||||
+40
-8
@@ -5,40 +5,72 @@ Generates language-specific manpages by replacing placeholder tokens in the
|
||||
input manpage.
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
if len(sys.argv) != 4:
|
||||
print('usage:', sys.argv[0], '<input> <output> <lang>')
|
||||
if len(sys.argv) != 3:
|
||||
print('usage:', sys.argv[0], '<input> <output>')
|
||||
exit(1)
|
||||
|
||||
input = sys.argv[1]
|
||||
output = sys.argv[2]
|
||||
lang = sys.argv[3].lower().encode('utf-8')
|
||||
|
||||
# Extract language name from the output filename.
|
||||
lang = re.search('re2([a-z]+)', os.path.basename(output)).group(1).encode('utf-8')
|
||||
prog = b're2' + lang
|
||||
hdr_ext = None
|
||||
disclaimer = b''
|
||||
|
||||
if lang == b'c':
|
||||
src_ext = b'c'
|
||||
hdr_ext = b'h'
|
||||
lang_name = b'C'
|
||||
lang_name = b'C/C++'
|
||||
disclaimer = b'Note: examples are in C++ (but can be easily adapted to C).'
|
||||
elif lang == b'd':
|
||||
src_ext = b'd'
|
||||
lang_name = b'D'
|
||||
elif lang == b'go':
|
||||
src_ext = b'go'
|
||||
hdr_ext = b'go'
|
||||
lang_name = b'Go'
|
||||
disclaimer = b'Note: This manual is for Go, but it refers to re2c as the general program.'
|
||||
elif lang == b'hs':
|
||||
lang = b'haskell'
|
||||
src_ext = b'hs'
|
||||
lang_name = b'Haskell'
|
||||
elif lang == b'java':
|
||||
src_ext = b'java'
|
||||
lang_name = b'Java'
|
||||
elif lang == b'js':
|
||||
src_ext = b'js'
|
||||
lang_name = b'JavaScript'
|
||||
elif lang == b'ocaml':
|
||||
src_ext = b'ml'
|
||||
lang_name = b'OCaml'
|
||||
elif lang == b'py':
|
||||
lang = b'python'
|
||||
src_ext = b'py'
|
||||
lang_name = b'Python'
|
||||
elif lang == b'rust':
|
||||
src_ext = b'rs'
|
||||
hdr_ext = b'rs'
|
||||
lang_name = b'Rust'
|
||||
disclaimer = b'Note: This manual is for Rust, but it refers to re2c as the general program.'
|
||||
elif lang == b'v':
|
||||
src_ext = b'v'
|
||||
lang_name = b'V'
|
||||
elif lang == b'zig':
|
||||
src_ext = b'zig'
|
||||
lang_name = b'Zig'
|
||||
else:
|
||||
print('***', sys.argv[0], ': unknown lang:', lang)
|
||||
exit(1)
|
||||
if hdr_ext == None:
|
||||
hdr_ext = src_ext
|
||||
|
||||
with open(input, 'rb') as input_file:
|
||||
file_bytes = input_file.read()
|
||||
|
||||
file_bytes = file_bytes.replace(b'RE2C_LANG_NAME', lang_name)
|
||||
file_bytes = file_bytes.replace(b'RE2C_LANG', lang)
|
||||
file_bytes = file_bytes.replace(b'RE2C_PROG', prog)
|
||||
file_bytes = file_bytes.replace(b'RE2C_SOURCE_EXT', src_ext)
|
||||
file_bytes = file_bytes.replace(b'RE2C_HEADER_EXT', hdr_ext)
|
||||
file_bytes = file_bytes.replace(b'RE2C_DISCLAIMER', disclaimer)
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
"""
|
||||
Encodes the contents of a syntax file as C++ source code.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
print('usage:', sys.argv[0], '<input> <output>')
|
||||
exit(1)
|
||||
|
||||
input = sys.argv[1]
|
||||
output = sys.argv[2]
|
||||
|
||||
with open(output, 'w') as output_file:
|
||||
name = os.path.splitext(os.path.basename(input))[0].upper()
|
||||
output_file.write("#include \"src/parse/conf_parser.h\"\n")
|
||||
output_file.write("const char* " + name + " =\n")
|
||||
|
||||
# write input file line by line as a string, escaping characters as needed
|
||||
with open(input, 'r') as input_file:
|
||||
for l in input_file:
|
||||
l_out = l[:-1].translate(str.maketrans({
|
||||
'\\': '\\\\',
|
||||
'"': '\\"'
|
||||
}))
|
||||
output_file.write(' "' + l_out + '\\n"\n')
|
||||
|
||||
output_file.write(" ;\n")
|
||||
@@ -0,0 +1,20 @@
|
||||
function(re2c_bootstrap_syntax source target)
|
||||
set(bootstrap "${CMAKE_CURRENT_SOURCE_DIR}/bootstrap/${target}")
|
||||
if(RE2C_REBUILD_SYNTAX)
|
||||
get_filename_component(targetdir "${target}" DIRECTORY)
|
||||
add_custom_command(
|
||||
OUTPUT "${target}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E make_directory ${targetdir}
|
||||
COMMAND "${PYTHON}" "${re2c_stx2cpp}" "${CMAKE_CURRENT_SOURCE_DIR}/${source}" "${target}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${target}" "${bootstrap}"
|
||||
DEPENDS "${source}" "${re2c_stx2cpp}"
|
||||
)
|
||||
else()
|
||||
add_custom_command(
|
||||
OUTPUT "${target}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy "${bootstrap}" "${target}"
|
||||
DEPENDS "${bootstrap}"
|
||||
COMMENT "Copying bootstrap syntax file, reconfigure with RE2C_REBUILD_PARSERS to regenerate"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -53,6 +53,11 @@ if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
# re2c uses C++11, not C++98
|
||||
"-Wno-c++98-compat"
|
||||
"-Wno-c++98-compat-pedantic"
|
||||
"-Wno-unsafe-pointer-arithmetic"
|
||||
"-Wno-unsafe-buffer-usage"
|
||||
# re2c is single-threaded => no danger of race conditions
|
||||
"-Wno-exit-time-destructors"
|
||||
"-Wno-switch-enum"
|
||||
)
|
||||
try_cxxflag("-fdiagnostics-color=always")
|
||||
|
||||
|
||||
+14
-27
@@ -1,19 +1,21 @@
|
||||
function(re2c_gen_manpage source target bootstrap lang)
|
||||
function(re2c_gen_docs source target tool args)
|
||||
file(RELATIVE_PATH relative_target "${CMAKE_CURRENT_BINARY_DIR}" "${target}")
|
||||
set(bootstrap "${CMAKE_CURRENT_SOURCE_DIR}/bootstrap/${relative_target}")
|
||||
if(RE2C_REBUILD_DOCS)
|
||||
get_filename_component(targetdir "${target}" DIRECTORY)
|
||||
set(source_l "${source}.${lang}")
|
||||
set(split_source "${target}.rst")
|
||||
add_custom_command(
|
||||
OUTPUT "${target}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E make_directory ${targetdir}
|
||||
COMMAND "${PYTHON}" "${re2c_splitman}" "${source}" "${source_l}" "${lang}"
|
||||
COMMAND "${PYTHON}" "${re2c_rst2man}" --tab-width=4 "${source_l}" "${target}"
|
||||
COMMAND "${PYTHON}" "${re2c_splitman}" "${source}" "${split_source}"
|
||||
COMMAND "${PYTHON}" "${tool}" ${args} "${split_source}" "${target}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${target}" "${bootstrap}"
|
||||
DEPENDS
|
||||
"${source}"
|
||||
"${tool}"
|
||||
"${re2c_splitman}"
|
||||
"${re2c_rst2man}"
|
||||
"${re2c_docs_sources}"
|
||||
BYPRODUCTS "${source_l}"
|
||||
BYPRODUCTS "${split_source}"
|
||||
)
|
||||
else()
|
||||
add_custom_command(
|
||||
@@ -24,25 +26,10 @@ function(re2c_gen_manpage source target bootstrap lang)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(re2c_gen_help source target bootstrap)
|
||||
if(RE2C_REBUILD_DOCS)
|
||||
get_filename_component(targetdir "${target}" DIRECTORY)
|
||||
add_custom_command(
|
||||
OUTPUT "${target}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E make_directory ${targetdir}
|
||||
COMMAND "${PYTHON}" "${re2c_rst2txt}" --variable-name=help "${source}" "${target}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${target}" "${bootstrap}"
|
||||
DEPENDS
|
||||
"${source}"
|
||||
"${re2c_rst2txt}"
|
||||
"${re2c_docs_sources}"
|
||||
BYPRODUCTS "${target}.1"
|
||||
)
|
||||
else()
|
||||
add_custom_command(
|
||||
OUTPUT "${target}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy "${bootstrap}" "${target}"
|
||||
DEPENDS "${bootstrap}"
|
||||
)
|
||||
endif()
|
||||
function(re2c_gen_manpage source target)
|
||||
re2c_gen_docs("${source}" "${target}" "${re2c_rst2man}" "--tab-width=4")
|
||||
endfunction()
|
||||
|
||||
function(re2c_gen_help source target)
|
||||
re2c_gen_docs("${source}" "${target}" "${re2c_rst2txt}" "--variable-name=help")
|
||||
endfunction()
|
||||
|
||||
+89
-11
@@ -1,4 +1,4 @@
|
||||
AC_INIT([re2c],[3.0],[re2c-general@lists.sourceforge.net])
|
||||
AC_INIT([re2c],[4.0],[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])
|
||||
@@ -15,7 +15,8 @@ AC_SUBST(PACKAGE_RELEASE, ${PACKAGE_RELEASE:-1})
|
||||
|
||||
AM_PATH_PYTHON([3.7])
|
||||
|
||||
# without this, --std=c++98 disables POSIX functions on Cygwin
|
||||
# without this, --std=c++11 disables POSIX functions on Cygwin and NetBSD
|
||||
# (alternatively we could use -std=gnu++11, as CMake does)
|
||||
AC_USE_SYSTEM_EXTENSIONS
|
||||
|
||||
|
||||
@@ -35,6 +36,11 @@ AM_COND_IF([REBUILD_DOCS], [
|
||||
])
|
||||
|
||||
|
||||
# --enable-syntax
|
||||
AC_ARG_ENABLE([syntax], [AS_HELP_STRING([--enable-syntax], [regenerate syntax files])])
|
||||
AM_CONDITIONAL([REBUILD_SYNTAX], [test "x$enable_syntax" = "xyes"])
|
||||
|
||||
|
||||
# --enable-lexers
|
||||
AC_ARG_ENABLE([lexers], [AS_HELP_STRING([--enable-lexers], [regenerate lexers])])
|
||||
AM_CONDITIONAL([REBUILD_LEXERS], [test "x$enable_lexers" = "xyes"])
|
||||
@@ -68,14 +74,36 @@ AM_COND_IF([WITH_LIBS], [
|
||||
])
|
||||
|
||||
|
||||
# --enable-dlang
|
||||
AC_ARG_ENABLE([dlang], [AS_HELP_STRING([--enable-dlang], [build re2d executable])])
|
||||
AM_CONDITIONAL([WITH_DLANG], [test "x$enable_dlang" != "xno"])
|
||||
# --enable-golang
|
||||
AC_ARG_ENABLE([golang], [AS_HELP_STRING([--enable-golang], [build re2go executable])])
|
||||
AM_CONDITIONAL([WITH_GOLANG], [test "x$enable_golang" != "xno"])
|
||||
|
||||
|
||||
# --enable-haskell
|
||||
AC_ARG_ENABLE([haskell], [AS_HELP_STRING([--enable-haskell], [build re2hs executable])])
|
||||
AM_CONDITIONAL([WITH_HASKELL], [test "x$enable_haskell" != "xno"])
|
||||
# --enable-java
|
||||
AC_ARG_ENABLE([java], [AS_HELP_STRING([--enable-java], [build re2java executable])])
|
||||
AM_CONDITIONAL([WITH_JAVA], [test "x$enable_java" != "xno"])
|
||||
# --enable-js
|
||||
AC_ARG_ENABLE([js], [AS_HELP_STRING([--enable-js], [build re2js executable])])
|
||||
AM_CONDITIONAL([WITH_JS], [test "x$enable_js" != "xno"])
|
||||
# --enable-ocaml
|
||||
AC_ARG_ENABLE([ocaml], [AS_HELP_STRING([--enable-ocaml], [build re2ocaml executable])])
|
||||
AM_CONDITIONAL([WITH_OCAML], [test "x$enable_ocaml" != "xno"])
|
||||
# --enable-python
|
||||
AC_ARG_ENABLE([python], [AS_HELP_STRING([--enable-python], [build re2py executable])])
|
||||
AM_CONDITIONAL([WITH_PYTHON], [test "x$enable_python" != "xno"])
|
||||
# --enable-rust
|
||||
AC_ARG_ENABLE([rust], [AS_HELP_STRING([--enable-rust], [build re2rust executable])])
|
||||
AM_CONDITIONAL([WITH_RUST], [test "x$enable_rust" != "xno"])
|
||||
# --enable-vlang
|
||||
AC_ARG_ENABLE([vlang], [AS_HELP_STRING([--enable-vlang], [build re2v executable])])
|
||||
AM_CONDITIONAL([WITH_VLANG], [test "x$enable_vlang" != "xno"])
|
||||
# --enable-zig
|
||||
AC_ARG_ENABLE([zig], [AS_HELP_STRING([--enable-zig], [build re2zig executable])])
|
||||
AM_CONDITIONAL([WITH_ZIG], [test "x$enable_zig" != "xno"])
|
||||
|
||||
|
||||
# --enable-benchmarks
|
||||
@@ -123,13 +151,18 @@ AC_DEFUN([TRY_CXXFLAG], [
|
||||
AS_VAR_SET([TRY_CXXFLAG_RESULT], [yes])
|
||||
AS_VAR_SET([CXXFLAGSDEFAULT], ["$CXXFLAGSDEFAULT $1 $2"])
|
||||
],
|
||||
[AS_VAR_SET([TRY_CXXFLAG_RESULT], [no])]
|
||||
[
|
||||
AS_VAR_SET([TRY_CXXFLAG_RESULT], [no])
|
||||
AS_IF([test "x$3" = "xrequired"], [
|
||||
AC_MSG_ERROR([C++ compiler flag $1 is required to build re2c])
|
||||
])
|
||||
]
|
||||
)
|
||||
AC_LANG_POP([C++])
|
||||
AS_VAR_SET([CXXFLAGS], ["$CXXFLAGS_BACKUP"])
|
||||
AC_MSG_RESULT([$TRY_CXXFLAG_RESULT])
|
||||
])
|
||||
TRY_CXXFLAG([-std=c++11])
|
||||
TRY_CXXFLAG([-std=c++11], [], [required])
|
||||
TRY_CXXFLAG([-W])
|
||||
TRY_CXXFLAG([-Wall])
|
||||
TRY_CXXFLAG([-Wextra])
|
||||
@@ -152,7 +185,11 @@ TRY_CXXFLAG([-Weverything], m4_join([ ],
|
||||
[-Wno-shadow-field-in-constructor] dnl using same names in ctor seems more like a feature
|
||||
[-Wno-undefined-func-template] dnl explicit specialization to reduce build dependencies
|
||||
[-Wno-c++98-compat], dnl allow using C++11 features like `nullptr`
|
||||
[-Wno-c++98-compat-pedantic]))
|
||||
[-Wno-c++98-compat-pedantic],
|
||||
[-Wno-unsafe-pointer-arithmetic],
|
||||
[-Wno-unsafe-buffer-usage],
|
||||
[-Wno-exit-time-destructors], dnl re2c is single-threaded => no danger of race conditions
|
||||
[-Wno-switch-enum]))
|
||||
|
||||
|
||||
# needed for POSIX file API
|
||||
@@ -169,8 +206,6 @@ AC_CONFIG_FILES([
|
||||
benchmarks/submatch_dfa_aot/Makefile
|
||||
benchmarks/submatch_dfa_jit/Makefile
|
||||
benchmarks/submatch_java/Makefile
|
||||
doc/manpage.rst
|
||||
doc/help.rst
|
||||
])
|
||||
AC_CONFIG_FILES([run_tests.py],
|
||||
[chmod +x run_tests.py])
|
||||
@@ -178,9 +213,52 @@ AC_CONFIG_FILES([benchmarks/submatch_dfa_aot/run.py],
|
||||
[chmod +x benchmarks/submatch_dfa_aot/run.py])
|
||||
AC_CONFIG_FILES([benchmarks/submatch_java/run.py],
|
||||
[chmod +x benchmarks/submatch_java/run.py])
|
||||
# Custom names are needed to accommodate POSIX Make suffix rules (bmake in
|
||||
# particular) instead of the more generic and flexible GNU Make pattern rules.
|
||||
# Copies are needed to patch them in-place with build/split_man.py.
|
||||
AC_CONFIG_FILES([
|
||||
src/msg/help_re2c.rst:doc/help.rst.in
|
||||
src/msg/help_re2d.rst:doc/help.rst.in
|
||||
src/msg/help_re2go.rst:doc/help.rst.in
|
||||
src/msg/help_re2hs.rst:doc/help.rst.in
|
||||
src/msg/help_re2java.rst:doc/help.rst.in
|
||||
src/msg/help_re2js.rst:doc/help.rst.in
|
||||
src/msg/help_re2ocaml.rst:doc/help.rst.in
|
||||
src/msg/help_re2py.rst:doc/help.rst.in
|
||||
src/msg/help_re2rust.rst:doc/help.rst.in
|
||||
src/msg/help_re2v.rst:doc/help.rst.in
|
||||
src/msg/help_re2zig.rst:doc/help.rst.in
|
||||
|
||||
|
||||
AC_CONFIG_LINKS([benchmarks/submatch_java/chart.js:benchmarks/submatch_java/chart.js])
|
||||
doc/re2c.rst:doc/manpage.rst.in
|
||||
doc/re2d.rst:doc/manpage.rst.in
|
||||
doc/re2go.rst:doc/manpage.rst.in
|
||||
doc/re2hs.rst:doc/manpage.rst.in
|
||||
doc/re2java.rst:doc/manpage.rst.in
|
||||
doc/re2js.rst:doc/manpage.rst.in
|
||||
doc/re2ocaml.rst:doc/manpage.rst.in
|
||||
doc/re2py.rst:doc/manpage.rst.in
|
||||
doc/re2rust.rst:doc/manpage.rst.in
|
||||
doc/re2v.rst:doc/manpage.rst.in
|
||||
doc/re2zig.rst:doc/manpage.rst.in
|
||||
])
|
||||
# Custom names are needed to accommodate POSIX Make suffix rules (bmake in
|
||||
# particular) instead of the more generic and flexible GNU Make pattern rules.
|
||||
AC_CONFIG_LINKS([
|
||||
src/default_syntax_c.stx:include/syntax/c
|
||||
src/default_syntax_d.stx:include/syntax/d
|
||||
src/default_syntax_go.stx:include/syntax/go
|
||||
src/default_syntax_haskell.stx:include/syntax/haskell
|
||||
src/default_syntax_java.stx:include/syntax/java
|
||||
src/default_syntax_js.stx:include/syntax/js
|
||||
src/default_syntax_ocaml.stx:include/syntax/ocaml
|
||||
src/default_syntax_python.stx:include/syntax/python
|
||||
src/default_syntax_rust.stx:include/syntax/rust
|
||||
src/default_syntax_v.stx:include/syntax/v
|
||||
src/default_syntax_zig.stx:include/syntax/zig
|
||||
])
|
||||
AC_CONFIG_LINKS([
|
||||
benchmarks/submatch_java/chart.js:benchmarks/submatch_java/chart.js
|
||||
])
|
||||
|
||||
|
||||
LT_INIT([dlopen win32-dll])
|
||||
|
||||
+1
-1
@@ -6,5 +6,5 @@ the 'gh-pages-gen' branch; the files with '.rst_' extension (which constitute
|
||||
the manpage) are pulled from the 'master' branch to 'gh-pages-gen' branch and
|
||||
used together with other docs in the generation of https://re2c.org website.
|
||||
|
||||
Normally the general descriptio of each feature is in an '.rst_' file on
|
||||
Normally the general description of each feature is in an '.rst_' file on
|
||||
'master' branch, and examples are in '.rst' files on 'gh-pages-gen' branch.
|
||||
|
||||
+7
-5
@@ -1,17 +1,19 @@
|
||||
Usage
|
||||
=====
|
||||
|
||||
.. |re2c| replace:: RE2C_PROG
|
||||
|
||||
.. include:: @top_srcdir@/doc/manual/synopsis.rst_
|
||||
|
||||
OPTIONS
|
||||
=======
|
||||
|
||||
.. include:: @top_srcdir@/doc/manual/options/options.rst_
|
||||
.. include:: @top_srcdir@/doc/manual/options/debug.rst_
|
||||
.. include:: @top_srcdir@/doc/manual/options/internal.rst_
|
||||
.. include:: @top_srcdir@/doc/manual/basics/options/options.rst_
|
||||
.. include:: @top_srcdir@/doc/manual/basics/options/debug.rst_
|
||||
.. include:: @top_srcdir@/doc/manual/basics/options/internal.rst_
|
||||
|
||||
WARNINGS
|
||||
========
|
||||
|
||||
.. include:: @top_srcdir@/doc/manual/warnings/warnings_general.rst_
|
||||
.. include:: @top_srcdir@/doc/manual/warnings/warnings_list.rst_
|
||||
.. include:: @top_srcdir@/doc/manual/basics/warnings/warnings_general.rst_
|
||||
.. include:: @top_srcdir@/doc/manual/basics/warnings/warnings_list.rst_
|
||||
|
||||
+80
-75
@@ -1,13 +1,16 @@
|
||||
++++
|
||||
re2c
|
||||
++++
|
||||
+++++++++
|
||||
RE2C_PROG
|
||||
+++++++++
|
||||
|
||||
======================================================
|
||||
generate fast lexical analyzers for C/C++, Go and Rust
|
||||
======================================================
|
||||
==================================================
|
||||
generate fast lexical analyzers for RE2C_LANG_NAME
|
||||
==================================================
|
||||
|
||||
:Manual section: 1
|
||||
|
||||
.. |re2c| replace:: RE2C_PROG
|
||||
.. |lang_name| replace:: RE2C_LANG_NAME
|
||||
|
||||
SYNOPSIS
|
||||
========
|
||||
|
||||
@@ -18,7 +21,7 @@ RE2C_DISCLAIMER
|
||||
Introduction
|
||||
============
|
||||
|
||||
.. include:: @top_srcdir@/doc/manual/syntax/intro.rst_
|
||||
.. include:: @top_srcdir@/doc/manual/intro.rst_
|
||||
|
||||
Here is an example of a small program that checks if a given string contains a
|
||||
decimal number:
|
||||
@@ -27,60 +30,61 @@ decimal number:
|
||||
:literal:
|
||||
:code: RE2C_LANG
|
||||
|
||||
In the output everything between ``/*!re2c`` and ``*/`` has been replaced with
|
||||
the generated code:
|
||||
In the output |re2c| replaced the block in the middle with the generated code:
|
||||
|
||||
.. include:: @top_srcdir@/examples/RE2C_LANG/01_basic.RE2C_SOURCE_EXT
|
||||
:literal:
|
||||
:code: RE2C_LANG
|
||||
|
||||
Syntax
|
||||
Basics
|
||||
======
|
||||
.. include:: @top_srcdir@/doc/manual/basics/syntax.rst_
|
||||
|
||||
.. include:: @top_srcdir@/doc/manual/syntax/syntax.rst_
|
||||
Blocks
|
||||
------
|
||||
.. include:: @top_srcdir@/doc/manual/basics/blocks.rst_
|
||||
|
||||
Directives
|
||||
----------
|
||||
.. include:: @top_srcdir@/doc/manual/basics/directives.rst_
|
||||
|
||||
Regular expressions
|
||||
-------------------
|
||||
.. include:: @top_srcdir@/doc/manual/basics/regular_expressions.rst_
|
||||
|
||||
Configurations
|
||||
--------------
|
||||
.. include:: @top_srcdir@/doc/manual/basics/configurations.rst_
|
||||
|
||||
Program interface
|
||||
=================
|
||||
|
||||
.. include:: @top_srcdir@/doc/manual/syntax/api1.rst_
|
||||
.. include:: @top_srcdir@/doc/manual/syntax/api2_RE2C_LANG.rst_
|
||||
.. include:: @top_srcdir@/doc/manual/syntax/api3.rst_
|
||||
-----------------
|
||||
.. include:: @top_srcdir@/doc/manual/basics/api/api1.rst_
|
||||
.. include:: @top_srcdir@/doc/manual/basics/api/api2_RE2C_LANG.rst_
|
||||
.. include:: @top_srcdir@/doc/manual/basics/api/api3.rst_
|
||||
|
||||
Options
|
||||
=======
|
||||
-------
|
||||
|
||||
Some of the options have corresponding `configurations`_,
|
||||
others are global and cannot be changed after re2c starts reading the input file.
|
||||
Debug options generally require building re2c in debug configuration.
|
||||
Internal options are useful for experimenting with the algorithms used in re2c.
|
||||
|
||||
.. include:: @top_srcdir@/doc/manual/options/options.rst_
|
||||
.. include:: @top_srcdir@/doc/manual/options/debug.rst_
|
||||
.. include:: @top_srcdir@/doc/manual/options/internal.rst_
|
||||
.. include:: @top_srcdir@/doc/manual/basics/options/options.rst_
|
||||
.. include:: @top_srcdir@/doc/manual/basics/options/debug.rst_
|
||||
.. include:: @top_srcdir@/doc/manual/basics/options/internal.rst_
|
||||
|
||||
Warnings
|
||||
========
|
||||
--------
|
||||
|
||||
Warnings can be invividually enabled, disabled and turned into an error.
|
||||
|
||||
.. include:: @top_srcdir@/doc/manual/warnings/warnings_general.rst_
|
||||
.. include:: @top_srcdir@/doc/manual/warnings/warnings_list.rst_
|
||||
.. include:: @top_srcdir@/doc/manual/basics/warnings/warnings_general.rst_
|
||||
.. include:: @top_srcdir@/doc/manual/basics/warnings/warnings_list.rst_
|
||||
|
||||
Blocks and directives
|
||||
=====================
|
||||
.. include:: @top_srcdir@/doc/manual/directives/directives.rst_
|
||||
|
||||
API primitives
|
||||
==============
|
||||
.. include:: @top_srcdir@/doc/manual/api/interface.rst_
|
||||
|
||||
Configurations
|
||||
==============
|
||||
.. include:: @top_srcdir@/doc/manual/configurations/configurations.rst_
|
||||
|
||||
Regular expressions
|
||||
===================
|
||||
.. include:: @top_srcdir@/doc/manual/regexps/regular_expressions.rst_
|
||||
Syntax files
|
||||
------------
|
||||
.. include:: @top_srcdir@/doc/manual/basics/syntax_files.rst_
|
||||
|
||||
Handling the end of input
|
||||
=========================
|
||||
@@ -97,8 +101,8 @@ Handling the end of input
|
||||
.. include:: @top_srcdir@/examples/RE2C_LANG/eof/02_bounds_checking.re
|
||||
:literal:
|
||||
:code: RE2C_LANG
|
||||
.. include:: @top_srcdir@/doc/manual/eof/04_generic_api.rst_
|
||||
.. include:: @top_srcdir@/examples/RE2C_LANG/eof/05_generic_api_eof_rule.re
|
||||
.. include:: @top_srcdir@/doc/manual/eof/04_fake_sentinel.rst_
|
||||
.. include:: @top_srcdir@/examples/RE2C_LANG/eof/04_fake_sentinel.re
|
||||
:literal:
|
||||
:code: RE2C_LANG
|
||||
|
||||
@@ -114,115 +118,118 @@ Buffer refilling
|
||||
:literal:
|
||||
:code: RE2C_LANG
|
||||
|
||||
Features
|
||||
========
|
||||
|
||||
Multiple blocks
|
||||
===============
|
||||
.. include:: @top_srcdir@/doc/manual/conditions/blocks.rst_
|
||||
---------------
|
||||
.. include:: @top_srcdir@/doc/manual/features/conditions/blocks.rst_
|
||||
.. include:: @top_srcdir@/examples/RE2C_LANG/conditions/parse_u32_blocks.re
|
||||
:literal:
|
||||
:code: RE2C_LANG
|
||||
|
||||
Start conditions
|
||||
================
|
||||
.. include:: @top_srcdir@/doc/manual/conditions/conditions.rst_
|
||||
----------------
|
||||
.. include:: @top_srcdir@/doc/manual/features/conditions/conditions.rst_
|
||||
.. include:: @top_srcdir@/examples/RE2C_LANG/conditions/parse_u32_conditions.re
|
||||
:literal:
|
||||
:code: RE2C_LANG
|
||||
|
||||
Storable state
|
||||
==============
|
||||
.. include:: @top_srcdir@/doc/manual/state/state.rst_
|
||||
--------------
|
||||
.. include:: @top_srcdir@/doc/manual/features/state/state.rst_
|
||||
.. include:: @top_srcdir@/examples/RE2C_LANG/state/push.re
|
||||
:literal:
|
||||
:code: RE2C_LANG
|
||||
|
||||
Reusable blocks
|
||||
===============
|
||||
.. include:: @top_srcdir@/doc/manual/reuse/reuse.rst_
|
||||
---------------
|
||||
.. include:: @top_srcdir@/doc/manual/features/reuse/reuse.rst_
|
||||
|
||||
Example of a ``!use`` directive
|
||||
-------------------------------
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
.. include:: @top_srcdir@/examples/RE2C_LANG/reuse/usedir.re
|
||||
:literal:
|
||||
:code: RE2C_LANG
|
||||
|
||||
Example of a ``/*!use:re2c ... */`` block
|
||||
-----------------------------------------
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
.. include:: @top_srcdir@/examples/RE2C_LANG/reuse/reuse.re
|
||||
:literal:
|
||||
:code: RE2C_LANG
|
||||
|
||||
Submatch extraction
|
||||
===================
|
||||
.. include:: @top_srcdir@/doc/manual/submatch/submatch.rst_
|
||||
.. include:: @top_srcdir@/doc/manual/submatch/submatch_example_stags.rst_
|
||||
-------------------
|
||||
.. include:: @top_srcdir@/doc/manual/features/submatch/submatch.rst_
|
||||
.. include:: @top_srcdir@/doc/manual/features/submatch/submatch_example_stags.rst_
|
||||
.. include:: @top_srcdir@/examples/RE2C_LANG/submatch/01_stags.re
|
||||
:literal:
|
||||
:code: RE2C_LANG
|
||||
.. include:: @top_srcdir@/doc/manual/submatch/submatch_example_stags_fill.rst_
|
||||
.. include:: @top_srcdir@/doc/manual/features/submatch/submatch_example_stags_fill.rst_
|
||||
.. include:: @top_srcdir@/examples/RE2C_LANG/submatch/01_stags_fill.re
|
||||
:literal:
|
||||
:code: RE2C_LANG
|
||||
.. include:: @top_srcdir@/doc/manual/submatch/submatch_example_posix.rst_
|
||||
.. include:: @top_srcdir@/examples/RE2C_LANG/submatch/03_posix.re
|
||||
.. include:: @top_srcdir@/doc/manual/features/submatch/submatch_example_captures.rst_
|
||||
.. include:: @top_srcdir@/examples/RE2C_LANG/submatch/03_captures.re
|
||||
:literal:
|
||||
:code: RE2C_LANG
|
||||
.. include:: @top_srcdir@/doc/manual/submatch/submatch_example_mtags.rst_
|
||||
.. include:: @top_srcdir@/doc/manual/features/submatch/submatch_example_mtags.rst_
|
||||
.. include:: @top_srcdir@/examples/RE2C_LANG/submatch/02_mtags.re
|
||||
:literal:
|
||||
:code: RE2C_LANG
|
||||
|
||||
Encoding support
|
||||
================
|
||||
.. include:: @top_srcdir@/doc/manual/encodings/encodings.rst_
|
||||
----------------
|
||||
.. include:: @top_srcdir@/doc/manual/features/encodings/encodings.rst_
|
||||
.. include:: @top_srcdir@/examples/RE2C_LANG/encodings/unicode_identifier.re
|
||||
:literal:
|
||||
:code: RE2C_LANG
|
||||
|
||||
Include files
|
||||
=============
|
||||
.. include:: @top_srcdir@/doc/manual/includes/includes.rst_
|
||||
-------------
|
||||
.. include:: @top_srcdir@/doc/manual/features/includes/includes.rst_
|
||||
|
||||
Include file 1 (definitions.RE2C_HEADER_EXT)
|
||||
------------------------------------------
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
.. include:: @top_srcdir@/examples/RE2C_LANG/includes/definitions.RE2C_HEADER_EXT
|
||||
:literal:
|
||||
:code: RE2C_LANG
|
||||
|
||||
Include file 2 (extra_rules.re.inc)
|
||||
-----------------------------------
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
.. include:: @top_srcdir@/examples/RE2C_LANG/includes/extra_rules.re.inc
|
||||
:literal:
|
||||
:code: RE2C_LANG
|
||||
|
||||
Input file
|
||||
----------
|
||||
~~~~~~~~~~
|
||||
.. include:: @top_srcdir@/examples/RE2C_LANG/includes/include.re
|
||||
:literal:
|
||||
:code: RE2C_LANG
|
||||
|
||||
Header files
|
||||
============
|
||||
.. include:: @top_srcdir@/doc/manual/headers/headers.rst_
|
||||
------------
|
||||
.. include:: @top_srcdir@/doc/manual/features/headers/headers.rst_
|
||||
|
||||
Input file
|
||||
----------
|
||||
~~~~~~~~~~
|
||||
.. include:: @top_srcdir@/examples/RE2C_LANG/headers/header.re
|
||||
:literal:
|
||||
:code: RE2C_LANG
|
||||
|
||||
Header file
|
||||
-----------
|
||||
~~~~~~~~~~~
|
||||
.. include:: @top_srcdir@/examples/RE2C_LANG/headers/lexer/state.RE2C_HEADER_EXT
|
||||
:literal:
|
||||
:code: RE2C_LANG
|
||||
|
||||
Skeleton programs
|
||||
=================
|
||||
.. include:: @top_srcdir@/doc/manual/skeleton/skeleton.rst_
|
||||
-----------------
|
||||
.. include:: @top_srcdir@/doc/manual/features/skeleton/skeleton.rst_
|
||||
|
||||
Visualization and debug
|
||||
=======================
|
||||
.. include:: @top_srcdir@/doc/manual/dot/dot.rst_
|
||||
-----------------------
|
||||
.. include:: @top_srcdir@/doc/manual/features/dot/dot.rst_
|
||||
|
||||
SEE ALSO
|
||||
========
|
||||
@@ -231,6 +238,4 @@ Similar programs are flex(1), lex(1), quex(http://quex.sourceforge.net).
|
||||
|
||||
AUTHORS
|
||||
=======
|
||||
re2c was originaly written by Peter Bumbulis in 1993.
|
||||
Since then it has been developed and maintained by multiple volunteers;
|
||||
mots notably, Brain Young, Marcus Boerger, Dan Nuffer and Ulya Trofimovich.
|
||||
.. include:: @top_srcdir@/doc/manual/authors.rst_
|
||||
|
||||
@@ -1,230 +0,0 @@
|
||||
Here is a list of API primitives that may be used by the generated
|
||||
code in order to interface with the outer program.
|
||||
Which primitives are needed depends on multiple factors, including
|
||||
the complexity of regular expressions, input representation,
|
||||
buffering, the use of various features and so on.
|
||||
All the necessary primitives should be defined by the user in the form
|
||||
of macros, functions, variables, free-form pieces of code, or any other
|
||||
suitable form.
|
||||
re2c does not (and cannot) check the definitions, so if anything is
|
||||
missing or defined incorrectly the generated code will not compile.
|
||||
|
||||
``YYCTYPE``
|
||||
The type of the input characters (code units).
|
||||
For ASCII, EBCDIC and UTF-8 encodings it should be 1-byte unsigned integer.
|
||||
For UTF-16 or UCS-2 it should be 2-byte unsigned integer. For UTF-32 it
|
||||
should be 4-byte unsigned integer.
|
||||
|
||||
``YYCURSOR``
|
||||
A pointer-like l-value that stores the current input position (usually a
|
||||
pointer of type ``YYCTYPE*``). Initially ``YYCURSOR`` should point to the
|
||||
first input character. It is advanced by the generated code.
|
||||
When a rule matches, ``YYCURSOR`` points to the position after the
|
||||
last matched character. It is used only in C pointer API.
|
||||
|
||||
``YYLIMIT``
|
||||
A pointer-like r-value that stores the end of input position (usually a
|
||||
pointer of type ``YYCTYPE*``). Initially ``YYLIMIT`` should point to the
|
||||
position after the last available input character. It is not changed by the
|
||||
generated code. The lexer compares ``YYCURSOR`` to ``YYLIMIT``
|
||||
in order to determine if there are enough input characters left.
|
||||
``YYLIMIT`` is used only in C pointer API.
|
||||
|
||||
``YYMARKER``
|
||||
A pointer-like l-value (usually a pointer of type ``YYCTYPE*``)
|
||||
that stores the position of the latest matched rule. It is used to
|
||||
restore the ``YYCURSOR`` position if the longer match fails and
|
||||
the lexer needs to rollback. Initialization is not
|
||||
needed. ``YYMARKER`` is used only in C pointer API.
|
||||
|
||||
``YYCTXMARKER``
|
||||
A pointer-like l-value that stores the position of the trailing context
|
||||
(usually a pointer of type ``YYCTYPE*``). No initialization is needed.
|
||||
It is used only in C pointer API, and only with the lookahead operator
|
||||
``/``.
|
||||
|
||||
``YYFILL``
|
||||
A generic API primitive with one argument ``len``.
|
||||
``YYFILL`` should provide at least ``len`` more input characters or fail.
|
||||
If ``re2c:eof`` is used, then ``len`` is always ``1`` and ``YYFILL`` should
|
||||
always return to the calling function; zero return value indicates success.
|
||||
If ``re2c:eof`` is not used, then ``YYFILL`` return value is ignored and it
|
||||
should not return on failure. The maximum value of ``len`` is ``YYMAXFILL``.
|
||||
The definition of ``YYFILL`` can be either function-like or free-form
|
||||
depending on the API style (see ``re2c:api:style`` and
|
||||
``re2c:define:YYFILL:naked``).
|
||||
|
||||
``YYMAXFILL``
|
||||
An integral constant equal to the maximum value of the argument to
|
||||
``YYFILL``. It can be generated with ``/*!max:re2c*/`` directive.
|
||||
|
||||
``YYLESSTHAN``
|
||||
A generic API primitive with one argument ``len``.
|
||||
It should be defined as an r-value of boolean type that equals ``true`` if
|
||||
and only if there are less than ``len`` input characters left.
|
||||
The definition can be either function-like or free-form depending on the
|
||||
API style (see ``re2c:api:style``).
|
||||
|
||||
``YYPEEK``
|
||||
A generic API primitive with no arguments.
|
||||
It should be defined as an r-value of type ``YYCTYPE`` that is equal to the
|
||||
character at the current input position. The definition can be either
|
||||
function-like or free-form depending on the API style (see
|
||||
``re2c:api:style``).
|
||||
|
||||
``YYSKIP``
|
||||
A generic API primitive with no arguments.
|
||||
``YYSKIP`` should advance the current input position by one
|
||||
character. The definition can be either function-like or free-form
|
||||
depending on the API style (see ``re2c:api:style``).
|
||||
|
||||
``YYBACKUP``
|
||||
A generic API primitive with no arguments.
|
||||
``YYBACKUP`` should save the current input position, which is
|
||||
later restored with ``YYRESTORE``.
|
||||
The definition should be either function-like or free-form depending on the
|
||||
API style (see ``re2c:api:style``).
|
||||
|
||||
``YYRESTORE``
|
||||
A generic API primitive with no arguments.
|
||||
``YYRESTORE`` should restore the current input position to the
|
||||
value saved by ``YYBACKUP``.
|
||||
The definition should be either function-like or free-form depending on the
|
||||
API style (see ``re2c:api:style``).
|
||||
|
||||
``YYBACKUPCTX``
|
||||
A generic API primitive with zero arguments.
|
||||
``YYBACKUPCTX`` should save the current input position as the
|
||||
position of the trailing context, which is later restored by
|
||||
``YYRESTORECTX``.
|
||||
The definition should be either function-like or free-form depending on the
|
||||
API style (see ``re2c:api:style``).
|
||||
|
||||
``YYRESTORECTX``
|
||||
A generic API primitive with no arguments.
|
||||
``YYRESTORECTX`` should restore the trailing context position
|
||||
saved with ``YYBACKUPCTX``.
|
||||
The definition should be either function-like or free-form depending on the
|
||||
API style (see ``re2c:api:style``).
|
||||
|
||||
``YYRESTORETAG``
|
||||
A generic API primitive with one argument ``tag``.
|
||||
``YYRESTORETAG`` should restore the trailing context position
|
||||
to the value of ``tag``.
|
||||
The definition should be either function-like or free-form depending on the
|
||||
API style (see ``re2c:api:style``).
|
||||
|
||||
``YYSTAGP``
|
||||
A generic API primitive with one argument ``tag``, where ``tag`` can be a
|
||||
pointer or an offset (see submatch extraction section for details).
|
||||
``YYSTAGP`` should set ``tag`` to the current input position.
|
||||
The definition should be either function-like or free-form depending on the
|
||||
API style (see ``re2c:api:style``).
|
||||
|
||||
``YYSTAGN``
|
||||
A generic API primitive with one argument ``tag``, where ``tag`` can be a
|
||||
pointer or an offset (see submatch extraction section for details).
|
||||
``YYSTAGN`` should to set ``tag`` to a value that represents non-existent
|
||||
input position.
|
||||
The definition should be either function-like or free-form depending on the
|
||||
API style (see ``re2c:api:style``).
|
||||
|
||||
``YYMTAGP``
|
||||
A generic API primitive with one argument ``tag``.
|
||||
``YYMTAGP`` should append the current position to the submatch history of
|
||||
``tag`` (see the submatch extraction section for details.)
|
||||
The definition should be either function-like or free-form depending on the
|
||||
API style (see ``re2c:api:style``).
|
||||
|
||||
``YYMTAGN``
|
||||
A generic API primitive with one argument ``tag``.
|
||||
``YYMTAGN`` should append a value that represents non-existent input
|
||||
position position to the submatch history of ``tag`` (see the submatch
|
||||
extraction section for details.)
|
||||
The definition can be either function-like or free-form depending on the
|
||||
API style (see ``re2c:api:style``).
|
||||
|
||||
``YYSHIFT``
|
||||
A generic API primitive with one argument ``shift``.
|
||||
``YYSHIFT`` should shift the current input position by
|
||||
``shift`` characters (the shift value may be negative). The definition
|
||||
can be either function-like or free-form depending on the API style
|
||||
(see ``re2c:api:style``).
|
||||
|
||||
``YYSHIFTSTAG``
|
||||
A generic API primitive with two arguments, ``tag`` and ``shift``.
|
||||
``YYSHIFTSTAG`` should shift ``tag`` by ``shift`` characters
|
||||
(the shift value may be negative).
|
||||
The definition can be either function-like or free-form depending on the
|
||||
API style (see ``re2c:api:style``).
|
||||
|
||||
``YYSHIFTMTAG``
|
||||
A generic API primitive with two arguments, ``tag`` and ``shift``.
|
||||
``YYSHIFTMTAG`` should shift the latest value in the history
|
||||
of ``tag`` by ``shift`` characters (the shift value may be negative).
|
||||
The definition should be either function-like or free-form depending on the
|
||||
API style (see ``re2c:api:style``).
|
||||
|
||||
``YYMAXNMATCH``
|
||||
An integral constant equal to the maximal number of POSIX capturing groups
|
||||
in a rule. It is generated with ``/*!maxnmatch:re2c*/`` directive.
|
||||
|
||||
``YYCONDTYPE``
|
||||
The type of the condition enum.
|
||||
It should be generated either with the ``/*!types:re2c*/``
|
||||
directive or the ``-t`` ``--type-header`` option.
|
||||
|
||||
``YYGETCONDITION``
|
||||
An API primitive with zero arguments.
|
||||
It should be defined as an r-value of type ``YYCONDTYPE`` that is equal to
|
||||
the current condition identifier. The definition can be either function-like
|
||||
or free-form depending on the API style (see ``re2c:api:style`` and
|
||||
``re2c:define:YYGETCONDITION:naked``).
|
||||
|
||||
``YYSETCONDITION``
|
||||
An API primitive with one argument ``cond``.
|
||||
The meaning of ``YYSETCONDITION`` is to set the current condition
|
||||
identifier to ``cond``.
|
||||
The definition should be either function-like or free-form depending on the
|
||||
API style (see ``re2c:api:style`` and ``re2c:define:YYSETCONDITION@cond``).
|
||||
|
||||
``YYGETSTATE``
|
||||
An API primitive with zero arguments.
|
||||
It should be defined as an r-value of integer type that is equal to the
|
||||
current lexer state. Should be initialized to ``-1``. The definition can be
|
||||
either function-like or free-form depending on the API style (see
|
||||
``re2c:api:style`` and ``re2c:define:YYGETSTATE:naked``).
|
||||
|
||||
``YYSETSTATE``
|
||||
An API primitive with one argument ``state``.
|
||||
The meaning of ``YYSETSTATE`` is to set the current lexer state to
|
||||
``state``.
|
||||
The definition should be either function-like or free-form depending on the
|
||||
API style (see ``re2c:api:style`` and ``re2c:define:YYSETSTATE@state``).
|
||||
|
||||
``YYDEBUG``
|
||||
A debug API primitive with two arguments. It can be used to debug the
|
||||
generated code (with ``-d`` ``--debug-output`` option). ``YYDEBUG`` should
|
||||
return no value and accept two arguments: ``state`` (either a DFA state
|
||||
index or ``-1``) and ``symbol`` (the current input symbol).
|
||||
|
||||
``yych``
|
||||
An l-value of type ``YYCTYPE`` that stores the current input character.
|
||||
User definition is necessary only with ``-f`` ``--storable-state`` option.
|
||||
|
||||
``yyaccept``
|
||||
An l-value of unsigned integral type that stores the number of the latest
|
||||
matched rule.
|
||||
User definition is necessary only with ``-f`` ``--storable-state`` option.
|
||||
|
||||
``yynmatch``
|
||||
An l-value of unsigned integral type that stores the number of POSIX
|
||||
capturing groups in the matched rule.
|
||||
Used only with ``-P`` ``--posix-captures`` option.
|
||||
|
||||
``yypmatch``
|
||||
An array of l-values that are used to hold the tag values corresponding
|
||||
to the capturing parentheses in the matching rule. Array length must be
|
||||
at least ``yynmatch * 2`` (usually ``YYMAXNMATCH * 2`` is a good choice).
|
||||
Used only with ``-P`` ``--posix-captures`` option.
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
|re2c| was originally written by Peter Bumbulis (peter@csg.uwaterloo.ca) in 1993.
|
||||
Marcus Boerger and Dan Nuffer spent several years to turn the original idea into
|
||||
a production ready code generator. Since then it has been maintained and
|
||||
developed by multiple volunteers, most notably,
|
||||
Brian Young (bayoung@acm.org),
|
||||
`Marcus Boerger <https://github.com/helly25>`_,
|
||||
Dan Nuffer (nuffer@users.sourceforge.net),
|
||||
`Ulya Trofimovich <https://github.com/skvadrik>`_ (skvadrik@gmail.com),
|
||||
`Serghei Iakovlev <https://github.com/sergeyklay>`_,
|
||||
`Sergei Trofimovich <https://github.com/trofi>`_,
|
||||
`Petr Skocik <https://github.com/pskocik>`_,
|
||||
`ligfx <https://github.com/ligfx>`_
|
||||
and `raekye <https://github.com/raekye>`_.
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
The generated code interfaces with the outer program with the help of
|
||||
*primitives*, collectively referred to as the *API*.
|
||||
Which primitives should be defined for a particular program depends on multiple
|
||||
factors, including the complexity of regular expressions, input representation,
|
||||
buffering and the use of various features. All the necessary primitives should
|
||||
be defined by the user in the form of macros, functions, variables or any other
|
||||
suitable form that makes the generated code syntactically and semantically
|
||||
correct. |re2c| does not (and cannot) check the definitions, so if anything is
|
||||
missing or defined incorrectly, the generated program may have compile-time or
|
||||
run-time errors.
|
||||
This manual provides examples of API definitions in the most common cases.
|
||||
|
||||
.. _generic_api:
|
||||
@@ -0,0 +1,99 @@
|
||||
|
||||
re2c has three API flavors that define the core set of primitives used by a
|
||||
program:
|
||||
|
||||
**Simple API**
|
||||
This is the default API for C/C++ backend. It consists of primitives
|
||||
``YYCURSOR``, ``YYMARKER``, ``YYCTXMARKER`` and ``YYLIMIT``, which
|
||||
should be defined as pointers of type ``YYCTYPE*``.
|
||||
|
||||
|
|
||||
|
||||
**Record API**
|
||||
(*added in version 4.0*)
|
||||
Record API is useful in cases when lexer state must be stored in a struct.
|
||||
It is enabled with ``--api record`` option or ``re2c:api = record``
|
||||
configuration. This API consists of a variable ``yyrecord`` (the
|
||||
name can be overridden with ``re2c:yyrecord``) that should be
|
||||
defined as a struct with fields ``yycursor``, ``yymarker``, ``yyctxmarker``,
|
||||
``yylimit`` (only the fields used by the generated code need to be defined,
|
||||
and their names can be configured).
|
||||
|
||||
|
|
||||
|
||||
**Generic API**
|
||||
(*added in version 0.14*)
|
||||
This is the most flexible API. It is enabled with ``--api generic`` option
|
||||
or ``re2c:api = generic`` configuration.
|
||||
This API contains primitives for generic operations:
|
||||
``YYPEEK``,
|
||||
``YYSKIP``,
|
||||
``YYBACKUP``,
|
||||
``YYBACKUPCTX``,
|
||||
``YYSTAGP``,
|
||||
``YYSTAGN``,
|
||||
``YYMTAGP``,
|
||||
``YYMTAGN``,
|
||||
``YYRESTORE``,
|
||||
``YYRESTORECTX``,
|
||||
``YYRESTORETAG``,
|
||||
``YYSHIFT``,
|
||||
``YYSHIFTSTAG``,
|
||||
``YYSHIFTMTAG``,
|
||||
``YYLESSTHAN``.
|
||||
Generic API supports two styles that determine the form in which the
|
||||
primitives should be defined:
|
||||
|
||||
|
|
||||
|
||||
**Free-form**
|
||||
Free-form style is enabled with configuration
|
||||
``re2c:api:style = free-form``.
|
||||
In this style interface primitives should be defined as free-form
|
||||
pieces of code with interpolated variables of the form ``@@{var}`` or
|
||||
optionally just ``@@`` if there is a single variable. The set of
|
||||
variables is specific to each primitive. Here's how free-form generic
|
||||
API can be defined in terms of pointers ``cursor``, ``limit``,
|
||||
``marker`` and ``ctxmarker``:
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
/*!re2c
|
||||
re2c:YYPEEK = "*cursor";
|
||||
re2c:YYSKIP = "++cursor;";
|
||||
re2c:YYBACKUP = "marker = cursor;";
|
||||
re2c:YYRESTORE = "cursor = marker;";
|
||||
re2c:YYBACKUPCTX = "ctxmarker = cursor;";
|
||||
re2c:YYRESTORECTX = "cursor = ctxmarker;";
|
||||
re2c:YYRESTORETAG = "cursor = ${tag};";
|
||||
re2c:YYLESSTHAN = "limit - cursor < @@{len}";
|
||||
re2c:YYSTAGP = "@@{tag} = cursor;";
|
||||
re2c:YYSTAGN = "@@{tag} = NULL;";
|
||||
re2c:YYSHIFT = "cursor += @@{shift};";
|
||||
re2c:YYSHIFTSTAG = "@@{tag} += @@{shift};";
|
||||
*/
|
||||
|
||||
|
|
||||
|
||||
**Function-like**
|
||||
Historically function-like style is the default one. It also can be
|
||||
enabled with configuration ``re2c:api:style = functions``. In this
|
||||
style primitives should be defined as functions or macros with
|
||||
parentheses, accepting the necessary arguments. Here's how function-like
|
||||
generic API can be defined in terms of pointers ``cursor``, ``limit``,
|
||||
``marker`` and ``ctxmarker`` using preprocessor macros:
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
#define YYPEEK() *cursor
|
||||
#define YYSKIP() ++cursor
|
||||
#define YYBACKUP() marker = cursor
|
||||
#define YYRESTORE() cursor = marker
|
||||
#define YYBACKUPCTX() ctxmarker = cursor
|
||||
#define YYRESTORECTX() cursor = ctxmarker
|
||||
#define YYRESTORETAG(tag) cursor = tag
|
||||
#define YYLESSTHAN(len) limit - cursor < len
|
||||
#define YYSTAGP(tag) tag = cursor
|
||||
#define YYSTAGN(tag) tag = NULL
|
||||
#define YYSHIFT(shift) cursor += shift
|
||||
#define YYSHIFTSTAG(tag, shift) tag += shift
|
||||
@@ -0,0 +1,41 @@
|
||||
|
||||
re2d has three API flavors that define the core set of primitives used by a
|
||||
program:
|
||||
|
||||
**Simple API**
|
||||
This is the default API for D backend. It consists of primitives
|
||||
``YYCURSOR``, ``YYMARKER``, ``YYCTXMARKER`` and ``YYLIMIT``, which
|
||||
should be defined as pointers of type ``YYCTYPE*``.
|
||||
|
||||
|
|
||||
|
||||
**Record API**
|
||||
Record API is useful in cases when lexer state must be stored in a struct.
|
||||
It is enabled with ``--api record`` option or ``re2c:api = record``
|
||||
configuration. This API consists of a variable ``yyrecord`` (the
|
||||
name can be overridden with ``re2c:yyrecord``) that should be
|
||||
defined as a struct with fields ``yycursor``, ``yymarker``, ``yyctxmarker``,
|
||||
``yylimit`` (only the fields used by the generated code need to be defined,
|
||||
and their names can be configured).
|
||||
|
||||
|
|
||||
|
||||
**Generic API**
|
||||
This is the most flexible API. It is enabled with ``--api generic`` option
|
||||
or ``re2c:api = generic`` configuration.
|
||||
It contains primitives for generic operations:
|
||||
``YYPEEK``,
|
||||
``YYSKIP``,
|
||||
``YYBACKUP``,
|
||||
``YYBACKUPCTX``,
|
||||
``YYSTAGP``,
|
||||
``YYSTAGN``,
|
||||
``YYMTAGP``,
|
||||
``YYMTAGN``,
|
||||
``YYRESTORE``,
|
||||
``YYRESTORECTX``,
|
||||
``YYRESTORETAG``,
|
||||
``YYSHIFT``,
|
||||
``YYSHIFTSTAG``,
|
||||
``YYSHIFTMTAG``,
|
||||
``YYLESSTHAN``.
|
||||
@@ -0,0 +1,96 @@
|
||||
|
||||
re2go has three API flavors that define the core set of primitives used by a
|
||||
program:
|
||||
|
||||
**Simple API**
|
||||
(*added in version 4.0*)
|
||||
This is a basic API that can be enabled with ``--api simple`` option or
|
||||
``re2c:api = simple`` configuration. It consists of the following
|
||||
primitives: ``YYINPUT`` (which should be defined as a sequence of code
|
||||
units, e.g. a string) and ``YYCURSOR``, ``YYMARKER``, ``YYCTXMARKER``,
|
||||
``YYLIMIT`` (which should be defined as indices in ``YYINPUT``).
|
||||
|
||||
|
|
||||
|
||||
**Record API**
|
||||
(*added in version 4.0*)
|
||||
Record API is useful in cases when lexer state must be stored in a struct.
|
||||
It is enabled with ``--api record`` option or ``re2c:api = record``
|
||||
configuration. This API consists of a variable ``yyrecord`` (the
|
||||
name can be overridden with ``re2c:yyrecord``) that should be
|
||||
defined as a struct with fields ``yyinput``, ``yycursor``, ``yymarker``,
|
||||
``yyctxmarker``, ``yylimit`` (only the fields used by the generated code
|
||||
need to be defined, and their names can be configured).
|
||||
|
||||
|
|
||||
|
||||
**Generic API**
|
||||
This is the most flexible API and the default API for the Go backend.
|
||||
It contains primitives for generic operations:
|
||||
``YYPEEK``,
|
||||
``YYSKIP``,
|
||||
``YYBACKUP``,
|
||||
``YYBACKUPCTX``,
|
||||
``YYSTAGP``,
|
||||
``YYSTAGN``,
|
||||
``YYMTAGP``,
|
||||
``YYMTAGN``,
|
||||
``YYRESTORE``,
|
||||
``YYRESTORECTX``,
|
||||
``YYRESTORETAG``,
|
||||
``YYSHIFT``,
|
||||
``YYSHIFTSTAG``,
|
||||
``YYSHIFTMTAG``,
|
||||
``YYLESSTHAN``.
|
||||
Generic API supports two styles that determine the form in which the
|
||||
primitives should be defined:
|
||||
|
||||
|
|
||||
|
||||
**Free-form**
|
||||
Free-form style is the default one. It can also be enabled with
|
||||
configuration ``re2c:api:style = free-form``.
|
||||
In this style interface primitives should be defined as free-form
|
||||
pieces of code with interpolated variables of the form ``@@{var}`` or
|
||||
optionally just ``@@`` if there is a single variable. The set of
|
||||
variables is specific to each primitive. Here's how free-form generic
|
||||
API can be defined in terms of integer variables ``cursor``, ``limit``,
|
||||
``marker``, ``ctxmarker`` and a string (or a byte slice) ``data``:
|
||||
|
||||
.. code-block:: go
|
||||
|
||||
/*!re2c
|
||||
re2c:YYPEEK = "data[cursor]";
|
||||
re2c:YYSKIP = "cursor++";
|
||||
re2c:YYBACKUP = "marker = cursor";
|
||||
re2c:YYRESTORE = "cursor = marker";
|
||||
re2c:YYBACKUPCTX = "ctxmarker = cursor";
|
||||
re2c:YYRESTORECTX = "cursor = ctxmarker";
|
||||
re2c:YYRESTORETAG = "cursor = ${tag}";
|
||||
re2c:YYLESSTHAN = "limit - cursor < @@{len}";
|
||||
re2c:YYSTAGP = "@@{tag} = cursor";
|
||||
re2c:YYSTAGN = "@@{tag} = -1";
|
||||
re2c:YYSHIFT = "cursor += @@{shift}";
|
||||
re2c:YYSHIFTSTAG = "@@{tag} += @@{shift}";
|
||||
*/
|
||||
|
||||
|
|
||||
|
||||
**Function-like**
|
||||
Function-like style is enabled with configuration
|
||||
``re2c:api:style = functions``. In this style primitives should be
|
||||
defined as closures accepting the necessary arguments. Here's how
|
||||
function-like generic API can be defined in terms of integer variables
|
||||
``cursor``, ``limit``, ``marker``, ``ctxmarker`` and a string (or a byte
|
||||
slice) ``data``:
|
||||
|
||||
.. code-block:: go
|
||||
|
||||
YYPEEK := func() byte { return data[cursor] }
|
||||
YYSKIP := func() { cursor++ }
|
||||
YYBACKUP := func() { marker = cursor }
|
||||
YYRESTORE := func() { cursor = marker }
|
||||
YYBACKUPCTX := func() { ctxmarker = cursor }
|
||||
YYRESTORECTX := func() { cursor = ctxmarker }
|
||||
YYLESSTHAN := func(n int) bool { return limit-cursor < n }
|
||||
YYSHIFT := func(n int) { cursor += n }
|
||||
@@ -0,0 +1,35 @@
|
||||
|
||||
re2hs has two API flavors that define the core set of primitives used by a
|
||||
program:
|
||||
|
||||
**Record API**
|
||||
Record API is the default API for the Haskell backend.
|
||||
This API consists of a binding ``yyrecord`` (the name can be overridden with
|
||||
``re2c:yyrecord``) that should be defined as a record with fields
|
||||
``_yyinput``, ``_yycursor``, ``_yymarker``, ``_yyctxmarker``, ``_yylimit``.
|
||||
Only the fields used by the generated code need to be defined, and their
|
||||
names can be configured.
|
||||
|
||||
|
|
||||
|
||||
**Generic API**
|
||||
This is the most flexible API. It is enabled with ``--api generic`` option
|
||||
or ``re2c:api = generic`` configuration.
|
||||
It contains primitives for generic operations:
|
||||
``YYPEEK``,
|
||||
``YYSKIP``,
|
||||
``YYBACKUP``,
|
||||
``YYBACKUPCTX``,
|
||||
``YYSTAGP``,
|
||||
``YYSTAGN``,
|
||||
``YYMTAGP``,
|
||||
``YYMTAGN``,
|
||||
``YYRESTORE``,
|
||||
``YYRESTORECTX``,
|
||||
``YYRESTORETAG``,
|
||||
``YYCOPYSTAG``,
|
||||
``YYCOPYMTAG``,
|
||||
``YYSHIFT``,
|
||||
``YYSHIFTSTAG``,
|
||||
``YYSHIFTMTAG``,
|
||||
``YYLESSTHAN``.
|
||||
@@ -0,0 +1,42 @@
|
||||
|
||||
re2java has three API flavors that define the core set of primitives used by a
|
||||
program:
|
||||
|
||||
**Simple API**
|
||||
This is the default API for the Java backend. It consists of the following
|
||||
primitives: ``YYINPUT`` (which should be defined as a sequence of code
|
||||
units, e.g. a string) and ``YYCURSOR``, ``YYMARKER``, ``YYCTXMARKER``,
|
||||
``YYLIMIT`` (which should be defined as indices in ``YYINPUT``).
|
||||
|
||||
|
|
||||
|
||||
**Record API**
|
||||
Record API is useful in cases when lexer state must be stored in a class.
|
||||
It is enabled with ``--api record`` option or ``re2c:api = record``
|
||||
configuration. This API consists of a variable ``yyrecord`` (the
|
||||
name can be overridden with ``re2c:yyrecord``) that should be
|
||||
defined as a class with fields ``yyinput``, ``yycursor``, ``yymarker``,
|
||||
``yyctxmarker``, ``yylimit`` (only the fields used by the generated code
|
||||
need to be defined, and their names can be configured).
|
||||
|
||||
|
|
||||
|
||||
**Generic API**
|
||||
This is the most flexible API. It is enabled with ``--api generic`` option
|
||||
or ``re2c:api = generic`` configuration.
|
||||
It contains primitives for generic operations:
|
||||
``YYPEEK``,
|
||||
``YYSKIP``,
|
||||
``YYBACKUP``,
|
||||
``YYBACKUPCTX``,
|
||||
``YYSTAGP``,
|
||||
``YYSTAGN``,
|
||||
``YYMTAGP``,
|
||||
``YYMTAGN``,
|
||||
``YYRESTORE``,
|
||||
``YYRESTORECTX``,
|
||||
``YYRESTORETAG``,
|
||||
``YYSHIFT``,
|
||||
``YYSHIFTSTAG``,
|
||||
``YYSHIFTMTAG``,
|
||||
``YYLESSTHAN``.
|
||||
@@ -0,0 +1,42 @@
|
||||
|
||||
re2js has three API flavors that define the core set of primitives used by a
|
||||
program:
|
||||
|
||||
**Simple API**
|
||||
This is the default API for the JavaScript backend. It consists of the
|
||||
following primitives: ``YYINPUT`` (which should be defined as a sequence of
|
||||
code units, e.g. a string) and ``YYCURSOR``, ``YYMARKER``, ``YYCTXMARKER``,
|
||||
``YYLIMIT`` (which should be defined as indices in ``YYINPUT``).
|
||||
|
||||
|
|
||||
|
||||
**Record API**
|
||||
Record API is useful in cases when lexer state must be stored in an object.
|
||||
It is enabled with ``--api record`` option or ``re2c:api = record``
|
||||
configuration. This API consists of a variable ``yyrecord`` (the
|
||||
name can be overridden with ``re2c:yyrecord``) that should be defined as an
|
||||
object with properties ``yyinput``, ``yycursor``, ``yymarker``,
|
||||
``yyctxmarker``, ``yylimit`` (only the fields used by the generated code
|
||||
need to be defined, and their names can be configured).
|
||||
|
||||
|
|
||||
|
||||
**Generic API**
|
||||
This is the most flexible API. It is enabled with ``--api generic`` option
|
||||
or ``re2c:api = generic`` configuration.
|
||||
It contains primitives for generic operations:
|
||||
``YYPEEK``,
|
||||
``YYSKIP``,
|
||||
``YYBACKUP``,
|
||||
``YYBACKUPCTX``,
|
||||
``YYSTAGP``,
|
||||
``YYSTAGN``,
|
||||
``YYMTAGP``,
|
||||
``YYMTAGN``,
|
||||
``YYRESTORE``,
|
||||
``YYRESTORECTX``,
|
||||
``YYRESTORETAG``,
|
||||
``YYSHIFT``,
|
||||
``YYSHIFTSTAG``,
|
||||
``YYSHIFTMTAG``,
|
||||
``YYLESSTHAN``.
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
re2ocaml has two API flavors that define the core set of primitives used by a
|
||||
program:
|
||||
|
||||
**Record API**
|
||||
Record API is the default API for the OCaml backend.
|
||||
This API consists of a variable ``yyrecord`` (the name can be overridden with
|
||||
``re2c:yyrecord``) that should be defined as a record with fields
|
||||
``_yyinput``, ``_yycursor``, ``_yymarker``, ``_yyctxmarker``, ``_yylimit``.
|
||||
Only the fields used by the generated code need to be defined, and their
|
||||
names can be configured.
|
||||
|
||||
|
|
||||
|
||||
**Generic API**
|
||||
This is the most flexible API. It is enabled with ``--api generic`` option
|
||||
or ``re2c:api = generic`` configuration.
|
||||
It contains primitives for generic operations:
|
||||
``YYPEEK``,
|
||||
``YYSKIP``,
|
||||
``YYBACKUP``,
|
||||
``YYBACKUPCTX``,
|
||||
``YYSTAGP``,
|
||||
``YYSTAGN``,
|
||||
``YYMTAGP``,
|
||||
``YYMTAGN``,
|
||||
``YYRESTORE``,
|
||||
``YYRESTORECTX``,
|
||||
``YYRESTORETAG``,
|
||||
``YYSHIFT``,
|
||||
``YYSHIFTSTAG``,
|
||||
``YYSHIFTMTAG``,
|
||||
``YYLESSTHAN``.
|
||||
@@ -0,0 +1,42 @@
|
||||
|
||||
re2py has three API flavors that define the core set of primitives used by a
|
||||
program:
|
||||
|
||||
**Simple API**
|
||||
This is the default API for the Python backend. It consists of the
|
||||
following primitives: ``YYINPUT`` (which should be defined as a sequence of
|
||||
code units, e.g. a string) and ``YYCURSOR``, ``YYMARKER``, ``YYCTXMARKER``,
|
||||
``YYLIMIT`` (which should be defined as indices in ``YYINPUT``).
|
||||
|
||||
|
|
||||
|
||||
**Record API**
|
||||
Record API is useful in cases when lexer state must be stored in a class.
|
||||
It is enabled with ``--api record`` option or ``re2c:api = record``
|
||||
configuration. This API consists of a variable ``yyrecord`` (the
|
||||
name can be overridden with ``re2c:yyrecord``) that should be defined as a
|
||||
class with attributes ``yyinput``, ``yycursor``, ``yymarker``,
|
||||
``yyctxmarker``, ``yylimit`` (only the fields used by the generated code
|
||||
need to be defined, and their names can be configured).
|
||||
|
||||
|
|
||||
|
||||
**Generic API**
|
||||
This is the most flexible API. It is enabled with ``--api generic`` option
|
||||
or ``re2c:api = generic`` configuration.
|
||||
It contains primitives for generic operations:
|
||||
``YYPEEK``,
|
||||
``YYSKIP``,
|
||||
``YYBACKUP``,
|
||||
``YYBACKUPCTX``,
|
||||
``YYSTAGP``,
|
||||
``YYSTAGN``,
|
||||
``YYMTAGP``,
|
||||
``YYMTAGN``,
|
||||
``YYRESTORE``,
|
||||
``YYRESTORECTX``,
|
||||
``YYRESTORETAG``,
|
||||
``YYSHIFT``,
|
||||
``YYSHIFTSTAG``,
|
||||
``YYSHIFTMTAG``,
|
||||
``YYLESSTHAN``.
|
||||
@@ -0,0 +1,65 @@
|
||||
|
||||
re2rust has three API flavors that define the core set of primitives used by a
|
||||
program:
|
||||
|
||||
**Simple API**
|
||||
(*added in version 4.0*)
|
||||
This is a basic API that can be enabled with ``--api simple`` option or
|
||||
``re2c:api = simple`` configuration. It consists of the following
|
||||
primitives: ``YYINPUT`` (which should be defined as a sequence of code
|
||||
units, e.g. a string) and ``YYCURSOR``, ``YYMARKER``, ``YYCTXMARKER``,
|
||||
``YYLIMIT`` (which should be defined as indices in ``YYINPUT``).
|
||||
|
||||
|
|
||||
|
||||
**Record API**
|
||||
(*added in version 4.0*)
|
||||
Record API is useful in cases when lexer state must be stored in a struct.
|
||||
It is enabled with ``--api record`` option or ``re2c:api = record``
|
||||
configuration. This API consists of a variable ``yyrecord`` (the
|
||||
name can be overridden with ``re2c:yyrecord``) that should be defined as a
|
||||
struct with fields ``yyinput``, ``yycursor``, ``yymarker``, ``yyctxmarker``,
|
||||
``yylimit`` (only the fields used by the generated code need to be defined,
|
||||
and their names can be configured).
|
||||
|
||||
|
|
||||
|
||||
**Generic API**
|
||||
This is the most flexible API and the default API for the Rust backend.
|
||||
This API contains primitives for generic operations:
|
||||
``YYPEEK``,
|
||||
``YYSKIP``,
|
||||
``YYBACKUP``,
|
||||
``YYBACKUPCTX``,
|
||||
``YYSTAGP``,
|
||||
``YYSTAGN``,
|
||||
``YYMTAGP``,
|
||||
``YYMTAGN``,
|
||||
``YYRESTORE``,
|
||||
``YYRESTORECTX``,
|
||||
``YYRESTORETAG``,
|
||||
``YYSHIFT``,
|
||||
``YYSHIFTSTAG``,
|
||||
``YYSHIFTMTAG``,
|
||||
``YYLESSTHAN``.
|
||||
For example, if the input is a byte slice ``buffer: &[u8]``, variables
|
||||
``cursor``, ``limit``, ``marker`` and ``ctxmarker`` of type ``usize``
|
||||
represent input positions, and a constant ``NONE`` represents invalid
|
||||
position, then generic API can be defined as follows:
|
||||
|
||||
.. code-block:: rust
|
||||
|
||||
/*!re2c
|
||||
re2c:YYPEEK = "*buffer.get_unchecked(cursor)";
|
||||
re2c:YYSKIP = "cursor += 1;";
|
||||
re2c:YYBACKUP = "marker = cursor;";
|
||||
re2c:YYRESTORE = "cursor = marker;";
|
||||
re2c:YYBACKUPCTX = "ctxmarker = cursor;";
|
||||
re2c:YYRESTORECTX = "cursor = ctxmarker;";
|
||||
re2c:YYRESTORETAG = "cursor = @@{tag};";
|
||||
re2c:YYLESSTHAN = "limit - cursor < @@{len}";
|
||||
re2c:YYSTAGP = "@@{tag} = cursor;";
|
||||
re2c:YYSTAGN = "@@{tag} = NONE;";
|
||||
re2c:YYSHIFT = "cursor = (cursor as isize + @@{shift}) as usize;";
|
||||
re2c:YYSHIFTSTAG = "@@{tag} = (@@{tag} as isize + @@{shift}) as usize;";
|
||||
*/
|
||||
@@ -0,0 +1,42 @@
|
||||
|
||||
re2v has three API flavors that define the core set of primitives used by a
|
||||
program:
|
||||
|
||||
**Simple API**
|
||||
This is the default API for the V backend. It consists of the following
|
||||
primitives: ``YYINPUT`` (which should be defined as a sequence of code
|
||||
units, e.g. a string) and ``YYCURSOR``, ``YYMARKER``, ``YYCTXMARKER``,
|
||||
``YYLIMIT`` (which should be defined as indices in ``YYINPUT``).
|
||||
|
||||
|
|
||||
|
||||
**Record API**
|
||||
Record API is useful in cases when lexer state must be stored in a struct.
|
||||
It is enabled with ``--api record`` option or ``re2c:api = record``
|
||||
configuration. This API consists of a variable ``yyrecord`` (the
|
||||
name can be overridden with ``re2c:yyrecord``) that should be
|
||||
defined as a struct with fields ``yyinput``, ``yycursor``, ``yymarker``,
|
||||
``yyctxmarker``, ``yylimit`` (only the fields used by the generated code
|
||||
need to be defined, and their names can be configured).
|
||||
|
||||
|
|
||||
|
||||
**Generic API**
|
||||
This is the most flexible API. It is enabled with ``--api generic`` option
|
||||
or ``re2c:api = generic`` configuration.
|
||||
It contains primitives for generic operations:
|
||||
``YYPEEK``,
|
||||
``YYSKIP``,
|
||||
``YYBACKUP``,
|
||||
``YYBACKUPCTX``,
|
||||
``YYSTAGP``,
|
||||
``YYSTAGN``,
|
||||
``YYMTAGP``,
|
||||
``YYMTAGN``,
|
||||
``YYRESTORE``,
|
||||
``YYRESTORECTX``,
|
||||
``YYRESTORETAG``,
|
||||
``YYSHIFT``,
|
||||
``YYSHIFTSTAG``,
|
||||
``YYSHIFTMTAG``,
|
||||
``YYLESSTHAN``.
|
||||
@@ -0,0 +1,42 @@
|
||||
|
||||
re2zig has three API flavors that define the core set of primitives used by a
|
||||
program:
|
||||
|
||||
**Simple API**
|
||||
This is the default API for the Zig backend. It consists of the following
|
||||
primitives: ``YYINPUT`` (which should be defined as a sequence of code
|
||||
units, e.g. a string) and ``YYCURSOR``, ``YYMARKER``, ``YYCTXMARKER``,
|
||||
``YYLIMIT`` (which should be defined as indices in ``YYINPUT``).
|
||||
|
||||
|
|
||||
|
||||
**Record API**
|
||||
Record API is useful in cases when lexer state must be stored in a struct.
|
||||
It is enabled with ``--api record`` option or ``re2c:api = record``
|
||||
configuration. This API consists of a variable ``yyrecord`` (the
|
||||
name can be overridden with ``re2c:yyrecord``) that should be
|
||||
defined as a struct with fields ``yyinput``, ``yycursor``, ``yymarker``,
|
||||
``yyctxmarker``, ``yylimit`` (only the fields used by the generated code
|
||||
need to be defined, and their names can be configured).
|
||||
|
||||
|
|
||||
|
||||
**Generic API**
|
||||
This is the most flexible API. It is enabled with ``--api generic`` option
|
||||
or ``re2c:api = generic`` configuration.
|
||||
It contains primitives for generic operations:
|
||||
``YYPEEK``,
|
||||
``YYSKIP``,
|
||||
``YYBACKUP``,
|
||||
``YYBACKUPCTX``,
|
||||
``YYSTAGP``,
|
||||
``YYSTAGN``,
|
||||
``YYMTAGP``,
|
||||
``YYMTAGN``,
|
||||
``YYRESTORE``,
|
||||
``YYRESTORECTX``,
|
||||
``YYRESTORETAG``,
|
||||
``YYSHIFT``,
|
||||
``YYSHIFTSTAG``,
|
||||
``YYSHIFTMTAG``,
|
||||
``YYLESSTHAN``.
|
||||
@@ -0,0 +1,234 @@
|
||||
Here is a full list of API primitives that may be used by the generated code in
|
||||
order to interface with the outer program.
|
||||
|
||||
``YYCTYPE``
|
||||
The type of the input characters (code units).
|
||||
For ASCII, EBCDIC and UTF-8 encodings it should be 1-byte unsigned integer.
|
||||
For UTF-16 or UCS-2 it should be 2-byte unsigned integer. For UTF-32 it
|
||||
should be 4-byte unsigned integer.
|
||||
|
||||
``YYCURSOR``
|
||||
An l-value that stores the current input position (a pointer or an integer
|
||||
offset in ``YYINPUT``). Initially ``YYCURSOR`` should point to the first
|
||||
input character, and later it is advanced by the generated code. When a rule
|
||||
matches, ``YYCURSOR`` position is the one after the last matched character.
|
||||
|
||||
``YYLIMIT``
|
||||
An r-value that stores the end of input position (a pointer or an integer
|
||||
offset in ``YYINPUT``). Initially ``YYLIMIT`` should point to the position
|
||||
after the last available input character. It is not changed by the
|
||||
generated code. The lexer compares ``YYCURSOR`` to ``YYLIMIT``
|
||||
in order to determine if there are enough input characters left.
|
||||
|
||||
``YYMARKER``
|
||||
An l-value that stores the position of the latest matched rule (a pointer or
|
||||
an integer offset in ``YYINPUT``). It is used to restore the ``YYCURSOR``
|
||||
position if the longer match fails and the lexer needs to rollback.
|
||||
Initialization is not needed.
|
||||
|
||||
``YYCTXMARKER``
|
||||
An l-value that stores the position of the trailing context (a pointer or an
|
||||
integer offset in ``YYINPUT``). No initialization is needed. ``YYCTXMARKER``
|
||||
is needed only if the lookahead operator ``/`` is used.
|
||||
|
||||
``YYFILL``
|
||||
A generic API primitive with one variable ``len``.
|
||||
``YYFILL`` should provide at least ``len`` more input characters or fail.
|
||||
If ``re2c:eof`` is used, then ``len`` is always ``1`` and ``YYFILL`` should
|
||||
always return to the calling function; zero return value indicates success.
|
||||
If ``re2c:eof`` is not used, then ``YYFILL`` return value is ignored and it
|
||||
should not return on failure. The maximum value of ``len`` is ``YYMAXFILL``.
|
||||
|
||||
``YYFN``
|
||||
A primitive that defines function prototype in ``--recursive-functions``
|
||||
code model. Its value should be an array of one or more strings, where each
|
||||
string contains two or three components separated by the string specified in
|
||||
``re2c:fn:sep`` configuration (typically a semicolon). The first array
|
||||
element defines function name and return type (empty for a void function).
|
||||
Subsequent elements define function arguments: first, the expression for the
|
||||
argument used in function body (usually just a name); second, argument type;
|
||||
third, an optional formal parameter (it defaults to the first component -
|
||||
usually both the argument and the parameter are the same identifier).
|
||||
|
||||
``YYINPUT``
|
||||
An r-value that stores the current input character sequence (string, buffer,
|
||||
etc.).
|
||||
|
||||
``YYMAXFILL``
|
||||
An integral constant equal to the maximum value of the argument to
|
||||
``YYFILL``. It can be generated with a ``max`` block.
|
||||
|
||||
``YYLESSTHAN``
|
||||
A generic API primitive with one variable ``len``.
|
||||
It should be defined as an r-value of boolean type that equals ``true`` if
|
||||
and only if there are less than ``len`` input characters left.
|
||||
|
||||
``YYPEEK``
|
||||
A generic API primitive with no variables.
|
||||
It should be defined as an r-value of type ``YYCTYPE`` that is equal to the
|
||||
character at the current input position.
|
||||
|
||||
``YYSKIP``
|
||||
A generic API primitive that should advance the current input position by
|
||||
one code unit.
|
||||
|
||||
``YYBACKUP``
|
||||
A generic API primitive that should save the current input position (to be
|
||||
restored with ``YYRESTORE`` later).
|
||||
|
||||
``YYRESTORE``
|
||||
A generic API primitive that should restore the current input position to
|
||||
the value saved by ``YYBACKUP``.
|
||||
|
||||
``YYBACKUPCTX``
|
||||
A generic API primitive that should save the current input position as the
|
||||
position of the trailing context (to be restored with ``YYRESTORECTX``
|
||||
later).
|
||||
|
||||
``YYRESTORECTX``
|
||||
A generic API primitive that should restore the trailing context position
|
||||
saved with ``YYBACKUPCTX``.
|
||||
|
||||
``YYRESTORETAG``
|
||||
A generic API primitive with one variable ``tag`` that should restore the
|
||||
trailing context position to the value of ``tag``.
|
||||
|
||||
``YYSTAGP``
|
||||
A generic API primitive with one variable ``tag``, where ``tag`` can be a
|
||||
pointer or an offset in ``YYINPUT`` (see submatch extraction section for
|
||||
details). ``YYSTAGP`` should set ``tag`` to the current input position.
|
||||
|
||||
``YYSTAGN``
|
||||
A generic API primitive with one variable ``tag``, where ``tag`` can be a
|
||||
pointer or an offset in ``YYINPUT`` (see submatch extraction section for
|
||||
details). ``YYSTAGN`` should to set ``tag`` to a value that represents
|
||||
non-existent input position.
|
||||
|
||||
``YYMTAGP``
|
||||
A generic API primitive with one variable ``tag``.
|
||||
``YYMTAGP`` should append the current position to the submatch history of
|
||||
``tag`` (see the submatch extraction section for details.)
|
||||
|
||||
``YYMTAGN``
|
||||
A generic API primitive with one variable ``tag``.
|
||||
``YYMTAGN`` should append a value that represents non-existent input
|
||||
position position to the submatch history of ``tag`` (see the submatch
|
||||
extraction section for details.)
|
||||
|
||||
``YYSHIFT``
|
||||
A generic API primitive with one variable ``shift`` that should shift the
|
||||
current input position by ``shift`` characters (the shift value may be
|
||||
negative).
|
||||
|
||||
``YYCOPYSTAG``
|
||||
A generic API primitive with two variables, ``lhs`` and ``rhs`` that should
|
||||
copy right-hand-side s-tag variable ``rhs`` to the left-hand-side s-tag
|
||||
variable ``lhs``. For most languages this primitive has a default definition
|
||||
that assigns ``lhs`` to ``rhs``.
|
||||
|
||||
``YYCOPYMTAG``
|
||||
A generic API primitive with two variables, ``lhs`` and ``rhs`` that should
|
||||
copy right-hand-side m-tag variable ``rhs`` to the left-hand-side m-tag
|
||||
variable ``lhs``. For most languages this primitive has a default definition
|
||||
that assigns ``lhs`` to ``rhs``.
|
||||
|
||||
``YYSHIFTSTAG``
|
||||
A generic API primitive with two variables, ``tag`` and ``shift`` that
|
||||
should shift ``tag`` by ``shift`` code units (the shift value may be
|
||||
negative).
|
||||
|
||||
``YYSHIFTMTAG``
|
||||
A generic API primitive with two variables, ``tag`` and ``shift`` that
|
||||
should shift the latest value in the history of ``tag`` by ``shift`` code
|
||||
units (the shift value may be negative).
|
||||
|
||||
``YYMAXNMATCH``
|
||||
An integral constant equal to the maximal number of POSIX capturing groups
|
||||
in a rule. It is generated with a ``maxnmatch`` block.
|
||||
|
||||
``YYCONDTYPE``
|
||||
The type of the condition enum.
|
||||
It can be generated either with ``conditions`` block or ``--header`` option.
|
||||
|
||||
``YYGETACCEPT``
|
||||
A primitive with one variable ``var`` that stores numeric selector of the
|
||||
accepted rule. For most languages this primitive has a default definition
|
||||
that reads from ``var``.
|
||||
|
||||
``YYSETACCEPT``
|
||||
A primitive with two variables: ``var`` (an l-value that stores numeric
|
||||
selector of the accepted rule), and ``val`` (the value of selector). For
|
||||
most languages this primitive has a default definition that assigns ``var``
|
||||
to ``val``.
|
||||
|
||||
``YYGETCOND``
|
||||
An r-value of type ``YYCONDTYPE`` that is equal to the current condition
|
||||
identifier.
|
||||
|
||||
``YYSETCOND``
|
||||
A primitive with one variable ``cond`` that should set the current
|
||||
condition identifier to ``cond``.
|
||||
|
||||
``YYGETSTATE``
|
||||
An r-value of integer type that is equal to the current lexer state. It
|
||||
should be initialized to ``-1``.
|
||||
|
||||
``YYSETSTATE``
|
||||
A primitive with one variable ``state`` that should set the current lexer
|
||||
state to ``state``.
|
||||
|
||||
``YYDEBUG``
|
||||
This primitive is generated only with ``-d``, ``--debug-output`` option.
|
||||
Its purpose is to add logging to the generated code (typical ``YYDEBUG``
|
||||
definition is a print statement). ``YYDEBUG`` statements are generated in
|
||||
every state and have two variables: ``state`` (either a DFA state index or
|
||||
``-1``) and ``symbol`` (the current input symbol).
|
||||
|
||||
``yyaccept``
|
||||
An l-value of unsigned integral type that stores the number of the latest
|
||||
matched rule. User definition is necessary only with ``--storable-state``
|
||||
option.
|
||||
|
||||
``yybm``
|
||||
A table containing compressed bitmaps for up to 8 transitions (used with
|
||||
the ``--bitmaps`` option). The table contains 256 elements and is indexed by
|
||||
1-byte code units. Each 8-bit element combines boolean values for up to 8
|
||||
transitions. k-Th bit of n-th element is true iff n-th code unit is in the
|
||||
range of k-th transition. The idea of this bitmap is to replace many `if`
|
||||
branches or `switch` cases with one check of a single bit in the table.
|
||||
|
||||
``yych``
|
||||
An l-value of type ``YYCTYPE`` that stores the current input character.
|
||||
User definition is necessary only with ``-f`` ``--storable-state`` option.
|
||||
|
||||
``yyctable``
|
||||
Jump table generated for the initial condition dispatch (enabled with the
|
||||
combination of ``--conditions`` and ``--computed-gotos`` options).
|
||||
|
||||
``yyfill``
|
||||
An l-value that stores the result of ``YYFILL`` call (this may be necessary
|
||||
for pure functional languages, where ``YYFILL`` is a monadic function with
|
||||
complex return value).
|
||||
|
||||
``yynmatch``
|
||||
An l-value of unsigned integral type that stores the number of POSIX
|
||||
capturing groups in the matched rule.
|
||||
Used only with ``-P`` ``--posix-captures`` option.
|
||||
|
||||
``yypmatch``
|
||||
An array of l-values that are used to hold the tag values corresponding
|
||||
to the capturing parentheses in the matching rule. Array length must be
|
||||
at least ``yynmatch * 2`` (usually ``YYMAXNMATCH * 2`` is a good choice).
|
||||
Used only with ``-P`` ``--posix-captures`` option.
|
||||
|
||||
``yystable``
|
||||
Deprecated.
|
||||
|
||||
``yystate``
|
||||
An l-value used with the ``--loop-switch`` option to store the current DFA
|
||||
state.
|
||||
|
||||
``yytarget``
|
||||
Jump table that contains jump targets (label addresses) for all transitions
|
||||
from a state. This table is local to each state. Generation of ``yytarget``
|
||||
tables is enabled with ``--computed-gotos`` option.
|
||||
@@ -0,0 +1,120 @@
|
||||
Block start and end markers are either ``/*!re2c`` and ``*/``, or ``%{`` and
|
||||
``%}`` (both styles are supported). Starting from version 2.2 blocks may have
|
||||
optional names that allow them to be referenced in other blocks.
|
||||
There are different kinds of blocks:
|
||||
|
||||
``/*!re2c[:<name>] ... */`` or ``%{[:<name>] ... %}``
|
||||
A *global block* contains definitions, configurations, rules and directives.
|
||||
|re2c| compiles regular expressions associated with each rule into a
|
||||
deterministic finite automaton, encodes it in the form of conditional jumps
|
||||
in the target language and replaces the block with the generated code. Names
|
||||
and configurations defined in a global block are added to the global scope
|
||||
and become visible to subsequent blocks. At the start of the program the
|
||||
global scope is initialized with command-line `options`_.
|
||||
|
||||
``/*!local:re2c[:<name>] ... */`` or ``%{local[:<name>] ... %}``
|
||||
A *local block* is like a global block, but the names and configurations in
|
||||
it have local scope (they do not affect other blocks).
|
||||
|
||||
``/*!rules:re2c[:<name>] ... */`` or ``%{rules[:<name>] ... %}``
|
||||
A *rules block* is like a local block, but it does not generate any code by
|
||||
itself, nor does it add any definitions to the global scope -- it is meant
|
||||
to be reused in other blocks. This is a way of sharing code (more details in
|
||||
the `reusable blocks`_ section). Prior to |re2c| version 2.2 rules blocks
|
||||
required ``-r --reusable`` option.
|
||||
|
||||
``/*!use:re2c[:<name>] ... */`` or ``%{use[:<name>] ... %}``
|
||||
A use block that references a previously defined rules block. If the name is
|
||||
specified, |re2c| looks for a rules blocks with this name. Otherwise the most
|
||||
recent rules block is used (either a named or an unnamed one). A use block
|
||||
can add definitions, configurations and rules of its own, which are added to
|
||||
those of the referenced rules block. Prior to |re2c| version 2.2 use blocks
|
||||
required ``-r --reusable`` option.
|
||||
|
||||
``/*!max:re2c[:<name1>[:<name2>...]] ... */`` or ``%{max[:<name1>[:<name2>...]] ... %}``
|
||||
A block that generates ``YYMAXFILL`` definition. An optional list of block
|
||||
names specifies which blocks should be included when computing ``YYMAXFILL``
|
||||
value (if the list is empty, all blocks are included).
|
||||
By default the generated code is a macro-definition for C
|
||||
(``#define YYMAXFILL <n>``), or a global variable for Go
|
||||
(``var YYMAXFILL int = <n>``). It can be customized with an optional
|
||||
configuration ``format`` that specifies a template string where ``@@{max}``
|
||||
(or ``@@`` for short) is replaced with the numeric value of ``YYMAXFILL``.
|
||||
|
||||
``/*!maxnmatch:re2c[:<name1>[:<name2>...]] ... */`` or ``%{maxnmatch[:<name1>[:<name2>...]] ... %}``
|
||||
A block that generates ``YYMAXNMATCH`` definition (it requires
|
||||
``-P --posix-captures`` option). An optional list of block names specifies
|
||||
which blocks should be included when computing ``YYMAXNMATCH`` value (if the
|
||||
list is empty, all blocks are included).
|
||||
By default the generated code is a macro-definition for C
|
||||
(``#define YYMAXNMATCH <n>``), or a global variable for Go
|
||||
(``var YYMAXNMATCH int = <n>``). It can be customized with an optional
|
||||
configuration ``format`` that specifies a template string where ``@@{max}``
|
||||
(or ``@@`` for short) is replaced with the numeric value of ``YYMAXNMATCH``.
|
||||
|
||||
``/*!stags:re2c[:<name1>[:<name2>...]] ... */``, ``/*!mtags:re2c[:<name1>[:<name2>...]] ... */`` or ``%{stags[:<name1>[:<name2>...]] ... %}``, ``%{mtags[:<name1>[:<name2>...]] ... %{``
|
||||
Blocks that specify a template piece of code that is expanded for each
|
||||
s-tag/m-tag variable generated by |re2c|. An optional list of block names
|
||||
specifies which blocks should be included when computing the set of tag
|
||||
variables (if the list is empty, all blocks are included).
|
||||
There are two optional configurations: ``format`` and ``separator``.
|
||||
Configuration ``format`` specifies a template string where ``@@{tag}`` (or
|
||||
``@@`` for short) is replaced with the name of each tag variable.
|
||||
Configuration ``separator`` specifies a piece of code used to join the
|
||||
generated ``format`` pieces for different tag variables.
|
||||
|
||||
``/*!svars:re2c[:<name1>[:<name2>...]] ... */``, ``/*!mvars:re2c[:<name1>[:<name2>...]] ... */`` or ``%{svars[:<name1>[:<name2>...]] ... %}``, ``%{mvars[:<name1>[:<name2>...]] ... %{``
|
||||
Blocks that specify a template piece of code that is expanded for each
|
||||
s-tag/m-tag that is either explicitly mentioned by the rules (with
|
||||
``--tags`` option) or implicitly generated by |re2c| (with ``--captvars`` or
|
||||
``--posix-captvars`` options). An optional list of block names specifies
|
||||
which blocks should be included when computing the set of tags (if the list
|
||||
is empty, all blocks are included).
|
||||
There are two optional configurations: ``format`` and ``separator``.
|
||||
Configuration ``format`` specifies a template string where ``@@{tag}`` (or
|
||||
``@@`` for short) is replaced with the name of each tag.
|
||||
Configuration ``separator`` specifies a piece of code used to join the
|
||||
generated ``format`` pieces for different tags.
|
||||
|
||||
``/*!getstate:re2c[:<name1>[:<name2>...]] ... */`` or ``%{getstate[:<name1>[:<name2>...]] ... %}``
|
||||
A block that generates conditional dispatch on the lexer state (it requires
|
||||
``--storable-state`` option). An optional list of block names specifies
|
||||
which blocks should be included in the state dispatch. The default
|
||||
transition goes to the start label of the first block on the list. If the
|
||||
list is empty, all blocks are included, and the default transition goes to
|
||||
the first block in the file that has a start label.
|
||||
This block type is incompatible with the ``--loop-switch`` option, as it
|
||||
requires cross-block transitions that are unsupported without ``goto`` or
|
||||
function calls.
|
||||
|
||||
``/*!conditions:re2c[:<name1>[:<name2>...]] ... */``, ``/*!types:re2c... */`` or ``%{conditions[:<name1>[:<name2>...]] ... %}``, ``%{types... %}``
|
||||
A block that generates condition enumeration (it requires ``--conditions``
|
||||
option). An optional list of block names specifies which blocks should be
|
||||
included when computing the set of conditions (if the list is empty, all
|
||||
blocks are included).
|
||||
By default the generated code is an enumeration ``YYCONDTYPE``. It can be
|
||||
customized with optional configurations ``format`` and ``separator``.
|
||||
Configuration ``format`` specifies a template string where ``@@{cond}`` (or
|
||||
``@@`` for short) is replaced with the name of each condition, and
|
||||
``@@{num}`` is replaced with a numeric index of that condition.
|
||||
Configuration ``separator`` specifies a piece of code used to join the
|
||||
generated ``format`` pieces for different conditions.
|
||||
|
||||
``/*!include:re2c <file> */`` or ``%{include <file> %}``
|
||||
This block allows one to include ``<file>``, which must be a double-quoted
|
||||
file path. The contents of the file are literally substituted in place of
|
||||
the block, in the same way as ``#include`` works in C/C++. This block can be
|
||||
used together with the ``--depfile`` option to generate build system
|
||||
dependencies on the included files.
|
||||
|
||||
``/*!header:re2c:on*/`` or ``%{header:on %}``
|
||||
This block marks the start of header file. Everything after it and up to the
|
||||
following ``header:off`` block is processed by |re2c| and written to the
|
||||
header file specified with ``-t --type-header`` option.
|
||||
|
||||
``/*!header:re2c:off*/`` or ``%{header:off %}``
|
||||
This block marks the end of header file started with ``header:on*/`` block.
|
||||
|
||||
``/*!ignore:re2c ... */`` or ``%{ignore ... %}``
|
||||
A block which contents are ignored and removed from the output file.
|
||||
|
||||
+211
-155
@@ -1,5 +1,6 @@
|
||||
Here is a full list of configurations supported by |re2c|:
|
||||
|
||||
``re2c:api``, ``re2c:flags:input``
|
||||
``re2c:api``, ``re2c:input``
|
||||
Same as the ``--api`` option.
|
||||
|
||||
``re2c:api:sigil``
|
||||
@@ -9,7 +10,7 @@
|
||||
to ``$``, then placeholders will have the form ``${name}``. Single-argument
|
||||
APIs may use shorthand notation without the name in braces. This option can
|
||||
be overridden by options for individual API primitives, e.g.
|
||||
``re2c:define:YYFILL@len`` for ``YYFILL``.
|
||||
``re2c:YYFILL@len`` for ``YYFILL``.
|
||||
|
||||
``re2c:api:style``
|
||||
Specify API style. Possible values are ``functions`` (the default for C) and
|
||||
@@ -24,12 +25,20 @@
|
||||
variables of the form ``@@{var}`` or ``@@`` (they correspond to arguments in
|
||||
function-like style).
|
||||
This configuration may be overridden for individual API primitives, see for
|
||||
example ``re2c:define:YYFILL:naked`` configuration for ``YYFILL``.
|
||||
example ``re2c:YYFILL:naked`` configuration for ``YYFILL``.
|
||||
|
||||
``re2c:bit-vectors``, ``re2c:flags:bit-vectors``, ``re2c:flags:b``
|
||||
Same as the ``--bit-vectors`` option, but can be configured on per-block
|
||||
basis.
|
||||
|
||||
``re2c:captures``, ``re2c:leftmost-captures``
|
||||
Same as the ``--leftmost-captures`` option, but can be configured on
|
||||
per-block basis.
|
||||
|
||||
``re2c:captvars``, ``re2c:leftmost-captvars``
|
||||
Same as the ``--leftmost-captvars`` option, but can be configured on
|
||||
per-block basis.
|
||||
|
||||
``re2c:case-insensitive``, ``re2c:flags:case-insensitive``
|
||||
Same as the ``--case-insensitive`` option, but can be configured on
|
||||
per-block basis.
|
||||
@@ -51,6 +60,10 @@
|
||||
threshold that triggers the generation of jump tables instead of nested
|
||||
``if`` statements and bitmaps. The default value is ``9``.
|
||||
|
||||
``re2c:cond:abort``
|
||||
If set to a positive integer value, the default case in the generated
|
||||
condition dispatch aborts program execution.
|
||||
|
||||
``re2c:cond:goto``
|
||||
Specifies a piece of code used for the autogenerated shortcut rules ``:=>``
|
||||
in conditions. The default is ``goto @@;``.
|
||||
@@ -85,129 +98,6 @@
|
||||
Same as the ``--debug-output`` option, but can be configured on per-block
|
||||
basis.
|
||||
|
||||
``re2c:define:YYBACKUP``
|
||||
Defines generic API primitive ``YYBACKUP`` (see the API primitives section).
|
||||
|
||||
``re2c:define:YYBACKUPCTX``
|
||||
Defines generic API primitive ``YYBACKUPCTX`` (see the API primitives
|
||||
section).
|
||||
|
||||
``re2c:define:YYCONDTYPE``
|
||||
Defines ``YYCONDTYPE`` (see the API primitives section).
|
||||
|
||||
``re2c:define:YYCTYPE``
|
||||
Defines ``YYCTYPE`` (see the API primitives section).
|
||||
|
||||
``re2c:define:YYCTXMARKER``
|
||||
Defines API primitive ``YYCTXMARKER`` (see the API primitives section).
|
||||
|
||||
``re2c:define:YYCURSOR``
|
||||
Defines API primitive ``YYCURSOR`` (see the API primitives section).
|
||||
|
||||
``re2c:define:YYDEBUG``
|
||||
Defines API primitive ``YYDEBUG`` (see the API primitives section).
|
||||
|
||||
``re2c:define:YYFILL``
|
||||
Defines API primitive ``YYFILL`` (see the API primitives section).
|
||||
|
||||
``re2c:define:YYFILL@len``
|
||||
Specifies the sigil used for argument substitution in ``YYFILL``
|
||||
definition. Defaults to ``@@``.
|
||||
Overrides the more generic ``re2c:api:sigil`` configuration.
|
||||
|
||||
``re2c:define:YYFILL:naked``
|
||||
Overrides the more generic ``re2c:api:style`` configuration for ``YYFILL``.
|
||||
Zero value corresponds to free-form API style.
|
||||
|
||||
``re2c:define:YYGETCONDITION``
|
||||
Defines API primitive ``YYGETCONDITION`` (see the API primitives section).
|
||||
|
||||
``re2c:define:YYGETCONDITION:naked``
|
||||
Overrides the more generic ``re2c:api:style`` configuration for
|
||||
``YYGETCONDITION``. Zero value corresponds to free-form API style.
|
||||
|
||||
``re2c:define:YYGETSTATE``
|
||||
Defines API primitive ``YYGETSTATE`` (see the API primitives section).
|
||||
|
||||
``re2c:define:YYGETSTATE:naked``
|
||||
Overrides the more generic ``re2c:api:style`` configuration for
|
||||
``YYGETSTATE``. Zero value corresponds to free-form API style.
|
||||
|
||||
``re2c:define:YYLESSTHAN``
|
||||
Defines generic API primitive ``YYLESSTHAN`` (see the API primitives
|
||||
section).
|
||||
|
||||
``re2c:define:YYLIMIT``
|
||||
Defines API primitive ``YYLIMIT`` (see the API primitives section).
|
||||
|
||||
``re2c:define:YYMARKER``
|
||||
Defines API primitive ``YYMARKER`` (see the API primitives section).
|
||||
|
||||
``re2c:define:YYMTAGN``
|
||||
Defines generic API primitive ``YYMTAGN`` (see the API primitives section).
|
||||
|
||||
``re2c:define:YYMTAGP``
|
||||
Defines generic API primitive ``YYMTAGP`` (see the API primitives section).
|
||||
|
||||
``re2c:define:YYPEEK``
|
||||
Defines generic API primitive ``YYPEEK`` (see the API primitives section).
|
||||
|
||||
``re2c:define:YYRESTORE``
|
||||
Defines generic API primitive ``YYRESTORE`` (see the API primitives
|
||||
section).
|
||||
|
||||
``re2c:define:YYRESTORECTX``
|
||||
Defines generic API primitive ``YYRESTORECTX`` (see the API primitives
|
||||
section).
|
||||
|
||||
``re2c:define:YYRESTORETAG``
|
||||
Defines generic API primitive ``YYRESTORETAG`` (see the API primitives
|
||||
section).
|
||||
|
||||
``re2c:define:YYSETCONDITION``
|
||||
Defines API primitive ``YYSETCONDITION`` (see the API primitives section).
|
||||
|
||||
``re2c:define:YYSETCONDITION@cond``
|
||||
Specifies the sigil used for argument substitution in ``YYSETCONDITION``
|
||||
definition. The default value is ``@@``.
|
||||
Overrides the more generic ``re2c:api:sigil`` configuration.
|
||||
|
||||
``re2c:define:YYSETCONDITION:naked``
|
||||
Overrides the more generic ``re2c:api:style`` configuration for
|
||||
``YYSETCONDITION``. Zero value corresponds to free-form API style.
|
||||
|
||||
``re2c:define:YYSETSTATE``
|
||||
Defines API primitive ``YYSETSTATE`` (see the API primitives section).
|
||||
|
||||
``re2c:define:YYSETSTATE@state``
|
||||
Specifies the sigil used for argument substitution in ``YYSETSTATE``
|
||||
definition. The default value is ``@@``.
|
||||
Overrides the more generic ``re2c:api:sigil`` configuration.
|
||||
|
||||
``re2c:define:YYSETSTATE:naked``
|
||||
Overrides the more generic ``re2c:api:style`` configuration for
|
||||
``YYSETSTATE``. Zero value corresponds to free-form API style.
|
||||
|
||||
``re2c:define:YYSKIP``
|
||||
Defines generic API primitive ``YYSKIP`` (see the API primitives section).
|
||||
|
||||
``re2c:define:YYSHIFT``
|
||||
Defines generic API primitive ``YYSHIFT`` (see the API primitives section).
|
||||
|
||||
``re2c:define:YYSHIFTMTAG``
|
||||
Defines generic API primitive ``YYSHIFTMTAG`` (see the API primitives
|
||||
section).
|
||||
|
||||
``re2c:define:YYSHIFTSTAG``
|
||||
Defines generic API primitive ``YYSHIFTSTAG`` (see the API primitives
|
||||
section).
|
||||
|
||||
``re2c:define:YYSTAGN``
|
||||
Defines generic API primitive ``YYSTAGN`` (see the API primitives section).
|
||||
|
||||
``re2c:define:YYSTAGP``
|
||||
Defines generic API primitive ``YYSTAGP`` (see the API primitives section).
|
||||
|
||||
``re2c:empty-class``, ``re2c:flags:empty-class``
|
||||
Same as the ``--empty-class`` option, but can be configured on per-block
|
||||
basis.
|
||||
@@ -236,6 +126,9 @@
|
||||
default value is ``-1`` (``$`` rule is not used). Other possible values
|
||||
include all valid code units. Only decimal numbers are recognized.
|
||||
|
||||
``re2c:fn:sep``
|
||||
Specifies separator used in ``YYFN`` elements (defaults to semicolon).
|
||||
|
||||
``re2c:header``, ``re2c:flags:type-header``, ``re2c:flags:t``
|
||||
Specifies the name of the generated header file relative to the directory of
|
||||
the output file. Same as the ``--header`` option except that the file path
|
||||
@@ -250,6 +143,10 @@
|
||||
Specifies the minimum amount of indentation to use. The default value is
|
||||
zero. The value should be a non-negative integer number.
|
||||
|
||||
``re2c:invert-captures``
|
||||
Same as the ``--invert-captures`` option, but can be configured on per-block
|
||||
basis.
|
||||
|
||||
``re2c:label:prefix``, ``re2c:labelprefix``
|
||||
Specifies the prefix used for DFA state labels. The default is ``yy``.
|
||||
|
||||
@@ -277,6 +174,10 @@
|
||||
``re2c:lookahead``, ``re2c:flags:lookahead``
|
||||
Deprecated (see the deprecated ``--no-lookahead`` option).
|
||||
|
||||
``re2c:monadic``
|
||||
If set to non-zero, the generated lexer will use monadic notation (this
|
||||
configuration is specific to Haskell).
|
||||
|
||||
``re2c:nested-ifs``, ``re2c:flags:nested-ifs``, ``re2c:flags:s``
|
||||
Same as the ``--nested-ifs`` option, but can be configured on per-block
|
||||
basis.
|
||||
@@ -285,18 +186,27 @@
|
||||
Same as the ``--posix-captures`` option, but can be configured on per-block
|
||||
basis.
|
||||
|
||||
``re2c:posix-captvars``
|
||||
Same as the ``--posix-captvars`` option, but can be configured on per-block
|
||||
basis.
|
||||
|
||||
``re2c:tags``, ``re2c:flags:tags``, ``re2c:flags:T``
|
||||
Same as the ``--tags`` option, but can be configured on per-block basis.
|
||||
|
||||
``re2c:tags:expression``
|
||||
Specifies the expression used for tag variables.
|
||||
By default re2c generates expressions of the form ``yyt<N>``. This might
|
||||
By default |re2c| generates expressions of the form ``yyt<N>``. This might
|
||||
be inconvenient, for example if tag variables are defined as fields in a
|
||||
struct. All occurrences of ``@@{tag}`` or ``@@`` are replaced with the
|
||||
actual tag name. For example, ``re2c:tags:expression = "s.@@";`` results
|
||||
in expressions of the form ``s.yyt<N>`` in the generated code.
|
||||
See also ``re2c:api:sigil`` configuration.
|
||||
|
||||
``re2c:tags:negative``
|
||||
Specifies the constant expression that is used for negative tag value
|
||||
(typically this would be ``-1`` if tags are integer offsets in the input
|
||||
string, or null pointer if they are pointers).
|
||||
|
||||
``re2c:tags:prefix``
|
||||
Specifies the prefix for tag variable names. The default is ``yyt``.
|
||||
|
||||
@@ -306,20 +216,20 @@
|
||||
set). This configuration does not affect code generation: its purpose is to
|
||||
verify that the sentinel is not allowed in the middle of a rule, and ensure
|
||||
that the lexer won't read past the end of buffer. The default value is
|
||||
`-1`` (in that case re2c assumes that the sentinel is zero, which is the
|
||||
`-1`` (in that case |re2c| assumes that the sentinel is zero, which is the
|
||||
most common case). Only decimal numbers are recognized.
|
||||
|
||||
``re2c:state:abort``
|
||||
If set to a positive integer value, changes the default case in
|
||||
``YYGETSTATE`` switch: by default it aborts the program, and an explicit
|
||||
``-1`` case contains transition to the start of the block.
|
||||
If set to a positive integer value, the default case in the generated
|
||||
state dispatch aborts program execution, and an explicit ``-1`` case
|
||||
contains transition to the start of the block.
|
||||
|
||||
``re2c:state:nextlabel``
|
||||
Controls if the ``YYGETSTATE`` switch is followed by an ``yyNext`` label
|
||||
(the default value is zero, which corresponds to no label).
|
||||
Alternatively one can use ``re2c:label:start`` to generate a specific start
|
||||
label, or an explicit ``getstate:re2c`` directive to generate the
|
||||
``YYGETSTATE`` switch separately from the lexer block.
|
||||
label, or an explicit ``getstate`` block to generate the ``YYGETSTATE``
|
||||
switch separately from the lexer block.
|
||||
|
||||
``re2c:unsafe``, ``re2c:flags:unsafe``
|
||||
Same as the ``--no-unsafe`` option, but can be configured on per-block
|
||||
@@ -328,42 +238,188 @@
|
||||
``YYPEEK``. The default is non-zero (wrappers are generated).
|
||||
This configuration is specific to Rust.
|
||||
|
||||
``re2c:variable:yyaccept``
|
||||
Specifies the name of the ``yyaccept`` variable (see the API primitives
|
||||
section).
|
||||
``re2c:YYBACKUP``, ``re2c:define:YYBACKUP``
|
||||
Defines generic API primitive ``YYBACKUP``.
|
||||
|
||||
``re2c:variable:yybm``
|
||||
Specifies the name of the ``yybm`` variable (used for bitmaps).
|
||||
``re2c:YYBACKUPCTX``, ``re2c:define:YYBACKUPCTX``
|
||||
Defines generic API primitive ``YYBACKUPCTX``.
|
||||
|
||||
``re2c:variable:yybm:hex``, ``re2c:yybm:hex``
|
||||
``re2c:YYCONDTYPE``, ``re2c:define:YYCONDTYPE``
|
||||
Defines API primitive ``YYCONDTYPE``.
|
||||
|
||||
``re2c:YYCTYPE``, ``re2c:define:YYCTYPE``
|
||||
Defines API primitive ``YYCTYPE``.
|
||||
|
||||
``re2c:YYCTXMARKER``, ``re2c:define:YYCTXMARKER``
|
||||
Defines API primitive ``YYCTXMARKER``.
|
||||
|
||||
``re2c:YYCURSOR``, ``re2c:define:YYCURSOR``
|
||||
Defines API primitive ``YYCURSOR``.
|
||||
|
||||
``re2c:YYDEBUG``, ``re2c:define:YYDEBUG``
|
||||
Defines API primitive ``YYDEBUG``.
|
||||
|
||||
``re2c:YYFILL``, ``re2c:define:YYFILL``
|
||||
Defines API primitive ``YYFILL``.
|
||||
|
||||
``re2c:YYFILL@len``, ``re2c:define:YYFILL@len``
|
||||
Specifies the sigil used for argument substitution in ``YYFILL``
|
||||
definition. Defaults to ``@@``.
|
||||
Overrides the more generic ``re2c:api:sigil`` configuration.
|
||||
|
||||
``re2c:YYFILL:naked``, ``re2c:define:YYFILL:naked``
|
||||
Overrides the more generic ``re2c:api:style`` configuration for ``YYFILL``.
|
||||
Zero value corresponds to free-form API style.
|
||||
|
||||
``re2c:YYFN``
|
||||
Defines API primitive ``YYFN``.
|
||||
|
||||
``re2c:YYINPUT``
|
||||
Defines API primitive ``YYINPUT``.
|
||||
|
||||
``re2c:YYGETCOND``, ``re2c:define:YYGETCONDITION``
|
||||
Defines API primitive ``YYGETCOND``.
|
||||
|
||||
``re2c:YYGETCOND:naked``, ``re2c:define:YYGETCONDITION:naked``
|
||||
Overrides the more generic ``re2c:api:style`` configuration for
|
||||
``YYGETCOND``. Zero value corresponds to free-form API style.
|
||||
|
||||
``re2c:YYGETSTATE``, ``re2c:define:YYGETSTATE``
|
||||
Defines API primitive ``YYGETSTATE``.
|
||||
|
||||
``re2c:YYGETSTATE:naked``, ``re2c:define:YYGETSTATE:naked``
|
||||
Overrides the more generic ``re2c:api:style`` configuration for
|
||||
``YYGETSTATE``. Zero value corresponds to free-form API style.
|
||||
|
||||
``re2c:YYGETACCEPT``, ``re2c:define:YYGETACCEPT``
|
||||
Defines API primitive ``YYGETACCEPT``.
|
||||
|
||||
``re2c:YYLESSTHAN``, ``re2c:define:YYLESSTHAN``
|
||||
Defines generic API primitive ``YYLESSTHAN``.
|
||||
|
||||
``re2c:YYLIMIT``, ``re2c:define:YYLIMIT``
|
||||
Defines API primitive ``YYLIMIT``.
|
||||
|
||||
``re2c:YYMARKER``, ``re2c:define:YYMARKER``
|
||||
Defines API primitive ``YYMARKER``.
|
||||
|
||||
``re2c:YYMTAGN``, ``re2c:define:YYMTAGN``
|
||||
Defines generic API primitive ``YYMTAGN``.
|
||||
|
||||
``re2c:YYMTAGP``, ``re2c:define:YYMTAGP``
|
||||
Defines generic API primitive ``YYMTAGP``.
|
||||
|
||||
``re2c:YYPEEK``, ``re2c:define:YYPEEK``
|
||||
Defines generic API primitive ``YYPEEK``.
|
||||
|
||||
``re2c:YYRESTORE``, ``re2c:define:YYRESTORE``
|
||||
Defines generic API primitive ``YYRESTORE``.
|
||||
|
||||
``re2c:YYRESTORECTX``, ``re2c:define:YYRESTORECTX``
|
||||
Defines generic API primitive ``YYRESTORECTX``.
|
||||
|
||||
``re2c:YYRESTORETAG``, ``re2c:define:YYRESTORETAG``
|
||||
Defines generic API primitive ``YYRESTORETAG``.
|
||||
|
||||
``re2c:YYSETCOND``, ``re2c:define:YYSETCONDITION``
|
||||
Defines API primitive ``YYSETCOND``.
|
||||
|
||||
``re2c:YYSETCOND@cond``, ``re2c:define:YYSETCONDITION@cond``
|
||||
Specifies the sigil used for argument substitution in ``YYSETCOND``
|
||||
definition. The default value is ``@@``.
|
||||
Overrides the more generic ``re2c:api:sigil`` configuration.
|
||||
|
||||
``re2c:YYSETCOND:naked``, ``re2c:define:YYSETCONDITION:naked``
|
||||
Overrides the more generic ``re2c:api:style`` configuration for
|
||||
``YYSETCOND``. Zero value corresponds to free-form API style.
|
||||
|
||||
``re2c:YYSETSTATE``, ``re2c:define:YYSETSTATE``
|
||||
Defines API primitive ``YYSETSTATE``.
|
||||
|
||||
``re2c:YYSETSTATE@state``, ``re2c:define:YYSETSTATE@state``
|
||||
Specifies the sigil used for argument substitution in ``YYSETSTATE``
|
||||
definition. The default value is ``@@``.
|
||||
Overrides the more generic ``re2c:api:sigil`` configuration.
|
||||
|
||||
``re2c:YYSETSTATE:naked``, ``re2c:define:YYSETSTATE:naked``
|
||||
Overrides the more generic ``re2c:api:style`` configuration for
|
||||
``YYSETSTATE``. Zero value corresponds to free-form API style.
|
||||
|
||||
``re2c:YYSETACCEPT``, ``re2c:define:YYSETACCEPT``
|
||||
Defines API primitive ``YYSETACCEPT``.
|
||||
|
||||
``re2c:YYSKIP``, ``re2c:define:YYSKIP``
|
||||
Defines generic API primitive ``YYSKIP``.
|
||||
|
||||
``re2c:YYSHIFT``, ``re2c:define:YYSHIFT``
|
||||
Defines generic API primitive ``YYSHIFT``.
|
||||
|
||||
``re2c:YYCOPYMTAG``, ``re2c:define:YYCOPYMTAG``
|
||||
Defines generic API primitive ``YYCOPYMTAG``.
|
||||
|
||||
``re2c:YYCOPYSTAG``, ``re2c:define:YYCOPYSTAG``
|
||||
Defines generic API primitive ``YYCOPYSTAG``.
|
||||
|
||||
``re2c:YYSHIFTMTAG``, ``re2c:define:YYSHIFTMTAG``
|
||||
Defines generic API primitive ``YYSHIFTMTAG``.
|
||||
|
||||
``re2c:YYSHIFTSTAG``, ``re2c:define:YYSHIFTSTAG``
|
||||
Defines generic API primitive ``YYSHIFTSTAG``.
|
||||
|
||||
``re2c:YYSTAGN``, ``re2c:define:YYSTAGN``
|
||||
Defines generic API primitive ``YYSTAGN``.
|
||||
|
||||
``re2c:YYSTAGP``, ``re2c:define:YYSTAGP``
|
||||
Defines generic API primitive ``YYSTAGP``.
|
||||
|
||||
``re2c:yyaccept``, ``re2c:variable:yyaccept``
|
||||
Defines API primitive ``yyaccept``.
|
||||
|
||||
``re2c:yybm``, ``re2c:variable:yybm``
|
||||
Defines API primitive ``yybm``.
|
||||
|
||||
``re2c:yybm:hex``, ``re2c:variable:yybm:hex``
|
||||
If set to nonzero, bitmaps for the ``--bit-vectors`` option are generated
|
||||
in hexadecimal format. The default is zero (bitmaps are in decimal format).
|
||||
|
||||
``re2c:variable:yych``
|
||||
Specifies the name of the ``yych`` variable (see the API primitives
|
||||
section).
|
||||
``re2c:yych``, ``re2c:variable:yych``
|
||||
Defines API primitive ``yych``.
|
||||
|
||||
``re2c:variable:yych:emit``, ``re2c:yych:emit``
|
||||
``re2c:yych:emit``, ``re2c:variable:yych:emit``
|
||||
If set to zero, ``yych`` definition is not generated.
|
||||
The default is non-zero.
|
||||
|
||||
``re2c:variable:yych:conversion``, ``re2c:yych:conversion``
|
||||
If set to non-zero, re2c automatically generates a conversion to ``YYCTYPE``
|
||||
``re2c:yych:conversion``, ``re2c:variable:yych:conversion``
|
||||
If set to non-zero, |re2c| automatically generates a conversion to ``YYCTYPE``
|
||||
every time ``yych`` is read. The default is to zero (no conversion).
|
||||
|
||||
``re2c:variable:yyctable``
|
||||
Specifies the name of the ``yyctable`` variable (the jump table generated
|
||||
for ``YYGETCONDITION`` switch with ``--computed-gotos`` option).
|
||||
``re2c:yych:literals``, ``re2c:variable:yych:literals``
|
||||
Specifies the form of literals that ``yych`` is matched against. Possible
|
||||
values are: ``char`` (character literals in single quotes, non-printable
|
||||
ones use escape sequences that start with backslash), ``hex`` (hexadecimal
|
||||
integers) and ``char_or_hex`` (a mixture of both, character literals for
|
||||
printable characters and hexadecimal integers for others).
|
||||
|
||||
``re2c:variable:yytarget``
|
||||
Specifies the name of the ``yytarget`` variable.
|
||||
``re2c:yyctable``, ``re2c:variable:yyctable``
|
||||
Defines API primitive ``yyctable``.
|
||||
|
||||
``re2c:variable:yystable``
|
||||
``re2c:yynmatch``, ``re2c:variable:yynmatch``
|
||||
Defines API primitive ``yynmatch``.
|
||||
|
||||
``re2c:yypmatch``, ``re2c:variable:yypmatch``
|
||||
Defines API primitive ``yypmatch``.
|
||||
|
||||
``re2c:yytarget``, ``re2c:variable:yytarget``
|
||||
Defines API primitive ``yytarget``.
|
||||
|
||||
``re2c:yystable``, ``re2c:variable:yystable``
|
||||
Deprecated.
|
||||
|
||||
``re2c:variable:yystate``
|
||||
Specifies the name of the ``yystate`` variable (used with the
|
||||
``--loop-switch`` option to store the current DFA state).
|
||||
``re2c:yystate``, ``re2c:variable:yystate``
|
||||
Defines API primitive ``yystate``.
|
||||
|
||||
``re2c:yyfill``, ``re2c:variable:yyfill``
|
||||
Defines API primitive ``yyfill``.
|
||||
|
||||
``re2c:yyfill:check``
|
||||
If set to zero, suppresses the generation of pre-``YYFILL`` check for the
|
||||
@@ -384,5 +440,5 @@
|
||||
If set to zero, suppresses the generation of parameter passed to ``YYFILL``.
|
||||
The parameter is the minimum number of characters that must be supplied.
|
||||
Defaults to non-zero (the parameter is generated).
|
||||
This configuration can be overridden with ``re2c:define:YYFILL:naked`` or
|
||||
This configuration can be overridden with ``re2c:YYFILL:naked`` or
|
||||
``re2c:api:style``.
|
||||
@@ -0,0 +1,17 @@
|
||||
Here is a full list of directives supported by |re2c|:
|
||||
|
||||
|
||||
``!use:<name>;``
|
||||
An in-block use directive that merges a previously defined rules block with
|
||||
the specified name into the current block. Named definitions, configurations
|
||||
and rules of the referenced block are added to the current ones. Conflicts
|
||||
between overlapping rules and configurations are resolved in the usual way:
|
||||
the first rule takes priority, and the latest configuration overrides the
|
||||
preceding ones. One exception is the special rules ``*``, ``$`` and ``<!>``
|
||||
for which a block-local definition always takes priority. A use directive
|
||||
can be placed anywhere inside of a block, and multiple use directives are
|
||||
allowed.
|
||||
|
||||
``!include <file>;``
|
||||
This directive is the same as ``include`` block: it inserts ``<file>``
|
||||
contents verbatim in place of the durective.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user