f8860c385e
Style change: added cino=:0 (i.e. case statements on same indentation as
...
switch). Also fixed issue where $$ would fail to match with trailing
newline on file
2021-08-28 16:05:30 -07:00
9db5e91781
Only print filenames when there are multiple files
2021-08-25 13:15:05 -07:00
5eda0d4b88
Only print all input if input is stdin *and* context is ALL
2021-08-23 22:33:58 -07:00
9d0db7e2a3
Instead of always printing all context with -r flag, always print all
...
context with handling piped in input
2021-08-23 22:29:11 -07:00
2f9b0ce941
Always print file when context is ALL
2021-08-23 12:42:57 -07:00
07c628471c
Changed it so --replace makes context default to all
, but --inplace
...
doesn't, so it can still be easily used as a filter.
2021-08-06 18:11:29 -07:00
7803453977
Inplace modifying should set context to all
2021-08-06 18:06:11 -07:00
887b1dc7f2
Properly set modifying_file/backup_file in case of errors
2021-08-06 17:58:44 -07:00
ac2e8f5a15
Improved, cleaner/faster/more flexible return value checks
2021-08-06 17:52:20 -07:00
7456a21ddb
Use git ls-files -z
instead of newline-separated
2021-08-06 13:26:05 -07:00
567045c621
Reduced code duplication on inplace mode
2021-08-06 13:15:27 -07:00
5eb905b01f
Deprecated --confirm flag
2021-08-06 12:50:57 -07:00
70f7f8c495
Added -B and -A options to match grep
2021-08-02 12:25:52 -07:00
db3c88d16b
Context flag: -c -> -C (to match grep), and confirm flag: -C -> -c
2021-08-02 11:45:01 -07:00
41bd2ce6fa
Renamed matchviz -> explain
2021-08-01 21:30:41 -07:00
0b2de4721f
Moved caching code onto the file, which fixed an issue with file slicing
...
having stale cache values.
2021-08-01 15:36:53 -07:00
d3c1526f71
Cleanup of space/line skipping code
2021-08-01 13:41:13 -07:00
994c9c973e
Changed how definitions work
2021-08-01 12:40:27 -07:00
cb9b4c40d8
Added -w/--word flag
2021-07-30 20:46:50 -07:00
18e8a131f5
xfree() -> delete()
2021-07-30 15:06:04 -07:00
3e63da180b
Cleaner checking of stdlib negative returns
2021-07-30 15:03:21 -07:00
33a63bb8d9
Improved error checking
2021-07-30 14:54:28 -07:00
ad640caac6
Removing DEBUG_HEAP, just do a full cleanup all the time
2021-07-30 13:38:39 -07:00
f23b9bc637
Introduced cache to greatly speed up many use cases
2021-07-26 20:59:45 -07:00
01410bd09d
Removed unnecessary code
2021-07-17 16:53:13 -07:00
378e94090f
Factored debug visualization into its own file
2021-07-17 14:05:10 -07:00
416484a636
Switched /etc/xdg/bp -> /etc/bp
2021-07-03 21:43:56 -07:00
c89fd1db42
Added lots of extra compiler flags
2021-05-31 13:25:38 -07:00
315aedc7cb
Minor splint fixes
2021-05-22 22:02:22 -07:00
219f62ed3f
Renamed file_t.contents -> file_t.start, added file_t.memory for
...
canonical tracking of memory for mmap, simplified json printing,
and added support for initiating searches on a specific line (and/or
column).
2021-05-20 18:31:28 -07:00
85dba49b54
Fixed up JSON output
2021-05-20 01:00:10 -07:00
3f0ab96f7f
Fix for binary file detection bug.
2021-05-19 22:16:39 -07:00
5d5817c2a3
Fancier string escape sequences and a bit of cleanup.
2021-05-19 21:58:54 -07:00
10532ca614
Cleanup
2021-05-18 10:10:35 -07:00
48cb65d2b5
True -> 1
2021-05-18 10:07:23 -07:00
6eab931c27
Moved settings into a struct
2021-05-12 20:33:27 -07:00
f6bb376d1b
Added --color flag
2021-05-12 19:20:58 -07:00
bc0c3205ef
Removed fallback where bp prompts for a pattern if none is given.
...
Instead print usage and exit.
2021-03-26 00:06:11 -07:00
00bb63d277
Debug error
2021-03-15 18:28:55 -07:00
ced0004c87
Fix for permissions/ownership getting screwed up with inplace modifying
...
of files. With the new change, temporary files are no longer created on
the filesystem and the file is entirely modified inplace (with an
in-memory copy kept on hand for matching).
2021-03-03 17:24:23 -08:00
b9c2024743
Slightly cleaner flag parsing
2021-02-07 11:33:17 -08:00
51d5872c71
Pulled git code into a separate function
2021-01-26 19:02:56 -08:00
08c6debe78
Replaced returns with exit()s in main
2021-01-26 18:50:55 -08:00
453374f5dd
Cleanup of return/exit paths for main()
2021-01-26 18:40:29 -08:00
de0fec8fcb
Removed check() and replaced with err()/errx()
2021-01-26 17:54:23 -08:00
c46a8227d0
Added --skip flag for skipping over patterns
2021-01-20 16:12:46 -08:00
62f866e370
Bumped prefix checker on is_text_file
2021-01-18 12:57:35 -08:00
218ea864e1
Fixed buggy git ls-files line reading
2021-01-18 12:30:55 -08:00
d12cf8abbd
More bools
2021-01-18 11:52:47 -08:00
4acf91f802
More bools
2021-01-18 11:52:00 -08:00
0b0e99bfac
A few more pedantic cleanups
2021-01-18 11:28:39 -08:00
e98574570e
More static analysis cleanup
2021-01-18 11:15:53 -08:00
eece8c8556
More static analyzer cleanup, including switching to use bools where
...
appropriate and EXIT_SUCESS/EXIT_FAILURE
2021-01-18 10:30:17 -08:00
7f0c3804dc
Checking more return values (per static analyzer)
2021-01-18 09:52:35 -08:00
3ededef53d
Static analysis part 1
2021-01-18 09:15:25 -08:00
65141b2402
Propagate signals better
2021-01-18 09:05:35 -08:00
dfdc7bf94a
Fixed error printing code
2021-01-18 00:14:01 -08:00
0979e9d68d
Fixed issue where bp -g bp
would accidentally load local bp
...
executable file instead of /etc/xdg/bp/bp.bp
2021-01-17 23:37:35 -08:00
1110a0ce8b
Fixed bug with NULL filename
2021-01-17 21:15:37 -08:00
c6dd967c70
Fixed two bugs: mmapped files weren't getting closed, and filenames with
...
%s-style formatting strings caused issues.
2021-01-17 18:06:00 -08:00
e248f5b2a8
Improved handling of directories (e.g. bp foo dir/
)
2021-01-17 17:30:31 -08:00
3cc645f2d0
Improved argument parsing and added support for prompting user for a
...
pattern if none is provided
2021-01-17 13:33:10 -08:00
a4f0b93836
Added comment
2021-01-17 12:37:27 -08:00
f264731e6b
Cleaned up flag parsing code.
2021-01-17 10:27:33 -08:00
58af933f4e
Added --git/-G
2021-01-17 09:21:58 -08:00
05b9b0ff97
Better errors for bad patterns.
2021-01-17 09:11:11 -08:00
3f6e7c2beb
Renamed VM_ to BP_
2021-01-16 10:29:09 -08:00
a2f30332cc
Sorting imports
2021-01-15 19:44:16 -08:00
13c4564594
Renamed grammar -> definitions
2021-01-15 19:35:39 -08:00
44573fc224
Rename compiler -> pattern
2021-01-15 19:32:37 -08:00
270509af3b
Renamed vm->match
2021-01-15 19:30:21 -08:00
77b33d6a3c
Renaming files: printing->print, file_loader->files
2021-01-15 19:27:25 -08:00
984a869c98
Renaming 'op' member fields to 'pat'
2021-01-15 19:02:36 -08:00
09e1d1a365
Removing opcode references
2021-01-15 18:57:09 -08:00
dc38cde3c7
Better input handling.
2021-01-15 18:47:30 -08:00
253e81e1d9
More correct behavior for Ctrl-c
2021-01-15 18:45:33 -08:00
f5881a8c96
Better behavior for --context when it comes to --inplace (context used
...
for --confirm)
2021-01-15 18:43:03 -08:00
813d9a76af
Renaming op -> pat, phase 1 refactor
2021-01-15 18:38:06 -08:00
631e59bfa7
Fully supporting NAME make argument
2021-01-15 18:32:56 -08:00
d31d2e8985
Added interactive confirmation mode for replacing text
2021-01-15 18:23:18 -08:00
00b96b1e13
Print trailing context in INPLACE modification
2021-01-15 13:12:22 -08:00
6fd46f996e
Removed auto-context-lines for -r flag
2021-01-15 12:53:57 -08:00
271ddaae66
Moved too-many-patterns check
2021-01-15 12:44:08 -08:00
ce1868d707
Added support for bp -p 'foo: "xx"; baz; baz: foo'
2021-01-15 12:40:19 -08:00
b29060f38b
Cleaned up and simplified global state setting stuff (e.g. --verbose)
2021-01-15 02:05:17 -08:00
8ff80b09cc
Major overhaul of how different modes of behavior work. Approximately 2x
...
speedup and 2x memory footprint reduction. Also removed --mode and
VM_HIDE (~ operator), and added --context. Printing works better now.
2021-01-15 01:19:10 -08:00
2c43d65c7d
Made all the heap garbage collection code optional, which saves some
...
time and memory.
2021-01-14 19:43:30 -08:00
3cd61e3abc
Overhaul of memory tracking and left recursion. Added explanation doc
...
for left recursion and fixed all visible memory leaks.
2021-01-14 19:21:31 -08:00
43aeadaab8
Replaced _exit()s with exits()
2021-01-13 19:01:49 -08:00
e7f94bbf50
Working towards zero memory leakage
2021-01-13 18:56:22 -08:00
45d7aff475
Major overhaul of some of the memory tracking code, as well as some
...
cleanup of the compilation code.
2021-01-13 01:48:36 -08:00
6deb08a4ab
Added forward declarations for static functions
2021-01-12 22:33:28 -08:00
2d109f974b
Some general cleanup, adding comments, adding more __attribute__s where
...
applicable
2021-01-12 22:22:38 -08:00
b27b71608b
Standardizing to line-comments instead of block comments
2021-01-12 21:04:43 -08:00
8144ae5dc9
Renamed op.op -> op.type
2021-01-12 19:27:57 -08:00
38bfd5ce0e
Making the code more intuitive and cleaning up some memory between
...
files.
2021-01-12 18:35:41 -08:00
421880be12
Refactor of grammar logic to instead *only* use a linked list for all
...
grammar rules and backrefs. This simplifies things a lot.
2021-01-10 01:45:40 -08:00
b8a5d399d7
Removing unnecessary fields
2021-01-10 00:39:34 -08:00
9d1f51c483
Simplified grammars using intrusive linked lists instead of dynamic
...
arrays
2021-01-10 00:12:09 -08:00
03c790d5b6
Renamed viz -> printing, and tidied up the code a bit
2021-01-08 01:06:43 -08:00