Skip to content

Commit 69bafa7

Browse files
committed
keep '()' token as an operator if it follows a function type (e.g. not 'element')
1 parent 0d30c78 commit 69bafa7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/xpLexer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ export class Data {
108108
public static separators = ['!', '*', '+', ',', '-', '.', '/', ':', '<', '=', '>', '?', '|', '%'];
109109
public static completionTriggers = ['"', '!', '*', '+', ',', '/', '=', '|', '(', '[', '{'];
110110
public static estimatorSeparators = Data.separators.concat(['(',')','[',']','{', '}','\'', '"']);
111+
public static readonly fnTypes = ['map', 'array', 'function', 'record'];
111112

112113
public static doubleSeps = ['!=', '*:', '..', '//', '::', ':=', '->', '<<', '<=', '=>', '>=', '>>', '||', '!!', '??'];
113114
public static anySeps = ['=', ':', '.', '/', '=', '<', '>', '|', '!', '*', '+', ',', '-', '.', '?', '['];
@@ -1095,7 +1096,7 @@ export class XPathLexer {
10951096
if (currentToken.value === ':*' || currentToken.value === '..') {
10961097
currentToken.charType = CharLevelState.lName;
10971098
currentToken.tokenType = TokenLevelState.nodeType;
1098-
} else if (currentToken.value === '()' && prevToken.tokenType === TokenLevelState.nodeType) {
1099+
} else if (currentToken.value === '()' && prevToken.tokenType === TokenLevelState.nodeType && !Data.fnTypes.includes(prevToken.value)) {
10991100
currentToken.charType = CharLevelState.lName;
11001101
currentToken.tokenType = TokenLevelState.nodeType;
11011102
}

0 commit comments

Comments
 (0)