private void ParseSchemaDef(ParseTreeNode node, Context context, string space) { _currentNode = node; var recordBuilder = new RecordTypeBuilder(context.TypeContext); foreach (var child in node.ChildNodes) { switch (child.Term.Name) { case SchematraGrammer.term_schema_def_name: recordBuilder.SetName(child.Token.Text, space); break; case SchematraGrammer.term_schema_def_options: ParseSchemaDefOptions(child, context, recordBuilder); break; case SchematraGrammer.term_schema_def_body: ParseSchemaDefBody(child, context, recordBuilder); break; } } context.TypeContext.AddType(recordBuilder.Create()); }
/// <summary> /// Define Record type /// </summary> public TypeContext DefineRecord(Action<RecordTypeBuilder> builder) { var recordTypeBuilder = new RecordTypeBuilder(this); builder(recordTypeBuilder); AddType(recordTypeBuilder.Create()); return this; }