Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unclosed property drawers causing a crash #102

Merged
merged 1 commit into from
Jul 8, 2021

Conversation

GuiltyDolphin
Copy link
Contributor

@GuiltyDolphin GuiltyDolphin commented Jun 28, 2021

Fixes #98.

@xiaoxinghu When a property drawer is unclosed, this just treats it as text.

I've added the modify method for Lexer, which allows you to modify a token in the lexer in-place. So in this case, if we see a property drawer token after trying to parse a property drawer, then we know it is unclosed and can modify it to be text.

A probably better approach for the future is to have the lexer check ahead for a drawer close, and only treat :PROPERTIES: as a drawer.begin token if there is a close for the drawer.

Edit: actually I think this should technically be handled in the parser (as it is in this PR), because the lexer shouldn't really be able to deal with nesting. It's probably okay to mix and match the lexer and parser a bit though, as long as they work properly.

Copy link
Collaborator

@xiaoxinghu xiaoxinghu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@xiaoxinghu xiaoxinghu merged commit f8f6ddf into orgapp:develop Jul 8, 2021
@GuiltyDolphin GuiltyDolphin deleted the gd/fix-property-drawers branch July 8, 2021 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants