nl_tokens: Sorts expressions in char class in the following order : - meta chars ordered alphabetically by value - chars ( except control kind ) and class ranges ordered alphabetically ( from char is used for class ranges ) - if ambiguous class range comes before char - if ambiguous between two class ranges orders alphabetically by to char - control chars ordered alphabetically by value
pl_tokens: function sortCharClass ( a , b ) { const aValue = getSortValue ( a ) ; const bValue = getSortValue ( b ) ; if ( aValue === bValue ) { // We want ClassRange before Char // [bb-d] -> [b-db] if ( a . type === 'ClassRange' && b . type !== 'ClassRange' ) { return - 1 ; } if ( b . type === 'ClassRange' && a . type !== 'ClassRange' ) { return 1 ; } if ( a . <mask> === 'ClassRange' && b . type === 'ClassRange' ) { return getSortValue ( a . to ) - getSortValue ( b . to ) ; } if ( ( isMeta ( a ) && isMeta ( b ) ) || ( isControl ( a ) && isControl ( b ) ) ) { return a . value < b . value ? - 1 : 1 ; } } return aValue - bValue ; }