Skip to content

Commit 7c0afdc

Browse files
committed
release-related updates
1 parent dd18bdc commit 7c0afdc

File tree

4 files changed

+64
-17
lines changed

4 files changed

+64
-17
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
/.project
44
/.settings
55
/bin
6-
/*.jar
6+
/dist
7+
/lib

NOTICE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
XML output generator for Open Fortran Parser
2+
Copyright 2017 Mateusz Bysiek

README.md

Lines changed: 53 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,78 @@
11
# XML output generator for Open Fortran Parser
22

33
This is an extension of Open Fortran Parser (OFP), which outputs abstract syntaxt tree (AST)
4-
in XML format - to a file or to 'System.out'.
4+
in XML format of parsed Fortran file - to a file or to `System.out`.
55

66

77
## dependencies
88

99
- Open Fortran Parser 0.8.4-1
1010

11-
https://github.com/mbdevpl/open-fortran-parser/releases/tag/v0.8.4-1
11+
https://github.com/mbdevpl/open-fortran-parser/releases/tag/v0.8.4-1
1212

13-
This is a patched version of OFP. Specifically, 'FortranParserActionPrint' class in OFP
14-
could not be properly subclassed due to access levels of members of that class, so for example
15-
writing my own printer would introduce a lot of code duplication. Patch resolves this,
16-
without affecting any functionality of the Parser.
13+
This is a patched version of OFP. Specifically, `FortranParserActionPrint` class in OFP
14+
could not be properly subclassed due to access levels of members of that class, so for example
15+
writing my own printer would introduce a lot of code duplication. Patch resolves this,
16+
without affecting any functionality.
1717

18-
The patch also resolves some issue when compiling with recent GCC versions.
18+
The patch also resolves an issue when compiling with recent GCC versions.
1919

2020
- ANTRL 3.3 (dependency of Open Fortran Parser)
2121

22-
http://www.antlr3.org/download/
22+
http://www.antlr3.org/download/
2323

24-
- Apache Commons CLI
24+
- Apache Commons CLI 1.4 (or later)
2525

26-
https://commons.apache.org/proper/commons-cli/download_cli.cgi
26+
https://commons.apache.org/proper/commons-cli/download_cli.cgi
2727

28+
## how to build
29+
30+
Put dependencies in `lib` directory, and run:
31+
32+
```
33+
ant
34+
```
35+
36+
This will create a `.jar` file in `dist` directory.
2837

2938
## how to run
3039

40+
```bash
41+
java -cp "/path/to/dependencies/*" fortran.ofp.FrontEnd --class fortran.ofp.XMLPrinter \
42+
--output output.xml --verbosity 0~100 input.f
43+
```
44+
45+
where:
46+
47+
- The `--verbosity` flag controls verbosity of the parse tree. Defaluts to `100` when omitted.
48+
49+
* Maximum, `100`, means that all details picked up by Open Fortran Parser will be preserved.
50+
51+
* Minimum, `0`, means that tree will contain only what is needed to reconstruct the program
52+
without changing it's meaning.
53+
54+
- The `--output` flag controls where the XML should be written. Defaults to standard output
55+
when omitted.
56+
57+
... and remaining command-line options are exactly as defined in OFP 0.8.4.
58+
59+
To parse `some_fortran_file.f` and save XML output in `tree.xml` with minimum verbosity:
60+
61+
```bash
62+
java -cp "./lib/*:./dist/*" fortran.ofp.FrontEnd --class fortran.ofp.XMLPrinter \
63+
--output tree.xml --verbosity 0 some_fortran_file.f
64+
```
65+
66+
And to dump XML with maximum verbosity to console:
67+
68+
```bash
69+
java -cp "./lib/*:./dist/*" fortran.ofp.FrontEnd --class fortran.ofp.XMLPrinter \
70+
--verbosity 100 some_fortran_file.f
71+
```
72+
3173

3274
## AST specification
3375

3476
In progress.
3577

36-
Root node is '<ofp>', it has one subnode '<file>'.
78+
Root node is `<ofp>`, it has one subnode `<file>`.

build.xml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
<property name="src.dir" value="src" />
99
<property name="bin.dir" value="bin" />
1010
<property name="lib.dir" value="lib" />
11-
<property name="jar.name" value="OpenFortranParserXml-0.1.0.jar" />
11+
<property name="dist.dir" value="dist" />
12+
<property name="jar.name" value="OpenFortranParserXML-0.1.0.jar" />
13+
<property name="mainclass" value="fortran.ofp.Xml" />
1214

1315
<path id="ofp.classpath">
1416
<pathelement location="bin" />
15-
<!-- <pathelement location="resources" /> -->
1617
<fileset dir="${lib.dir}" includes="*.jar" />
1718
</path>
1819

@@ -28,7 +29,6 @@
2829
<exclude name="**/*.java" />
2930
</fileset>
3031
</copy>
31-
<copy file="LICENSE" todir="${bin.dir}" />
3232
</target>
3333

3434
<target name="build" depends="clean,init">
@@ -40,10 +40,12 @@
4040
</target>
4141

4242
<target name="jar" depends="build">
43-
<jar jarfile="${jar.name}" basedir="bin" includes="**/*.class">
43+
<jar jarfile="${dist.dir}/${jar.name}" basedir="bin" includes="**/*.class">
4444
<manifest>
45-
<attribute name="Main-Class" value="fortran.ofp.Xml" />
45+
<attribute name="Main-Class" value="${mainclass}" />
4646
</manifest>
47+
<metainf file="LICENSE" />
48+
<metainf file="NOTICE" />
4749
</jar>
4850
</target>
4951

0 commit comments

Comments
 (0)