Skip to content

Commit

Permalink
Merge pull request #938 from GaloisInc/selector_bug
Browse files Browse the repository at this point in the history
Update the lexer to allow `'` characters in record selectors
  • Loading branch information
robdockins authored Oct 21, 2020
2 parents b46a2f6 + 7ab7db1 commit 6653f02
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Cryptol/Parser/LexerUtils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -318,13 +318,14 @@ selectorToken :: Text -> TokenT
selectorToken txt
| Just n <- readDecimal body, n >= 0 = Selector (TupleSelectorTok n)
| Just (x,xs) <- T.uncons body
, ok isAlpha x
, T.all (ok isAlphaNum) xs = Selector (RecordSelectorTok body)
, id_first x
, T.all id_next xs = Selector (RecordSelectorTok body)
| otherwise = Err MalformedSelector

where
body = T.drop 1 txt
ok p x = p x || x == '_'
id_first x = isAlpha x || x == '_'
id_next x = isAlphaNum x || x == '_' || x == '\''


readDecimal :: Integral a => Text -> Maybe a
Expand Down

0 comments on commit 6653f02

Please sign in to comment.