aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/regexp.c
Commit message (Collapse)AuthorAge
...
* | | regexp: Fix warning about octal constantZyX2017-04-16
| |/ |/|
* | lint: fix clint errors around mb_tolower callsBjörn Linse2017-04-10
| |
* | mbyte: replace vim_tolower with mb_tolower handling locale correctlyBjörn Linse2017-04-10
|/
* eval: Move remaining get_tv_string* functions to eval/typval.cZyX2017-03-29
|
* eval: Split eval.c into smaller filesZyX2017-03-29
|
* Allow lambdas to be used with jobs, timers and dictwatchers.Michael Ennen2017-02-14
|
* vim-patch:7.4.2137Michael Ennen2017-02-14
| | | | | | | | | Problem: Using function() with a name will find another function when it is redefined. Solution: Add funcref(). Refer to lambda using a partial. Fix several reference counting issues. https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
* vim-patch:7.4.2090Michael Ennen2017-02-14
| | | | | | | | Problem: Using submatch() in a lambda passed to substitute() is verbose. Solution: Use a static list and pass it as an optional argument to the function. Fix memory leak. https://github.com/vim/vim/commit/df48fb456fb6bf63d94cad9b302ff01d8ee8d311
* vim-patch:7.4.2072Michael Ennen2017-02-14
| | | | | | | Problem: substitute() does not support a Funcref argument. Solution: Support a Funcref like it supports a string starting with "\=". https://github.com/vim/vim/commit/72ab729c3dcdea0fba44d8e676602c847e841bcd
* vim-patch:7.4.1783Michael Ennen2016-12-31
| | | | | | | | Problem: The old regexp engine doesn't handle character classes correctly. (Manuel Ortega) Solution: Use regmbc() instead of regc(). Add a test. https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
* vim-patch:7.4.1793Michael Ennen2016-12-31
| | | | | | | | Problem: Some character classes may differ between systems. On OS/X the regexp test fails. Solution: Make this less dependent on the system. (idea by Kazunobu Kuriyama) https://github.com/vim/vim/commit/e8aee7dcf9b12becff86e8ce1783a86801c5f9f6
* refactor: eliminate misc2.cJustin M. Keyes2016-09-13
| | | | | | | | | | move `call_shell` to misc1.c Move some fns to state.c Move some fns to option.c Move some fns to memline.c Move `vim_chdir*` fns to file_search.c Move some fns to new module, bytes.c Move some fns to fileio.c
* vim-patch:7.4.1305 #5094Michael Ennen2016-08-01
| | | | | | | | | | Problem: "\%1l^#.*" does not match on a line starting with "#". Solution: Do not clear the start-of-line flag. (Christian Brabandt) https://github.com/vim/vim/commit/7c29f387819b5817b003d2ba73e2b5cf3cb3d0dd Helped-by: jamessan Helped-by: mhinz
* *: Fix new linter errorsZyX2016-05-01
| | | | Originally there were 128 new errors, so I thought this is a good idea to fix all of them. Of course, this commit also fixes many suppressed errors.
* regexp: Remove a leftover line.Jurica Bradaric2016-01-24
| | | | It was replaced with `case 0xc3: case 0xc4: case 0xc5:`.
* vim-patch:7.4.704Jurica Bradaric2016-01-24
| | | | | | | | | | Problem: Searching for a character matches an illegal byte and causes invalid memory access. (Dominique Pelle) Solution: Do not match an invalid byte when search for a character in a string. Fix equivalence classes using negative numbers, which result in illegal bytes. https://github.com/vim/vim/commit/d82a2a990bc329754e1b61c5af669c76ac202497
* vim-patch:7.4.685Jurica Bradaric2016-01-23
| | | | | | | | Problem: When there are illegal utf-8 characters the old regexp engine may go past the end of a string. Solution: Only advance to the end of the string. (Dominique Pelle) https://github.com/vim/vim/commit/0e462411cafdd908356792b2c229ab6369103bca
* vim-patch:7.4.714Michael Ennen2016-01-13
| | | | | | | Problem: Illegal memory access when there are illegal bytes. Solution: Check the byte length of the character. (Dominique Pelle) https://github.com/vim/vim/commit/069dd08d8dbbbadc4e6780d5c881a24bce79a4f7
* vim-patch:7.4.776 #3062Marco Hinz2015-08-09
| | | | | | | | Problem: Equivalence class for 'd' does not work correctly. Solution: Fix 0x1e0f and 0x1d0b. (Dominique Pelle) Original patch: https://code.google.com/p/vim/source/detail?r=94b17958585153641ad1e813fa144cad57c7170f
* Remove POSIX 'cpoptions': '\'Michael Reed2015-07-19
|
* vim-patch:7.4.736 #2998cztchoice2015-07-11
| | | | | | | | Problem: Invalid memory access. Solution: Avoid going over the end of a NUL terminated string. (Dominique Pelle) https://github.com/vim/vim/commit/v7-4-736
* vim-patch:7.4.593 #2657David Bürgin2015-06-13
| | | | | | | | | | Problem: Crash when searching for "x\{0,90000}". (Dominique Pelle) Solution: Bail out from the NFA engine when the max limit is much higher than the min limit. https://github.com/vim/vim/commit/v7-4-593 See https://groups.google.com/d/msg/vim_dev/c7owwoseba8/ZETgSNZ6p10J
* Remove char_u: message:smsg()Michael Reed2015-05-13
|
* vim-patch:7.4.526 #2562David Bürgin2015-05-07
| | | | | | | | | Problem: matchstr() fails on long text. Daniel Hahler) Solution: Return NFA_TOO_EXPENSIVE from regexec_nl(). (Christian Brabandt) https://github.com/vim/vim/commit/v7-4-526 Helped-by: Michael Reed <m.reed@mykolab.com>
* vim-patch:7.4.519David Bürgin2015-04-27
| | | | | | | | | Problem: Crash when using syntax highlighting. Solution: When regprog is freed and replaced, store the result. https://github.com/vim/vim/tree/v7-4-519 Helped-by: Scott Prager <splinterofchaos@gmail.com>
* Replace vim_isxdigit() with to ascii_isxdigit() defined in ascii.hFelipe Oliveira Carvalho2015-04-24
|
* Replace VIM_ISDIGIT() and vim_isdigit() with ascii_isdigit() defined in ascii.hFelipe Oliveira Carvalho2015-04-24
|
* Replace vim_iswhite with ascii_iswhite() defined in ascii.hFelipe Oliveira Carvalho2015-04-24
|
* memory: Add `free` wrapper and refactor project to use itThiago de Arruda2015-04-13
| | | | | | We already use wrappers for allocation, the new `xfree` function is the equivalent for deallocation and provides a way to fully replace the malloc implementation used by Neovim.
* vim-patch:7.4.497 #2295David Bürgin2015-04-05
| | | | | | | | | | | | | Problem: With some regexp patterns the NFA engine uses many states and becomes very slow. To the user it looks like Vim freezes. Solution: When the number of states reaches a limit fall back to the old engine. (Christian Brabandt) https://github.com/vim/vim/releases/tag/v7-4-497 Helped-by: David Bürgin <676c7473@gmail.com> Helped-by: Justin M. Keyes <justinkz@gmail.com> Helped-by: Scott Prager <splinterofchaos@gmail.com>
* Enable -Wconversion: mark.c.Eliseo Martínez2015-02-18
| | | | | | Refactoring summary: - MB_STRNICMP: Inlined. - MB_STRNCMP: Inlined.
* Remove long_u: regexp: Refactor long_u.Eliseo Martínez2015-01-19
|
* Macro cleanup: PROTOMichael Reed2015-01-14
| | | | | | Regarding dict_lookup() in eval.c: both definitions are the same, the only difference being the spacing between the indirection operator and the indentation level.
* Cleanup: Rename getdigits() family functions.Eliseo Martínez2015-01-11
|
* Cleanup: Refactor getdigits().Eliseo Martínez2015-01-11
| | | | | | | | | | | | | | | | Problem : getdigits() currently returns a long, but at most places, return value is casted (unsafely) into an int. Making casts safe would introduce a lot of fuss in the form of assertions checking for limits. Note : We cannot just change return type to int, because, at some places, legitimate long values are used. For example, in diff.c, for line numbers. Solution : Introduce new functions: - get_digits() : Gets an intmax_t from a string. - get_int_digits() : Wrapper for ints. - get_long_digits() : Wrapper for longs. And replace getdigits() invocations by the appropiate wrapper invocations.
* Define and use the ARRAY_SIZE macroFelipe Oliveira Carvalho2014-12-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A similar macro is defined in the Linux kernel [1]. To refactor the code I used a slightly modified Coccinelle script I found in [2]. ```diff // Use the macro ARRAY_SIZE when possible // // Confidence: High // Copyright: (C) Gilles Muller, Julia Lawall, EMN, DIKU. GPLv2. // URL: http://www.emn.fr/x-info/coccinelle/rules/array.html // Options: -I ... -all_includes can give more complete results @@ type T; T[] E; @@ - (sizeof(E)/sizeof(*E)) + ARRAY_SIZE(E) @@ type T; T[] E; @@ - (sizeof(E)/sizeof(E[...])) + ARRAY_SIZE(E) @@ type T; T[] E; @@ - (sizeof(E)/sizeof(T)) + ARRAY_SIZE(E) @n@ identifier AS,E; @@ - #define AS(E) ARRAY_SIZE(E) @@ expression E; identifier n.AS; @@ - AS(E) + ARRAY_SIZE(E) ``` `spatch --in-place --sp-file array_size.cocci -I src/ -I build/include/ -I build/src/nvim/auto/ src/nvim/*.c` [1] http://lxr.free-electrons.com/source/include/linux/kernel.h#L54 [2] http://www.emn.fr/z-info/coccinelle/rules/#macros
* Reduce indentation level by early returning or continuing loopFelipe Oliveira Carvalho2014-12-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace code like this ```c func() { if (cond) { ... ... ... } return ret; } ``` ```c for (...) { if (cond) { ... ... ... } } ``` with ```c func() { if (!cond) { return ret; } ... ... ... } ``` ```c for (...) { if (!cond) { continue; } ... ... ... } ```
* vim-patch:7.4.437Scott Prager2014-11-13
| | | | | | | Problem: New and old regexp engine are not consistent. Solution: Also give an error for "\ze*" for the old regexp engine. https://code.google.com/p/vim/source/detail?r=v7-4-437
* Fix warnings: regexp.c: match_with_backref(): Nonnull violation: FP.Eliseo Martínez2014-11-06
| | | | | | | | | | | Problem: Argument with 'nonnull' attribute passed null @ 5632. http://neovim.org/doc/reports/clang/report-041a0e.html#EndPath. Diagnostic: False positive. Rationale : `p = reg_getline(clnum)` above should not be null, because `clnum` starts at `start_lnum` and only increments after that. Resolution: Assert p not null.
* Fix warnings: regexp.c: br_regcomp(): Np dereference: MI.Eliseo Martínez2014-11-06
| | | | | | | | | | | | | | | | | | Problem: Dereference of null pointer @ 1312. http://neovim.org/doc/reports/clang/report-b1d09a.html#EndPath Diagnostic: Multithreading issue. Rationale : Suggested error path contains two succesive calls to `regnext(scan)`, first of which returning nonnull, the second one returning null. This can only occur if global `reg_toolong` accesed in `regnext()` changes between the calls. Resolution: Use local variable to cache first `regnext(scan)` result. Note that this change alters function semantics, as now function only issues one call instead of two, reusing the result for the second time. This shouldn't be a problem, though, as new semantics should be in fact be better.
* Fix warnings: regexp.c: skip_regexp: Np dereference: FP.Eliseo Martínez2014-11-06
| | | | | | | | | | | | Problem: Derefence of null pointer @ 1208. http://neovim.org/doc/reports/clang/report-24b5ca.html#Path10 Diagnostic: False positive. Rationale : Error is reported to happen if after `if (*newp == NULL) {` body, `*newp` continues being NULL, and false branch of following `if (*newp != NULL)` is taken. Now, `vim_strsave` cannot return NULL, so error cannot happen. Resolution: Remove dead code (leftover since OOM refactors).
* vim-patch:7.4.360André Twupack2014-09-21
| | | | | | | | Problem: In a regexp pattern a "$" followed by \v or \V is not seen as the end-of-line. Solution: Handle the situation. (Ozaki Kiichi) https://code.google.com/p/vim/source/detail?r=v7-4-360
* vim-patch:7.4.293Damián Silvani2014-08-14
| | | | | | | | Problem: It is not possible to ignore composing characters at a specific point in a pattern. Solution: Add the %C item. https://code.google.com/p/vim/source/detail?r=10fc95f48546f438648b8357062e93c9c2c0a377
* Remove SMALL_MALLOC. Used on MSDOS and WIN16.Pavel Platto2014-08-02
|
* profiling: implement on top of os_hrtime()Nicolas Hillegeer2014-07-16
| | | | | | | | | | | | | | | | | | | | | | | | | | Should be better than gettimeofday() since libuv uses higher resolution clocks on most UNIX platforms. Libuv also tries to use monotonic clocks, kernel bugs notwithstanding, which is another win over gettimeofday(). Necessary for Windows, which doesn't have gettimeofday(). In vanilla vim, Windows uses QueryPerformanceCounter, which is the correct primitive for this sort of things, but that was removed when slimming up the codebase. Libuv uses QueryPerformanceCounter to implement uv_hrtime() on Windows so the behaviour of vim profiling on Windows should now be the same. The behaviour on Linux should be different (better) though, libuv uses more accurate primitives than gettimeofday(). Other misc. changes: - Added function attributes where relevant (const, pure, ...) - Convert functions to receive scalars: Now that proftime_T is always a (uint64_t) scalar (and not a struct), it's clearer to convert the functions to receive it as such instead of a pointer to a scalar. - Extract profiling funcs to profile.c: make everything clearer and reduces the size of the "catch-all" ex_cmds2.c - Add profile.{c,h} to clint and -Wconv: - Don't use sprintf, use snprintf - Don't use long, use int16_t/int32_t/...
* Use strict function prototypes #945Pavel Platto2014-07-14
| | | | | | | | | | | | | | | | | | | `-Wstrict-prototypes` warn if a function is declared or defined without specifying the argument types. This warning disallow function prototypes with empty parameter list. In C, a function declared with an empty parameter list accepts an arbitrary number of arguments when being called. This is for historic reasons; originally, C functions didn't have prototypes, as C evolved from B, a typeless language. When prototypes were added, the original typeless declarations were left in the language for backwards compatibility. Instead we should provide `void` in argument list to state that function doesn't have arguments. Also this warning disallow declaring type of the parameters after the parentheses because Neovim header generator produce no declarations for old-stlyle prototypes: it expects to find `{` after prototype.
* vim-patch:7.4.291 #879oni-link2014-07-11
| | | | | | | | Problem: Compiler warning for int to pointer of different size when DEBUG is defined. Solution: use smsg() instead of EMSG3(). https://code.google.com/p/vim/source/detail?r=b5972833add9de714f4651e26fd9ea63ec4a880c
* move <inttypes.h> include out of vim.hBrandon Coleman2014-07-09
|
* move ascii.h include out of vim.hBrandon Coleman2014-07-09
|
* remove stdbool.h include from vim.h and globals.hBrandon Coleman2014-07-09
|