Skip to content
Cameron Purdy edited this page Apr 8, 2020 · 5 revisions

In general, the term postfix expression is used to describe a unary operator that immediately follows an expression. Ecstasy has six operators that it combines into the PostfixExpression construct:

a()
a[]
a.
a?
a++
a--

The form a. is further sub-divided into four expressions; here is the expanded list of forms:

Op Expression Description
a() InvocationExpression invoke method or function
a[] ArrayAccessExpression access or update array element
a.name NameExpression identity or member specifier
a.is TypeCheckExpression type test
a.as TypeCheckExpression type assertion
a.new NewExpression virtual child creation
a? NotNullExpression arc if value is null
a++ SequentialExpression post-increment
a-- SequentialExpression post-decrement
    PostfixExpression:
        PrimaryExpression
        PostfixExpression ( Argumentsopt )
        PostfixExpression ArrayIndexes
        PostfixExpression .is ( TypeExpression )
        PostfixExpression .as ( TypeExpression )
        PostfixExpression .new TypeExpression ( Argumentsopt )
        PostfixExpression . &opt Name TypeParameterTypeListopt
        PostfixExpression NoWhitespace ?
        PostfixExpression ++
        PostfixExpression --

    TypeParameterTypeList:
        < TypeExpressionList >

    TypeExpressionList:
        TypeExpressionListElement
        TypeExpressionList , TypeExpressionListElement
    
    TypeExpressionListElement:
        TypeParameterTypeList
        TypeExpression

From InvocationExpression:

    Arguments:
        Argument
        Arguments , Argument

    Argument:
        NamedArgumentopt ArgumentExpression

    ArgumentExpression:
        _
        < TypeExpression > _
        Expression

    NamedArgument:
        Name =

From ArrayAccessExpression:

    ArrayIndexes:
        [ ExpressionList ]
        
    ExpressionList:
        Expression
        ExpressionList , Expression