Code Monkey home page Code Monkey logo

Comments (6)

Hackerpilot avatar Hackerpilot commented on May 28, 2024

The parser doesn't make bar a child of a conditional declaration. It parses "version(Windows):" as a sibling node to bar.

from libdparse.

joakim-noah avatar joakim-noah commented on May 28, 2024

Are you saying this is expected? If I simply take out the nested version(X86_64) block in the second file, Dscanner can't find bar, ie it is a child again.

from libdparse.

Hackerpilot avatar Hackerpilot commented on May 28, 2024

Like this?

version(Windows):
long bar = 3;

from libdparse.

joakim-noah avatar joakim-noah commented on May 28, 2024

Yes, or this:

version(Windows):
char noo = 'd';
long bar = 3;

Note that is with the one modification to Dscannner specified above, to omit visiting conditional declarations. Try it for yourself, add that line and recompile Dscanner, then try searching each of the above sample files. It's not clear why bar is a child declaration within a colon-terminated conditional declaration in some cases but not in others, ie when there's a nested conditional declaration in between.

from libdparse.

Hackerpilot avatar Hackerpilot commented on May 28, 2024

Have you tried the --ast option? It should show you what AST the parser is creating.

from libdparse.

joakim-noah avatar joakim-noah commented on May 28, 2024

No, I had not tried it. It shows that noo and bar are listed in the trueDeclarations for the first Windows conditional declaration if there's no nested conditional declaration, but not if the X86_64 conditional declaration is in between. They are then listed outside the Windows conditional declaration, which appears to be a clear bug to me, as a colon-terminated version declaration should apply to the entire file.

from libdparse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.