Skip to content

Conversation

@marihachi
Copy link
Contributor

@marihachi marihachi commented Oct 15, 2023

What

  • 文法エラーで行番号と列番号が表示されるようになります。
  • 型エラーのコンストラクタにもlocパラメータを追加。

関連 #144

Why

Additional info (optional)

@marihachi marihachi added this to the AiScript Next (2023) milestone Oct 15, 2023
@marihachi marihachi self-assigned this Oct 15, 2023
@codecov
Copy link

codecov bot commented Oct 15, 2023

Codecov Report

All modified lines are covered by tests ✅

❗ No coverage uploaded for pull request base (aiscript-next@8101167). Click here to learn what that means.

Additional details and impacted files
@@               Coverage Diff                @@
##             aiscript-next     #413   +/-   ##
================================================
  Coverage                 ?   90.44%           
================================================
  Files                    ?       25           
  Lines                    ?     5136           
  Branches                 ?      943           
================================================
  Hits                     ?     4645           
  Misses                   ?      481           
  Partials                 ?       10           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@marihachi marihachi marked this pull request as ready for review October 15, 2023 11:35
@marihachi marihachi changed the title エラーに位置情報を追加 文法エラーに位置情報を追加 Oct 15, 2023
@marihachi marihachi requested a review from syuilo October 20, 2023 01:41
@syuilo syuilo merged commit 86eb9de into aiscript-next Oct 20, 2023
@syuilo syuilo deleted the work/error-location branch October 20, 2023 01:42
@syuilo
Copy link
Collaborator

syuilo commented Oct 20, 2023

👍👍👍

@FineArchs
Copy link
Member

@marihachi 今気づいたんですが、locのインデックスが1始まりになっているっぽいです。0始まりに修正お願いします。

@marihachi
Copy link
Contributor Author

locはインデックスではないです
1始まりの仕様で考えていますが、どうでしょうか

@FineArchs
Copy link
Member

str.pickstr.codepoint_atも0始まりなのにこれだけ1始まりなのはかなり分かりにくい気がしますが…

@marihachi
Copy link
Contributor Author

ソースコード上の位置はコードエディタなどで行1,列1から始まってますよね
プログラム上のインデックス値とはまた別の概念だと思いますが

@syuilo
Copy link
Collaborator

syuilo commented Oct 21, 2023

内部的な表現としては0始まりで持っておいて人間への表示時は+1するというのも考えられる

@marihachi
Copy link
Contributor Author

パーサー内部では行も列も0始まりで扱ってるのでどちらにも出来ますけど
どちらかに決めればどちらでも良いと思います。ただ一般的に1始まりだと思ったのでそれに合わせた訳です。

@marihachi

This comment was marked as outdated.

@marihachi
Copy link
Contributor Author

ただ行と列の番号で演算をすることはなさそうな?
表示目的だけであれば0ベースにする必要はないと思います

@marihachi
Copy link
Contributor Author

ちょっと他のツールとか調査しますか

@marihachi
Copy link
Contributor Author

0始まりが好きな人も1始まりが好きな人もいるようなので、どちらが優れているというわけではなさそうです。
とりあえずしゅいろが好きな方で行きましょう @syuilo

@syuilo
Copy link
Collaborator

syuilo commented Oct 21, 2023

1で

@FineArchs
Copy link
Member

1で

了解です

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.

4 participants