-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parse Events: adverbs + handlers? #32
Comments
Sounds basically good. Note the distinction between nulling rules, which always derive the The idea of making hiding analogous to discarding is nice. The event-adverb for discard needs another name, I think -- the name is Multiple event adverbs may occur with the same rule, so an On Thu, May 14, 2015 at 3:39 AM, rns notifications@github.com wrote:
|
LUIF manual currently specifies completion and prediction events via
completed
andpredicted
adverbs.Their values are event handler functions, which can call context accessors to get location data and rule data.
Below is an idea on how to use that approach for other event types defined for Marpa::R2.
Nulling events can be set by modifying a nulling rule with
nulled
adverb.Pre- and post-lexeme events can be set using
predicted
andcompleted
adverbs of a lexeme rule (havingaction = lexeme
orlexeme = true
adverb). Their handlers will be able to useluif.recognizer.lexeme_read()
to read lexemes and context accessors inluif.context.*
.Discard events can be set via
discarded
adverb on a lexeme rule.discard = true
on a lexeme rule will discard a lexeme,on a structural rule it will be a synonym for hiding (
[]
).Exhaustion and rejection event handlers can be set in
luif.recognizer.new()
,and, if so set, will be synonymos to
rejection = event
in Marpa::R2.All events are
off
(deactivated) by default that can be changed byluif.event.activate(rule_id, event_name)
andluif.event.deactivate(rule_id, event_name)
, whereevent_name
is the same as the adverb name. Alternatively,activate = on/off
can be used in conjunction with the event handler adverbs.The text was updated successfully, but these errors were encountered: