-
Notifications
You must be signed in to change notification settings - Fork 0
Conversation
…exibility with whitespace and conditionals
+ Added a constructor to provide the String type + Added a getType(); to return the type of the variable * Changed "type" to private and final to follow OOP conventions Function: * Changed all fields from public to private to follow OOP conventions + Added a couple constructors for easy accessibility for fields + Added necessary getter and setter methods Variable: * Changed all fields from public to private to follow OOP conventions + Added a couple constructors for easy accessibility for fields + Added necessary getter and setter methods ParsedCode: * Changed all fields from public to private to follow OOP conventions + Added a couple constructors for easy accessibility for fields + Added necessary getter and setter methods Parser: + Created a new map and list of values for every file parse (This is necessary to allow for multiple scripts) * The parse functions are now more specific to the regex match + Utilized the new Function constructor when building a new Function + Utilized all new constructors / methods in the Flow, Function, and Variable classes
Just pushed up a new commit to change up the functionality of all type values. These should follow proper OOP conventions, and allow for the construction of values with constructors as well. |
Nice! For The For Loops, For Now, I Don't Know What I'll Do For Them, Any Suggestions? Also, When I Merge Your Request, How Do I Update My Code In Eclipse TO Match It" |
No suggestions for the for loop. I would suggest taking a look at how Lua does it. Obviously, parameter braces would be recommended rather than free-hand to match a similar syntax as while, but that's up to you. It's your language. As for how to link it to your IDE, clone the project to your desktop on a local repository. (I assume you've already done this, as I believe you're using GitHub Desktop or SourceTree?). In Eclipse, do File -> Import -> [Git]: Projects from Git. Follow along the steps there and you should be on your way to importing your project |
Gracias, Syntax Will Probably Be Like "for var, boolean, manipulateVar do end" |
Might I suggest the removal of the "do" keyword to match with the while loop? Unless of course that's the syntax of while. If it is, then I am able to modify the regex to search for that as well |
Your Regex Thing Doesn't Work With Tabs... Wit This:
It Doesn't Find Anything... And I Dont Need While to have do |
Oh... you want to know why that is? That's because I was silly and thought that the syntax was similar to Java :P It's expecting parameter braces for conditionals! As for why it's not working with tabs, it actually is. It's detecting it, but the way you're parsing it with the parseVariable() method is not. You're replacing all spaces, but indents are not spaces; they are whitespace. I suggest perhaps the use of the following:
Same thing goes for the other parsing functions. That will replace all whitespace characters including indents and spaces. To fix the regex statements, replace the following: With: That should fix it to utilise the new syntax :D Functions, however expect parenthesis for parameters as per requested syntax :) I hope that fixes it |
I Have Tried To Figure Out Why, But Your Regex Won't Recognise "function yomamma()" But Will For "function hello(inp)" |
My apologies. I must have messed up when writing that regex. I didn't take into consideration of the acceptance of no parameter fields in the parameter braces for functions. Here. This should fix it:
Just replace the regex currently being used for functions with the regex code above. That should fix everything :) |
Thanks! I Am Not To Savy With Regex |
Sorry If You Arnt The Person To Ask But, I AM Stuck With Parsing Nested Loops And Loops In Functions. My Current Version Doesn't Work With Theml |
Personally would you seggest I use a third party parser, like luaj? |
Greatly improved the file parser using RegEx. This allows for more flexibility with whitespace and conditionals
Example:
function name(parameters) // This is valid
function name ( parameters , adsduadf ) // This is also valid
function name (parame\te*rs) // This is not valid
Whitespace is simply ignored in all declarations, including the declaration of variables. This allows for more flexibility with the compiler, much like Java's multi-line syntax and whitespace ignorer. Personally, this feels much more elegant, though if you disagree you are free to decline this pull request 😃
NOTE: I did not add support for the "for" loop, as I am not sure what your plans are for its syntax.
I also did not modify the way function parameters or any other variable parsing features act. I only changed the method of detecting that a line is x, y or z.
This was tested in a .TEA file, and it seems to have parsed everything perfectly. There should be no external changes, only internal efficiency improvements