Commit Graph

4855 Commits

Author SHA1 Message Date
Geoffrey Booth
0045cb21ba Colons are apparently another token type that doesn't survive passing through the parser, so rescue any comments attached to colons 2019-12-30 01:04:30 -08:00
Geoffrey Booth
3e7c570679 AST (#5273)
AST
2019-12-29 22:31:05 -08:00
Julian Rosse
a34c0c9502 Return Root from nodes() (#5274)
* return Root from nodes()

* add children
2019-12-29 21:17:32 -08:00
Geoffrey Booth
2ab714b4fe Merge branch 'master' into ast
# Conflicts:
#	lib/coffeescript/lexer.js
#	lib/coffeescript/parser.js
#	src/lexer.coffee
#	test/jsx.coffee
#	test/numeric_literal_separators.coffee
2019-12-29 17:00:06 -08:00
Geoffrey Booth
56eec0bc4e AST: Update with latest changes from master (#5270)
* Fix #5213: Update Babel options to restore MINIFY=false (#5214)

* CSX namespaced tags and attributes (#5218)

* Support namespaces in attributes

* Support namespaces in tag names

* Support reserved words in CSX boolean properties (fix #5125)

* Implement review comments

* Build

* Revert parser.js

* Add debugging information to error message test (#5239)

One of the test cases in test/error_messages.coffee fails intermittently
in the Node.js ecosystem-testing tool CITGM. In an effort to help debug
what's going on when this occurs, this adds more information to the
AssertionError message in question.

* Fix #5103: Add support for BigInt literals (#5104)

* Fix #5103: Add support for BigInt literals

* Fix typos found in testing

* Support binary, octal and hex BigInt literals

* Make decimal BigInt test consistent other bases

* Correct test BigInt test names

* Add Node versions to CI

* Numeric literal separators (#5215)

* implement numeric literal separators

* add tests

* Revert changes to package-lock.json

* small regex adjustment

* split tests

* add comment

* Add Node versions to CI

* Fix #5103: Add support for BigInt literals (#5104)

* Fix #5103: Add support for BigInt literals

* Fix typos found in testing

* Support binary, octal and hex BigInt literals

* Make decimal BigInt test consistent other bases

* Correct test BigInt test names

* Add Node versions to CI

* Update output

* Fix style

* support bigint literal with separators

* un-disallow property access on number literal

* Update output

* Refactor numeric literal separator tests to be more like the rest of the tests

* Add test for numeric property with underscore

Co-authored-by: Geoffrey Booth <GeoffreyBooth@users.noreply.github.com>
Co-authored-by: Robert de Forest <guitar.robot@gmail.com>

Co-authored-by: Erik Demaine <edemaine@mit.edu>
Co-authored-by: Rich Trott <rtrott@gmail.com>
Co-authored-by: Robert de Forest <guitar.robot@gmail.com>
Co-authored-by: square <Inve1951@users.noreply.github.com>
2019-12-29 16:55:33 -08:00
Julian Rosse
f528e5e754 AST: numeric separators, BigInt (#5272)
* Revert to more complicated lexing of numbers, as the Number constructor can't handle BigInts or numbers with numeric separators

* Add debugging information to error message test (#5239)

One of the test cases in test/error_messages.coffee fails intermittently
in the Node.js ecosystem-testing tool CITGM. In an effort to help debug
what's going on when this occurs, this adds more information to the
AssertionError message in question.

* Fix #5103: Add support for BigInt literals (#5104)

* Fix #5103: Add support for BigInt literals

* Fix typos found in testing

* Support binary, octal and hex BigInt literals

* Make decimal BigInt test consistent other bases

* Correct test BigInt test names

* Add Node versions to CI

* Numeric literal separators (#5215)

* implement numeric literal separators

* add tests

* Revert changes to package-lock.json

* small regex adjustment

* split tests

* add comment

* Add Node versions to CI

* Fix #5103: Add support for BigInt literals (#5104)

* Fix #5103: Add support for BigInt literals

* Fix typos found in testing

* Support binary, octal and hex BigInt literals

* Make decimal BigInt test consistent other bases

* Correct test BigInt test names

* Add Node versions to CI

* Update output

* Fix style

* support bigint literal with separators

* un-disallow property access on number literal

* Update output

* Refactor numeric literal separator tests to be more like the rest of the tests

* Add test for numeric property with underscore

Co-authored-by: Geoffrey Booth <GeoffreyBooth@users.noreply.github.com>
Co-authored-by: Robert de Forest <guitar.robot@gmail.com>

* Update test style and output

* numeric separator parsed value

* BigInt AST; parseNumber()

Co-authored-by: Geoffrey Booth <GeoffreyBooth@users.noreply.github.com>
Co-authored-by: Rich Trott <rtrott@gmail.com>
Co-authored-by: Robert de Forest <guitar.robot@gmail.com>
Co-authored-by: square <Inve1951@users.noreply.github.com>
2019-12-29 16:20:43 -08:00
Geoffrey Booth
bdcb2c73af Revert to more complicated lexing of numbers, as the Number constructor can't handle BigInts or numbers with numeric separators (#5269) 2019-12-29 15:41:01 -08:00
square
9b37f16f11 Numeric literal separators (#5215)
* implement numeric literal separators

* add tests

* Revert changes to package-lock.json

* small regex adjustment

* split tests

* add comment

* Add Node versions to CI

* Fix #5103: Add support for BigInt literals (#5104)

* Fix #5103: Add support for BigInt literals

* Fix typos found in testing

* Support binary, octal and hex BigInt literals

* Make decimal BigInt test consistent other bases

* Correct test BigInt test names

* Add Node versions to CI

* Update output

* Fix style

* support bigint literal with separators

* un-disallow property access on number literal

* Update output

* Refactor numeric literal separator tests to be more like the rest of the tests

* Add test for numeric property with underscore

Co-authored-by: Geoffrey Booth <GeoffreyBooth@users.noreply.github.com>
Co-authored-by: Robert de Forest <guitar.robot@gmail.com>
2019-12-28 17:02:40 -08:00
Julian Rosse
26351096a6 AST: interpolated string is computed key (#5267)
* interpolated string key is computed

* lhs test
2019-12-22 15:47:24 -08:00
Julian Rosse
a091bb82f9 AST: splat param location data (#5266)
* handle assignment to nested nontrailing splat

* splat param location data
2019-12-17 23:19:09 -08:00
Julian Rosse
a6d4bf1982 handle assignment to nested nontrailing splat (#5265) 2019-12-17 23:18:27 -08:00
Julian Rosse
0e51cdaccd AST: allow assignment to nontrailing splat (#5263)
* allow assignment to nontrailing splat

* allow assignment to empty array

* complex object splat

* add explanatory comment
2019-12-16 17:18:26 -08:00
Julian Rosse
d4b7bd3a1f AST: fix interpolated regex tokens (#5262)
* this property

* clean up AST tests

* updated grammar

* export location data

* export default class location data

* fix interpolated regex tokens
2019-12-16 14:14:23 -08:00
Julian Rosse
559e735994 AST: clean up AST tests (#5261)
* this property

* clean up AST tests

* updated grammar

* export location data

* export default class location data
2019-12-16 14:13:54 -08:00
Julian Rosse
09caa217c2 AST: test compile errors (#5260)
* multiple splats error

* delete operand; catch variable

* disallow multiple splats

* unassignable conditional

* lone expansion param

* class bodies pure statements/arguments

* remove duplicate

* getAndCheckSplatProps()

* getAndCheckSplatsAndExpansions()

* clean up disallowLoneExpansionAndMultipleSplats()
2019-12-16 00:16:55 -05:00
Julian Rosse
a35df430db AST: throw expected error messages (#5259)
* working through error messages

* import/export errors

* param assignability

* super

* non-top-level import TODO comment
2019-12-14 17:32:24 -05:00
Julian Rosse
05d45e9b27 astAsBlockIfNeeded(); eachName checkAssignability (#5258)
👍
2019-12-09 14:36:10 -08:00
Julian Rosse
69521b97ce AST: comment after semicolon (#5257)
* astNode()

* no override ast()

* add suggested comments

* astInitialize()

* astAddReturns()

* separate step

* recognize quoted constructor

* add params to scope

* object colon location data

* mark generated JSX tokens

* more generated tokens

* preserve comment after semicolon

* move comments

* Add explanation for token seeming mismatch
2019-12-08 16:18:00 -08:00
Julian Rosse
c7e538a624 AST: token cleanups (#5256)
* astNode()

* no override ast()

* add suggested comments

* astInitialize()

* astAddReturns()

* separate step

* recognize quoted constructor

* add params to scope

* object colon location data

* mark generated JSX tokens

* more generated tokens

* Add explanation for token seeming mismatch
2019-12-08 15:36:59 -08:00
Julian Rosse
44be72a4d9 AST: object colon location data (#5253)
* astNode()

* no override ast()

* add suggested comments

* astInitialize()

* astAddReturns()

* separate step

* recognize quoted constructor

* add params to scope

* object colon location data
2019-12-08 14:41:15 -08:00
Julian Rosse
9cfcf8623c AST: add params to scope (#5252)
* astNode()

* no override ast()

* add suggested comments

* astInitialize()

* astAddReturns()

* separate step

* recognize quoted constructor

* add params to scope
2019-12-08 14:41:02 -08:00
Julian Rosse
25c23786af AST: recognize quoted constructor (#5251)
* astNode()

* no override ast()

* add suggested comments

* astInitialize()

* astAddReturns()

* separate step

* recognize quoted constructor
2019-12-08 14:40:23 -08:00
Julian Rosse
47bf5d962b AST: mark implicit returns (#5255)
* astNode()

* no override ast()

* add suggested comments

* astInitialize()

* astAddReturns()

* separate step
2019-12-08 13:37:58 -08:00
Julian Rosse
a30e6807b1 add mark argument to makeReturn (#5254) 2019-12-06 14:54:30 -08:00
Julian Rosse
d735c81da0 Location data: compensate for stripped characters (#5249)
* location data compensations

* previous lines compensation
2019-12-01 12:26:10 -08:00
Julian Rosse
f56515b100 Compound assign location data (#5248)
* Assign declaration

* For

* Class

* import/export

* params

* Catch

* compound assign location data
2019-11-30 18:51:48 -08:00
Julian Rosse
74d6635f95 AST: declarations (#5247)
* Assign declaration

* For

* Class

* import/export

* params

* Catch
2019-11-30 18:49:10 -08:00
Julian Rosse
e8d0deae78 AST: expose tokens (#5246)
* respect withTokens option

* attach tokens to ast
2019-11-30 13:35:04 -08:00
Julian Rosse
95d6ec7492 handle empty program AST (#5245)
Looks good!
2019-11-28 16:31:10 -08:00
Robert de Forest
09c95394e1 Fix #5103: Add support for BigInt literals (#5104)
* Fix #5103: Add support for BigInt literals

* Fix typos found in testing

* Support binary, octal and hex BigInt literals

* Make decimal BigInt test consistent other bases

* Correct test BigInt test names

* Add Node versions to CI
2019-11-26 21:15:03 -08:00
Rich Trott
ddb5dac49d Add debugging information to error message test (#5239)
One of the test cases in test/error_messages.coffee fails intermittently
in the Node.js ecosystem-testing tool CITGM. In an effort to help debug
what's going on when this occurs, this adds more information to the
AssertionError message in question.
2019-10-18 11:03:16 -07:00
Julian Rosse
265b251a7d AST comments: include in blocks; heregex comments (#5233)
* simple trailing comment

* multiple trailing tests

* fix rebase

* leading comments

* empty block

* nested dedented comment

* check preceding

* trailing implicit call in condition

* don't include heregex comments in AST

* expose heregex comments in AST

* heregex comment location data

* don't use object spread
2019-08-24 01:10:08 -07:00
Julian Rosse
7539f7af2e Reconcile ast branch with Prettier plugin: part 2 (#5234)
* pass level

* assign always expression

* escaped backticks in PassthroughLiteral

* computed class properties
2019-08-18 17:30:24 -07:00
Julian Rosse
2f27225e8c JSX namespaced name AST (#5231)
* opening element

* closing element
2019-07-30 17:58:51 -07:00
Julian Rosse
99ad0cc16c Merge master into ast (#5230)
* Fix #5213: Update Babel options to restore MINIFY=false (#5214)

* CSX namespaced tags and attributes (#5218)

* Support namespaces in attributes

* Support namespaces in tag names

* Support reserved words in CSX boolean properties (fix #5125)

* Implement review comments

* Build

* Revert parser.js
2019-07-29 17:49:22 -07:00
Erik Demaine
70c2c4706f CSX namespaced tags and attributes (#5218)
* Support namespaces in attributes

* Support namespaces in tag names

* Support reserved words in CSX boolean properties (fix #5125)

* Implement review comments

* Build

* Revert parser.js
2019-07-29 14:54:57 -07:00
Julian Rosse
9d1af43c91 Start reconciling ast branch with Prettier plugin (#5228)
* export IDENTIFIER

* leading comment + directive

* function hasIndentedBody

* missing o

* Sequence

* root location data with leading comment

* empty interpolations

* fixes from code review
2019-07-29 09:07:10 -07:00
Julian Rosse
c6fdde8834 Chained comparison AST (#5225)
* chained comparison AST

* Explicit return

Co-Authored-By: Geoffrey Booth <GeoffreyBooth@users.noreply.github.com>
2019-07-24 07:11:42 -07:00
Julian Rosse
0174ee082c super AST (#5226) 2019-07-23 16:01:12 -07:00
Julian Rosse
82b7bd3a92 use OptionalMemberExpression/OptionalCallExpression (#5224) 2019-07-21 21:51:46 -07:00
Julian Rosse
1f22c16bee Basic comments AST; PassthroughLiteral AST (#5220)
* passing existing tests

* comments ast

* fixes from code review
2019-07-21 18:05:05 -07:00
Julian Rosse
f33d4dd4f1 Compile heredocs to template literals (#5211)
* compile heredocs to template literals

* disallow pseudo-octal escapes

* extend existing guard against continuations looking like octal escapes

* convert trailing null escapes

* nicer pattern for conditional heregex chunks

* remove covered test
2019-05-15 16:13:59 -07:00
Geoffrey Booth
9c913f86fa Fix #5213: Update Babel options to restore MINIFY=false (#5214) 2019-05-15 15:37:09 -07:00
Julian Rosse
f0bb59790a Directive AST (#5209)
* directive AST

* heredoc AST

* updates from code review
2019-05-05 21:07:04 -07:00
Julian Rosse
391fcc4afa Class AST: bound/computed properties, executable body (#5208)
* executable class body aST

* tests for bound/computed

* remove

* computed
2019-04-29 13:42:36 -07:00
Julian Rosse
7b2fb18a0b Class prototype property AST (#5205)
* class prototype property AST

* consistent naming

* extract fix for #5204
2019-04-28 16:54:59 -07:00
Geoffrey Booth
5596a5c209 Merge branch 'master' of github.com:jashkenas/coffeescript into ast
# Conflicts:
#	lib/coffeescript/grammar.js
#	lib/coffeescript/parser.js
2019-04-28 16:27:26 -07:00
Julian Rosse
71750554c3 Allow computed class properties (#5206)
* fix broken JS output

* static computed properties
2019-04-28 15:45:57 -07:00
Julian Rosse
0574b664e8 Fix #5201: allow leading breaking elision (#5202)
* allow simple breaking elision

* add tests

* use OptComma

* more tests

* trigger CI
2019-04-22 10:21:37 -07:00
Julian Rosse
ca0ac814b3 parse array ending in empty function (#5200) 2019-04-18 15:36:04 -07:00