forked from kcl-lang/kcl
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: impl string-like schema attribute parser and ast printer (kcl-l…
…ang#849) Signed-off-by: peefy <[email protected]>
- Loading branch information
Showing
15 changed files
with
482 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
...ser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_32.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
--- | ||
source: parser/src/tests/error_recovery.rs | ||
assertion_line: 277 | ||
expression: "crate::tests::parsing_module_string(r#\"\nschema A:\n \"attr\": str\"#)" | ||
--- | ||
Module { | ||
filename: "", | ||
pkg: "", | ||
doc: None, | ||
name: "", | ||
body: [ | ||
Node { | ||
node: Schema( | ||
SchemaStmt { | ||
doc: None, | ||
name: Node { | ||
node: "A", | ||
filename: "", | ||
line: 2, | ||
column: 7, | ||
end_line: 2, | ||
end_column: 8, | ||
}, | ||
parent_name: None, | ||
for_host_name: None, | ||
is_mixin: false, | ||
is_protocol: false, | ||
args: None, | ||
mixins: [], | ||
body: [ | ||
Node { | ||
node: SchemaAttr( | ||
SchemaAttr { | ||
doc: "", | ||
name: Node { | ||
node: "attr", | ||
filename: "", | ||
line: 3, | ||
column: 4, | ||
end_line: 3, | ||
end_column: 10, | ||
}, | ||
type_str: Node { | ||
node: "str", | ||
filename: "", | ||
line: 3, | ||
column: 12, | ||
end_line: 3, | ||
end_column: 15, | ||
}, | ||
op: None, | ||
value: None, | ||
is_optional: false, | ||
decorators: [], | ||
ty: Node { | ||
node: Basic( | ||
Str, | ||
), | ||
filename: "", | ||
line: 3, | ||
column: 12, | ||
end_line: 3, | ||
end_column: 15, | ||
}, | ||
}, | ||
), | ||
filename: "", | ||
line: 3, | ||
column: 4, | ||
end_line: 3, | ||
end_column: 15, | ||
}, | ||
], | ||
decorators: [], | ||
checks: [], | ||
index_signature: None, | ||
}, | ||
), | ||
filename: "", | ||
line: 2, | ||
column: 0, | ||
end_line: 3, | ||
end_column: 15, | ||
}, | ||
], | ||
comments: [], | ||
} | ||
|
97 changes: 97 additions & 0 deletions
97
...ser/src/tests/snapshots/kclvm_parser__tests__error_recovery__schema_stmt_recovery_33.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
--- | ||
source: parser/src/tests/error_recovery.rs | ||
assertion_line: 280 | ||
expression: "crate::tests::parsing_module_string(r#\"\nschema A:\n \"\"\"Schema Doc\"\"\"\n \"attr\": str\"#)" | ||
--- | ||
Module { | ||
filename: "", | ||
pkg: "", | ||
doc: None, | ||
name: "", | ||
body: [ | ||
Node { | ||
node: Schema( | ||
SchemaStmt { | ||
doc: Some( | ||
Node { | ||
node: "\"\"\"Schema Doc\"\"\"", | ||
filename: "", | ||
line: 3, | ||
column: 4, | ||
end_line: 3, | ||
end_column: 20, | ||
}, | ||
), | ||
name: Node { | ||
node: "A", | ||
filename: "", | ||
line: 2, | ||
column: 7, | ||
end_line: 2, | ||
end_column: 8, | ||
}, | ||
parent_name: None, | ||
for_host_name: None, | ||
is_mixin: false, | ||
is_protocol: false, | ||
args: None, | ||
mixins: [], | ||
body: [ | ||
Node { | ||
node: SchemaAttr( | ||
SchemaAttr { | ||
doc: "", | ||
name: Node { | ||
node: "attr", | ||
filename: "", | ||
line: 4, | ||
column: 4, | ||
end_line: 4, | ||
end_column: 10, | ||
}, | ||
type_str: Node { | ||
node: "str", | ||
filename: "", | ||
line: 4, | ||
column: 12, | ||
end_line: 4, | ||
end_column: 15, | ||
}, | ||
op: None, | ||
value: None, | ||
is_optional: false, | ||
decorators: [], | ||
ty: Node { | ||
node: Basic( | ||
Str, | ||
), | ||
filename: "", | ||
line: 4, | ||
column: 12, | ||
end_line: 4, | ||
end_column: 15, | ||
}, | ||
}, | ||
), | ||
filename: "", | ||
line: 4, | ||
column: 4, | ||
end_line: 4, | ||
end_column: 15, | ||
}, | ||
], | ||
decorators: [], | ||
checks: [], | ||
index_signature: None, | ||
}, | ||
), | ||
filename: "", | ||
line: 2, | ||
column: 0, | ||
end_line: 4, | ||
end_column: 15, | ||
}, | ||
], | ||
comments: [], | ||
} | ||
|
Oops, something went wrong.