Prev: FAQ Topic - Internationalisation and Multinationalisation injavascript. (2010-03-23)
Next: HTML tags in textarea
From: nick on 28 May 2010 16:46 On May 28, 3:27 pm, Stefan Weiss <krewech...(a)gmail.com> wrote: > On 26/05/10 13:05, Thomas 'PointedEars' Lahn wrote: > > > WFM. In practice, automatically, as a post-commit hook. wc -l says 20 LOCs > > (counting the empty ones ;-)). > > I assume that's a hook for Subversion? I only ever used the hooks to set > permissions and send out email notices. What's the use case for removing > comments post commit? To get an accurate LOC count, remember? ;) > I gave up on my last attempt at writing a regex-based comment remover > for JavaScript (in Perl, not sed) after I realized I'd probably need a > proper parser. Would you mind posting your solution? I'd be interested in that too. Regarding to cpp and regex literals, I haven't run into any problems with it yet. Cpp complains about the regex in a warning message, but manages to deal with it. I suppose certain regex literals might trip it up while others don't.
From: Thomas 'PointedEars' Lahn on 30 May 2010 12:31 Stefan Weiss wrote: > Thomas 'PointedEars' Lahn wrote: >> Stefan Weiss wrote: >>> I suppose it's possible, in theory, to write a parser using sed, as >>> Thomas suggested, but it would be either very complex, or unsafe. >> WFM. In practice, automatically, as a post-commit hook. wc -l says 20 >> LOCs (counting the empty ones ;-)). > > I assume that's a hook for Subversion? Correct. > I only ever used the hooks to set permissions and send out email notices. > What's the use case for removing comments post commit? Not having most of the comments in the online sources, but in the local working copy and the repository. This reduces the size of the online sources (and their download time) by ca. 50% (depending on the documentation comments in the file), still keeps them readable and the development versions easily maintainable. > I gave up on my last attempt at writing a regex-based comment remover > for JavaScript (in Perl, not sed) after I realized I'd probably need a > proper parser. Would you mind posting your solution? It is available online at <http://PointedEars.de/bin/uncomment> for the time being. AISB, it leaves certain comments in because either they are intended to be left in or they cannot be recognized unambiguously (see the comments in the sed script). Suggestions welcome. (The part that is commented out in the bash script is the interactive solution which did not come in as handy to me as I thought. Maybe it does to you.) HTH PointedEars -- realism: HTML 4.01 Strict evangelism: XHTML 1.0 Strict madness: XHTML 1.1 as application/xhtml+xml -- Bjoern Hoehrmann
From: nick on 1 Jun 2010 05:39 On May 30, 12:31 pm, Thomas 'PointedEars' Lahn <PointedE...(a)web.de> wrote: > Stefan Weiss wrote: > > Thomas 'PointedEars' Lahn wrote: > > I gave up on my last attempt at writing a regex-based comment remover > > for JavaScript (in Perl, not sed) after I realized I'd probably need a > > proper parser. Would you mind posting your solution? > > It is available online at <http://PointedEars.de/bin/uncomment> for the time > being. AISB, it leaves certain comments in because either they are intended > to be left in or they cannot be recognized unambiguously (see the comments > in the sed script). Suggestions welcome. (The part that is commented out > in the bash script is the interactive solution which did not come in as > handy to me as I thought. Maybe it does to you.) That's a hell of a nice bash script, Pointy. What do you call this thing: ${...} ? I've never seen that used in some of the ways you used them here; I'd like to learn more about that. The sed script is pretty scary though... can't you wrap those regexps in quotes and get rid of most of the backslashes, or are sed script files different than running sed on the command line or from a bash script in that regard?
First
|
Prev
|
Pages: 1 2 3 4 Prev: FAQ Topic - Internationalisation and Multinationalisation injavascript. (2010-03-23) Next: HTML tags in textarea |