2
ruleYear :: Rule
ruleYear = Rule
{ name = "year"
 , pattern=[regex "[12]\d{3})|(([\.\/\-\'])[901]\d)"] 
 --pattern = [Predicate $ isIntegerBetween 1000 2100]
 , prod = \tokens -> case tokens of
   (token:_) -> do
     n <- getIntValue token
     tt $ year n
    _ -> Nothing
}

I am new to Haskell. I was trying to modify the time parser in duckling.

I changed one of the several rules for parsing and received this error:

"lexical error in string/character literal at character 'd' " for line 4.

I am not sure what is the cause of this error and how to rectify it.

ChiralCarbon
  • 347
  • 2
  • 11

1 Answers1

2

It was fixed by using \\ instead of \ in the pattern.

ChiralCarbon
  • 347
  • 2
  • 11