dlang-community / d-scanner Goto Github PK
View Code? Open in Web Editor NEWSwiss-army knife for D source code
License: Boost Software License 1.0
Swiss-army knife for D source code
License: Boost Software License 1.0
In static this(), where type properties are defined, in every instance of string "double".
I've sent you an email (found on dlang.org), but probably there is some better way to contact you?
Also, what is your time zone? When would it be (potentially) convenient to ask questions, if I have any?
It would be great to have automated smoke tests to check that most important functionality is not broken after changes.
If not possible, at least manual instructions what to check and how.
Currently Dscanner doesn't parse enum members in situation like
enum { ... }
i.e. when no name is given. Dscanner supposes there is always a name (if I understand correctly)
I've put comment in source file to implement correct behavior later (whoever will do that)
align(16) uint a = 0;
(originally from phobos:
align(16) private immutable uint[4] bswap_shufb_ctl =
[
0x0001_0203, 0x0405_0607, 0x0809_0a0b, 0x0c0d_0e0f
];
)
dscanner --ctags dmd_root/src/phobos/std/algorithm.d > out_ctags.txt
std.format.FormatException@dmd_root/src/phobos/std/string.d(2536): Orphan format arguments: args[4..5]
This is on behalf of my brother who uses Emacs, would it be possible to also output etags so that Emacs can use them?
And it looks really silly!
#!/usr/bin/rdmd
ctags for etags format option is -e.
How in Dscanner?
I'm on windows and get these errors/warning if I run the build.bat:
C:\Users\Besitzer\Documents\Github\Dscanner>dmd main.d stats.d imports.d highlig
hter.d ctags.d astprinter.d outliner.d stdx/d/lexer.d stdx/d/parser.d stdx/d/ent
ities.d stdx/d/ast.d -wi -ofdscanner
stdx\d\parser.d(390): Warning: statement is not reachable
stdx\d\parser.d(405): Warning: statement is not reachable
stdx\d\parser.d(419): Warning: statement is not reachable
stdx\d\parser.d(433): Warning: statement is not reachable
stdx\d\parser.d(452): Warning: statement is not reachable
stdx\d\parser.d(466): Warning: statement is not reachable
stdx\d\parser.d(480): Warning: statement is not reachable
stdx\d\parser.d(494): Warning: statement is not reachable
stdx\d\parser.d(508): Warning: statement is not reachable
stdx\d\parser.d(526): Warning: statement is not reachable
stdx\d\parser.d(540): Warning: statement is not reachable
stdx\d\parser.d(554): Warning: statement is not reachable
stdx\d\parser.d(591): Warning: statement is not reachable
stdx\d\parser.d(611): Warning: statement is not reachable
stdx\d\parser.d(625): Warning: statement is not reachable
stdx\d\parser.d(3680): Warning: statement is not reachable
stdx\d\parser.d(5655): Warning: statement is not reachable
OPTLINK (R) for Win32 Release 8.00.13
Copyright (C) Digital Mars 1989-2010 All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
dscanner.obj(dscanner)
Error 42: Symbol Undefined _D9formatter7__arrayZ
dscanner.obj(dscanner)
Error 42: Symbol Undefined _D9formatter12__ModuleInfoZ
--- errorlevel 2
Implementation accepts some invalid inputs. I'm going to fix this in a way that corresponds to specification and will ask for review.
I tried Dscanner with the --json flag and alias declarations
alias int MyInt;
are not recognized. They do not appear in the JSON file, at least.
errors are not recoverable, warnings are, so the API should distinguish them to make it easy for client code using the parser
I will handle this myself if you don't mind (that's pretty straightforward).
struct A{}
@(A) void fun(){}
This file triggers an assertion failure, here is a link, sorry if this is somewhat nonstandard:
https://dl.dropbox.com/u/5629472/abstractmenu.d
The D language provides few information about exception, so I currently don't know how to properly find it.
This can be observed by running echo "q{test}" | dscanner --highlight
Hi. Trying to run --ctags on some dub packages:
~/code/d/Dscanner/dscanner /home/simendsjo/.dub/packages/libevent-master --recursive --ctags
[1] 1316 segmentation fault (core dumped) ~/code/d/Dscanner/dscanner /home/simendsjo/.dub/packages/libevent-master
Integrating completion with an editor will require saving the file (either directly or to a temporary location) before running dscanner. If you support reading the file from stdin as an alternative to a file, you can avoid this issue.
ubyte a[1];
=> error: C-style variable declarations are not supported.
autocomplete.d(237): Error: function langutils.combineTokens (ref const(Token[]) tokens) is not callable using argument types (const(Token)[])
/usr/include/d/std/range.d(611): Error: static assert "Cannot put a char[] into a Appender!(char[])"
/usr/include/d/std/array.d(1493): instantiated from here: put!(Appender!(char[]), char[])
autocomplete.d(341): instantiated from here: join!(MapResult!(unaryFun, const(Token)[]), string)
make: *** [all] Error 1
template A(int stop) {
alias int[3] A;
}
void test(){
enum a=A!3.length;
}
They are part of specification, but I saw somewhere that it is planned to deprecate them.
I just tried the --json flag and it appears to output twice the "structs":{}
pair.
int fun(){return 0;}
void test(){
foreach(i;0..100)
auto t=fun();
}
Add a --recursive option to the ctags generation option so that a tags file can be generated for an entire directory at once. Switch should be --recursive or -R
void main(string[] args)
causes a range violation.
Location information makes the AST more useful for applications such as static code analysis. Right now it's possible to use the --ast option and xmllint to do things like search for if statements without braces, but you can't say where in the source file it happened.
class A{}
class B : public A {}
void fun(){}
version(none):
void fun2(){}
alias extern(C) int function(int) foo;
void foo(alias fun=a=>a) () {}
import std.stdio;
void main(){
writeln(0,);
}
DMD 2.063 accepts the following:
enum Foo { Bar, Baz }
void main(string[] args)
{
Foo foo;
final switch (foo) with (Foo)
{
case Bar: break;
case Baz: break;
}
}
Dscanner expects a '{' after the switch test and reports the following errors when using ---syntaxCheck
:
test_switch.d(7:21)[error]: Expected { instead of with
test_switch.d(0:1)[error]: Expected } instead of EOF
import std.algorithm;
void test(){
0.reduce!max([1]);
}
import std.stdio;
void test(){
mixin(`1`).writeln;
}
int a, b;
produces this json output
"variables" : [
{
"name" : "a",
"line" : 1,
"protection" : "public",
"attributes" : [
],
"type" : "int"
}
],
class B{}
template A(alias T: B){}
void test(){
import core.time:msecs;
auto timeout=0.msecs;
}
From the Libevent D bindings in Deimos:
mixin("*msg.base." ~ member ~ "_assign")(msg, value);
I'm guessing this is a function call?
I have started using Dscanner to extract info about phobos modules. Currently not everything seems to be parsed. For example, in std.functional, the only functions I get back from Dscanner are adjoin and toDelegate.
Is this a known parsing issue (something to do with templates maybe) or must I be doing something wrong to not see all the function definitions?
Thanks and great tool!
dscanner doesn't output variables info with --json option.
it would be useful if it can return info about a,b inside function main.
int main()
{
int a;
string b;
return 0;
}
Dscanner crashes with command dscanner --sloc
, when no args are specified. Go make it read from stdin! ;)
Some editors can display errors as you type. E.g., Visual Studio. Other tools might also benefit from having diagnostic information available.
Example design would be to add a parameter to tokenize():
Token[] tokenize(S)(S inputString, void delegate(string) logMessage, IterationStyle iterationStyle = IterationStyle.CODE_ONLY) if (isSomeString!S)
logMessage() would by default write to stderr.
Of course, details may vary, the concept could be generalized or implemented totally differently. For example, you might want to add command line arguments to specify logFileName or to pass formatString. Error code could be returned from main to indicate that error log is not empty.
stdx/d/lexer.d(1663): Error: std.uni.isAlpha at phobos/std/uni.d(7063) conflicts with std.ascii.isAlpha at phobos/std/ascii.d(92)
I get this error after upgrading to git master.
should it be std.uni.isAlpha or std.ascii.isAlpha?
Introduced to the language in 2.061
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.