Beispiel #1
0
 //=====================================================================
 /// <summary>
 /// Writes a macro description.
 /// </summary>
 public void WriteMacro(StreamWriter w, MacroDef m)
 {
     this.WriteThingWithDescription(
         w, m.Name, (m.Parameters.Count == 0) ? null : m.Parameters,
         m.Body, m.Description, false, m.Source,
         null, null, false);
 }
Beispiel #2
0
        //=====================================================================
        /// <summary>
        /// Processes a line which appears to define a macro.
        /// #define identifier ["(" identifierList ")"]
        /// </summary>
        private void ProcessMacro(String line)
        {
            // note: the keyword "#define" has already been parsed
            MacroDef m = new MacroDef(Path.GetFileName(CurrentFileName), LineNumber);
            m.Name = GetNextToken(ref line);
            m.Description = LastComment;
            LastComment = "";

            if (line.StartsWith("("))   // look for macro args
            {
                line = line.Substring(1).Trim();
                if (! ParseArgList(ref line, m))
                    return;
            }

            // get the body of the macro
            m.Body = line.Trim();
            if (m.Body == "\\")
                m.Body = "";
            while (line.EndsWith("\\"))
            {
                if (m.Body != "")
                    m.Body += "<br>";
                line = GetNextLine().Trim();
                m.Body += line;
            }

            SymbolTable.Macros.Add(m);
            this.CurrentSourceFile.Macros.Add(m);
        }