简体   繁体   中英

Getting the raw code in xtext dsl

I try to implement xtext dsl plugin based on existing interpreted language. The language already has an interpreter and I want to use it as it. The problem is, I can't see any stage where I can access the raw code and send it into interpretation. I noticed only the code generator with the doGenerate method, but it's not my case.

Appreciating your help

Try to obtain the XtextResource from the parsed AST. It can provide the raw text.

MyModel model = ..
XtextResource res = (XtextResource)model.eResource();
String text = res.getParseResult().getRootNode().getText();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM