Exemple #1
0
 private static RegisterOperand ParseX(OperandLexer lexer)
 {
     if (!lexer.SkipIf(TokenType.Comma))
     {
         return(null);
     }
     else
     {
         return(ParseIndexRegister(lexer));
     }
 }
        /// <summary>
        /// 定数の並びを解釈します。
        /// </summary>
        /// <param name="lexer">オペランドの字句を解析する <see cref="OperandLexer"/> のオブジェクトです。</param>
        /// <returns>
        /// 解釈した結果として生成した <see cref="ConstantCollection"/> オブジェクトを返します。
        /// </returns>
        internal static ConstantCollection Parse(OperandLexer lexer)
        {
            List <Constant> constantList = new List <Constant>();

            for ( ; ;)
            {
                Constant constant = Constant.Parse(lexer);
                constantList.Add(constant);

                if (!lexer.SkipIf(TokenType.Comma))
                {
                    break;
                }
            }

            // 解釈しなかった残りの字句要素は、Instruction.ReadOperand() で取り扱う。
            return(new ConstantCollection(constantList.ToArray()));
        }