jsstyle icon indicating copy to clipboard operation
jsstyle copied to clipboard

Regexes treated as comments?

Open thekvn opened this issue 13 years ago • 2 comments

Error: missing blank before close comment on:

server.all(/.*/, function (req, res, next) {
  req.sdc = server.clients;
  next();
});

and

server.get(/\/.*/, function (req, res) {
  res.render('index');
});

thekvn avatar Feb 20 '12 15:02 thekvn

The usual workaround is to add a /* JSSTYLED */ comment on the previous line (which is not to say this couldn't be improved).

davepacheco avatar Feb 20 '12 16:02 davepacheco

This would be really nice to have fixed. This is kind of obnoxious to work around with if/else blocks of regex's. For example, each line below results in an error from jsstlye (and yes, you can use BEGIN - END, but still).

0                 } else if (/^;; QUESTION SECTION:/.test(l)) {
51                         section = 'question';
52                 } else if (/^;; ANSWER SECTION:/.test(l)) {
53                         section = 'answer';
54                 } else if (/^;; ADDITIONAL SECTION:/.test(l)) {
55                         section = 'additional';
56                 } else if (/^;; AUTHORITY SECTION:/.test(l)) {
57                         section = 'authority';
58                 }
59 
60                 if (section === 'question') {
61                         if (/^;([A-Za-z0-9])*\./.test(l)) {
62                                 results.question =
63                                         l.match(/([A-Za-z0-9_\-\.])+/)[0];
64                         }
65                 }
66 
67                 if (section === 'answer') {
68                         if (/^([_A-Za-z0-9])+/.test(l)) {
69                                 var tokens = l.match(/(.*)/)[0].split(/\t/);

mcavage avatar Jun 01 '12 20:06 mcavage