summaryrefslogtreecommitdiff
path: root/testsuite/tests/printer
diff options
context:
space:
mode:
authorVladislav Zavialov <vlad.z.4096@gmail.com>2022-09-16 19:03:55 +0300
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-09-18 08:01:20 -0400
commit780371678fae6cc4ab08a029f5cc35c73de2dc4b (patch)
treeeb354170b5789d12a4930f8eb791af14f7993daf /testsuite/tests/printer
parent8a666ad2a89a8ad2aa24a6406b88f516afaec671 (diff)
downloadhaskell-780371678fae6cc4ab08a029f5cc35c73de2dc4b.tar.gz
Lexer: pass updated buffer to actions (#22201)
In the lexer, predicates have the following type: { ... } :: user -- predicate state -> AlexInput -- input stream before the token -> Int -- length of the token -> AlexInput -- input stream after the token -> Bool -- True <=> accept the token This is documented in the Alex manual. There is access to the input stream both before and after the token. But when the time comes to construct the token, GHC passes only the initial string buffer to the lexer action. This patch fixes it: - type Action = PsSpan -> StringBuffer -> Int -> P (PsLocated Token) + type Action = PsSpan -> StringBuffer -> Int -> StringBuffer -> P (PsLocated Token) Now lexer actions have access to the string buffer both before and after the token, just like the predicates. It's just a matter of passing an additional function parameter throughout the lexer.
Diffstat (limited to 'testsuite/tests/printer')
0 files changed, 0 insertions, 0 deletions