Skip to content
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

Allow synchronous call tags to work inside redirects #203

Merged
merged 2 commits into from
Jan 19, 2017

Conversation

kirsle
Copy link
Member

@kirsle kirsle commented Jan 19, 2017

This change makes it possible to include synchronous object macro calls inside of redirects (both the command and inline form).

This fixes #201.

Example from the unit test:

> object echo javascript
  var message = args.join(" ");
  return message;
< object

+ hello bot
- Hello human.

+ redirect to *
@ <call>echo <star></call>

+ inline to *
- "<sentence>": {@ <call>echo <star></call>}

This is similar to the bug fix in #111 when object macros were fixed for conditional commands. It only supports synchronous macros (ones which return a string reply, not a promise) for the same reason.

In order to avoid regular expression problems with the {@...} syntax's curly brackets conflicting with those from the mangled {__call_arg__} types of tags, I changed the delimiter of the mangled call tags to use the 'LEFT-POINTING DOUBLE ANGLE QUOTATION MARK' (U+00AB) and 'RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK' (U+00BB)' symbols: « and ». I chose these symbols so that if the call tag fails to parse properly (as it did in the original bug), the resulting text contains printable symbols. « and » are not used by anything else in RiveScript.

@kirsle kirsle added the async label Jan 19, 2017
@kirsle kirsle merged commit ea760f0 into master Jan 19, 2017
@kirsle kirsle deleted the bug/201-async-redirect branch January 19, 2017 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How do I chain replies
1 participant