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

Classify parser errors and use them #320

Merged
merged 37 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
1e07283
update: invalid convert error
GreasySlug Jan 14, 2023
35db8c5
add: handling when add: `None` is matched
GreasySlug Jan 14, 2023
4c50f1d
update: style
GreasySlug Jan 15, 2023
b2a0dc1
add: classify error
GreasySlug Jan 16, 2023
9e1d5d2
[WIP]test: collection and class attr
GreasySlug Jan 16, 2023
38cb160
update: use classified err instead of syntax_error
GreasySlug Jan 16, 2023
af4bbbb
fix: use skip and put log
GreasySlug Jan 16, 2023
fcf79f1
update: add chinese
GreasySlug Jan 22, 2023
f4dfb38
update: add seq and unclosed error
GreasySlug Jan 24, 2023
292bc6c
fix(parser): conflict and linter warning
GreasySlug Feb 5, 2023
709b29c
fix: modify Chinese error information
C-BJ Feb 5, 2023
d52c10e
chore: use syntax instead of new
GreasySlug Feb 5, 2023
ebd528e
Update parse.rs
mtshiba Feb 8, 2023
e5e9da5
refactor(parser): modify messages
Feb 10, 2023
3bc4a7e
fix: modify Chinese error information
C-BJ Feb 10, 2023
e50d208
fix(parser): skip dedent
GreasySlug Feb 14, 2023
855be06
test(parser): update class def
GreasySlug Feb 14, 2023
723e758
fix(parser): fix conflict
GreasySlug Apr 1, 2023
219ecb7
chore(error): remove unnecessary errors
GreasySlug Apr 1, 2023
165d859
chore: update msg
GreasySlug Apr 2, 2023
9b58d92
test: remove the part that is no longer an error
GreasySlug Apr 4, 2023
0dba4da
chore: improve error messages
mtshiba Apr 5, 2023
0b36b48
fix(parser): skip multi nested dedent
GreasySlug Apr 5, 2023
6998328
test(parser): check skip multi nested dedent
GreasySlug Apr 5, 2023
d190abd
Revert "update: invalid convert error"
GreasySlug Apr 9, 2023
bd7eb2e
refactor: test funcs
mtshiba Apr 13, 2023
17cbd33
Update parse.rs
mtshiba Apr 13, 2023
8d723ae
fix(parser): #369
GreasySlug Apr 17, 2023
1ff53f4
fix(parser): #245
GreasySlug Apr 18, 2023
7004025
chore(error): wording
GreasySlug Apr 18, 2023
85bc213
fix(parser): add expr error erg-lang#369
GreasySlug Apr 29, 2023
fdce1e2
fix: modify Chinese error information
C-BJ Jun 4, 2023
d707da8
fix: modify Chinese error information
C-BJ Jun 4, 2023
47718b4
fix: modify Chinese error information
C-BJ Jun 4, 2023
9f8746c
Merge branch 'main' of https://github.com/GreasySlug/erg into feature…
GreasySlug Jun 4, 2023
30a9aab
fix(parser): modification of wording
GreasySlug Jun 4, 2023
924b22a
Merge branch 'main' into pr/320
mtshiba Jun 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions crates/erg_common/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -790,15 +790,25 @@ impl ErrorCore {
Some(Attribute::Underline),
);

let m_msg = switch_lang!(
"japanese" => format!("これはErgのバグです、開発者に報告して下さい({URL})\n{fn_name}:{line}より発生"),
"simplified_chinese" => format!("这是Erg的bug,请报告给{URL}\n原因来自: {fn_name}:{line}"),
"traditional_chinese" => format!("这是Erg的bug,请报告给{URL}\n原因来自: {fn_name}:{line}"),
"english" => format!("this is a bug of Erg, please report it to {URL}\ncaused from: {fn_name}:{line}"),
let main_msg = switch_lang!(
"japanese" => format!("\
これはErgのバグです、開発者に報告して下さい({URL})
発生箇所: {fn_name}:{line}"),
"simplified_chinese" => format!("\
这是Erg的bug,请报告给{URL}
原因来自: {fn_name}:{line}"),
"traditional_chinese" => format!("\
這是Erg的bug,請報告給{URL}
原因來自: {fn_name}:{line}"),
"english" => format!("\
This is a bug of Erg, please report it to {URL}
Caused from: {fn_name}:{line}"),
);
let main_msg =
StyledStr::new(&main_msg, Some(Color::Red), Some(Attribute::Bold)).to_string();
Self::new(
vec![SubMessage::only_loc(loc)],
m_msg,
main_msg,
errno,
CompilerSystemError,
loc,
Expand Down
2 changes: 1 addition & 1 deletion crates/erg_compiler/error/tycheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,7 @@ passed keyword args: {kw_args_len}"
vec![SubMessage::only_loc(loc)],
switch_lang!(
"japanese" => format!("型が期待されましたが、{tp}は型ではありません"),
"simplified_chinese" => format!("期望一个类型,但是得到了{tp}"),
"simplified_chinese" => format!("期望类型,但是得到了{tp}"),
"traditional_chinese" => format!("期望一個類型,但是得到了{tp}"),
"english" => format!("expected a type, but got {tp}"),
),
Expand Down
2 changes: 1 addition & 1 deletion crates/erg_compiler/ty/deserialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl DeserializeError {
"{expect}型オブジェクトを予期しましたが、 読み込んだオブジェクトは{found}型です",
),
"simplified_chinese" => format!(
"期望一个{expect}对象,但反序列化的对象是{found}",
"期望{expect}对象,但反序列化的对象是{found}",
),
"traditional_chinese" => format!(
"期望一個{expect}對象,但反序列化的對像是{found}",
Expand Down
499 changes: 357 additions & 142 deletions crates/erg_parser/error.rs

Large diffs are not rendered by default.

Loading