mirror of
https://github.com/adelphes/android-dev-ext.git
synced 2025-12-23 09:59:25 +00:00
different attempt to parse using collapsable text
ranges
This commit is contained in:
29
langserver/java/validation/parse-errors.js
Normal file
29
langserver/java/validation/parse-errors.js
Normal file
@@ -0,0 +1,29 @@
|
||||
const { ModuleBlock, TypeDeclBlock, MethodBlock } = require('../parser9');
|
||||
const ParseProblem = require('../parsetypes/parse-problem');
|
||||
|
||||
/**
|
||||
* @param {TypeDeclBlock} type
|
||||
* @param {ParseProblem[]} probs
|
||||
*/
|
||||
function checkTypeParseErrors(type, probs) {
|
||||
type.parseErrors.forEach(err => probs.push(ParseProblem.Error(err, `Invalid, incomplete or unsupported declaration`)));
|
||||
type.methods.filter(m => m.parseErrors).forEach(m => checkMethodParseErrors(m, probs));
|
||||
type.types.forEach(type => checkTypeParseErrors(type, probs));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {MethodBlock} method
|
||||
* @param {ParseProblem[]} probs
|
||||
*/
|
||||
function checkMethodParseErrors(method, probs) {
|
||||
method.parseErrors.forEach(err => probs.push(ParseProblem.Error(err, `Invalid, incomplete or unsupported declaration`)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {ModuleBlock} mod
|
||||
*/
|
||||
module.exports = function(mod) {
|
||||
const probs = [];
|
||||
mod.types.forEach(type => checkTypeParseErrors(type, probs));
|
||||
return probs;
|
||||
}
|
||||
Reference in New Issue
Block a user