diff --git a/jerry-core/ecma/operations/ecma-regexp-object.cpp b/jerry-core/ecma/operations/ecma-regexp-object.cpp index e28f30d784..961f393a9a 100644 --- a/jerry-core/ecma/operations/ecma-regexp-object.cpp +++ b/jerry-core/ecma/operations/ecma-regexp-object.cpp @@ -216,7 +216,7 @@ utf8_backtrack (const ecma_char_t* str_p) { /* FIXME: fix this, when unicode support is finished! */ return --str_p; -} +} /* utf8_backtrack */ /** * Helper to get an input character and increase string pointer. @@ -228,7 +228,7 @@ get_input_char (const ecma_char_t** char_p) const ecma_char_t ch = **char_p; (*char_p)++; return ch; -} +} /* get_input_char */ /** * Helper to get current input character, won't increase string pointer. @@ -238,7 +238,7 @@ lookup_input_char (const ecma_char_t* str_p) { /* FIXME: fix this, when unicode support is finished! */ return *str_p; -} +} /* lookup_input_char */ /** * Helper to get previous input character, won't decrease string pointer. @@ -248,7 +248,7 @@ lookup_prev_char (const ecma_char_t* str_p) { /* FIXME: fix this, when unicode support is finished! */ return *(--str_p); -} +} /* lookup_prev_char */ /** * Helper to check that a unicode character is a word character or not. @@ -264,7 +264,7 @@ regexp_is_wordchar (const ecma_char_t ch) return true; } return false; -} +} /* regexp_is_wordchar */ /** * Recursive function for RegExp matching diff --git a/jerry-core/parser/js/lexer.cpp b/jerry-core/parser/js/lexer.cpp index f57e3649b6..2a2f0cff77 100644 --- a/jerry-core/parser/js/lexer.cpp +++ b/jerry-core/parser/js/lexer.cpp @@ -346,7 +346,7 @@ consume_char (void) } \ while (0) -static uint32_t +uint32_t hex_to_int (char hex) { switch (hex) diff --git a/jerry-core/parser/js/lexer.h b/jerry-core/parser/js/lexer.h index 21f004bebd..33aef50e0a 100644 --- a/jerry-core/parser/js/lexer.h +++ b/jerry-core/parser/js/lexer.h @@ -169,6 +169,8 @@ typedef struct */ #define TOKEN_EMPTY_INITIALIZER {0, TOK_EMPTY, 0} +uint32_t hex_to_int (char hex); + void lexer_init (const char *, size_t, bool); void lexer_free (void); diff --git a/jerry-core/parser/regexp/re-parser.cpp b/jerry-core/parser/regexp/re-parser.cpp index bece939491..fb6716c088 100644 --- a/jerry-core/parser/regexp/re-parser.cpp +++ b/jerry-core/parser/regexp/re-parser.cpp @@ -19,6 +19,7 @@ #include "ecma-helpers.h" #include "ecma-try-catch-macro.h" #include "jrt-libc-includes.h" +#include "lexer.h" #include "re-parser.h" #include "syntax-errors.h" @@ -27,44 +28,13 @@ #define RE_LOOKUP(str_p, lookup) *(str_p + lookup) #define RE_ADVANCE(str_p, advance) do { str_p += advance; } while (0) -static uint32_t -hex_to_int (ecma_char_t hex) -{ - switch (hex) - { - case '0': return 0x0; - case '1': return 0x1; - case '2': return 0x2; - case '3': return 0x3; - case '4': return 0x4; - case '5': return 0x5; - case '6': return 0x6; - case '7': return 0x7; - case '8': return 0x8; - case '9': return 0x9; - case 'a': - case 'A': return 0xA; - case 'b': - case 'B': return 0xB; - case 'c': - case 'C': return 0xC; - case 'd': - case 'D': return 0xD; - case 'e': - case 'E': return 0xE; - case 'f': - case 'F': return 0xF; - default: JERRY_UNREACHABLE (); - } -} - static ecma_char_t get_ecma_char (ecma_char_t** char_p) { ecma_char_t ch = **char_p; RE_ADVANCE (*char_p, 1); return ch; -} +} /* get_ecma_char */ /** * Parse RegExp iterators @@ -152,7 +122,7 @@ parse_re_iterator (ecma_char_t *pattern_p, /**< RegExp pattern */ return ret_value; } digits++; - qmin = qmin * 10 + hex_to_int (ch1); + qmin = qmin * 10 + hex_to_int ((char) ch1); } else if (ch1 == ',') { @@ -231,7 +201,7 @@ parse_re_iterator (ecma_char_t *pattern_p, /**< RegExp pattern */ } return ret_value; -} +} /* parse_re_iterator */ /** * Count the number of groups in pattern @@ -279,7 +249,7 @@ re_count_num_of_groups (re_parser_ctx_t *parser_ctx_p) /**< RegExp parser contex } } } -} +} /* re_count_num_of_groups */ /** * Read the input pattern and parse the range of character class @@ -691,7 +661,7 @@ re_parse_next_token (re_parser_ctx_t *parser_ctx_p, /**< RegExp parser context * { break; } - number = number * 10 + hex_to_int (digit); + number = number * 10 + hex_to_int ((char) digit); index++; } while (true); diff --git a/tests/jerry/regexp_assertions.js b/tests/jerry/regexp-assertions.js similarity index 100% rename from tests/jerry/regexp_assertions.js rename to tests/jerry/regexp-assertions.js diff --git a/tests/jerry/regexp_backreference.js b/tests/jerry/regexp-backreference.js similarity index 100% rename from tests/jerry/regexp_backreference.js rename to tests/jerry/regexp-backreference.js diff --git a/tests/jerry/regexp_capture_groups.js b/tests/jerry/regexp-capture-groups.js similarity index 100% rename from tests/jerry/regexp_capture_groups.js rename to tests/jerry/regexp-capture-groups.js diff --git a/tests/jerry/regexp_character_class.js b/tests/jerry/regexp-character-class.js similarity index 100% rename from tests/jerry/regexp_character_class.js rename to tests/jerry/regexp-character-class.js diff --git a/tests/jerry/regexp_construct.js b/tests/jerry/regexp-construct.js similarity index 100% rename from tests/jerry/regexp_construct.js rename to tests/jerry/regexp-construct.js diff --git a/tests/jerry/regexp_non_capture_groups.js b/tests/jerry/regexp-non-capture-groups.js similarity index 100% rename from tests/jerry/regexp_non_capture_groups.js rename to tests/jerry/regexp-non-capture-groups.js diff --git a/tests/jerry/regexp_routines.js b/tests/jerry/regexp-routines.js similarity index 100% rename from tests/jerry/regexp_routines.js rename to tests/jerry/regexp-routines.js diff --git a/tests/jerry/regexp_simple_atom_and_iterations.js b/tests/jerry/regexp-simple-atom-and-iterations.js similarity index 100% rename from tests/jerry/regexp_simple_atom_and_iterations.js rename to tests/jerry/regexp-simple-atom-and-iterations.js