2020-09-16 22:36:38 -07:00
|
|
|
yes: ''
|
|
|
|
no: !''
|
2020-09-16 20:41:38 -07:00
|
|
|
|
2020-09-16 21:43:12 -07:00
|
|
|
# Configurable options:
|
2020-09-16 22:36:38 -07:00
|
|
|
is-tty: no # Defined as either always-match or always-fail, depending on stdout
|
2020-09-18 22:32:36 -07:00
|
|
|
include-binary-files: no;
|
2021-01-12 18:34:45 -08:00
|
|
|
is-text-file: >32(\t/\n/\r/\x20-x7e/!\x00-x7f utf8-codepoint/$$)
|
2020-09-16 21:43:12 -07:00
|
|
|
|
|
|
|
# Meta-rules for acting on everything:
|
2020-09-16 22:36:38 -07:00
|
|
|
pattern: !'' # Not defined by default
|
|
|
|
replacement: !'' # Not defined by default
|
2020-09-12 18:20:13 -07:00
|
|
|
|
|
|
|
# Helper definitions (commonly used)
|
2020-09-28 16:14:06 -07:00
|
|
|
url: (
|
2020-09-28 18:08:23 -07:00
|
|
|
"file://" +(`/ *url-char)
|
2020-09-28 16:14:06 -07:00
|
|
|
/ "mailto:" email
|
2020-09-28 22:22:10 -07:00
|
|
|
/ ("https"/"http"/"ftp") "://" [>..`@ +url-char [`: +url-char] `@]
|
|
|
|
(ipv4/ipv6/domain) [`: int] [url-path]
|
2020-09-28 16:14:06 -07:00
|
|
|
)
|
2020-09-28 22:22:10 -07:00
|
|
|
url-path: +(`/ *url-char) [`? +(+url-char`=+url-char)%`&]
|
2020-09-28 16:14:06 -07:00
|
|
|
ipv4: 4 int % `.
|
|
|
|
ipv6: 8 (4 Hex) % `:
|
2020-09-28 22:22:10 -07:00
|
|
|
domain: +(+(Abc/digit/`-))%`.
|
2020-12-19 19:04:21 -08:00
|
|
|
url-char: Abc/digit/`$,-,_,.,+,!,*,',(,),,,%
|
|
|
|
email: +(Abc/digit/`.,-,+) `@ domain
|
2020-09-28 16:14:06 -07:00
|
|
|
|
2020-12-14 21:27:47 -08:00
|
|
|
nodent: \N !(\t/` )
|
|
|
|
indent: \N (` /\t)
|
2020-10-13 17:12:37 -07:00
|
|
|
dedent: $ !(nodent/indent)
|
2020-09-18 22:32:36 -07:00
|
|
|
utf8-codepoint: (
|
|
|
|
\x00-x7f
|
|
|
|
/ \xc0-xdf 1\x80-xbf
|
|
|
|
/ \xe0-xef 2\x80-xbf
|
|
|
|
/ \xf0-xf7 3\x80-xbf
|
|
|
|
)
|
2020-09-16 22:36:38 -07:00
|
|
|
crlf: \r\n
|
2020-09-28 15:13:54 -07:00
|
|
|
cr: \r
|
2021-01-05 00:09:30 -08:00
|
|
|
anglebraces: `<..`> % (\n/anglebraces/string)
|
|
|
|
brackets: `[..`] % (\n/brackets/string)
|
|
|
|
braces: `{..`} % (\n/braces/string)
|
|
|
|
parens: `(..`) % (\n/parens/string)
|
2020-12-14 21:38:49 -08:00
|
|
|
string: `"..`" % (`\.) / `'..`' % (`\.)
|
2020-12-19 19:04:21 -08:00
|
|
|
id: !<`a-z,A-Z,_,0-9 `a-z,A-Z,_ *`a-z,A-Z,_,0-9
|
|
|
|
id-char: `a-z,A-Z,_,0-9
|
|
|
|
word: !<`a-z,A-Z,_,0-9 +`a-z,A-Z !>`0-9,_
|
|
|
|
|: !<`a-z,A-Z,_,0-9 / !>`a-z,A-Z,_,0-9
|
|
|
|
HEX: `0-9,A-F
|
|
|
|
Hex: `0-9,a-f,A-F
|
|
|
|
hex: `0-9,a-f
|
2020-09-28 18:08:23 -07:00
|
|
|
number: +`0-9 [`. *`0-9] / `. +`0-9
|
|
|
|
int: +`0-9
|
2020-09-16 22:36:38 -07:00
|
|
|
digit: `0-9
|
2020-12-19 19:04:21 -08:00
|
|
|
Abc: `a-z,A-Z
|
2020-09-16 22:36:38 -07:00
|
|
|
ABC: `A-Z
|
|
|
|
abc: `a-z
|
2020-09-28 15:13:54 -07:00
|
|
|
esc: \e
|
|
|
|
tab: \t
|
|
|
|
nl: \n; lf: \n
|
2021-01-05 00:09:30 -08:00
|
|
|
c-block-comment: '/*'..'*/'%\n
|
|
|
|
c-line-comment: '//'..$
|
2020-09-16 22:36:38 -07:00
|
|
|
c-comment: c-line-comment / c-block-comment
|
|
|
|
hash-comment: `# ..$
|
|
|
|
comment: !''; # No default definition, can be overridden
|
|
|
|
WS: ` /\t/\n/\r/comment
|
|
|
|
ws: ` /\t
|
2021-01-05 00:09:30 -08:00
|
|
|
$$: !(./\n)
|
2020-09-16 22:36:38 -07:00
|
|
|
$: !.
|
2021-01-05 00:09:30 -08:00
|
|
|
^^: !<(./\n)
|
2020-09-16 22:36:38 -07:00
|
|
|
^: !<.
|
2020-09-28 18:08:23 -07:00
|
|
|
__: *(` /\t/\n/\r/comment)
|
|
|
|
_: *(` /\t)
|