示例#1
0
文件: Parser.cs 项目: 3TUSK/LC-Sharp
        public ParsedFile Parse(params string[] lines)
        {
            var controller = new ParserController();

            // Use index-based loop for deterministic iteration order
            for (var i = 0; i < lines.Length; i++)
            {
                controller.BeginLine();
                if (lines[i].Length > 0)
                {
                    var tokens = lines[i].Split(' ');
                    // Same above
                    for (var j = 0; j < tokens.Length; j++)
                    {
                        controller.Accept(tokens[j]);
                    }
                }
                controller.EndLine();

                if (controller.isTerminated()) // Can happen if there is .END pseudo-instruction
                {
                    break;
                }
            }

            return(controller.Assemble());
        }
示例#2
0
文件: Parser.cs 项目: 3TUSK/LC-Sharp
 public void Process(ParserController controller, params string[] arguments) => _impl(controller, arguments);