|
||
---|---|---|
README.md | ||
autocomplete.d | ||
build.sh | ||
codegen.d | ||
highlighter.d | ||
langutils.d | ||
main.d | ||
parser.d | ||
tokenizer.d | ||
types.d |
README.md
Overview
Dscanner is a tool used to analyze D source code.
Options
- --dotComplete sourceFile cursorPosition - Provide autocompletion for the insertion of the dot operator. The cursor position is the character position in the file, not the position in the line.
- --sloc sourceFiles - count the number of logical lines of code in the given source files.
- --json sourceFile - Generate a JSON summary of the given source file
- --parenComplete sourceFile cursorPosition - Provides a listing of function parameters or pre-defined version identifiers at the cursor position. The cursor position is the character position in the file, not the line.
- --highlight sourceFile - Syntax-highlight the given source file. The resulting HTML will be written to standard output.
- -I includePath - Include includePath in the list of paths used to search for imports. By default dscanner will search in the current working directory as well as any paths specified in /etc/dmd.conf.
Dot Completion
Paren Completion
JSON output
Generates a JSON summary of the input file.
Example
The given D code: module example;
import std.stdio;
interface Iface {
double interfaceMethod();
}
class SomeClass(T) if (isSomeString!T) : IFace {
public:
this() {}
void doStuff(T);
override double interfaceMethod() {}
private:
T theTee;
}
int freeFunction(int x) { return x + x; }
void main(string[] args) {
}
is transformed into the following JSON markup:
{
"name" : "example",
"imports" : [
"std.stdio"
],
"interfaces" : [
{
"name" : "Iface",
"line" : 5,
"protection" : "public",
"attributes" : [
],
"constraint" : "",
"templateParameters" : [
],
"functions" : [
{
"name" : "interfaceMethod",
"line" : 6,
"protection" : "",
"attributes" : [
],
"constraint" : "",
"templateParameters" : [
],
"parameters" : [
],
"returnType" : "double"
}
],
"variables" : [
],
"baseClasses" : [
]
}
],
"classes" : [
{
"name" : "SomeClass",
"line" : 9,
"protection" : "public",
"attributes" : [
],
"constraint" : "if (isSomeString!T)",
"templateParameters" : [
"T"
],
"functions" : [
{
"name" : "this",
"line" : 11,
"protection" : "",
"attributes" : [
],
"constraint" : "",
"templateParameters" : [
],
"parameters" : [
],
"returnType" : ""
},
{
"name" : "doStuff",
"line" : 12,
"protection" : "",
"attributes" : [
],
"constraint" : "",
"templateParameters" : [
],
"parameters" : [
{
"name" : "",
"line" : 0,
"protection" : "",
"attributes" : [
],
"type" : "T"
}
],
"returnType" : "void"
},
{
"name" : "interfaceMethod",
"line" : 13,
"protection" : "",
"attributes" : [
"override"
],
"constraint" : "",
"templateParameters" : [
],
"parameters" : [
],
"returnType" : "double"
}
],
"variables" : [
{
"name" : "theTee",
"line" : 15,
"protection" : "private",
"attributes" : [
],
"type" : "T"
}
],
"baseClasses" : [
"IFace"
]
}
],
"structs" : [
],
"structs" : [
],
"functions" : [
{
"name" : "freeFunction",
"line" : 18,
"protection" : "",
"attributes" : [
],
"constraint" : "",
"templateParameters" : [
],
"parameters" : [
{
"name" : "x",
"line" : 18,
"protection" : "",
"attributes" : [
],
"type" : "int"
}
],
"returnType" : "int"
},
{
"name" : "main",
"line" : 20,
"protection" : "",
"attributes" : [
],
"constraint" : "",
"templateParameters" : [
],
"parameters" : [
{
"name" : "args",
"line" : 20,
"protection" : "",
"attributes" : [
],
"type" : "string[]"
}
],
"returnType" : "void"
}
],
"variables" : [
],
"enums" : [
]
}
Line of Code count
This option counts the logical lines of code in the given source files, not simply the physical lines. More specifically, it counts the number of semicolons, if, while, case, foreach, and for tokens in the given files.
Highlighting
Syntax highlights the given file in HTML format. Output is written to stdout. The CSS styling information is currently hard-coded.