Esempio n. 1
0
 public override Argument CreateArgument(InstructionLine line, ExpressionMediator exm)
 {
     Argument ret = null;
     StringStream st = line.PopArgumentPrimitive();
     List<IOperandTerm> termList = new List<IOperandTerm>();
     LexicalAnalyzer.SkipHalfSpace(st);
     if (st.EOS)
     {
         if (line.FunctionCode == FunctionCode.RETURNFORM)
         {
             termList.Add(new SingleTerm("0"));
             ret = new ExpressionArrayArgument(termList);
             ret.IsConst = true;
             ret.ConstInt = 0;
             return ret;
         }
         warn("引数が設定されていません", line, 2, false);
         return null;
     }
     while (true)
     {
         StrFormWord sfwt = LexicalAnalyzer.AnalyseFormattedString(st, FormStrEndWith.Comma, false);
         IOperandTerm term = ExpressionParser.ToStrFormTerm(sfwt);
         term = term.Restructure(exm);
         termList.Add(term);
         st.ShiftNext();
         if (st.EOS)
             break;
         LexicalAnalyzer.SkipHalfSpace(st);
         if (st.EOS)
         {
             warn("\',\'の後ろに引数がありません。", line, 1, false);
             break;
         }
     }
     return new ExpressionArrayArgument(termList);
 }
Esempio n. 2
0
            public override Argument CreateArgument(InstructionLine line, ExpressionMediator exm)
            {
                IOperandTerm[] terms = popTerms(line);
                if (!checkArgumentType(line, exm, terms))
                    return null;

                List<IOperandTerm> termList = new List<IOperandTerm>();
                termList.AddRange(terms);
                ExpressionArrayArgument ret = new ExpressionArrayArgument(termList);
                if (terms.Length == 0)
                {
                    if (line.FunctionCode == FunctionCode.RETURN)
                    {
                        termList.Add(new SingleTerm(0));
                        ret.IsConst = true;
                        ret.ConstInt = 0;
                        return ret;
                    }
                    warn("引数が設定されていません", line, 2, false);
                    return null;
                }
                else if (terms.Length == 1)
                {

                    SingleTerm s = terms[0] as SingleTerm;
                    if (s != null)
                    {
                        ret.IsConst = true;
                        ret.ConstInt = s.Int;
                        return ret;
                    }
                    else if (line.FunctionCode == FunctionCode.RETURN)
                    {
                        //定数式は定数化してしまうので現行システムでは見つけられない
                        if (terms[0] is VariableTerm)
                            warn("RETURNの引数に変数が渡されています(eramaker:常に0を返します)", line, 0, true);
                        else
                            warn("RETURNの引数に数式が渡されています(eramaker:Emueraとは異なる値を返します)", line, 0, true);
                    }
                }
                else
                {
                    warn(line.Function.Name + "の引数に複数の値が与えられています(eramaker:非対応です)", line, 0, true);
                }
                return ret;
            }
Esempio n. 3
0
            public override Argument CreateArgument(InstructionLine line, ExpressionMediator exm)
            {
                IOperandTerm[] terms = popTerms(line);
                if (!checkArgumentType(line, exm, terms))
                    return null;

                List<IOperandTerm> termList = new List<IOperandTerm>();
                termList.AddRange(terms);
                ExpressionArrayArgument ret = new ExpressionArrayArgument(termList);

                for (int i = 2; i < termList.Count; i++)
                {
                    if (!(termList[i] is SingleTerm))
                        continue;
                    Int64 iValue = termList[i].GetIntValue(null);
                    if (iValue < 0)
                    { warn("キャラ登録番号は正の値でなければなりません", line, 2, false); return null; }
                    if (iValue > Int32.MaxValue)
                    { warn("キャラ登録番号が32bit符号付整数の上限を超えています", line, 2, false); return null; }
                    for (int j = i + 1; j < termList.Count; j++)
                    {
                        if (!(termList[j] is SingleTerm))
                            continue;
                        if (iValue == termList[j].GetIntValue(null))
                        {
                            warn("キャラ登録番号" + iValue.ToString() + "を二度以上保存しようとしています", line, 1, false);
                            return null;
                        }
                    }
                }
                return ret;
            }