77 Commits

Author SHA1 Message Date
Andrey Shitov
7f1a7981b9 Support true, false, null as property names.
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
2015-07-13 18:01:17 +03:00
Andrey Shitov
60bd718fb5 Fix assertion !lit_utf8_iterator_is_eos (iter_p) in lexer.
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
2015-07-13 18:01:17 +03:00
Andrey Shitov
64bbf2752e Fix printing of the source line with syntax error.
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
2015-07-13 18:01:17 +03:00
Andrey Shitov
d5fd0b09b1 Properly process Use Strict which contains EscapeSeqence or LineContinuation.
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
2015-07-09 12:43:13 +03:00
Andrey Shitov
17cdc35d6d Fix detection of Use Strict directive not in the start of Directive Prologue.
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
2015-07-09 12:43:03 +03:00
Andrey Shitov
146ac15b5f Change locus type from size_t to lit_utf8_iterator_pos_t.
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
2015-07-08 15:53:33 +03:00
Ruben Ayrapetyan
7dd1d01541 Replace character constants with corresponding LIT_CHAR_* definitions in lexer_parse_token (renamed from lexer_next_token_private); replace remaining character constants in lexer with corresponding LIT_CHAR_* definitions.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-07-08 15:53:23 +03:00
Ruben Ayrapetyan
e45f6dc61b Replace punctuator character constants with corresponding LIT_CHAR_* definitions in lexer_next_token_private.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-07-08 15:53:12 +03:00
Ruben Ayrapetyan
23b847015c Support unicode whitespace and line terminators in lexer, fix parse of comments.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-07-08 15:53:02 +03:00
Ruben Ayrapetyan
32094622ec Replace character constants with corresponding LIT_CHAR_* definitions in lexer_parse_regexp (renamed from parse_regexp).
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-07-08 15:52:52 +03:00
Ruben Ayrapetyan
7664bc161b Replace character constants with corresponding LIT_CHAR_* defines in lexer_parse_string (renamed from parse_string).
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-07-08 15:52:42 +03:00
Ruben Ayrapetyan
1711416e2e Simplify lexer_parse_number (parse_number) and add unicode support to the function.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-07-08 15:52:31 +03:00
Ruben Ayrapetyan
baf3748d1b Support unicode in lexer_parse_identifier_name_or_keyword (renamed from parse_name).
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-07-08 15:52:21 +03:00
Ruben Ayrapetyan
6432e4d7cf Replace convert_string_to_token_transform_escape_seq with lexer_transform_escape_sequences that outputs transformed charset to specified buffer, instead of creating token from the charset.
Also the commit introduces lexer_convert_escape_sequence_digits_to_char, adds 'lexer' prefix to convert_single_escape_character and replaces character constants with corresponding LIT_CHAR_* definitions in the function.

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-07-08 15:52:10 +03:00
Ruben Ayrapetyan
b5d30de4d7 Rename decode_keyword to lexer_parse_reserved_word and change it so that it doesn't return TOK_NAME, but empty token instead.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-07-08 15:51:59 +03:00
Andrey Shitov
32318137c3 Switch lexer to utf8 iterators.
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
2015-07-08 15:51:24 +03:00
Evgeny Gavrin
69fe6199c0 Add syntax check for return from global scope/eval.
Related issue: #129

JerryScript-DCO-1.0-Signed-off-by: Evgeny Gavrin e.gavrin@samsung.com
2015-07-02 19:12:41 +03:00
Ruben Ayrapetyan
2a78d24fce Add preprocessor definitions for various character codes, referenced in ECMA-262, and helpers for checking if a character falls into a ECMA-defined character category; remove lit_char_is_carriage_return and lit_char_is_new_line helpers.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-07-02 17:38:32 +03:00
Ruben Ayrapetyan
c37964f7a9 Move helpers from ecma-helpers-char.cpp to lit-char-helpers.cpp, rename them correspondingly.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-07-02 17:36:48 +03:00
Ruben Ayrapetyan
b45302ee07 Fix propagation of strict mode.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-07-01 14:44:12 +03:00
Ruben Ayrapetyan
ec02ace0e9 Fix syntax check for duplicate parameter names in a strict mode function.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-30 15:22:21 +03:00
Evgeny Gavrin
be2de16a4e Fix build error using GCC 4.7.4
JerryScript-DCO-1.0-Signed-off-by: Evgeny Gavrin e.gavrin@samsung.com
2015-06-30 15:03:36 +03:00
Ruben Ayrapetyan
4870550c8a Fix false-positive unexpected EOF in preparse_scope.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-30 14:52:20 +03:00
Ruben Ayrapetyan
0422e2230d Fix syntax check for case 'eval' or 'arguments' identifiers are used for name of function in strict mode.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-30 14:36:18 +03:00
Ruben Ayrapetyan
7b90d54490 Fix raise of several nested jumpable borders at one label.
Related issue: #164

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-30 14:25:51 +03:00
Andrey Shitov
fd9ff8e3bd Add core unicode functionality.
Add utf-8 processing routines.
Change ecma_char_t from char/uint16_t to uint16_t.
Apply all utf-8 processing routines.
Change char to jerry_api_char in API functions' declarations.

JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
2015-06-29 23:27:58 +03:00
Andrey Shitov
a0c5974ab8 Move char type definitions and magic string processing functions to literal component.
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
2015-06-29 23:27:58 +03:00
Ruben Ayrapetyan
a56693e00c Fix syntax error check for assignment of 'eval' and 'arguments' in strict mode code.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-29 18:11:24 +03:00
Ruben Ayrapetyan
984e269db6 Fix direct call to eval from strict mode code.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-29 18:04:42 +03:00
Ruben Ayrapetyan
6573ffd632 Fix several issues in parse of variable declarations.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-29 17:56:42 +03:00
Ruben Ayrapetyan
3d31bfec92 Fix parse of nested switch statements.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-29 17:42:37 +03:00
Ruben Ayrapetyan
6e2733dbfd Reduce register pressure by reusing registers, allocated for argument preparation instruction sequence.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-29 17:23:51 +03:00
Ruben Ayrapetyan
dc095bb902 Enhancement of argument list parsing loop: removing break / continue operators, so that every iteration passes start and end of loop body.
The change makes possible simple notification of byte-code generator about start / end of byte-code generation for an argument.
As register values are not passed between byte-code sequences that prepare different arguments, the change would make possible for byte-code generator to reuse registers allocated for the code sequences.

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-29 17:23:51 +03:00
Ruben Ayrapetyan
06dffdec8f Remove exit completion value type.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-29 10:24:18 +03:00
Ruben Ayrapetyan
447358cd4a Remove intrinsics support from parser.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-29 10:24:18 +03:00
Ruben Ayrapetyan
507411f0a0 Implement parse of for-in statement.
JerryScript-DCO-1.0-Signed-off-by: Evgeny Gavrin e.gavrin@samsung.com
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-26 20:21:59 +03:00
Ruben Ayrapetyan
9b414deb8d Introduce explicit description of registers (temporary variables) ranges.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-26 20:10:31 +03:00
László Langó
e027b4d65d Enable regular expressions.
- add regular expressions support to JS parser and interpreter;
- add tests for regular expressions.

JerryScript-DCO-1.0-Signed-off-by: Szilard Ledan szledan.u-szeged@partner.samsung.com
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2015-06-26 13:31:10 +02:00
László Langó
1f9add4735 Add ecma_char_is_word_char helper (part of IsWordChar abstract operation, ECMA-262 v5, 15.10.2.6); move hex_to_int from lexer to jerry-core/ecma/base/ecma-helpers-char.cpp, renaming it to ecma_char_hex_to_int.
JerryScript-DCO-1.0-Signed-off-by: Szilard Ledan szledan.u-szeged@partner.samsung.com
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2015-06-26 13:31:00 +02:00
Ruben Ayrapetyan
f849cc6283 Fix parse of simple for statement.
Related issue: #156

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-25 20:29:36 +03:00
Ruben Ayrapetyan
601f1eea58 Introduce jsp_skip_braces function for skiping blocks, surrounded with braces.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-25 20:29:36 +03:00
Ruben Ayrapetyan
5f174cf8bf Remove 'process_keyword_names' stage, as keyword literals now can be registered during main parse stage.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-25 20:29:36 +03:00
Ruben Ayrapetyan
d7ecd4a467 Fix raise of syntax errors for unmatched braces.
Related issue: #43, #183

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-25 16:47:45 +03:00
Ruben Ayrapetyan
4ff9e79b02 Generate anonymous function expressions for getters / setters of an object literal.
Related issue: #234

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-24 15:37:42 +03:00
Peter Gal
77b01a6473 Provide assert as an external method.
Removed the internal assert implementation from the engine
and provide externally an assert function via api calls.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2015-06-23 18:08:51 +02:00
Ruben Ayrapetyan
ab2abfa8b3 Fix receiving of byte-code instructions from serializer.
Related issue: #203

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-23 13:49:46 +03:00
Ruben Ayrapetyan
a536073da4 Add literal registration in parse_member_expression (TOK_KEYWORD case).
Related issue: #116

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-23 12:39:45 +03:00
Ruben Ayrapetyan
a4e54e736e Support syntax error feedback in parser.
Now, parser correctly finishes parse procedure if syntax of source code is incorrect (syntax correctness is indicated using return value):
 - parser-internal memory management is performed using jsp_mm_alloc / jsp_mm_free;
 - upon detection of incorrect syntax, all parser-allocated memory regions are deallocated using jsp_mm_free_all and parse finishes with corresponding return value.

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-19 17:05:15 +03:00
Ruben Ayrapetyan
85f12de139 Introduce parser-specific managed memory allocator with interface jsp_mm_free_all that, upon call, frees all memory allocated with the allocator.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-19 16:25:34 +03:00
Ruben Ayrapetyan
9b0f5d439d Introduce jsp_label_remove_all_labels interface that removes all jump labels registered at the moment of call for usage upon raise of SyntaxError during parse.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-19 16:25:34 +03:00