forked from phoedos/pmd
Plsql + modelica
This commit is contained in:
@@ -20,7 +20,7 @@ public class ModelicaHandler extends AbstractPmdLanguageVersionHandler {
|
||||
|
||||
@Override
|
||||
public Parser getParser(ParserOptions parserOptions) {
|
||||
return new ModelicaParser(parserOptions);
|
||||
return new ModelicaParser();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
package net.sourceforge.pmd.lang.modelica.ast;
|
||||
|
||||
import net.sourceforge.pmd.lang.LanguageVersion;
|
||||
import net.sourceforge.pmd.lang.Parser.ParserTask;
|
||||
import net.sourceforge.pmd.lang.ast.RootNode;
|
||||
import net.sourceforge.pmd.lang.modelica.resolver.CompositeName;
|
||||
|
||||
@@ -12,6 +14,8 @@ import net.sourceforge.pmd.lang.modelica.resolver.CompositeName;
|
||||
*/
|
||||
public class ASTStoredDefinition extends AbstractModelicaNode implements RootNode {
|
||||
private boolean hasBOM = false;
|
||||
private LanguageVersion languageVersion;
|
||||
private String filename;
|
||||
|
||||
ASTStoredDefinition(int id) {
|
||||
super(id);
|
||||
@@ -26,6 +30,23 @@ public class ASTStoredDefinition extends AbstractModelicaNode implements RootNod
|
||||
hasBOM = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LanguageVersion getLanguageVersion() {
|
||||
return languageVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSourceCodeFile() {
|
||||
return filename;
|
||||
}
|
||||
|
||||
ASTStoredDefinition addTaskInfo(ParserTask languageVersion) {
|
||||
this.languageVersion = languageVersion.getLanguageVersion();
|
||||
this.filename = languageVersion.getFileDisplayName();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether this source file contains Byte Order Mark.
|
||||
*/
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
package net.sourceforge.pmd.lang.modelica.ast;
|
||||
|
||||
import net.sourceforge.pmd.lang.ParserOptions;
|
||||
import net.sourceforge.pmd.lang.ast.CharStream;
|
||||
import net.sourceforge.pmd.lang.ast.ParseException;
|
||||
import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccTokenDocument;
|
||||
@@ -13,18 +12,14 @@ import net.sourceforge.pmd.lang.ast.impl.javacc.JjtreeParserAdapter;
|
||||
|
||||
public class ModelicaParser extends JjtreeParserAdapter<ASTStoredDefinition> {
|
||||
|
||||
public ModelicaParser(final ParserOptions parserOptions) {
|
||||
super(parserOptions);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JavaccTokenDocument newDocument(String fullText) {
|
||||
return new ModelicaTokenDocument(fullText);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ASTStoredDefinition parseImpl(CharStream cs, ParserOptions options) throws ParseException {
|
||||
return new ModelicaParserImpl(cs).StoredDefinition();
|
||||
protected ASTStoredDefinition parseImpl(CharStream cs, ParserTask task) throws ParseException {
|
||||
return new ModelicaParserImpl(cs).StoredDefinition().addTaskInfo(task);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user