pp_c.ssl

来自「开放源码的编译器open watcom 1.6.0版的源代码」· SSL 代码 · 共 1,263 行 · 第 1/2 页

SSL
1,263
字号

    logical_and:
	@inclusive_or
	{
	    [
	      | ET_AND_AND:
		[SkipCount
		  | 0:
		    [DoTstTrue( 1 )
		      | false:
			@skip_ands
			>
		      | *:
			PopEntry
		    ]
		  | *:
		]
		@inclusive_or
		[SkipCount
		  | 0:
		    DoTstTrue( 1 )	% make result either true or false
		  | *:
		]
	      | *:
		>
	    ]
	}
    ;


    skip_ands:
	SkipCountAdd( 1 )
	{
	    @inclusive_or
	    [
	      | ET_AND_AND:
	      | *:
		>
	    ]
	}
	SkipCountAdd( -1 )
    ;



    inclusive_or:
	@exclusive_or
	{
	    [
	      | ET_OR:
		@exclusive_or
		[SkipCount
		  | 0:
		    DoOr
		  | *:
		]
	      | *:
		>>
	    ]
	}
    ;


    exclusive_or:
	@and
	{
	    [
	      | ET_XOR:
		@and
		[SkipCount
		  | 0:
		    DoXor
		  | *:
		]
	      | *:
		>>
	    ]
	}
    ;


    and:
	@equality
	{
	    [
	      | ET_AND:
		@equality
		[SkipCount
		  | 0:
		    DoAnd
		  | *:
		]
	      | *:
		>>
	    ]
	}
    ;



    equality:
	@relational
	{
	    [
	      | ET_EQ:
		@relational
		[SkipCount
		  | 0:
		    DoTstEQ(1)
		  | *:
		]
	      | ET_NE:
		@relational
		[SkipCount
		  | 0:
		    DoTstEQ(1)
		    PushInt( 1 )
		    DoXor
		  | *:
		]
	      | *:
		>>
	    ]
	}
    ;


    relational:
	@shift
	{
	    [
	      | ET_LE:
		@shift
		[SkipCount
		  | 0:
		    StackSwap( 1 )
		    DoTstLT( 1 )
		    PushInt( 1 )
		    DoXor
		  | *:
		]
	      | ET_GE:
		@shift
		[SkipCount
		  | 0:
		    DoTstLT( 1 )
		    PushInt( 1 )
		    DoXor
		  | *:
		]
	      | ET_LT:
		@shift
		[SkipCount
		  | 0:
		    DoTstLT( 1 )
		  | *:
		]
	      | ET_GT:
		@shift
		[SkipCount
		  | 0:
		    StackSwap( 1 )
		    DoTstLT( 1 )
		  | *:
		]
	      | *:
		>>
	    ]
	}
    ;



    shift:
	@additive
	{
	    [
	      | ET_LSHIFT:
		@additive
		[SkipCount
		  | 0:
		    DoShift
		  | *:
		]
	      | ET_RSHIFT:
		@additive
		[SkipCount
		  | 0:
		    @negate
		    DoShift
		  | *:
		]
	      | *:
		>>
	    ]
	}
    ;



    additive:
	@multiplicative
	{
	    [
	      | ET_PLUS:
		@multiplicative
		[SkipCount
		  | 0:
		    @perform_add
		  | *:
		]
	      | ET_MINUS:
		@multiplicative
		[SkipCount
		  | 0:
		    @perform_minus
		  | *:
		]
	      | *:
		>>
	    ]
	}
    ;



    multiplicative:
	@cast
	{
	    [
	      | ET_MUL:
		@cast
		[SkipCount
		  | 0:
		    DoMul
		  | *:
		]
	      | ET_DIV:
		@cast
		[SkipCount
		  | 0:
		    DoDiv
		  | *:
		]
	      | ET_MOD:
		@cast
		[SkipCount
		  | 0:
		    DoMod
		  | *:
		]
	      | *:
		>>
	    ]
	}
    ;




    unary:
	[
	  | ET_PLUS_PLUS:
	    @unary
	    SwitchOn( sw_side_effect )
	    [SkipCount
	      | 0:
		PushDup
		PushInt( 1 )
		@perform_add
		DoAssign
	      | *:
	    ]
	  | ET_MINUS_MINUS:
	    @unary
	    SwitchOn( sw_side_effect )
	    [SkipCount
	      | 0:
		PushDup
		PushInt( -1 )
		@perform_add
		DoAssign
	      | *:
	    ]
	  | ET_AND:
	    @cast
	    [SkipCount
	      | 0:
		DoAddr
	      | *:
	    ]
	  | ET_MUL:
	    @cast
	    [SkipCount
	      | 0:
	        @do_points_unsigned
	      | *:
	    ]
	  | ET_MOD:
	    @cast
	    [SkipCount
	      | 0:
	        @do_points_addr
	      | *:
	    ]
	  | ET_PLUS:
	    @cast
	  | ET_MINUS:
	    @cast
	    [SkipCount
	      | 0:
		@negate
	      | *:
	    ]
	  | ET_NOT:
!ifdef CPP
	    GetInit
	    [GetDtorName
	      | false:
!endif
		@cast
		[SkipCount
		  | 0:
		    PushInt( -1 )
		    DoXor
		  | *:
		]
!ifdef CPP
	      | *:
	        [SkipCount
		  | 0:
		    GetFini
		  | *:
		]
	    ]
!endif
	  | ET_EXCLAMATION:
	    @cast
	    [SkipCount
	      | 0:
		PushInt( 0 )
		DoTstEQ(1)
	      | *:
	    ]
	  | ET_SIZEOF:
	    [
	      | ET_LEFT_PAREN:
		[@parsetypename
		  | false:
		    @nest_callexpr
		  | *:
		    [SkipCount
		      | 0:
		      | *:
			PopEntry
		    ]
		]
		@req_right_paren
	      | *:
		@unary
	    ]
	    [SkipCount
	      | 0:
		StackLValue( 0 )
		DoSizeType
	      | *:
	    ]
	  | *:
	    @postfix
	]
    ;



    postfix:
	@segmented
	{
	    ScanSave
	    [
	      | ET_LEFT_BRACKET:
		[SkipCount
		  | 0:
		    StartSubscript
		  | *:
		]
		@nest_callexpr
		[SkipCount
		  | 0:
		    AddSubscriptIndex
		  | *:
		]
		ET_RIGHT_BRACKET
		[SkipCount
		  | 0:
		    EndSubscript
		  | *:
		]
	      | ET_LEFT_PAREN:
		[ExprIsCall
		  | true:
		    ScanRestore	% unget '(' token
		    >>
		  | *:
		]
		NextNestedCall
		NumSet( 0 )
		[
		  | ET_RIGHT_PAREN:
		    % endchoice
		  | *:
		    {
			NumPush
			@nest_callexpr
			[SkipCount
			  | 0:
			    StackValue(0)
			    StackSwap( 1 )
			  | *:
			]
			NumPop
			NumAdd( 1 )
			[
			  | ET_COMMA:
			    % null statement
			  | ET_RIGHT_PAREN:
			    >
			  | *:
			    ET_RIGHT_PAREN % cause error
			]
		    }
		]
		SwitchOn( sw_side_effect )
		[SkipCount
		  | 0:
		    DoCall( false )
		  | *:
		]
	      | ET_DOT:
		@field_name
	      | ET_RIGHT_ARROW:
		[SkipCount
		  | 0:
		    @do_points_unsigned
		  | *:
		]
		@field_name
	      | ET_PLUS_PLUS:
	        SwitchOn( sw_side_effect )
		[SkipCount
		  | 0:
		    PushDup
		    StackRValue( 0 )
		    StackSwap( 1 )
		    PushDup
		    PushInt( 1 )
		    @perform_add
		    DoAssign
		    PopEntry
		  | *:
		]
	      | ET_MINUS_MINUS:
	        SwitchOn( sw_side_effect )
		[SkipCount
		  | 0:
		    PushDup
		    StackRValue( 0 )
		    StackSwap( 1 )
		    PushDup
		    PushInt( -1 )
		    @perform_add
		    DoAssign
		    PopEntry
		  | *:
		]
	      | *:
		ScanPop
		>>
	    ]
	    ScanPop
	}
    ;

    field_name:
        [@push_name
	| false:
	    #err_loc_and_want_name
	| *:
	]
	[SkipCount
	| 0:
!ifdef JAVA
	  [StackSymKind(1)
	  | SK_NAMESPACE:
	    DoScope( false )
	  | *:
	    DoField
	  ]
!else
	  DoField
!endif
	| *:
	  PopEntry
	]
    ;

    segmented:
	[
	  | ET_DOT:
	    [SkipCount
	      | 0:
		PushDot
	      | *:
	    ]
	  | ET_VAR_EXIST:
	    @primary
	    [SkipCount
	      | 0:
		DoTstExist(1)
	      | *:
	    ]
	  | *:
	    @primary
!ifndef JAVA
	    [
	      | ET_COLON:
		@primary
		[SkipCount
		  | 0:
		    DoMakeAddr
		  | *:
		]
	      | *:
	    ]
!endif
	]
    ;

!ifdef CPP
    push_cpp_name:
      @push_token
      [StackForm(0)
      | SF_NAME:
      | *:
        #err_loc_and_want_name
      ]
    ;
    
    handle_scoping:
      {
        [
	| ET_SCOPE:
	  @push_cpp_name
	  DoScope( false )
	| *:
	  >
	]
      }
    ;
!endif

    primary:
	[
	  | ET_LEFT_PAREN:
	    [@parsetypename
	      | false:
		@nest_expr
		@req_right_paren
		[SkipCount
		| 0:
		| *:
		   PushInt( 0 )	% popped later
		]  
	      | *:
		@req_right_paren
		@cast
		[SkipCount
		  | 0:
		    DoConvert
		  | *:
		]
	    ]
	  | ET_LEFT_BRACKET:
	    [PushRegSet
	      | false:
		[@parsetypename
		  | false:
		    #err_loc_and_want_reg_name
		  | *:
		    ET_RIGHT_BRACKET
		    @cast
		    [SkipCount
		      | 0:
			DoLConvert
		      | *:
		    ]
		]
	      | *:
		ET_RIGHT_BRACKET
	    ]
!ifdef CPP
	  | ET_TRUE:
	    PushInt( 1 )
	  | ET_FALSE:
	    PushInt( 0 )
	  | ET_SCOPE:
	    @push_cpp_name
	    DoScope( true )
	    @handle_scoping
!endif
	  | *:
	    @push_token
!ifdef CPP
	    [StackForm(0)
	    | SF_NAME:
	      @handle_scoping
	    | *:
	    ]
!endif
	]
	@skip_pop
    ;


% bypass unimplemented levels
    conditional:
	@logical_or
    ;
    cast:
	@unary
    ;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?