aichaos / rivescript-python

A RiveScript interpreter for Python. RiveScript is a scripting language for chatterbots.
https://www.rivescript.com
MIT License
157 stars 71 forks source link

‘=‘ in var definitions ends the definition #130

Closed snoopyjc closed 4 years ago

snoopyjc commented 5 years ago

If a var definition RHS contains a ‘=‘, that will act as the end of the definition. Instead it should be part of the variable value. Example:

! var website = https://www.rivescript.com/try/#/doc?x=y&more=more_stuff

+ where is your (website|web site|site)
- <bot website>

User: Where is your site?

Bot: https://www.rivescript.com/try/#/doc?x

snoopyjc commented 5 years ago

Potential fix in parser.py:

        # Handle the types of RiveScript commands.
        if cmd == '!':
            # ! DEFINE
    -       halves = re.split(RE.equals, line, 2)
    +       halves = re.split(RE.equals, line, 1)
snoopyjc commented 5 years ago

Potential fix for js version:

        // Handle the types of RiveScript commands.
        switch (cmd) {
            case "!": // ! Define
    -           let halves = line.split("=", 2);
        +                       let halves = line.split("=", 1);
kirsle commented 4 years ago

Fixed in #144.