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

Robust position parser #11

Merged
merged 14 commits into from
Jan 24, 2024
Merged

Robust position parser #11

merged 14 commits into from
Jan 24, 2024

Conversation

phenylshima
Copy link
Member

@phenylshima phenylshima commented Jan 19, 2024

split.match_position()はAllPositionを一意に決定し(もし複数の候補が残ればエラーを返します),split.verify(position)はそれが既知のパターンに矛盾しないことを確認します.

したがって,パターンに記述された条件が不十分で一つに決定できない場合はmatch_position,位置は一意に推定できるものの,文法が間違っていてマッチしないものはverifyでエラーになります.

なお,estimate_positionOkを返したとしても,rangeが有効であること,及びrangeが有効に対象の範囲を絞り込めることは保証しません.例えば,*/B:?*は全くの無意味ですが,estimate_positionOkを返します.

@phenylshima phenylshima marked this pull request as draft January 19, 2024 03:06
Copy link

codecov bot commented Jan 19, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (0e85f53) 90.66% compared to head (88993e8) 91.77%.

Files Patch % Lines
crates/jlabel-question/src/parse_position.rs 99.42% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #11      +/-   ##
==========================================
+ Coverage   90.66%   91.77%   +1.11%     
==========================================
  Files           6        7       +1     
  Lines         857      961     +104     
==========================================
+ Hits          777      882     +105     
+ Misses         80       79       -1     

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

@phenylshima phenylshima marked this pull request as ready for review January 19, 2024 04:52
@phenylshima phenylshima self-assigned this Jan 19, 2024
@phenylshima phenylshima requested a review from cm-ayf January 19, 2024 04:52
Copy link
Contributor

@cm-ayf cm-ayf left a comment

Choose a reason for hiding this comment

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

取り急ぎ

EmptyRange,
}

pub fn estimate_position(input_pattern: &str) -> Result<(AllPosition, &str), PositionError> {
Copy link
Contributor

Choose a reason for hiding this comment

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

refactor……
letの初期化式が長くなってるのをそれぞれ関数に切り出す?

@phenylshima phenylshima requested a review from cm-ayf January 20, 2024 00:45
@phenylshima phenylshima changed the title Robust parser Robust position parser Jan 20, 2024
@phenylshima phenylshima merged commit e760e91 into main Jan 24, 2024
5 checks passed
@phenylshima phenylshima deleted the robust-parser branch January 24, 2024 05:29
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