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

Demo syntax and syntax-markdown extensions #65 #66

Open
wants to merge 1 commit into
base: feature/file-event
Choose a base branch
from

Conversation

jmatsushita
Copy link
Collaborator

And building on #65 here's a demo of the syntax modules (for now pinned to github commits). It would be great if you could take a look at

before I make the jump to submit my first packages on hackage?

The idea is that a syntax extension implements

type Lexer a = Y.YiString -> Tokens a
type Styler a = TokenRange a -> BufAction (Span CrdRange Style)
type Mapper = [Extension]
data Syntax a = Syntax String Mapper (Lexer a) (Styler a)

for instance:

markdown :: Mapper -> Syntax MarkdownToken
markdown mapper = Syntax "Markdown" mapper lexer styler

Which then allows to add extensions like so:

main :: IO ()
main = rasa $ do
  ...
  syntax [markdown [Extension ".md"]]

@ChrisPenner ChrisPenner changed the base branch from master to feature/file-event November 24, 2018 17:35
@ChrisPenner
Copy link
Owner

I just changed the base branch to be your other feature to clean up the diff while we review it; we'll switch it back to master when we merge 👍

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