Skip to content

Conversation

@smitgajjar
Copy link
Contributor

@smitgajjar smitgajjar commented Apr 17, 2020

References to other Issues or PRs

Brief description of what is fixed or changed

  • Added support for unary operators: unary plus(+), unary minus(-), pre/post increment(++), pre/post decrement(--) and logical NOT(!)
  • Added support for parenthesized expression
  • Added corresponding tests

Other comments

  • Dereferencing operator(*), Address operator(&) and bitwise NOT(~) are the unary operators that have not been implemented because of unavailability of such nodes or classes in SymPy
  • If unary operators are the children of binary operator in AST, it is not possible to parse yet!

Release Notes

  • parsing
    • added support for unary operators: unary plus(+), unary minus(-), pre/post increment(++), pre/post decrement(--) and logical NOT(!) in C parser
    • added support for parenthesized expression in C parser

@sympy-bot
Copy link

sympy-bot commented Apr 17, 2020

Hi, I am the SymPy bot (v158). I'm here to help you write a release notes entry. Please read the guide on how to write release notes.

Your release notes are in good order.

Here is what the release notes will look like:

  • parsing
    • added support for unary operators: unary plus(+), unary minus(-), pre/post increment(++), pre/post decrement(--) and logical NOT(!) in C parser (#19140 by @smitgajjar)

    • added support for parenthesized expression in C parser (#19140 by @smitgajjar)

This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.6.

Note: This comment will be updated with the latest check if you edit the pull request. You need to reload the page to see it.

Click here to see the pull request description that was parsed.

<!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->

#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more information). Also, please
write a comment on that issue linking back to this pull request once it is
open. -->

#### Brief description of what is fixed or changed
- Added support for unary operators: unary plus(`+`), unary minus(`-`), pre/post increment(`++`), pre/post decrement(`--`) and logical NOT(`!`)
- Added support for parenthesized expression
- Added corresponding tests

#### Other comments
- Dereferencing operator(`*`), Address operator(`&`) and bitwise NOT(`~`) are the unary operators that have not been implemented because of unavailability of such nodes or classes in SymPy
- If unary operators are the children of binary operator in AST, it is not possible to parse yet!

#### Release Notes

<!-- Write the release notes for this release below. See
https://github.com/sympy/sympy/wiki/Writing-Release-Notes for more information
on how to write release notes. The bot will check your release notes
automatically to see if they are formatted correctly. -->

<!-- BEGIN RELEASE NOTES -->
- parsing
    - added support for unary operators: unary plus(`+`), unary minus(`-`), pre/post increment(`++`), pre/post decrement(`--`) and logical NOT(`!`) in C parser
    - added support for parenthesized expression in C parser
<!-- END RELEASE NOTES -->

Update

The release notes on the wiki have been updated.

@codecov
Copy link

codecov bot commented Apr 17, 2020

Codecov Report

Merging #19140 into master will decrease coverage by 0.056%.
The diff coverage is 0.000%.

@@              Coverage Diff              @@
##            master    #19140       +/-   ##
=============================================
- Coverage   75.709%   75.652%   -0.057%     
=============================================
  Files          650       651        +1     
  Lines       169166    169384      +218     
  Branches     39909     39985       +76     
=============================================
+ Hits        128075    128144       +69     
- Misses       35494     35632      +138     
- Partials      5597      5608       +11     

@smitgajjar
Copy link
Contributor Author

Please review @Sc0rpi0n101 @certik

Copy link
Member

@Sc0rpi0n101 Sc0rpi0n101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.
Is there anything else left to be done here?

@smitgajjar
Copy link
Contributor Author

No. It is better to merge now, though I wanted to parse unary operators which are children of binary operators. But, using operator precedence parsing, it seems difficult to achieve.

Copy link
Member

@certik certik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok to me.

@Sc0rpi0n101
Copy link
Member

Also, can you add some tests for errorneous behaviour to see if the errors are raised correctly.

@smitgajjar
Copy link
Contributor Author

Sure! working on it now... :)

@smitgajjar
Copy link
Contributor Author

smitgajjar commented Apr 25, 2020

Should I write tests for binary operators and var decl also in this PR? I didn't write those for raising exceptions in earlier PR

@Sc0rpi0n101
Copy link
Member

Should I write tests for binary operators and var decl also in this PR? I didn't write those for raising exceptions in earlier PR

Yeah, sure. It'd be great if you can do that.

@smitgajjar smitgajjar requested a review from Sc0rpi0n101 April 26, 2020 10:43
@smitgajjar
Copy link
Contributor Author

ping

Copy link
Member

@Sc0rpi0n101 Sc0rpi0n101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Can you squash your commits now?

@smitgajjar
Copy link
Contributor Author

Sure!

@smitgajjar smitgajjar force-pushed the unary_op branch 2 times, most recently from 1d1cf48 to 04d463c Compare April 27, 2020 19:20
@smitgajjar
Copy link
Contributor Author

If there is anything else, do comment. Otherwise it is good to go now...

- Added support for unary operators:
    - unary plus(+), unary minus(-), pre/post increment(++), pre/post decrement(--) and logical NOT(!)
- Added support for parenthesized expression
- Added corresponding tests
    - Added tests for unary operators
    - Added tests for parenthesized expression
    - Added tests for Exceptions raised in parsing binary operators, variable declarations and unary operators
- Improved error messages of Exceptions raised in parsing binary operators, variable declarations and unary operators

Other notes:
- Dereferencing operator(*), Address operator(&) and bitwise NOT(~) are the unary operators that have not been implemented because of unavailability of such nodes or classes in SymPy
- If unary operators are the children of binary operator in AST, it is not possible to parse yet!
@Sc0rpi0n101
Copy link
Member

Merging it now. Thank you for the contribution.

@Sc0rpi0n101 Sc0rpi0n101 merged commit 591a62f into sympy:master Apr 29, 2020
@smitgajjar smitgajjar deleted the unary_op branch April 29, 2020 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants