• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ParseResult类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.fife.ui.rsyntaxtextarea.parser.ParseResult的典型用法代码示例。如果您正苦于以下问题:Java ParseResult类的具体用法?Java ParseResult怎么用?Java ParseResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ParseResult类属于org.fife.ui.rsyntaxtextarea.parser包,在下文中一共展示了ParseResult类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: forceReparsing

import org.fife.ui.rsyntaxtextarea.parser.ParseResult; //导入依赖的package包/类
/**
 * Forces the given {@link Parser} to re-parse the content of this text
 * area.<p>
 * 
 * This method can be useful when a <code>Parser</code> can be configured
 * as to what notices it returns.  For example, if a Java language parser
 * can be configured to set whether no serialVersionUID is a warning,
 * error, or ignored, this method can be called after changing the expected
 * notice type to have the document re-parsed.
 *
 * @param parser The index of the <code>Parser</code> to re-run.
 * @see #getParser(int)
 */
public void forceReparsing(int parser) {
	Parser p = getParser(parser);
	RSyntaxDocument doc = (RSyntaxDocument)textArea.getDocument();
	String style = textArea.getSyntaxEditingStyle();
	doc.readLock();
	try {
		if (p.isEnabled()) {
			ParseResult res = p.parse(doc, style);
			addParserNoticeHighlights(res);
		}
		else {
			clearParserNoticeHighlights(p);
		}
		textArea.fireParserNoticesChange();
	} finally {
		doc.readUnlock();
	}
}
 
开发者ID:curiosag,项目名称:ftc,代码行数:32,代码来源:ParserManager.java


示例2: removeParserNotices

import org.fife.ui.rsyntaxtextarea.parser.ParseResult; //导入依赖的package包/类
/**
 * Removes any currently stored notices (and the corresponding highlights
 * from the editor) from the same Parser, and in the given line range,
 * as in the results.
 *
 * @param res The results.
 */
private void removeParserNotices(ParseResult res) {
	if (noticeHighlightPairs!=null) {
		RSyntaxTextAreaHighlighter h = (RSyntaxTextAreaHighlighter)
											textArea.getHighlighter();
		for (Iterator<NoticeHighlightPair> i=noticeHighlightPairs.iterator(); i.hasNext(); ) {
			NoticeHighlightPair pair = i.next();
			boolean removed = false;
			if (shouldRemoveNotice(pair.notice, res)) {
				if (pair.highlight!=null) {
					h.removeParserHighlight(pair.highlight);
				}
				i.remove();
				removed = true;
			}
			if (DEBUG_PARSING) {
				String text = removed ? "[DEBUG]: ... notice removed: " :
										"[DEBUG]: ... notice not removed: ";
				System.out.println(text + pair.notice);
			}
		}

	}

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:32,代码来源:ParserManager.java


示例3: shouldRemoveNotice

import org.fife.ui.rsyntaxtextarea.parser.ParseResult; //导入依赖的package包/类
/**
 * Returns whether a parser notice should be removed, based on a parse
 * result.
 *
 * @param notice The notice in question.
 * @param res The result.
 * @return Whether the notice should be removed.
 */
private final boolean shouldRemoveNotice(ParserNotice notice,
										ParseResult res) {

	if (DEBUG_PARSING) {
		System.out.println("[DEBUG]: ... ... shouldRemoveNotice " +
				notice + ": " + (notice.getParser()==res.getParser()));
	}

	// NOTE: We must currently remove all notices for the parser.  Parser
	// implementors are required to parse the entire document each parsing
	// request, as RSTA is not yet sophisticated enough to determine the
	// minimum range of text to parse (and ParserNotices' locations aren't
	// updated when the Document is mutated, which would be a requirement
	// for this as well).
	// return same_parser && (in_reparsed_range || in_deleted_end_of_doc)
	return notice.getParser()==res.getParser();

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:27,代码来源:ParserManager.java


示例4: parse

import org.fife.ui.rsyntaxtextarea.parser.ParseResult; //导入依赖的package包/类
@Override
public ParseResult parse(RSyntaxDocument doc, String style) {
    DefaultParseResult result = new DefaultParseResult(this);
    CodeModel.ErrorMessage errorMessage = codeModel.compileScript(sourceFile);
    if (errorMessage != null) {
        int line = errorMessage.line - 1;
        try {
            DefaultParserNotice notice = new DefaultParserNotice(this,
                    errorMessage.message,
                    line,
                    textArea.getLineStartOffset(line),
                    textArea.getLineEndOffset(line));
            result.addNotice(notice);
        } catch (BadLocationException e) {
            // Do nothing
        }
    }
    return result;
}
 
开发者ID:loadtestgo,项目名称:pizzascript,代码行数:20,代码来源:FilePanel.java


示例5: forceReparsing

import org.fife.ui.rsyntaxtextarea.parser.ParseResult; //导入依赖的package包/类
/**
 * Forces the given {@link Parser} to re-parse the content of this text area.
 * <p>
 * 
 * This method can be useful when a <code>Parser</code> can be configured as to what notices it returns. For
 * example, if a Java language parser can be configured to set whether no serialVersionUID is a warning, error, or
 * ignored, this method can be called after changing the expected notice type to have the document re-parsed.
 * 
 * @param parser
 *            The index of the <code>Parser</code> to re-run.
 * @see #getParser(int)
 */
public void forceReparsing(int parser) {
    Parser p = getParser(parser);
    RSyntaxDocument doc = (RSyntaxDocument) textArea.getDocument();
    String style = textArea.getSyntaxEditingStyle();
    doc.readLock();
    try {
        if (p.isEnabled()) {
            ParseResult res = p.parse(doc, style);
            addParserNoticeHighlights(res);
        }
        else {
            clearParserNoticeHighlights(p);
        }
        textArea.fireParserNoticesChange();
    } finally {
        doc.readUnlock();
    }
}
 
开发者ID:intuit,项目名称:Tank,代码行数:31,代码来源:ParserManager.java


示例6: shouldRemoveNotice

import org.fife.ui.rsyntaxtextarea.parser.ParseResult; //导入依赖的package包/类
/**
 * Returns whether a parser notice should be removed, based on a parse result.
 * 
 * @param notice
 *            The notice in question.
 * @param res
 *            The result.
 * @return Whether the notice should be removed.
 */
private final boolean shouldRemoveNotice(ParserNotice notice,
        ParseResult res) {

    if (DEBUG_PARSING) {
        System.out.println("[DEBUG]: ... ... shouldRemoveNotice " +
                notice + ": " + (notice.getParser() == res.getParser()));
    }

    // NOTE: We must currently remove all notices for the parser. Parser
    // implementors are required to parse the entire document each parsing
    // request, as RSTA is not yet sophisticated enough to determine the
    // minimum range of text to parse (and ParserNotices' locations aren't
    // updated when the Document is mutated, which would be a requirement
    // for this as well).
    // return same_parser && (in_reparsed_range || in_deleted_end_of_doc)
    return notice.getParser() == res.getParser();

}
 
开发者ID:intuit,项目名称:Tank,代码行数:28,代码来源:ParserManager.java


示例7: parse

import org.fife.ui.rsyntaxtextarea.parser.ParseResult; //导入依赖的package包/类
@Override // lang can be set using editor.setSyntaxEditingStyle
public ParseResult parse(RSyntaxDocument code, String lang) {
	DefaultParseResult result = new DefaultParseResult(this);
	if((lang != "sat" && lang != "smt" && lang != "qbf") || code.getLength()==0)
		return result;
	if(bufferErrors == null) {
		try {
			TranslationLatex tr = new TranslationLatex(code.getText(0, code.getLength()), lang, true);
			bufferErrors = tr.getErrors();
			if (tr.getFormula().length() != 0 && edition != null) {
				edition.setLatex(tr.getFormula());
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	for (TranslationError error : bufferErrors) {
		result.addNotice(new ErrorParserNotice(this, error));
	}
	bufferErrors = null;
	return result;
}
 
开发者ID:touist,项目名称:touist,代码行数:25,代码来源:ErrorParser.java


示例8: parse

import org.fife.ui.rsyntaxtextarea.parser.ParseResult; //导入依赖的package包/类
@Override
	public ParseResult parse(RSyntaxDocument doc, String style) {
		ZScriptAst old = ast;
		AstFactory parser2 = new AstFactory(doc, this, null);
		ZScriptParseResult zspr = parser2.parse();
		DefaultParseResult result = new DefaultParseResult(this);
		ast = zspr.getAst();
		List<ParserNotice> notices = zspr.getNotices();
		for (ParserNotice notice : notices) {
			//System.out.println(">>> " + notice);
			result.addNotice(notice);
		}
		support.firePropertyChange(PROPERTY_AST, old, ast);
//System.out.println("----------");
//ast.getRootNode().accept(new org.fife.rsta.zscript.ast.AstPrinter());
//System.out.println("----------");
		return result;
	}
 
开发者ID:bobbylight,项目名称:ZScriptLanguageSupport,代码行数:19,代码来源:ZScriptParser.java


示例9: removeParserNotices

import org.fife.ui.rsyntaxtextarea.parser.ParseResult; //导入依赖的package包/类
/**
 * Removes any currently stored notices (and the corresponding highlights
 * from the editor) from the same Parser, and in the given line range,
 * as in the results.
 *
 * @param res The results.
 */
private void removeParserNotices(ParseResult res) {
	if (noticeHighlightPairs!=null) {
		RSyntaxTextAreaHighlighter h = (RSyntaxTextAreaHighlighter)
											textArea.getHighlighter();
		for (Iterator i=noticeHighlightPairs.iterator(); i.hasNext(); ) {
			NoticeHighlightPair pair = (NoticeHighlightPair)i.next();
			boolean removed = false;
			if (shouldRemoveNotice(pair.notice, res)) {
				if (pair.highlight!=null) {
					h.removeParserHighlight(pair.highlight);
				}
				i.remove();
				removed = true;
			}
			if (DEBUG_PARSING) {
				String text = removed ? "[DEBUG]: ... notice removed: " :
										"[DEBUG]: ... notice not removed: ";
				System.out.println(text + pair.notice);
			}
		}

	}

}
 
开发者ID:Nanonid,项目名称:RSyntaxTextArea,代码行数:32,代码来源:ParserManager.java


示例10: parse

import org.fife.ui.rsyntaxtextarea.parser.ParseResult; //导入依赖的package包/类
@Override
public ParseResult parse(RSyntaxDocument doc, String style) {
	DefaultParseResult result = new DefaultParseResult(this);
	onStartParsing();
	List<SyntaxElement> elements = syntaxElementSource.get(DocumentUtil.getText(doc));
	
	for (SyntaxElement e : elements)
		maybeAddNotice(result, e);
	
	onFinishParsing();
	
	return result;
}
 
开发者ID:curiosag,项目名称:ftc,代码行数:14,代码来源:GftParser.java


示例11: removeParserNotices

import org.fife.ui.rsyntaxtextarea.parser.ParseResult; //导入依赖的package包/类
/**
 * Removes any currently stored notices (and the corresponding highlights from the editor) from the same Parser, and
 * in the given line range, as in the results.
 * 
 * @param res
 *            The results.
 */
private void removeParserNotices(ParseResult res) {

    if (noticesToHighlights != null) {

        RSyntaxTextAreaHighlighter h = (RSyntaxTextAreaHighlighter)
                textArea.getHighlighter();

        for (Iterator i = noticesToHighlights.entrySet().iterator(); i.hasNext();) {
            Map.Entry entry = (Map.Entry) i.next();
            ParserNotice notice = (ParserNotice) entry.getKey();
            if (shouldRemoveNotice(notice, res)) {
                if (entry.getValue() != null) {
                    h.removeParserHighlight(entry.getValue());
                }
                i.remove();
                if (DEBUG_PARSING) {
                    System.out.println("[DEBUG]: ... notice removed: " +
                            notice);
                }
            }
            else {
                if (DEBUG_PARSING) {
                    System.out.println("[DEBUG]: ... notice not removed: " +
                            notice);
                }
            }
        }

    }

}
 
开发者ID:intuit,项目名称:Tank,代码行数:39,代码来源:ParserManager.java


示例12: parse

import org.fife.ui.rsyntaxtextarea.parser.ParseResult; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public ParseResult parse(RSyntaxDocument doc, String style) {

    result.clearNotices();
    Element root = doc.getDefaultRootElement();
    result.setParsedLines(0, root.getElementCount() - 1);

    if (spf == null) {
        return result;
    }

    try {
        SAXParser sp = spf.newSAXParser();
        Handler handler = new Handler();
        DocumentReader r = new DocumentReader(doc);
        InputSource input = new InputSource(r);
        sp.parse(input, handler);
        r.close();
    } catch (SAXParseException spe) {
        // A fatal parse error - ignore; a ParserNotice was already created.
    } catch (Exception e) {
        e.printStackTrace();
        result.addNotice(new DefaultParserNotice(this,
                "Error parsing XML: " + e.getMessage(), 0, -1, -1));
    }

    return result;

}
 
开发者ID:intuit,项目名称:Tank,代码行数:32,代码来源:XMLParser.java


示例13: parse

import org.fife.ui.rsyntaxtextarea.parser.ParseResult; //导入依赖的package包/类
/**
	 * {@inheritDoc}
	 */
	public ParseResult parse(RSyntaxDocument doc, String style) {

		cu = null;
		result.clearNotices();
		// Always spell check all lines, for now.
		int lineCount = doc.getDefaultRootElement().getElementCount();
		result.setParsedLines(0, lineCount-1);

		DocumentReader r = new DocumentReader(doc);
		Scanner scanner = new Scanner(r);
		scanner.setDocument(doc);
		ASTFactory fact = new ASTFactory();
		long start = System.currentTimeMillis();
		try {
			cu = fact.getCompilationUnit("SomeFile.java", scanner); // TODO: Real name?
			long time = System.currentTimeMillis() - start;
			result.setParseTime(time);
		} catch (IOException ioe) {
			result.setError(ioe);
//			ioe.printStackTrace();
		}

		r.close();

		addNotices(doc);
		support.firePropertyChange(PROPERTY_COMPILATION_UNIT, null, cu);
		return result;

	}
 
开发者ID:pyros2097,项目名称:GdxStudio,代码行数:33,代码来源:JavaParser.java


示例14: parse

import org.fife.ui.rsyntaxtextarea.parser.ParseResult; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public ParseResult parse(RSyntaxDocument doc, String style) {

	cu = null;
	result.clearNotices();
	// Always spell check all lines, for now.
	int lineCount = doc.getDefaultRootElement().getElementCount();
	result.setParsedLines(0, lineCount-1);

	DocumentReader r = new DocumentReader(doc);
	Scanner scanner = new Scanner(r);
	scanner.setDocument(doc);
	ASTFactory fact = new ASTFactory();
	long start = System.currentTimeMillis();
	try {
		cu = fact.getCompilationUnit("SomeFile.java", scanner); // TODO: Real name?
		long time = System.currentTimeMillis() - start;
		result.setParseTime(time);
	} finally {
		r.close();
	}

	addNotices(doc);
	support.firePropertyChange(PROPERTY_COMPILATION_UNIT, null, cu);
	return result;

}
 
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:31,代码来源:JavaParser.java


示例15: actionPerformed

import org.fife.ui.rsyntaxtextarea.parser.ParseResult; //导入依赖的package包/类
/**
 * Called when the timer fires (e.g. it's time to parse the document).
 * 
 * @param e The event.
 */
public void actionPerformed(ActionEvent e) {

	// Sanity check - should have >1 parser if event is fired.
	int parserCount = getParserCount();
	if (parserCount==0) {
		return;
	}

	long begin = 0;
	if (DEBUG_PARSING) {
		begin = System.currentTimeMillis();
	}

	RSyntaxDocument doc = (RSyntaxDocument)textArea.getDocument();
	
	Element root = doc.getDefaultRootElement();
	int firstLine = firstOffsetModded==null ? 0 : root.getElementIndex(firstOffsetModded.getOffset());
	int lastLine = lastOffsetModded==null ? root.getElementCount()-1 : root.getElementIndex(lastOffsetModded.getOffset());
	firstOffsetModded = lastOffsetModded = null;
	if (DEBUG_PARSING) {
		System.out.println("[DEBUG]: Minimum lines to parse: " + firstLine + "-" + lastLine);
	}

	String style = textArea.getSyntaxEditingStyle();
	doc.readLock();
	try {
		for (int i=0; i<parserCount; i++) {
			Parser parser = getParser(i);
			if (parser.isEnabled()) {
				ParseResult res = parser.parse(doc, style);
				addParserNoticeHighlights(res);
			}
			else {
				clearParserNoticeHighlights(parser);
			}
		}
		textArea.fireParserNoticesChange();
	} finally {
		doc.readUnlock();
	}

	if (DEBUG_PARSING) {
		float time = (System.currentTimeMillis()-begin)/1000f;
		System.out.println("Total parsing time: " + time + " seconds");
	}

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:53,代码来源:ParserManager.java


示例16: addParserNoticeHighlights

import org.fife.ui.rsyntaxtextarea.parser.ParseResult; //导入依赖的package包/类
/**
 * Adds highlights for a list of parser notices.  Any current notices
 * from the same Parser, in the same parsed range, are removed.
 *
 * @param res The result of a parsing.
 * @see #clearParserNoticeHighlights()
 */
private void addParserNoticeHighlights(ParseResult res) {

	// Parsers are supposed to return at least empty ParseResults, but
	// we'll be defensive here.
	if (res==null) {
		return;
	}

	if (DEBUG_PARSING) {
		System.out.println("[DEBUG]: Adding parser notices from " +
							res.getParser());
	}

	if (noticeHighlightPairs==null) {
		noticeHighlightPairs = new ArrayList<NoticeHighlightPair>();
	}

	removeParserNotices(res);

	List<ParserNotice> notices = res.getNotices();
	if (notices.size()>0) { // Guaranteed non-null

		RSyntaxTextAreaHighlighter h = (RSyntaxTextAreaHighlighter)
												textArea.getHighlighter();

		for (ParserNotice notice : notices) {
			if (DEBUG_PARSING) {
				System.out.println("[DEBUG]: ... adding: " + notice);
			}
			try {
				HighlightInfo highlight = null;
				if (notice.getShowInEditor()) {
					highlight = h.addParserHighlight(notice,
										parserErrorHighlightPainter);
				}
				noticeHighlightPairs.add(new NoticeHighlightPair(notice, highlight));
			} catch (BadLocationException ble) { // Never happens
				ble.printStackTrace();
			}
		}

	}

	if (DEBUG_PARSING) {
		System.out.println("[DEBUG]: Done adding parser notices from " +
							res.getParser());
	}

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:57,代码来源:ParserManager.java


示例17: actionPerformed

import org.fife.ui.rsyntaxtextarea.parser.ParseResult; //导入依赖的package包/类
/**
 * Called when the timer fires (e.g. it's time to parse the document).
 * 
 * @param e
 *            The event.
 */
public void actionPerformed(ActionEvent e) {

    // Sanity check - should have >1 parser if event is fired.
    int parserCount = getParserCount();
    if (parserCount == 0) {
        return;
    }

    long begin = 0;
    if (DEBUG_PARSING) {
        begin = System.currentTimeMillis();
    }

    RSyntaxDocument doc = (RSyntaxDocument) textArea.getDocument();

    Element root = doc.getDefaultRootElement();
    int firstLine = firstOffsetModded == null ? 0 : root.getElementIndex(firstOffsetModded.getOffset());
    int lastLine = lastOffsetModded == null ? root.getElementCount() - 1 : root.getElementIndex(lastOffsetModded
            .getOffset());
    firstOffsetModded = lastOffsetModded = null;
    if (DEBUG_PARSING) {
        System.out.println("[DEBUG]: Minimum lines to parse: " + firstLine + "-" + lastLine);
    }

    String style = textArea.getSyntaxEditingStyle();
    doc.readLock();
    try {
        for (int i = 0; i < parserCount; i++) {
            Parser parser = getParser(i);
            if (parser.isEnabled()) {
                ParseResult res = parser.parse(doc, style);
                addParserNoticeHighlights(res);
            }
            else {
                clearParserNoticeHighlights(parser);
            }
        }
        textArea.fireParserNoticesChange();
    } finally {
        doc.readUnlock();
    }

    if (DEBUG_PARSING) {
        float time = (System.currentTimeMillis() - begin) / 1000f;
        System.err.println("Total parsing time: " + time + " seconds");
    }

}
 
开发者ID:intuit,项目名称:Tank,代码行数:55,代码来源:ParserManager.java


示例18: addParserNoticeHighlights

import org.fife.ui.rsyntaxtextarea.parser.ParseResult; //导入依赖的package包/类
/**
 * Adds highlights for a list of parser notices. Any current notices from the same Parser, in the same parsed range,
 * are removed.
 * 
 * @param res
 *            The result of a parsing.
 * @see #clearParserNoticeHighlights()
 */
private void addParserNoticeHighlights(ParseResult res) {

    if (DEBUG_PARSING) {
        System.out.println("[DEBUG]: Adding parser notices from " +
                res.getParser());
    }

    if (noticesToHighlights == null) {
        noticesToHighlights = new HashMap();
    }

    removeParserNotices(res);

    List notices = res.getNotices();
    if (notices.size() > 0) { // Guaranteed non-null

        RSyntaxTextAreaHighlighter h = (RSyntaxTextAreaHighlighter)
                textArea.getHighlighter();

        for (Iterator i = notices.iterator(); i.hasNext();) {
            ParserNotice notice = (ParserNotice) i.next();
            if (DEBUG_PARSING) {
                System.out.println("[DEBUG]: ... adding: " + res);
            }
            try {
                Object highlight = null;
                if (notice.getShowInEditor()) {
                    highlight = h.addParserHighlight(notice,
                            parserErrorHighlightPainter);
                }
                noticesToHighlights.put(notice, highlight);
            } catch (BadLocationException ble) { // Never happens
                ble.printStackTrace();
            }
        }

    }

    if (DEBUG_PARSING) {
        System.out.println("[DEBUG]: Done adding parser notices from " +
                res.getParser());
    }

}
 
开发者ID:intuit,项目名称:Tank,代码行数:53,代码来源:ParserManager.java


示例19: parse

import org.fife.ui.rsyntaxtextarea.parser.ParseResult; //导入依赖的package包/类
/**
     * {@inheritDoc}
     */
    @Override
    public ParseResult parse(final RSyntaxDocument doc, final String style) {
        assert m_snippet.getDocument() == doc;

        JavaSnippetCompiler compiler = new JavaSnippetCompiler(m_snippet);
        StringWriter log = new StringWriter();
        DiagnosticCollector<JavaFileObject> digsCollector =
            new DiagnosticCollector<JavaFileObject>();
        CompilationTask compileTask = null;
        try {
            compileTask = compiler.getTask(log, digsCollector);
        } catch (IOException e) {
            LOGGER.error("Cannot create an compile task.", e);
            return new DefaultParseResult(this);
        }
        compileTask.call();
        DefaultParseResult parseResult = new DefaultParseResult(this);
        parseResult.setError(null);
        for (Diagnostic<? extends JavaFileObject> d
                : digsCollector.getDiagnostics()) {
            boolean isSnippet = m_snippet.isSnippetSource(d.getSource());
            if (isSnippet) {
                DefaultParserNotice notice = new DefaultParserNotice(this,
                        d.getMessage(Locale.US),
                        (int)d.getLineNumber(),
                        (int)d.getStartPosition(),
                        (int)(d.getEndPosition()
                                - d.getStartPosition() + 1));
                if (d.getKind().equals(Kind.ERROR)) {
                    notice.setLevel(ParserNotice.Level.ERROR);
//                    LOGGER.error(d.getMessage(Locale.US));
                } else if (d.getKind().equals(Kind.WARNING)) {
                    notice.setLevel(ParserNotice.Level.WARNING);
//                    LOGGER.warn(d.getMessage(Locale.US));
                } else {
                    notice.setLevel(ParserNotice.Level.INFO);
//                    LOGGER.debug(d.getMessage(Locale.US));
                }
                parseResult.addNotice(notice);
            }
        }
        return parseResult;
    }
 
开发者ID:pavloff-de,项目名称:spark4knime,代码行数:47,代码来源:JSnippetParser.java


示例20: actionPerformed

import org.fife.ui.rsyntaxtextarea.parser.ParseResult; //导入依赖的package包/类
/**
 * Called when the timer fires (e.g. it's time to parse the document).
 * 
 * @param e The event.
 */
public void actionPerformed(ActionEvent e) {

	// Sanity check - should have >1 parser if event is fired.
	int parserCount = getParserCount();
	if (parserCount==0) {
		return;
	}

	long begin = 0;
	if (DEBUG_PARSING) {
		begin = System.currentTimeMillis();
	}

	RSyntaxDocument doc = (RSyntaxDocument)textArea.getDocument();

	Element root = doc.getDefaultRootElement();
	int firstLine = firstOffsetModded==null ? 0 : root.getElementIndex(firstOffsetModded.getOffset());
	int lastLine = lastOffsetModded==null ? root.getElementCount()-1 : root.getElementIndex(lastOffsetModded.getOffset());
	firstOffsetModded = lastOffsetModded = null;
	if (DEBUG_PARSING) {
		System.out.println("[DEBUG]: Minimum lines to parse: " + firstLine + "-" + lastLine);
	}

	String style = textArea.getSyntaxEditingStyle();
	doc.readLock();
	try {
		for (int i=0; i<parserCount; i++) {
			Parser parser = getParser(i);
			if (parser.isEnabled()) {
				ParseResult res = parser.parse(doc, style);
				addParserNoticeHighlights(res);
			}
			else {
				clearParserNoticeHighlights(parser);
			}
		}
		textArea.fireParserNoticesChange();
	} finally {
		doc.readUnlock();
	}

	if (DEBUG_PARSING) {
		float time = (System.currentTimeMillis()-begin)/1000f;
		System.out.println("Total parsing time: " + time + " seconds");
	}

}
 
开发者ID:4refr0nt,项目名称:ESPlorer,代码行数:53,代码来源:ParserManager.java



注:本文中的org.fife.ui.rsyntaxtextarea.parser.ParseResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LuaInteger类代码示例发布时间:2022-05-22
下一篇:
Java EchoResponseProto类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap