Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
DHParser
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
badw-it
DHParser
Commits
7595cd9c
Commit
7595cd9c
authored
Apr 25, 2017
by
di68kap
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- additions testbed minilanguage
parent
3b9b93c9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
20 deletions
+36
-20
DHParser/ebnf.py
DHParser/ebnf.py
+0
-3
examples/DHParser-Testbed/example.tb
examples/DHParser-Testbed/example.tb
+36
-15
examples/EBNF/EBNF.ebnf
examples/EBNF/EBNF.ebnf
+0
-2
No files found.
DHParser/ebnf.py
View file @
7595cd9c
...
...
@@ -75,8 +75,6 @@ class EBNFGrammar(GrammarBase):
repetition = "{" expression §"}"
option = "[" expression §"]"
link = regexp | symbol | literal # semantic restriction: symbol must evaluate to a regexp or chain
symbol = /(?!\d)\w+/~ # e.g. expression, factor, parameter_list
literal = /"(?:[^"]|\\")*?"/~ # e.g. "(", '+', 'while'
| /'(?:[^']|\\')*?'/~ # whitespace following literals will be ignored tacitly.
...
...
@@ -99,7 +97,6 @@ class EBNFGrammar(GrammarBase):
regexp
=
RE
(
'~?/(?:[^/]|(?<=
\\\\
)/)*/~?'
)
literal
=
Alternative
(
RE
(
'"(?:[^"]|
\\\\
")*?"'
),
RE
(
"'(?:[^']|
\\\\
')*?'"
))
symbol
=
RE
(
'(?!
\\
d)
\\
w+'
)
link
=
Alternative
(
regexp
,
symbol
,
literal
)
option
=
Sequence
(
Token
(
"["
),
expression
,
Required
(
Token
(
"]"
)))
repetition
=
Sequence
(
Token
(
"{"
),
expression
,
Required
(
Token
(
"}"
)))
oneormore
=
Sequence
(
Token
(
"{"
),
expression
,
Token
(
"}+"
))
...
...
examples/DHParser-Testbed/example.tb
View file @
7595cd9c
...
...
@@ -2,30 +2,51 @@
# language
#######################################################################
match:literal
standard {"literal test double quoted"}
MATCH:literal
{'literal test single suoted'
}
standard {"literal test double quoted"
}
{'literal
multiple lines
with gap'}
{'literal test single suoted'}
whitespace
{'literal with right-attached whitespace' }
{'literal
multiple lines
with gap'}
whitespaced
{'literal with right-attached whitespace' }
fail:literal
FAIL:literal
{ 'literal with left-attached whitespace'}
{quotation marks forgotten}
#######################################################################
match:symbol
"letters" {symbol}
"underscore" {symbol_with_underscore}
""
MATCH:symbol
standard {letters}
{letters_with_underscore}
{numbers_123}
whitespaced {whitespace }
FAIL:symbol
{1_cannot_start_with_number}
{ no_whitespace_on_the_left}
{"with quotation marks it is a literal, not a symbol"}
MATCH:regexp
standard {/\w+/}
{/whitespace/ }
whitespacemarker {~/\w+/~}
right_wsp {/\w+/~}
MATCH:repetition
[{ symbol }]
examples/EBNF/EBNF.ebnf
View file @
7595cd9c
...
...
@@ -29,8 +29,6 @@ oneormore = "{" expression "}+"
repetition = "{" expression §"}"
option = "[" expression §"]"
link = regexp | symbol | literal # semantic restriction: symbol must evaluate to a regexp or chain
symbol = /(?!\d)\w+/~ # e.g. expression, factor, parameter_list
literal = /"(?:[^"]|\\")*?"/~ # e.g. "(", '+', 'while'
| /'(?:[^']|\\')*?'/~ # whitespace following literals will be ignored tacitly.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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