bp/grammars/builtins.bp

36 lines
855 B
Plaintext
Raw Permalink 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)
crlf: \r\n
cr: \r
2021-08-29 13:44:43 -07:00
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 / .)
id: \I *\i
var: \I *\i
keyword: !"" # No keywords defined by default
word: \b +\i
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)