Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -110,6 +110,9 @@ func (x *yyLex) dequeue() int {
110
110
func (x * yyLex ) refill () {
111
111
var err error
112
112
x .line , err = x .reader .ReadString ('\n' )
113
+ if strings .HasSuffix (x .line , "\r \n " ) {
114
+ x .line = x .line [:len (x .line )- 2 ] + "\n "
115
+ }
113
116
if yyDebug >= 2 {
114
117
fmt .Printf ("line = %q, err = %v\n " , x .line , err )
115
118
}
Original file line number Diff line number Diff line change @@ -262,7 +262,7 @@ func TestLex(t *testing.T) {
262
262
{"01" , "illegal decimal with leading zero 1:0" , "exec" , LexTokens {
263
263
{FILE_INPUT , nil , ast.Pos {0 , 0 }},
264
264
}},
265
- {"1\n 2\n 3\n 4\n " , "" , "exec" , LexTokens {
265
+ {"1\n 2\r \ n 3\r \n 4\n " , "" , "exec" , LexTokens {
266
266
{FILE_INPUT , nil , ast.Pos {0 , 0 }},
267
267
{NUMBER , py .Int (1 ), ast.Pos {1 , 0 }},
268
268
{NEWLINE , nil , ast.Pos {1 , 1 }},
<
2F5D
svg aria-hidden="true" version="1.1" viewBox="0 0 340 84" xmlns="http://www.w3.org/2000/svg" class="Box-sc-g0xbh4-0 hqtbbn">
0 commit comments