本文整理汇总了Java中org.fife.ui.rsyntaxtextarea.parser.DefaultParserNotice类的典型用法代码示例。如果您正苦于以下问题:Java DefaultParserNotice类的具体用法?Java DefaultParserNotice怎么用?Java DefaultParserNotice使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultParserNotice类属于org.fife.ui.rsyntaxtextarea.parser包,在下文中一共展示了DefaultParserNotice类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: parse
import org.fife.ui.rsyntaxtextarea.parser.DefaultParserNotice; //导入依赖的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
示例2: addNotices
import org.fife.ui.rsyntaxtextarea.parser.DefaultParserNotice; //导入依赖的package包/类
/**
* Adds all notices from the Java parser to the results object.
*/
private void addNotices(RSyntaxDocument doc) {
result.clearNotices();
int count = cu==null ? 0 : cu.getParserNoticeCount();
if (count==0) {
return;
}
for (int i=0; i<count; i++) {
ParserNotice notice = cu.getParserNotice(i);
int offs = getOffset(doc, notice);
if (offs>-1) {
int len = notice.getLength();
result.addNotice(new DefaultParserNotice(this,
notice.getMessage(), notice.getLine(), offs, len));
}
}
}
开发者ID:pyros2097,项目名称:GdxStudio,代码行数:24,代码来源:JavaParser.java
示例3: doError
import org.fife.ui.rsyntaxtextarea.parser.DefaultParserNotice; //导入依赖的package包/类
private void doError(SAXParseException e, ParserNotice.Level level) {
if (!xls.getShowSyntaxErrors()) {
return;
}
int line = e.getLineNumber() - 1;
Element root = doc.getDefaultRootElement();
Element elem = root.getElement(line);
int offs = elem.getStartOffset();
int len = elem.getEndOffset() - offs;
if (line==root.getElementCount()-1) {
len++;
}
DefaultParserNotice pn = new DefaultParserNotice(XmlParser.this,
e.getMessage(), line, offs, len);
pn.setLevel(level);
result.addNotice(pn);
//System.err.println(">>> " + offs + "-" + len + " -> "+ pn);
}
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:19,代码来源:XmlParser.java
示例4: gatherParserErrorsRhino
import org.fife.ui.rsyntaxtextarea.parser.DefaultParserNotice; //导入依赖的package包/类
/**
* Gathers the syntax errors found by Rhino in-process when parsing the
* document.
*
* @param errorHandler The errors found by Rhino.
* @param root The root element of the document parsed.
* @see #gatherParserErrorsJsHint(RSyntaxDocument)
*/
private void gatherParserErrorsRhino(ErrorCollector errorHandler,
Element root) {
List<ParseProblem> errors = errorHandler.getErrors();
if (errors != null && errors.size() > 0) {
for (ParseProblem problem : errors) {
int offs = problem.getFileOffset();
int len = problem.getLength();
int line = root.getElementIndex(offs);
String desc = problem.getMessage();
DefaultParserNotice notice = new DefaultParserNotice(this,
desc, line, offs, len);
if (problem.getType() == ParseProblem.Type.Warning) {
notice.setLevel(ParserNotice.Level.WARNING);
}
result.addNotice(notice);
}
}
}
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:33,代码来源:JavaScriptParser.java
示例5: maybeAddNotice
import org.fife.ui.rsyntaxtextarea.parser.DefaultParserNotice; //导入依赖的package包/类
private void maybeAddNotice(DefaultParseResult result, SyntaxElement e) {
Level level;
if (e.type == SyntaxElementType.error)
level = Level.ERROR;
else if (e.hasSemanticError())
level = Level.WARNING;
else
return;
DefaultParserNotice notice = new DefaultParserNotice(this, null, -1, e.from, e.value.length());
notice.setLevel(level);
result.addNotice(notice);
}
开发者ID:curiosag,项目名称:ftc,代码行数:13,代码来源:GftParser.java
示例6: parse
import org.fife.ui.rsyntaxtextarea.parser.DefaultParserNotice; //导入依赖的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
示例7: doError
import org.fife.ui.rsyntaxtextarea.parser.DefaultParserNotice; //导入依赖的package包/类
private void doError(SAXParseException e) {
int line = e.getLineNumber() - 1;
try {
int offs = textArea.getLineStartOffset(line);
int len = textArea.getLineEndOffset(line) - offs + 1;
ParserNotice pn = new DefaultParserNotice(XMLParser.this,
e.getMessage(), line, offs, len);
result.addNotice(pn);
System.err.println(">>> " + offs + "-" + len + " -> " + pn);
} catch (BadLocationException ble) {
ble.printStackTrace();
}
}
开发者ID:intuit,项目名称:Tank,代码行数:14,代码来源:XMLParser.java
示例8: gatherParserErrorsJsHint
import org.fife.ui.rsyntaxtextarea.parser.DefaultParserNotice; //导入依赖的package包/类
/**
* Launches jshint as an external process, and gathers syntax errors from
* it.
*
* @param doc the document to parse.
* @see #gatherParserErrorsRhino(ErrorCollector, Element)
*/
private void gatherParserErrorsJsHint(RSyntaxDocument doc) {
try {
JsHinter.parse(this, textArea, result);
} catch (IOException ioe) {
// TODO: Localize me?
String msg = "Error launching jshint: " + ioe.getMessage();
result.addNotice(new DefaultParserNotice(this, msg, 0));
ioe.printStackTrace();
}
}
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:19,代码来源:JavaScriptParser.java
示例9: addNotice
import org.fife.ui.rsyntaxtextarea.parser.DefaultParserNotice; //导入依赖的package包/类
public void addNotice(String msg, int line) {
notices.add(new DefaultParserNotice(parser, msg, line));
}
开发者ID:bobbylight,项目名称:ZScriptLanguageSupport,代码行数:4,代码来源:ZScriptParseResult.java
示例10: handleLineRead
import org.fife.ui.rsyntaxtextarea.parser.DefaultParserNotice; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void handleLineRead(String line) {
Matcher m = ERROR_PATTERN.matcher(line);
if (m.find()) {
line = line.substring(0, line.length()-m.group().length());
int lineNumber = Integer.parseInt(m.group(1)) - 1;
Element elem = root.getElement(lineNumber);
int start = elem.getStartOffset();
int end = elem.getEndOffset();
DefaultParserNotice pn = new DefaultParserNotice(
parser, line, lineNumber, start, end-start);
result.addNotice(pn);
}
}
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:26,代码来源:PerlOutputCollector.java
示例11: parse
import org.fife.ui.rsyntaxtextarea.parser.DefaultParserNotice; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public ParseResult parse(RSyntaxDocument doc, String style) {
astRoot = null;
result.clearNotices();
// Always spell check all lines, for now.
Element root = doc.getDefaultRootElement();
int lineCount = root.getElementCount();
result.setParsedLines(0, lineCount - 1);
DocumentReader r = new DocumentReader(doc);
ErrorCollector errorHandler = new ErrorCollector();
CompilerEnvirons env = createCompilerEnvironment(errorHandler, langSupport);
long start = System.currentTimeMillis();
try {
Parser parser = new Parser(env);
astRoot = parser.parse(r, null, 0);
long time = System.currentTimeMillis() - start;
result.setParseTime(time);
} catch (IOException ioe) { // Never happens
result.setError(ioe);
ioe.printStackTrace();
} catch (RhinoException re) {
// Shouldn't happen since we're passing an ErrorCollector in
int line = re.lineNumber();
// if (line>0) {
Element elem = root.getElement(line);
int offs = elem.getStartOffset();
int len = elem.getEndOffset() - offs - 1;
String msg = re.details();
result.addNotice(new DefaultParserNotice(this, msg, line, offs, len));
// }
} catch (Exception e) {
result.setError(e); // catch all
}
r.close();
// Get any parser errors.
switch (langSupport.getErrorParser()) {
default:
case RHINO:
gatherParserErrorsRhino(errorHandler, root);
break;
case JSHINT:
gatherParserErrorsJsHint(doc);
break;
}
// addNotices(doc);
support.firePropertyChange(PROPERTY_AST, null, astRoot);
return result;
}
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:59,代码来源:JavaScriptParser.java
注:本文中的org.fife.ui.rsyntaxtextarea.parser.DefaultParserNotice类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论