Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
POTTIER Francois
menhir
Commits
2d225824
Commit
2d225824
authored
Oct 23, 2018
by
POTTIER Francois
Browse files
In fancy-parser, introduce and use [located(X)].
parent
a01e0cf0
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/fancy-parser.mly
View file @
2d225824
...
...
@@ -318,7 +318,7 @@ producer:
symbol
=
symbol
actuals
=
plist
(
A
)
{
Parameters
.
app
symbol
actuals
}
(* 2- *)
|
p
=
B
m
=
modifier
|
p
=
B
m
=
located
(
modifier
)
{
ParameterApp
(
m
,
[
p
])
}
strict_actual
:
...
...
@@ -334,8 +334,8 @@ lax_actual:
{
p
}
(* 3- *)
|
/*
leading
bar
disallowed
*/
branches
=
branches
{
ParameterAnonymous
(
with_loc
$
loc
branches
)
}
branches
=
located
(
branches
)
{
ParameterAnonymous
branches
}
(* 2016/05/18: we used to eliminate anonymous rules on the fly during
parsing. However, when an anonymous rule appears in a parameterized
definition, the fresh nonterminal symbol that is created should be
...
...
@@ -357,11 +357,11 @@ lax_actual:
modifier
:
QUESTION
{
with_loc
$
loc
"option"
}
{
"option"
}
|
PLUS
{
with_loc
$
loc
"nonempty_list"
}
{
"nonempty_list"
}
|
STAR
{
with_loc
$
loc
"list"
}
{
"list"
}
/*
-------------------------------------------------------------------------
*/
/*
A
postlude
is
announced
by
%%,
but
is
optional
.
*/
...
...
@@ -372,4 +372,13 @@ postlude:
|
p
=
PERCENTPERCENT
/*
followed
by
actual
postlude
*/
{
Some
(
Lazy
.
force
p
)
}
/*
--------------------------------------------------------------------------
*/
/*
[
located
(
X
)]
recognizes
the
same
language
as
[
X
]
and
converts
the
resulting
value
from
type
[
'
a
]
to
type
[
'
a
located
]
.
*/
located
(
X
)
:
x
=
X
{
with_loc
$
loc
x
}
%%
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