Skip to content

Text.Parsec.Language.LanguageDef - Add spaceChar #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Text/Parsec/Language.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module Text.Parsec.Language

import Text.Parsec
import Text.Parsec.Token
import Data.Char (isSpace)

-----------------------------------------------------------
-- Styles: haskellStyle, javaStyle
Expand Down Expand Up @@ -88,6 +89,7 @@ emptyDef = LanguageDef
, reservedOpNames= []
, reservedNames = []
, caseSensitive = True
, spaceChar = satisfy isSpace
}


Expand Down
9 changes: 6 additions & 3 deletions Text/Parsec/Token.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module Text.Parsec.Token
, makeTokenParser
) where

import Data.Char ( isAlpha, toLower, toUpper, isSpace, digitToInt )
import Data.Char ( isAlpha, toLower, toUpper, digitToInt )
import Data.List ( nub, sort )
import Control.Monad.Identity
import Text.Parsec.Prim
Expand Down Expand Up @@ -95,8 +95,11 @@ data GenLanguageDef s u m

-- | Set to 'True' if the language is case sensitive.

caseSensitive :: Bool
caseSensitive :: Bool,

-- | Is whitespace character?

spaceChar :: ParsecT s u m Char
}

-----------------------------------------------------------
Expand Down Expand Up @@ -687,7 +690,7 @@ makeTokenParser languageDef


simpleSpace =
skipMany1 (satisfy isSpace)
skipMany1 (spaceChar languageDef)

oneLineComment =
do{ try (string (commentLine languageDef))
Expand Down