Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions abl.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,9 @@
{
"include": "#handle-methods"
},
{
"include": "#get-query"
},
{
"include": "#abl-functions"
},
Expand Down Expand Up @@ -1108,6 +1111,29 @@
}
]
},
"get-query" :{
"begin": "(?i)\\b(get)\\s+(first|next|prev|last|current)\\b",
"beginCaptures": {
"1": {
"name": "keyword.other.abl"
},
"2": {
"name": "keyword.other.abl"
}
},
"end": "(?i)\\s*(?=share-lock|exclusive-lock|no-lock|\\.)",
"patterns": [
{
"include": "#variable-name"
},
{
"include": "#preprocessors"
},
{
"include": "#comment"
}
]
},
"attribute-access": {
"begin": ":",
"end": "(?=:)|(?=\\s*)",
Expand Down
137 changes: 137 additions & 0 deletions spec/db-table-and-field/query-get.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
const { assert, expect } = require('chai');
const shared = require('../shared.js');

describe('', () => {
let statement = `get first qttFoo
no-lock.`;
let expectedTokens = [
[
{ "startIndex": 0, "endIndex": 3, "scopes": ["source.abl", "keyword.other.abl"] }, // 'get'
{ "startIndex": 3, "endIndex": 4, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 4, "endIndex": 9, "scopes": ["source.abl", "keyword.other.abl"] }, // 'first'
{ "startIndex": 9, "endIndex": 10, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 10, "endIndex": 16, "scopes": ["source.abl", "variable.other.abl"] } // 'qttFoo'
],
[
{ "startIndex": 0, "endIndex": 4, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 4, "endIndex": 11, "scopes": ["source.abl", "keyword.other.abl"] }, // 'no-lock'
{ "startIndex": 11, "endIndex": 12, "scopes": ["source.abl", "punctuation.terminator.abl"] } // '.'
]
];
shared.itShouldMatchExpectedScopes(statement, expectedTokens);
})

describe('', () => {
let statement = `get first qttFoo.

if available(ttFoo) then
do:
end.`;
let expectedTokens = [
[
{ "startIndex": 0, "endIndex": 3, "scopes": ["source.abl", "keyword.other.abl"] }, // 'get'
{ "startIndex": 3, "endIndex": 4, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 4, "endIndex": 9, "scopes": ["source.abl", "keyword.other.abl"] }, // 'first'
{ "startIndex": 9, "endIndex": 10, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 10, "endIndex": 16, "scopes": ["source.abl", "variable.other.abl"] }, // 'qttFoo'
{ "startIndex": 16, "endIndex": 17, "scopes": ["source.abl", "punctuation.terminator.abl"] } // '.'
],
[
{ "startIndex": 0, "endIndex": 1, "scopes": ["source.abl"] } // ''
],
[
{ "startIndex": 0, "endIndex": 2, "scopes": ["source.abl", "keyword.other.abl"] }, // 'if'
{ "startIndex": 2, "endIndex": 3, "scopes": ["source.abl", "meta.function-call.abl"] }, // ' '
{ "startIndex": 3, "endIndex": 12, "scopes": ["source.abl", "meta.function-call.abl", "support.function.abl"] }, // 'available'
{ "startIndex": 12, "endIndex": 13, "scopes": ["source.abl", "meta.function-call.abl", "meta.function.arguments.abl", "meta.brace.round.js"] }, // '('
{ "startIndex": 13, "endIndex": 18, "scopes": ["source.abl", "meta.function-call.abl", "meta.function.arguments.abl", "variable.other.abl"] }, // 'ttFoo'
{ "startIndex": 18, "endIndex": 19, "scopes": ["source.abl", "meta.function-call.abl", "meta.brace.round.js"] }, // ')'
{ "startIndex": 19, "endIndex": 20, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 20, "endIndex": 24, "scopes": ["source.abl", "keyword.other.abl"] } // 'then'
],
[
{ "startIndex": 0, "endIndex": 2, "scopes": ["source.abl", "meta.block.abl", "keyword.other.abl"] }, // 'do'
{ "startIndex": 2, "endIndex": 3, "scopes": ["source.abl", "punctuation.terminator.abl"] } // ':'
],
[
{ "startIndex": 0, "endIndex": 3, "scopes": ["source.abl", "keyword.other.abl"] }, // 'end'
{ "startIndex": 3, "endIndex": 4, "scopes": ["source.abl", "punctuation.terminator.abl"] } // '.'
]
];
shared.itShouldMatchExpectedScopes(statement, expectedTokens);
})

describe('', () => {
let statement = `get first qttFoo /* all foos by bar squared */
no-lock.`;
let expectedTokens = [
[
{ "startIndex": 0, "endIndex": 3, "scopes": ["source.abl", "keyword.other.abl"] }, // 'get'
{ "startIndex": 3, "endIndex": 4, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 4, "endIndex": 9, "scopes": ["source.abl", "keyword.other.abl"] }, // 'first'
{ "startIndex": 9, "endIndex": 10, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 10, "endIndex": 16, "scopes": ["source.abl", "variable.other.abl"] }, // 'qttFoo'
{ "startIndex": 16, "endIndex": 17, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 17, "endIndex": 19, "scopes": ["source.abl", "comment.block.source.abl"] }, // '/*'
{ "startIndex": 19, "endIndex": 44, "scopes": ["source.abl", "comment.block.source.abl", "comment"] }, // ' all foos by bar squared '
{ "startIndex": 44, "endIndex": 46, "scopes": ["source.abl", "comment.block.source.abl"] } // '*/'
],
[
{ "startIndex": 0, "endIndex": 4, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 4, "endIndex": 11, "scopes": ["source.abl", "keyword.other.abl"] }, // 'no-lock'
{ "startIndex": 11, "endIndex": 12, "scopes": ["source.abl", "punctuation.terminator.abl"] } // '.'
]
];
shared.itShouldMatchExpectedScopes(statement, expectedTokens);
})

describe('', () => {
let statement = `get first qttFoo // excludes single bars
exclusive-lock.`;
let expectedTokens = [
[
{ "startIndex": 0, "endIndex": 3, "scopes": ["source.abl", "keyword.other.abl"] }, // 'get'
{ "startIndex": 3, "endIndex": 4, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 4, "endIndex": 9, "scopes": ["source.abl", "keyword.other.abl"] }, // 'first'
{ "startIndex": 9, "endIndex": 10, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 10, "endIndex": 16, "scopes": ["source.abl", "variable.other.abl"] }, // 'qttFoo'
{ "startIndex": 16, "endIndex": 17, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 17, "endIndex": 40, "scopes": ["source.abl", "comment.line.double-slash.abl"] } // '// excludes single bars'
],
[
{ "startIndex": 0, "endIndex": 2, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 2, "endIndex": 16, "scopes": ["source.abl", "keyword.other.abl"] }, // 'exclusive-lock'
{ "startIndex": 16, "endIndex": 17, "scopes": ["source.abl", "punctuation.terminator.abl"] } // '.'
]
];
shared.itShouldMatchExpectedScopes(statement, expectedTokens);
})

describe('', () => {
let statement = `get first {&BROWSE-NAME}.`;
let expectedTokens = [
{ "startIndex": 0, "endIndex": 3, "scopes": ["source.abl", "keyword.other.abl"] }, // 'get'
{ "startIndex": 3, "endIndex": 4, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 4, "endIndex": 9, "scopes": ["source.abl", "keyword.other.abl"] }, // 'first'
{ "startIndex": 9, "endIndex": 10, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 10, "endIndex": 11, "scopes": ["source.abl", "meta.preprocessor.abl", "punctuation.section.abl"] }, // '{'
{ "startIndex": 11, "endIndex": 12, "scopes": ["source.abl", "meta.preprocessor.abl", "punctuation.definition.preprocessor.abl"] }, // '&'
{ "startIndex": 12, "endIndex": 23, "scopes": ["source.abl", "meta.preprocessor.abl", "entity.name.function.preprocessor.abl"] }, // 'BROWSE-NAME'
{ "startIndex": 23, "endIndex": 24, "scopes": ["source.abl", "meta.preprocessor.abl", "punctuation.section.abl"] }, // '}'
{ "startIndex": 24, "endIndex": 25, "scopes": ["source.abl", "punctuation.terminator.abl"] } // '.'
];
shared.itShouldMatchExpectedScopes(statement, expectedTokens);
})

describe('', () => {
let statement = `get last qttFoo.`;
let expectedTokens = [
{ "startIndex": 0, "endIndex": 3, "scopes": ["source.abl", "keyword.other.abl"] }, // 'get'
{ "startIndex": 3, "endIndex": 4, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 4, "endIndex": 8, "scopes": ["source.abl", "keyword.other.abl"] }, // 'last'
{ "startIndex": 8, "endIndex": 9, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 9, "endIndex": 15, "scopes": ["source.abl", "variable.other.abl"] }, // 'qttFoo'
{ "startIndex": 15, "endIndex": 16, "scopes": ["source.abl", "punctuation.terminator.abl"] } // '.'
];
shared.itShouldMatchExpectedScopes(statement, expectedTokens);
})