Read all tutorials from this series.
Source code for this tutorial is available on github as a single zip archive, as a Team Project Set or you can browse the files online.
Step 1: Provide a code parser
Code parser is a big word. Currently all we need to detect in given script code are comments. As there already exists a corresponding base class, all we need to do is to provide a derived class indicating comment tokens:
package org.eclipse.ease.lang.beanshell; import org.eclipse.ease.AbstractCodeParser; public class BeanShellCodeParser extends AbstractCodeParser { @Override protected boolean hasBlockComment() { return true; } @Override protected String getBlockCommentEndToken() { return "*/"; } @Override protected String getBlockCommentStartToken() { return "/*"; } @Override protected String getLineCommentToken() { return "//"; } }Step 2: Register the code parser
Similar to registering the code factory, we also need to register the code parser. Open the plugin.xml and select the scriptType extension for BeanShell. There register the code parser from above. Now EASE is able to parse script headers for keywords and interprets them accordingly.
No comments:
Post a Comment