equal
deleted
inserted
replaced
2114 {-# LANGUAGE OverloadedStrings #-} |
2114 {-# LANGUAGE OverloadedStrings #-} |
2115 |
2115 |
2116 module Isabelle.Name ( |
2116 module Isabelle.Name ( |
2117 Name, |
2117 Name, |
2118 uu, uu_, aT, |
2118 uu, uu_, aT, |
2119 clean_index, clean, |
2119 clean_index, clean, internal, skolem, is_internal, is_skolem, |
2120 Context, declare, is_declared, context, make_context, variant |
2120 Context, declare, is_declared, context, make_context, variant |
2121 ) |
2121 ) |
2122 where |
2122 where |
2123 |
2123 |
2124 import Data.Word (Word8) |
2124 import Data.Word (Word8) |
2139 uu = "uu" |
2139 uu = "uu" |
2140 uu_ = "uu_" |
2140 uu_ = "uu_" |
2141 aT = "'a" |
2141 aT = "'a" |
2142 |
2142 |
2143 |
2143 |
2144 {- suffix for internal names -} |
2144 {- internal names -- NB: internal subsumes skolem -} |
2145 |
2145 |
2146 underscore :: Word8 |
2146 underscore :: Word8 |
2147 underscore = Bytes.byte '_' |
2147 underscore = Bytes.byte '_' |
|
2148 |
|
2149 internal, skolem :: Name -> Name |
|
2150 internal x = x <> "_" |
|
2151 skolem x = x <> "__" |
|
2152 |
|
2153 is_internal, is_skolem :: Name -> Bool |
|
2154 is_internal = Bytes.isSuffixOf "_" |
|
2155 is_skolem = Bytes.isSuffixOf "__" |
2148 |
2156 |
2149 clean_index :: Name -> (Name, Int) |
2157 clean_index :: Name -> (Name, Int) |
2150 clean_index x = |
2158 clean_index x = |
2151 if Bytes.null x || Bytes.last x /= underscore then (x, 0) |
2159 if Bytes.null x || Bytes.last x /= underscore then (x, 0) |
2152 else |
2160 else |