journal: dates should be followed by whitespace or newline
This commit is contained in:
parent
2992ce069d
commit
efe7c7a029
@ -327,6 +327,7 @@ transaction = do
|
|||||||
sourcepos <- getPosition
|
sourcepos <- getPosition
|
||||||
date <- datep <?> "transaction"
|
date <- datep <?> "transaction"
|
||||||
edate <- optionMaybe (secondarydatep date) <?> "secondary date"
|
edate <- optionMaybe (secondarydatep date) <?> "secondary date"
|
||||||
|
lookAhead (spacenonewline <|> newline) <?> "whitespace or newline"
|
||||||
status <- status <?> "cleared flag"
|
status <- status <?> "cleared flag"
|
||||||
code <- codep <?> "transaction code"
|
code <- codep <?> "transaction code"
|
||||||
description <- descriptionp >>= return . strip
|
description <- descriptionp >>= return . strip
|
||||||
@ -492,7 +493,7 @@ secondarydatep primarydate = do
|
|||||||
return edate
|
return edate
|
||||||
|
|
||||||
status :: GenParser Char JournalContext Bool
|
status :: GenParser Char JournalContext Bool
|
||||||
status = try (do { many spacenonewline; (char '*' <|> char '!') <?> "status"; return True } ) <|> return False
|
status = try (do { many1 spacenonewline; (char '*' <|> char '!') <?> "status"; return True } ) <|> return False
|
||||||
|
|
||||||
codep :: GenParser Char JournalContext String
|
codep :: GenParser Char JournalContext String
|
||||||
codep = try (do { many1 spacenonewline; char '(' <?> "codep"; code <- anyChar `manyTill` char ')'; return code } ) <|> return ""
|
codep = try (do { many1 spacenonewline; char '(' <?> "codep"; code <- anyChar `manyTill` char ')'; return code } ) <|> return ""
|
||||||
|
|||||||
@ -35,3 +35,17 @@ hledgerdev -f- print
|
|||||||
b
|
b
|
||||||
>>>2 /bad date/
|
>>>2 /bad date/
|
||||||
>>>= 1
|
>>>= 1
|
||||||
|
# 5. dates should be followed by whitespace or newline
|
||||||
|
hledgerdev -f- print
|
||||||
|
<<<
|
||||||
|
2015/9/6:
|
||||||
|
a 0
|
||||||
|
>>>2 /unexpected ":"/
|
||||||
|
>>>= 1
|
||||||
|
# 6.
|
||||||
|
hledgerdev -f- print
|
||||||
|
<<<
|
||||||
|
2015/9/6=9/6* x
|
||||||
|
a 0
|
||||||
|
>>>2 /unexpected "*"/
|
||||||
|
>>>= 1
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user