Beispiel #1
0
        public void Ose_LineArgs()
        {
            var line = new OllyScript.Line();

            OllyScript.ParseArgumentsIntoLine(" hello,world", line);
            Assert.AreEqual(2, line.args.Length);
        }
Beispiel #2
0
        private OllyScript.Line Line()
        {
            var tok = GetToken();

            if (tok.Type == TokenType.EOF)
            {
                return(null);
            }
            if (tok.Type == TokenType.Directive)
            {
                Directive(tok);
            }
            // Eat the label.
            if (tok.Type == TokenType.Id)
            {
                if (PeekAndDiscard(TokenType.Colon))
                {
                    script.Labels[(string)tok.Value] = tok.LineNumber;
                    tok = GetToken();
                }
            }

            var line = new OllyScript.Line {
                LineNumber = tok.LineNumber
            };

            if (tok.Type == TokenType.Id)
            {
                line.Command   = (string)tok.Value;
                line.IsCommand = true;
                line.Args      = ExpressionList();
                tok            = GetToken();
            }
            if (tok.Type != TokenType.EOF && tok.Type != TokenType.Newline)
            {
                host.MsgError($"Unexpected token on line {tok.LineNumber + 1}.");
                do
                {
                    tok = GetToken();
                } while (tok.Type != TokenType.Newline && tok.Type != TokenType.EOF);
            }
            return(line);
        }
Beispiel #3
0
 public void Ose_LineArgs()
 {
     var line = new OllyScript.Line();
     OllyScript.ParseArgumentsIntoLine( " hello,world", line);
     Assert.AreEqual(2, line.args.Length);
 }