Ejemplo n.º 1
0
 //=====================================================================
 /// <summary>
 /// Writes a template description.
 /// </summary>
 public void WriteTemplate(StreamWriter w, TemplateDef t)
 {
     this.WriteThingWithDescription(
         w, t.Name, null, t.Body, t.Description,
         false, t.Source, null, null, false);
 }
Ejemplo n.º 2
0
        //=====================================================================
        /// <summary>
        /// Processes a line which appears to define a template.
        /// identifier "template" body
        /// </summary>
        /// <param name="name">the name of the template (already parsed)</param>
        private void ProcessTemplate(String name, String line)
        {
            // note: the template name and keyword "template" have already been parsed
            TemplateDef t = new TemplateDef(
                Path.GetFileName(CurrentFileName), LineNumber);
            t.Name = name;
            t.Description = LastComment;
            LastComment = "";

            // start the token body with the current (trimmed) line
            line = line.Trim();
            String tBody = line.Trim();

            // scan tokens until we find a semicolon
            for (;;)
            {
                // if necessary, read a new line
                if (line == "")
                {
                    line = GetNextLine().Trim();
                    tBody += " " + line;
                }

                // get the next token
                if (GetNextToken(ref line) == ";")
                    break;
            }

            // set the template body
            t.Body = tBody;

            // add the template to the tables
            this.SymbolTable.Templates.Add(t);
            this.CurrentSourceFile.Templates.Add(t);
        }