本文整理汇总了Java中org.fife.ui.rsyntaxtextarea.parser.DefaultParseResult类的典型用法代码示例。如果您正苦于以下问题:Java DefaultParseResult类的具体用法?Java DefaultParseResult怎么用?Java DefaultParseResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultParseResult类属于org.fife.ui.rsyntaxtextarea.parser包,在下文中一共展示了DefaultParseResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import org.fife.ui.rsyntaxtextarea.parser.DefaultParseResult; //导入依赖的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;
}
示例2: parse
import org.fife.ui.rsyntaxtextarea.parser.DefaultParseResult; //导入依赖的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;
}
示例3: parse
import org.fife.ui.rsyntaxtextarea.parser.DefaultParseResult; //导入依赖的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;
}
示例4: parse
import org.fife.ui.rsyntaxtextarea.parser.DefaultParseResult; //导入依赖的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;
}
示例5: maybeAddNotice
import org.fife.ui.rsyntaxtextarea.parser.DefaultParseResult; //导入依赖的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);
}
示例6: XMLParser
import org.fife.ui.rsyntaxtextarea.parser.DefaultParseResult; //导入依赖的package包/类
public XMLParser(RSyntaxTextArea textArea) {
this.textArea = textArea;
result = new DefaultParseResult(this);
try {
spf = SAXParserFactory.newInstance();
} catch (FactoryConfigurationError fce) {
fce.printStackTrace();
}
}
示例7: PerlOutputCollector
import org.fife.ui.rsyntaxtextarea.parser.DefaultParseResult; //导入依赖的package包/类
/**
* Constructor.
*
* @param in The input stream.
*/
public PerlOutputCollector(InputStream in, PerlParser parser,
DefaultParseResult result, Element root) {
super(in);
this.parser = parser;
this.result = result;
this.root = root;
}
示例8: JavaScriptParser
import org.fife.ui.rsyntaxtextarea.parser.DefaultParseResult; //导入依赖的package包/类
/**
* Constructor.
*/
public JavaScriptParser(JavaScriptLanguageSupport langSupport,
RSyntaxTextArea textArea) {
this.textArea = textArea;
this.langSupport = langSupport;
support = new PropertyChangeSupport(this);
result = new DefaultParseResult(this);
}
示例9: JavaParser
import org.fife.ui.rsyntaxtextarea.parser.DefaultParseResult; //导入依赖的package包/类
/**
* Constructor.
*/
public JavaParser(RSyntaxTextArea textArea) {
support = new PropertyChangeSupport(this);
result = new DefaultParseResult(this);
}
示例10: AsmParser
import org.fife.ui.rsyntaxtextarea.parser.DefaultParseResult; //导入依赖的package包/类
private AsmParser()
{
result = new DefaultParseResult(this);
}
示例11: PerlParser
import org.fife.ui.rsyntaxtextarea.parser.DefaultParseResult; //导入依赖的package包/类
/**
* Constructor.
*/
public PerlParser() {
result = new DefaultParseResult(this);
}
示例12: parse
import org.fife.ui.rsyntaxtextarea.parser.DefaultParseResult; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public ParseResult parse(RSyntaxDocument doc, String style) {
new ValidationConfigSniffer().sniff(doc);
DefaultParseResult result = new DefaultParseResult(this);
curElem = root = new XmlTreeNode("Root");
if (spf==null || doc.getLength()==0) {
return result;
}
//long start = System.currentTimeMillis();
try {
if (sp==null) { // New or reset for different validation
sp = spf.newSAXParser();
}
Handler handler = new Handler(doc, result);
if (validationConfig!=null) {
validationConfig.configureHandler(handler);
}
DocumentReader r = new DocumentReader(doc);
InputSource input = new InputSource(r);
sp.parse(input, handler);
r.close();
} catch (Exception e) {
// Don't give an error; they likely just saved an incomplete XML
// file
// Fall through
}
//long time = System.currentTimeMillis() - start;
//System.err.println("DEBUG: IconGroupLoader parsing: " + time + " ms");
if (locator!=null) {
try {
root.setStartOffset(doc.createPosition(0));
root.setEndOffset(doc.createPosition(doc.getLength()));
} catch (BadLocationException ble) {
ble.printStackTrace();
}
}
support.firePropertyChange(PROPERTY_AST, null, root);
return result;
}
示例13: Handler
import org.fife.ui.rsyntaxtextarea.parser.DefaultParseResult; //导入依赖的package包/类
public Handler(RSyntaxDocument doc, DefaultParseResult result) {
this.doc = doc;
this.result = result;
s = new Segment();
}
示例14: JsHinter
import org.fife.ui.rsyntaxtextarea.parser.DefaultParseResult; //导入依赖的package包/类
private JsHinter(JavaScriptParser parser, RSyntaxDocument doc,
DefaultParseResult result) {
this.parser = parser;
// this.doc = doc;
this.result = result;
}
示例15: parse
import org.fife.ui.rsyntaxtextarea.parser.DefaultParseResult; //导入依赖的package包/类
public static void parse(JavaScriptParser parser, RSyntaxTextArea textArea,
DefaultParseResult result) throws IOException {
String stdout = null;
RSyntaxDocument doc = (RSyntaxDocument)textArea.getDocument();
List<String> command = new ArrayList<String>();
if (File.separatorChar=='\\') {
command.add("cmd.exe");
command.add("/c");
}
else {
command.add("/bin/sh");
command.add("-c");
}
command.add("jshint");
File jshintrc = parser.getJsHintRCFile(textArea);
if (jshintrc!=null) {
command.add("--config");
command.add(jshintrc.getAbsolutePath());
}
command.add("--verbose"); // Allows to decide error vs. warning
command.add("-");
ProcessBuilder pb = new ProcessBuilder(command);
pb.redirectErrorStream();
Process p = pb.start();
PrintWriter w = new PrintWriter(p.getOutputStream());
// Create threads to read the stdout and stderr of the external
// process. If we do not do it this way, the process may
// deadlock.
InputStream outStream = p.getInputStream();
InputStream errStream = p.getErrorStream();
StreamReaderThread stdoutThread = new StreamReaderThread(outStream);
StreamReaderThread stderrThread = new StreamReaderThread(errStream);
stdoutThread.start();
try {
String text = doc.getText(0, doc.getLength());
w.print(text);
w.flush();
w.close();
/*rc = */p.waitFor();
p = null;
// Save the stdout and stderr. Don't interrupt reader threads;
// just wait for them to terminate normally.
//stdoutThread.interrupt();
//stderrThread.interrupt();
stdoutThread.join();
stderrThread.join();
stdout = stdoutThread.getStreamOutput();
} catch (InterruptedException ie) {
//ie.printStackTrace();
stdoutThread.interrupt();
//lastError = ie;
} catch (BadLocationException ble) {
ble.printStackTrace(); // Never happens
} finally {
if (outStream!=null) {
outStream.close();
}
w.close();
if (p!=null) {
p.destroy();
}
}
JsHinter hinter = new JsHinter(parser, doc, result);
hinter.parseOutput(doc, stdout);
}