genObjCol function

Map<String, Parser> genObjCol()

Helper function to generate inter-dependent parsers.

Examples: 15 collection and 12 object

Implementation

Map<String, Parser> genObjCol() {
  Map<String, Parser> rtn = {};
  final collection = undefined();
  final object = undefined();
  final objectList = undefined();
  final predicateObjectList = undefined();
  final blankNodePropertyList = undefined();
  // [15] 	collection 	::= 	'(' object* ')'
  collection.set(string('(') & object.trim().star() & string(')'));
  // [12] 	object 	::= 	iri | BlankNode | collection | blankNodePropertyList | literal
  object.set(iri | BlankNode | collection | blankNodePropertyList | literal);
  // [7] 	predicateObjectList 	::= 	verb objectList (';' (verb objectList)?)*
  predicateObjectList.set(verb &
      objectList.trim() &
      (string(';').trim() &
              (verb.trim() & objectList.trim()).repeat(0, 1).trim())
          .star()
          .trim());
  // [8] 	objectList 	::= 	object (',' object)*
  objectList.set(object & (string(',').trim() & object).star().trim());
  // [14] 	blankNodePropertyList 	::= 	'[' predicateObjectList ']'
  blankNodePropertyList
      .set(string('[') & predicateObjectList.trim() & string(']'));
  rtn['object'] = object;
  rtn['collection'] = collection;
  rtn['objectList'] = objectList;
  rtn['predicateObjectList'] = predicateObjectList;
  rtn['blankNodePropertyList'] = blankNodePropertyList;
  return rtn;
}