From 054bc88b820474159d513912416e5fb2f0b8f397 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Mon, 12 Mar 2018 12:43:08 -0500 Subject: [PATCH] Add gettext operator back to strings in tokenizer This was purposely disabled as it causes a floating point exception immediately on run: Program received signal SIGFPE, Arithmetic exception. 0x000000000056eae8 in std::__detail::_Mod_range_hashing::operator()(unsigned long, unsigned long) const () (gdb) bt #0 0x000000000056eae8 in std::__detail::_Mod_range_hashing::operator()(unsigned long, unsigned long) const () #1 0x00000000005bb4f1 in std::__detail::_Hash_code_base, std::allocator >, std::pair, std::allocator > const, std::__cxx11::basic_string, std::allocator > >, std::__detail::_Select1st, std::hash, std::allocator > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::_M_bucket_index(std::__cxx11::basic_string, std::allocator > const&, unsigned long, unsigned long) const () #2 0x00000000005bb22a in std::_Hashtable, std::allocator >, std::pair, std::allocator > const, std::__cxx11::basic_string, std::allocator > >, std::allocator, std::allocator > const, std::__cxx11::basic_string, std::allocator > > >, std::__detail::_Select1st, std::equal_to, std::allocator > >, std::hash, std::allocator > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits >::_M_bucket_index(std::__cxx11::basic_string, std::allocator > const&, unsigned long) const () #3 0x00000000005bb115 in std::__detail::_Map_base, std::allocator >, std::pair, std::allocator > const, std::__cxx11::basic_string, std::allocator > >, std::allocator, std::allocator > const, std::__cxx11::basic_string, std::allocator > > >, std::__detail::_Select1st, std::equal_to, std::allocator > >, std::hash, std::allocator > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits, true>::operator[](std::__cxx11::basic_string, std::allocator > const&) () #4 0x00000000005af388 in std::unordered_map, std::allocator >, std::__cxx11::basic_string, std::allocator >, std::hash, std::allocator > >, std::equal_to, std::allocator > >, std::allocator, std::allocator > const, std::__cxx11::basic_string, std::allocator > > > >::operator[](std::__cxx11::basic_string, std::allocator > const&) () #5 0x000000000067dc6b in wgettext[abi:cxx11](wchar_t const*) () #6 0x0000000000551df7 in __cxx_global_var_init.1 () #7 0x000000000055225e in _GLOBAL__sub_I_tokenizer.cpp () #8 0x000000000069d45d in __libc_csu_init () #9 0x00007ffffdc907bf in __libc_start_main (main=0x552500
, argc=1, argv=0x7ffffffed298, init=0x69d410 <__libc_csu_init>, fini=, rtld_fini=, stack_end=0x7ffffffed288) at ../csu/libc-start.c:247 #10 0x0000000000552389 in _start () (gdb) --- src/tokenizer.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/tokenizer.cpp b/src/tokenizer.cpp index 65e262204..91dd1ac8f 100644 --- a/src/tokenizer.cpp +++ b/src/tokenizer.cpp @@ -17,18 +17,18 @@ #include "wutil.h" // IWYU pragma: keep tokenizer_error *TOK_ERROR_NONE = new tokenizer_error(L""); -tokenizer_error *TOK_UNTERMINATED_QUOTE = new tokenizer_error((L"Unexpected end of string, quotes are not balanced"), parse_error_tokenizer_unterminated_quote); -tokenizer_error *TOK_UNTERMINATED_SUBSHELL = new tokenizer_error((L"Unexpected end of string, expecting ')'"), parse_error_tokenizer_unterminated_subshell); -tokenizer_error *TOK_UNTERMINATED_SLICE = new tokenizer_error((L"Unexpected end of string, square brackets do not match"), parse_error_tokenizer_unterminated_slice); -tokenizer_error *TOK_UNTERMINATED_ESCAPE = new tokenizer_error((L"Unexpected end of string, incomplete escape sequence"), parse_error_tokenizer_unterminated_escape); -tokenizer_error *TOK_INVALID_REDIRECT = new tokenizer_error((L"Invalid input/output redirection")); -tokenizer_error *TOK_INVALID_PIPE = new tokenizer_error((L"Cannot use stdin (fd 0) as pipe output")); -tokenizer_error *TOK_CLOSING_UNOPENED_SUBSHELL = new tokenizer_error((L"Unexpected ')' for unopened parenthesis")); -tokenizer_error *TOK_ILLEGAL_SLICE = new tokenizer_error((L"Unexpected '[' at this location")); -tokenizer_error *TOK_CLOSING_UNOPENED_BRACE = new tokenizer_error((L"Unexpected '}' for unopened brace expansion")); -tokenizer_error *TOK_UNTERMINATED_BRACE = new tokenizer_error((L"Unexpected end of string, incomplete parameter expansion")); -tokenizer_error *TOK_EXPECTED_PCLOSE_FOUND_BCLOSE = new tokenizer_error((L"Unexpected '}' found, expecting ')'")); -tokenizer_error *TOK_EXPECTED_BCLOSE_FOUND_PCLOSE = new tokenizer_error((L"Unexpected ')' found, expecting '}'")); +tokenizer_error *TOK_UNTERMINATED_QUOTE = new tokenizer_error(_(L"Unexpected end of string, quotes are not balanced"), parse_error_tokenizer_unterminated_quote); +tokenizer_error *TOK_UNTERMINATED_SUBSHELL = new tokenizer_error(_(L"Unexpected end of string, expecting ')'"), parse_error_tokenizer_unterminated_subshell); +tokenizer_error *TOK_UNTERMINATED_SLICE = new tokenizer_error(_(L"Unexpected end of string, square brackets do not match"), parse_error_tokenizer_unterminated_slice); +tokenizer_error *TOK_UNTERMINATED_ESCAPE = new tokenizer_error(_(L"Unexpected end of string, incomplete escape sequence"), parse_error_tokenizer_unterminated_escape); +tokenizer_error *TOK_INVALID_REDIRECT = new tokenizer_error(_(L"Invalid input/output redirection")); +tokenizer_error *TOK_INVALID_PIPE = new tokenizer_error(_(L"Cannot use stdin (fd 0) as pipe output")); +tokenizer_error *TOK_CLOSING_UNOPENED_SUBSHELL = new tokenizer_error(_(L"Unexpected ')' for unopened parenthesis")); +tokenizer_error *TOK_ILLEGAL_SLICE = new tokenizer_error(_(L"Unexpected '[' at this location")); +tokenizer_error *TOK_CLOSING_UNOPENED_BRACE = new tokenizer_error(_(L"Unexpected '}' for unopened brace expansion")); +tokenizer_error *TOK_UNTERMINATED_BRACE = new tokenizer_error(_(L"Unexpected end of string, incomplete parameter expansion")); +tokenizer_error *TOK_EXPECTED_PCLOSE_FOUND_BCLOSE = new tokenizer_error(_(L"Unexpected '}' found, expecting ')'")); +tokenizer_error *TOK_EXPECTED_BCLOSE_FOUND_PCLOSE = new tokenizer_error(_(L"Unexpected ')' found, expecting '}'")); /// Return an error token and mark that we no longer have a next token. tok_t tokenizer_t::call_error(tokenizer_error *error_type, const wchar_t *token_start,