コード例 #1
0
 public VariableDefinitionExpressionCompiler(HlTypeSystem typeSystem)
 {
     m_TypeSystem = typeSystem;
 }
コード例 #2
0
 public HlCompilerCollection(HlTypeSystem ts)
 {
     m_TypeMap = new Dictionary <Type, IHlExpressionCompiler>
     {
         { typeof(HlMemberAccessOp), new MemberAccessCompiler() },
         { typeof(HlVarDefOperand), new VariableDefinitionExpressionCompiler(ts) },
         { typeof(HlArrayAccessorOp), new ArrayAccessCompiler() },
         { typeof(HlVarOperand), new VarExpressionCompiler() },
         { typeof(HlValueOperand), new ConstExpressionCompiler() },
         { typeof(HlInvocationOp), new InvocationExpressionCompiler() },
         { typeof(HlFuncDefOperand), new FunctionDefinitionCompiler() },
         { typeof(HlIfOp), new IfBlockCompiler() },
         { typeof(HlReturnOp), new ReturnExpressionCompiler() },
         { typeof(HlWhileOp), new WhileExpressionCompiler() },
         { typeof(HlForOp), new ForExpressionCompiler() },
         {
             typeof(HlUnaryOp), new OperatorCompilerCollection <HlUnaryOp
                                                                >(
                 new Dictionary <HlTokenType,
                                 HlExpressionCompiler <HlUnaryOp> >
             {
                 { HlTokenType.OpBang, new BoolNotExpressionCompiler() },
                 { HlTokenType.OpUnaryPostfixIncrement, new PostfixIncrementExpressionCompiler() },
                 { HlTokenType.OpUnaryPostfixDecrement, new PostfixDecrementExpressionCompiler() },
                 { HlTokenType.OpUnaryPrefixIncrement, new PrefixIncrementExpressionCompiler() },
                 { HlTokenType.OpUnaryPrefixDecrement, new PrefixDecrementExpressionCompiler() },
                 { HlTokenType.OpReference, new ReferenceExpressionCompiler() },
                 { HlTokenType.OpDeReference, new DereferenceExpressionCompiler() },
                 { HlTokenType.OpTilde, new BitwiseInvertExpressionCompiler() },
                 { HlTokenType.OpMinus, new UnaryMinusExpressionCompiler() }
             }, new HlUnaryRuntimeOperatorCompiler()
                 )
         },
         {
             typeof(HlBinaryOp), new OperatorCompilerCollection <
                 HlBinaryOp>(
                 new Dictionary <HlTokenType,
                                 HlExpressionCompiler <HlBinaryOp
                                                       > >
             {
                 { HlTokenType.OpEquality, new EqualExpressionCompiler() },
                 { HlTokenType.OpPlus, new AddExpressionCompiler() },
                 {
                     HlTokenType.OpMinus, new
                     SubExpressionCompiler()
                 },
                 {
                     HlTokenType.OpAsterisk, new
                     MulExpressionCompiler()
                 },
                 {
                     HlTokenType.OpComparison, new
                     EqualityExpressionCompiler()
                 },
                 {
                     HlTokenType.OpLogicalOr, new
                     BoolOrExpressionCompiler()
                 },
                 {
                     HlTokenType.OpLogicalAnd, new
                     BoolAndExpressionCompiler()
                 },
                 {
                     HlTokenType.OpPipe, new
                     BitwiseOrExpressionCompiler()
                 },
                 {
                     HlTokenType.OpAnd, new
                     BitwiseAndExpressionCompiler()
                 },
                 {
                     HlTokenType.OpPercent, new
                     ModExpressionCompiler()
                 },
                 {
                     HlTokenType.OpFwdSlash, new
                     DivExpressionCompiler()
                 },
                 {
                     HlTokenType.OpCap, new
                     BitwiseXOrExpressionCompiler()
                 },
                 { HlTokenType.OpLessThan, new LessThanExpressionCompiler() },
                 {
                     HlTokenType.OpGreaterThan, new
                     GreaterThanExpressionCompiler()
                 },
                 {
                     HlTokenType.OpLessOrEqual, new
                     LessEqualExpressionCompiler()
                 },
                 {
                     HlTokenType.OpGreaterOrEqual, new
                     GreaterEqualExpressionCompiler()
                 },
                 {
                     HlTokenType.OpShiftLeft, new
                     BitShiftLeftExpressionCompiler()
                 },
                 {
                     HlTokenType.OpShiftRight, new
                     BitShiftRightExpressionCompiler()
                 },
                 {
                     HlTokenType.OpSumAssign, new
                     AddAssignExpressionCompiler()
                 },
                 {
                     HlTokenType.OpDifAssign, new
                     SubAssignExpressionCompiler()
                 },
                 {
                     HlTokenType.OpProdAssign, new
                     MulAssignExpressionCompiler()
                 },
                 {
                     HlTokenType.OpQuotAssign, new
                     DivAssignExpressionCompiler()
                 },
                 {
                     HlTokenType.OpRemAssign, new
                     ModAssignExpressionCompiler()
                 },
                 {
                     HlTokenType.OpOrAssign, new
                     OrAssignExpressionCompiler()
                 },
                 {
                     HlTokenType.OpAndAssign, new
                     AndAssignExpressionCompiler()
                 },
                 {
                     HlTokenType.OpXOrAssign, new
                     XOrAssignExpressionCompiler()
                 },
                 {
                     HlTokenType.OpShiftLeftAssign, new
                     ShiftLeftAssignExpressionCompiler()
                 },
                 {
                     HlTokenType.OpShiftRightAssign, new
                     ShiftRightAssignExpressionCompiler()
                 }
             }, new HlBinaryRuntimeOperatorCompiler()
                 )
         }
     };
 }