From ddff54964ec78dd3e2a688f4525b39e41b82b5f0 Mon Sep 17 00:00:00 2001 From: adelon <22380201+adelon@users.noreply.github.com> Date: Wed, 16 Jul 2025 21:48:35 +0200 Subject: Relax label syntax --- source/Tptp/UnsortedFirstOrder.hs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'source/Tptp') diff --git a/source/Tptp/UnsortedFirstOrder.hs b/source/Tptp/UnsortedFirstOrder.hs index 277ffc9..4fcf052 100644 --- a/source/Tptp/UnsortedFirstOrder.hs +++ b/source/Tptp/UnsortedFirstOrder.hs @@ -16,8 +16,13 @@ import Prettyprinter.Render.Text import Text.Builder -isAsciiAlphaNum :: Char -> Bool -isAsciiAlphaNum c = isAsciiLower c || isAsciiUpper c || isDigit c || c == '_' + +isAsciiLetter :: Char -> Bool +isAsciiLetter c = isAsciiLower c || isAsciiUpper c + +isAsciiAlphaNumOrUnderscore :: Char -> Bool +isAsciiAlphaNumOrUnderscore c = isAsciiLower c || isAsciiUpper c || isDigit c || c == '_' + -- | A TPTP atomic word, starting with a lowercase letter or enclosed in single quotes. newtype AtomicWord = AtomicWord Text deriving (Show, Eq, Ord, IsString) @@ -25,7 +30,7 @@ newtype AtomicWord = AtomicWord Text deriving (Show, Eq, Ord, IsString) isProperAtomicWord :: Text -> Bool isProperAtomicWord w = case Text.uncons w of Nothing -> False - Just (head, tail) -> isAsciiLower head && Text.all isAsciiAlphaNum tail + Just (head, tail) -> isAsciiLower head && Text.all isAsciiAlphaNumOrUnderscore tail -- | A TPTP variable, written as a word starting with an uppercase letter. newtype Variable = Variable Text deriving (Show, Eq, Ord, IsString) @@ -33,7 +38,7 @@ newtype Variable = Variable Text deriving (Show, Eq, Ord, IsString) isVariable :: Text -> Bool isVariable var = case Text.uncons var of Nothing -> False -- Variables must be nonempty. - Just (head, tail) -> isAsciiUpper head && Text.all isAsciiAlphaNum tail + Just (head, tail) -> isAsciiUpper head && Text.all isAsciiAlphaNumOrUnderscore tail data Expr -- cgit v1.2.3