bp/grammars/builtins.bp

48 lines
1.1 KiB
Plaintext
Raw Normal View History

2021-01-17 22:35:13 -08:00
# This file contains some default general-purpose definitions.
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)
utf8-codepoint: (
\x00-x7f
/ \xc0-xdf 1\x80-xbf
/ \xe0-xef 2\x80-xbf
/ \xf0-xf7 3\x80-xbf
)
crlf: \r\n
cr: \r
anglebraces: `< ..%(\n/anglebraces/string) `>
brackets: `[ ..%(\n/brackets/string) `]
braces: `{ ..%(\n/braces/string) `}
parens: `( ..%(\n/parens/string) `)
string: `" ..%string-escape `" / `' ..%string-escape `'
string-escape: `\ (`x 2 Hex / 1-3 `0-7 / `u 1-4 Hex / .)
left-id-edge: !<id-char
2021-05-11 19:06:41 -07:00
right-id-edge: !id-char
2021-05-22 13:28:33 -07:00
id: left-id-edge !`0-9 !(keyword !id-char) +id-char
2020-12-19 19:04:21 -08:00
id-char: `a-z,A-Z,_,0-9
2021-01-17 20:13:34 -08:00
var: id
keyword: !"" # No keywords defined by default
2021-05-20 15:27:24 -07:00
left-word-edge: !<word-char
2021-05-11 19:06:41 -07:00
right-word-edge: !word-char
word-char: `a-z,A-Z,_,0-9,-,'
2021-05-11 19:06:41 -07:00
word: left-word-edge +word-char
2020-12-19 19:04:21 -08:00
HEX: `0-9,A-F
Hex: `0-9,a-f,A-F
hex: `0-9,a-f
number: +`0-9 [`. *`0-9] / `. +`0-9
int: +`0-9
digit: `0-9
2021-01-17 22:35:13 -08:00
Abc123: `a-z,A-Z,0-9
ABC123: `A-Z,0-9
abc123: `a-z,0-9
2020-12-19 19:04:21 -08:00
Abc: `a-z,A-Z
ABC: `A-Z
abc: `a-z
esc: \e
tab: \t
nl: \n; lf: \n
comment: !''; # No default definition, can be overridden
__: *(` /\t/\n/\r/comment)
_: *(` /\t)