Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UniUnaryOp: i++, ++i マネージメント #26

Open
khlee12 opened this issue Jul 7, 2016 · 1 comment
Open

UniUnaryOp: i++, ++i マネージメント #26

khlee12 opened this issue Jul 7, 2016 · 1 comment

Comments

@khlee12
Copy link
Contributor

khlee12 commented Jul 7, 2016

++ii++の扱い方法として:

マッパーを生成する時に、ParseRule
preIncrementExpression
preDecrementExpression
unaryExpressionNotPlusMinus
であれば、operatorの前に"_"をつけて、
postIncrementExpression
postDecrementExpression
であれば、operatorの後ろに"_"をつける。

(そうすれば、Generatoroperatorを読む時に、"_"の位置によってプリントする順番を決められる)

タスクとして、"_"のつけるのをUniMapperGeneratorで自動的に生成できるようにしたい。

preIncrementExpression => UniUnaryOp
    :   INC$operator unaryExpression$expr
    ;

preDecrementExpression => UniUnaryOp
    :   DEC$operator unaryExpression$expr
    ;

unaryExpressionNotPlusMinus => UniUnaryOp
    :   postfixExpression$RETURN
    |   TILDE$operator unaryExpression$expr
    |   BANG$operator unaryExpression$expr
    |   castExpression
    ;

postfixExpression => UniUnaryOp
    :   (   primary$RETURN
        |   expressionName$RETURN
        )
        (   postIncrementExpression_lf_postfixExpression
        |   postDecrementExpression_lf_postfixExpression
        )*
    ;

postIncrementExpression => UniUnaryOp
    :   postfixExpression$expr INC$operator
    ;

postDecrementExpression=>UniUnaryOp
    :   postfixExpression$expr DEC$operator
    ;

@exKAZUu
Copy link
Member

exKAZUu commented Jul 14, 2016

UniUnaryOpにフィールドを追加して,順序無関係,前置,後置を表現するようにする.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants