21.10.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

BibTeX.ebnf 1.25 KB
Newer Older
1
2
# BibTeX-Grammar

3
4
5
6
7
8
#######################################################################
#
#  EBNF-Directives
#
######################################################################

9
10
11
12
13
@ testing     = True
@ whitespace  = /\s*/
@ ignorecase  = True
@ comment     = /%.*(?:\n|$)/

14
15
16
17
18
19
20

#######################################################################
#
#  Bib-file Structure and Components
#
#######################################################################

21
22
bibliography = { preamble | comment | entry }

Eckhart Arnold's avatar
Eckhart Arnold committed
23
24
preamble      = "@Preamble{" /"/ pre_code /"/~ §"}"
pre_code      = { /[^"%]+/ | /%.*\n/ }
25

Eckhart Arnold's avatar
Eckhart Arnold committed
26
comment       = "@Comment{" text §"}"
27

Eckhart Arnold's avatar
Eckhart Arnold committed
28
entry         = /@/ type "{" key { "," field §"=" content } §"}"
29
30
31
type          = WORD
key           = NO_BLANK_STRING
field         = WORD_
Eckhart Arnold's avatar
Eckhart Arnold committed
32
33
content       = "{" text "}" | plain_content

34
plain_content = COMMA_TERMINATED_STRING
35
text          = { CONTENT_STRING | "{" text "}" }
36
37
38
39
40
41
42
43
44
45
46
47


#######################################################################
#
#  Regular Expressions
#
#######################################################################

WORD          = /\w+/
WORD_         = /\w+/~
NO_BLANK_STRING         = /[^ \t\n,%]+/~
COMMA_TERMINATED_STRING = { /[^,%]+/ | /(?=%)/~ }
48
CONTENT_STRING = { [^{}%]+ | /(?=%)/~ }