POV-Ray : Newsgroups : povray.newusers : Good ways to keep curly braces straight Server Time
23 Nov 2024 12:29:00 EST (-0500)
  Good ways to keep curly braces straight (Message 1 to 7 of 7)  
From: Bald Eagle
Subject: Good ways to keep curly braces straight
Date: 10 Mar 2014 15:41:46
Message: <531e157a$1@news.povray.org>
... and the subject was intended to read just like THAT!   :D

Anyway,
I have a small (~500 line) file that I keep having issues with after 
editing, where I either have an extra, or a missing curly brace.

I'd like some tips and tricks on organizing and visually keeping track 
of my SDL code, and maybe even some clever thingsd embedded in the code 
to help locate where the offending error resides.


Post a reply to this message

From: Le Forgeron
Subject: Re: Good ways to keep curly braces straight
Date: 10 Mar 2014 16:33:49
Message: <531e21ad$1@news.povray.org>
Le 10/03/2014 20:42, Bald Eagle nous fit lire :
> ... and the subject was intended to read just like THAT!   :D
> 
> Anyway,
> I have a small (~500 line) file that I keep having issues with after
> editing, where I either have an extra, or a missing curly brace.
> 
> I'd like some tips and tricks on organizing and visually keeping track
> of my SDL code, and maybe even some clever thingsd embedded in the code
> to help locate where the offending error resides.

what editor are you using ?
Some have the capability to:
 1. find the matching braces
 2. indent the code according to braces

For instance, with vi/vim/gvim, one basic trick is: all opening &
closing curly are alone on their own line. Indenting is just a matter of
moving to one curly brace and press =% (just two keys: = then % )
and everything inside the block get indented (to the amount of sw, so
':set sw=2' for an indent of 2 spaces)


Post a reply to this message

From: Bald Eagle
Subject: Re: Good ways to keep curly braces straight
Date: 10 Mar 2014 19:35:41
Message: <531e4c4d$1@news.povray.org>
Unfortunately, I'm running it on Winbloze, and so am using the internal 
POV-Ray text editor.  I DL'd a text app for Win 8.1 that highlights 
brackets and parentheses, but haven't tried to get pov-ray to run on 
that OS yet...

I guess as soon as I get over this cold, I'll just try to pick through 
it all and establish a logical and consistent indentation methodology.


Post a reply to this message

From: Ger
Subject: Re: Good ways to keep curly braces straight
Date: 10 Mar 2014 21:11:23
Message: <531e62bb$1@news.povray.org>
Bald Eagle wrote:

> Unfortunately, I'm running it on Winbloze, and so am using the internal
> POV-Ray text editor.  I DL'd a text app for Win 8.1 that highlights
> brackets and parentheses, but haven't tried to get pov-ray to run on
> that OS yet...
> 
> I guess as soon as I get over this cold, I'll just try to pick through
> it all and establish a logical and consistent indentation methodology.

There's a "Kate" version for Windows available. It has everything you want for code
editing. It can handle Povray SDL as well. (Highlighting, brace checking etc).
-- 

Ger


Post a reply to this message

From: Alain
Subject: Re: Good ways to keep curly braces straight
Date: 10 Mar 2014 23:00:59
Message: <531e7c6b@news.povray.org>

> ... and the subject was intended to read just like THAT!   :D
>
> Anyway,
> I have a small (~500 line) file that I keep having issues with after
> editing, where I either have an extra, or a missing curly brace.
>
> I'd like some tips and tricks on organizing and visually keeping track
> of my SDL code, and maybe even some clever thingsd embedded in the code
> to help locate where the offending error resides.

Assuming that you are using the Windows version.

With the cursor on a brace, you can use Ctrl+] to find the matching brace.

On the menu, under the "Text" heading, sellect:
Auto-Indent style -> Language scope
Now, if you start a new line after a brace, it will be idented.
After you close a brace, the next line identation will get reduced. When 
you find yourself with no identation, it mean that all braces are matched.
This will also tend to make your code more readable.



Alain


Post a reply to this message

From: Larry Hudson
Subject: Re: Good ways to keep curly braces straight
Date: 11 Mar 2014 03:08:54
Message: <531eb686@news.povray.org>
On 03/10/2014 04:35 PM, Bald Eagle wrote:
> Unfortunately, I'm running it on Winbloze, and so am using the internal POV-Ray text
editor.  I
> DL'd a text app for Win 8.1 that highlights brackets and parentheses, but haven't
tried to get
> pov-ray to run on that OS yet...
>
> I guess as soon as I get over this cold, I'll just try to pick through it all and
establish a
> logical and consistent indentation methodology.

You might try the free notepad++.  One of its capabilities is to show/hide blocks of
code, you 
can sometimes find mismatched braces this way.  I'm sure there are other editors with
this 
capability as well, but I do know notepad++ will do it.  I expect it will run on
Windows 8, but 
don't know for sure.

<aside>
I'm a Linux guy, and have no interest in changing my Windows 7 installation to 8.  I
stick to 
Linux (Mint) and rarely run Windows.  Actually, my preferred Windows editor is notetab
-- notice 
that is noteTAB not notePAD.  But notepad++ is also an excellent programmer's editor
-- and free 
as well.
</aside>

      -=- Larry -=-


Post a reply to this message

From: Cousin Ricky
Subject: Re: Good ways to keep curly braces straight
Date: 11 Mar 2014 13:10:00
Message: <web.531f423cc3f8948a85de7b680@news.povray.org>
Bald Eagle <cre### [at] netscapenet> wrote:
> ... and the subject was intended to read just like THAT!   :D
>
> Anyway,
> I have a small (~500 line) file that I keep having issues with after
> editing, where I either have an extra, or a missing curly brace.
>
> I'd like some tips and tricks on organizing and visually keeping track
> of my SDL code, and maybe even some clever thingsd embedded in the code
> to help locate where the offending error resides.

Should you go the Kate route, a syntax highlighting file is located at

   http://news.povray.org/4f4092fb%40news.povray.org

so you don't have to download the Unix version of POV-Ray.  Kate highlights not
only curly braces, but square brackets and (most helpful to me) parentheses.

One thing I do that requires no software is that I use a non-customary formating
style.  Customarily, the opening brace is placed on the same line as the
keyword, for example:

   object {
      MyObject
      translate MyLocation
   }

This confuses me to no end.  I prefer:

   object
   {  MyObject
      translate MyLocation
   }

This helps me keep better track of the braces and the blocks they enclose.  I
once read in a C/C++ style guide that thou shalt use the One True Brace Style.
Right.  If a brace style confuses me, it defeats its own purpose.


Post a reply to this message

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