Schema definition
Inheritance: TypeDefinition
Ejemplo n.º 1
0
        /// <summary>
        /// Parsing of schema-def-tagged-option nonterm
        /// </summary>
        private void ParseSchemaDefTaggedOption(ParseTreeNode node, RecordDefinition schemadef)
        {
            _currentNode = node;

            foreach (var child in node.ChildNodes)
            {
                switch (child.Term.Name)
                {
                    case SchematraGrammer.term_schema_def_tag:

                        var guidText = child.Token.ValueString;
                        schemadef.Tag = Guid.Parse(guidText);
                        break;
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Parsing of schema-def-options nonterm
        /// </summary>
        private void ParseSchemaDefOptions(ParseTreeNode node, RecordDefinition schemadef)
        {
            _currentNode = node;

            if (node.ChildNodes.Count <= 0)
                return;

            foreach (var child in node.ChildNodes)
            {
                switch (child.Term.Name)
                {
                    case SchematraGrammer.term_schema_def_option:
                        ParseSchemaDefOption(child, schemadef);
                        break;
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Parsing of schema-def-option nonterm
        /// </summary>
        private void ParseSchemaDefOption(ParseTreeNode node, RecordDefinition schemadef)
        {
            _currentNode = node;

            foreach (var child in node.ChildNodes)
            {
                switch (child.Term.Name)
                {
                    case SchematraGrammer.term_schema_def_tagged_option:
                        ParseSchemaDefTaggedOption(child, schemadef);
                        break;
                    case SchematraGrammer.term_schema_def_extends_option:
                        ParseSchemaDefExtendsOption(child, schemadef);
                        break;
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Parsing of schema-def-extends-option nonterm
        /// </summary>
        private void ParseSchemaDefExtendsOption(ParseTreeNode node, RecordDefinition schemadef)
        {
            _currentNode = node;

            foreach (var child in node.ChildNodes)
            {
                switch (child.Term.Name)
                {
                    case SchematraGrammer.term_schema_def_extends:
                        schemadef.Extends = child.Token.ValueString;
                        break;
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Parsing of schema-def-body nonterm
        /// </summary>
        private void ParseSchemaDefBody(ParseTreeNode node, RecordDefinition schemadef)
        {
            _currentNode = node;

            foreach (var child in node.ChildNodes)
            {
                switch (child.Term.Name)
                {
                    case SchematraGrammer.term_field:
                        var fieldDefinition = new FieldDefinition();
                        ParseField(child, fieldDefinition);
                        schemadef.FieldDefinitions.Add(fieldDefinition);
                        break;
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Parsing of schema-def nonterm
        /// </summary>
        private void ParseSchemaDef(ParseTreeNode node, UnitDefinition unitDefinition, String space)
        {
            _currentNode = node;

            var schemadef = new RecordDefinition();

            foreach (var child in node.ChildNodes)
            {
                switch (child.Term.Name)
                {
                    case SchematraGrammer.term_schema_def_name:
                        schemadef.Name = child.Token.Text;
                        schemadef.Namespace = space;
                        break;

                    case SchematraGrammer.term_schema_def_options:
                        ParseSchemaDefOptions(child, schemadef);
                        break;

                    case SchematraGrammer.term_schema_def_body:
                        ParseSchemaDefBody(child, schemadef);
                        break;
                }
            }

            unitDefinition.TypeDefinitions.Add(schemadef);
        }