simple-graph-query 2.5.1 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -66,6 +66,7 @@ export declare class ForgeExprEvaluator extends AbstractParseTreeVisitor<EvalRes
|
|
|
66
66
|
visitQualName(ctx: QualNameContext): EvalResult;
|
|
67
67
|
private evaluateBinaryOperation;
|
|
68
68
|
private evaluateUnaryOperation;
|
|
69
|
+
private evaluateSetOperation;
|
|
69
70
|
}
|
|
70
71
|
export declare class NameNotFoundError extends Error {
|
|
71
72
|
constructor(message: string);
|
|
@@ -110,12 +110,13 @@ export declare class ForgeLexer extends Lexer {
|
|
|
110
110
|
static readonly COMMA_TOK = 105;
|
|
111
111
|
static readonly SLASH_TOK = 106;
|
|
112
112
|
static readonly NUM_CONST_TOK = 107;
|
|
113
|
-
static readonly
|
|
114
|
-
static readonly
|
|
115
|
-
static readonly
|
|
116
|
-
static readonly
|
|
117
|
-
static readonly
|
|
118
|
-
static readonly
|
|
113
|
+
static readonly QUOTED_IDENTIFIER_TOK = 108;
|
|
114
|
+
static readonly IDENTIFIER_TOK = 109;
|
|
115
|
+
static readonly WS = 110;
|
|
116
|
+
static readonly CCOMMENT = 111;
|
|
117
|
+
static readonly COMMENT = 112;
|
|
118
|
+
static readonly MULTCOMMENT = 113;
|
|
119
|
+
static readonly LANG_DECL = 114;
|
|
119
120
|
static readonly channelNames: string[];
|
|
120
121
|
static readonly modeNames: string[];
|
|
121
122
|
static readonly ruleNames: string[];
|
|
@@ -116,12 +116,13 @@ export declare class ForgeParser extends Parser {
|
|
|
116
116
|
static readonly COMMA_TOK = 105;
|
|
117
117
|
static readonly SLASH_TOK = 106;
|
|
118
118
|
static readonly NUM_CONST_TOK = 107;
|
|
119
|
-
static readonly
|
|
120
|
-
static readonly
|
|
121
|
-
static readonly
|
|
122
|
-
static readonly
|
|
123
|
-
static readonly
|
|
124
|
-
static readonly
|
|
119
|
+
static readonly QUOTED_IDENTIFIER_TOK = 108;
|
|
120
|
+
static readonly IDENTIFIER_TOK = 109;
|
|
121
|
+
static readonly WS = 110;
|
|
122
|
+
static readonly CCOMMENT = 111;
|
|
123
|
+
static readonly COMMENT = 112;
|
|
124
|
+
static readonly MULTCOMMENT = 113;
|
|
125
|
+
static readonly LANG_DECL = 114;
|
|
125
126
|
static readonly RULE_predDecl = 0;
|
|
126
127
|
static readonly RULE_parseExpr = 1;
|
|
127
128
|
static readonly RULE_alloyModule = 2;
|
|
@@ -855,7 +856,8 @@ export declare class OptionDeclContext extends ParserRuleContext {
|
|
|
855
856
|
accept<Result>(visitor: ForgeVisitor<Result>): Result;
|
|
856
857
|
}
|
|
857
858
|
export declare class NameContext extends ParserRuleContext {
|
|
858
|
-
IDENTIFIER_TOK(): TerminalNode;
|
|
859
|
+
IDENTIFIER_TOK(): TerminalNode | undefined;
|
|
860
|
+
QUOTED_IDENTIFIER_TOK(): TerminalNode | undefined;
|
|
859
861
|
constructor(parent: ParserRuleContext | undefined, invokingState: number);
|
|
860
862
|
get ruleIndex(): number;
|
|
861
863
|
enterRule(listener: ForgeListener): void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { NameContext } from './ForgeParser';
|
|
2
|
+
/**
|
|
3
|
+
* Extracts the identifier string from a NameContext.
|
|
4
|
+
* Handles both regular identifiers and backtick-quoted identifiers (for reserved keywords).
|
|
5
|
+
*
|
|
6
|
+
* Examples:
|
|
7
|
+
* - Regular: `myVar` -> "myVar"
|
|
8
|
+
* - Quoted: `` `set` `` -> "set"
|
|
9
|
+
* - Quoted with escape: `` `my\`name` `` -> "my`name"
|
|
10
|
+
*
|
|
11
|
+
* @param ctx The NameContext to extract the identifier from
|
|
12
|
+
* @returns The identifier string with backticks and escapes processed
|
|
13
|
+
*/
|
|
14
|
+
export declare function getIdentifierName(ctx: NameContext): string;
|
|
15
|
+
/**
|
|
16
|
+
* Quotes an identifier if it conflicts with a reserved keyword.
|
|
17
|
+
* Use this when generating Forge expressions that might contain reserved words.
|
|
18
|
+
*
|
|
19
|
+
* @param identifier The identifier to potentially quote
|
|
20
|
+
* @param reservedKeywords Set of reserved keywords to check against
|
|
21
|
+
* @returns The identifier, quoted with backticks if necessary
|
|
22
|
+
*/
|
|
23
|
+
export declare function quoteIfReserved(identifier: string, reservedKeywords: Set<string>): string;
|
|
24
|
+
/**
|
|
25
|
+
* Set of all reserved keywords in Forge.
|
|
26
|
+
* Use with quoteIfReserved() when generating Forge expressions.
|
|
27
|
+
*/
|
|
28
|
+
export declare const FORGE_RESERVED_KEYWORDS: Set<string>;
|
package/dist/index.d.ts
CHANGED
|
@@ -17,3 +17,4 @@ export declare class SimpleGraphQueryEvaluator {
|
|
|
17
17
|
evaluateExpression(forgeExpr: string): EvaluationResult;
|
|
18
18
|
}
|
|
19
19
|
export { synthesizeSelector, synthesizeBinaryRelation, synthesizeBinaryRelationWithWhy, synthesizeSelectorWithWhy, AtomSelectionExample, BinaryRelationExample, SelectorSynthesisError, SynthesisWhy, SynthesisWhyExample, WhyNode, } from './SelectorSynthesizer';
|
|
20
|
+
export { getIdentifierName, quoteIfReserved, FORGE_RESERVED_KEYWORDS, } from './forge-antlr/utils';
|