当前位置: 首页>>代码示例>>Java>>正文


Java DefaultParseResult类代码示例

本文整理汇总了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;
}
 
开发者ID:loadtestgo,项目名称:pizzascript,代码行数:20,代码来源:FilePanel.java

示例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;
}
 
开发者ID:touist,项目名称:touist,代码行数:25,代码来源:ErrorParser.java

示例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;
	}
 
开发者ID:bobbylight,项目名称:ZScriptLanguageSupport,代码行数:19,代码来源:ZScriptParser.java

示例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;
}
 
开发者ID:curiosag,项目名称:ftc,代码行数:14,代码来源:GftParser.java

示例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);
}
 
开发者ID:curiosag,项目名称:ftc,代码行数:13,代码来源:GftParser.java

示例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();
    }
}
 
开发者ID:intuit,项目名称:Tank,代码行数:10,代码来源:XMLParser.java

示例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;
}
 
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:13,代码来源:PerlOutputCollector.java

示例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);
}
 
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:11,代码来源:JavaScriptParser.java

示例9: JavaParser

import org.fife.ui.rsyntaxtextarea.parser.DefaultParseResult; //导入依赖的package包/类
/**
 * Constructor.
 */
public JavaParser(RSyntaxTextArea textArea) {
	support = new PropertyChangeSupport(this);
	result = new DefaultParseResult(this);
}
 
开发者ID:pyros2097,项目名称:GdxStudio,代码行数:8,代码来源:JavaParser.java

示例10: AsmParser

import org.fife.ui.rsyntaxtextarea.parser.DefaultParseResult; //导入依赖的package包/类
private AsmParser()
{
    result = new DefaultParseResult(this);
}
 
开发者ID:dries007,项目名称:j8051,代码行数:5,代码来源:AsmParser.java

示例11: PerlParser

import org.fife.ui.rsyntaxtextarea.parser.DefaultParseResult; //导入依赖的package包/类
/**
 * Constructor.
 */
public PerlParser() {
	result = new DefaultParseResult(this);
}
 
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:7,代码来源:PerlParser.java

示例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;

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

示例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();
}
 
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:6,代码来源:XmlParser.java

示例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;
	}
 
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:7,代码来源:JsHinter.java

示例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);

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


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