Esempio n. 1
0
        private void AddLine(string rawLine, int SourceFileLine, List <LineInfo> Lines = null, string Error = null)
        {
            Lines = Lines ?? unit;

            LineInfo        lp;
            List <LineInfo> linesToAdd = new List <LineInfo>();

            lp = new LineInfo(rawLine, SourceFileLine, symbolTable);

            if (!String.IsNullOrWhiteSpace(Error))
            {
                lp.SetError(Error);
            }

            if (lp.Empty)
            {
                return;
            }

            // Expand multivalue meta instructions
            string label   = lp.Label;
            string comment = String.IsNullOrWhiteSpace(lp.Comment) ? String.Empty : ("\t; " + lp.Comment);

            switch (lp.Mnemonic)
            {
            case "TITLE":
                var title = lp.Operand0.RawText;
                if (!(this.title is null))
                {
                    lp.SetError("Title already defined.");
                }
                else if (IsValidTitle(ref title))
                {
                    this.title = title;
                }
                else
                {
                    lp.SetError("Invalid Title");
                }
                lp.Suppress();
                break;