-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
70ae278
commit a9dc927
Showing
4 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,4 @@ configureMiscModes = do | |
addMode gnuMakeMode | ||
addMode ottMode | ||
addMode whitespaceMode | ||
addMode yamlMode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
-- -*- haskell -*- | ||
-- Lexer for YAML-file | ||
-- This is based off the syntax as described in the github manual: | ||
-- http://yaml.org/spec/1.2/spec.html | ||
-- Maintainer: Junji Hashimoto | ||
{ | ||
{-# OPTIONS -w #-} | ||
module Yi.Lexer.YAML ( lexer ) where | ||
import Yi.Lexer.Alex hiding (tokenToStyle) | ||
import Yi.Style | ||
( Style ( .. ) | ||
, StyleName | ||
) | ||
import qualified Yi.Style as Style | ||
} | ||
|
||
$space = [\ ] | ||
|
||
yaml :- | ||
|
||
<0> | ||
{ | ||
^\%.* { c Style.importStyle } | ||
^\-\-\- { c Style.importStyle } | ||
^$space*\#.* { c Style.commentStyle } | ||
^$space*[\-] { c Style.keywordStyle } | ||
^$space*[^\:]+\: { c Style.keywordStyle } | ||
\n | ||
{ c Style.defaultStyle } | ||
. | ||
{ c Style.defaultStyle } | ||
} | ||
|
||
{ | ||
data HlState = | ||
TopLevel | ||
deriving Show | ||
stateToInit TopLevel = 0 | ||
|
||
initState :: HlState | ||
initState = TopLevel | ||
|
||
type Token = StyleName | ||
|
||
lexer :: StyleLexerASI HlState Token | ||
lexer = StyleLexer | ||
{ _tokenToStyle = id | ||
, _styleLexer = commonLexer alexScanToken initState | ||
} | ||
|
||
#include "common.hsinc" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters