[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [StrongED] Re: S & R query



In message <83510cbc56.harriet@xxxxxxxxxxxxxxxx>
          Harriet Bazley <lists@xxxxxxxxxxxxxxxxxx> wrote:

> On 15 Jan 2018 as I do recall,
>           Fred Graute  wrote:
> 
> > In message <ab3d5fba56.harriet@xxxxxxxxxxxxxxxx>
> >           Harriet Bazley <lists@xxxxxxxxxxxxxxxxxx> wrote:
> 
> [snip]
> 
> 
> > > I don't understand the 'bracketed blocks of text' section - how is this
> > > distinguished from the previously described uses of braces and round
> > > brackets for a very different purpose?
> >
> > Block shorthands are escaped with '\' to distinguish them from their
> > regular forms which have a different meaning, so it's \( and \{.
> >
> > Richard is working from the text extracted from the StrongED manual
> > using Chris Morison's tools. For some reason it exported the '\\\{'
> > from the manual as '{' rather than '\{'.
> 
> Aha!  Yes, that was it.
> 
> An example would be helpful too I think:  does the search just skip over all
> material until it finds the closing bracket, then look for the next
> character in the search string, e.g. "func\{local" as a search string would
> not match "func{fruit, peel,  local1}" but would match "func{fruit, peel}
> local slices=nil"?

Yes, that's correct. "func\{local" would need to be ("func" \{ "local")
or ("func" \{ \n "local") though (can't tell which because of hardwrap).
You can't use \{ inside a string.

Both \{ and \( take advantage of the bracket matching code meaning that
nesting is taken into account. Brackets inside comments and strings are
ignored.

They came about when I was wondering if it would be possible to create a
advanced search expression that could match function definitions in C.

With the help of \{ this was reasonably successful but the internal code
still handled some things better, most notably in C++.

If anyone is interested in the rather complicated result, here it is:

Search
  FuncType   < {{'\t *'} {\i}+ {\s} ~"("}+ {\s} {'*'} {\s}
  Function   FuncType {"("} @0 {\i}+ @9 {")"} {\s} {\( {" "}}+ ~";" ** \{
End

> Is the closing bracket not specified in the search string?

The closing bracket is taken to be the same type as the opening bracket,
so \{ -> } and \( -> ).

Cheers,
Fred.

-- 
StrongED Developer
http://www.stronged.iconbar.com/

-- 
To unsubscribe send a mail to StrongED+unsubscribe@xxxxxxxxxxx
List archives and instructions at
http://diy.Torrens.org/RO/StrongED/index.html