Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
9.2.2023: Due to updates GitLab will be unavailable for some minutes between 9:00 and 11:00.
Open sidebar
badw-it
DHParser
Commits
592bc036
Commit
592bc036
authored
Apr 19, 2017
by
Eckhart Arnold
Browse files
- LaTeX.ebnf slightly extended; need a test-suite first
parent
41357b5f
Changes
1
Hide whitespace changes
Inline
Side-by-side
examples/LaTeX/LaTeX.ebnf
View file @
592bc036
# latex Grammar
@ whitespace = /[ \t]*\n?(?!\s*\n)[ \t]*/
@ whitespace = /[ \t]*\n?(?!\s*\n)[ \t]*/
# whitespace, including at most one linefeed
@ comment = /%.*(?:\n|$)/
genericenv = beginenv sequence endenv
latexdoc = preamble document
preamble = { command }+
genericenv = beginenv sequence §endenv
beginenv = "\begin" §( "{" name "}" )
endenv = "\end" §( "{" ::name "}" )
name =
~
/\w+/
name = /\w+/
~
genericcmd = command
[ config ] block
c
ommand
= /\\\w+/
comand = cmdname
[ config ] block
c
mdname
= /\\\w+/
config = "[" cfgtext §"]"
sequence = { partext | parblock }
...
...
@@ -18,16 +21,16 @@ sequence = { partext | parblock }
parblock = "{" { partext | parblock } §"}"
block = "{" { text | block } §"}"
partext = text |
par
partext = text |
PARSEP
text = cfgtext | brackets
cfgtext = chunk |
wspc |
escaped
cfgtext = chunk | escaped
| WSPC
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.
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)
PARSEP
= /\s*\n\s*\n/ # at least one empty line, i.e.
# [whitespace] linefeed [whitespace] linefeed
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment