-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/minimalist-parser
- Loading branch information
Showing
51 changed files
with
1,367 additions
and
650 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
from aethel.frontend import LexicalPhrase | ||
from aethel.mill.types import type_prefix, type_repr | ||
|
||
|
||
def serialize_phrases_with_infix_notation( | ||
def serialize_phrases( | ||
lexical_phrases: list[LexicalPhrase], | ||
) -> list[dict[str, str]]: | ||
""" | ||
Serializes a list of LexicalPhrases in a human-readable infix notation that is already available in Æthel in Type.__repr__. | ||
Serializes a list of LexicalPhrases in a human-readable infix notation that is already available in Æthel in Type.__repr__ or type_repr(). This is used to display the types in the frontend. | ||
The standard JSON serialization of phrases uses a prefix notation for types, which is good for data-exchange purposes (easier parsing) but less ideal for human consumption. | ||
The standard JSON serialization of phrases uses a prefix notation for types, which is good for data-exchange purposes (easier parsing) but less ideal for human consumption. This notation is used to query. | ||
""" | ||
return [dict(phrase.json(), type=repr(phrase.type)) for phrase in lexical_phrases] | ||
return [ | ||
dict( | ||
phrase.json(), | ||
display_type=type_repr(phrase.type), | ||
type=type_prefix(phrase.type), | ||
) | ||
for phrase in lexical_phrases | ||
] |
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
Oops, something went wrong.