superscriptjs / superscript

A dialogue engine for creating chat bots
http://superscriptjs.com
MIT License
1.65k stars 209 forks source link

keep flag does not work in topic, reply #392

Open hailiang-wang opened 6 years ago

hailiang-wang commented 6 years ago

After install the latest superscript, I parse a script with keep flag. But I think it does not as expected. The keep flag is not in Topic and the reply's keep is false.

Expected Behavior

As described in Wiki, keep can be used with topics.

Current Behavior

keep flag does not work in topic, reply

Possible Solution

Steps to Reproduce (for bugs)

node_modules/superscript/lib/bin/parse.js -p chat -o data.json -f

greetings.ss in chat

> topic greetings {keep}

+ {keep} hello
- hi
- hey
- hello

< topic

data.json

{
    "topics": {
        "greetings": {
            "name": "greetings",
            "flags": {},
            "keywords": [],
            "filter": null,
            "gambits": [
                "DBtRlurb"
            ]
        }
    },
    "gambits": {
        "DBtRlurb": {
            "trigger": {
                "flags": {},
                "filter": null,
                "question": false,
                "raw": "hello",
                "clean": "hello"
            },
            "replies": [
                "NKJf47IE",
                "sc90c3A3"
            ],
            "conditional": null,
            "conversation": null,
            "topic": "greetings"
        }
    },
    "replies": {
        "NKJf47IE": {
            "string": "hi",
            "filter": null,
            "keep": false
        },
        "sc90c3A3": {
            "string": "hey",
            "filter": null,
            "keep": false
        }
    },
    "checksums": {
        "chat/greetings.ss": "99959fad371a27860e419504f5fdac9c4f8ebc38"
    },
    "version": 1
}

with superscript#1.0.0, things works out as expected, data.json with ss 1.0.0:

{
    "topics": {
        "greetings": {
            "name": "greetings",
            "flags": {
                "keep": "keep"
            },
            "keywords": [],
            "filter": null,
            "gambits": [
                "ZmywpgXK"
            ]
        }
    },
    "gambits": {
        "ZmywpgXK": {
            "trigger": {
                "flags": {
                    "keep": "keep"
                },
                "filter": null,
                "question": false,
                "raw": "hello",
                "clean": "hello"
            },
            "replies": [
                "SiA1tHNg",
                "yQnR8A2X",
                "EJW4gAug"
            ],
            "conditional": null,
            "conversation": null,
            "topic": "greetings"
        }
    },
    "replies": {
        "SiA1tHNg": {
            "string": "hi",
            "filter": null,
            "keep": false
        },
        "yQnR8A2X": {
            "string": "hey",
            "filter": null,
            "keep": false
        },
        "EJW4gAug": {
            "string": "hello",
            "filter": null,
            "keep": false
        }
    },
    "checksums": {
        "engine/chat/greetings.ss": "b2eed9b04702eaf5091b0eb2456660fa0da1bd7f"
    },
    "version": 1
}

Context

Your Environment

image