lib/abc_parser/index.js
function(line, curr_pos)
  {
    var ret = tokenizer.getBarLine(line, curr_pos);
    if (ret.len === 0)
      return [0,""];
    if (ret.warn) {
      warn(ret.warn, line, curr_pos);
      return [ret.len,""];
    }

    // Now see if this is a repeated ending
    // A repeated ending is all of the characters 1,2,3,4,5,6,7,8,9,0,-, and comma
    // It can also optionally start with '[', which is ignored.
    // Also, it can have white space before the '['.
    for (var ws = 0; ws < line.length; ws++)
      if (line.charAt(curr_pos + ret.len + ws) !== ' ')
        break;
    var orig_bar_len = ret.len;
    if (line.charAt(curr_pos+ret.len+ws) === '[') {
      ret.len += ws + 1;
    }

    // It can also be a quoted string. It is unclear whether that construct requires '[', but it seems like it would. otherwise it would be confused with a regular chord.
    if (line.charAt(curr_pos+ret.len) === '"' && line.charAt(curr_pos+ret.len-1) === '[') {
      var ending = tokenizer.getBrackettedSubstring(line, curr_pos+ret.len, 5);
      return [ret.len+ending[0], ret.token, ending[1]];
    }
    var retRep = tokenizer.getTokenOf(line.substring(curr_pos+ret.len), "1234567890-,");
    if (retRep.len === 0 || retRep.token[0] === '-')
      return [orig_bar_len, ret.token];

    return [ret.len+retRep.len, ret.token, retRep.token];
  }
function(line, curr_pos)
  {
    var ret = tokenizer.getBarLine(line, curr_pos);
    if (ret.len === 0)
      return [0,""];
    if (ret.warn) {
      warn(ret.warn, line, curr_pos);
      return [ret.len,""];
    }

    // Now see if this is a repeated ending
    // A repeated ending is all of the characters 1,2,3,4,5,6,7,8,9,0,-, and comma
    // It can also optionally start with '[', which is ignored.
    // Also, it can have white space before the '['.
    for (var ws = 0; ws < line.length; ws++)
      if (line.charAt(curr_pos + ret.len + ws) !== ' ')
        break;
    var orig_bar_len = ret.len;
    if (line.charAt(curr_pos+ret.len+ws) === '[') {
      ret.len += ws + 1;
    }

    // It can also be a quoted string. It is unclear whether that construct requires '[', but it seems like it would. otherwise it would be confused with a regular chord.
    if (line.charAt(curr_pos+ret.len) === '"' && line.charAt(curr_pos+ret.len-1) === '[') {
      var ending = tokenizer.getBrackettedSubstring(line, curr_pos+ret.len, 5);
      return [ret.len+ending[0], ret.token, ending[1]];
    }
    var retRep = tokenizer.getTokenOf(line.substring(curr_pos+ret.len), "1234567890-,");
    if (retRep.len === 0 || retRep.token[0] === '-')
      return [orig_bar_len, ret.token];

    return [ret.len+retRep.len, ret.token, retRep.token];
  }
function ( line , curr_pos ) { var ret = tokenizer . getBarLine ( line , curr_pos ) ; if ( ret . len === 0 ) return [ 0 , "" ] ; if ( ret . warn ) { warn ( ret . warn , line , curr_pos ) ; return [ ret . len , "" ] ; } // Now see if this is a repeated ending // A repeated ending is all of the characters 1,2,3,4,5,6,7,8,9,0,-, and comma // It can also optionally start with '[', which is ignored. // Also, it can have white space before the '['. for ( var ws = 0 ; ws < line . length ; ws ++ ) if ( line . charAt ( curr_pos + ret . len + ws ) !== ' ' ) break ; var orig_bar_len = ret . len ; if ( line . charAt ( curr_pos + ret . len + ws ) === '[' ) { ret . len += ws + 1 ; } // It can also be a quoted string. It is unclear whether that construct requires '[', but it seems like it would. otherwise it would be confused with a regular chord. if ( line . charAt ( curr_pos + ret . len ) === '"' && line . charAt ( curr_pos + ret . len - 1 ) === '[' ) { var ending = tokenizer . getBrackettedSubstring ( line , curr_pos + ret . len , 5 ) ; return [ ret . len + ending [ 0 ] , ret . token , ending [ 1 ] ] ; } var retRep = tokenizer . getTokenOf ( line . substring ( curr_pos + ret . len ) , "1234567890-," ) ; if ( retRep . len === 0 || retRep . token [ 0 ] === '-' ) return [ orig_bar_len , ret . token ] ; return [ ret . len + retRep . len , ret . token , retRep . token ] ; }
returns the class of the bar line the number of the repeat and the number of characters used up if 0 is returned, then the next element was not a bar line
returns the class of the bar line the number of the repeat and the number of characters used up if 0 is returned then the next element was not a bar line