Skip to content

Commit

Permalink
Improve Date.parse (#289)
Browse files Browse the repository at this point in the history
* Improve `Date.parse()`

- rewrite `Date.parse()` with separate parsers
- return `NaN` for out of bounds field values as specified
- add `js_tzabbr` and `string_get_tzabbr` to handle timezone abbreviations
- improve `string_get_milliseconds` readability
- accept up to 9 decimals for millisecond fraction but truncate at 3
- accept many more alternative date/time formats
- add test cases in **tests/test_builtin.js**
- produce readable output for `Date` objects in repl 
- use `JSON.stringify` to output `Date` and `string` values in **repl.js**
- remove `String.prototype.__quote`
- add `minimum_length` macro to specify argument array sizes (C99 except MSVC)
- v8.js: parse all environment variables and output them, update **v8.txt**
  • Loading branch information
chqrlie authored Mar 10, 2024
1 parent c61336c commit 648a8f5
Show file tree
Hide file tree
Showing 8 changed files with 11,002 additions and 10,829 deletions.
6 changes: 6 additions & 0 deletions cutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ static void *__builtin_frame_address(unsigned int level) {
#define container_of(ptr, type, member) ((type *)((uint8_t *)(ptr) - offsetof(type, member)))
#endif

#if !defined(_MSC_VER) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define minimum_length(n) static n
#else
#define minimum_length(n) n
#endif

typedef int BOOL;

#ifndef FALSE
Expand Down
20,981 changes: 10,521 additions & 10,460 deletions gen/repl.c

Large diffs are not rendered by default.

Loading

0 comments on commit 648a8f5

Please sign in to comment.