コード例 #1
0
        /// <summary>
        /// Parses the code from the Code property and files syntax errors if any.
        /// </summary>
        protected void Parse()
        {
            // The parser expects each instruction to end with '\n'.
            if (!Code.EndsWith("\n"))
            {
                Code += "\n";
            }

            Analyzer a = new Analyzer(this);
            Parser   p = new PicoParser(new StringReader(Code), a);

            try
            {
                Node n = p.Parse();
            }
            catch (ParserLogException ex)
            {
                for (int i = 0; i < ex.Count; i++)
                {
                    ParseException e   = ex[i];
                    Error          err = new Error();
                    err.ID          = 0;
                    err.Description = string.Format(Messages.E0000, e.ErrorMessage);
                    err.Line        = e.Line;
                    err.Column      = e.Column;
                    Errors.Add(err);
                }
            }
        }
コード例 #2
0
ファイル: Assembler.cs プロジェクト: lazanet/messylab
        /// <summary>
        /// Parses the code from the Code property and files syntax errors if any.
        /// </summary>
        protected void Parse()
        {
            // The parser expects each instruction to end with '\n'.
            if (!Code.EndsWith("\n")) Code += "\n";

            Analyzer a = new Analyzer(this);
            Parser p = new PicoParser(new StringReader(Code), a);
            try
            {
                Node n = p.Parse();
            }
            catch (ParserLogException ex)
            {
                for (int i = 0; i < ex.Count; i++)
                {
                    ParseException e = ex[i];
                    Error err = new Error();
                    err.ID = 0;
                    err.Description = string.Format(Messages.E0000, e.ErrorMessage);
                    err.Line = e.Line;
                    err.Column = e.Column;
                    Errors.Add(err);
                }
            }
        }