# How to Access Source Code?

**URL:** <https://discourse.processing.org/t/how-to-access-source-code/5434>\
**Category:** Development\
**Created:** [November 11, 2018, 11:08am UTC](https://discourse.processing.org/t/how-to-access-source-code/5434 "2018-11-11T11:08:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lexyth](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lexyth/32/7403_2.png) [@Lexyth](https://discourse.processing.org/u/Lexyth)\
**Post date:** [November 11, 2018, 11:08am UTC](https://discourse.processing.org/t/how-to-access-source-code/5434/1 "2018-11-11T11:08:22Z")

</div>

What i Need it to Access the Source Code, But only the ‚Blocks‘ from specific classes/methods, for a Tool i‘m trying to write.

I already looked at how autosuggestion gets it‘s information and came to eclipses Block or more specifically ASTNode. I Even found a Field within it, that targets Comments (or at least it‘s called like that), which is also needed for what i want to do.

The Problem is that i don‘t know if there is a simpler way… because this seems to be a lot of work only deciphering what anything there does… so my Question is :

Is there a relatively simple way to get sourcecode from a method/class by its text only?

So that it can be used as code, and not by manually looking at github or so… just like autosuggestion gives you all methods from a class, just by the name and the previous „word“‘s class?

An example of what i mean Would be similar to this :

```auto
PVector a;

void setup() {
  a.a // and then it returns all methods and fields for a PVector in autosuggestion. 
}

```

What i Would Need Would be all the fields and methods as source Code and preferibly ordered.

Now, i can simply add all the methods Source Codes together that result there, that is not the Problem. The Problem is, that i don‘t know how to get the actual code Block… autosuggestion only returns method/field names, But not the relative code Block… and a Look at where this Block should be only left me with despair 😅  
So, any help is very much appreciated 😊

---

<div class="post-metadata">

**Author:** ![Kevin](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kevin/32/2297_2.png) [@Kevin](https://discourse.processing.org/u/Kevin)\
**Post date:** [November 12, 2018, 9:59pm UTC](https://discourse.processing.org/t/how-to-access-source-code/5434/2 "2018-11-12T21:59:49Z")

</div>

You could look into using **reflection** to retried the functions and variables of a particular class.
