Exemplo n.º 1
0
 internal McallStatement(McallFunctionPrimitive theToken, VariablePrimitive var, ExpressionToken exp, ArgumentToken arg)
 {
     this.token = theToken;
     this.var   = var;
     this.exp   = exp;
     this.arg   = arg;
 }
Exemplo n.º 2
0
        private static LogicalLine readMcall(TokenCollection stream)
        {
            int start = stream.Position;
            McallFunctionPrimitive mcall = stream.GetNextToken() as McallFunctionPrimitive;

            if (mcall == null)
            {
                throw new HspLogicalLineException("mcall:mcallプリミティブ以外からスタート");
            }
            if (stream.NextIsEndOfLine)
            {
                stream.Position = start;
                return((LogicalLine)readCommand(stream));
            }
            ExpressionToken exp = CodeTokenFactory.ReadExpression(stream);

            if (exp.CanRpnConvert)            //RPN変換ができるなら普通の関数として扱う。
            {
                stream.Position = start;
                return((LogicalLine)readCommand(stream));
            }

            stream.Position = start;
            stream.GetNextToken();
            VariablePrimitive var = stream.GetNextToken() as VariablePrimitive;

            if (var == null)
            {
                throw new HspLogicalLineException("mcall行:変換不能な形式");
            }
            if (stream.NextIsBracketStart)            //mcall の記法は配列変数を認めない
            {
                throw new HspLogicalLineException("mcall行:変換不能な形式");
            }
            if (stream.NextIsEndOfLine)
            {
                throw new HspLogicalLineException("mcall行:変換不能な形式");
            }
            exp = CodeTokenFactory.ReadExpression(stream);
            if (stream.NextIsEndOfLine)
            {
                return(new McallStatement(mcall, var, exp, null));
            }
            ArgumentToken arg = CodeTokenFactory.ReadArgument(stream);

            if (stream.NextIsEndOfLine)
            {
                return(new McallStatement(mcall, var, exp, arg));
            }
            throw new HspLogicalLineException("mcall行:余分なトークンがある");
        }
Exemplo n.º 3
0
            internal static VariableToken ReadVariable(TokenCollection stream)
            {
                if (stream.NextIsEndOfStream)
                {
                    throw new HspLogicalLineException("変数:読み込み中にスタックが空になった");
                }
                //変数プリティブ読み込み
                VariablePrimitive token = stream.GetNextToken() as VariablePrimitive;

                if (token == null)
                {
                    throw new HspLogicalLineException("変数:変数プリミティブ以外からスタート");
                }

                //次が括弧ならば配列変数
                if (stream.NextIsBracketStart)
                {
                    return(new VariableToken(token, ReadArgument(stream)));
                }
                //そうでなければ普通の変数
                return(new VariableToken(token));
                //if (parser.NextIsEndOfLine)
                //    return VariableToken(token);
            }
Exemplo n.º 4
0
 internal VariableToken(VariablePrimitive var, ArgumentToken theArg)
 {
     primitive = var;
     arg       = theArg;
 }
Exemplo n.º 5
0
 internal VariableToken(VariablePrimitive var)
 {
     primitive = var;
     arg       = null;
 }