Tor Andersson
9f3e141d80
Fix typo in lexlinecomment where it did not detect EOF properly.
2020-06-25 13:29:53 +02:00
Tor Andersson
0261579d78
Support embedded 0 in strings by using modified UTF-8.
2020-05-27 12:32:32 +02:00
Tor Andersson
603977ae5b
Add repr() function to shell, and use it in the REPL.
2019-03-22 14:00:20 +01:00
Tor Andersson
28643e6afb
Bug 697891: Parse all JSON string escapes.
2019-01-23 12:53:25 +01:00
Tor Andersson
45208d7331
Be stricter when parsing JSON strings.
...
JSON strings must use double quotes, and only support a subset of
character escapes.
2017-04-03 12:31:11 +02:00
Tor Andersson
dbeda99b66
Fix JSON number parsing.
...
We were using too relaxed number parsing rules, and we didn't support
an initial sign character.
Also detect missing exponent in regular number parsing.
2017-04-03 12:10:13 +02:00
Tor Andersson
129dff49d5
Silence gcc 6 indentation warning.
2016-11-17 16:21:27 +01:00
Tor Andersson
a0ceaf5050
Fix 697244: Check for incomplete escape sequence at end of input.
2016-10-31 13:05:37 +01:00
Tor Andersson
f8234d830e
Fix bug 697136.
...
We were unconditionally reading the next character if we encountered
a '*' in a multi-line comment; possibly reading past the end of
the input.
2016-09-20 17:19:56 +02:00
Tor Andersson
13c7d26dda
Deoptimize isalpha macro due to potential overflow errors.
...
Silence coverity warnings.
2015-01-05 12:57:25 +01:00
Tor Andersson
b4fb12662d
Rename next/accept/expect macros in lexer and parser.
...
Make the names regular, and don't conflict with libc function accept().
2015-01-02 13:43:57 +01:00
Tor Andersson
45c62b0fcc
Fix JSON parsing problems:
...
* false/true/null keywords
* empty arrays and dictionaries
* single quoted strings (are not allowed)
2014-10-28 12:21:04 +01:00
Tor Andersson
ee6c9c53f0
Optimize isalpha/digit macros in lexer.
2014-10-13 16:34:21 +02:00
Tor Andersson
15795e2b58
Allow unescaped / inside classes in regular expression tokens.
2014-10-09 15:18:26 +02:00
Tor Andersson
2e196dd0fc
Strip backslash from escaped / when lexing regular expressions.
2014-09-24 14:05:59 +02:00
Tor Andersson
bc845cbd64
Optimize lexnumber when using strtod.
...
Keep the old--fast but inaccurate--version in #ifdef 0.
2014-09-22 15:47:04 +02:00
Tor Andersson
93cc0584df
Add portable strtod implementation.
...
Ignore locale problems with strtod.
2014-09-01 16:56:38 +02:00
Tor Andersson
eed403069f
Use strtod when lexing numbers.
2014-03-12 15:23:00 +01:00
Tor Andersson
67b33c5a86
Handle malloc failure by throwing exceptions.
2014-02-28 14:24:13 +01:00
Tor Andersson
01d85a4994
Move nelem() macro into jsi.h
2014-02-26 17:35:18 +01:00
Tor Andersson
c67ca523aa
Remove more dead code.
2014-02-25 20:08:16 +01:00
Tor Andersson
45e3a31950
Some -pedantic warning fixes.
...
Drop the use of 'inline' in most places... place some trust in the
compiler.
2014-02-25 01:23:52 +01:00
Tor Andersson
c7e9ab0b05
Fix signed/unsigned comparison warnings.
2014-02-24 23:55:58 +01:00
Tor Andersson
ccf14d4ab5
Fix bug in comment lexing.
2014-02-14 10:49:07 +01:00
Tor Andersson
8e938724ff
Clean up for one.c compilation.
2014-02-11 13:42:25 +01:00
Tor Andersson
39dd0a36ba
JSON.parse()
2014-02-10 13:41:28 +01:00
Tor Andersson
6ecb4e7a4e
Calculate exponent the same way as fractions for symmetry in the lexer.
...
"3E-1" should have the same rounding error as "0.3"
2014-02-05 05:40:35 +01:00
Tor Andersson
299d6c71c6
Fix typo in CR/LF handling in lexer.
2014-02-05 05:17:50 +01:00
Tor Andersson
e8dfb4e624
Rename non-js utility sources to not have the 'js' prefix.
2014-01-28 01:34:41 +01:00
Tor Andersson
a6a5bd7994
Add prefixes and remove duplicate functions.
...
Allows compiling all sources as one big blob.
2014-01-22 03:14:37 +01:00
Tor Andersson
6d2a4c7af8
Make jsY_error return void (as it is a noreturn function).
2014-01-21 21:25:08 +01:00
Tor Andersson
7c82ec2541
Clean up error object creation and throwing functions.
2014-01-20 18:27:52 +01:00
Tor Andersson
40a12fba0d
Split header into js.h public and jsi.h private. Start cleaning up
...
private function prefixes.
2014-01-20 16:13:09 +01:00
Tor Andersson
8e20fae71a
Don't pass pointless 'sp' pointer throughout lexer now that we use
...
a real next() function to advance through the source.
2014-01-18 16:49:00 +01:00
Tor Andersson
a3aa9e7dcc
Simplify newline tests since we normalize line endings in next().
2014-01-18 16:27:10 +01:00
Tor Andersson
8c7f4dc573
Handle \uXXXX escapes in identifiers.
2014-01-18 16:13:23 +01:00
Tor Andersson
dbc00e4e01
Parse UTF-8 source text.
2014-01-18 15:52:48 +01:00
Tor Andersson
bfab4a4be4
Fix bug in number parsing.
2014-01-18 15:15:30 +01:00
Tor Andersson
63d88a9c1b
Rewrite lexer to use a proper lookahead token.
...
Easier to understand, and in preparation for reading UTF-8.
2014-01-18 15:10:57 +01:00
Tor Andersson
7bf5257d00
Save line number where the token starts for improved error messages.
2014-01-18 15:10:57 +01:00
Tor Andersson
288eef80e1
Clean up. Rearrange files. Rename functions.
2014-01-16 20:48:43 +01:00
Tor Andersson
f77a6e7e8e
Implement value stack and use it in the interpreter.
...
We can now run simple programs that don't use function calls.
2014-01-14 18:17:06 +01:00
Tor Andersson
fb30504592
Improve naming of macros in lexer.
2014-01-12 13:39:47 +01:00
Tor Andersson
f36eb04aee
Track newlines properly.
2014-01-11 18:11:23 +01:00
Tor Andersson
d81fc84632
Improve regexp context detection.
2014-01-11 18:11:23 +01:00
Tor Andersson
74f2ad2c0b
Count lines in block comments as well.
2014-01-11 18:11:23 +01:00
Tor Andersson
e23d2070a0
Check future reserved words in parser to allow them as IdentifierName tokens.
2014-01-11 18:11:23 +01:00
Tor Andersson
a476ffcc12
Preserve regexp flags. Escape more characters when dumping strings.
2014-01-11 12:47:08 +01:00
Tor Andersson
8342452b13
Rename files and put stuff in the correct headers.
2014-01-10 14:37:57 +01:00