示例#1
0
 return function root (token, type, next) {
     if (type === 'begin-array') {
         that.emit('type', 'array');
         next(
             //that.beginArray(),
             Parser.expect('begin-array'),
             Parser.list(
                 'comma',                    // array
                 this.value(function () {}), // values
                 'end-array'                 // token ending the list
             ),
             Parser.expect('end-array')
             //that.endArray()
         );
     }
     else if (type === 'begin-object') {
         that.emit('type', 'object');
         next(
             that.beginObject(o),
             Parser.list(
                 'comma',                      // separator
                 this.labeledValue(objectSet), // values
                 'end-object'                  // token ending the list
             ),
             that.endObject(o)
         );
     }
     return true; //expand this
 }
示例#2
0
 return function object (token, type, next) {
     next(
         that.beginObject(o),
         Parser.list(
             'comma',                        // separator
             this.labeledValue(objectSet),   // values
             'end-object'                    // token ending the list
         ),
         that.endObject(o)
     )
     return true;
 }
示例#3
0
 return function array (token, type, next) {
     next(
         that.beginArray(a),
         Parser.list(
             'comma',                // array
             this.value(arraySet),   // values
             'end-array'             // token ending the list
         ),
         that.endArray(a)
     );
     return true; //expand this
 }