Skip to content
Permalink
Browse files

ABLDuck task

PR #319
- Removed antlr javadoc parser, had weird issues and was overkill for what i needed
- Better support for ABLDoc comments
- Added .p support for procedures, functions
- Minified the ablduck.zip template and build it using sencha cmd tools
- Removed a lot of the html rendering, move this to the template
- Cleaned up code a lot
  • Loading branch information...
spazzymoto authored and gquerret committed Mar 9, 2019
1 parent bdea75e commit 0b0bb268e25da91cacd666a35bb9b753cba1da96
Showing 560 changed files with 1,945 additions and 1,984 deletions.
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="build/java" path="src/java"/>
<classpathentry kind="src" output="build/java" path="build/javadoc"/>
<classpathentry kind="src" output="build/test" path="src/test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="lib" path="lib/ant.jar" sourcepath="lib/ant-src.jar"/>
@@ -13,7 +12,6 @@
<classpathentry kind="lib" path="lib/ast.jar"/>
<classpathentry kind="lib" path="lib/ast-dependencies.jar"/>
<classpathentry kind="lib" path="lib/ini4j-0.5.1.jar"/>
<classpathentry kind="lib" path="lib/antlr-4.7-complete.jar"/>
<classpathentry kind="lib" path="lib/commonmark-0.9.0.jar"/>
<classpathentry kind="lib" path="lib/commonmark-0.11.0.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
@@ -23,7 +23,6 @@

<property name="build" location="build" />
<property name="build-java" location="build/java" />
<property name="build-javadoc" location="build/javadoc" />
<property name="build-test" location="build/test" />
<property name="build-v10" location="build/build-v10" />
<property name="build-v10-64" location="build/build-v10-64" />
@@ -95,9 +94,7 @@
<pathelement location="lib/ast-dependencies.jar" />

<!-- ABLDuck classes -->
<pathelement location="lib/antlr-runtime-4.7.jar"/>
<pathelement location="lib/commonmark-0.9.0.jar"/>
<pathelement location="${build-javadoc}" />
<pathelement location="lib/commonmark-0.11.0.jar"/>
</path>
<path id="pct.test.compil">
<path refid="pct.compil" />
@@ -113,7 +110,6 @@
</tstamp>

<mkdir dir="${build-java}" />
<mkdir dir="${build-javadoc}" />
<mkdir dir="${build-test}" />
<mkdir dir="${build-v10}" />
<mkdir dir="${build-v10-64}" />
@@ -138,19 +134,6 @@
</target>

<target name="build" depends="init" description="Java source files compilation">
<!-- Generate javadoc classes from the antlr grammar files -->
<java jar="lib/antlr-4.7-complete.jar" fork="true">
<arg line="${src.java}/za/co/mip/ablduck/javadoc/JavadocParser.g4 ${src.java}/za/co/mip/ablduck/javadoc/JavadocLexer.g4"/>
<arg line="-o ${build-javadoc}/za/co/mip/ablduck/javadoc"/>
<arg line="-listener -no-visitor -encoding UTF-8"/>
<arg line="-package za.co.mip.ablduck.javadoc"/>
</java>

<javac srcdir="${build-javadoc}" destdir="${build-java}" debug="${debug}" source="${javac.source}" target="${javac.target}" deprecation="${deprecation}" optimize="${optimize}" encoding="utf-8" includeAntRuntime="false">
<include name="za/co/mip/**/*.java" />
<classpath refid="pct.compil" />
</javac>

<javac srcdir="${src.java}" destdir="${build-java}" debug="${debug}" source="${javac.source}" target="${javac.target}" deprecation="${deprecation}" optimize="${optimize}" encoding="utf-8" includeAntRuntime="false">
<include name="com/phenix/pct/*.java" />
<include name="net/cordova/prounit/*.java" />
@@ -320,7 +303,9 @@
<fileset dir="classDocTemp/v12" includes="**/*.r" />
</bootstrapLibrary>
<delete dir="classDocTemp" />

<zip destfile="${build}/ablduck.zip">
<fileset dir="${src.java}/za/co/mip/ablduck/resources" />
</zip>
<jar jarfile="${dist}/PCT.jar">
<fileset dir="${build-java}">
<include name="**/*.class" />
@@ -333,6 +318,7 @@
<include name="pct12.pl" />
<include name="pct-src.zip" />
</fileset>
<zipfileset dir="${build}" includes="ablduck.zip" prefix="za/co/mip/ablduck/resources" />
<fileset dir="${src.java}">
<include name="eu/rssw/pct/antlib.xml" />
<include name="eu/rssw/pct/oedoc/antlib.xml" />
@@ -341,8 +327,7 @@
<zipfileset src="lib/gson-2.2.4.jar" />

<!-- ABLDuck classes -->
<zipfileset src="lib/antlr-runtime-4.7.jar"/>
<zipfileset src="lib/commonmark-0.9.0.jar"/>
<zipfileset src="lib/commonmark-0.11.0.jar"/>

<zipfileset dir="${src.progress}/Consultingwerk/Studio/ClassDocumentation/Templates" prefix="templates" />
<manifest>
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -30,6 +30,7 @@
import com.openedge.pdt.core.ast.ASTNode;
import com.openedge.pdt.core.ast.ConstructorDeclaration;
import com.openedge.pdt.core.ast.DatasetDeclaration;
import com.openedge.pdt.core.ast.DestructorDeclaration;
import com.openedge.pdt.core.ast.EnumDeclaration;
import com.openedge.pdt.core.ast.EnumeratorItem;
import com.openedge.pdt.core.ast.EventDeclaration;
@@ -45,6 +46,7 @@
import com.openedge.pdt.core.ast.UsingDeclaration;
import com.openedge.pdt.core.ast.IndexDeclaration.IndexColumn;
import com.openedge.pdt.core.ast.model.IASTNode;
import com.openedge.pdt.core.ast.model.IASTToken;
import com.openedge.pdt.core.ast.model.IField;
import com.openedge.pdt.core.ast.model.IIndex;
import com.openedge.pdt.core.ast.model.IParameter;
@@ -55,6 +57,7 @@
import eu.rssw.rcode.ClassCompilationUnit;
import eu.rssw.rcode.Constructor;
import eu.rssw.rcode.Dataset;
import eu.rssw.rcode.Destructor;
import eu.rssw.rcode.EnumMember;
import eu.rssw.rcode.Event;
import eu.rssw.rcode.GetSetModifier;
@@ -123,6 +126,10 @@ public boolean visit(TemptableDeclaration node) {
tt.beforeTable = node.getBeforeTable();
tt.xmlNodeName = node.getXmlNodeName();
tt.serialize = node.getSerializeName();
tt.isNew = node.getChild(ProgressParserTokenTypes.NEW) != null;
tt.isGlobal = node.getChild(ProgressParserTokenTypes.GLOBAL) != null;
tt.isShared = node.getChild(ProgressParserTokenTypes.SHARED) != null;
tt.modifier = AccessModifier.from(node.getAccessModifier());
String fName = "";
if (node.getFileName() != null) {
fName = propath.searchRelative(node.getFileName(), false).toPortableString();
@@ -142,7 +149,7 @@ public boolean visit(TemptableDeclaration node) {
tidx.unique = idx.isUnique();
tidx.wordIndex = idx.isWordIndex();
tidx.primary = idx.isPrimary();
List<IndexColumn> lst = (List<IndexColumn>) idx.getColumnList();
List<IndexColumn> lst = idx.getColumnList();
for (IndexColumn col : lst) {
tidx.fields.add(col.getName());
}
@@ -159,6 +166,10 @@ public boolean visit(DatasetDeclaration node) {
ds.name = node.getName();
ds.comment = findPreviousComment(node);

ds.modifier = AccessModifier.from(node.getAccessModifier());
ds.isNew = node.getChild(ProgressParserTokenTypes.NEW) != null;
ds.isShared = node.getChild(ProgressParserTokenTypes.SHARED) != null;

for (String str : node.getBufferNames()) {
ds.buffers.add(str);
}
@@ -216,8 +227,10 @@ public boolean visit(TypeDeclaration decl) {
cu.isFinal = decl.isFinal();
IASTNode clzNode = decl.getChildFirstLevel(ProgressParserTokenTypes.CLASS);
if (clzNode != null) {
cu.isSerializable = clzNode.getChildFirstLevel(ProgressParserTokenTypes.SERIALIZABLE) != null;
cu.useWidgetPool = clzNode.getChildFirstLevel(ProgressParserTokenTypes.USE__WIDGET__POOL) != null;
cu.isSerializable = clzNode
.getChildFirstLevel(ProgressParserTokenTypes.SERIALIZABLE) != null;
cu.useWidgetPool = clzNode
.getChildFirstLevel(ProgressParserTokenTypes.USE__WIDGET__POOL) != null;
}
cu.classComment.addAll(firstComments);
cu.classComment.add(findPreviousComment(decl));
@@ -241,6 +254,7 @@ public boolean visit(PropertyDeclaration decl) {
prop.isStatic |= (zz == ProgressParserTokenTypes.STATIC);
}
prop.isAbstract = decl.isAbstract();
prop.isOverride = decl.isOverride();
prop.dataType = getDataTypeName(decl.getDataType());
prop.extent = decl.getExtent();
prop.modifier = AccessModifier.from(decl.getAccessModifier());
@@ -299,6 +313,18 @@ public boolean visit(ConstructorDeclaration decl) {
return true;
}

@Override
public boolean visit(DestructorDeclaration decl) {
if (decl == null)
return true;

Destructor destructor = new Destructor();
destructor.destructorComment = findPreviousComment(decl);
cu.destructors.add(destructor);

return true;
}

@Override
public boolean visit(MethodDeclaration decl) {
if (decl == null)
@@ -312,6 +338,7 @@ public boolean visit(MethodDeclaration decl) {
method.isStatic = decl.isStatic();
method.isFinal = decl.isFinal();
method.isAbstract = decl.isAbstract();
method.isOverride = decl.isOverride();
method.methodComment = findPreviousComment(decl);
cu.methods.add(method);

@@ -340,6 +367,7 @@ public boolean visit(EventDeclaration decl) {
event.modifier = AccessModifier.from(decl.getAccessModifier());
event.isStatic = decl.isStatic();
event.isAbstract = decl.isAbstract();
event.isOverride = decl.isOverride();
if (decl.isDelegate())
event.delegateName = decl.getDelegateName();
event.eventComment = findPreviousComment(decl);
@@ -394,6 +422,18 @@ private static String findPreviousComment(ASTNode node) {
return n.getHiddenPrevious().getText();
n = n.getPrevSibling();
}

// If we find nothing lets try just after, for legacy reasons
for (IASTNode nd : node.getChildren()) {
if (nd.getType() == ProgressParserTokenTypes.EOS__COLON) {
IASTToken commentnode = nd.getHiddenNext();
if (commentnode != null
&& commentnode.getType() == ProgressTokenTypes.ML__COMMENT) {
return commentnode.getText();
}
break;
}
}
return null;
}

Oops, something went wrong.

0 comments on commit 0b0bb26

Please sign in to comment.
You can’t perform that action at this time.