Example #1
0
 public Region(SyntaxContext context, string groupName)
     : base(context, groupName)
 {
     this.m_startPatterns = new List<Pattern>();
     this.m_skipPatterns = new List<Pattern>();
     this.m_endPatterns = new List<Pattern>();
 }
Example #2
0
        public VimMatch(SyntaxContext context, string groupName, Pattern pattern)
            : base(context, groupName)
        {
            ArgumentValidator.ThrowIfNull(pattern, "pattern");
            ArgumentValidator.ThrowIfNullOrEmpty(groupName, "groupName");

            this.m_pattern = pattern;
        }
Example #3
0
        internal Cluster(SyntaxContext context)
        {
            ArgumentValidator.ThrowIfNull(context, "scope");

            this.m_containedGroupsAndClusters = new List<string>();
            this.m_syntaxContext = context;
            this.m_ClusterType = ClusterType.NONMAGIC;
            this.m_directItems = new SetOfSyntaxItems();
            this.m_syntaxDefinition = context.SyntaxDefinition;
        }
Example #4
0
        public Keyword(SyntaxContext context, string groupName, string name, bool ignoreCase)
            : base(context, groupName)
        {
            ArgumentValidator.ThrowIfNullOrEmpty(name, "name");

            // MAY: implement more elegant solution here
            // At this point, we have been added by base() to syntaxDefinition.AllItems and also to TopItems. AllItems is unordered,
            // but TopItems is ordered. Unfortunately we must now change our orderingBoost, which messes up the ordering in TopItems.
            // So we remove ourselves, and then put ourselves back there.
            context.TopItems.Remove(this);
            this.m_orderingBoost = ignoreCase ? 1 : 2;
            this.m_ignoreCase = ignoreCase;
            context.TopItems.Add(this);

            this.SetupKeyword(name);
        }
        private static void DoContext(SyntaxContext context)
        {
            Console.WriteLine("\nContext:  {0}", context.Name);

            foreach (SyntaxItem item in context.AllItems) {
                StringBuilder firstLine = new StringBuilder(32);
                string moreLines = null;

                if (item is Keyword) {
                    firstLine.AppendFormat("{0,3} keyword  {1,-10} {2,-10} {3}", item.LineNumberInSyntaxFile, (item as Keyword).Name, item.GroupName, item.HighlightMode);
                } else if (item is VimMatch) {
                    firstLine.AppendFormat("{0,3} vimMatch {1,-10} {2}", item.LineNumberInSyntaxFile, item.GroupName, item.HighlightMode);
                    moreLines = DumpPattern((item as VimMatch).Pattern, string.Empty);
                } else if (item is Region) {
                    firstLine.AppendFormat("{0,3} region	{1,-10} {2}", item.LineNumberInSyntaxFile, item.GroupName, item.HighlightMode);
                    moreLines = DumpRegionPatterns((Region) item);
                }

                AppendCommonOptions(item, firstLine);

                Console.WriteLine(firstLine.ToString());
                if (moreLines != null) {
                    Console.Write(moreLines);
                }
            }
        }
Example #6
0
 internal Cluster(SyntaxContext context, string myClusterName)
     : this(context)
 {
     this.m_clusterName = myClusterName;
 }
Example #7
0
 public ContainerItem(SyntaxContext context, string groupName)
     : base(context, groupName)
 {
     this.m_contains = new Cluster(context);
     this.m_containedItems = new SetOfSyntaxItems();
 }
Example #8
0
        private void ImportSyntax(Match m, SyntaxContext syntaxContext)
        {
            if (!this.IsProcessingTokens) {
                return;
            }

            string fullScriptPath = this.SourceFile.ScriptFile.Directory.FullName + "\\" + m.Groups["syntaxId"].Value;
            ScriptSourceFile sourceFile = new ScriptSourceFile(new FileInfo(fullScriptPath), syntaxContext);

            this.m_sourceFiles.Add(sourceFile);
            this.ParseFile();
        }
Example #9
0
 internal ScriptSourceFile(FileInfo scriptFile, SyntaxContext syntaxContext)
 {
     this.ScriptFile = scriptFile;
     this.Reader = new StreamReader(scriptFile.OpenRead(), true);
     this.SyntaxContext = syntaxContext;
 }