Thread: Parsing help

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    4
    Rep Power
    0

    Parsing help


    hi all, new to the forum, new to programming. I'm working on a little project, and i could use a little help/guidance.

    I'm trying to make a class that will crawl any php source, and then build an array of all the classes and their methods.

    I'm totally new to programming and have no clue where to start or how to get it done. so i would like any feedback you guys might have, if there are any libraries or classes that do this.

    Thanks,
  2. #2
  3. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6352
    Look at the reflectionClass.

    Note that recursively parsing programming language syntax is not the best way to learn a language. It's a bit out of your depth.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    4
    Rep Power
    0
    Thanks, That's the ticket. My main objective here is to create an intuitive UI to navigate through my framework's classes and methods. And i just needed a place to start, so thanks.

    I was looking at using regex to parse the files as plain text, but i did not want to get into that kind of dredging.... so thanks i never knew about the ReflectionClass AWESOME!
  6. #4
  7. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6352
    Always describe your problem. Don't ask how to do what you've decided is the solution.

    PHPDocumenter does this already.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    4
    Rep Power
    0
    Very well, my end goal is to be able to read a php file, and come up with an array or all classes, and nested with in a class all it's methods. I will be using this to drive a GUI that highlights your systems objects, classes, and methods. and will provide an interactive UML or sorts. i have most of the JS ready, just need the php part.

    Thanks
  10. #6
  11. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6352
    thanks, im not trying to make a UML or diagram....
    I never thought you were.

    My end goal is to come up with li or divs, each one representing a method, or through a stack of methods a class, so i can produce a GUI for navigating and managing one's classes and methods.
    That is exactly what PHPDocumenter does. PHP.net is made with PHPDocumenter.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    4
    Rep Power
    0
    ok i will look at phpDocumenter, thanks

IMN logo majestic logo threadwatch logo seochat tools logo