@@ -97,6 +97,7 @@ function intoTokens(source, externalContext, internalContext, isNested) {
9797 var isSpace ;
9898 var isNewLineNix ;
9999 var isNewLineWin ;
100+ var isCarriageReturn ;
100101 var isCommentStart ;
101102 var wasCommentStart = false ;
102103 var isCommentEnd ;
@@ -116,7 +117,8 @@ function intoTokens(source, externalContext, internalContext, isNested) {
116117 isQuoted = level == Level . SINGLE_QUOTE || level == Level . DOUBLE_QUOTE ;
117118 isSpace = character == Marker . SPACE || character == Marker . TAB ;
118119 isNewLineNix = character == Marker . NEW_LINE_NIX ;
119- isNewLineWin = character == Marker . NEW_LINE_NIX && source [ position . index - 1 ] == Marker . NEW_LINE_WIN ;
120+ isNewLineWin = character == Marker . NEW_LINE_NIX && source [ position . index - 1 ] == Marker . CARRIAGE_RETURN ;
121+ isCarriageReturn = character == Marker . CARRIAGE_RETURN && source [ position . index + 1 ] && source [ position . index + 1 ] != Marker . NEW_LINE_NIX ;
120122 isCommentStart = ! wasCommentEnd && level != Level . COMMENT && ! isQuoted && character == Marker . ASTERISK && source [ position . index - 1 ] == Marker . FORWARD_SLASH ;
121123 isCommentEndMarker = ! wasCommentStart && ! isQuoted && character == Marker . FORWARD_SLASH && source [ position . index - 1 ] == Marker . ASTERISK ;
122124 isCommentEnd = level == Level . COMMENT && isCommentEndMarker ;
@@ -483,7 +485,7 @@ function intoTokens(source, externalContext, internalContext, isNested) {
483485 } else if ( buffer . length == 1 && isNewLineWin ) {
484486 // ignore windows newline which is composed of two characters
485487 buffer . pop ( ) ;
486- } else if ( buffer . length > 0 || ! isSpace && ! isNewLineNix && ! isNewLineWin ) {
488+ } else if ( buffer . length > 0 || ! isSpace && ! isNewLineNix && ! isNewLineWin && ! isCarriageReturn ) {
487489 // any character
488490 buffer . push ( character ) ;
489491 }
@@ -493,8 +495,8 @@ function intoTokens(source, externalContext, internalContext, isNested) {
493495 wasCommentStart = isCommentStart ;
494496 wasCommentEnd = isCommentEnd ;
495497
496- position . line = ( isNewLineWin || isNewLineNix ) ? position . line + 1 : position . line ;
497- position . column = ( isNewLineWin || isNewLineNix ) ? 0 : position . column + 1 ;
498+ position . line = ( isNewLineWin || isNewLineNix || isCarriageReturn ) ? position . line + 1 : position . line ;
499+ position . column = ( isNewLineWin || isNewLineNix || isCarriageReturn ) ? 0 : position . column + 1 ;
498500 }
499501
500502 if ( seekingValue ) {
0 commit comments