1010import type { Token } from './ast' ;
1111import type { Source } from './source' ;
1212import { syntaxError } from '../error' ;
13+ import removeIndentation from '../jsutils/removeIndentation' ;
1314
1415/**
1516 * Given a Source object, this returns a Lexer for that source.
@@ -532,7 +533,7 @@ function readMultiLineString(source, start, line, col, prev): Token {
532533 let position = start + 3 ;
533534 let chunkStart = position ;
534535 let code = 0 ;
535- let value = '' ;
536+ let rawValue = '' ;
536537
537538 while (
538539 position < body . length &&
@@ -544,15 +545,15 @@ function readMultiLineString(source, start, line, col, prev): Token {
544545 charCodeAt . call ( body , position + 1 ) === 34 &&
545546 charCodeAt . call ( body , position + 2 ) === 34
546547 ) {
547- value += slice . call ( body , chunkStart , position ) ;
548+ rawValue += slice . call ( body , chunkStart , position ) ;
548549 return new Tok (
549550 MULTI_LINE_STRING ,
550551 start ,
551552 position + 3 ,
552553 line ,
553554 col ,
554555 prev ,
555- value
556+ removeIndentation ( rawValue )
556557 ) ;
557558 }
558559
@@ -577,7 +578,7 @@ function readMultiLineString(source, start, line, col, prev): Token {
577578 charCodeAt . call ( body , position + 2 ) === 34 &&
578579 charCodeAt . call ( body , position + 3 ) === 34
579580 ) {
580- value += slice . call ( body , chunkStart , position ) + '"""' ;
581+ rawValue += slice . call ( body , chunkStart , position ) + '"""' ;
581582 position += 4 ;
582583 chunkStart = position ;
583584 } else {
0 commit comments