Previous: Per-rule events, Up: Per-rule events [Contents][Index]
Most users will fix the second limitation
(see lim2Ex)
by falling back
on marker symbols.
For those users who for some reason prefer to avoid this,
in this section we present
a workaround that is based on introducing a new symbol,
one dedicated to acting as the LHS of (R3)
of lim2Ex
.
We show the fix as another example,
one which we will call
fixEx
.
fixEx
is identical to
lim2Ex
with
the following exceptions:
(R3)
in lim2Ex
is replaced with the following rules:
[ A1 ::= W X ] (R3a) [ A ::= A1 ] (R3b)
In these two rules,
rule (R3a)
is the replacement rule
for rule (R3)
in lim2Ex
,
and A1
is the new LHS symbol,
which is dedicated to serving as the LHS
of rule (R3a)
.
MARPA_EVENT_SYMBOL_COMPLETED
event
is activated for symbol A1
,
instead of for symbol A
.
(R3a)
has the same semantics
as rule (R3)
in lim2Ex
,
the rule that it replaced.
(R3b)
has pass-through semantics.
MARPA_EVENT_SYMBOL_COMPLETED
event
for symbol A1
,
instead of symbol A
.
fixEx
will accept the same language
as lim2Ex
,
with the same semantics as lim2Ex
.
A MARPA_EVENT_SYMBOL_COMPLETED
event
will trigger at the end of (R3a)
,
this time for symbol A1
,
but at exactly the same parse location as it did
for symbol A
in lim2Ex
.
And a MARPA_EVENT_SYMBOL_COMPLETED
event
will no longer trigger at the end of (R4)
,
which is the fix we were looking for.