Giter Club home page Giter Club logo

Comments (12)

RomanYankovsky avatar RomanYankovsky commented on June 12, 2024

Please download the latest sources. Then make sure that you defined a platform's defines before parsing. This was fine for me (tested with XE7):

      ASTBuilder.AddDefine('MSWINDOWS');
      ASTBuilder.AddDefine('CPUX86');

Please confirm that it works for you now :)

from delphiast.

 avatar commented on June 12, 2024

Using latest version of your demo, @RomanYankovsky, parsing XE7's System.pas unit... I'm getting the same error as @sglienke.

The line it's failing on is 5442, and appears to be related to the Defines not being handled properly. I'm checking to see if this has anything to do with my modifications to the conditional defines handling, but it shouldn't because these are {$IFDEF} expressions not {$IF DEFINED(CONDITION)} (which is what I improved for you the other day).

I'll make the code break on IFDEF expressions only when Y > 5415 and step through the code to see where it's going wrong.

from delphiast.

RomanYankovsky avatar RomanYankovsky commented on June 12, 2024

I guess that's because demo doesn't define CPUX86.

from delphiast.

 avatar commented on June 12, 2024

Extra bit of information, and this is a strange one.
Looking at the Lexer's FDefined list at the point of failure, the list is completely empty!

CPUX86' define is definitely in there (I added it myself along with all the other standard compiler defines up to XE7's list, which was in the merge you did from my pull request the other day).

EDIT: To be clear, the procedure on which it is failing is _UGetDir originating on line 5416 and ending line 5442.

from delphiast.

 avatar commented on June 12, 2024

Okay, why is there an "Exit" call on line 2331 of SimpleParser.Lexer.pas? This means that none of the necessary defines are being added to the Lexer's FDefines list!

from delphiast.

 avatar commented on June 12, 2024

Removing that "Exit" call from line 2331 makes it parse all the way up to line 39592 with a different error, which is the "initialization" section. Error message is "Begin expected, found initialization"

from delphiast.

RomanYankovsky avatar RomanYankovsky commented on June 12, 2024

Please make sure that you have merged latest changes. Empty define list was fixed yesterday with commit 7c061bb, and default defines were moved to other method with commit 7b5d5af.

from delphiast.

RomanYankovsky avatar RomanYankovsky commented on June 12, 2024

Also I updated the demo a couple of minutes ago. Now it's fine.

P.S. I moved default defines to other method because it's not always needed. For instance, you may run parser on Windows machine, but want to parse Android code. Especially, if you develop an IDE expert.

from delphiast.

 avatar commented on June 12, 2024

I accidentally pulled from my fork instead of the upstream. Pulling from the upstream it now parses (and takes a VERY long time to produce the XML)

And yes, your "outsourcing" of the defines makes perfect sense in that context.

from delphiast.

RomanYankovsky avatar RomanYankovsky commented on June 12, 2024

Yup. Actually parser is fast (less than a second to parse System.pas on my laptop), but converting a tree of TSyntaxNode to XML takes A LOT of time...

from delphiast.

 avatar commented on June 12, 2024

It's a massive unit, so it doesn't surprise me that generating all of that XML data takes a significant amount of time. For my purposes, that's not a problem as I'm not using the XML output, but rather the TSyntaxNode directly.

from delphiast.

RomanYankovsky avatar RomanYankovsky commented on June 12, 2024

Fixed.

from delphiast.

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.