Escaped character in single quoted string

18 views
Skip to first unread message

Yannick Duchêne

unread,
Dec 1, 2015, 7:24:11 PM12/1/15
to ats-lang-users
Hi all,

The questions may be stupid, but I wonder as I'm about an highlighter for Sublime Text: is there anything special with "(" and "[" and "{" in single quoted strings? `pats_lexing.dats` seems to handle it a special way, when it follows a back‑slash, it seems to insert the character next to a single quote, instead of the character alone. is that what I have to understand? Also, these three characters appears as escaped in the source it‑self, and I don't see why (may be just ATS1 needs it, as ATS2 source is ATS1… i don't know).

I'm just using this regex for escaped character:

\b(?:(\\n|\\t|\\a|\\b|\\v|\\f|\\r|\\[xX][0-9A-Fa-f]{1,3}|\\[0-9]{1,3}))

Now I wonder if I should add something special for "(" and "[" and "{", escaped or not, when they appears in a single quoted string.

Yannick Duchêne

unread,
Dec 1, 2015, 7:34:07 PM12/1/15
to ats-lang-users
No, sorry, I've understood, it's not parsing a single quoted string, at that point, it's just seeing " '( " and the like and parse it (not as a quoted string). My apologies.

gmhwxi

unread,
Dec 1, 2015, 7:34:50 PM12/1/15
to ats-lang-users
Yes, '(, '[, and '{ are special tokens.

'(...) for a boxed tuple while @(...) for a flat tuple
'{...} for a boxed record while @{...} for a flat record

'[...] is not yet used (I am not so sure); @[...](...) is for forming flat array (e.g., @[int](1,2,3,4,5) for an integer array of size 5)
Reply all
Reply to author
Forward
0 new messages