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

単項演算子をサポート #131

Open
wants to merge 3 commits into
base: pgcst--expr-support
Choose a base branch
from

Conversation

lemonadern
Copy link
Collaborator

@lemonadern lemonadern commented Feb 27, 2025

Summary

式のうち、単項の演算子をサポートしました

Note

PostgreSQLの絶対値演算子(@)について、@-5 のように他の演算子と並べて記述すると @- という一つの演算子と認識される挙動がありますが、現行フォーマッタのテストケースではこの点を考慮しないフォーマットをしていたため挙動を変更しました。
commit: baae324

パーサ移行によって解消される問題としてIssueに起こしました:#132

@lemonadern lemonadern mentioned this pull request Feb 27, 2025
6 tasks
@@ -52,7 +52,8 @@ impl UnaryExpr {

result.push_str(&self.operator);
// `NOT` のときは空白が必要
if self.operator.to_uppercase() == "NOT" {
// `@`(絶対値)のときも空白が必要(PostgreSQLでは、`@-` とすると一つのトークンとして扱われてしまうため)
if self.operator.to_uppercase() == "NOT" || self.operator.to_uppercase() == "@" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@ の方は to_uppercase 不要かと思います。

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

修正しました 🙏

@lemonadern lemonadern marked this pull request as ready for review February 28, 2025 06:22
`@-` というパターンはPostgreSQLでは不正なため、演算子の間に空白を挿入
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

Successfully merging this pull request may close these issues.

2 participants