aihc-parser 7.1.0.0 → 7.1.0.1
raw patch · 5 files changed
+39/−10 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +10/−0
- aihc-parser.cabal +1/−1
- src/Aihc/Parser/Lex.hs +13/−9
- test/Test/Fixtures/lexer/core/qualified-varid-then-dot.yaml +8/−0
- test/Test/Fixtures/lexer/core/qualified-varid-then-varsym.yaml +7/−0
CHANGELOG.md view
@@ -6,6 +6,16 @@ ## [Unreleased] +## [7.1.0.1] - 2026-11-29++### Fixed++- The lexer adds a segment to a qualifier only after a segment that starts+ with an upper-case letter, as GHC does. Before, it only examined the first+ segment. Thus, `C.intToDigit.fromEnum` was one qualified name with the+ qualifier `C.intToDigit`. Now it is `C.intToDigit`, then `.`, and then+ `fromEnum`. Also, `M.f.+` is now `M.f` and then `.+`.+ ## [7.1.0.0] - 2026-11-27 ### Fixed
aihc-parser.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.8 name: aihc-parser-version: 7.1.0.0+version: 7.1.0.1 build-type: Simple license: Unlicense license-file: LICENSE
src/Aihc/Parser/Lex.hs view
@@ -300,11 +300,11 @@ !firstChunkLen = utf8CharWidth c + identTailBytes hasMagicHash rest firstChunk = TU.takeWord8 firstChunkLen (lexerInput st) rest0 = TU.dropWord8 firstChunkLen (lexerInput st)- in case gatherQualified hasMagicHash False firstChunk rest0 of- (consumed, rest1, isQualified) ->+ in case gatherQualified hasMagicHash False (isConIdStart c) firstChunk rest0 of+ (consumed, rest1, isQualified, lastIsConId) -> case rest1 of '.' :< dotRest@(opChar :< _)- | isQualified || isConIdStart c,+ | lastIsConId, isSymbolicOpChar opChar -> let opChars = T.takeWhile isSymbolicOpChar dotRest fullOp = consumed <> "." <> opChars@@ -321,19 +321,23 @@ in Just (mkToken st st' consumed kind, st') _ -> Nothing where- -- The Bool accumulator records whether a qualifier segment was added.- gatherQualified :: Bool -> Bool -> Text -> Text -> (Text, Text, Bool)- gatherQualified hasMH qualified acc chars =+ -- The first Bool accumulator records whether a qualifier segment was+ -- added. The second Bool accumulator records whether the last segment+ -- starts with an upper-case letter. Only a conid segment can be part of+ -- a qualifier. Thus, @C.f.g@ is the qualified name @C.f@, then @.@, and+ -- then @g@.+ gatherQualified :: Bool -> Bool -> Bool -> Text -> Text -> (Text, Text, Bool, Bool)+ gatherQualified hasMH qualified lastIsConId acc chars = case chars of '.' :< dotRest@(c' :< more) | isIdentStart c', not (T.isSuffixOf "#" acc),- isConIdStart (T.head acc) ->+ lastIsConId -> case consumeIdentTail hasMH more of (seg, rest) -> let segWithHead = TU.takeWord8 (utf8CharWidth c' + TU.lengthWord8 seg) dotRest- in gatherQualified hasMH True (acc <> "." <> segWithHead) rest- _ -> (acc, chars, qualified)+ in gatherQualified hasMH True (isConIdStart c') (acc <> "." <> segWithHead) rest+ _ -> (acc, chars, qualified, lastIsConId) classifyIdentifier firstChar isQualified ident | isQualified =
+ test/Test/Fixtures/lexer/core/qualified-varid-then-dot.yaml view
@@ -0,0 +1,8 @@+extensions: []+input: "C.intToDigit.fromEnum"+tokens:+ - 'TkQVarId "C" "intToDigit"'+ - 'TkVarSym "."'+ - 'TkVarId "fromEnum"'+ - 'TkEOF'+status: pass
+ test/Test/Fixtures/lexer/core/qualified-varid-then-varsym.yaml view
@@ -0,0 +1,7 @@+extensions: []+input: "M.f.+"+tokens:+ - 'TkQVarId "M" "f"'+ - 'TkVarSym ".+"'+ - 'TkEOF'+status: pass