From b1ae454ae4f8cc78071a5708486bd0f6dc96d29c Mon Sep 17 00:00:00 2001 From: xiaowei Date: Wed, 8 Sep 2021 20:27:46 +0800 Subject: [PATCH] feat: add Bracket, Comma, and FunctionArguments tokens --- src/utils/token.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/utils/token.ts b/src/utils/token.ts index 490b58d..4c89564 100755 --- a/src/utils/token.ts +++ b/src/utils/token.ts @@ -6,7 +6,6 @@ export enum TokenType { SingleQuotation = 'SingleQuotation', DoubleQuotation = 'DoubleQuotation', BackQuotation = 'BackQuotation', - /** * Language element type */ @@ -16,11 +15,20 @@ export enum TokenType { * Statement */ StatementTerminator = 'StatementTerminator', - /** * Others */ - Error = 'Error' + Error = 'Error', + /** + * Left small Bracket + */ + LeftSmallBracket = 'LeftSmallBracket', + /** + * Left small Bracket + */ + RightSmallBracket = 'RightSmallBracket', + Comma = 'Comma', + FunctionArguments = 'FunctionArguments' } /** @@ -40,7 +48,10 @@ export interface Token { */ export const TokenReg = { [TokenType.StatementTerminator]: /[;]/, - [TokenType.SingleQuotation]: /[']/, + [TokenType.SingleQuotation]: /['|\']/, [TokenType.DoubleQuotation]: /["]/, [TokenType.BackQuotation]: /[`]/, + [TokenType.LeftSmallBracket]: /[(]/, + [TokenType.RightSmallBracket]: /[)]/, + [TokenType.Comma]: /[,]/, };