LearnBoost/stylus — Issue #442: Should Single Line Comments Emit "comment" Token?
Author: JosephPecoraro
Created: 2011-10-23 09:09:53+00:00
State: open

Looking at `Lexer.prototype.comment` Single line comments don't emit a "comment" token, but Multi line comments do. I suppose if it isn't used right now, and since CSS comments are traditionally not single line, this is fine. But might be useful for completeness or if others want to write a non-compressing prettifier which converts single-line comments to valid css comments. Easy to implement, but if it sounds like a waste just ignore this issue.

Inspect the Lexer for Single-line and Multi-line comments:

```javascript
var stylus = require('../lib/stylus')
var parser = new stylus.Parser('// test');
var debug = parser.lexer.inspect();
["// Test", "/* Test */"].forEach(function(x) {
var parser = new stylus.Parser(x);
console.log(parser.lexer.inspect());
});
```

Produces:

```text
[Token:1 eos]
[Token:1 comment { lineno: undefined,
str: '/* Test */',
suppress: true }]
[Token:1 eos]
```

Expected some token for the single-line comment.