Skip to content

Commit dcbcad2

Browse files
committed
fix(sdk): update parser from codingame
1 parent 5197f43 commit dcbcad2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

runner/src/main/resources/view/lib/Parser.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const OCCURENCE_TOKEN = '@>'
22

33
function ParseError (name, params) {
4+
this.message = name + ': ' + JSON.stringify(params)
45
this.name = name
56
this.params = params
67
}
@@ -219,10 +220,10 @@ Parser.prototype.parseTree = function (node, input, loopCnt) {
219220
const name = vari.trim()
220221
match = name.match(/"(.*)"/)
221222
if (match) {
222-
return {type: 'CONST', value: match[1]}
223+
return { type: 'CONST', value: match[1] }
223224
} else {
224225
const codeName = parser.getFirstCodeName(input.vars, name)
225-
return {type: 'VAR', node: input.getVar(codeName)}
226+
return { type: 'VAR', node: input.getVar(codeName) }
226227
}
227228
})
228229
write.param.separator = separator
@@ -343,7 +344,7 @@ Parser.prototype.extractParam = function (type) {
343344
return type.substring(iopen + 1, iclose)
344345
}
345346
Parser.prototype.getLineNumber = function () {
346-
return this.code.substring(0, this.cursor - 1).split('').filter(r => r === '\n').length + 1
347+
return this.code.substring(0, this.cursor - 1).split('\n').length
347348
}
348349

349350
export default Parser

0 commit comments

Comments
 (0)