Check-in [b62dfde2d3]

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

Overview
Comment:All test still failing. Investigating why.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:b62dfde2d338bffc52727a810203e1943b6fcba1
User & Date: CrosslandA 2016-10-10 17:30:50
Context
2016-10-10
19:24
[2b12c9d54e] Final changes for implementing all combinator. check-in: 3cdeaf46fb user: CrosslandA tags: trunk
17:30
All test still failing. Investigating why. check-in: b62dfde2d3 user: CrosslandA tags: trunk
00:40
Added all combinator and tests. The test is currently not working. check-in: acb88ef3d0 user: adamc tags: trunk
Changes

Changes to tests/test.ts.

54
55
56
57
58
59
60

61
62
63
64
65
66
67
..
80
81
82
83
84
85
86


87
88
89
90
91
92
93
...
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
...
282
283
284
285
286
287
288
289
290
291
292

293
294
295
296
297
298
299
    private eitherNameValuePair: pcomb.Parser;
    private allStoreName: pcomb.Parser;
    private optWsParser: pcomb.Parser;
    private optParser: pcomb.Parser;
    private anyParser1: pcomb.Parser;
    private anyParser2: pcomb.Parser;
    private numericParser: pcomb.Parser;

    private storeNameValue: (matched: string, output: testOutput) => testOutput;
    private recordWhitespace: (matched: string, output: testOutput) => testOutput;
    private dumbGrabber: (matched: string, output: testOutput) => testOutput;

    constructor() {
        super();
    }
................................................................................
        this.eitherNameValuePair = pcomb.or(this.litValue, this.litValueOther);
        this.nameValuePair2 = pcomb.and(this.litName, this.litColon, this.eitherNameValuePair);
        this.optParser = pcomb.and(
            this.litName, this.optWsParser, this.litColon,
            this.optWsParser, this.litValue);
        this.anyParser1 = pcomb.and(this.litName, this.litColon, this.allStoreName);
        this.anyParser2 = pcomb.and(this.litName, this.litColon, pcomb.any(this.litSemicolon), this.litSemicolon);



        // Declare functions that are used in testing in this way to prevent tsUnit from throwing errors
        // related to them.
        this.storeNameValue = function (matched: string, output: testOutput) {
            let newOutput = output.copy();
            newOutput.name = matched;

................................................................................
        this.dumbGrabber = function (matched: string, output: testOutput): testOutput {
            let newOutput = output.copy();
            newOutput.name = matched;

            return newOutput;
        }

        this.numericParser = function(input: pcomb.ParserInput, output: pcomb.ParserOutput) : pcomb.ParseResult {
            let result: pcomb.ParseResult = [false, input.copy(), output.copy()];
            let cur:string = input.text.slice(0,1);
            if (Number(cur) != NaN) {
                result[0] = true;
                result[1].text = input.text.slice(1);
                result[2].matched.push(cur);
            }

            return result;
        }
    }

    litTest1() {
        let tryResult = this.parsers.parse(this.litName, "name");

        this.isTrue(tryResult[0]);
        this.areIdentical(tryResult[2].matched.length, 1);
................................................................................
        this.areIdentical(tryResult2[2].matched[0], "name");
        this.areIdentical(tryResult2[2].matched[1], ":");
        this.areIdentical(tryResult2[2].matched[2], "value");
        foo = <testOutput>tryResult2[2];
        this.isFalse(foo.containsWhitespace);
    }

    allTest1() {
        let testParser = pcomb.all(this.numericParser);
        let tryResult = this.parsers.parse(testParser,"1234Hello!");


        this.isTrue(tryResult[0]);
        this.areIdentical(tryResult[1].text, "Hello!");
        this.areIdentical(tryResult[2].matched.length, 1);
        this.areIdentical(tryResult[2].matched[0], "1234");
    }
}








>







 







>
>







 







<
<
<
<
<
<
<
<
<
<
<







 







|
|
|
<
>







54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
..
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
...
107
108
109
110
111
112
113











114
115
116
117
118
119
120
...
274
275
276
277
278
279
280
281
282
283

284
285
286
287
288
289
290
291
    private eitherNameValuePair: pcomb.Parser;
    private allStoreName: pcomb.Parser;
    private optWsParser: pcomb.Parser;
    private optParser: pcomb.Parser;
    private anyParser1: pcomb.Parser;
    private anyParser2: pcomb.Parser;
    private numericParser: pcomb.Parser;
    private numericSequence: pcomb.Parser;
    private storeNameValue: (matched: string, output: testOutput) => testOutput;
    private recordWhitespace: (matched: string, output: testOutput) => testOutput;
    private dumbGrabber: (matched: string, output: testOutput) => testOutput;

    constructor() {
        super();
    }
................................................................................
        this.eitherNameValuePair = pcomb.or(this.litValue, this.litValueOther);
        this.nameValuePair2 = pcomb.and(this.litName, this.litColon, this.eitherNameValuePair);
        this.optParser = pcomb.and(
            this.litName, this.optWsParser, this.litColon,
            this.optWsParser, this.litValue);
        this.anyParser1 = pcomb.and(this.litName, this.litColon, this.allStoreName);
        this.anyParser2 = pcomb.and(this.litName, this.litColon, pcomb.any(this.litSemicolon), this.litSemicolon);
        this.numericParser = pcomb.numeric();
        this.numericSequence = pcomb.all(this.numericParser);

        // Declare functions that are used in testing in this way to prevent tsUnit from throwing errors
        // related to them.
        this.storeNameValue = function (matched: string, output: testOutput) {
            let newOutput = output.copy();
            newOutput.name = matched;

................................................................................
        this.dumbGrabber = function (matched: string, output: testOutput): testOutput {
            let newOutput = output.copy();
            newOutput.name = matched;

            return newOutput;
        }












    }

    litTest1() {
        let tryResult = this.parsers.parse(this.litName, "name");

        this.isTrue(tryResult[0]);
        this.areIdentical(tryResult[2].matched.length, 1);
................................................................................
        this.areIdentical(tryResult2[2].matched[0], "name");
        this.areIdentical(tryResult2[2].matched[1], ":");
        this.areIdentical(tryResult2[2].matched[2], "value");
        foo = <testOutput>tryResult2[2];
        this.isFalse(foo.containsWhitespace);
    }

    allTest() {
        console.log("OH");
        let tryResult = this.parsers.parse(this.numericSequence, "1234Hello!");

        console.log("HAI");
        this.isTrue(tryResult[0]);
        this.areIdentical(tryResult[1].text, "Hello!");
        this.areIdentical(tryResult[2].matched.length, 1);
        this.areIdentical(tryResult[2].matched[0], "1234");
    }
}