About: Highlighting source between matching curly braces   Sponge Permalink

An Entity of Type : owl:Thing, within Data Space : 134.155.108.49:8890 associated with source dataset(s)

The following ruby script generates a pattern (see below) used for highlighting a codesection from the curly brace under the cursor to the matching brace. It currently finds 12 recursions, you can generate larger patterns reaching deeper by changing the parameter (n=12) in method "generate". "a" and "b" are synonyms for the starting/ending brace, "x" holds the characters in between, if any. Using recursion, the original pattern "a(x)*b" is expanded to the monstrous pattern seen below. Append the following to your vimrc:

AttributesValues
rdfs:label
  • Highlighting source between matching curly braces
rdfs:comment
  • The following ruby script generates a pattern (see below) used for highlighting a codesection from the curly brace under the cursor to the matching brace. It currently finds 12 recursions, you can generate larger patterns reaching deeper by changing the parameter (n=12) in method "generate". "a" and "b" are synonyms for the starting/ending brace, "x" holds the characters in between, if any. Using recursion, the original pattern "a(x)*b" is expanded to the monstrous pattern seen below. Append the following to your vimrc:
Version
  • 6(xsd:integer)
dbkwik:vim/property/wikiPageUsesTemplate
Previous
  • 753(xsd:integer)
Category
  • Syntax
  • LanguageSpecific
Text
  • Rainbow Parenthsis Bundle : Colors Parenthsis
Author
  • joerga
Complexity
  • basic
Created
  • 2004-06-26(xsd:date)
ID
  • 754(xsd:integer)
  • 1561(xsd:integer)
NEXT
  • 755(xsd:integer)
Rating
  • -1(xsd:integer)
abstract
  • The following ruby script generates a pattern (see below) used for highlighting a codesection from the curly brace under the cursor to the matching brace. It currently finds 12 recursions, you can generate larger patterns reaching deeper by changing the parameter (n=12) in method "generate". # ruby script def next_iteration(text) text.gsub( /#{Regexp.quote("a%(x)*b")}/, "a%(%(a%(x)*b)|%(x))*b" ) end def generate( text, n ) 1.upto(n){ |i| text = next_iteration( text ) } text end def to_pattern(text) text.gsub(/x/,"\ |[^ab]").gsub(/a/,"\\{").gsub(/b/,"\\}") end ax = generate("a%(x)*b", 12).sub(/b$/,"") # a = starting brace, b = ending brace, x = characters in between puts to_pattern( "/\\v%(%##{ax}b)|%(#{ax}%#b)/" ) "a" and "b" are synonyms for the starting/ending brace, "x" holds the characters in between, if any. Using recursion, the original pattern "a(x)*b" is expanded to the monstrous pattern seen below. Note: Use %() for grouping in the pattern, as the normal (captivating) variant cannot be used that often in one pattern. Append the following to your vimrc: highlight ShowMatches guibg=darkgrey guifg=white au! Cursorhold * exe 'match ShowMatches /\v%(%#\{%(%(\{%(%(\{%(%(\{%(%(\{%(%(\{%(%(\{%(%(\{%(%(\{%(%(\{%(%(\{%(%(\{%(%(\{%( |[^\{\}])*\})|%( |[^\{\}]))*\})|%( |[^\{\}]))*\})|%( |[^\{\}]))*\})|%( |[^\{\}]))*\})|%( |[^\{\}]))*\})|%( |[^\{\}]))*\})|%( |[^\{\}]))*\})|%( |[^\{\}]))*\})|%( |[^\{\}]))*\})|%( |[^\{\}]))*\})|%( |[^\{\}]))*\})|%( |[^\{\}]))*\})|%(\{%(%(\{%(%(\{%(%(\{%(%(\{%(%(\{%(%(\{%(%(\{%(%(\{%(%(\{%(%(\{%(%(\{%(%(\{%( |[^\{\}])*\})|%( |[^\{\}]))*\})|%( |[^\{\}]))*\})|%( |[^\{\}]))*\})|%( |[^\{\}]))*\})|%( |[^\{\}]))*\})|%( |[^\{\}]))*\})|%( |[^\{\}]))*\})|%( |[^\{\}]))*\})|%( |[^\{\}]))*\})|%( |[^\{\}]))*\})|%( |[^\{\}]))*\})|%( |[^\{\}]))*%#\})/' set ut=30 Up to now, creating a pattern for mixing curly braces and brackets hasn't been very successful. The resulting patterns grow far too fast.
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software