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

LaTeX.ebnf 1.12 KB
 Eckhart Arnold committed Feb 23, 2017 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 # latex Grammar @ whitespace := /[ \t]*\n?(?!\s*\n)[ \t]*/ @ comment := /%.*(?:\n|$)/ genericenv := beginenv sequence endenv beginenv := "\begin" §( "{" name "}" ) endenv := "\end" §( "{" @name "}" ) name := ~/\w+/ genericcmd := command [ config ] block command := /\\\w+/ config := "[" cfgtext §"]" sequence := { partext | parblock } parblock := "{" { partext | parblock } §"}" block := "{" { text | block } §"}" partext := text | par text := cfgtext | brackets cfgtext := chunk | wspc | escaped escaped := /\$%&]/ brackets := /[\[$]/ # left and right square brackets: [ ] chunk := /[^\\%$&\{\}\s\n]+/ # some piece of text excluding whitespace, # linefeed and special characters wspc := /[ \t]*\n?(?!\s*\n)[ \t]*/ # whitespace, including at most one linefeed lf := /[ \t]*\n(?!\s*\n)/ # a linefeed, but not an empty line (i.e. par) par := /\s*\n\s*\n/ # at least one empty line, i.e. # [whitespace] linefeed [whitespace] linefeed