1
1
mirror of https://github.com/github/semantic.git synced 2024-12-01 00:33:59 +03:00

Map NodeType onto Grammar.

This commit is contained in:
Rob Rix 2017-06-07 18:13:44 -04:00
parent e4ad59bb25
commit 9c49f3366f

View File

@ -63,6 +63,28 @@ cmarkParser source = pure . toTerm (totalRange source) (rangeToSourceSpan source
toCategory t = Other (show t) toCategory t = Other (show t)
toSpan PosInfo{..} = SourceSpan (SourcePos (pred startLine) (pred startColumn)) (SourcePos (pred endLine) endColumn) toSpan PosInfo{..} = SourceSpan (SourcePos (pred startLine) (pred startColumn)) (SourcePos (pred endLine) endColumn)
toGrammar :: NodeType -> Grammar
toGrammar DOCUMENT{} = Document
toGrammar THEMATIC_BREAK{} = ThematicBreak
toGrammar PARAGRAPH{} = Paragraph
toGrammar BLOCK_QUOTE{} = BlockQuote
toGrammar HTML_BLOCK{} = HTMLBlock
toGrammar CUSTOM_BLOCK{} = CustomBlock
toGrammar CODE_BLOCK{} = CodeBlock
toGrammar HEADING{} = Heading
toGrammar LIST{} = List
toGrammar ITEM{} = Item
toGrammar TEXT{} = Text
toGrammar SOFTBREAK{} = SoftBreak
toGrammar LINEBREAK{} = LineBreak
toGrammar HTML_INLINE{} = HTMLInline
toGrammar CUSTOM_INLINE{} = CustomInline
toGrammar CODE{} = Code
toGrammar EMPH{} = Emphasis
toGrammar STRONG{} = Strong
toGrammar LINK{} = Link
toGrammar IMAGE{} = Image
instance Symbol Grammar where instance Symbol Grammar where
symbolType _ = Regular symbolType _ = Regular