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',
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]: /[,]/,
};