Skip to content

Commit ef7ec1d

Browse files
authored
Merge pull request #268 from jimmyhogerty/add-mru-scope-support
feat: add support for 'mru' in USING SCOPE clause
2 parents 8b08141 + f9fc0f7 commit ef7ec1d

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

src/parser/lexer.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,13 @@ export const AllPrivate = createToken({
881881
categories: [UsingScopeEnumeration, Identifier],
882882
start_chars_hint: ['A', 'a'],
883883
});
884+
export const Mru = createToken({
885+
name: 'Mru',
886+
pattern: /MRU/i,
887+
longer_alt: Identifier,
888+
categories: [UsingScopeEnumeration, Identifier],
889+
start_chars_hint: ['M', 'm'],
890+
});
884891

885892
export const allTokens = [
886893
// we place WhiteSpace first as it is very common thus it will speed up the lexer.
@@ -921,6 +928,7 @@ export const allTokens = [
921928
Everything,
922929
MineAndMyGroups,
923930
Mine,
931+
Mru,
924932
MyTerritory,
925933
MyTeamTerritory,
926934
Team,

test/test-cases-for-is-valid.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,5 +493,6 @@ WHERE
493493
soql: `SELECT Id FROM Account WITH SYSTEM_MODE`,
494494
isValid: true,
495495
},
496+
{ testCase: 161, soql: `SELECT Name, Id FROM Contact USING SCOPE mru ORDER BY Name ASC`, isValid: true },
496497
];
497498
export default testCases;

test/test-cases.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2686,6 +2686,19 @@ export const testCases: TestCase[] = [
26862686
},
26872687
},
26882688
},
2689+
{
2690+
testCase: 129,
2691+
soql: 'SELECT Name, Id FROM Contact USING SCOPE mru ORDER BY Name ASC',
2692+
output: {
2693+
fields: [
2694+
{ type: 'Field', field: 'Name' },
2695+
{ type: 'Field', field: 'Id' },
2696+
],
2697+
sObject: 'Contact',
2698+
usingScope: 'mru',
2699+
orderBy: [{ field: 'Name', order: 'ASC' }],
2700+
},
2701+
},
26892702
];
26902703

26912704
export default testCases;

0 commit comments

Comments
 (0)