[qooxdoo-commit] SF.net SVN: qooxdoo: [4083] trunk/qooxdoo/frontend
Brought to you by:
ecker,
martinwittemann
From: <wp...@us...> - 2006-08-31 13:02:39
|
Revision: 4083 http://svn.sourceforge.net/qooxdoo/?rev=4083&view=rev Author: wpbasti Date: 2006-08-31 06:02:27 -0700 (Thu, 31 Aug 2006) Log Message: ----------- Improved support for new and throw statements; added support for keys in hash maps which needs protection, improved separator logic Modified Paths: -------------- trunk/qooxdoo/frontend/demo/Makefile trunk/qooxdoo/frontend/framework/tool/generator/modules/treecompiler.py Modified: trunk/qooxdoo/frontend/demo/Makefile =================================================================== --- trunk/qooxdoo/frontend/demo/Makefile 2006-08-31 13:01:11 UTC (rev 4082) +++ trunk/qooxdoo/frontend/demo/Makefile 2006-08-31 13:02:27 UTC (rev 4083) @@ -74,6 +74,7 @@ --script-input $(FRAMEWORK)/source/class \ --generate-compiled-script \ --compiled-script-file build/script/qx.js \ + --use-tree-compiler --add-new-lines --add-file-ids \ --copy-resources \ --resource-input $(FRAMEWORK)/source/resource \ --resource-output build/resource \ Modified: trunk/qooxdoo/frontend/framework/tool/generator/modules/treecompiler.py =================================================================== --- trunk/qooxdoo/frontend/framework/tool/generator/modules/treecompiler.py 2006-08-31 13:01:11 UTC (rev 4082) +++ trunk/qooxdoo/frontend/framework/tool/generator/modules/treecompiler.py 2006-08-31 13:02:27 UTC (rev 4083) @@ -4,6 +4,9 @@ import config, tokenizer, filetool +KEY = re.compile("^[A-Za-z0-9_]+$") + + def indentPrint(level, text): print "%s%s" % (" " * level, text) @@ -102,9 +105,17 @@ elif node.type == "keyvalue": keyString = node.get("key") + keyQuote = node.get("quotation", False) - if "-" in keyString or keyString in config.JSPROTECTED: - # print "PROTECT: %s" % keyString + if keyQuote != None: + # print "USE QUOTATION" + if keyQuote == "doublequotes": + keyString = '"' + keyString + '"' + else: + keyString = "'" + keyString + "'" + + elif keyString in config.JSPROTECTED or not KEY.match(keyString): + print "ATTENTION: Auto protect key: %s" % keyString keyString = "\"" + keyString + "\"" compString += keyString + ":" @@ -219,9 +230,9 @@ childrenNumber += 1 previousType = None - separators = [ "assignment", "call", "operation", "definition", "definitionGroup", "return", "loop", "switch", "break", "continue", "default", "case", "delete", "accessor" ] + separators = [ "assignment", "call", "operation", "definition", "definitionGroup", "return", "loop", "switch", "break", "continue", "default", "case", "delete", "accessor", "instantiation", "throw" ] not_after = [ "case", "default" ] - not_in = [ "definitionGroup" ] + not_in = [ "definitionGroup", "params", "variable", "array" ] @@ -282,13 +293,10 @@ elif not node.type in not_in: if previousType in separators and child.type in separators: if not previousType in not_after: - if not (previousType == "accessor" and child.type == "accessor"): - if not child.parent.type == "array": - compString += ";" - #compString += ";EXEC[%s];" % child.type + compString += ";/*[Parent:%s|Previous:%s|Child:%s]*/" % (node.type, previousType, child.type) - if enableNewLines: - compString += "\n" + if enableNewLines: + compString += "\n" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |