Skip to content
This repository has been archived by the owner on Jan 17, 2018. It is now read-only.

real time client side parsing of regexp #37

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

Iftahh
Copy link

@Iftahh Iftahh commented Jan 16, 2013

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.


RepeatSpecFull: {
count: function() {
return

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)
}

@ForbesLindesay
Copy link

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

@Iftahh
Copy link
Author

Iftahh commented Feb 13, 2013

Thanks for the testing the fixes and for setting it up!

@Iftahh
Copy link
Author

Iftahh commented Feb 15, 2013

@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.

@ForbesLindesay
Copy link

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.

@javallone
Copy link
Owner

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.

@Iftahh
Copy link
Author

Iftahh commented Sep 21, 2013

Well, if you do the rendering in a Canvas instead of SVG then you can
easily export bitmap from it.

But then it will be more difficult to do the mouse hover on the nodes (see
the other pull request I added). Still possible just a bit more work.

On Sat, Sep 21, 2013 at 7:55 PM, Jeff Avallone [email protected]:

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.


Reply to this email directly or view it on GitHubhttps://github.com//pull/37#issuecomment-24866277
.

@ForbesLindesay
Copy link

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.

@jokeyrhyme
Copy link

Could be somewhat related to #35 ??

@jokeyrhyme jokeyrhyme mentioned this pull request Nov 18, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants