Add syntax highlighting to the readme ()

This commit is contained in:
clYd3r 2017-06-24 14:40:18 +02:00 committed by Petar Kirov
parent 7de68bf5f9
commit 721f2bc907
1 changed files with 89 additions and 82 deletions

View File

@ -21,11 +21,13 @@ compilers instead of DMD. To install, simply place the generated binary (in the
# Usage # Usage
The following examples assume that we are analyzing a simple file called helloworld.d The following examples assume that we are analyzing a simple file called helloworld.d
```d
import std.stdio; import std.stdio;
void main(string[] args) void main(string[] args)
{ {
writeln("Hello World"); writeln("Hello World");
} }
```
### Token Count ### Token Count
The "--tokenCount" or "-t" option prints the number of tokens in the given file The "--tokenCount" or "-t" option prints the number of tokens in the given file
@ -214,7 +216,11 @@ If a `dscanner.ini` file is locate in the working directory or any of it's paren
The "--ast" or "--xml" options will dump the complete abstract syntax tree of The "--ast" or "--xml" options will dump the complete abstract syntax tree of
the given source file to standard output in XML format. the given source file to standard output in XML format.
```sh
$ dscanner --ast helloworld.d $ dscanner --ast helloworld.d
```
```xml
<module> <module>
<declaration> <declaration>
<importDeclaration> <importDeclaration>
@ -291,6 +297,7 @@ the given source file to standard output in XML format.
</functionDeclaration> </functionDeclaration>
</declaration> </declaration>
</module> </module>
```
For more readable output, pipe the command through [xmllint](http://xmlsoft.org/xmllint.html) For more readable output, pipe the command through [xmllint](http://xmlsoft.org/xmllint.html)
using its formatting switch. using its formatting switch.