POV-Ray : Newsgroups : povray.beta-test : 2.2.1.2 Comments (block comments). : Re: 2.2.1.2 Comments (block comments). Server Time
29 Jul 2024 06:15:32 EDT (-0400)
  Re: 2.2.1.2 Comments (block comments).  
From: Thorsten Froehlich
Date: 26 Mar 2006 09:37:50
Message: <4426a73e$1@news.povray.org>
Warp wrote:
>   Is adding support for nested comments really that much heavier than
> supporting single comments? 

Yes, just try to think about the algorithm: It would always have to search 
the whole file in both directions to determine where it is inside nested 
comments, while the non-nested version can abort as soon as it finds the 
first closing of a comment to know it isn't inside a comment, and the first 
opening to know that it is inside an opening (all based on searching from 
the first visible line to the beginning of the file). Alternatively it would 
have to somehow keep track of comments at least on a line-by-line basis 
(comment count would do, I think, but I haven't verified that). It basically 
gets messy, and even then it would only for as long as there is one type of 
multi-line comments (I don't know of any language that has more off-hand, 
but I certainly can imagine one). Basically, the algorithm for non-nested is 
simple and fast, but the nested case is either messy and probably fast or 
simple and slow. And that is why I said coloring cannot be done due to 
computational complexity. Of course it is possible, but with much added 
complexity.

	Thorsten

PS: In the Mac version I "solved" the problem in a different way. The editor 
simply colors the comment-characters and single-line comments only. That way 
it is really fast, even on the oldest Macs it can run on. Coloring exists 
since POV-Ray 3.1 on Macs, and that could run on systems with just a MC 
68020 - meaning with less than five MIPS average performance available...


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.