Package org.lilypondbeans.parser.LyParser

Examples of org.lilypondbeans.parser.LyParser.LyParserResult


    }

    @Override
    public void run(Result result, SchedulerEvent event) {
        try {
            LyParserResult sjResult = (LyParserResult) result;


            List<ParseException> syntaxErrors = sjResult.getJavaParser().syntaxErrors;
            Document document = result.getSnapshot().getSource().getDocument(false);
            List<ErrorDescription> errors = new ArrayList<ErrorDescription>();
            for (int px = 0; px < syntaxErrors.size(); px++) {
                ParseException syntaxError = syntaxErrors.get(px);
                Logger logger = Logger.getLogger(SyntaxErrorsHighlightingTask.class.getName());

              //  Exceptions.printStackTrace(syntaxError);

                Token token = syntaxError.currentToken;
                String msg = syntaxError.getMessage();
                boolean isHint = false;
                if (syntaxError instanceof ReparseException) {
                    ReparseException pex = (ReparseException) syntaxError;
                    pex = pex.expandIncludedFile();
                    isHint = pex.isHint;
                    msg = pex.getMessage();
                    if (pex.syntaxErrors != null && pex.syntaxErrors.size() > 0) {
                        msg = msg + "\n\t" + pex.syntaxErrors.get(0).getMessage();
                    }
                    token = pex.currentToken;
                    syntaxError = pex;
                }
                int start = token == null ? 0 : NbDocument.findLineOffset((StyledDocument) document, token.beginLine - 1) + token.beginColumn - 1;
                int end = token == null ? 0 : NbDocument.findLineOffset((StyledDocument) document, token.endLine - 1) + token.endColumn;
                ErrorDescription errorDescription = ErrorDescriptionFactory.createErrorDescription(
                        isHint ? Severity.HINT : Severity.ERROR,
                        msg == null ? "" : msg,
                        document,
                        document.createPosition(start),
                        document.createPosition(end));
                errors.add(errorDescription);
            }
            checkVersion(errors, document, sjResult.getRoot());
            HintsController.setErrors(document, "ly", errors);


            UpdateNodeTask.getInstance().fireRootChanged(sjResult.getRoot(), 1);

        } catch (BadLocationException ex1) {
            Exceptions.printStackTrace(ex1);
        } catch (org.netbeans.modules.parsing.spi.ParseException ex1) {
            Exceptions.printStackTrace(ex1);
View Full Code Here

TOP

Related Classes of org.lilypondbeans.parser.LyParser.LyParserResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.