Represents file (logical unit)
Beispiel #1
0
        /// <summary>
        /// Parsing of unit-defs nonterm
        /// </summary>
        private void ParseUsingDefs(ParseTreeNode node, UnitDefinition unitDefinition)
        {
            _currentNode = node;

            foreach (var child in node.ChildNodes)
            {
                switch (child.Term.Name)
                {
                    case SchematraGrammer.term_using_def:
                        ParseUsingDef(child, unitDefinition);
                        break;
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Parsing of def nonterm
        /// </summary>
        private void ParseDef(ParseTreeNode node, UnitDefinition unitDefinition, String space)
        {
            _currentNode = node;

            foreach (var child in node.ChildNodes)
            {
                switch (child.Term.Name)
                {
                    case SchematraGrammer.term_schema_def:
                        ParseSchemaDef(child, unitDefinition, space);
                        break;
                    case SchematraGrammer.term_namespace_def:
                        ParseNamespaceDef(child, unitDefinition, space);
                        break;
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// Parsing of using-def nonterm
        /// </summary>
        private void ParseUsingDef(ParseTreeNode node, UnitDefinition unitDefinition)
        {
            _currentNode = node;

            foreach (var child in node.ChildNodes)
            {
                switch (child.Term.Name)
                {
                    case SchematraGrammer.term_using_def_name:
                        unitDefinition.Usings.Add(child.Token.ValueString);
                        break;
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// Parsing of unit nonterm
        /// </summary>
        private void ParseUnit(ParseTree tree, CompilationDefinition compilation)
        {
            var unitDefinition = new UnitDefinition();

            foreach (var child in tree.Root.ChildNodes)
            {
                switch (child.Term.Name)
                {
                    case SchematraGrammer.term_defs:
                        ParseDefs(child, unitDefinition, "");
                        break;
                    case SchematraGrammer.term_using_defs:
                        ParseUsingDefs(child, unitDefinition);
                        break;
                }
            }

            compilation.Units.Add(unitDefinition);
        }
Beispiel #5
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);
        }
Beispiel #6
0
        /// <summary>
        /// Parsing of namespace-def nonterm
        /// </summary>
        private void ParseNamespaceDef(ParseTreeNode node, UnitDefinition unitDefinition, String space)
        {
            _currentNode = node;

            var namespaceText = String.Empty;

            foreach (var child in node.ChildNodes)
            {
                switch (child.Term.Name)
                {
                    case SchematraGrammer.term_namespace_def_name:
                        namespaceText = child.Token.ValueString;
                        break;
                    case SchematraGrammer.term_defs:
                        ParseDefs(child, unitDefinition, Utils.ConcatNamespaces(space, namespaceText));
                        break;
                }
            }
        }
Beispiel #7
0
        /// <summary>
        /// Parsing of defs nonterm
        /// </summary>
        private void ParseDefs(ParseTreeNode node, UnitDefinition unitDefinition, String space)
        {
            _currentNode = node;

            if (node.Term.Name != SchematraGrammer.term_defs)
                return;

            foreach (var child in node.ChildNodes)
            {
                switch (child.Term.Name)
                {
                    case SchematraGrammer.term_def:
                        ParseDef(child, unitDefinition, space);
                        break;
                }
            }
        }