src/Pure/General/symbol.scala
changeset 43418 c69e9fbb81a8
parent 40529 d5fb1f1a5857
child 43443 5d9693c2337e
equal deleted inserted replaced
43417:83be997a11d6 43418:c69e9fbb81a8
    24   {
    24   {
    25     require(k >= 0)
    25     require(k >= 0)
    26     if (k < static_spaces.length) static_spaces.substring(0, k)
    26     if (k < static_spaces.length) static_spaces.substring(0, k)
    27     else space * k
    27     else space * k
    28   }
    28   }
       
    29 
       
    30 
       
    31   /* ASCII characters */
       
    32 
       
    33   def is_ascii_letter(c: Char): Boolean = 'A' <= c && c <= 'Z' || 'a' <= c && c <= 'z'
       
    34   def is_ascii_digit(c: Char): Boolean = '0' <= c && c <= '9'
       
    35   def is_ascii_quasi(c: Char): Boolean = c == '_' || c == '\''
       
    36 
       
    37   def is_ascii_letdig(c: Char): Boolean =
       
    38     is_ascii_letter(c) || is_ascii_digit(c) || is_ascii_quasi(c)
       
    39 
       
    40   def is_ascii_identifier(s: String): Boolean =
       
    41     s.length > 0 && is_ascii_letter(s(0)) && s.substring(1).forall(is_ascii_letdig)
    29 
    42 
    30 
    43 
    31   /* Symbol regexps */
    44   /* Symbol regexps */
    32 
    45 
    33   private val plain = new Regex("""(?xs)
    46   private val plain = new Regex("""(?xs)