jashkenas/coffee-script — pull request #3034 by marchaefner (2013-06-13 23:07:22+00:00)
Title: Better handling of initial indent at file start.

Better handling of initial indent at file start.

* Detect initial indentation before the first token and enforce it.

Throw an appropriate error if a token is less indented. This fixes #2981.

Note that under-indentation is _still_ possible for comments, strings and here-regexes.

* Don't add `INDENT` token (or the matching `OUTDENT, TERMINATOR`).

This avoids a different token stream for "base-indented" code, in particular literate code, which fixes #2955.

It would be possible to allow under-indented code (via a shrinkable `@baseIndent`), but i assume that a missing indentation is almost always by mistake.

This PR is an alternative to #2985 and basically the solution @Nami-Doc suggested in #2981 (except the weird errors, i hope).