Somebody needs to document `scanp`, it's awesome.
    
    
    import strscans
    from strutils import Whitespace
    
    let line = "    ; abc "
    
    var idx = 0
    var comment = ""
    if scanp(line, idx, *`Whitespace`, {'#',';'}):
      let start = idx
      if scanp(line, idx, +(~{'\C', '\L', '\0'} -> comment.add($_))):
        echo "found a comment ##", comment, "## starting at: ", start
    

Reply via email to