예제 #1
0
    public void updateInstructionMap(ProcessContext context, ref ProcessedAs[] processMap)
    {
        if (context.instruction() == null)
        {
            return;
        }
        ProcessedAs currentPA = processMap[context.Index];

        if (currentPA == ProcessedAs.CONSTANT)
        {
            return;
        }
        if (currentPA == ProcessedAs.DO_NOTHING)
        {
            if (returnTypes.Count > 0)
            {
                currentPA = processMap[context.Index] = ProcessedAs.QUERY;
            }
            if (command)
            {
                currentPA = processMap[context.Index] = ProcessedAs.COMMAND;
            }
        }
        int lastIndex = context.next(context.Index, false);

        for (int i = 0; i < parameters.Count; i++)
        {
            if (lastIndex >= context.Count)
            {
                //don't re-paint-process the instructions at the beginning
                break;
            }
            if (validParameter(parameters[i], context.instruction(lastIndex)))
            {
                if (parameters[i] == ReturnType.NONE &&
                    context.instruction(lastIndex).command)
                {
                    processMap[lastIndex] = ProcessedAs.COMMAND;
                }
                else
                {
                    processMap[lastIndex] = ProcessedAs.QUERY;
                }
                lastIndex = context.getLastParameterIndex(lastIndex);
            }
            else
            {
                processMap[lastIndex] = ProcessedAs.CONSTANT;
            }
            lastIndex = context.next(lastIndex, false);
        }
    }
예제 #2
0
    public int getLastParameterIndex(ProcessContext context)
    {
        int lastIndex = context.next();

        for (int i = 0; i < parameters.Count; i++)
        {
            if (validParameter(parameters[i], context.instruction(lastIndex)))
            {
                lastIndex = context.getLastParameterIndex(lastIndex);
            }
            lastIndex = context.next(lastIndex);
        }
        lastIndex = context.prev(lastIndex);
        return(lastIndex);
    }
예제 #3
0
    public int[] getParameterIndices(ProcessContext context)
    {
        int[] paramIndices = new int[parameters.Count];
        int   paramIndex   = context.next();

        for (int i = 0; i < parameters.Count; i++)
        {
            paramIndices[i] = paramIndex;
            if (validParameter(parameters[i], context.instruction(paramIndex)))
            {
                paramIndex = context.getLastParameterIndex(paramIndex);
            }
            paramIndex = context.next(paramIndex);
        }
        return(paramIndices);
    }