equal
deleted
inserted
replaced
24 val is_digit: symbol -> bool |
24 val is_digit: symbol -> bool |
25 val is_quasi: symbol -> bool |
25 val is_quasi: symbol -> bool |
26 val is_quasi_letter: symbol -> bool |
26 val is_quasi_letter: symbol -> bool |
27 val is_letdig: symbol -> bool |
27 val is_letdig: symbol -> bool |
28 val is_blank: symbol -> bool |
28 val is_blank: symbol -> bool |
|
29 val is_identifier: symbol -> bool |
29 val is_symbolic: symbol -> bool |
30 val is_symbolic: symbol -> bool |
30 val is_printable: symbol -> bool |
31 val is_printable: symbol -> bool |
31 val length: symbol list -> int |
32 val length: symbol list -> int |
32 val strip_blanks: string -> string |
33 val strip_blanks: string -> string |
33 val beginning: symbol list -> string |
34 val beginning: symbol list -> string |
109 |
110 |
110 fun is_printable s = |
111 fun is_printable s = |
111 size s = 1 andalso ord space <= ord s andalso ord s <= ord "~" orelse |
112 size s = 1 andalso ord space <= ord s andalso ord s <= ord "~" orelse |
112 is_symbolic s; |
113 is_symbolic s; |
113 |
114 |
|
115 fun is_identifier s = |
|
116 case (explode s) of |
|
117 [] => false |
|
118 | c::cs => is_letter c andalso forall is_letdig cs; |
114 |
119 |
115 fun sym_length ss = foldl (fn (n, s) => |
120 fun sym_length ss = foldl (fn (n, s) => |
116 (if not (is_printable s) then 0 else |
121 (if not (is_printable s) then 0 else |
117 (case Library.try String.substring (s, 2, 4) of |
122 (case Library.try String.substring (s, 2, 4) of |
118 Some s' => if s' = "long" orelse s' = "Long" then 2 else 1 |
123 Some s' => if s' = "long" orelse s' = "Long" then 2 else 1 |