repo.or.cz
/
lisp-parkour.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
fennel: add single-quote prefix
[lisp-parkour.git]
/
parser
/
scheme
/
init.lua
blob
1f0d29b2bb737917418b3b8ef30468780c5f1fc7
1
require
'lpeg'
2
local
lpeg
=
lpeg
3
local
P
,
S
,
R
=
lpeg
.
P
,
lpeg
.
S
,
lpeg
.
R
4
5
-- TODO: add more prefixes
6
local
macro_prefix
=
7
P
'#'
* (
8
S
'us'
* (
'8'
+
'16'
+
'32'
+
'64'
)
--[[+ P'f' * ('32' + '64')]]
+
9
R
'09'
^
0
*
'vu8'
+
10
R
'09'
^
1
+
11
';'
) +
12
P
'#'
^
-
1
* (
P
',@'
+
S
",`'"
) +
13
'#'
14
15
local
opposite
= {
16
[
"("
] =
")"
,
17
[
")"
] =
"("
,
18
[
"{"
] =
"}"
,
19
[
"}"
] =
"{"
,
20
[
"["
] =
"]"
,
21
[
"]"
] =
"["
,
22
[
'"'
] =
'"'
,
23
[
"|"
] =
"|"
,
24
[
";"
] =
"
\n
"
,
25
[
"
\n
"
] =
";"
,
26
[
"#|"
] =
"|#"
,
27
}
28
29
return
{
30
prefix
=
macro_prefix
,
31
opposite
=
opposite
,
32
}