braces

Indent style names

I've seen this questions here. I'm wondering if there exists an offical name for the following indent style: void fooBar(String s) { while (true) { // ... do something } } When the opening brace is in the same line as the control statement, the statments within are indented and the closing brace is on the same iden...

Script to covert cuddle style

I believe it is called "cuddle" style: function foo() { // blah } function foo() { // blah } Does anyone know of any scripts that will go through a file and toggle in one direction or the other? My goal is TextMate integration through a bundle, but any script in any language should be fine. I believe I can hook most any lang...

Linked Braces in Visual Studio 2008

Hello, How can I, create a vertical line between the open brace and close brace in Visual Studio 2008 (C#), if you can't understand about what I'm talking, there's a following picture(Pic1). [Pic1 - I want to do this with the braces] http://www.hanselman.com/blog/content/binary/vsbeforefonts.png Thanks. ...

regular expression for content within braces

hi there, is there a regular expression to match the content within braces. For example with the following: d = {'key': {'a': [1,2,3]}} I would want to match {'key': {'a': [1,2,3]}} and {'a': [1,2,3]}, but not {'key': {'a': [1,2,3]} ...

RegEx for String.Format

Hiho everyone! :) I have an application, in which the user can insert a string into a textbox, which will be used for a String.Format output later. So the user's input must have a certain format: I would like to replace exactly one placeholder, so the string should be of a form like this: "Text{0}Text". So it has to contain at least on...

How to put braces in django templates?

I need to produce an id surrounded by braces ( for example "{1234}" ). With the django template language, braces are also used to start a variable substitution, so I have some trouble in obtaining what I want. I tried {{{ id }}} {{ '{'id'}' }} {{ '{'+id+'}' }} { {{ id }} } None of these methods work, except the last one, which unfortu...

How to jump to Next statement from For or For Each (like braces but in vb) in Visual Studio 2008

Does anyone know the keyboard shortcut to jump from the start of a For / For Each (or If, While, etc.) block to the end of it in visual studio if you're using vb.net? I found the following which I thought would work but doesn't : http://stackoverflow.com/questions/1501921/go-to-matching-brace-in-visual-studio Following the comment ther...

Matching innermost braces with regex or strpos?

I have a sort of mini parsing syntax I made up to help me streamline my view code in cakephp. Basically I have created a table helper which, when given a dataset and (optionally) a set of options for how to format the data will render out a table, as opposed to me looping though the data and editing it manually. It allows the user to be...

How come BraceMatch() doesn't work when a lexer is set in wxStyledTextCtrl?

I have the following chunk of C++ code that gets called when } is pressed: int iCurPos = GetCurrentPos(); InsertText(iCurPos,wxT("}")); int iPos = BraceMatch(iCurPos); This works fine (iPos gets the position of the matching brace) except when I call SetLexer(...) beforehand. Then it returns -1? How can I get it to work? Edit: I sho...

Emacs braces indentation

I can't for the life of me find any answer to this through conventional Internet means, so I'm hoping for some help. Emacs for me right now tends to do indentation on braces as follows: if( ... ) { } Which I find incredibly irritating; I've never even seen this behaviour anywhere else. At any rate, the behaviour I'm expecting i...

How can I extract a string between matching braces in Perl?

My input file is as below : HEADER {ABC|*|DEF {GHI 0 1 0} {{Points {}}}} {ABC|*|DEF {GHI 0 2 0} {{Points {}}}} {ABC|*|XYZ:abc:def {GHI 0 22 0} {{Points {{F1 1.1} {F2 1.2} {F3 1.3} {F4 1.4}}}}} {ABC|*|XYZ:ghi:jkl {JKL 0 372 0} {{Points {}}}} {ABC|*|XYZ:mno:pqr {GHI 0 34 0} {{Points {}}}} { ABC|*|XYZ:abc:pqr {GHI 0 68 0} ...

Is this valid Java code? My teacher claims it is, but I'm really not so sure.

Granted he didn't show us actual code here, just mentioned it, I found it extremely bizarre. For example, according to what he said this is valid Java: public class Person { String Name; int Age; { //These two braces just chilling together - VALID? :O } } ...

A regular expression that moves opening { braces to a new line, for C/C++/PHP/etc code

This kind of code structure makes, IMHO, code less readable: int func() { [...] } It's just a matter of taste, but I prefer this one: int func() { [...] } So I've trying to make a regular expression to apply in my text editor in order to make code in the first example look like the second one. I've come up with something lik...

Customizing the formatting output of .sass?

#foo { color:black; } Is there some sort of option to prefix a newline before the trailing } when a .css file is generated from .sass? I would appreciate it if someone included an example of combining sass --watch style.scss:style.css, which is what I'm using, along with this newline requirement. ...

Opening Curly Bracket (Brace) position on code

I'm used to write code (in C, Perl, or any language with curly brackets) like: Loops: for (int i = 0; i < 10; i++) { // <----- ... } Conditions: if (i == 10) { // <----- ... } Main: int main () { // <----- ... } Wherein I place the opening curly bracket right after the closing parenthesis. Yet, I see some templates ...

if/else format within while loop

while(true) { cout << "Name: "; getline(cin, Name); if(Name == "Stop") break; cout << "Additional Name - Y/N: "; getline(cin, additional); if (additional == "Y") cout << "Additional Name: "; getline(cin, Name2); else cout << "Location: "; getline(cin, Location); if(Location == "Stop") break; } chi...