diff --git a/es2panda/lexer/lexer.cpp b/es2panda/lexer/lexer.cpp index 5e80b9718eeaf3a3db4c7b6a1272ced26a9c2c7e..657f2addc53fc5d3eae9d07e6f6336580f358f77 100644 --- a/es2panda/lexer/lexer.cpp +++ b/es2panda/lexer/lexer.cpp @@ -1233,6 +1233,18 @@ void Lexer::SkipWhiteSpaces() auto cp = Iterator().Peek(); switch (cp) { + case LEX_CHAR_HASH_MARK: { + Iterator().Forward(1); + cp = Iterator().Peek(); + if (cp == LEX_CHAR_EXCLAMATION) { + Iterator().Forward(1); + SkipSingleLineComment(); + continue; + } + + Iterator().Backward(1); + return; + } case LEX_CHAR_CR: { Iterator().Forward(1); @@ -1286,6 +1298,8 @@ void Lexer::SkipWhiteSpaces() [[fallthrough]]; } case LEX_CHAR_NBSP: + case LEX_CHAR_NLINE: + case LEX_CHAR_IGSP: case LEX_CHAR_ZWNBSP: { Iterator().Forward(cpSize); continue; diff --git a/es2panda/lexer/token/letters.h b/es2panda/lexer/token/letters.h index 5ca37714066984d42954c382804b8eea8a0d5625..cb8c574b5cef47dffe595c5e4db71ecef3476b5d 100644 --- a/es2panda/lexer/token/letters.h +++ b/es2panda/lexer/token/letters.h @@ -89,11 +89,13 @@ namespace panda::es2panda::lexer { #define LEX_CHAR_SP 0x20 /* space */ #define LEX_CHAR_NBSP 0xA0 /* no-break space */ #define LEX_CHAR_ZWNBSP 0xFEFF /* zero width no-break space */ +#define LEX_CHAR_IGSP 0x3000 /* ideographic space */ #define LEX_CHAR_MVS 0x180e /* MONGOLIAN VOWEL SEPARATOR (U+180E) */ #define LEX_CHAR_DOUBLE_QUOTE 0x22 /* " */ #define LEX_CHAR_DOLLAR_SIGN 0x24 /* $ */ #define LEX_CHAR_SINGLE_QUOTE 0x27 /* ' */ #define LEX_CHAR_DOT 0x2E /* . */ +#define LEX_CHAR_NLINE 0x85 /* nextline */ #define LEX_CHAR_0 0x30 /* 0 */ #define LEX_CHAR_1 0x31 /* 1 */ diff --git a/es2panda/test/test_tsc_ignore_list.txt b/es2panda/test/test_tsc_ignore_list.txt index 761f6a12a60d378dd107004dcfa7ae526836406a..91c8e1cc509c04701c6919c5d962817439fddaa6 100644 --- a/es2panda/test/test_tsc_ignore_list.txt +++ b/es2panda/test/test_tsc_ignore_list.txt @@ -6,9 +6,6 @@ es2panda/test/TypeScript/tests/cases/compiler/collisionArgumentsInterfaceMembers es2panda/test/TypeScript/tests/cases/compiler/computedPropertiesTransformedInOtherwiseNonTSClasses.ts es2panda/test/TypeScript/tests/cases/compiler/constructorOverloads5.ts es2panda/test/TypeScript/tests/cases/compiler/elidedEmbeddedStatementsReplacedWithSemicolon.ts -es2panda/test/TypeScript/tests/cases/compiler/emitBundleWithShebang1.ts -es2panda/test/TypeScript/tests/cases/compiler/fileWithNextLine2.ts -es2panda/test/TypeScript/tests/cases/compiler/genericRecursiveImplicitConstructorErrors2.ts es2panda/test/TypeScript/tests/cases/compiler/globalIsContextualKeyword.ts es2panda/test/TypeScript/tests/cases/compiler/inferenceErasedSignatures.ts es2panda/test/TypeScript/tests/cases/compiler/isLiteral1.ts @@ -19,9 +16,7 @@ es2panda/test/TypeScript/tests/cases/compiler/letInVarDeclOfForIn_ES6.ts es2panda/test/TypeScript/tests/cases/compiler/letInVarDeclOfForOf_ES5.ts es2panda/test/TypeScript/tests/cases/compiler/letInVarDeclOfForOf_ES6.ts es2panda/test/TypeScript/tests/cases/compiler/parameterInitializerBeforeDestructuringEmit.ts -es2panda/test/TypeScript/tests/cases/compiler/shebang.ts es2panda/test/TypeScript/tests/cases/compiler/sigantureIsSubTypeIfTheyAreIdentical.ts -es2panda/test/TypeScript/tests/cases/compiler/sourceMap-LineBreaks.ts es2panda/test/TypeScript/tests/cases/compiler/withStatementInternalComments.ts es2panda/test/TypeScript/tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments03_ES6.ts es2panda/test/TypeScript/tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments04_ES6.ts @@ -62,7 +57,6 @@ es2panda/test/TypeScript/tests/cases/conformance/interfaces/interfaceDeclaration es2panda/test/TypeScript/tests/cases/conformance/interfaces/interfaceDeclarations/asiPreventsParsingAsInterface03.ts es2panda/test/TypeScript/tests/cases/conformance/interfaces/interfaceDeclarations/asiPreventsParsingAsInterface04.ts es2panda/test/TypeScript/tests/cases/conformance/parser/ecmascript5/RegressionTests/parser579071.ts -es2panda/test/TypeScript/tests/cases/conformance/parser/ecmascript5/parserUnicodeWhitespaceCharacter1.ts es2panda/test/TypeScript/tests/cases/conformance/scanner/ecmascript3/scannerES3NumericLiteral2.ts es2panda/test/TypeScript/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts es2panda/test/TypeScript/tests/cases/conformance/types/members/objectTypeWithStringNamedNumericProperty.ts