473,387 Members | 1,463 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to handle multi-line quotes

Thinking about unclosed multi-line quotes.

When you open a multi-line quote (type '"""') what does your editor
do? Does it color the remainder of your text as a quote, or does it
color the line with the open quote as a quote and leave the rest of
your code alone?

What do you want it to do?

This is a tokenizer question in disguise, of course. The simple way to
handle it, which is what my editor sees, is for the tokenizer to
return the remainder of the text as one great UNCLOSED_MULTILINE_QUOTE
token. The alternative is to assume that the line with the unclosed
quote is in error and to continue to tokenize the rest. An editor
might blink or otherwise draw attention to the unmatched quote.
Dec 21 '07 #1
4 2676
Lie
On Dec 22, 2:15*am, MartinRineh...@gmail.com wrote:
Thinking about unclosed multi-line quotes.

When you open a multi-line quote (type '"""') what does your editor
do? Does it color the remainder of your text as a quote, or does it
color the line with the open quote as a quote and leave the rest of
your code alone?

What do you want it to do?

This is a tokenizer question in disguise, of course. The simple way to
handle it, which is what my editor sees, is for the tokenizer to
return the remainder of the text as one great UNCLOSED_MULTILINE_QUOTE
token. The alternative is to assume that the line with the unclosed
quote is in error and to continue to tokenize the rest. An editor
might blink or otherwise draw attention to the unmatched quote.
Are you asking about IDLE? If it is, IDLE considers the remainder of
the code as part of multiline-quote and thus colors them green (in
default color scheme). This behavior is consistent with any other code
editors way of handling multiline comments (Frontpage, Dreamweaver,
etc). IMHO, it is a fine behavior, such a huge color change would be
immediately noticed by any non-color-blind people and they'll
immediately close the multiline (perhaps in panic) before filling the
multiline.
Dec 21 '07 #2
Ma************@gmail.com a écrit :
Thinking about unclosed multi-line quotes.

When you open a multi-line quote (type '"""') what does your editor
do?
The RightThing(tm), that is:
Does it color the remainder of your text as a quote,
Indeed.
Dec 21 '07 #3
On 21 Dic, 22:13, Bruno Desthuilliers
<bdesth.quelquech...@free.quelquepart.frwrote:
MartinRineh...@gmail.com a écrit :
Thinking about unclosed multi-line quotes.
When you open a multi-line quote (type '"""') what does your editor
do?

The RightThing(tm), that is:
Does it color the remainder of your text as a quote,

Indeed.
I'd call it "The CommonBehaviour(tm)".
Other options, wich I've never seen, could be
1) color every word as in normal mode, while changing the background
color (with something similar peraps)
2) color the remainder of the text as a quote, but using lighter/
darker colors for the different kind of tokens
Dec 21 '07 #4
MartinRinehart wrote:
Thinking about unclosed multi-line quotes.

When you open a multi-line quote (type '"""') what does your editor
do? Does it color the remainder of your text as a quote, or does it
color the line with the open quote as a quote and leave the rest of
your code alone?

What do you want it to do?
Warning: You don't want to hear this, but you did ask...
======

It depends on context in my mind.

If I am typing a new string, I want it to automatically add the trailing quotes
and leave the cursor between them, ready for entry, until I use the arrow
keys or the mouse to get "out of" the string.

If I am commenting out a piece of code, I want it to give me the default
behaviour - chunking the rest of the file in one big lump until I insert the
closing quotes.

But alas - it has always been thus - I seldom get what I want, because
people and things always seem to misinterpret my intentions.

So I will settle for the default initial behaviour, with a switch to the first
style when I type the first displayable character after the opening quotes.

Or the opposite, start with the full set of delimiters, the cursor between
them, and if the cursor moves out of the empty string, fall back to the
lumpy behaviour by removing the closing delimiters.

Both would force one to explicitly define an empty string, but that is
just the way the world works now, so that is fine by me.

And just to make your day, I want the behaviour to nest or not, to give
me control over how it works, and while we are parameterising - why not
something to choose between the three styles? - you could define some
globals, and write a lot more code. (and yes its three not two - think about
it)

Do you sometimes feel that becoming a fireman or a pizza salesman
would have led to a less complicated life?

- Hendrik
Dec 22 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jinlin | last post by:
I found a interesting problem in C# and couldn't explain it. The code to reproduce it is very simple: 1. Create a windows application in C#. 2. Listen to the activated event on the default form...
2
by: Simon Niederberger | last post by:
Hi I've written a Windows Service which has - several (0-100) listeners threads which spawn worker threads based on events, timers etc - several (0-300) worker threads which handle data...
4
by: LhK-Soft | last post by:
Hi, I'm active in VC++ for several years now, so I know some things (I think). Using MS-Access I store a db with lots of entries and uses the VBA techniques to export those data to e.g. HTML, XML...
6
by: Leandro Berti via DotNetMonster.com | last post by:
Hi All, I wrote a code to do serial communication with an equipament. When i use the code outside of threaded class it seens work properly, but when i put inside a class and execute a thread in...
2
by: JollyK | last post by:
Hello friends, In a large asp.net project, I don't think it is a good idea for having one common resource file containing all localized strings for the whole application. I think a better...
2
by: lucy | last post by:
Hi, I'm working on a multi-threading web application. I'm using Application_Error event to write exception detail to windows event log to help debug. It seems exception happened in the second...
3
by: Basel | last post by:
Hi All I'm using SetConsoleCtrlHandler to handle Ctrl-C event. But I have a problem using it in multi-threaded applications (it doesn't invoke handler function). What is the correct way to...
1
by: rapin | last post by:
How do you make javascript’s string functions (like toUpperCase() or substr()) run under SpiderMonkey to handle multi-byte characters. For example: var strTest = "ørnen på"; var ...
4
by: Rui Maciel | last post by:
I want to support Unicode on a pet project of mine (small markup language parser). I've read a bit about Unicode (didn't delved beyond the basics) and I searched for some info on how to support...
8
by: dmoore | last post by:
Hi folks, I've seen the following issue come up in multiple posts to this mailing list: I have a python program that spawns a child process with popen or popen2 or popen3 or popen2.popen2...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.