Parsing: Simplified and improved singleQuoteStart.
This makes 's', 'l', etc. parse properly. Formerly we had some English-centric heuristics, but they are no longer needed now that we keep track of the last 'Str' position in state. Closes #698.
This commit is contained in:
parent
360f8a3d01
commit
127851ea61
1 changed files with 2 additions and 8 deletions
|
@ -161,7 +161,7 @@ import Text.HTML.TagSoup.Entity ( lookupEntity )
|
|||
import Data.Default
|
||||
import qualified Data.Set as Set
|
||||
import Control.Monad.Reader
|
||||
import Control.Applicative ((*>), (<*), liftA2)
|
||||
import Control.Applicative ((*>), (<*), (<$), liftA2)
|
||||
import Data.Monoid
|
||||
|
||||
type Parser t s = Parsec t s
|
||||
|
@ -882,13 +882,7 @@ singleQuoteStart = do
|
|||
st <- getState
|
||||
-- single quote start can't be right after str
|
||||
guard $ stateLastStrPos st /= Just pos
|
||||
try $ do charOrRef "'\8216\145"
|
||||
notFollowedBy (oneOf ")!],;:-? \t\n")
|
||||
notFollowedBy (char '.') <|> lookAhead (string "..." >> return ())
|
||||
notFollowedBy (try (oneOfStrings ["s","t","m","ve","ll","re"] >>
|
||||
satisfy (not . isAlphaNum)))
|
||||
-- possess/contraction
|
||||
return ()
|
||||
() <$ charOrRef "'\8216\145"
|
||||
|
||||
singleQuoteEnd :: Parser [Char] st ()
|
||||
singleQuoteEnd = try $ do
|
||||
|
|
Loading…
Reference in a new issue