1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00
jashkenas--coffeescript/documentation/examples
Geoffrey Booth 6d21dc5495 [CS2] Comments (#4572)
* Make `addLocationDataFn` more DRY

* Style fixes

* Provide access to full parser inside our custom function running in parser.js; rename the function to lay the groundwork for adding data aside from location data

* Fix style.

* Fix style.

* Label test comments

* Update grammar to remove comment tokens; update DSL to call new helper function that preserves comments through parsing

* New implementation of compiling block comments: the lexer pulls them out of the token stream, attaching them as a property to a token; the rewriter moves the attachment around so it lives on a token that is destined to make it through to compilation (and in a good placement); and the nodes render the block comment. All tests but one pass (commented out).

* If a comment follows a class declaration, move the comment inside the class body

* Style

* Improve indentation of multiline comments

* Fix indentation for block comments, at least in the cases covered by the one failing test

* Don’t reverse the order of unshifted comments

* Simplify rewriter’s handling of comments, generalizing the special case

* Expand the list of tokens we need to avoid for passing comments through the parser; get some literal tokens to have nodes created for them so that the comments pass through

* Improve comments; fix multiline flag

* Prepare HereComments for processing line comments

* Line comments, first draft: the tests pass, but the line comments aren’t indented and sometimes trail previous lines when they shouldn’t; updated compiler output in following commit

* Updated compiler, now with line comments

* `process` doesn’t exist in the browser, so we should check for its existence first

* Update parser output

* Test that proves #4290 is fixed

* Indent line comments, first pass

* Compiled output with indented line comments

* Comments that start a new line shouldn’t trail; don’t skip comments attached to generated tokens; stop looking for indentation once we hit a newline

* Revised output

* Cleanup

* Split “multiline” line comment tokens, shifting them forward or back as appropriate

* Fix comments in module specifiers

* Abstract attaching comments to a node

* Line comments in interpolated strings

* Line comments can’t be multiline anymore

* Improve handling of blank lines and indentation of following comments that start a new line (i.e. don’t trail)

* Make comments compilation more object-oriented

* Remove lots of dead code that we don’t need anymore because a comment is never a node, only a fragment

* Improve eqJS helper

* Fix #4290 definitively, with improved output for arrays with interspersed block comments

* Add support for line comments output interspersed within arrays

* Fix mistake, don’t lose the variable we’re working on

* Remove redundant replacements

* Check for indentation only from the start of the string

* Indentations in generated JS are always multiples of two spaces (never tabs) so just look for 2+ spaces

* Update package versions; run Babel twice, once for each preset, temporarily until a Babili bug is fixed that prevents it from running with the env preset

* Don’t rely on `fragment.type`, which can break when the compiler is minified

* Updated generated docs and browser compiler

* Output block comments after function arguments

* Comments appear above scope `var` declarations; better tracking of generated `JS` tokens created only to shepherd comments through to the output

* Create new FuncGlyph node, to hold comments we want to output near the function parameters

* Block comments between `)` and `->`/`=>` get output between `)` and `{`.

* Fix indentation of comments that are the first line inside a bare mode block

* Updated output

* Full Flow example

* Updated browser compiler

* Abstract and organize comment fragment generation code; store more properties on the comment fragment objects; make `throw` behave like `return`

* Abstract token insertion code

* Add missing locationData to STRING_START token, giving it the locationData of the overall StringWithInterpolations token so that comments attached to STRING_START end up on the StringWithInterpolations node

* Allow `SUPER` tokens to carry comments

* Rescue comments from `Existence` nodes and `If` nodes’ conditions

* Rescue comments after `\` line continuation tokens

* Updated compiled output

* Updated browser compiler

* Output block comments in the same `compileFragments` method as line comments, except for inline block comments

* Comments before splice

* Updated browser compiler

* Track compiledComments as a property of Base, to ensure that it’s not a global variable

* Docs: split up the Usage section

* Docs for type annotations via Flow; updated docs output

* Update regular comments documentation

* Updated browser compiler

* Comments before soak

* Comments before static methods, and probably before `@variable =` (this) assignments generally

* Comments before ‘if exists?’, refactor comment before ‘if this.var’ to be more precise, improve helper methods

* Comments before a method that contains ‘super()’ should output above the method property, not above the ‘super.method()’ call

* Fix missing comments before `if not` (i.e. before a UNARY token)

* Fix comments before ‘for’; add test for comment before assignment if (fixed in earlier commit)

* Comments within heregexes

* Updated browser compiler

* Update description to reflect what’s now happening in compileCommentFragments

* Preserve blank lines between line comments; output “whitespace-only” line comments as blank lines, rather than `//` following by whitespace

* Better future-proof comments tests

* Comments before object destructuring; abstract method for setting comments aside before compilation

* Handle more cases of comments before or after `for` loop declaration lines

* Fix indentation of comments preceding `for` loops

* Fix comment before splat function parameter

* Catch another RegexWithInterpolations comment edge case

* Updated browser compiler

* Change heregex example to one that’s more readable; update output

* Remove a few last references to the defunct HERECOMMENT token

* Abstract location hash creation into a function

* Improved clarity per code review notes

* Updated browser compiler
2017-08-02 19:34:34 -07:00
..
aliases.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
array_comprehensions.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
array_spread.coffee 2.0.0-beta3 (#4594) 2017-06-30 09:58:05 -07:00
async.coffee Relocate example per new folder structure; update per final notes 2016-11-22 21:53:03 -08:00
breaking_change_bound_generator_function.coffee Update docs for classes, breaking changes (#4438) 2017-02-09 08:50:11 -08:00
breaking_change_destructuring_default_values.coffee [CS2] 2.0.0-beta1 docs (#4494) 2017-04-09 23:07:58 -07:00
breaking_change_fat_arrow.coffee 2.0.0-beta3 (#4594) 2017-06-30 09:58:05 -07:00
breaking_change_function_parameter_default_values.coffee Update docs for classes, breaking changes (#4438) 2017-02-09 08:50:11 -08:00
breaking_change_super_in_non-class_methods_refactor_with_apply.coffee [CS2] Docs updates (#4536) 2017-05-05 19:44:11 -07:00
breaking_change_super_in_non-class_methods_refactor_with_class.coffee Update docs for classes, breaking changes (#4438) 2017-02-09 08:50:11 -08:00
breaking_change_super_with_arguments.coffee Update docs for classes, breaking changes (#4438) 2017-02-09 08:50:11 -08:00
breaking_change_super_without_arguments.coffee Update docs for classes, breaking changes (#4438) 2017-02-09 08:50:11 -08:00
cake_tasks.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
chaining.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
classes.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
comment.coffee [CS2] Comments (#4572) 2017-08-02 19:34:34 -07:00
comparisons.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
conditionals.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
constructor_destructuring.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
default_args.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
do.coffee [CS2] Docs updates (#4536) 2017-05-05 19:44:11 -07:00
embedded.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
embedded_block.coffee Docs for triple-backticks and escaping backticks (#4369) 2016-11-22 22:09:35 -08:00
embedded_escaped.coffee Docs for triple-backticks and escaping backticks (#4369) 2016-11-22 22:09:35 -08:00
existence.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
existence_declared.coffee [CS2] Docs updates (#4536) 2017-05-05 19:44:11 -07:00
existence_undeclared.coffee [CS2] Docs updates (#4536) 2017-05-05 19:44:11 -07:00
expansion.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
expressions.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
expressions_assignment.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
expressions_comprehension.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
expressions_try.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
fat_arrow.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
functions.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
generator_iteration.coffee Docs for for…from (#4368) 2016-11-22 09:30:39 -08:00
generators.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
get_set.coffee Merge unsupported let/const and get/set sections, shorten 2017-04-02 22:52:37 -07:00
heredocs.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
heregexes.coffee [CS2] Comments (#4572) 2017-08-02 19:34:34 -07:00
interpolation.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
jsx.coffee [CS2] JSX documentation, Try CoffeeScript improvements (#4583) 2017-06-25 23:53:35 -07:00
modules.coffee Remove hyphen in coffee-script 2017-02-12 17:00:05 -08:00
modulo.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
multiple_return_values.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
object_comprehensions.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
object_extraction.coffee Show a simple object extraction before complex one 2017-01-04 16:06:25 -05:00
object_spread.coffee 2.0.0-beta3 (#4594) 2017-06-30 09:58:05 -07:00
objects_and_arrays.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
objects_reserved.coffee Modernize various sections as relevant to v2; improve presentation of tables 2016-12-19 22:27:32 -08:00
objects_shorthand.coffee Docs shorthand object notation (#4356) 2016-11-20 23:04:49 -08:00
overview.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
parallel_assignment.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
patterns_and_splats.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
prototypes.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
range_comprehensions.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
scope.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
slices.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
soaks.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
splats.coffee 2.0.0-beta3 (#4594) 2017-06-30 09:58:05 -07:00
splices.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
static.coffee Update docs for classes, breaking changes (#4438) 2017-02-09 08:50:11 -08:00
strings.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
switch.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
switch_with_no_expression.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
tagged_template_literals.coffee Docs for tagged template literals (#4372) 2016-11-26 19:28:43 -08:00
try.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00
type_annotations.coffee [CS2] Comments (#4572) 2017-08-02 19:34:34 -07:00
while.coffee Docs improvements (#4367) 2016-11-20 17:05:19 -08:00