character-parser
- Version 4.0.0
- Published
- 33.6 kB
- No dependencies
- MIT license
Install
npm i character-parser
yarn add character-parser
pnpm add character-parser
Overview
Parse JavaScript one character at a time to look for snippets in Templates. This is not a validator, it's just designed to allow you to have sections of JavaScript delimited by brackets robustly.
Index
Functions
Classes
Enums
Functions
function defaultState
defaultState: () => State;
function isKeyword
isKeyword: (id: string) => boolean;
function isPunctuator
isPunctuator: (c: string) => boolean;
function parse
parse: ( src: string, state?: State, options?: { readonly start?: number; readonly end?: number }) => State;
function parseChar
parseChar: (character: string, state?: State) => State;
function parseUntil
parseUntil: ( src: string, delimiter: string | RegExp, options?: { readonly start?: number; readonly end?: number; readonly ignoreLineComment?: boolean; readonly ignoreNesting?: boolean; }) => { start: number; end: number; src: string };
Classes
class State
class State {}
property escaped
escaped: boolean;
property hasDollar
hasDollar: boolean;
property history
history: string;
property lastChar
lastChar: string;
property regexpStart
regexpStart: boolean;
property src
src: string;
property stack
stack: TOKEN_TYPES[];
method current
current: () => TOKEN_TYPES;
method isComment
isComment: () => boolean;
method isNesting
isNesting: (opts?: { readonly ignoreLineComment?: boolean }) => boolean;
method isString
isString: () => boolean;
Enums
enum TOKEN_TYPES
enum TOKEN_TYPES { LINE_COMMENT = 'LINE_COMMENT', BLOCK_COMMENT = 'BLOCK_COMMENT', SINGLE_QUOTE = 'SINGLE_QUOTE', DOUBLE_QUOTE = 'DOUBLE_QUOTE', TEMPLATE_QUOTE = 'TEMPLATE_QUOTE', REGEXP = 'REGEXP', ROUND_BRACKET = 'ROUND_BRACKET', CURLY_BRACKET = 'CURLY_BRACKET', SQUARE_BRACKET = 'SQUARE_BRACKET',}
member BLOCK_COMMENT
BLOCK_COMMENT = 'BLOCK_COMMENT'
member CURLY_BRACKET
CURLY_BRACKET = 'CURLY_BRACKET'
member DOUBLE_QUOTE
DOUBLE_QUOTE = 'DOUBLE_QUOTE'
member LINE_COMMENT
LINE_COMMENT = 'LINE_COMMENT'
member REGEXP
REGEXP = 'REGEXP'
member ROUND_BRACKET
ROUND_BRACKET = 'ROUND_BRACKET'
member SINGLE_QUOTE
SINGLE_QUOTE = 'SINGLE_QUOTE'
member SQUARE_BRACKET
SQUARE_BRACKET = 'SQUARE_BRACKET'
member TEMPLATE_QUOTE
TEMPLATE_QUOTE = 'TEMPLATE_QUOTE'
Package Files (1)
Dependencies (0)
No dependencies.
Dev Dependencies (3)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/character-parser
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/character-parser)
- HTML<a href="https://www.jsdocs.io/package/character-parser"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 2670 ms. - Missing or incorrect documentation? Open an issue for this package.