Check-in [8c24d05535]

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

Overview
Comment:Finished impementation of the desired parser, with english synonyms for operations.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:8c24d05535521b26f10f322f6d75f189fac0fc1d
User & Date: CrosslandA 2016-10-11 18:04:50
Context
2016-10-12
00:51
Added package.json for better npm usage. check-in: e2ee230a08 user: adamc tags: trunk
2016-10-11
18:04
Finished impementation of the desired parser, with english synonyms for operations. check-in: 8c24d05535 user: CrosslandA tags: trunk
18:04
Added documentation comments for whitespace and numeric parsers. check-in: a7aa84dacb user: CrosslandA tags: trunk
Changes

Changes to app/chattymath.ts.

60
61
62
63
64
65
66

67
68
69

70
71
72
73
74
75
76
..
88
89
90
91
92
93
94
95

96

97
98
99
100
101
102
103
                result.operator = MathOps.Add;
                break;
            case "-":
            case "minus":
                result.operator = MathOps.Subtract;
                break;
            case "*":

                result.operator = MathOps.Multipy;
                break;
            case "/":

                result.operator = MathOps.Divide;
                break;
        }

        return result;
    }

................................................................................
    }

    constructor() {
        this.operandPlus = pcomb.or(pcomb.lit("+", this.operandSet),
            pcomb.lit("plus", this.operandSet));
        this.operandMinus = pcomb.or(pcomb.lit("-", this.operandSet),
            pcomb.lit("minus", this.operandSet));
        this.operandMultiply = pcomb.lit("*", this.operandSet);

        this.operandDivide = pcomb.lit("/", this.operandSet);


        this.operand = pcomb.or(this.operandPlus,
            this.operandMinus,
            this.operandMultiply,
            this.operandDivide);

        this.numberParser = pcomb.all(pcomb.numeric(), this.numberSet);







>



>







 







|
>
|
>







60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
..
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
                result.operator = MathOps.Add;
                break;
            case "-":
            case "minus":
                result.operator = MathOps.Subtract;
                break;
            case "*":
            case "times":
                result.operator = MathOps.Multipy;
                break;
            case "/":
            case "divided by":
                result.operator = MathOps.Divide;
                break;
        }

        return result;
    }

................................................................................
    }

    constructor() {
        this.operandPlus = pcomb.or(pcomb.lit("+", this.operandSet),
            pcomb.lit("plus", this.operandSet));
        this.operandMinus = pcomb.or(pcomb.lit("-", this.operandSet),
            pcomb.lit("minus", this.operandSet));
        this.operandMultiply = pcomb.or(pcomb.lit("*", this.operandSet),
            pcomb.lit("times", this.operandSet));
        this.operandDivide = pcomb.or(pcomb.lit("/", this.operandSet),
            pcomb.lit("divided by", this.operandSet));

        this.operand = pcomb.or(this.operandPlus,
            this.operandMinus,
            this.operandMultiply,
            this.operandDivide);

        this.numberParser = pcomb.all(pcomb.numeric(), this.numberSet);