Allan Odgaard
f60e0dad98
Use text::transcode_t instead if iconv API
2016-06-21 18:33:20 +02:00
Allan Odgaard
8483826fae
Always use '\0' as fill value when creating a string buffer
2016-06-18 10:34:08 +02:00
Allan Odgaard
e83fee564c
Refactor: use emplace_back(…) instead of push_back(make_pair(…))
2016-05-28 22:12:46 +02:00
Allan Odgaard
8fe7681ebd
Remove unnecessary include of oak/compat.h
2015-08-05 12:31:20 +02:00
Allan Odgaard
4827e354f0
Don’t call non-virtual member functions for nullptr
2015-05-09 21:40:29 +02:00
Allan Odgaard
9ceb07e54c
Add API to escape a string for use in a glob pattern
2015-04-30 15:15:57 +02:00
Allan Odgaard
40879d5683
Replace sizeofA macro with range-based for loop or std::begin/end
2015-03-05 16:38:09 +07:00
Allan Odgaard
812f8146bf
Only limit regexp search to 5 MB when operating on disk file
...
That is, if the file has been opened by the user, there is no size limit on what we will search.
2015-01-29 14:37:56 +07:00
Allan Odgaard
0bdefafac3
Remove dependency graph support to only framework using this API
2014-12-25 09:33:56 +01:00
Allan Odgaard
ab69cf8b4a
Make code more robust
...
This is motivated by a crash that indicates that an empty string might result from the `all_varations` function.
2014-11-21 13:24:24 +01:00
Allan Odgaard
a778f0b3da
Combine std::set’s find and insert into a single operation
2014-11-10 17:11:31 +01:00
Allan Odgaard
609558edac
Regexp search a 5+ MB file could find matches in wrong locations
...
The code was supposed to stop the search after 5 MB, this didn’t always work, and when it worked, the returned match offsets were not always correct (as they didn’t account for the capped buffer size).
2014-10-29 12:24:12 +01:00
Allan Odgaard
6f68d2afb1
Titlecase does not preserve case when everything is uppercase
2014-10-03 21:49:13 +02:00
Allan Odgaard
ab83cc6e50
Strip diacritics and combining marks when asciifying
...
Previously we would transliterate æ → ae and å → a (via iconv) but something like é became 'e.
Related to issue textmate/latex.tmbundle#87 .
2014-09-15 11:02:25 +02:00
Allan Odgaard
5d72c8a2c5
Support case-insensitive glob matching
2014-08-24 12:12:24 +02:00
Allan Odgaard
94165739fb
Improve capitalization heuristic
...
See added/updated tests for details.
2014-08-22 14:29:16 +02:00
Allan Odgaard
e81286b0cd
Remove unused include
2014-05-16 22:11:28 +07:00
Allan Odgaard
af3f4aaa33
Check result of most CF/CT ‘Create’ functions
2014-05-15 13:17:30 +07:00
Allan Odgaard
c272afaff2
Cleanup/harmonize whitespace
...
Leading indent should consist only of tabs, beyond that, only spaces should be used.
2014-04-25 16:55:31 +07:00
Allan Odgaard
9e4a5ccd82
Add instance counter for node_t (used by glob parser)
...
This will alert us of any leaks (if instance count is non-zero during quit).
2014-04-19 17:01:31 +07:00
Allan Odgaard
91b216bf24
Use glob parser for brace expansion
2014-04-19 17:01:31 +07:00
Allan Odgaard
d178527924
Do not make expansion order assumptions about consecutive braces
2014-04-19 17:01:31 +07:00
Allan Odgaard
7d1f7941b9
Include exclude operator in glob syntax comment/documentation
2014-04-19 17:01:31 +07:00
Allan Odgaard
78e76f55d8
Improve handling of empty braces in globs
...
We treat empty braces as literal characters though do balance them.
2014-04-18 20:30:07 +07:00
Allan Odgaard
9524439aef
Handle bang in globs (negation) identically to tilde
...
This simplifies the code (slightly) and allows the bang to appear in other positions than leading.
2014-04-18 06:40:48 +07:00
Allan Odgaard
45481d2e4d
Add tilde (~) as a glob “exclude” operator
...
For example the following glob will match C++/Objective-C++ source/header files, except those in the ‘vendor’ directory: *.{cc,mm,h}~vendor/**
It is possible to do multiple exclusions, e.g.: src/**~*.log~*.db
It is also possible to start with the exclude operator to negate the pattern (identical to the ! operator).
The exclude operator is not supported inside brace expansion, e.g.: {*.o,*~.nib} will treat it as a literal tilde. Furthermore, placing the tilde last will also treat it as a literal tilde, e.g.: *.txt~
In the exclude pattern, single/double asterisk (*/**) will match hidden files.
2014-04-18 06:40:48 +07:00
Allan Odgaard
01722b9a6e
Create custom parser for glob patterns
...
Previously we parsed them using regular expressions, but future improvements is hard using that approach.
2014-04-18 06:39:55 +07:00
Allan Odgaard
0b2932b3de
Add test for empty glob (should not match anything)
2014-04-18 06:39:28 +07:00
Allan Odgaard
39b94e6ac3
Harmonize whitespace and add trailing newline
2014-04-14 14:26:52 +07:00
Allan Odgaard
96de950ed1
Return initializer list instead of using std::make_pair (C++11)
2014-04-06 19:36:09 +07:00
Allan Odgaard
6185cc17ab
Do not inherit numbered variables for potential regexp captures
...
If the format string itself does a replacement with potential captures $1-$n then we ensure that $1-$n are not inherited from the environment (which could be a parent regexp match).
2014-04-05 14:13:39 +07:00
Allan Odgaard
69c83e56df
The ‘const’ keyword should be to the right of its type
...
The standard doesn’t care which side the keyword is placed on, but placing it on the right makes it easier to read types.
E.g. reading “int const* const” from right to left we get “const pointer to const integer”.
2014-03-31 08:27:19 +07:00
Allan Odgaard
db13d4c1f9
Use std::string::back() instead of operator[] with size()-1
2014-03-31 08:27:18 +07:00
Allan Odgaard
c7ae7d1337
Add test for snippets with overlapping fields
...
See 4e1cdb4c9e for details.
2014-03-07 00:10:35 +07:00
Allan Odgaard
c2397484b8
Use C++11 for loop
...
Majority of the edits done using the following ruby script:
def update_loops(src)
dst, cnt = '', 0
block_indent, variable = nil, nil
src.each_line do |line|
if block_indent
if line =~ /^#{block_indent}([{}\t])|^\t*$/
block_indent = nil if $1 == '}'
line = line.gsub(%r{ ([^a-z>]) \(\*#{variable}\) | \*#{variable}\b | \b#{variable}(->) }x) do
$1.to_s + variable + ($2 == "->" ? "." : "")
end
else
block_indent = nil
end
elsif line =~ /^(\t*)c?iterate\((\w+), (?!diacritics::make_range)(.*\))$/
block_indent, variable = $1, $2
line = "#$1for(auto const& #$2 : #$3\n"
cnt += 1
end
dst << line
end
return dst, cnt
end
paths.each do |path|
src = IO.read(path)
cnt = 1
while cnt != 0
src, cnt = update_loops(src)
STDERR << "#{path}: #{cnt}\n"
end
File.open(path, "w") { |io| io << src }
end
2014-03-03 10:34:13 +07:00
Allan Odgaard
1781f4a605
Use proper iterate macro for temporary
2014-03-03 00:20:02 +07:00
Allan Odgaard
d843225d81
Lines increasing and decreasing indent no longer go below zero
...
Normally a line matched by both patterns will be decreased by one unit compared to the non-ignored lines immediately above and below. If however the line above was not indented, the line would in theory be decreased to -1 and thus just go back to zero indent for the line following it.
2013-11-08 00:38:53 +01:00
Allan Odgaard
558d7ee8b9
Don’t default placeholders with no default text as mirrors
2013-10-04 16:51:27 +02:00
Allan Odgaard
c5558d0574
Remove a few std::shared_ptr typedefs
2013-10-04 16:51:26 +02:00
Allan Odgaard
1c308c810d
Use map::emplace instead of inserting std::pair (C++11)
2013-09-05 20:59:11 +02:00
Allan Odgaard
e4e80a946c
Use std::make_shared
2013-09-03 12:27:20 +02:00
Allan Odgaard
27c054484e
Allow “stop chars” when parsing a format string
...
This is useful when we have a format that embed format strings and we wish to use the format string parsers (to avoid an extra layer of escapes).
2013-08-28 15:27:42 +02:00
Allan Odgaard
e1230653f8
Support hex characters in format strings
2013-08-27 15:30:09 +02:00
Allan Odgaard
64663dd17f
Allow creating non-capturing regexps
2013-08-25 21:13:06 +02:00
Allan Odgaard
36c5ff4288
Support ${var} in regexp part of format string transformations
2013-08-24 20:28:16 +02:00
Allan Odgaard
1e27f6bf47
Add ONIG_OPTION_NOTGPOS
2013-08-18 17:29:30 +02:00
Allan Odgaard
7350192d51
DFA nodes themselves should not dispose children
...
A DFA node may be disposed as part of DFA construction (because the node is redundant) and here it would have “next” pointers setup, which it should not follow in its destructor, since those nodes could still be used.
Fixes #1086
2013-08-14 10:41:30 +02:00
Allan Odgaard
5512d65ecf
Remove some commented debug output blocks
2013-08-12 22:57:57 +02:00
Allan Odgaard
f7b9694e9f
Fix linear destruction of DFA
...
This is a graph (not a tree) so we have to watch for cycles.
2013-08-12 22:57:57 +02:00
Allan Odgaard
a74bfcc206
Remove some uses of foreach()
2013-08-12 19:32:23 +02:00