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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ grammar.json
node_modules
npm-debug.log
debug-*
test.txt
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ The ABL-specific scopes produced by the ABL grammar listed in the table below. T
|punctuation.definition.string.end.abl | Closing `"` or `'` of a quoted string |
|punctuation.section.abl | `{` and `}` |
|punctuation.separator.comma.abl | `,` |
|punctuation.separator.continuation | `~` at the end of a line (preprocessor) |
|punctuation.separator.continuation.abl | `~` at the end of a line (preprocessor) |
|punctuation.separator.period.abl | `.` |
|punctuation.terminator.abl | `.` and `:` |
|storage.data.database.abl | Statically-defined database names, e.g.in the `create alias` statement |
Expand Down
23 changes: 6 additions & 17 deletions abl.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -3213,35 +3213,24 @@
"match": "(~)\\s*$",
"captures": {
"1": {
"name": "punctuation.separator.continuation"
"name": "punctuation.separator.continuation.abl"
}
}
},
"branch-return-value-double": {
"comment": "RETURN \"return-value\"",
"begin": "(?i)\\s*(return)(\\s+(error))?\\s+(\")",
"beginCaptures": {
"match": "(?i)\\s*(return)(\\s+(error))?\\s+(?=\")",
"captures": {
"1": {
"name": "keyword.other.abl"
},
"2": {
"3": {
"name": "keyword.other.abl"
},
"3": {
"4": {
"name": "punctuation.definition.string.begin.abl"
}
},
"end": "(\")",
"endCaptures": {
"1": {
"name": "punctuation.definition.string.end.abl"
}
},
"patterns": [
{
"include": "#escape-char"
}
]
}
},
"branch-return-no-apply": {
"comment": "RETURN NO-APPLY",
Expand Down
8 changes: 4 additions & 4 deletions spec/global-scoped-define/global-define.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ SOMETHING value`;
[
{ "startIndex": 0, "endIndex": 1, "scopes": ["source.abl", "meta.preprocessor.abl", "punctuation.definition.preprocessor.abl"] }, // '&'
{ "startIndex": 1, "endIndex": 14, "scopes": ["source.abl", "meta.preprocessor.abl", "keyword.control.directive.define.abl"] }, // 'global-define'
{ "startIndex": 14, "endIndex": 15, "scopes": ["source.abl", "meta.preprocessor.abl", "punctuation.separator.continuation"] } // '~'
{ "startIndex": 14, "endIndex": 15, "scopes": ["source.abl", "meta.preprocessor.abl", "punctuation.separator.continuation.abl"] } // '~'
],
[
{ "startIndex": 0, "endIndex": 9, "scopes": ["source.abl", "meta.preprocessor.abl", "entity.name.function.preprocessor.abl"] }, // 'SOMETHING'
Expand All @@ -42,19 +42,19 @@ done`;
[
{ "startIndex": 0, "endIndex": 1, "scopes": ["source.abl", "meta.preprocessor.abl", "punctuation.definition.preprocessor.abl"] }, // '&'
{ "startIndex": 1, "endIndex": 14, "scopes": ["source.abl", "meta.preprocessor.abl", "keyword.control.directive.define.abl"] }, // 'global-define'
{ "startIndex": 14, "endIndex": 15, "scopes": ["source.abl", "meta.preprocessor.abl", "punctuation.separator.continuation"] } // '~'
{ "startIndex": 14, "endIndex": 15, "scopes": ["source.abl", "meta.preprocessor.abl", "punctuation.separator.continuation.abl"] } // '~'
],
[
{ "startIndex": 0, "endIndex": 9, "scopes": ["source.abl", "meta.preprocessor.abl", "entity.name.function.preprocessor.abl"] }, // 'SOMETHING'
{ "startIndex": 9, "endIndex": 10, "scopes": ["source.abl", "meta.preprocessor.abl"] }, // ' '
{ "startIndex": 10, "endIndex": 15, "scopes": ["source.abl", "keyword.other.abl"] }, // 'value'
{ "startIndex": 15, "endIndex": 16, "scopes": ["source.abl", "punctuation.separator.continuation"] } // '~'
{ "startIndex": 15, "endIndex": 16, "scopes": ["source.abl", "punctuation.separator.continuation.abl"] } // '~'
],
[
{ "startIndex": 0, "endIndex": 4, "scopes": ["source.abl", "variable.other.abl"] }, // 'more'
{ "startIndex": 4, "endIndex": 5, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 5, "endIndex": 10, "scopes": ["source.abl", "keyword.other.abl"] }, // 'value'
{ "startIndex": 10, "endIndex": 11, "scopes": ["source.abl", "punctuation.separator.continuation"] } // '~'
{ "startIndex": 10, "endIndex": 11, "scopes": ["source.abl", "punctuation.separator.continuation.abl"] } // '~'
],
[
{ "startIndex": 0, "endIndex": 4, "scopes": ["source.abl", "variable.other.abl"] } // 'done'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ Procedure`;
{ "startIndex": 0, "endIndex": 1, "scopes": ["source.abl", "meta.preprocessor.abl", "punctuation.definition.preprocessor.abl"] }, // '&'
{ "startIndex": 1, "endIndex": 14, "scopes": ["source.abl", "meta.preprocessor.abl", "keyword.control.directive.define.abl"] }, // 'Scoped-define'
{ "startIndex": 14, "endIndex": 15, "scopes": ["source.abl", "meta.preprocessor.abl"] }, // ' '
{ "startIndex": 15, "endIndex": 16, "scopes": ["source.abl", "meta.preprocessor.abl", "punctuation.separator.continuation"] } // '~'
{ "startIndex": 15, "endIndex": 16, "scopes": ["source.abl", "meta.preprocessor.abl", "punctuation.separator.continuation.abl"] } // '~'
],
[
{ "startIndex": 0, "endIndex": 14, "scopes": ["source.abl", "meta.preprocessor.abl", "entity.name.function.preprocessor.abl"] }, // 'PROCEDURE-TYPE'
{ "startIndex": 14, "endIndex": 16, "scopes": ["source.abl", "meta.preprocessor.abl"] }, // ' '
{ "startIndex": 16, "endIndex": 17, "scopes": ["source.abl", "punctuation.separator.continuation"] } // '~'
{ "startIndex": 16, "endIndex": 17, "scopes": ["source.abl", "punctuation.separator.continuation.abl"] } // '~'
],
[
{ "startIndex": 0, "endIndex": 9, "scopes": ["source.abl", "keyword.other.abl"] } // 'Procedure'
Expand Down
74 changes: 74 additions & 0 deletions spec/misc-statements/return-statement.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,78 @@ describe('', () => {
{ "startIndex": 19, "endIndex": 20, "scopes": ["source.abl", "punctuation.terminator.abl"] } // '.'
];
shared.itShouldMatchExpectedScopes(statement, expectedTokens);
})

describe('', () => {
let statement = `PROCEDURE xyz:
RETURN ERROR "ok".
RETURN "ok".
END.`;
let expectedTokens = [
[
{ "startIndex": 0, "endIndex": 9, "scopes": ["source.abl", "meta.procedure.abl", "keyword.other.abl"] }, // 'PROCEDURE'
{ "startIndex": 9, "endIndex": 10, "scopes": ["source.abl", "meta.procedure.abl"] }, // ' '
{ "startIndex": 10, "endIndex": 13, "scopes": ["source.abl", "meta.procedure.abl", "entity.name.procedure.abl"] }, // 'xyz'
{ "startIndex": 13, "endIndex": 14, "scopes": ["source.abl", "punctuation.terminator.abl"] } // ':'
],
[
{ "startIndex": 0, "endIndex": 3, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 3, "endIndex": 9, "scopes": ["source.abl", "keyword.other.abl"] }, // 'RETURN'
{ "startIndex": 9, "endIndex": 10, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 10, "endIndex": 15, "scopes": ["source.abl", "keyword.other.abl"] }, // 'ERROR'
{ "startIndex": 15, "endIndex": 16, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 16, "endIndex": 17, "scopes": ["source.abl", "string.quoted.double.abl", "punctuation.definition.string.begin.abl"] }, // '"'
{ "startIndex": 17, "endIndex": 19, "scopes": ["source.abl", "string.quoted.double.abl"] }, // 'ok'
{ "startIndex": 19, "endIndex": 20, "scopes": ["source.abl", "string.quoted.double.abl", "punctuation.definition.string.end.abl"] }, // '"'
{ "startIndex": 20, "endIndex": 21, "scopes": ["source.abl", "punctuation.terminator.abl"] } // '.'
],
[
{ "startIndex": 0, "endIndex": 3, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 3, "endIndex": 9, "scopes": ["source.abl", "keyword.other.abl"] }, // 'RETURN'
{ "startIndex": 9, "endIndex": 10, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 10, "endIndex": 11, "scopes": ["source.abl", "string.quoted.double.abl", "punctuation.definition.string.begin.abl"] }, // '"'
{ "startIndex": 11, "endIndex": 13, "scopes": ["source.abl", "string.quoted.double.abl"] }, // 'ok'
{ "startIndex": 13, "endIndex": 14, "scopes": ["source.abl", "string.quoted.double.abl", "punctuation.definition.string.end.abl"] }, // '"'
{ "startIndex": 14, "endIndex": 15, "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 = `FUNCTION X RETURNS CHARACTER():
RETURN "asdfasdf".
END.`;
let expectedTokens = [
[
{ "startIndex": 0, "endIndex": 8, "scopes": ["source.abl", "keyword.other.abl"] }, // 'FUNCTION'
{ "startIndex": 8, "endIndex": 9, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 9, "endIndex": 10, "scopes": ["source.abl", "variable.other.abl"] }, // 'X'
{ "startIndex": 10, "endIndex": 11, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 11, "endIndex": 18, "scopes": ["source.abl", "keyword.other.abl"] }, // 'RETURNS'
{ "startIndex": 18, "endIndex": 19, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 19, "endIndex": 28, "scopes": ["source.abl", "entity.name.function.abl"] }, // 'CHARACTER'
{ "startIndex": 28, "endIndex": 29, "scopes": ["source.abl", "meta.function.arguments.abl", "meta.brace.round.js"] }, // '('
{ "startIndex": 29, "endIndex": 30, "scopes": ["source.abl", "meta.brace.round.js"] }, // ')'
{ "startIndex": 30, "endIndex": 31, "scopes": ["source.abl", "punctuation.terminator.abl"] } // ':'
],
[
{ "startIndex": 0, "endIndex": 3, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 3, "endIndex": 9, "scopes": ["source.abl", "keyword.other.abl"] }, // 'RETURN'
{ "startIndex": 9, "endIndex": 10, "scopes": ["source.abl"] }, // ' '
{ "startIndex": 10, "endIndex": 11, "scopes": ["source.abl", "string.quoted.double.abl", "punctuation.definition.string.begin.abl"] }, // '"'
{ "startIndex": 11, "endIndex": 19, "scopes": ["source.abl", "string.quoted.double.abl"] }, // 'asdfasdf'
{ "startIndex": 19, "endIndex": 20, "scopes": ["source.abl", "string.quoted.double.abl", "punctuation.definition.string.end.abl"] }, // '"'
{ "startIndex": 20, "endIndex": 21, "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);
})