diff options
author | kudah <kudahkukarek@gmail.com> | 2013-04-13 13:57:45 +0300 |
---|---|---|
committer | kudah <kudahkukarek@gmail.com> | 2013-04-13 13:57:45 +0300 |
commit | c17c15c41be5770e83c7c438c92ae4a326106edf (patch) | |
tree | 922c56fea99582525c3b4695e619cd1c76cfba9b /lexers/LexHaskell.cxx | |
parent | b10e80c37af88439ff22503c8d91bf9d1dda684c (diff) | |
download | scintilla-mirror-c17c15c41be5770e83c7c438c92ae4a326106edf.tar.gz |
Really minor refactor
Diffstat (limited to 'lexers/LexHaskell.cxx')
-rw-r--r-- | lexers/LexHaskell.cxx | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/lexers/LexHaskell.cxx b/lexers/LexHaskell.cxx index 3e0f83d5b..93f9d9ce4 100644 --- a/lexers/LexHaskell.cxx +++ b/lexers/LexHaskell.cxx @@ -73,15 +73,6 @@ static inline bool IsAnOperatorChar(const int ch) { || ch == '^' || ch == '|' || ch == '~' || ch == '\\'); } -static inline void skipMagicHash(StyleContext &sc, const bool magicHash, const bool twoHashes) { - if (magicHash && sc.ch == '#') { - sc.Forward(); - if (twoHashes && sc.ch == '#') { - sc.Forward(); - } - } -} - struct OptionsHaskell { bool magicHash; bool allowQuotes; @@ -150,6 +141,15 @@ class LexerHaskell : public ILexer { OptionsHaskell options; OptionSetHaskell osHaskell; + inline void skipMagicHash(StyleContext &sc, const bool twoHashes) { + if (options.magicHash && sc.ch == '#') { + sc.Forward(); + if (twoHashes && sc.ch == '#') { + sc.Forward(); + } + } + } + inline bool LineContainsImport(int line, Accessor &styler) { if (options.foldImports) { return styler.Match(styler.LineStart(line), "import"); @@ -297,7 +297,7 @@ void SCI_METHOD LexerHaskell::Lex(unsigned int startPos, int length, int initSty else if (sc.state == SCE_HA_STRING) { if (sc.ch == '\"') { sc.Forward(); - skipMagicHash(sc, options.magicHash, false); + skipMagicHash(sc, false); sc.SetState(SCE_HA_DEFAULT); } else if (sc.ch == '\\') { sc.Forward(2); @@ -312,7 +312,7 @@ void SCI_METHOD LexerHaskell::Lex(unsigned int startPos, int length, int initSty else if (sc.state == SCE_HA_CHARACTER) { if (sc.ch == '\'') { sc.Forward(); - skipMagicHash(sc, options.magicHash, false); + skipMagicHash(sc, false); sc.SetState(SCE_HA_DEFAULT); } else if (sc.ch == '\\') { sc.Forward(2); @@ -335,7 +335,7 @@ void SCI_METHOD LexerHaskell::Lex(unsigned int startPos, int length, int initSty if (sc.ch == '+' || sc.ch == '-') sc.Forward(); } else { - skipMagicHash(sc, options.magicHash, true); + skipMagicHash(sc, true); sc.SetState(SCE_HA_DEFAULT); } } @@ -669,7 +669,6 @@ void SCI_METHOD LexerHaskell::Fold(unsigned int startPos, int length, int // ini if (lineNext <= docLines) { // Information about next line is only available if not at end of document - importNext = LineContainsImport(lineNext, styler); indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL); } if (indentNext & SC_FOLDLEVELWHITEFLAG) |