Check-in [a356076104]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:[bb7eb5d898] Changed the demo app code to use the new static Parse method.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:a356076104b81faf39142cd3808fb33e7f455e89
User & Date: adamc 2016-11-13 14:26:04
Context
2016-11-13
14:52
[a7c9cfbcda] Made changes to CSS and TS to implement. check-in: 268cdcdf71 user: adamc tags: trunk
14:26
[bb7eb5d898] Changed the demo app code to use the new static Parse method. check-in: a356076104 user: adamc tags: trunk
14:13
[4c607651cb] Added code and tests to give ParserSet the Parse method. check-in: 99e17d1f46 user: adamc tags: trunk
Changes

Changes to app/chattymath.ts.

270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
            pcomb.opt(pcomb.or([pcomb.lit("="), pcomb.lit("equal")]))]);

        this.parsers = new pcomb.ParserSet(new ChattyInput(), new ChattyData());
    }

    ask(text: string): string {
        let theAnswer = "sorry, but I couldn't understand that";
        let parseResult = this.parsers.parse(this.formulaParser, text);
        if (parseResult[0]) {
            let calc: number = NaN;
            let theData: ChattyData = <ChattyData>parseResult[2];

            switch (theData.operator) {
                case MathOps.Add:
                    calc = theData.leftOperand + theData.rightOperand;







|







270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
            pcomb.opt(pcomb.or([pcomb.lit("="), pcomb.lit("equal")]))]);

        this.parsers = new pcomb.ParserSet(new ChattyInput(), new ChattyData());
    }

    ask(text: string): string {
        let theAnswer = "sorry, but I couldn't understand that";
        let parseResult = pcomb.Parse(this.formulaParser, text, new ChattyInput(), new ChattyData());
        if (parseResult[0]) {
            let calc: number = NaN;
            let theData: ChattyData = <ChattyData>parseResult[2];

            switch (theData.operator) {
                case MathOps.Add:
                    calc = theData.leftOperand + theData.rightOperand;