Example #1
0
		public static void FindNextMacro(string text, int startOffset, 
			out int macroStart, 
			out int length, 
			out string macroName, 
			out Dictionary<string,string> macroParameters)
		{
			macroStart = text.IndexOf ("$(", startOffset);
			macroParameters = null;

			if (macroStart < 0) {
				macroName = null;
				length = 0;
				return;
			}

			var ddoc = new DDocParser { text = text, nextOffset = macroStart+2 };

			macroName = ddoc.MacroName ();

			if (!ddoc.Finished)
				macroParameters = ddoc.Parameters ();

			ddoc.Step ();

			length = Math.Min(ddoc.nextOffset,text.Length) - macroStart;
		}
Example #2
0
        public static void FindNextMacro(string text, int startOffset,
                                         out int macroStart,
                                         out int length,
                                         out string macroName,
                                         out Dictionary <string, string> macroParameters)
        {
            macroStart      = text.IndexOf("$(", startOffset);
            macroParameters = null;

            if (macroStart < 0)
            {
                macroName = null;
                length    = 0;
                return;
            }

            var ddoc = new DDocParser {
                text = text, nextOffset = macroStart + 2
            };

            macroName = ddoc.MacroName();

            if (!ddoc.Finished)
            {
                macroParameters = ddoc.Parameters();
            }

            ddoc.Step();

            length = Math.Min(ddoc.nextOffset, text.Length) - macroStart;
        }