Skip to content

Scanner import fixes#16

Closed
rocky wants to merge 4 commits intomasterfrom
mathics-scanner-import
Closed

Scanner import fixes#16
rocky wants to merge 4 commits intomasterfrom
mathics-scanner-import

Conversation

@rocky
Copy link
Member

@rocky rocky commented Jan 23, 2021

main.py, termshell.py: import mathics_scanner
inputrc-no-unicode: remove translations that aren't surrounded in escape

__main__.py, termshell.py: import mathics_scanner
inputrc-no-unicode: remove translations that aren't surrounded in escape
"\e\\omega\e": "\\[Omega]"

# Autogenerated from https://github.com/Mathics3/mathics-development-guide/blob/master/resources/named-characters-data.csv
"a'": "\\[AAcute]"
Copy link
Member Author

Choose a reason for hiding this comment

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

@GarkGarcia All of these characters should be regenerated. They are missing the escape at the beginning and end of the escape sequence.

For example "\ea'\e" rather than "a'".

Copy link
Contributor

Choose a reason for hiding this comment

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

Ohh, yes, forgot about that. @rocky btw we could use mathics-scanner to proceduraly generate the inputrc files now. It would look something like the following:

from mathics_scanner.characters import replace_wl_with_plain_text, aliased_characters

# Print inputrc with unicode
for alias in alieased_characters:
  print(f'"\\e{escape(alias)}\\e": "{escape(replace_wl_with_plain_text(aliased_characters[alias]))}"')

# Print inputrc without unicode
for alias in alieased_characters:
  print(f'"\\e{escape(alias)}\\e": "{escape(replace_wl_with_plain_text(aliased_characters[alias], use_unicode=False))}"')

Copy link
Member Author

Choose a reason for hiding this comment

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

Great! Make it so!

Copy link
Contributor

Choose a reason for hiding this comment

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

Great! Make it so!

Ok, I just need to know which characters should be escaped inside of a inputrc string.

@rocky rocky force-pushed the mathics-scanner-import branch from a306cd6 to f87c10f Compare January 23, 2021 22:51
@rocky rocky force-pushed the mathics-scanner-import branch from 920636e to 5b17b72 Compare January 23, 2021 23:02
@rocky
Copy link
Member Author

rocky commented Jan 23, 2021

Superceded by #17

@rocky rocky closed this Jan 23, 2021
@rocky rocky deleted the mathics-scanner-import branch February 14, 2021 18:18
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