feat: revert qbv5

This commit is contained in:
Aditya Singh 2025-08-05 13:32:35 +05:30
parent b4fbd7c673
commit f114d0249d
15 changed files with 37 additions and 2647 deletions

View File

@ -1,154 +0,0 @@
# QuerySearch Component Documentation
## Overview
The QuerySearch component is a sophisticated query builder interface that allows users to construct complex search queries with real-time validation and autocomplete functionality.
## Dependencies
```typescript
// Core UI
import { Card, Collapse, Space, Tag, Typography } from 'antd';
// Code Editor
import {
autocompletion,
CompletionContext,
CompletionResult,
startCompletion,
} from '@codemirror/autocomplete';
import { javascript } from '@codemirror/lang-javascript';
import { ViewPlugin, ViewUpdate } from '@codemirror/view';
import { copilot } from '@uiw/codemirror-theme-copilot';
import CodeMirror, { EditorView, Extension } from '@uiw/react-codemirror';
// Custom Hooks and Utilities
import { useGetQueryKeySuggestions } from 'hooks/querySuggestions/useGetQueryKeySuggestions';
import { getValueSuggestions } from 'api/querySuggestions/getValueSuggestion';
import { queryOperatorSuggestions, validateQuery } from 'utils/antlrQueryUtils';
import { getQueryContextAtCursor } from 'utils/queryContextUtils';
```
## Key Features
1. Real-time query validation
2. Context-aware autocompletion
3. Support for various query operators (=, !=, IN, LIKE, etc.)
4. Support for complex conditions with AND/OR operators
5. Support for functions (HAS, HASANY, HASALL, HASNONE)
6. Support for parentheses and nested conditions
7. Query examples for common use cases
## State Management
```typescript
const [query, setQuery] = useState<string>('');
const [valueSuggestions, setValueSuggestions] = useState<any[]>([]);
const [activeKey, setActiveKey] = useState<string>('');
const [isLoadingSuggestions, setIsLoadingSuggestions] = useState(false);
const [queryContext, setQueryContext] = useState<IQueryContext | null>(null);
const [validation, setValidation] = useState<IValidationResult>({...});
const [editingMode, setEditingMode] = useState<'key' | 'operator' | 'value' | 'conjunction' | 'function' | 'parenthesis' | 'bracketList' | null>(null);
```
## Core Functions
### 1. Autocomplete Handler
```typescript
function myCompletions(context: CompletionContext): CompletionResult | null {
// Handles autocomplete suggestions based on context
// Supports different contexts: key, operator, value, function, etc.
}
```
### 2. Value Suggestions Fetcher
```typescript
const fetchValueSuggestions = useCallback(
async (key: string): Promise<void> => {
// Fetches value suggestions for a given key
// Handles loading states and error cases
},
[activeKey, isLoadingSuggestions],
);
```
### 3. Query Change Handler
```typescript
const handleQueryChange = useCallback(async (newQuery: string) => {
// Updates query and validates it
// Handles validation errors
}, []);
```
## Query Context Types
1. Key context: When editing a field name
2. Operator context: When selecting an operator
3. Value context: When entering a value
4. Conjunction context: When using AND/OR
5. Function context: When using functions
6. Parenthesis context: When using parentheses
7. Bracket list context: When using IN operator
## Example Queries
```typescript
const queryExamples = [
{ label: 'Basic Query', query: "status = 'error'" },
{ label: 'Multiple Conditions', query: "status = 'error' AND service = 'frontend'" },
{ label: 'IN Operator', query: "status IN ['error', 'warning']" },
{ label: 'Function Usage', query: "HAS(service, 'frontend')" },
{ label: 'Numeric Comparison', query: 'duration > 1000' },
// ... more examples
];
```
## Performance Optimizations
1. Uses `useCallback` for memoized functions
2. Tracks component mount state to prevent updates after unmount
3. Debounces suggestion fetching
4. Caches key suggestions
## Error Handling
```typescript
try {
const validationResponse = validateQuery(newQuery);
setValidation(validationResponse);
} catch (error) {
setValidation({
isValid: false,
message: 'Failed to process query',
errors: [error as IDetailedError],
});
}
```
## Usage Example
```typescript
<QuerySearch />
```
## Styling
- Uses SCSS for styling
- Custom classes for different components
- Theme integration with CodeMirror
## Best Practices
1. Always validate queries before submission
2. Handle loading states appropriately
3. Provide clear error messages
4. Use appropriate operators for different data types
5. Consider performance implications of complex queries
## Common Issues and Solutions
1. Query validation errors
- Check syntax and operator usage
- Verify data types match operator requirements
2. Performance issues
- Optimize suggestion fetching
- Cache frequently used values
3. UI/UX issues
- Ensure clear error messages
- Provide helpful suggestions
- Show appropriate loading states
## Future Improvements
1. Add more query examples
2. Enhance error messages
3. Improve performance for large datasets
4. Add more operator support
5. Enhance UI/UX features

View File

@ -60,7 +60,6 @@
"antd-table-saveas-excel": "2.2.1",
"antlr4": "4.13.2",
"axios": "1.8.2",
"antlr4": "4.13.2",
"babel-eslint": "^10.1.0",
"babel-jest": "^29.6.4",
"babel-loader": "9.1.3",

View File

@ -1,14 +1,12 @@
.explorer-options-container {
position: fixed;
bottom: 8px;
bottom: 24px;
left: calc(50% + 240px);
transform: translate(calc(-50% - 120px), 0);
transition: left 0.2s linear;
border-radius: 6px;
background: var(--Ink-300, #16181d);
display: flex;
gap: 16px;
background-color: transparent;
.multi-alert-button,
@ -34,15 +32,19 @@
.explorer-update {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 8px;
background: var(--Ink-300, #16181d);
gap: 12px;
padding: 10px 10px;
border-radius: 50px;
border: 1px solid var(--bg-slate-400);
background: rgba(22, 24, 29, 0.6);
backdrop-filter: blur(20px);
.action-icon {
display: flex;
justify-content: center;
align-items: center;
padding: 6px;
padding: 8px;
border-radius: 50px;
border: 1px solid var(--bg-slate-400);
background: var(--bg-slate-500);
cursor: pointer;
@ -62,8 +64,10 @@
.explorer-options {
padding: 10px 12px;
background: var(--Ink-300, #16181d);
border-radius: 2px;
border: 1px solid var(--bg-slate-400);
border-radius: 50px;
background: rgba(22, 24, 29, 0.6);
backdrop-filter: blur(20px);
cursor: default;
display: flex;
@ -92,6 +96,27 @@
align-items: center;
gap: 8px;
button {
display: flex;
justify-content: center;
align-items: center;
border: none;
border: 1px solid #1d2023;
box-shadow: none !important;
&.ant-btn-round {
padding: 8px 12px 8px 10px;
font-weight: 500;
}
&.ant-btn-round:disabled {
background-color: rgba(209, 209, 209, 0.074);
color: #5f5f5f;
}
}
.ant-select-focused {
border-color: transparent !important;

View File

@ -63,7 +63,6 @@ export const panelTypeDataSourceFormValuesMap: Record<
'groupBy',
'limit',
'having',
'havingExpression',
'orderBy',
'functions',
'stepInterval',
@ -87,7 +86,6 @@ export const panelTypeDataSourceFormValuesMap: Record<
'groupBy',
'limit',
'having',
'havingExpression',
'orderBy',
'stepInterval',
'legend',
@ -109,7 +107,6 @@ export const panelTypeDataSourceFormValuesMap: Record<
'groupBy',
'limit',
'having',
'havingExpression',
'orderBy',
'functions',
'stepInterval',
@ -133,7 +130,6 @@ export const panelTypeDataSourceFormValuesMap: Record<
'groupBy',
'limit',
'having',
'havingExpression',
'orderBy',
'functions',
'stepInterval',
@ -157,7 +153,6 @@ export const panelTypeDataSourceFormValuesMap: Record<
'groupBy',
'limit',
'having',
'havingExpression',
'orderBy',
'stepInterval',
'legend',
@ -179,7 +174,6 @@ export const panelTypeDataSourceFormValuesMap: Record<
'groupBy',
'limit',
'having',
'havingExpression',
'orderBy',
'functions',
'stepInterval',
@ -203,7 +197,6 @@ export const panelTypeDataSourceFormValuesMap: Record<
'groupBy',
'limit',
'having',
'havingExpression',
'orderBy',
'functions',
'stepInterval',
@ -227,7 +220,6 @@ export const panelTypeDataSourceFormValuesMap: Record<
'groupBy',
'limit',
'having',
'havingExpression',
'orderBy',
'stepInterval',
'legend',
@ -249,7 +241,6 @@ export const panelTypeDataSourceFormValuesMap: Record<
'groupBy',
'limit',
'having',
'havingExpression',
'orderBy',
'functions',
'stepInterval',
@ -273,7 +264,6 @@ export const panelTypeDataSourceFormValuesMap: Record<
'groupBy',
'limit',
'having',
'havingExpression',
'orderBy',
'functions',
'stepInterval',
@ -298,7 +288,6 @@ export const panelTypeDataSourceFormValuesMap: Record<
'reduceTo',
'limit',
'having',
'havingExpression',
'orderBy',
'stepInterval',
'legend',
@ -320,7 +309,6 @@ export const panelTypeDataSourceFormValuesMap: Record<
'groupBy',
'limit',
'having',
'havingExpression',
'orderBy',
'functions',
'stepInterval',
@ -344,7 +332,6 @@ export const panelTypeDataSourceFormValuesMap: Record<
'groupBy',
'limit',
'having',
'havingExpression',
'orderBy',
'functions',
'stepInterval',
@ -369,7 +356,6 @@ export const panelTypeDataSourceFormValuesMap: Record<
'reduceTo',
'limit',
'having',
'havingExpression',
'orderBy',
'stepInterval',
'legend',
@ -391,7 +377,6 @@ export const panelTypeDataSourceFormValuesMap: Record<
'groupBy',
'limit',
'having',
'havingExpression',
'orderBy',
'functions',
'stepInterval',
@ -445,7 +430,6 @@ export const panelTypeDataSourceFormValuesMap: Record<
'filter',
'reduceTo',
'having',
'havingExpression',
'functions',
'stepInterval',
'queryName',
@ -466,7 +450,6 @@ export const panelTypeDataSourceFormValuesMap: Record<
'filter',
'spaceAggregation',
'having',
'havingExpression',
'reduceTo',
'stepInterval',
'legend',
@ -487,7 +470,6 @@ export const panelTypeDataSourceFormValuesMap: Record<
'filter',
'reduceTo',
'having',
'havingExpression',
'functions',
'stepInterval',
'queryName',
@ -506,7 +488,6 @@ export function handleQueryChange(
supersetQuery: Query,
currentPanelType: PANEL_TYPES,
): Query {
console.log('supersetQuery', supersetQuery);
return {
...supersetQuery,
builder: {

View File

@ -3,7 +3,6 @@
display: flex;
flex-direction: column;
height: 100%;
margin: 0 -1rem;
.ant-tabs {
height: 100%;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,49 +0,0 @@
LPAREN=1
RPAREN=2
LBRACK=3
RBRACK=4
COMMA=5
EQUALS=6
NOT_EQUALS=7
NEQ=8
LT=9
LE=10
GT=11
GE=12
LIKE=13
NOT_LIKE=14
ILIKE=15
NOT_ILIKE=16
BETWEEN=17
NOT_BETWEEN=18
EXISTS=19
NOT_EXISTS=20
REGEXP=21
NOT_REGEXP=22
CONTAINS=23
NOT_CONTAINS=24
IN=25
NOT_IN=26
NOT=27
AND=28
OR=29
HAS=30
HASANY=31
HASALL=32
HASNONE=33
BOOL=34
NUMBER=35
QUOTED_TEXT=36
KEY=37
WS=38
'('=1
')'=2
'['=3
']'=4
','=5
'!='=7
'<>'=8
'<'=9
'<='=10
'>'=11
'>='=12

File diff suppressed because one or more lines are too long

View File

@ -1,371 +0,0 @@
// Generated from /Users/younix/Documents/SigNoz-Repos/signoz/frontend/src/query-grammar/FilterQuery.g4 by ANTLR 4.13.1
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenStream;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.misc.*;
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue", "this-escape"})
public class FilterQueryLexer extends Lexer {
static { RuntimeMetaData.checkVersion("4.13.1", RuntimeMetaData.VERSION); }
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
LPAREN=1, RPAREN=2, LBRACK=3, RBRACK=4, COMMA=5, EQUALS=6, NOT_EQUALS=7,
NEQ=8, LT=9, LE=10, GT=11, GE=12, LIKE=13, NOT_LIKE=14, ILIKE=15, NOT_ILIKE=16,
BETWEEN=17, NOT_BETWEEN=18, EXISTS=19, NOT_EXISTS=20, REGEXP=21, NOT_REGEXP=22,
CONTAINS=23, NOT_CONTAINS=24, IN=25, NOT_IN=26, NOT=27, AND=28, OR=29,
HAS=30, HASANY=31, HASALL=32, HASNONE=33, BOOL=34, NUMBER=35, QUOTED_TEXT=36,
KEY=37, WS=38;
public static String[] channelNames = {
"DEFAULT_TOKEN_CHANNEL", "HIDDEN"
};
public static String[] modeNames = {
"DEFAULT_MODE"
};
private static String[] makeRuleNames() {
return new String[] {
"LPAREN", "RPAREN", "LBRACK", "RBRACK", "COMMA", "EQUALS", "NOT_EQUALS",
"NEQ", "LT", "LE", "GT", "GE", "LIKE", "NOT_LIKE", "ILIKE", "NOT_ILIKE",
"BETWEEN", "NOT_BETWEEN", "EXISTS", "NOT_EXISTS", "REGEXP", "NOT_REGEXP",
"CONTAINS", "NOT_CONTAINS", "IN", "NOT_IN", "NOT", "AND", "OR", "HAS",
"HASANY", "HASALL", "HASNONE", "BOOL", "NUMBER", "QUOTED_TEXT", "KEY",
"WS", "DIGIT"
};
}
public static final String[] ruleNames = makeRuleNames();
private static String[] makeLiteralNames() {
return new String[] {
null, "'('", "')'", "'['", "']'", "','", null, "'!='", "'<>'", "'<'",
"'<='", "'>'", "'>='"
};
}
private static final String[] _LITERAL_NAMES = makeLiteralNames();
private static String[] makeSymbolicNames() {
return new String[] {
null, "LPAREN", "RPAREN", "LBRACK", "RBRACK", "COMMA", "EQUALS", "NOT_EQUALS",
"NEQ", "LT", "LE", "GT", "GE", "LIKE", "NOT_LIKE", "ILIKE", "NOT_ILIKE",
"BETWEEN", "NOT_BETWEEN", "EXISTS", "NOT_EXISTS", "REGEXP", "NOT_REGEXP",
"CONTAINS", "NOT_CONTAINS", "IN", "NOT_IN", "NOT", "AND", "OR", "HAS",
"HASANY", "HASALL", "HASNONE", "BOOL", "NUMBER", "QUOTED_TEXT", "KEY",
"WS"
};
}
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
/**
* @deprecated Use {@link #VOCABULARY} instead.
*/
@Deprecated
public static final String[] tokenNames;
static {
tokenNames = new String[_SYMBOLIC_NAMES.length];
for (int i = 0; i < tokenNames.length; i++) {
tokenNames[i] = VOCABULARY.getLiteralName(i);
if (tokenNames[i] == null) {
tokenNames[i] = VOCABULARY.getSymbolicName(i);
}
if (tokenNames[i] == null) {
tokenNames[i] = "<INVALID>";
}
}
}
@Override
@Deprecated
public String[] getTokenNames() {
return tokenNames;
}
@Override
public Vocabulary getVocabulary() {
return VOCABULARY;
}
public FilterQueryLexer(CharStream input) {
super(input);
_interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
}
@Override
public String getGrammarFileName() { return "FilterQuery.g4"; }
@Override
public String[] getRuleNames() { return ruleNames; }
@Override
public String getSerializedATN() { return _serializedATN; }
@Override
public String[] getChannelNames() { return channelNames; }
@Override
public String[] getModeNames() { return modeNames; }
@Override
public ATN getATN() { return _ATN; }
public static final String _serializedATN =
"\u0004\u0000&\u0167\u0006\uffff\uffff\u0002\u0000\u0007\u0000\u0002\u0001"+
"\u0007\u0001\u0002\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002\u0004"+
"\u0007\u0004\u0002\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002\u0007"+
"\u0007\u0007\u0002\b\u0007\b\u0002\t\u0007\t\u0002\n\u0007\n\u0002\u000b"+
"\u0007\u000b\u0002\f\u0007\f\u0002\r\u0007\r\u0002\u000e\u0007\u000e\u0002"+
"\u000f\u0007\u000f\u0002\u0010\u0007\u0010\u0002\u0011\u0007\u0011\u0002"+
"\u0012\u0007\u0012\u0002\u0013\u0007\u0013\u0002\u0014\u0007\u0014\u0002"+
"\u0015\u0007\u0015\u0002\u0016\u0007\u0016\u0002\u0017\u0007\u0017\u0002"+
"\u0018\u0007\u0018\u0002\u0019\u0007\u0019\u0002\u001a\u0007\u001a\u0002"+
"\u001b\u0007\u001b\u0002\u001c\u0007\u001c\u0002\u001d\u0007\u001d\u0002"+
"\u001e\u0007\u001e\u0002\u001f\u0007\u001f\u0002 \u0007 \u0002!\u0007"+
"!\u0002\"\u0007\"\u0002#\u0007#\u0002$\u0007$\u0002%\u0007%\u0002&\u0007"+
"&\u0001\u0000\u0001\u0000\u0001\u0001\u0001\u0001\u0001\u0002\u0001\u0002"+
"\u0001\u0003\u0001\u0003\u0001\u0004\u0001\u0004\u0001\u0005\u0001\u0005"+
"\u0001\u0005\u0003\u0005]\b\u0005\u0001\u0006\u0001\u0006\u0001\u0006"+
"\u0001\u0007\u0001\u0007\u0001\u0007\u0001\b\u0001\b\u0001\t\u0001\t\u0001"+
"\t\u0001\n\u0001\n\u0001\u000b\u0001\u000b\u0001\u000b\u0001\f\u0001\f"+
"\u0001\f\u0001\f\u0001\f\u0001\r\u0001\r\u0001\r\u0001\r\u0004\rx\b\r"+
"\u000b\r\f\ry\u0001\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001\u000e\u0001"+
"\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000f\u0001"+
"\u000f\u0001\u000f\u0001\u000f\u0004\u000f\u008b\b\u000f\u000b\u000f\f"+
"\u000f\u008c\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f"+
"\u0001\u000f\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0010"+
"\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0011\u0001\u0011\u0001\u0011"+
"\u0001\u0011\u0004\u0011\u00a1\b\u0011\u000b\u0011\f\u0011\u00a2\u0001"+
"\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0001"+
"\u0011\u0001\u0011\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0012\u0001"+
"\u0012\u0001\u0012\u0003\u0012\u00b3\b\u0012\u0001\u0013\u0001\u0013\u0001"+
"\u0013\u0001\u0013\u0004\u0013\u00b9\b\u0013\u000b\u0013\f\u0013\u00ba"+
"\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0013"+
"\u0003\u0013\u00c3\b\u0013\u0001\u0014\u0001\u0014\u0001\u0014\u0001\u0014"+
"\u0001\u0014\u0001\u0014\u0001\u0014\u0001\u0015\u0001\u0015\u0001\u0015"+
"\u0001\u0015\u0004\u0015\u00d0\b\u0015\u000b\u0015\f\u0015\u00d1\u0001"+
"\u0015\u0001\u0015\u0001\u0015\u0001\u0015\u0001\u0015\u0001\u0015\u0001"+
"\u0015\u0001\u0016\u0001\u0016\u0001\u0016\u0001\u0016\u0001\u0016\u0001"+
"\u0016\u0001\u0016\u0001\u0016\u0003\u0016\u00e3\b\u0016\u0001\u0017\u0001"+
"\u0017\u0001\u0017\u0001\u0017\u0004\u0017\u00e9\b\u0017\u000b\u0017\f"+
"\u0017\u00ea\u0001\u0017\u0001\u0017\u0001\u0017\u0001\u0017\u0001\u0017"+
"\u0001\u0017\u0001\u0017\u0001\u0017\u0003\u0017\u00f5\b\u0017\u0001\u0018"+
"\u0001\u0018\u0001\u0018\u0001\u0019\u0001\u0019\u0001\u0019\u0001\u0019"+
"\u0004\u0019\u00fe\b\u0019\u000b\u0019\f\u0019\u00ff\u0001\u0019\u0001"+
"\u0019\u0001\u0019\u0001\u001a\u0001\u001a\u0001\u001a\u0001\u001a\u0001"+
"\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001c\u0001\u001c\u0001"+
"\u001c\u0001\u001d\u0001\u001d\u0001\u001d\u0001\u001d\u0001\u001e\u0001"+
"\u001e\u0001\u001e\u0001\u001e\u0001\u001e\u0001\u001e\u0001\u001e\u0001"+
"\u001f\u0001\u001f\u0001\u001f\u0001\u001f\u0001\u001f\u0001\u001f\u0001"+
"\u001f\u0001 \u0001 \u0001 \u0001 \u0001 \u0001 \u0001 \u0001 \u0001!"+
"\u0001!\u0001!\u0001!\u0001!\u0001!\u0001!\u0001!\u0001!\u0003!\u0133"+
"\b!\u0001\"\u0004\"\u0136\b\"\u000b\"\f\"\u0137\u0001\"\u0001\"\u0004"+
"\"\u013c\b\"\u000b\"\f\"\u013d\u0003\"\u0140\b\"\u0001#\u0001#\u0001#"+
"\u0001#\u0005#\u0146\b#\n#\f#\u0149\t#\u0001#\u0001#\u0001#\u0001#\u0001"+
"#\u0005#\u0150\b#\n#\f#\u0153\t#\u0001#\u0003#\u0156\b#\u0001$\u0001$"+
"\u0005$\u015a\b$\n$\f$\u015d\t$\u0001%\u0004%\u0160\b%\u000b%\f%\u0161"+
"\u0001%\u0001%\u0001&\u0001&\u0000\u0000\'\u0001\u0001\u0003\u0002\u0005"+
"\u0003\u0007\u0004\t\u0005\u000b\u0006\r\u0007\u000f\b\u0011\t\u0013\n"+
"\u0015\u000b\u0017\f\u0019\r\u001b\u000e\u001d\u000f\u001f\u0010!\u0011"+
"#\u0012%\u0013\'\u0014)\u0015+\u0016-\u0017/\u00181\u00193\u001a5\u001b"+
"7\u001c9\u001d;\u001e=\u001f? A!C\"E#G$I%K&M\u0000\u0001\u0000\u001c\u0002"+
"\u0000LLll\u0002\u0000IIii\u0002\u0000KKkk\u0002\u0000EEee\u0002\u0000"+
"NNnn\u0002\u0000OOoo\u0002\u0000TTtt\u0002\u0000\t\t \u0002\u0000BBb"+
"b\u0002\u0000WWww\u0002\u0000XXxx\u0002\u0000SSss\u0002\u0000RRrr\u0002"+
"\u0000GGgg\u0002\u0000PPpp\u0002\u0000CCcc\u0002\u0000AAaa\u0002\u0000"+
"DDdd\u0002\u0000HHhh\u0002\u0000YYyy\u0002\u0000UUuu\u0002\u0000FFff\u0002"+
"\u0000\"\"\\\\\u0002\u0000\'\'\\\\\u0004\u000009AZ__az\u0006\u0000..0"+
"9A[]]__az\u0003\u0000\t\n\r\r \u0001\u000009\u017c\u0000\u0001\u0001"+
"\u0000\u0000\u0000\u0000\u0003\u0001\u0000\u0000\u0000\u0000\u0005\u0001"+
"\u0000\u0000\u0000\u0000\u0007\u0001\u0000\u0000\u0000\u0000\t\u0001\u0000"+
"\u0000\u0000\u0000\u000b\u0001\u0000\u0000\u0000\u0000\r\u0001\u0000\u0000"+
"\u0000\u0000\u000f\u0001\u0000\u0000\u0000\u0000\u0011\u0001\u0000\u0000"+
"\u0000\u0000\u0013\u0001\u0000\u0000\u0000\u0000\u0015\u0001\u0000\u0000"+
"\u0000\u0000\u0017\u0001\u0000\u0000\u0000\u0000\u0019\u0001\u0000\u0000"+
"\u0000\u0000\u001b\u0001\u0000\u0000\u0000\u0000\u001d\u0001\u0000\u0000"+
"\u0000\u0000\u001f\u0001\u0000\u0000\u0000\u0000!\u0001\u0000\u0000\u0000"+
"\u0000#\u0001\u0000\u0000\u0000\u0000%\u0001\u0000\u0000\u0000\u0000\'"+
"\u0001\u0000\u0000\u0000\u0000)\u0001\u0000\u0000\u0000\u0000+\u0001\u0000"+
"\u0000\u0000\u0000-\u0001\u0000\u0000\u0000\u0000/\u0001\u0000\u0000\u0000"+
"\u00001\u0001\u0000\u0000\u0000\u00003\u0001\u0000\u0000\u0000\u00005"+
"\u0001\u0000\u0000\u0000\u00007\u0001\u0000\u0000\u0000\u00009\u0001\u0000"+
"\u0000\u0000\u0000;\u0001\u0000\u0000\u0000\u0000=\u0001\u0000\u0000\u0000"+
"\u0000?\u0001\u0000\u0000\u0000\u0000A\u0001\u0000\u0000\u0000\u0000C"+
"\u0001\u0000\u0000\u0000\u0000E\u0001\u0000\u0000\u0000\u0000G\u0001\u0000"+
"\u0000\u0000\u0000I\u0001\u0000\u0000\u0000\u0000K\u0001\u0000\u0000\u0000"+
"\u0001O\u0001\u0000\u0000\u0000\u0003Q\u0001\u0000\u0000\u0000\u0005S"+
"\u0001\u0000\u0000\u0000\u0007U\u0001\u0000\u0000\u0000\tW\u0001\u0000"+
"\u0000\u0000\u000b\\\u0001\u0000\u0000\u0000\r^\u0001\u0000\u0000\u0000"+
"\u000fa\u0001\u0000\u0000\u0000\u0011d\u0001\u0000\u0000\u0000\u0013f"+
"\u0001\u0000\u0000\u0000\u0015i\u0001\u0000\u0000\u0000\u0017k\u0001\u0000"+
"\u0000\u0000\u0019n\u0001\u0000\u0000\u0000\u001bs\u0001\u0000\u0000\u0000"+
"\u001d\u0080\u0001\u0000\u0000\u0000\u001f\u0086\u0001\u0000\u0000\u0000"+
"!\u0094\u0001\u0000\u0000\u0000#\u009c\u0001\u0000\u0000\u0000%\u00ac"+
"\u0001\u0000\u0000\u0000\'\u00b4\u0001\u0000\u0000\u0000)\u00c4\u0001"+
"\u0000\u0000\u0000+\u00cb\u0001\u0000\u0000\u0000-\u00da\u0001\u0000\u0000"+
"\u0000/\u00e4\u0001\u0000\u0000\u00001\u00f6\u0001\u0000\u0000\u00003"+
"\u00f9\u0001\u0000\u0000\u00005\u0104\u0001\u0000\u0000\u00007\u0108\u0001"+
"\u0000\u0000\u00009\u010c\u0001\u0000\u0000\u0000;\u010f\u0001\u0000\u0000"+
"\u0000=\u0113\u0001\u0000\u0000\u0000?\u011a\u0001\u0000\u0000\u0000A"+
"\u0121\u0001\u0000\u0000\u0000C\u0132\u0001\u0000\u0000\u0000E\u0135\u0001"+
"\u0000\u0000\u0000G\u0155\u0001\u0000\u0000\u0000I\u0157\u0001\u0000\u0000"+
"\u0000K\u015f\u0001\u0000\u0000\u0000M\u0165\u0001\u0000\u0000\u0000O"+
"P\u0005(\u0000\u0000P\u0002\u0001\u0000\u0000\u0000QR\u0005)\u0000\u0000"+
"R\u0004\u0001\u0000\u0000\u0000ST\u0005[\u0000\u0000T\u0006\u0001\u0000"+
"\u0000\u0000UV\u0005]\u0000\u0000V\b\u0001\u0000\u0000\u0000WX\u0005,"+
"\u0000\u0000X\n\u0001\u0000\u0000\u0000Y]\u0005=\u0000\u0000Z[\u0005="+
"\u0000\u0000[]\u0005=\u0000\u0000\\Y\u0001\u0000\u0000\u0000\\Z\u0001"+
"\u0000\u0000\u0000]\f\u0001\u0000\u0000\u0000^_\u0005!\u0000\u0000_`\u0005"+
"=\u0000\u0000`\u000e\u0001\u0000\u0000\u0000ab\u0005<\u0000\u0000bc\u0005"+
">\u0000\u0000c\u0010\u0001\u0000\u0000\u0000de\u0005<\u0000\u0000e\u0012"+
"\u0001\u0000\u0000\u0000fg\u0005<\u0000\u0000gh\u0005=\u0000\u0000h\u0014"+
"\u0001\u0000\u0000\u0000ij\u0005>\u0000\u0000j\u0016\u0001\u0000\u0000"+
"\u0000kl\u0005>\u0000\u0000lm\u0005=\u0000\u0000m\u0018\u0001\u0000\u0000"+
"\u0000no\u0007\u0000\u0000\u0000op\u0007\u0001\u0000\u0000pq\u0007\u0002"+
"\u0000\u0000qr\u0007\u0003\u0000\u0000r\u001a\u0001\u0000\u0000\u0000"+
"st\u0007\u0004\u0000\u0000tu\u0007\u0005\u0000\u0000uw\u0007\u0006\u0000"+
"\u0000vx\u0007\u0007\u0000\u0000wv\u0001\u0000\u0000\u0000xy\u0001\u0000"+
"\u0000\u0000yw\u0001\u0000\u0000\u0000yz\u0001\u0000\u0000\u0000z{\u0001"+
"\u0000\u0000\u0000{|\u0007\u0000\u0000\u0000|}\u0007\u0001\u0000\u0000"+
"}~\u0007\u0002\u0000\u0000~\u007f\u0007\u0003\u0000\u0000\u007f\u001c"+
"\u0001\u0000\u0000\u0000\u0080\u0081\u0007\u0001\u0000\u0000\u0081\u0082"+
"\u0007\u0000\u0000\u0000\u0082\u0083\u0007\u0001\u0000\u0000\u0083\u0084"+
"\u0007\u0002\u0000\u0000\u0084\u0085\u0007\u0003\u0000\u0000\u0085\u001e"+
"\u0001\u0000\u0000\u0000\u0086\u0087\u0007\u0004\u0000\u0000\u0087\u0088"+
"\u0007\u0005\u0000\u0000\u0088\u008a\u0007\u0006\u0000\u0000\u0089\u008b"+
"\u0007\u0007\u0000\u0000\u008a\u0089\u0001\u0000\u0000\u0000\u008b\u008c"+
"\u0001\u0000\u0000\u0000\u008c\u008a\u0001\u0000\u0000\u0000\u008c\u008d"+
"\u0001\u0000\u0000\u0000\u008d\u008e\u0001\u0000\u0000\u0000\u008e\u008f"+
"\u0007\u0001\u0000\u0000\u008f\u0090\u0007\u0000\u0000\u0000\u0090\u0091"+
"\u0007\u0001\u0000\u0000\u0091\u0092\u0007\u0002\u0000\u0000\u0092\u0093"+
"\u0007\u0003\u0000\u0000\u0093 \u0001\u0000\u0000\u0000\u0094\u0095\u0007"+
"\b\u0000\u0000\u0095\u0096\u0007\u0003\u0000\u0000\u0096\u0097\u0007\u0006"+
"\u0000\u0000\u0097\u0098\u0007\t\u0000\u0000\u0098\u0099\u0007\u0003\u0000"+
"\u0000\u0099\u009a\u0007\u0003\u0000\u0000\u009a\u009b\u0007\u0004\u0000"+
"\u0000\u009b\"\u0001\u0000\u0000\u0000\u009c\u009d\u0007\u0004\u0000\u0000"+
"\u009d\u009e\u0007\u0005\u0000\u0000\u009e\u00a0\u0007\u0006\u0000\u0000"+
"\u009f\u00a1\u0007\u0007\u0000\u0000\u00a0\u009f\u0001\u0000\u0000\u0000"+
"\u00a1\u00a2\u0001\u0000\u0000\u0000\u00a2\u00a0\u0001\u0000\u0000\u0000"+
"\u00a2\u00a3\u0001\u0000\u0000\u0000\u00a3\u00a4\u0001\u0000\u0000\u0000"+
"\u00a4\u00a5\u0007\b\u0000\u0000\u00a5\u00a6\u0007\u0003\u0000\u0000\u00a6"+
"\u00a7\u0007\u0006\u0000\u0000\u00a7\u00a8\u0007\t\u0000\u0000\u00a8\u00a9"+
"\u0007\u0003\u0000\u0000\u00a9\u00aa\u0007\u0003\u0000\u0000\u00aa\u00ab"+
"\u0007\u0004\u0000\u0000\u00ab$\u0001\u0000\u0000\u0000\u00ac\u00ad\u0007"+
"\u0003\u0000\u0000\u00ad\u00ae\u0007\n\u0000\u0000\u00ae\u00af\u0007\u0001"+
"\u0000\u0000\u00af\u00b0\u0007\u000b\u0000\u0000\u00b0\u00b2\u0007\u0006"+
"\u0000\u0000\u00b1\u00b3\u0007\u000b\u0000\u0000\u00b2\u00b1\u0001\u0000"+
"\u0000\u0000\u00b2\u00b3\u0001\u0000\u0000\u0000\u00b3&\u0001\u0000\u0000"+
"\u0000\u00b4\u00b5\u0007\u0004\u0000\u0000\u00b5\u00b6\u0007\u0005\u0000"+
"\u0000\u00b6\u00b8\u0007\u0006\u0000\u0000\u00b7\u00b9\u0007\u0007\u0000"+
"\u0000\u00b8\u00b7\u0001\u0000\u0000\u0000\u00b9\u00ba\u0001\u0000\u0000"+
"\u0000\u00ba\u00b8\u0001\u0000\u0000\u0000\u00ba\u00bb\u0001\u0000\u0000"+
"\u0000\u00bb\u00bc\u0001\u0000\u0000\u0000\u00bc\u00bd\u0007\u0003\u0000"+
"\u0000\u00bd\u00be\u0007\n\u0000\u0000\u00be\u00bf\u0007\u0001\u0000\u0000"+
"\u00bf\u00c0\u0007\u000b\u0000\u0000\u00c0\u00c2\u0007\u0006\u0000\u0000"+
"\u00c1\u00c3\u0007\u000b\u0000\u0000\u00c2\u00c1\u0001\u0000\u0000\u0000"+
"\u00c2\u00c3\u0001\u0000\u0000\u0000\u00c3(\u0001\u0000\u0000\u0000\u00c4"+
"\u00c5\u0007\f\u0000\u0000\u00c5\u00c6\u0007\u0003\u0000\u0000\u00c6\u00c7"+
"\u0007\r\u0000\u0000\u00c7\u00c8\u0007\u0003\u0000\u0000\u00c8\u00c9\u0007"+
"\n\u0000\u0000\u00c9\u00ca\u0007\u000e\u0000\u0000\u00ca*\u0001\u0000"+
"\u0000\u0000\u00cb\u00cc\u0007\u0004\u0000\u0000\u00cc\u00cd\u0007\u0005"+
"\u0000\u0000\u00cd\u00cf\u0007\u0006\u0000\u0000\u00ce\u00d0\u0007\u0007"+
"\u0000\u0000\u00cf\u00ce\u0001\u0000\u0000\u0000\u00d0\u00d1\u0001\u0000"+
"\u0000\u0000\u00d1\u00cf\u0001\u0000\u0000\u0000\u00d1\u00d2\u0001\u0000"+
"\u0000\u0000\u00d2\u00d3\u0001\u0000\u0000\u0000\u00d3\u00d4\u0007\f\u0000"+
"\u0000\u00d4\u00d5\u0007\u0003\u0000\u0000\u00d5\u00d6\u0007\r\u0000\u0000"+
"\u00d6\u00d7\u0007\u0003\u0000\u0000\u00d7\u00d8\u0007\n\u0000\u0000\u00d8"+
"\u00d9\u0007\u000e\u0000\u0000\u00d9,\u0001\u0000\u0000\u0000\u00da\u00db"+
"\u0007\u000f\u0000\u0000\u00db\u00dc\u0007\u0005\u0000\u0000\u00dc\u00dd"+
"\u0007\u0004\u0000\u0000\u00dd\u00de\u0007\u0006\u0000\u0000\u00de\u00df"+
"\u0007\u0010\u0000\u0000\u00df\u00e0\u0007\u0001\u0000\u0000\u00e0\u00e2"+
"\u0007\u0004\u0000\u0000\u00e1\u00e3\u0007\u000b\u0000\u0000\u00e2\u00e1"+
"\u0001\u0000\u0000\u0000\u00e2\u00e3\u0001\u0000\u0000\u0000\u00e3.\u0001"+
"\u0000\u0000\u0000\u00e4\u00e5\u0007\u0004\u0000\u0000\u00e5\u00e6\u0007"+
"\u0005\u0000\u0000\u00e6\u00e8\u0007\u0006\u0000\u0000\u00e7\u00e9\u0007"+
"\u0007\u0000\u0000\u00e8\u00e7\u0001\u0000\u0000\u0000\u00e9\u00ea\u0001"+
"\u0000\u0000\u0000\u00ea\u00e8\u0001\u0000\u0000\u0000\u00ea\u00eb\u0001"+
"\u0000\u0000\u0000\u00eb\u00ec\u0001\u0000\u0000\u0000\u00ec\u00ed\u0007"+
"\u000f\u0000\u0000\u00ed\u00ee\u0007\u0005\u0000\u0000\u00ee\u00ef\u0007"+
"\u0004\u0000\u0000\u00ef\u00f0\u0007\u0006\u0000\u0000\u00f0\u00f1\u0007"+
"\u0010\u0000\u0000\u00f1\u00f2\u0007\u0001\u0000\u0000\u00f2\u00f4\u0007"+
"\u0004\u0000\u0000\u00f3\u00f5\u0007\u000b\u0000\u0000\u00f4\u00f3\u0001"+
"\u0000\u0000\u0000\u00f4\u00f5\u0001\u0000\u0000\u0000\u00f50\u0001\u0000"+
"\u0000\u0000\u00f6\u00f7\u0007\u0001\u0000\u0000\u00f7\u00f8\u0007\u0004"+
"\u0000\u0000\u00f82\u0001\u0000\u0000\u0000\u00f9\u00fa\u0007\u0004\u0000"+
"\u0000\u00fa\u00fb\u0007\u0005\u0000\u0000\u00fb\u00fd\u0007\u0006\u0000"+
"\u0000\u00fc\u00fe\u0007\u0007\u0000\u0000\u00fd\u00fc\u0001\u0000\u0000"+
"\u0000\u00fe\u00ff\u0001\u0000\u0000\u0000\u00ff\u00fd\u0001\u0000\u0000"+
"\u0000\u00ff\u0100\u0001\u0000\u0000\u0000\u0100\u0101\u0001\u0000\u0000"+
"\u0000\u0101\u0102\u0007\u0001\u0000\u0000\u0102\u0103\u0007\u0004\u0000"+
"\u0000\u01034\u0001\u0000\u0000\u0000\u0104\u0105\u0007\u0004\u0000\u0000"+
"\u0105\u0106\u0007\u0005\u0000\u0000\u0106\u0107\u0007\u0006\u0000\u0000"+
"\u01076\u0001\u0000\u0000\u0000\u0108\u0109\u0007\u0010\u0000\u0000\u0109"+
"\u010a\u0007\u0004\u0000\u0000\u010a\u010b\u0007\u0011\u0000\u0000\u010b"+
"8\u0001\u0000\u0000\u0000\u010c\u010d\u0007\u0005\u0000\u0000\u010d\u010e"+
"\u0007\f\u0000\u0000\u010e:\u0001\u0000\u0000\u0000\u010f\u0110\u0007"+
"\u0012\u0000\u0000\u0110\u0111\u0007\u0010\u0000\u0000\u0111\u0112\u0007"+
"\u000b\u0000\u0000\u0112<\u0001\u0000\u0000\u0000\u0113\u0114\u0007\u0012"+
"\u0000\u0000\u0114\u0115\u0007\u0010\u0000\u0000\u0115\u0116\u0007\u000b"+
"\u0000\u0000\u0116\u0117\u0007\u0010\u0000\u0000\u0117\u0118\u0007\u0004"+
"\u0000\u0000\u0118\u0119\u0007\u0013\u0000\u0000\u0119>\u0001\u0000\u0000"+
"\u0000\u011a\u011b\u0007\u0012\u0000\u0000\u011b\u011c\u0007\u0010\u0000"+
"\u0000\u011c\u011d\u0007\u000b\u0000\u0000\u011d\u011e\u0007\u0010\u0000"+
"\u0000\u011e\u011f\u0007\u0000\u0000\u0000\u011f\u0120\u0007\u0000\u0000"+
"\u0000\u0120@\u0001\u0000\u0000\u0000\u0121\u0122\u0007\u0012\u0000\u0000"+
"\u0122\u0123\u0007\u0010\u0000\u0000\u0123\u0124\u0007\u000b\u0000\u0000"+
"\u0124\u0125\u0007\u0004\u0000\u0000\u0125\u0126\u0007\u0005\u0000\u0000"+
"\u0126\u0127\u0007\u0004\u0000\u0000\u0127\u0128\u0007\u0003\u0000\u0000"+
"\u0128B\u0001\u0000\u0000\u0000\u0129\u012a\u0007\u0006\u0000\u0000\u012a"+
"\u012b\u0007\f\u0000\u0000\u012b\u012c\u0007\u0014\u0000\u0000\u012c\u0133"+
"\u0007\u0003\u0000\u0000\u012d\u012e\u0007\u0015\u0000\u0000\u012e\u012f"+
"\u0007\u0010\u0000\u0000\u012f\u0130\u0007\u0000\u0000\u0000\u0130\u0131"+
"\u0007\u000b\u0000\u0000\u0131\u0133\u0007\u0003\u0000\u0000\u0132\u0129"+
"\u0001\u0000\u0000\u0000\u0132\u012d\u0001\u0000\u0000\u0000\u0133D\u0001"+
"\u0000\u0000\u0000\u0134\u0136\u0003M&\u0000\u0135\u0134\u0001\u0000\u0000"+
"\u0000\u0136\u0137\u0001\u0000\u0000\u0000\u0137\u0135\u0001\u0000\u0000"+
"\u0000\u0137\u0138\u0001\u0000\u0000\u0000\u0138\u013f\u0001\u0000\u0000"+
"\u0000\u0139\u013b\u0005.\u0000\u0000\u013a\u013c\u0003M&\u0000\u013b"+
"\u013a\u0001\u0000\u0000\u0000\u013c\u013d\u0001\u0000\u0000\u0000\u013d"+
"\u013b\u0001\u0000\u0000\u0000\u013d\u013e\u0001\u0000\u0000\u0000\u013e"+
"\u0140\u0001\u0000\u0000\u0000\u013f\u0139\u0001\u0000\u0000\u0000\u013f"+
"\u0140\u0001\u0000\u0000\u0000\u0140F\u0001\u0000\u0000\u0000\u0141\u0147"+
"\u0005\"\u0000\u0000\u0142\u0146\b\u0016\u0000\u0000\u0143\u0144\u0005"+
"\\\u0000\u0000\u0144\u0146\t\u0000\u0000\u0000\u0145\u0142\u0001\u0000"+
"\u0000\u0000\u0145\u0143\u0001\u0000\u0000\u0000\u0146\u0149\u0001\u0000"+
"\u0000\u0000\u0147\u0145\u0001\u0000\u0000\u0000\u0147\u0148\u0001\u0000"+
"\u0000\u0000\u0148\u014a\u0001\u0000\u0000\u0000\u0149\u0147\u0001\u0000"+
"\u0000\u0000\u014a\u0156\u0005\"\u0000\u0000\u014b\u0151\u0005\'\u0000"+
"\u0000\u014c\u0150\b\u0017\u0000\u0000\u014d\u014e\u0005\\\u0000\u0000"+
"\u014e\u0150\t\u0000\u0000\u0000\u014f\u014c\u0001\u0000\u0000\u0000\u014f"+
"\u014d\u0001\u0000\u0000\u0000\u0150\u0153\u0001\u0000\u0000\u0000\u0151"+
"\u014f\u0001\u0000\u0000\u0000\u0151\u0152\u0001\u0000\u0000\u0000\u0152"+
"\u0154\u0001\u0000\u0000\u0000\u0153\u0151\u0001\u0000\u0000\u0000\u0154"+
"\u0156\u0005\'\u0000\u0000\u0155\u0141\u0001\u0000\u0000\u0000\u0155\u014b"+
"\u0001\u0000\u0000\u0000\u0156H\u0001\u0000\u0000\u0000\u0157\u015b\u0007"+
"\u0018\u0000\u0000\u0158\u015a\u0007\u0019\u0000\u0000\u0159\u0158\u0001"+
"\u0000\u0000\u0000\u015a\u015d\u0001\u0000\u0000\u0000\u015b\u0159\u0001"+
"\u0000\u0000\u0000\u015b\u015c\u0001\u0000\u0000\u0000\u015cJ\u0001\u0000"+
"\u0000\u0000\u015d\u015b\u0001\u0000\u0000\u0000\u015e\u0160\u0007\u001a"+
"\u0000\u0000\u015f\u015e\u0001\u0000\u0000\u0000\u0160\u0161\u0001\u0000"+
"\u0000\u0000\u0161\u015f\u0001\u0000\u0000\u0000\u0161\u0162\u0001\u0000"+
"\u0000\u0000\u0162\u0163\u0001\u0000\u0000\u0000\u0163\u0164\u0006%\u0000"+
"\u0000\u0164L\u0001\u0000\u0000\u0000\u0165\u0166\u0007\u001b\u0000\u0000"+
"\u0166N\u0001\u0000\u0000\u0000\u0018\u0000\\y\u008c\u00a2\u00b2\u00ba"+
"\u00c2\u00d1\u00e2\u00ea\u00f4\u00ff\u0132\u0137\u013d\u013f\u0145\u0147"+
"\u014f\u0151\u0155\u015b\u0161\u0001\u0006\u0000\u0000";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
}
}
}

View File

@ -1,49 +0,0 @@
LPAREN=1
RPAREN=2
LBRACK=3
RBRACK=4
COMMA=5
EQUALS=6
NOT_EQUALS=7
NEQ=8
LT=9
LE=10
GT=11
GE=12
LIKE=13
NOT_LIKE=14
ILIKE=15
NOT_ILIKE=16
BETWEEN=17
NOT_BETWEEN=18
EXISTS=19
NOT_EXISTS=20
REGEXP=21
NOT_REGEXP=22
CONTAINS=23
NOT_CONTAINS=24
IN=25
NOT_IN=26
NOT=27
AND=28
OR=29
HAS=30
HASANY=31
HASALL=32
HASNONE=33
BOOL=34
NUMBER=35
QUOTED_TEXT=36
KEY=37
WS=38
'('=1
')'=2
'['=3
']'=4
','=5
'!='=7
'<>'=8
'<'=9
'<='=10
'>'=11
'>='=12

File diff suppressed because it is too large Load Diff

View File

@ -1,183 +0,0 @@
grammar FilterQuery;
/*
* Parser Rules
*/
query
: expression ( (AND | OR) expression | expression )*
EOF
;
expression
: orExpression
;
orExpression
: andExpression ( OR andExpression )*
;
andExpression
: unaryExpression ( AND unaryExpression | unaryExpression )*
;
unaryExpression
: NOT? primary
;
primary
: LPAREN orExpression RPAREN
| comparison
| functionCall
| fullText
;
comparison
: key EQUALS value
| key (NOT_EQUALS | NEQ) value
| key LT value
| key LE value
| key GT value
| key GE value
| key (LIKE | ILIKE) value
| key (NOT_LIKE | NOT_ILIKE) value
| key BETWEEN value AND value
| key NOT_BETWEEN value AND value
| key inClause
| key notInClause
| key EXISTS
| key NOT_EXISTS
| key REGEXP value
| key NOT_REGEXP value
| key CONTAINS value
| key NOT_CONTAINS value
;
inClause
: IN LPAREN valueList RPAREN
| IN LBRACK valueList RBRACK
;
notInClause
: NOT_IN LPAREN valueList RPAREN
| NOT_IN LBRACK valueList RBRACK
;
valueList
: value ( COMMA value )*
;
fullText
: QUOTED_TEXT
;
functionCall
: (HAS | HASANY | HASALL | HASNONE) LPAREN functionParamList RPAREN
;
functionParamList
: functionParam ( COMMA functionParam )*
;
functionParam
: key
| value
| array
;
array
: LBRACK valueList RBRACK
;
value
: QUOTED_TEXT
| NUMBER
| BOOL
;
key
: KEY
;
/*
* Lexer Rules
*/
// Common punctuation / symbols
LPAREN : '(' ;
RPAREN : ')' ;
LBRACK : '[' ;
RBRACK : ']' ;
COMMA : ',' ;
EQUALS : '=' | '==' ;
NOT_EQUALS : '!=' ;
NEQ : '<>' ;
LT : '<' ;
LE : '<=' ;
GT : '>' ;
GE : '>=' ;
// Multi-keyword operators
LIKE : [Ll][Ii][Kk][Ee] ;
NOT_LIKE : [Nn][Oo][Tt] [ \t]+ [Ll][Ii][Kk][Ee] ;
ILIKE : [Ii][Ll][Ii][Kk][Ee] ;
NOT_ILIKE : [Nn][Oo][Tt] [ \t]+ [Ii][Ll][Ii][Kk][Ee] ;
BETWEEN : [Bb][Ee][Tt][Ww][Ee][Ee][Nn] ;
NOT_BETWEEN : [Nn][Oo][Tt] [ \t]+ [Bb][Ee][Tt][Ww][Ee][Ee][Nn] ;
EXISTS : [Ee][Xx][Ii][Ss][Tt][Ss]? ;
NOT_EXISTS : [Nn][Oo][Tt] [ \t]+ [Ee][Xx][Ii][Ss][Tt][Ss]? ;
REGEXP : [Rr][Ee][Gg][Ee][Xx][Pp] ;
NOT_REGEXP : [Nn][Oo][Tt] [ \t]+ [Rr][Ee][Gg][Ee][Xx][Pp] ;
CONTAINS : [Cc][Oo][Nn][Tt][Aa][Ii][Nn][Ss]? ;
NOT_CONTAINS: [Nn][Oo][Tt] [ \t]+ [Cc][Oo][Nn][Tt][Aa][Ii][Nn][Ss]? ;
IN : [Ii][Nn] ;
NOT_IN : [Nn][Oo][Tt] [ \t]+ [Ii][Nn] ;
// Boolean logic
NOT : [Nn][Oo][Tt] ;
AND : [Aa][Nn][Dd] ;
OR : [Oo][Rr] ;
// Functions
HAS : [Hh][Aa][Ss] ;
HASANY : [Hh][Aa][Ss][Aa][Nn][Yy] ;
HASALL : [Hh][Aa][Ss][Aa][Ll][Ll] ;
HASNONE : [Hh][Aa][Ss][Nn][Oo][Nn][Ee] ;
// Boolean values
BOOL
: [Tt][Rr][Uu][Ee]
| [Ff][Aa][Ll][Ss][Ee]
;
// Numbers
NUMBER
: DIGIT+ ( '.' DIGIT+ )?
;
// Quoted text
QUOTED_TEXT
: ( '"' ( ~["\\] | '\\' . )* '"' // double-quoted
| '\'' ( ~['\\] | '\\' . )* '\'' // single-quoted
)
;
// Keys
KEY
: [a-zA-Z0-9_] [a-zA-Z0-9_.[\]]*
;
// Whitespace
WS
: [ \t\r\n]+ -> skip
;
// Digits fragment
fragment DIGIT
: [0-9]
;

View File

@ -1,159 +0,0 @@
/* eslint-disable sonarjs/cognitive-complexity */
/* eslint-disable no-restricted-syntax */
import antlr4, { CharStreams } from 'antlr4';
import cloneDeep from 'lodash-es/cloneDeep';
import FilterQueryLexer from 'parser/FilterQueryLexer';
export enum CursorContext {
Key,
Operator,
Value,
NoFilter,
FullText,
}
const contextNames = ['Key', 'Operator', 'Value', 'NoFilter', 'FullText'];
export function contextToString(context: CursorContext): string {
return contextNames[context];
}
export interface ContextInfo {
context: CursorContext;
key?: string;
token?: antlr4.Token;
operator?: string;
}
export function detectContext(
query: string,
cursorOffset: number,
): ContextInfo {
console.log('query', query);
console.log('cursorOffset', cursorOffset);
const chars = CharStreams.fromString(query);
const lexer = new FilterQueryLexer(chars);
const tokens = new antlr4.CommonTokenStream(lexer);
tokens.fill();
enum State {
ExpectKey,
ExpectOperator,
ExpectValue,
}
let state = State.ExpectKey;
let parens = 0;
let array = 0;
let lastKey: antlr4.Token | undefined;
let lastOperator: antlr4.Token | undefined;
let cursorTok: antlr4.Token | undefined;
let pos = 0;
for (const tok of tokens.tokens) {
const text = tok.text || '';
if (
tok.channel === antlr4.Token.DEFAULT_CHANNEL &&
pos <= cursorOffset &&
cursorOffset <= pos + text.length
) {
cursorTok = tok;
break;
}
switch (tok.type) {
case FilterQueryLexer.LPAREN:
parens++;
state = State.ExpectKey;
break;
case FilterQueryLexer.RPAREN:
if (parens > 0) parens--;
state = State.ExpectOperator;
break;
case FilterQueryLexer.LBRACK:
array++;
state = State.ExpectValue;
break;
case FilterQueryLexer.RBRACK:
if (array > 0) array--;
state = State.ExpectOperator;
break;
case FilterQueryLexer.COMMA:
if (array > 0) state = State.ExpectValue;
break;
case FilterQueryLexer.KEY:
if (state === State.ExpectKey) {
lastKey = tok;
state = State.ExpectOperator;
}
break;
case FilterQueryLexer.QUOTED_TEXT:
case FilterQueryLexer.NUMBER:
case FilterQueryLexer.BOOL:
if (state === State.ExpectValue) {
state = State.ExpectOperator;
}
break;
default:
if (
tok.type >= FilterQueryLexer.EQUALS &&
tok.type <= FilterQueryLexer.CONTAINS
) {
state = State.ExpectValue;
}
break;
}
pos += text.length;
}
console.log('cursorTok', cursorTok);
const out: ContextInfo = { context: CursorContext.NoFilter };
if (cursorTok) {
out.token = cursorTok;
}
console.log('out', cloneDeep(out));
console.log('state', cloneDeep(state));
switch (state) {
case State.ExpectKey:
out.context = CursorContext.Key;
break;
case State.ExpectOperator:
out.context = CursorContext.Operator;
if (lastKey) out.key = lastKey.text;
break;
case State.ExpectValue:
out.context = CursorContext.Value;
if (lastKey) out.key = lastKey.text;
if (lastOperator) {
out.operator = lastOperator.text;
}
break;
default:
out.context = CursorContext.NoFilter;
break;
}
console.log('out', cloneDeep(out));
if (
cursorTok &&
cursorTok.type === FilterQueryLexer.QUOTED_TEXT &&
(out.context === CursorContext.Key || out.context === CursorContext.NoFilter)
) {
out.context = CursorContext.FullText;
}
// if (!cursorTok || cursorTok.type === antlr4.Token.EOF) {
// out.context = CursorContext.NoFilter;
// }
return out;
}