All pastes #41061 Raw Edit

Miscellany

public text v1 · immutable
#41061 ·published 2006-02-10 22:32 UTC
rendered paste body
 if i >= len then failwith "Unexpected end of string"
 else if s.[i] = '[' then failwith "Invalid \"[\" inside character class"
 else if s.[i] = ']' then (i + 1, cs)
 else (
      let (i1, c1) = parse_char i in
      if i1 < len && s.[i1] = '-' then (
        let (i2, c2) = parse_char (i1 + 1) in
        cs#add_range c1 c2;
        parse_inner_charclass i2 cs
      ) else (
        cs#add c1;
        parse_inner_charclass i1 cs
      )
  )