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
This commit is contained in:
László Langó
2015-06-26 00:03:20 +03:00
parent f992f5d92e
commit e027b4d65d
19 changed files with 1087 additions and 6 deletions
+5
View File
@@ -1,4 +1,5 @@
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
* Copyright 2015 University of Szeged.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +23,7 @@
#include "opcodes-dumper.h"
#include "opcodes-native-call.h"
#include "parser.h"
#include "re-parser.h"
#include "scopes-tree.h"
#include "serializer.h"
#include "stack.h"
@@ -745,6 +747,7 @@ parse_object_literal (void)
| 'false'
| number_literal
| string_literal
| regexp_literal
; */
static operand
parse_literal (void)
@@ -753,6 +756,7 @@ parse_literal (void)
{
case TOK_NUMBER: return dump_number_assignment_res (token_data_as_lit_cp ());
case TOK_STRING: return dump_string_assignment_res (token_data_as_lit_cp ());
case TOK_REGEXP: return dump_regexp_assignment_res (token_data_as_lit_cp ());
case TOK_NULL: return dump_null_assignment_res ();
case TOK_BOOL: return dump_boolean_assignment_res ((bool) token_data ());
case TOK_SMALL_INT: return dump_smallint_assignment_res ((idx_t) token_data ());
@@ -786,6 +790,7 @@ parse_primary_expression (void)
case TOK_BOOL:
case TOK_SMALL_INT:
case TOK_NUMBER:
case TOK_REGEXP:
case TOK_STRING: return parse_literal ();
case TOK_NAME: return literal_operand (token_data_as_lit_cp ());
case TOK_OPEN_SQUARE: return parse_array_literal ();