From: Simon Strandgaard Date: 2003-10-09T16:52:04+09:00 Subject: Re: Extension Language for a Text Editor Ryan Pavlik skrev i en nyhedsmeddelelse:20031008152310.7dff4411.rpav@mephle.com... > On Thu, 9 Oct 2003 07:10:42 +0900 > Simon Strandgaard wrote: > > > > I want to use same syntax as Ruby's regex, and perhaps extend it > > with some editor stuff, perhaps like: > > There seem to be simpler/more elegant solutions to these problems than > reimplementing pcre: Agree, it may be sufficiently to only replace "regex.c/re_search()" with something which can operate on an iterator-range. But I am not that strong in the internals of Ruby and I prefer C++ over C. I rather make a full-blown regex engine in Ruby than interfacing to GNU regex in C. It may take longer, but the reward is many: * exercise my regex knowledge. * a regex engine with Ruby license. I am not interested in doing what may be the easiest. I just do what I like :-) > > * how to traverse the datastructure, jump over folds, jump into > > folds. > > * regex on columnar selections. > > * mechanism for getting the syntax-state: perhaps a regex which > > only operates inside comments, apply regex to variable-names, etc. > > All three of these can easily be accomplished by providing constrained > input to the matcher. For folds etc, first you grab the pieces you > want (folds, no folds), then apply the re. For colums, same deal. > Extract the column, then apply. I'm sure you can guess where this is > going for the last one... extract and apply the regexp only to > comments or variable names. Your are talking about traversing, and you are absolutly right.. But I am talking about the syntax of the regex. Misunderstanding :-) [snip more text about traversing] BTW: I use many different kinds of iterators for traversing. > I'd say this is way simpler, more effective, and more extensible than > redefining all-new regexp syntax. Especially since the existing > syntax is hairy enough. ;-) Yes this isn't going to be easy. I am the kind of type which like hairy problems :-) -- Simon Strandgaard