build(dev-deps): add `chevrotain` as a `devDependencies`

This commit is contained in:
Reda Al Sulais 2023-11-03 22:24:54 +03:00
parent 7765afa7da
commit fe2e46fe60
4 changed files with 8 additions and 52 deletions

View File

@ -41,5 +41,8 @@
],
"publishConfig": {
"access": "public"
},
"devDependencies": {
"chevrotain": "^11.0.3"
}
}

View File

@ -1,51 +0,0 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
type CustomPatternMatcherReturn = [string] & { payload?: any };
export type CustomPatternMatcherFunc = (
text: string,
offset: number,
tokens: IToken[],
groups: {
[groupName: string]: IToken[];
}
) => CustomPatternMatcherReturn | RegExpExecArray | null;
interface ICustomPattern {
exec: CustomPatternMatcherFunc;
}
type TokenPattern = RegExp | string | CustomPatternMatcherFunc | ICustomPattern;
export interface IToken {
image: string;
startOffset: number;
startLine?: number;
startColumn?: number;
endOffset?: number;
endLine?: number;
endColumn?: number;
isInsertedInRecovery?: boolean;
tokenTypeIdx: number;
tokenType: TokenType;
payload?: any;
}
export interface TokenType {
name: string;
GROUP?: string;
PATTERN?: TokenPattern;
LABEL?: string;
LONGER_ALT?: TokenType | TokenType[];
POP_MODE?: boolean;
PUSH_MODE?: string;
LINE_BREAKS?: boolean;
CATEGORIES?: TokenType[];
tokenTypeIdx?: number;
categoryMatches?: number[];
categoryMatchesMap?: {
[tokType: number]: boolean;
};
isParent?: boolean;
START_CHARS_HINT?: (string | number)[];
}

View File

@ -1,5 +1,5 @@
import type { GrammarAST, Stream, TokenBuilderOptions } from 'langium';
import type { TokenType } from '../chevrotainWrapper.js';
import type { TokenType } from 'chevrotain';
import { DefaultTokenBuilder } from 'langium';

View File

@ -486,6 +486,10 @@ importers:
langium:
specifier: 2.1.0
version: 2.1.0
devDependencies:
chevrotain:
specifier: ^11.0.3
version: 11.0.3
tests/webpack:
dependencies: