-
Notifications
You must be signed in to change notification settings - Fork 63
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
feat(#331): Literate Haskell Support #344
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks and seems to work great! Mostly just looking for enhanced documentation. Why did you make the decisions you did?
@@ -0,0 +1,11 @@ | |||
[package] | |||
name = "harper-literate-haskell" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure this includes all the keys that the other public crates include (repository, etc).
} | ||
|
||
impl Masker for LiterateHaskellMasker { | ||
fn create_mask(&mut self, source: &[char]) -> harper_core::Mask { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a language specification you're referencing for this implementation? If so, make sure to link it here.
@@ -0,0 +1,145 @@ | |||
use harper_core::{CharStringExt, Mask, Masker, Span}; | |||
|
|||
pub struct LiterateHaskellMasker { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Give us a brief description of what this does. What part of the text are we masking?
Keep in mind that this will get posted on crates.io
and therefore docs.rs
, so we want doc-comments that somewhat explain things.
let source = text.chars().collect_vec(); | ||
let parser = LiterateHaskellParser; | ||
|
||
if let Some(new_dict) = parser.create_ident_dict(&source) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be generalized to the other languages?
The parser does not support parsing the actual code beyond extracting identifiers, but I don't know how that would be implemented considering the vastly different contexts.
If we were able to, using CommentParser would be great. It is a little weird to have comments in your code when it's literate programming anyway, but I can see it happening.
Will need to be revisited before/after merging #302 because of the changes to the
Parser
andMasker
traits.