3 local P
, S
= lpeg
.P
, lpeg
.S
4 local cwd
= (...):match
'(.-)[^%.]+$'
5 local l
= require(cwd
..'_lexer')
7 -- The LPeg patterns for atoms are taken from the scintillua lexer:
8 -- Copyright 2006-2017 Mitchell mitchell.att.foicica.com.
11 [':implementation'] = 1,
17 ['defimplementation'] = 1,
18 ['define-condition'] = 1,
19 ['define-implementation-package'] = 1,
28 ['do-external-symbols'] = 1,
39 ['print-unreadable-object'] = 1,
48 ['with-open-file'] = 1,
49 ['with-output-to-string'] = 1,
50 ['with-input-from-string'] = 1,
56 ['ignore-errors'] = 1,
58 ['multiple-value-bind'] = 2,
60 ['unwind-protect'] = 1,
62 ['destructuring-bind'] = 2,
67 local macro_prefix
= P('#.') + ',@' + ',.' + ',' + '`' + "'"
78 local number = P('-')^
-1 * l
.digit^
1 * (S('./') * l
.digit^
1)^
-1
79 local word
= l
.alpha
* (l
.alnum
+ '_' + '-')^
0
80 local entity
= '&' * word
81 local identifier
= word
84 lispwords
= lispwords
,
85 prefix
= macro_prefix
,
87 atom
= function(pfx
) return pfx
* identifier
+ number + entity
+ "..." + "." end,
88 word
= number + identifier
+ "\\" * l
.any