Пример #1
0
        /*
         * void ParseDxExpressions(AstDxElement elem)
         * {
         *  while (true)
         *  {
         *      if (_tokenizer.Token == Token.String)
         *      {
         *          if (elem is AstDbElement)
         *          {
         *              foreach (var b in Encoding.UTF8.GetBytes(_tokenizer.TokenString))
         *              {
         *                  elem.AddValue(new ExprNodeLiteral(_tokenizer.TokenPosition, b));
         *              }
         *          }
         *          else
         *          {
         *              foreach (var ch in _tokenizer.TokenString)
         *              {
         *                  elem.AddValue(new ExprNodeLiteral(_tokenizer.TokenPosition, ch));
         *              }
         *          }
         *          _tokenizer.Next();
         *      }
         *      else
         *      {
         *          elem.AddValue(ParseExpression());
         *      }
         *      if (!_tokenizer.TrySkipToken(Token.Comma))
         *          return;
         *  }
         * }
         */

        AstInstruction ParseInstruction(SourcePosition pos, string name)
        {
            var instruction = new AstInstruction(pos, name);

            if (_tokenizer.Token == Token.EOL || _tokenizer.Token == Token.EOF)
            {
                return(instruction);
            }

            while (true)
            {
                instruction.AddOperand(ParseOperandExpression());
                if (!_tokenizer.TrySkipToken(Token.Comma))
                {
                    return(instruction);
                }
            }
        }
Пример #2
0
 public void EnterInstruction(AstInstruction instruction)
 {
     _currentInstructionAddress = ip;
 }