Inheritance: DataItem
コード例 #1
0
 private static TreeNode CreateNodeForMapping(Mapping mapping)
 {
     TreeNode node = new TreeNode("Mapping");
     foreach (MappingEntry entry in mapping.Enties)
     {
         TreeNode nodeEntry = new TreeNode("Entry");
         nodeEntry.Nodes.Add(CreateNode(entry.Key));
         nodeEntry.Nodes.Add(CreateNode(entry.Value));
         node.Nodes.Add(nodeEntry);
     }
     return node;
 }
コード例 #2
0
        public static Dictionary<String, Int32> convertToDictionary( Mapping m, KeyCase forceKeyCase )
        {
            Dictionary<String, Int32> dic = new Dictionary<string, Int32>();
            foreach ( MappingEntry me in m.Enties )
            {
                String key = me.Key.ToString();
                Int32 value = Convert.ToInt32( Double.Parse( me.Value.ToString() ) );
                KeyValuePair<String, Int32> kvp = makeKvp( key, value, forceKeyCase );
                dic.Add( kvp.Key, kvp.Value );
            }

            return dic;
        }
コード例 #3
0
        private Mapping ParseBlockMapping(out bool success)
        {
            int errorCount = Errors.Count;
            Mapping mapping = new Mapping();

            while (true)
            {
                int seq_start_position1 = position;
                MappingEntry mappingEntry = ParseBlockMappingEntry(out success);
                if (success) { mapping.Enties.Add(mappingEntry); }
                else
                {
                    Error("Failed to parse BlockMappingEntry of BlockMapping.");
                    break;
                }

                while (true)
                {
                    while (true)
                    {
                        int seq_start_position2 = position;
                        ParseIndent(out success);
                        if (!success)
                        {
                            Error("Failed to parse Indent of BlockMapping.");
                            break;
                        }

                        mappingEntry = ParseBlockMappingEntry(out success);
                        if (success) { mapping.Enties.Add(mappingEntry); }
                        else
                        {
                            Error("Failed to parse BlockMappingEntry of BlockMapping.");
                            position = seq_start_position2;
                        }
                        break;
                    }
                    if (!success) { break; }
                }
                success = true;
                break;
            }
            if (success) { ClearError(errorCount); }
            else { Error("Failed to parse Enties of BlockMapping."); }
            return mapping;
        }
コード例 #4
0
        private Mapping ParseFlowMapping(out bool success)
        {
            int errorCount = Errors.Count;
            Mapping mapping = new Mapping();
            int start_position = position;

            MatchTerminal('{', out success);
            if (!success)
            {
                Error("Failed to parse '{' of FlowMapping.");
                position = start_position;
                return mapping;
            }

            ParseSeparationLinesInFlow(out success);
            success = true;

            while (true)
            {
                int seq_start_position1 = position;
                MappingEntry mappingEntry = ParseFlowMappingEntry(out success);
                if (success) { mapping.Enties.Add(mappingEntry); }
                else
                {
                    Error("Failed to parse FlowMappingEntry of FlowMapping.");
                    break;
                }

                while (true)
                {
                    while (true)
                    {
                        int seq_start_position2 = position;
                        MatchTerminal(',', out success);
                        if (!success)
                        {
                            Error("Failed to parse ',' of FlowMapping.");
                            break;
                        }

                        ParseSeparationLinesInFlow(out success);
                        success = true;

                        mappingEntry = ParseFlowMappingEntry(out success);
                        if (success) { mapping.Enties.Add(mappingEntry); }
                        else
                        {
                            Error("Failed to parse FlowMappingEntry of FlowMapping.");
                            position = seq_start_position2;
                        }
                        break;
                    }
                    if (!success) { break; }
                }
                success = true;
                break;
            }
            if (!success)
            {
                Error("Failed to parse Enties of FlowMapping.");
                position = start_position;
                return mapping;
            }

            MatchTerminal('}', out success);
            if (!success)
            {
                Error("Failed to parse '}' of FlowMapping.");
                position = start_position;
            }

            if (success) { ClearError(errorCount); }
            return mapping;
        }