feat: add Bracket, Comma, and FunctionArguments tokens

This commit is contained in:
xiaowei 2021-09-08 20:27:46 +08:00 committed by Ziv
parent 5404cdd4d0
commit b1ae454ae4

View File

@ -6,7 +6,6 @@ export enum TokenType {
SingleQuotation = 'SingleQuotation', SingleQuotation = 'SingleQuotation',
DoubleQuotation = 'DoubleQuotation', DoubleQuotation = 'DoubleQuotation',
BackQuotation = 'BackQuotation', BackQuotation = 'BackQuotation',
/** /**
* Language element type * Language element type
*/ */
@ -16,11 +15,20 @@ export enum TokenType {
* Statement * Statement
*/ */
StatementTerminator = 'StatementTerminator', StatementTerminator = 'StatementTerminator',
/** /**
* Others * 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 = { export const TokenReg = {
[TokenType.StatementTerminator]: /[;]/, [TokenType.StatementTerminator]: /[;]/,
[TokenType.SingleQuotation]: /[']/, [TokenType.SingleQuotation]: /['|\']/,
[TokenType.DoubleQuotation]: /["]/, [TokenType.DoubleQuotation]: /["]/,
[TokenType.BackQuotation]: /[`]/, [TokenType.BackQuotation]: /[`]/,
[TokenType.LeftSmallBracket]: /[(]/,
[TokenType.RightSmallBracket]: /[)]/,
[TokenType.Comma]: /[,]/,
}; };