Syntax highlighting -- compound quotes for strings (Stata)
Posted: Sat Jul 21, 2012 6:42 pm
Greetings,
I use TextPad as my editor for the Stata statistical program (www.stata.com). I have a problem with syntax highlighting and I'm hoping I'm missing a feature.
The issue:
Stata has three two different ways to indicate quoted text. The first is the standard regular double quotation marks, for example, "quoted text". The second allows for nesting quoted text within a quoted string by using "compound quotes," which have different open- and close-quote indicators. For example: `"This is quoted text with compound quotes"'.
Note that the open-quote is two characters: `" (that's the weird accent character that is usually under the tilde on the keyboard, followed by a double-quote) and the close-quote is also two characters "' (that's the double quote followed by the single-quote).
This allows for things like `"Quoted text with "quoted string" inside it"' without the need for a character to escape the internal quotes.
So: my problem is how to get Textpad to highlight syntax correctly. I can specify `" and "' as StringStart and StringEnd, and " as StringAlt. That gets both types of strings highlighted as strings.
However, Stata also surrounds character literals (local macros in Stata lingo) in ` and ' (the single characters that are part of compound quotes). The problem is in cases where a local macro is within a compound string:
`" This is a `local' within a compound string"'
In this case, Texpad takes the ' at the end of `local' to be the end of the string, not the end of the character literal.
Am I misunderstanding something about how I might set this up?
Thanks for any help!
I use TextPad as my editor for the Stata statistical program (www.stata.com). I have a problem with syntax highlighting and I'm hoping I'm missing a feature.
The issue:
Stata has three two different ways to indicate quoted text. The first is the standard regular double quotation marks, for example, "quoted text". The second allows for nesting quoted text within a quoted string by using "compound quotes," which have different open- and close-quote indicators. For example: `"This is quoted text with compound quotes"'.
Note that the open-quote is two characters: `" (that's the weird accent character that is usually under the tilde on the keyboard, followed by a double-quote) and the close-quote is also two characters "' (that's the double quote followed by the single-quote).
This allows for things like `"Quoted text with "quoted string" inside it"' without the need for a character to escape the internal quotes.
So: my problem is how to get Textpad to highlight syntax correctly. I can specify `" and "' as StringStart and StringEnd, and " as StringAlt. That gets both types of strings highlighted as strings.
However, Stata also surrounds character literals (local macros in Stata lingo) in ` and ' (the single characters that are part of compound quotes). The problem is in cases where a local macro is within a compound string:
`" This is a `local' within a compound string"'
In this case, Texpad takes the ' at the end of `local' to be the end of the string, not the end of the character literal.
Am I misunderstanding something about how I might set this up?
Thanks for any help!