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

Implement J8 Strings and shopt, for b'' and u'' #1426

Closed
andychu opened this issue Dec 17, 2022 · 3 comments
Closed

Implement J8 Strings and shopt, for b'' and u'' #1426

andychu opened this issue Dec 17, 2022 · 3 comments

Comments

@andychu
Copy link
Contributor

andychu commented Dec 17, 2022

https://oilshell.zulipchat.com/#narrow/stream/325160-oil-discuss-public/topic/Oil.20Changes.20to.20support.20String.2FData.20language.20Unification

  • add \{var} interpolation to $''
  • possibly add $"" as a JSON parser, for generating shell code from other languages?
    • then [$"foo", $"bar\n"] becomes a valid ARGV array I guess
    • differences from "": the characters $ and backtick are no longer special
    • possibly add '{var}` as well, for consistency
  • double quoted strings can support C-escapes like \x00 and \u{1234}, as long as strict_backslash
  • add $"" as a synonym to "", which also makes it consistent with $'' - NO, maintain this assymetry on purpose
@andychu
Copy link
Contributor Author

andychu commented Dec 17, 2022

Simpler String Unification

https://oilshell.zulipchat.com/#narrow/stream/325160-oil-discuss-public/topic/Simpler.20String.20Unification

  • back out changes to $''
  • create $"" which is NJ-SQ compatible
  • fix up multi-line strings -- only ''' and $"""
    • you don't need either """ or $'''
  • write --bs8

@andychu andychu changed the title Oil string literals can be consistent with data languages Implement C strings and shopt -s parse_simple_strings, which makes Oil consistent with data languages Dec 21, 2022
@andychu
Copy link
Contributor Author

andychu commented Dec 21, 2022

Even Simplier Unification with c"" (and existing r'')

https://oilshell.zulipchat.com/#narrow/stream/325160-oil-discuss-public/topic/C.20Prefix.20Idea

TODO:

  1. Remove enhancements to $'\n'
  2. Rename shopt --set parse_raw_strings -> shopt --set parse_simple_strings or parse_rc_strings
    • make sure that r"" and c'' are syntax errors -- wrong type of quotes
    • although to be honest, I guess you COULD support those, but it would be out of touch with both shell and JSON
  3. Implement data language -- JSTR still (not CSTR)
    • read --jstr, instead of read --qsn

@andychu andychu changed the title Implement C strings and shopt -s parse_simple_strings, which makes Oil consistent with data languages Implement J8 Strings and shopt -s parse_j8s for j"\n" May 27, 2023
@andychu andychu changed the title Implement J8 Strings and shopt -s parse_j8s for j"\n" Implement J8 Strings and shopt, for b'' and u'' Jan 17, 2024
@andychu
Copy link
Contributor Author

andychu commented Feb 23, 2024

@andychu andychu closed this as completed Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant