Commit Graph

422 Commits

Author SHA1 Message Date
Tom Alexander
42fca12e41
Add support for indenting greater blocks. 2023-04-07 16:18:13 -04:00
Tom Alexander
7023fb4617
Add a comment about a shortcoming. 2023-04-03 19:40:20 -04:00
Tom Alexander
d7f0a02bb8
Fix plain list ending with another element. 2023-04-03 19:30:17 -04:00
Tom Alexander
9257420c83
Add comment defining problem. 2023-04-03 19:19:33 -04:00
Tom Alexander
70225a668b
Do not match lesser blocks. 2023-04-03 18:38:35 -04:00
Tom Alexander
6e6ec56d1f
Basic implementation of greater block parser. 2023-04-03 18:33:07 -04:00
Tom Alexander
9e0bea4c3e
Starting the greater block source. 2023-04-03 17:36:56 -04:00
Tom Alexander
9ad428bb20
Standardize on the children name instead of contents. 2023-04-03 17:33:01 -04:00
Tom Alexander
11f127b545
Minor cleanup. 2023-04-03 17:25:30 -04:00
Tom Alexander
c7c922a4df
Do not allow plain lists to start with an asterisk with no indent. 2023-04-03 16:38:26 -04:00
Tom Alexander
b5b335b9b0
Fix handling of whitespace at the end of paragraphs and mandatory whitespace in list items. 2023-04-03 16:30:58 -04:00
Tom Alexander
2d1df18544
Cleanup. 2023-04-03 15:15:16 -04:00
Tom Alexander
2552ba28d1
Correctly parsing plain list items. 2023-04-03 15:06:12 -04:00
Tom Alexander
e681f8fdff
Remove the exit matcher block.
I'm not sure this is a problem, but while I'm debugging I want this removed to be safe.
2023-03-31 13:22:30 -04:00
Tom Alexander
2b0e88dc01
The current problem is plain_list_item_end is not taking into account depth. 2023-03-31 13:08:53 -04:00
Tom Alexander
68156f3667
Consume line break at the end of paragraph. 2023-03-31 11:42:04 -04:00
Tom Alexander
707eac5bf8
Move trailing whitespace parsing to a separate element.
I still need to parse the line break at the end of elements.
2023-03-31 11:16:37 -04:00
Tom Alexander
602cf4c374
Removing regurgitate calls.
This hacky solution ends up with whitespace getting captured twice so I will need to either use context or a separate parser.
2023-03-31 09:54:48 -04:00
Tom Alexander
775e703ade
Not sure whats going on. 2023-03-27 19:19:51 -04:00
Tom Alexander
9545990b52
Regurgitate seems to have made all text a paragraph. 2023-03-27 19:12:20 -04:00
Tom Alexander
3643f91bac
The current problem is whitespace at the end of a list item should not be consumed. 2023-03-27 18:50:25 -04:00
Tom Alexander
3d8fe253c9
Check for exit matcher between elements in a plain list item. 2023-03-27 18:22:08 -04:00
Tom Alexander
2c7a559869
Fix the line break consumption issue.
This leaves us with an issue of lists becoming needlessly nested.
2023-03-27 18:10:14 -04:00
Tom Alexander
028946ec90
Identified the problem.
The issue is plain text is eating the line break so paragraph is failing since it expects a line break at the end.
2023-03-27 18:08:17 -04:00
Tom Alexander
cddefdb963
Remove unnecessary exit matcher check. 2023-03-27 16:53:38 -04:00
Tom Alexander
a77d2655bd
Instrument the code. 2023-03-27 16:36:43 -04:00
Tom Alexander
22a2ed29f1
Integrate plain list parser into the parser tree. 2023-03-27 13:06:41 -04:00
Tom Alexander
81a9a754de
I seem to have solved the infinite loop issue by moving the exit check into the plain list parser. 2023-03-27 12:52:49 -04:00
Tom Alexander
188fdaacbc
Remove dead line of code. 2023-03-27 12:07:40 -04:00
Tom Alexander
d2923bfc0f
Add a special case exit matcher for end of file. 2023-03-25 14:45:35 -04:00
Tom Alexander
fc9d131740
Add basic test for plain list item. 2023-03-25 14:28:48 -04:00
Tom Alexander
422535fbe4
Wrote a plain list item parser. 2023-03-25 14:23:52 -04:00
Tom Alexander
e6752b9d83
Building the plain list item context. 2023-03-25 14:10:22 -04:00
Tom Alexander
4a863e92ff
Add a test case showing only paragraphs exist on the first line for plain lists. 2023-03-25 13:25:20 -04:00
Tom Alexander
ab09edb5de
Initial structures for plain lists. 2023-03-25 13:16:28 -04:00
Tom Alexander
74fc440cbd
Move parsers for specific objects/elements to their own files.
The parsers are the most complicated part, so I want them in their own files. I am uncertain if I want to move their corresponding structs or just the parsers.
2023-03-25 12:53:57 -04:00
Tom Alexander
5d9771c3b6
Move old modules out of the src tree. 2023-03-25 12:25:05 -04:00
Tom Alexander
23eb4d01f4
Add title to heading object. 2023-03-25 12:18:47 -04:00
Tom Alexander
e3f6dd497a
Test cases showing headings handling nesting properly. 2023-03-25 12:01:50 -04:00
Tom Alexander
3a0a4c8953
Consume the trailing whitespace after a headline. 2023-03-25 11:59:19 -04:00
Tom Alexander
b65c2f86b5
Consume trailing whitespace in paragraphs. 2023-03-25 11:50:15 -04:00
Tom Alexander
faf2bb401d
Fix plain text matcher exit conditions. 2023-03-25 11:40:12 -04:00
Tom Alexander
2ab407bb83
Invoke the document parser. 2023-03-25 11:27:38 -04:00
Tom Alexander
3c26933e7f
Move some functions into util. 2023-03-25 11:25:10 -04:00
Tom Alexander
d582c8603a
Implement a basic paragraph parser. 2023-03-25 11:22:59 -04:00
Tom Alexander
b88365e7eb
Wrote plain text parser. 2023-03-25 10:45:43 -04:00
Tom Alexander
f2d16d302a
Implement document parser. 2023-03-24 17:34:56 -04:00
Tom Alexander
7ab3df6938
Use headline instead of heading for section_end.
This should be more performant.
2023-03-24 17:30:33 -04:00
Tom Alexander
8013f127df
Implement heading parser. 2023-03-24 17:19:46 -04:00
Tom Alexander
dc9f3eb2e6
Implement the section parser. 2023-03-24 17:00:27 -04:00
Tom Alexander
754c1922df
Create a start_of_line parser. 2023-03-24 16:37:34 -04:00
Tom Alexander
ceb7788cfa
Check the exit matcher in more places. 2023-03-23 20:12:42 -04:00
Tom Alexander
3502a31b28
Simple version of the headline parser done. 2023-03-23 20:03:45 -04:00
Tom Alexander
4f10f2abec
Solved the lifetime issue by using the standard many1 combinator. 2023-03-23 20:00:35 -04:00
Tom Alexander
02d04b59db
Ran into a lifetime issue. 2023-03-23 19:53:20 -04:00
Tom Alexander
5c8a064eca
Start writing the parser for headings. 2023-03-23 19:35:32 -04:00
Tom Alexander
d3c804942f
Simplified context_many1 based on the assumption that we will not use previous element context elements. 2023-03-23 18:25:00 -04:00
Tom Alexander
ee60cf40dd
Disable building the old combinator. 2023-03-23 18:01:33 -04:00
Tom Alexander
6042c44514
Starting to define document parser. 2023-03-23 17:59:39 -04:00
Tom Alexander
d98a11059c
Introduce the document structure. 2023-03-23 17:52:16 -04:00
Tom Alexander
35d60c10ba
Define greater and lesser elements. 2023-03-23 17:26:07 -04:00
Tom Alexander
66befc66a9
Define regular link. 2023-03-23 17:02:08 -04:00
Tom Alexander
87c4a955af
Starting to define objects based on org-mode's definitions. 2023-03-23 16:49:52 -04:00
Tom Alexander
36210c2d7f
Add a DocumentRoot context element storing the original full document.
This might be used for look-behind instead of storing previous element nodes in the context tree.
2023-03-23 16:40:39 -04:00
Tom Alexander
f060e7189b
Minor cleanup. 2023-03-23 14:13:21 -04:00
Tom Alexander
cee12b7512
Allow IgnoreParent to be dead code. 2023-03-21 13:44:22 -04:00
Tom Alexander
77d8c5e029
Mark the plain list functions as allow dead code. 2023-03-21 13:38:23 -04:00
Tom Alexander
2fcb445fe9
Switch to ending plain lists with 2 blank lines instead of just 1. 2023-03-21 13:36:52 -04:00
Tom Alexander
e3f0aaefdf
Add TODO. 2023-03-19 18:28:59 -04:00
Tom Alexander
bf3464c65c
End list items when the following line is indented less than or equal to the current item. 2023-03-19 13:05:37 -04:00
Tom Alexander
6d19eeb0f4
Add parsers for lines that are indented less than or equal to the current line item's indent. 2023-03-18 17:32:07 -04:00
Tom Alexander
29904f2bb5
Detect next list item as ender for current list item. 2023-03-18 14:36:33 -04:00
Tom Alexander
88c974f8e4
Record the list item indent depth in the context tree. 2023-03-18 13:26:35 -04:00
Tom Alexander
32897270a5
Support leading whitespace for list items. 2023-03-18 13:26:32 -04:00
Tom Alexander
37070689c6
Continued work on item parser.
Still needs to:

1. Do context things
2. Fix the double-space after the tag separator issue
3. Add support for indentation
4. Write item_end
5. Write plain_list
2022-12-18 07:52:02 -05:00
Tom Alexander
5e7c891681
Start of list item implementation. 2022-12-18 07:52:02 -05:00
Tom Alexander
62e5499150
Add parsers for most of the rest of item. 2022-12-18 07:52:02 -05:00
Tom Alexander
b4e28f3d4d
Implement a parser for a bullet in a list item. 2022-12-18 07:52:02 -05:00
Tom Alexander
76b2325486
Start the plain list module. 2022-12-18 07:52:01 -05:00
Tom Alexander
f39319702c
Switch to nom's consumed. 2022-12-18 07:52:01 -05:00
Tom Alexander
89758721ed
Rename contents to source to match objects that need to store a separate source. 2022-12-18 04:42:13 -05:00
Tom Alexander
448dcfac72
Create an also_recognize combinator to make providing source slices fast and safe. 2022-12-18 04:36:12 -05:00
Tom Alexander
60d9487fdf
Add comment. 2022-12-18 04:36:12 -05:00
Tom Alexander
f7de564deb
Add a source trait to ensure we can re-create the source document using the parsed objects. 2022-12-18 04:36:12 -05:00
Tom Alexander
50a67c65ef
Standardize order of lifetimes for r and s. 2022-12-18 03:30:36 -05:00
Tom Alexander
2def475337
Move the structs into the token module. 2022-12-18 03:24:35 -05:00
Tom Alexander
8211e1043f
Move in_section to a util module. 2022-12-18 03:18:43 -05:00
Tom Alexander
6404e5f50e
Cleanup 2022-12-18 03:15:11 -05:00
Tom Alexander
4ac3a47deb
Move the text element parser into the text module. 2022-12-18 03:15:11 -05:00
Tom Alexander
46672b40b2
Cleanup. 2022-12-18 03:04:31 -05:00
Tom Alexander
54ed989300
Move Res into the error type module. 2022-12-18 03:04:31 -05:00
Tom Alexander
a005502d97
Move another function inside bold that was only used by bold. 2022-12-18 02:55:14 -05:00
Tom Alexander
eaf8721ae9
Move paragraph to its own module. 2022-12-18 02:53:26 -05:00
Tom Alexander
7fc19cc9a6
Rename the parser for bold and link. 2022-12-18 02:39:29 -05:00
Tom Alexander
58f2f4e6aa
Move link to its own module. 2022-12-18 02:37:42 -05:00
Tom Alexander
0b35491047
Move bold out to its own module. 2022-12-18 02:30:24 -05:00
Tom Alexander
6352f92ebc
Rename nom context to parser context. 2022-12-18 02:16:28 -05:00
Tom Alexander
6caaeddc37
Update link to use the new contextual combinators like bold. 2022-12-18 02:05:21 -05:00
Tom Alexander
9eab737aa8
Add comment. 2022-12-16 01:39:57 -05:00
Tom Alexander
1da38c8f7d
Use context_many1 for paragraphs in a document. 2022-12-16 01:35:49 -05:00
Tom Alexander
601fc4776a
Have to rework the paragraph parser to return something that I'd want to put in a token, like a Paragraph struct. 2022-12-16 00:53:29 -05:00
Tom Alexander
6459cc64d0
I think thats all for context_many1. Just need to start using it. 2022-12-16 00:47:33 -05:00
Tom Alexander
1f1a18782e
Start of many1. 2022-12-16 00:21:13 -05:00
Tom Alexander
0504c48b66
Implement an iter_until. 2022-12-15 23:52:52 -05:00
Tom Alexander
0d2dfe3a14
Move context_many_till to its own combinators file. 2022-12-15 23:28:09 -05:00
Tom Alexander
c74b802038
Cleanup. 2022-12-15 23:23:03 -05:00
Tom Alexander
cd2daf6fef
Replace all TODOs wanting a custom error with a generic custom error. 2022-12-15 23:15:27 -05:00
Tom Alexander
a1adf2aa41
Custom error seems to be working. 2022-12-15 23:09:40 -05:00
Tom Alexander
f2e68612c4
Create a custom error enum to contain regular nom errors. 2022-12-15 22:57:08 -05:00
Tom Alexander
4a9bb31aed
Start of a custom error. 2022-12-15 22:38:28 -05:00
Tom Alexander
4c09c390fa
Prevent bold inside bold. 2022-12-15 21:57:21 -05:00
Tom Alexander
c6f75e1736
Don't increment Rc counters when checking exit matchers. 2022-12-15 21:30:53 -05:00
Tom Alexander
4af09a69a1
Rename fail matcher to exit matcher. 2022-12-15 21:24:53 -05:00
Tom Alexander
0c676c44c2
I need to prevent matching bold inside a bold. 2022-12-15 21:14:49 -05:00
Tom Alexander
b27be8eab1
Pass context into fail matchers. 2022-12-15 20:33:52 -05:00
Tom Alexander
23e567ca93
Add a comment with a note about what my next step is. 2022-12-11 02:31:14 -05:00
Tom Alexander
50a57ef15b
Check that there is blank space after the ending asterisk. 2022-12-11 02:24:19 -05:00
Tom Alexander
bb09ed41a4
Deciding if bold can start. 2022-12-11 02:07:12 -05:00
Tom Alexander
b6b88a7d78
Switch to using borrows instead of cloning the Rc during iteration. 2022-12-11 01:07:16 -05:00
Tom Alexander
cfdcb7408a
Implement iterator with far too many clones. 2022-12-11 01:04:51 -05:00
Tom Alexander
0bcc3d9dc6
Borrow the context instead of clone it for fewer reference count increments. 2022-12-11 00:39:35 -05:00
Tom Alexander
9dfca22b86
Switch to a contextual bold start function. 2022-12-11 00:36:59 -05:00
Tom Alexander
88bf1b3d8b
Update flat_bold to context_many_till. 2022-12-11 00:33:40 -05:00
Tom Alexander
972ffa6345
Add start of paragraph context. 2022-12-11 00:21:30 -05:00
Tom Alexander
b2742f89e2
Cleaning up. 2022-12-11 00:13:19 -05:00
Tom Alexander
103dcbea35
Add an assert. 2022-12-11 00:08:39 -05:00
Tom Alexander
7cb85fc8af
Implement two todo!()s. 2022-12-11 00:02:13 -05:00
Tom Alexander
fa1d845b76
Reverse the element order. 2022-12-10 23:57:39 -05:00
Tom Alexander
0aa8926d6b
OMFG it built. 2022-12-10 23:51:04 -05:00
Tom Alexander
7d40b8ae24
Attempt to put two lifetimes in the context. 2022-12-10 23:49:02 -05:00
Tom Alexander
75ab876b0b
Its building again. 2022-12-10 23:38:19 -05:00
Tom Alexander
7bed61a541
Lets try not digging into return type O. 2022-12-10 23:11:52 -05:00
Tom Alexander
a86ece4d02
Going down to one lifetime. 2022-12-10 22:57:30 -05:00
Tom Alexander
43fddc6e58
Re-adding 'r allowed me to remove dependency but adding in return tokens broke the build again. 2022-12-10 22:56:03 -05:00
Tom Alexander
24a8247907
Got rid of the 'r lifetimes without issue. 2022-12-10 22:31:28 -05:00
Tom Alexander
5b645c67e5
Uhhh fixed it by setting r to outlive x. I Don't know if that was correct. 2022-12-10 22:25:54 -05:00
Tom Alexander
ea63793b36
Start of attempt to return tokens. 2022-12-10 22:24:12 -05:00
Tom Alexander
a88117f731
Type issue with returning the elements. 2022-12-10 22:20:29 -05:00
Tom Alexander
2a595e2b6c
Implement ptr_eq on the context types. 2022-12-10 22:04:39 -05:00
Tom Alexander
7ba863118f
Only require a mutable borrow by using option's take(). 2022-12-10 21:36:22 -05:00
Tom Alexander
bb4b045aa8
pop_front implemented. 2022-12-10 21:27:33 -05:00
Tom Alexander
5899bde66e
Add comment of what I need to do. 2022-12-10 21:10:37 -05:00
Tom Alexander
1efe2efc41
Using many_elem twice is breaking the build. 2022-12-10 20:58:58 -05:00
Tom Alexander
95a043deef
Huh, managed to solve the lifetime issue using HRTB. Not sure if I should be changing the 'r at the end of the line. 2022-12-10 20:56:06 -05:00
Tom Alexander
e222b5a9df
Maybe we should switch to an owned context. 2022-12-10 20:53:37 -05:00
Tom Alexander
396813c70a
Two uses of context tree. 2022-12-04 00:53:59 -05:00
Tom Alexander
fb8a31a88f
I think I solved the clone issue by manually implementing clone since the Rc needs to be cloned, not the content inside it. 2022-12-04 00:04:39 -05:00
Tom Alexander
2db400198e
Going to try removing clone from the tokens. 2022-12-04 00:04:38 -05:00
Tom Alexander
b20568c09e
Clone issue. 2022-12-04 00:04:38 -05:00
Tom Alexander
96aca6b537
Switching to a new context variable. 2022-12-04 00:04:38 -05:00
Tom Alexander
c568920da8
Cleanup. 2022-12-04 00:04:38 -05:00
Tom Alexander
b15f299de8
Blindly followed the compiler's advice and it solved the build error. 2022-12-04 00:04:38 -05:00
Tom Alexander
8ae942a6fc
Remove unnecessary dynamic dispatch. 2022-12-04 00:04:38 -05:00
Tom Alexander
b17429e05c
Remove unnecessary wrapping. 2022-12-04 00:04:38 -05:00
Tom Alexander
ff65776607
Weird lifetime issue. 2022-12-04 00:04:37 -05:00
Tom Alexander
11cf24a500
Trying to switch to unbound matchers. 2022-12-04 00:04:37 -05:00
Tom Alexander
05b3ac1725
Starting an unbound matcher type to allow unbound matchers as parameters to context_many_till. 2022-12-04 00:04:37 -05:00
Tom Alexander
6cfc39ca45
Replace the old nom_context with the contents of new_context. 2022-12-04 00:04:37 -05:00
Tom Alexander
84fa1c3aae
Impleemnt the behavior for check_fail_matcher. 2022-12-04 00:04:37 -05:00
Tom Alexander
1a7bfd23f1
Implement the structure to the check_fail_matcher function. 2022-12-04 00:04:37 -05:00
Tom Alexander
13ee93f31c
It is building again. 2022-12-04 00:04:37 -05:00
Tom Alexander
83881e55b5
Omg lifetimes errors. 2022-12-04 00:04:36 -05:00
Tom Alexander
dff528da32
Implement clone for the context. 2022-12-04 00:04:36 -05:00
Tom Alexander
b91e4df797
Switch to a centrally-defined context type. 2022-12-04 00:04:36 -05:00
Tom Alexander
a3286b2542
Running into a FnOnce vs FnMut error. 2022-12-04 00:04:36 -05:00
Tom Alexander
bc91775880
Add the with_additional_node function to the ContextTree. 2022-12-04 00:04:36 -05:00
Tom Alexander
c0e51298b6
Port a lot of the function signatures over. 2022-12-04 00:04:36 -05:00
Tom Alexander
bdf3c98f34
Starting to move the org-mode specific context tree stuff over. 2022-12-03 20:47:31 -05:00
Tom Alexander
89148a623c
Move the list to its own file. 2022-12-03 20:38:56 -05:00
Tom Alexander
170ddec9a9
Starting a new context tree. 2022-12-03 20:30:03 -05:00
Tom Alexander
b9034147a6
wip 2022-12-03 19:38:04 -05:00
Tom Alexander
8608136124
Removed one wrapper. 2022-11-27 00:35:38 -05:00
Tom Alexander
7d25628f74
Same lifetime issue. 2022-11-27 00:21:34 -05:00
Tom Alexander
ec4078c812
Add a blank check_fail_matcher implementation. 2022-11-27 00:14:23 -05:00
Tom Alexander
15dedc8ee9
Add with_additional_fail_matcher. 2022-11-27 00:12:33 -05:00
Tom Alexander
a55b7c42fd
maybe working with dynamic dispatch. 2022-11-27 00:07:43 -05:00
Tom Alexander
a08fab1a8d
Remove hrtb attempt. 2022-11-27 00:02:57 -05:00
Tom Alexander
b8e3074a0e
with addition node not working. 2022-11-27 00:01:05 -05:00
Tom Alexander
7346f5e850
hrtb not working. 2022-11-26 23:56:03 -05:00
Tom Alexander
9673917a3c
get_fail_matcher implemented. 2022-11-26 23:35:10 -05:00
Tom Alexander
4a2b633f9c
Added traits for nodes and context elements. 2022-11-26 23:12:53 -05:00
Tom Alexander
f93f1c5950
Going to attempt the tree one more time. 2022-11-26 22:57:05 -05:00
Tom Alexander
2bb6f50cba
Start of working on enum. 2022-11-26 22:54:54 -05:00
Tom Alexander
f4473cbf01
Remove the new context tree implementation. 2022-11-26 22:37:00 -05:00
Tom Alexander
6e2ff8b870
Revert "Migrating to the new context tree."
This reverts commit c37008df1d41c36780c57054c3d0e0244478c8d5.
2022-11-26 22:36:02 -05:00
Tom Alexander
29add885f3
Revert "with_additional_fail_matcher is not going to work due to lifetimes with the new forced borrow."
This reverts commit 1d9fb42b6214bd922ac99ea23c1b80b756055128.
2022-11-26 22:36:00 -05:00
Tom Alexander
8659a1083e
Revert "I may need to switch to boxes."
This reverts commit bdc61c075716e1752eb1332ce8e2682f69b2e435.
2022-11-26 22:35:53 -05:00
Tom Alexander
c2bd6e23c6
I may need to switch to boxes. 2022-11-26 22:20:30 -05:00
Tom Alexander
0b2acd7e54
with_additional_fail_matcher is not going to work due to lifetimes with the new forced borrow. 2022-11-26 22:08:17 -05:00
Tom Alexander
e8b44f27e8
Migrating to the new context tree. 2022-11-26 22:03:15 -05:00
Tom Alexander
f0de041710
Make the fail matcher code in the new context tree work. 2022-11-26 21:55:33 -05:00
Tom Alexander
8abf194a12
Getting weird errors from the not()s. 2022-11-26 21:47:57 -05:00
Tom Alexander
67e95a0adc
Remove unnecessary pubs. 2022-11-26 21:28:57 -05:00
Tom Alexander
f645b0cb75
Make the node type inside the ContextTree generic but the implementation still explicitly uses dyn OrgModeContext. 2022-11-26 21:07:56 -05:00
Tom Alexander
e888c0e66f
Make the node type generic. 2022-11-26 21:02:52 -05:00
Tom Alexander
7a241353b5
New heterogeneous context tree seems to be working. 2022-11-26 20:41:37 -05:00
Tom Alexander
d9f0eda5b7
many_till ignoring context. 2022-11-26 19:54:46 -05:00
Tom Alexander
c1778a4f12
Switching to generics. 2022-11-26 19:46:59 -05:00
Tom Alexander
0fb523e0fe
mut didn't help. 2022-11-26 19:41:33 -05:00
Tom Alexander
d3b49a6835
Urg hrtb hell again. 2022-11-26 19:39:00 -05:00