-
Notifications
You must be signed in to change notification settings - Fork 219
real time client side parsing of regexp #37
base: master
Are you sure you want to change the base?
Conversation
|
||
RepeatSpecFull: { | ||
count: function() { | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line causes an error, should be:
return {
start: parseInt(this.start.textValue),
stop: parseInt(this.stop.textValue)
}
With the above fixes (and a slight special casing for long regexps) this is deployed to my fork at http://regexplained.co.uk/ Thanks for doing all the hard work |
Thanks for the testing the fixes and for setting it up! |
@ForbesLindesay - I updated the code to include the other feature I've suggested - highlight by hover. Would be great if you merge and deploy it also. |
Would be cool to see as a separate pull request to https://github.com/ForbesLindesay/regexplained.co.uk as the code is pretty different (I've used a simple module system rather than your wacky dependency injection thingy and because you've used). The other point I'd make is that we ought to be able to highlight the regex in the initial text-box, rather than displaying a separate copy of the regex. |
Thank you for the contribution. I'm not going to merge this at this time, but I am going to keep it around. I was actually talking about how the processing on Regexper was split between server and client with a co-worker recently (and even that this change has been sitting in the pull requests). We were talking about the pros and cons of doing all the processing server-side vs. client-side. I might actually update the site to do all the processing server-side since that would lead to sending a bitmapped image to the client (as a PNG probably). This makes it much easier to save the image and embed it in other documents, which may be more useful than the instant processing that client-side rendering provides. I'm still thinking about the best course of action. |
Well, if you do the rendering in a Canvas instead of SVG then you can But then it will be more difficult to do the mouse hover on the nodes (see On Sat, Sep 21, 2013 at 7:55 PM, Jeff Avallone [email protected]:
|
For regexplained I now have a version that renders everything to an SVG string rather than using raphael. It's actually a lot faster and it makes it possible to use SVG on the server. As an added bonus, the renderer could easilly be sapped out to use Canvas instead of SVG at some point. |
Could be somewhat related to #35 ?? |
I used javascrsipt peg parser (called canopy) to parse the regexp in javascript - so no ruby is needed.
I had to do some minor changes to allow simple static file serving - such as removed require.js and moved /public into /app
I think its possible to put require.js back, but I don't have much experience with it so I'm leaving it as is.