Skip to content

Commit f5a2cc1

Browse files
committed
Continue mangle optimization
1 parent e540440 commit f5a2cc1

File tree

7 files changed

+275
-271
lines changed

7 files changed

+275
-271
lines changed

@types/core/parse/ast/ast.d.ts

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,135 +21,135 @@ export class AST {
2121
* @param {string} text - The input text to parse.
2222
* @returns {ASTNode} The root node of the AST.
2323
*/
24-
ast(text: string): ASTNode;
24+
_ast(text: string): ASTNode;
2525
text: string;
2626
tokens: import("../lexer/token.js").Token[];
2727
/**
2828
* Parses a program.
2929
* @returns {ASTNode} The program node.
3030
*/
31-
program(): ASTNode;
31+
_program(): ASTNode;
3232
/**
3333
* Parses an expression statement.
3434
* @returns {ASTNode} The expression statement node.
3535
*/
36-
expressionStatement(): ASTNode;
36+
_expressionStatement(): ASTNode;
3737
/**
3838
* Parses a filter chain.
3939
* @returns {ASTNode} The filter chain node.
4040
*/
41-
filterChain(): ASTNode;
41+
_filterChain(): ASTNode;
4242
/**
4343
* Parses an assignment expression.
4444
* @returns {ASTNode} The assignment expression node.
4545
*/
46-
assignment(): ASTNode;
46+
_assignment(): ASTNode;
4747
/**
4848
* Parses a ternary expression.
4949
* @returns {ASTNode} The ternary expression node.
5050
*/
51-
ternary(): ASTNode;
51+
_ternary(): ASTNode;
5252
/**
5353
* Parses a logical OR expression.
5454
* @returns {ASTNode} The logical OR expression node.
5555
*/
56-
logicalOR(): ASTNode;
56+
_logicalOR(): ASTNode;
5757
/**
5858
* Parses a logical AND expression.
5959
* @returns {ASTNode} The logical AND expression node.
6060
*/
61-
logicalAND(): ASTNode;
61+
_logicalAND(): ASTNode;
6262
/**
6363
* Parses an equality expression.
6464
* @returns {ASTNode} The equality expression node.
6565
*/
66-
equality(): ASTNode;
66+
_equality(): ASTNode;
6767
/**
6868
* Parses a relational expression.
6969
* @returns {ASTNode} The relational expression node.
7070
*/
71-
relational(): ASTNode;
71+
_relational(): ASTNode;
7272
/**
7373
* Parses an additive expression.
7474
* @returns {ASTNode} The additive expression node.
7575
*/
76-
additive(): ASTNode;
76+
_additive(): ASTNode;
7777
/**
7878
* Parses a multiplicative expression.
7979
* @returns {ASTNode} The multiplicative expression node.
8080
*/
81-
multiplicative(): ASTNode;
81+
_multiplicative(): ASTNode;
8282
/**
8383
* Parses a unary expression.
8484
* @returns {ASTNode} The unary expression node.
8585
*/
86-
unary(): ASTNode;
86+
_unary(): ASTNode;
8787
/**
8888
* Parses a primary expression.
8989
* @returns {ASTNode} The primary expression node.
9090
*/
91-
primary(): ASTNode;
91+
_primary(): ASTNode;
9292
/**
9393
* Parses a filter.
9494
* @param {ASTNode} baseExpression - The base expression to apply the filter to.
9595
* @returns {ASTNode} The filter node.
9696
*/
97-
filter(baseExpression: ASTNode): ASTNode;
97+
_filter(baseExpression: ASTNode): ASTNode;
9898
/**
9999
* Parses function arguments.
100100
* @returns {ASTNode[]} The arguments array.
101101
*/
102-
parseArguments(): ASTNode[];
102+
_parseArguments(): ASTNode[];
103103
/**
104104
* Parses an identifier.
105105
* @returns {ASTNode} The identifier node.
106106
*/
107-
identifier(): ASTNode;
107+
_identifier(): ASTNode;
108108
/**
109109
* Parses a constant.
110110
* @returns {ASTNode} The constant node.
111111
*/
112-
constant(): ASTNode;
112+
_constant(): ASTNode;
113113
/**
114114
* Parses an array declaration.
115115
* @returns {ASTNode} The array declaration node.
116116
*/
117-
arrayDeclaration(): ASTNode;
117+
_arrayDeclaration(): ASTNode;
118118
/**
119119
* Parses an object.
120120
* @returns {ASTNode} The object node.
121121
*/
122-
object(): ASTNode;
122+
_object(): ASTNode;
123123
/**
124124
* Throws a syntax error.
125125
* @param {string} msg - The error message.
126126
* @param {import("../lexer/lexer.js").Token} [token] - The token that caused the error.
127127
*/
128-
throwError(msg: string, token?: import("../lexer/lexer.js").Token): void;
128+
_throwError(msg: string, token?: import("../lexer/lexer.js").Token): void;
129129
/**
130130
* Consumes a token if it matches the expected type.
131131
* @param {string} [e1] - The expected token type.
132132
* @returns {import("../lexer/lexer.js").Token} The consumed token.
133133
*/
134-
consume(e1?: string): import("../lexer/lexer.js").Token;
134+
_consume(e1?: string): import("../lexer/lexer.js").Token;
135135
/**
136136
* Returns the next token without consuming it.
137137
* @returns {import("../lexer/lexer.js").Token} The next token.
138138
*/
139-
peekToken(): import("../lexer/lexer.js").Token;
139+
_peekToken(): import("../lexer/lexer.js").Token;
140140
/**
141141
* Checks if the next token matches any of the expected types.
142142
* @param {...string} [expected] - The expected token types.
143143
* @returns {import('../lexer/lexer.js').Token|boolean} The next token if it matches, otherwise false.
144144
*/
145-
peek(...expected: string[]): import("../lexer/lexer.js").Token | boolean;
145+
_peek(...expected: string[]): import("../lexer/lexer.js").Token | boolean;
146146
/**
147147
* Checks if the token at the specified index matches any of the expected types.
148148
* @param {number} i - The index to check.
149149
* @param {...string} [expected] - The expected token types.
150150
* @returns {import("../lexer/lexer.js").Token|boolean} The token at the specified index if it matches, otherwise false.
151151
*/
152-
peekAhead(
152+
_peekAhead(
153153
i: number,
154154
...expected: string[]
155155
): import("../lexer/lexer.js").Token | boolean;
@@ -158,7 +158,7 @@ export class AST {
158158
* @param {...string} [expected] - The expected token types.
159159
* @returns {import("../lexer/lexer.js").Token|boolean} The consumed token if it matches, otherwise false.
160160
*/
161-
expect(...expected: string[]): import("../lexer/lexer.js").Token | boolean;
161+
_expect(...expected: string[]): import("../lexer/lexer.js").Token | boolean;
162162
}
163163
export type ASTNode = import("./ast-node.ts").ASTNode;
164164
export type Token = import("../lexer/token.js").Token;

@types/core/parse/lexer/lexer.d.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,91 +20,91 @@ export class Lexer {
2020
* @param {string} text Input text to lex.
2121
* @returns {Array<Token>} Array of tokens.
2222
*/
23-
lex(text: string): Array<Token>;
24-
text: string;
25-
index: number;
23+
_lex(text: string): Array<Token>;
24+
_text: string;
25+
_index: number;
2626
/** @type {Array<Token>} */
27-
tokens: Array<Token>;
27+
_tokens: Array<Token>;
2828
/**
2929
* Checks if a character is contained in a set of characters.
3030
* @param {string} ch Character to check.
3131
* @param {string} chars Set of characters.
3232
* @returns {boolean} True if character is in the set, false otherwise.
3333
*/
34-
is(ch: string, chars: string): boolean;
34+
_is(ch: string, chars: string): boolean;
3535
/**
3636
* Peeks at the next character in the text.
3737
* @param {number} [i=1] Number of characters to peek.
3838
* @returns {string|false} Next character or false if end of text.
3939
*/
40-
peek(i?: number): string | false;
40+
_peek(i?: number): string | false;
4141
/**
4242
* Checks if a character is a number.
4343
* @param {string} ch Character to check.
4444
* @returns {boolean} True if character is a number, false otherwise.
4545
*/
46-
isNumber(ch: string): boolean;
46+
_isNumber(ch: string): boolean;
4747
/**
4848
* Checks if a character is whitespace.
4949
* @param {string} ch Character to check.
5050
* @returns {boolean} True if character is whitespace, false otherwise.
5151
*/
52-
isWhitespace(ch: string): boolean;
52+
_isWhitespace(ch: string): boolean;
5353
/**
5454
* Checks if a character is a valid identifier start.
5555
* @param {string} ch Character to check.
5656
* @returns {boolean} True if character is a valid identifier start, false otherwise.
5757
*/
58-
isIdentifierStart(ch: string): boolean;
58+
_isIdentifierStart(ch: string): boolean;
5959
/**
6060
* Checks if a character is a valid identifier continuation.
6161
* @param {string} ch Character to check.
6262
* @returns {boolean} True if character is a valid identifier continuation, false otherwise.
6363
*/
64-
isIdentifierContinue(ch: string): boolean;
64+
_isIdentifierContinue(ch: string): boolean;
6565
/**
6666
* Converts a character to its Unicode code point.
6767
* @param {string} ch Character to convert.
6868
* @returns {number} Unicode code point.
6969
*/
70-
codePointAt(ch: string): number;
70+
_codePointAt(ch: string): number;
7171
/**
7272
* Peeks at the next multicharacter sequence in the text.
7373
* @returns {string} Next multicharacter sequence.
7474
*/
75-
peekMultichar(): string;
75+
_peekMultichar(): string;
7676
/**
7777
* Checks if a character is an exponent operator.
7878
* @param {string} ch Character to check.
7979
* @returns {boolean} True if character is an exponent operator, false otherwise.
8080
*/
81-
isExpOperator(ch: string): boolean;
81+
_isExpOperator(ch: string): boolean;
8282
/**
8383
* Throws a lexer error.
8484
* @param {string} error Error message.
8585
* @param {number} [start] Start index.
8686
* @param {number} [end] End index.
8787
* @throws {Error} Lexer error.
8888
*/
89-
throwError(error: string, start?: number, end?: number): void;
89+
_throwError(error: string, start?: number, end?: number): void;
9090
/**
9191
* Reads and tokenizes a number from the text.
9292
* @return {void}
9393
*/
94-
readNumber(): void;
94+
_readNumber(): void;
9595
/**
9696
* Reads and tokenizes an identifier from the text.
9797
*/
98-
readIdent(): void;
98+
_readIdent(): void;
9999
/**
100100
* Reads and tokenizes a string from the text.
101101
* @param {string} quote Quote character used for the string.
102102
*/
103-
readString(quote: string): void;
103+
_readString(quote: string): void;
104104
/**
105105
* @returns {string}
106106
*/
107-
handleUnicodeEscape(): string;
107+
_handleUnicodeEscape(): string;
108108
}
109109
export type Token = import("./token.ts").Token;
110110
export type LexerOptions = {

0 commit comments

Comments
 (0)