imp: journal: python directive also consumes empty lines (ledger compat)
This commit is contained in:
parent
23d25c8403
commit
b1e08ffe46
@ -549,10 +549,14 @@ definedirectivep = do string "define" >> lift restofline >> return ()
|
|||||||
exprdirectivep = do string "expr" >> lift restofline >> return ()
|
exprdirectivep = do string "expr" >> lift restofline >> return ()
|
||||||
valuedirectivep = do string "value" >> lift restofline >> return ()
|
valuedirectivep = do string "value" >> lift restofline >> return ()
|
||||||
evaldirectivep = do string "eval" >> lift restofline >> return ()
|
evaldirectivep = do string "eval" >> lift restofline >> return ()
|
||||||
pythondirectivep = do string "python" >> lift restofline >> many (indented $ lift restofline) >> return ()
|
|
||||||
where
|
|
||||||
indented = (lift skipNonNewlineSpaces1 >>)
|
|
||||||
commandlineflagdirectivep = do string "--" >> lift restofline >> return ()
|
commandlineflagdirectivep = do string "--" >> lift restofline >> return ()
|
||||||
|
pythondirectivep = do
|
||||||
|
string "python" >> lift restofline
|
||||||
|
many $ indentedline <|> blankline
|
||||||
|
return ()
|
||||||
|
where
|
||||||
|
indentedline = lift skipNonNewlineSpaces1 >> lift restofline
|
||||||
|
blankline = lift skipNonNewlineSpaces >> newline >> return "" <?> "blank line"
|
||||||
|
|
||||||
keywordp :: String -> JournalParser m ()
|
keywordp :: String -> JournalParser m ()
|
||||||
keywordp = void . string . fromString
|
keywordp = void . string . fromString
|
||||||
|
|||||||
@ -69,7 +69,11 @@ tag Receipt
|
|||||||
assert value != "foobar"
|
assert value != "foobar"
|
||||||
value some_func
|
value some_func
|
||||||
python
|
python
|
||||||
import os
|
def option_pyfirst(context):
|
||||||
|
print("In --pyfirst (from %s)" % context)
|
||||||
|
|
||||||
|
def option_pysecond(context, val):
|
||||||
|
print("In --pysecond=%s (from %s)" % (val, context))
|
||||||
eval foo
|
eval foo
|
||||||
--command-line-flag
|
--command-line-flag
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user