aboutsummaryrefslogtreecommitdiff
path: root/jerry-core/ecma/base/ecma-helpers-string.c
AgeCommit message (Collapse)Author
2023-11-15Update doxygen and fix documentation (#5106)Máté Tokodi
Update Doxyfile to version 1.9.1 Re-enable doxygen CI checker Fix some regular comments that should have been doc comments Document void return types for some inline functions explicitly Move start of some doxygen groups so they are included always, and not left out of certain ifdefs Ignore some doxygen warnings: Member (function) is not documented in headers Documented empty return type in headers Argument has multiple @param documentation sections JerryScript-DCO-1.0-Signed-off-by: Máté Tokodi mate.tokodi@szteszoftver.hu
2022-01-31Remove ES_NEXT macro (#4915)Szilagyi Adam
- remove all '#JERRY_ESNEXT' macro - remove 5.1 build profile, update test runner accordingly (Note: all builtins are turn on by default) - move tests from tests/jerry/esnext into tests/jerry, concatenate files with same names - add skiplist to some snapshot tests that were supported only in 5.1 - fix doxygen issues that were hidden before (bc. of es.next macro) Co-authored-by: Martin Negyokru negyokru@inf.u-szeged.hu JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2022-01-20Update jerry-port and jerry-ext (#4907)Dániel Bátyai
Notable changes: - Updated and the port API interface, new functions have been added and some have been changed. The port library is now cleaned up to not have any dependency on jerry-core, as it should be. The port library is now strictly a collection of functions that implement embedding/platform specific behavior. - The default port implementation has been split for windows and unix. Implemented port functions have been categorized and reorganized, and marked with attribute((weak)) for better reusability. - External context allocation has been moved to the port API instead of a core API callback. The iterface has also been extended with a function to free the allocated context. When external context is enabled, jerry_init now automatically calls the port implementation to allocate the context and jerry_cleanup automatically calls the port to free the context. - jerry_port_log has been changed to no longer require formatting to be implemented by the port. The reason beind this is that it was vague what format specifiers were used by the engine, and in what manner. The port function now takes a zero-terminated string, and should only implement how the string should be logged. - Logging and log message formatting is now handled by the core jerry library where it can be implemented as necessary. Logging can be done through a new core API function, which uses the port to output the final log message. - Log level has been moved into jerry-core, and an API function has been added to set the log level. It should be the library that filters log messages based on the requested log level, instead of logging everything and requiring the user to do so. - Module resolving logic has been moved into jerry-core. There's no reason to have it in the port library and requiring embedders to duplicate the code. It also added an unnecessary dependency on jerry-core to the port. Platform specific behavior is still used through the port API, like resolving module specifiers, and reading source file contents. If necessary, the resolving logic can still be overridden as previously. - The jerry-ext library has also been cleaned up, and many utility functions have been added that previously were implemented in jerry-main. This allows easier reusability for some common operations, like printing unhandled exceptions or providing a repl console. - Debugger interaction with logged/printed messages has been fixed, so that it's no longer the port implementations responsibility to send the output to the debugger, as the port should have no notion of what a debugger is. The printing and logging functions will now pass the result message to the debugger, if connected. - Cleaned up TZA handling in the date port implementation, and simplified the API function prototype. - Moved property access helper functions that use ASCII strings as keys from jerry-ext to the core API. JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2021-12-06Rework the public API (#4829)Dániel Bátyai
Related to #4186. Some notable changes: - The term 'Error' now strictly refers to native Error objects defined in the ECMA standard, which are ordinary objects. All other uses of 'error' or 'error reference' where the term refers to a thrown value is now called 'exception'. - Simplified the naming scheme of many String API functions. These functions will now also take an 'encoding' argument to specify the desired encoding in which to operate. - Removed the substring-copy-to-buffer functions. These functions behaved awkwardly, as they use character index to specify the start/end positions, and were mostly used incorrectly with byte offsets instead. The functionality can still be replicated with other functions if necessary. - String-to-buffer functions will no longer fail if the buffer is not sufficiently large, the string will instead be cropped. - Fixed the usage of the '_sz' prefix in many API functions. The term 'sz' means zero-terminated string in hungarian notation, this was used incorrectly in many cases. - Renamed most of the public API functions to have shorter, more on-point names, rather than the often too long descriptive names. Functions are now also grouped by the type of value they operate on, where this makes sense. JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2021-12-03Improve float number handling and conversion (#4820)Dániel Bátyai
Fixes #4739. JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2021-11-26Implement ECMAScript 2022 private class methods and fields (#4831)Szilagyi Adam
Co-authored-by: Robert Fancsik robert.fancsik@h-lab.eu Co-authored-by: Martin Negyokru mnegyokru@inf.u-szeged.hu JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2021-11-25Outsource magic error messages (#4821)Csaba Repasi
Modify tools/gen-magic-strings.py to generate error messages. JerryScript-DCO-1.0-Signed-off-by: Csaba Repasi repasics@inf.u-szeged.hu
2021-11-05Replace vera++ with clang-format (#4518)Robert Fancsik
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2021-08-31Implement function.toString operation (#4752)Zoltan Herczeg
May increase the memory consumtpion heavily. JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-08-17Improve parse_identifier (#4691)batizdaniel
Ascii string length is no longer computed during string allocation. JerryScript-DCO-1.0-Signed-off-by: Daniel Batiz batizjob@gmail.com
2021-08-17Rework external string free operation (#4690)Zoltan Herczeg
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-04-13Support native modules (#4649)Zoltan Herczeg
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-04-13Add info to external pointer free callback. (#4642)Zoltan Herczeg
Furthermore reduce memory consumption when only one external pointer is assigned to an object. JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-02-22Optimize the copying/freeing of ecma values (#4602)Dániel Bátyai
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2021-02-04Remove the ENABLED/DISABLED macros (#4515)Robert Fancsik
The removal of these macros enabled cppcheck to reveal new errors. These errors are also fixed by the patch. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-01-28Remove full stop after error messages (#4524)Zoltan Herczeg
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-01-16Fixes ENABLE_AMALGAM need FORCE set to ON when building with MSVC (#4392)Yonggang Luo
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-01-12Unify internal property creation (#4373)Zoltan Herczeg
Furthermore free up a bit in the property descriptor. JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-10-22Implement ES11 globalThis (#4306)Zoltan Herczeg
Also improve symbol built-in instantiation. JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-10-14Fix implicit 'double' conversion reported by Clang 12.0.0 (#4288)Ádám Kallai
JerryScript-DCO-1.0-Signed-off-by: Adam Kallai kadam@inf.u-szeged.hu
2020-10-12Implement numeric-separator (#4158)kisbg
JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-08-25Implement TrimStart TrimEnd and aliases (#4102)Tóth Béla
Based on: https://tc39.es/ecma262/#sec-string.prototype.trim JerryScript-DCO-1.0-Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2020-08-24Fix memory corruption (bad-free) in ecma_string_pad (#4164)Csaba Osztrogonác
JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-08-04Fix AdvanceStringIndex to return an ecma_length_t (#4100)Dániel Bátyai
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-07-29Update ToLength operation to conform ES6 spec (#4007)Robert Fancsik
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-07-28Rework ascii string to use less memory. (#4030)Zoltan Herczeg
Furthermore rename utf8_string to short_string. JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-07-24Implement String.padStart and String.padEnd (#3999)Tóth Béla
Based on: https://tc39.es/ecma262/#sec-string.prototype.padstart JerryScript-DCO-1.0-Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2020-07-22Fix property name comparison when external strings are used. (#4033)Zoltan Herczeg
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-07-22Implement external strings. (#4028)Zoltan Herczeg
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-07-20Remove the usage of ecma_length_t (#4009)Robert Fancsik
Now the following conventions are applied: - passing the number of arguments for a function call is always uint32_t - string size/length/position related operation should use lit_utf8_size_t - Extended objects internal fields must be uint32_t JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-07-06Support Unicode supplementary planes (#3928)Robert Fancsik
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-06-12Re-target for ES.Next (#3901)Dániel Bátyai
A list of changes: - 'es2015-subset' profile is deprecated, and an 'es.next' profile is added. - The default profile is changed to 'es.next' - Renamed the JERRY_ES2015 guard to JERRY_ESNEXT - Renamed JERRY_ES2015_BUILTIN_* guards to JERRY_BUILTIN_* - Moved es2015 specific tests to a new 'es.next' subdirectory - Updated docs, targets, and test runners to reflect these changes Resolves #3737. JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2020-05-26Rework RegExp engine and add support for proper unicode matching (#3746)Dániel Bátyai
This change includes several bugfixes, general improvements, and support for additional features. - Added full support for web compatibility syntax defined in Annex B - Implemented parsing and matching patterns in unicode mode - Fixed capture results when iterating with nested capturing groups - Significantly reduced regexp bytecode size - Reduced stack usage during regexp execution - Improved matching performance JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2020-03-17Use array based storage in container objects (#3600)Roland Takacs
Currently, collections use object based solutions for storing elements and iterating on them. If an element is deleted and re-inserted, the storage position is the same as before so the iteration order is wrong. This patch replaces the object based storage with an array based solution that helps to store and iterate elements as expected. JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs@inf.u-szeged.hu
2020-03-02Implement ecma_stringbuilder_create_raw method for stringbuilder (#3584)Szilagyi Adam
With this new method, we can create a stringbuilder from a raw string JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-02-24Use stringbuilder in ecma_builtin_try_to_instantiate_property (#3575)Szilagyi Adam
Also removed the ecma_append_magic_string_to_string method, because it doesn't get used anymore. JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-02-03Add vera rules to check consecutive and trailing empty lines (#3540)Dániel Bátyai
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-12-16Implement \u{hex} support. (#3447)Zoltan Herczeg
A large rework because surrogate pairs must be combined. Currently only the 0x10C80..0x10CF2 is accepted as valid identifier character from the non-basic plane. JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-12-04Fix index handling in ecma_op_advance_string_index (#3406)Szilagyi Adam
Fixes #3389 JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-11-28Change JERRY_ES2015_BUILTIN_ITERATOR macro to JERRY_ES2015. (#3374)Zoltan Herczeg
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-11-26Implement Regexp.prototype[@@match] method (#3345)Szilagyi Adam
The algorithm is based on ECMA-262 v6, 21.2.5.6 The following helper methods are also implemented: - RegExpExec: ECMA-262 v6, 21.2.5.2.1 - AdvanceStringIndex: ECMA-262 v6, 21.2.5.2.3 JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-10-24Revise ES2015 feature guards (#3240)Robert Fancsik
All the basic language element guards are merged into JERRY_ES2015 macro guard. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-16Static strings should be reference counted in debug mode (#3219)Robert Fancsik
This patch helps to find out invalid reference count usage for ecma-strings. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-09-26Fix undefined references build error on Windows (x64) (#3168)Csaba Osztrogonác
We should emit function symbols for these jerry-core functions: - ecma_compare_ecma_strings is used by test-stringbuilder.c - ecma_is_value_number is used by test-literal-storage.c - ecma_date_time_within_day is used by test-date-helpers.c - jmem_heap_alloc_block is used by test-jmem.c - jmem_heap_free_block is used by test-jmem.c - jmem_pools_alloc is used by test-poolman.c - jmem_pools_free is used by test-poolman.c JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-09-20Fix undefined references build error on Windows (#3134)Csaba Osztrogonác
We should emit function symbols for ecma_get_magic_string function, because it is used by unit-test-stringbuilder.c. JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-09-05Refactor JSON builtin methods (#3031)Dániel Bátyai
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-08-30Improve ecma_string_t descriptor (#3016)Robert Fancsik
This patch introduces several changes conntect to ecma-strings: - Extend the size of the reference counter to 28 bytes from 13 - Extend the size of the string hash to 32 bytes from 16 to use the extact FNV-1a hash - Introduce ECMA_STATIC_STRING_FLAG to reduce the number of string ref/derefs for static strings. - Introduce ECMA_STRING_CONTAINER_ASCII_STRING to store run-time allocated ASCII strings more efficiently - Remove ECMA_STRING_CONTAINER_LIT_NUMBER to half the storage size of the parsing time allocated floating point numbers - Rework the global number storage, to store only the floating point numbers - Optimize the lookup in the global number/string/symbol tables via reduce the number of NULL checks during decompressing the next element pointers - Reduce the code duplication in ecma_concat_ecma_strings and ecma_append_chars_to_string - Improve ecma_string_get_char with optional arguments to make it more reusable. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-08-26New trim helper function (#3014)Szilagyi Adam
Created a new trim helper function which is used in every situation where we need to trim a string Co-authored-by: Tibor Dusnoki tdusnoki@inf.u-szeged.hu JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-08-26Eliminate ECMA_TRY_CATCH macros part I. (#3006)Robert Fancsik
Also this patch introduces several helper function to find/put/delete properties by indexed property names to reduce code duplications. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-08-26Add string builder helper (#2999)Dániel Bátyai
This change adds a new string builder type, that can be used to construct strings internally by appending various types of other strings. JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu