diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-09-16 00:29:12 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-09-16 00:29:12 -0400 |
| commit | 14b04f97be197940eb6244f17deda5c344176c91 (patch) | |
| tree | ab171cd1ae0e37df6144c5bde0725dbc6eb3476c | |
| parent | 10a51ad996482d07ecfe4bcd3251b4e8701a30df (diff) | |
Quote Patterns with "|" instead of "/" when applicable
| -rw-r--r-- | examples/ini/ini.tm | 2 | ||||
| -rw-r--r-- | stdlib/text.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/examples/ini/ini.tm b/examples/ini/ini.tm index 7598417f..8b91d3fa 100644 --- a/examples/ini/ini.tm +++ b/examples/ini/ini.tm @@ -29,7 +29,7 @@ func parse_ini(path:Path)->{Text:{Text:Text}}: return {k:v[] for k,v in sections} func main(path:Path, key:Text?): - keys := key:or_else(""):split($Pattern"/") + keys := key:or_else(""):split($|/|) if keys.length > 2: exit(" Too many arguments! diff --git a/stdlib/text.c b/stdlib/text.c index fd54204b..2da8628c 100644 --- a/stdlib/text.c +++ b/stdlib/text.c @@ -1108,7 +1108,7 @@ public Text_t Text$as_text(const void *text, bool colorize, const TypeInfo *info if (!text) return info && info->TextInfo.lang ? Text$from_str(info->TextInfo.lang) : Text("Text"); char quote_char; if (info == &Pattern$info) { - quote_char = '/'; + quote_char = Text$has(*(Text_t*)text, Pattern("/")) && !Text$has(*(Text_t*)text, Pattern("|")) ? '|' : '/'; } else { // Figure out the best quotation mark to use: bool has_dollar = false, has_double_quote = false, has_backtick = false, |
