1.2.6 • Published 10 years ago

toker v1.2.6

Weekly downloads
2
License
ISC
Repository
github
Last release
10 years ago

#toker

General purpose lexical analyzer

##Usage

var toker = require('toker');

var lex = new toker.LexicalAnalyzer('.p {color: #fff}', {
	keywords: ['@mixin', '@include', '@extend'],
	identifierStart: /[#@$_a-zA-Z]/,
	identifierPart: /([$_a-zA-Z-]|[0-9])/
});

console.log(lex.getTokens());

##Options

identifierStart and identifierPart

Default:

identifierStart = /[$_a-zA-Z]/
identifierPart = /([$_a-zA-Z]|[0-9])/;

Re to check is lexeme is an identifier

keywords

List of tokens to mark as keywords.

Default:

'break', 'case', 'catch', 'continue', 'debugger', 'default', 'delete', 'do', 'else', 'finally', 'for', 'function', 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw', 'try', 'typeof', 'var', 'void', 'while', 'with', 'class', 'const', 'enum', 'export', 'extends', 'import', 'super'

operators

List of operators.

Default:

    '{', '}', '(', ')', '[', ']', '.', ';', ',', '?', '', '===', '==', '=', '!==', '!=', '!', '<<=', '<<', '<=', '<', '>>>=', '>>>', '>>=', '>>', '>=', '>', '+=', '++', '+', '-=', '--', '-', '*=', '*', '/=', '/', '%=', '%', '&&', '&=', '&', '||', '|=', '|', '^=', '^', '~'
    

punctuators

Default:

'.', '(', ')', ';', ',', '{', '}', '[', ']', ':', '?', '~'
1.2.6

10 years ago

1.1.6

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago