Simple wrapper of SrcML for Pharo
- Download SrcML binaries from SrcML website and extract them in your filesystem.
- Copy or create a symlink for the dynamic libraries inside the srcml/lib folder to the folder of the Pharo image.
- Copy or create a symlink for the SrcML binary in srcml/bin/srcml to the folder of the image (working directory).
- Install XMLParser and XPath from the Pharo catalog.
- Run the tests of the package.
There are two use modes of this wrapper.
Extract and analyze all the source files in a directory.
(SrcML extractFromDir: 'PATH/TO/SOURCE/DIRECTORY') xml
Extract and analyze the source code stored in a String in Pharo. In this case it is mandatory to pass the target language to SourceML.
(SrcML extractFromCode: sourceCodeString language: 'C++') xml. "-> Extract the code using a C++ parser."
(SrcML extractJavaFromCode: sourceCodeString) xml. "-> Syntactic sugar for extracting the code using a Java parser"