View unanswered posts | View active topics



Reply to topic  [ 6 posts ] 
New Generator.txt syntax 
Author Message
Member

Joined: Thu Mar 29, 2007 9:32 am
Posts: 244
Reply with quote
I am creating new syntax for Generator.txt templates so it would give more freedom for developers. Some people like that syntax
Code:
private function parseLocaleData(keyData:XMLList):void {
         
}

while some might prefer that
Code:
private function parseLocaleData ( keyData : XMLList ) : void {
         
}

or maybe some other syntax

So I came up with the following Generator.txt templates language. For example, function generation template would look like this:
Code:
$(modifiers) function $(name)($(arguments))[[:$(type)]] $(CSLB){\n\t[[$(body)]]$(EntryPoint)\n}

In [[ and ]] brackets contain non-mandatory parts, e.g. some functions might not have type and FD should not fail because of that.
Here's a function parameter template
Code:
$(p_name)[[:$(p_type)]][[ = $(p_default_value)]][[$(p_comma) ]]

Again, type, default value and comma are not mandatory components (last parameter does not have comma after that). This template gives you possibility to generate this type of function (or even more crazy):
Code:
public function init(  isAdmin  :  Boolean  , test  :  String  ):void {
           
}

What I want to ask community is whether you like that kind of syntax or you can suggest a better one?


Wed Oct 27, 2010 2:44 pm
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Reply with quote
Generator.txt definitely was not designed for complex templates.

Suggested syntax seem reasonnable - is it efficient to parse and does it handle future needs (like several args between [[..]])?

Now if the templates file is modified we should rename it like generator2.txt to be sure everybody will get an updated one next time they update FD.


Fri Oct 29, 2010 2:40 pm
Profile WWW
Member

Joined: Thu Mar 29, 2007 9:32 am
Posts: 244
Reply with quote
Philippe wrote:
(like several args between [[..]])?

good idea, will have to create a better regexp for that (this is the hardest part). Otherwise all generators are already moved to new syntax (not committed yet). This needs to be thoroughly tested though. When it would be the best time to commit that stuff (beginning of November?)?


Fri Oct 29, 2010 6:32 pm
Profile
Member

Joined: Thu May 14, 2015 6:02 pm
Posts: 45
Reply with quote
I guess I'm using a newer version because there's no Generator.txt anymore, just a Snippets>as3>generators folder. But when I try to edit any of the FDS files, it says "Access is denied." What do I do?


Thu May 14, 2015 8:54 pm
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Reply with quote
Scythe wrote:
I guess I'm using a newer version because there's no Generator.txt anymore, just a Snippets>as3>generators folder. But when I try to edit any of the FDS files, it says "Access is denied." What do I do?

Edit your user copy: from FD, Tools > User Config Files...


Thu May 14, 2015 9:06 pm
Profile WWW
Member

Joined: Thu May 14, 2015 6:02 pm
Posts: 45
Reply with quote
Philippe wrote:
Scythe wrote:
I guess I'm using a newer version because there's no Generator.txt anymore, just a Snippets>as3>generators folder. But when I try to edit any of the FDS files, it says "Access is denied." What do I do?

Edit your user copy: from FD, Tools > User Config Files...


Thanks, that worked!


Thu May 14, 2015 11:30 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.