Beispiel #1
0
        private static OnEventStatement readOnEvent(TokenCollection stream)
        {
            OnEventFunctionPrimitive token = stream.GetNextToken() as OnEventFunctionPrimitive;

            if (token == null)
            {
                throw new HspLogicalLineException("on条件分岐行:条件分岐プリミティブ以外からスタート");
            }
            //goto/gosubがないこともあるかもしれない(実行時エラー)
            if (stream.NextIsEndOfLine)
            {
                return(new OnEventStatement(token, null));
            }
            //goto/gosub関数を読む。goto/gosub以外でもコンパイルは通る(実行時エラー)
            //この関数には()がつかない。
            FunctionToken func = CodeTokenFactory.ReadFunction(stream, false);

            if (stream.NextIsEndOfLine)
            {
                return(new OnEventStatement(token, func));
            }
            //まだあまってたらエラーね。
            throw new HspLogicalLineException("on条件分岐行:余分なトークンがある");
        }
Beispiel #2
0
 internal OnEventStatement(OnEventFunctionPrimitive theToken, FunctionToken func)
 {
     this.token = theToken;
     this.func  = func;
 }