Наследование: ProjectNodeBase
Пример #1
0
        public Project(ProjectNode root)
        {
            m_Random = root.Serializer.Random;
            m_Rules = new RuleCollection(m_Random);

            foreach (IProjectNode node in root.Children)
            {
                switch (node.NodeType)
                {
                    case ProjectNodeType.TokenSetDeclaration:
                        this.TokenSets.Add(new TokenSet(node, m_Random));
                        break;
                    case ProjectNodeType.RuleDeclaration:
                        this.Rules.Add(new Rule(node as RuleNode));
                        break;
                    case ProjectNodeType.StartingRuleDeclaration:
                        StartingRuleNode srn = node as StartingRuleNode;
                        this.StartRules.Add(srn.Name, srn.Amount);
                        break;
                    case ProjectNodeType.ColumnDeclaration:
                        ColumnNode cn = node as ColumnNode;
                        this.Columns.Add(cn.Title, cn.Expression);
                        break;
                    default:
                        break;
                }
            }

            foreach (Rule r in this.Rules)
            {
                foreach (Whee.WordBuilder.Model.Commands.CommandBase c in r.Commands)
                {
                    c.CheckSanity(this, root.Serializer);
                }
            }
        }
Пример #2
0
 public void DoHighlighting(ProjectNode project)
 {
     m_textView.Buffer.RemoveAllTags(m_textView.Buffer.StartIter, m_textView.Buffer.EndIter);
     foreach (Token tok in project.Serializer.Tokens)
     {
         TextIter start = m_textView.Buffer.GetIterAtOffset(tok.Offset);
         TextIter end = m_textView.Buffer.GetIterAtOffset(tok.Offset + tok.Length);
         m_textView.Buffer.ApplyTag(tok.Type.ToString(), start, end);
     }
 }