Commit a863575a authored by Leonid Onokhov's avatar Leonid Onokhov
Browse files

A little bit more robust lexer for docs

parent 17352791
......@@ -209,18 +209,20 @@ class CabalLexer(lexer.RegexLexer):
name = 'Cabal'
aliases = ['cabal']
filenames = ['.cabal']
flags = re.MULTILINE# | re.DOTALL
flags = re.MULTILINE
tokens = {
'root' : [
(r'\n', token.Text),
(r'^\s*(--.*)$', token.Comment.Single),
(r'[^\S\n]+', token.Text),
(r'(\n\s*|\t)', token.Whitespace),
(r'&&|\|\||==|<=|>=|<|>|^=', token.Operator),
(r',', token.Punctuation),
(r'^\s*([\w\-_]+:)', token.Keyword),
(r'^\s*([\w\-_]+)(\s+)([\w\-_]+).*$', lexer.bygroups(token.Keyword, token.Whitespace, token.Name)),
(r'.', token.Text)
(r'\n', token.Text),
(r'^\s*(--.*)$', token.Comment.Single),
# key: value
(r'^(\s*)([\w\-_]+)(:)',
lexer.bygroups(token.Whitespace, token.Keyword, token.Punctuation)),
(r'^([\w\-_]+)', token.Keyword), # library, executable, flag etc.
(r'[^\S\n]+', token.Text),
(r'(\n\s*|\t)', token.Whitespace),
(r'&&|\|\||==|<=|>=|<|>|^=', token.Operator),
(r',|:|{|}', token.Punctuation),
(r'.', token.Text)
],
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment