Skip to content

Demo syntax and syntax-markdown extensions #65 - #66

Open
jmatsushita wants to merge 1 commit into
feature/file-eventfrom
feature/demo-syntax
Open

Demo syntax and syntax-markdown extensions #65#66
jmatsushita wants to merge 1 commit into
feature/file-eventfrom
feature/demo-syntax

Conversation

@jmatsushita

Copy link
Copy Markdown
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
Copy Markdown
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.

2 participants