Upload Tizen2.0a sources. 2.0alpha master 2.0_alpha
authorWoongsik Choi <woongsik76.choi@samsung.com>
Tue, 18 Sep 2012 09:55:10 +0000 (18:55 +0900)
committerWoongsik Choi <woongsik76.choi@samsung.com>
Tue, 18 Sep 2012 09:55:10 +0000 (18:55 +0900)
Change-Id: I227a79a3903bda6a113f9cf99f53dd3057a8b4d7

48 files changed:
AUTHOR [new file with mode: 0644]
COPYING [new file with mode: 0644]
LICENSE [new file with mode: 0644]
NOTICE [new file with mode: 0644]
builder/build.properties.clean [new file with mode: 0644]
builder/customTargets.xml [new file with mode: 0644]
org.tizen.web.assignmenttracing.feature/.project [new file with mode: 0644]
org.tizen.web.assignmenttracing.feature/build.properties [new file with mode: 0644]
org.tizen.web.assignmenttracing.feature/feature.properties [new file with mode: 0644]
org.tizen.web.assignmenttracing.feature/feature.xml [new file with mode: 0644]
org.tizen.web.assignmenttracing.tests/.classpath [new file with mode: 0644]
org.tizen.web.assignmenttracing.tests/.project [new file with mode: 0644]
org.tizen.web.assignmenttracing.tests/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
org.tizen.web.assignmenttracing.tests/META-INF/MANIFEST.MF [new file with mode: 0644]
org.tizen.web.assignmenttracing.tests/build.properties [new file with mode: 0644]
org.tizen.web.assignmenttracing.tests/src/org/tizen/web/assignmenttracing/tests/AssignmentTracingTest.java [new file with mode: 0644]
org.tizen.web.assignmenttracing/.classpath [new file with mode: 0644]
org.tizen.web.assignmenttracing/.project [new file with mode: 0644]
org.tizen.web.assignmenttracing/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
org.tizen.web.assignmenttracing/META-INF/MANIFEST.MF [new file with mode: 0644]
org.tizen.web.assignmenttracing/build.properties [new file with mode: 0644]
org.tizen.web.assignmenttracing/contexts.xml [new file with mode: 0644]
org.tizen.web.assignmenttracing/fragment.xml [new file with mode: 0644]
org.tizen.web.assignmenttracing/icons/duchain.gif [new file with mode: 0644]
org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/CFGBuilder.java [new file with mode: 0644]
org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/CFGNode.java [new file with mode: 0644]
org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/ChainBuilder.java [new file with mode: 0644]
org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/DeclNode.java [new file with mode: 0644]
org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/DefNode.java [new file with mode: 0644]
org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/SkipNode.java [new file with mode: 0644]
org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/TrySkipNode.java [new file with mode: 0644]
org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/UseNode.java [new file with mode: 0644]
org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/environment/CatchElement.java [new file with mode: 0644]
org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/environment/EnvironmentElement.java [new file with mode: 0644]
org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/environment/EnvironmentStack.java [new file with mode: 0644]
org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/environment/LabeledStmtElement.java [new file with mode: 0644]
org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/environment/LoopElement.java [new file with mode: 0644]
org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/environment/NotInterestingElement.java [new file with mode: 0644]
org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/environment/SwitchElement.java [new file with mode: 0644]
org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/environment/TryElement.java [new file with mode: 0644]
org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/exceptions/TracingCancelException.java [new file with mode: 0644]
org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/exceptions/TracingInternalErrorException.java [new file with mode: 0644]
org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/exceptions/TracingUnsupportedException.java [new file with mode: 0644]
org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/ui/AssignmentTracingUI.java [new file with mode: 0644]
org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/ui/TracingActionDelegate.java [new file with mode: 0644]
org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/ui/TracingCommandHandler.java [new file with mode: 0644]
package/build.linux [new file with mode: 0644]
package/pkginfo.manifest [new file with mode: 0644]

diff --git a/AUTHOR b/AUTHOR
new file mode 100644 (file)
index 0000000..062e045
--- /dev/null
+++ b/AUTHOR
@@ -0,0 +1,5 @@
+Woongsik Choi <woongsik76.choi@samsung.com>
+Hyukmin Kwon <hyukmin0530.kwon@samsung.com>
+Wooyoung Cho <wooyoung1.cho@samsung.com>
+Jaeheung Kim <jaeheung.kim@samsung.com>
+HyunGoo Kang <hyungoo1.kang@samsung.com>
diff --git a/COPYING b/COPYING
new file mode 100644 (file)
index 0000000..f94008a
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,206 @@
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+
+
diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..f94008a
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,206 @@
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+
+
diff --git a/NOTICE b/NOTICE
new file mode 100644 (file)
index 0000000..4c49449
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1 @@
+Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
diff --git a/builder/build.properties.clean b/builder/build.properties.clean
new file mode 100644 (file)
index 0000000..f356bf5
--- /dev/null
@@ -0,0 +1,260 @@
+###############################################################################
+# Copyright (c) 2003, 2006 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+# 
+# Contributors:
+#     IBM Corporation - initial API and implementation
+###############################################################################
+#####################
+# Parameters describing how and where to execute the build.
+# Typical users need only update the following properties:
+#    baseLocation - where things you are building against are installed
+#    bootclasspath - The base jars to compile against (typicaly rt.jar)
+#    configs - the list of {os, ws, arch} configurations to build.  
+#
+# Of course any of the settings here can be overridden by spec'ing 
+# them on the command line (e.g., -DbaseLocation=d:/eclipse
+
+#The type of the top level element we are building,  generally "feature"
+topLevelElementType=feature
+#The id of the top level element we are building
+topLevelElementId=org.tizen.web.assignmenttracing.feature
+
+############# PRODUCT/PACKAGING CONTROL #############
+#product=/com.samsung.freshide/SLPSDK.product
+#runPackager=true
+
+#Set the name of the archive that will result from the product build.
+#archiveNamePrefix=
+
+# The prefix that will be used in the generated archive.
+archivePrefix="Do not touch here."
+
+# The location underwhich all of the build output will be collected.
+collectingFolder=${archivePrefix}
+
+# The list of {os, ws, arch} configurations to build.  This 
+# value is a '&' separated list of ',' separate triples.  For example, 
+#     configs=win32,win32,x86 & linux,motif,x86
+# By default the value is *,*,*
+configs="Do not touch here."
+#configs=win32, win32, x86 & \
+#      win32,win32,x86_64 & \
+#      win32,win32,wpf & \
+#      linux, gtk, ppc & \
+#      linux, gtk, x86 & \
+#      linux, gtk, x86_64 & \
+#      linux, motif, x86 & \
+#      solaris, motif, sparc & \
+#      solaris, gtk, sparc & \
+#      aix, motif, ppc & \
+#      hpux, motif, ia64_32 & \
+#      macosx, carbon, ppc & \
+#      macosx, carbon, x86 & \
+#      macosx, cocoa, ppc & \
+#      macosx, cocoa, x86 & \
+#      macosx, cocoa, x86_64
+
+# By default PDE creates one archive (result) per entry listed in the configs property.
+# Setting this value to true will cause PDE to only create one output containing all 
+# artifacts for all the platforms listed in the configs property.
+# To control the output format for the group, add a "group, group, group - <format>" entry to the
+# archivesFormat. 
+#groupConfigurations=true
+
+#The format of the archive. By default a zip is created using antZip.
+#The list can only contain the configuration for which the desired format is different than zip.
+#archivesFormat=win32, win32, x86 - antZip& \
+#      linux, gtk, ppc - antZip &\
+#    linux, gtk, x86 - antZip& \
+#      linux, gtk, x86_64 - antZip& \
+# linux, motif, x86 - antZip& \
+#      solaris, motif, sparc - antZip& \
+#      solaris, gtk, sparc - antZip& \
+#      aix, motif, ppc - antZip& \
+#      hpux, motif, PA_RISC - antZip& \
+#      macosx, carbon, ppc - antZip
+
+#Allow cycles involving at most one bundle that needs to be compiled with the rest being binary bundles.
+allowBinaryCycles=true
+
+#Sort bundles depenedencies across all features instead of just within a given feature.
+#flattenDependencies = true
+
+#Parallel compilation, requires flattenedDependencies=true
+#parallelCompilation=true
+#parallelThreadCount=
+#parallelThreadsPerProcessor=
+       
+#Set to true if you want the output to be ready for an update jar (no site.xml generated)
+#outputUpdateJars = false
+
+#Set to true for Jnlp generation
+#codebase should be a URL that will be used as the root of all relative URLs in the output.
+#generateJnlp=false
+#jnlp.codebase=<codebase url>
+#jnlp.j2se=<j2se version>
+#jnlp.locale=<a locale>
+#jnlp.generateOfflineAllowed=true or false generate <offlineAllowed/> attribute in the generated features
+#jnlp.configs=${configs}                       #uncomment to filter the content of the generated jnlp files based on the configuration being built
+
+#Set to true if you want to sign jars
+#signJars=false
+#sign.alias=<alias>
+#sign.keystore=<keystore location>
+#sign.storepass=<keystore password>
+#sign.keypass=<key password>
+
+#Arguments to send to the zip executable
+#zipargs=
+
+#Arguments to send to the tar executable
+#tarargs=
+
+#Control the creation of a file containing the version included in each configuration - on by default 
+#generateVersionsLists=false
+
+############## BUILD NAMING CONTROL ################
+# The directory into which the build elements are fetched and where
+# the build takes place.
+buildDirectory="Do not touch here"
+
+# Type of build.  Used in naming the build output.  Typically this value is
+# one of I, N, M, S, ...
+buildType="Do not touch here"
+
+# ID of the build.  Used in naming the build output.
+buildId="Do not touch here"
+
+# Label for the build.  Used in naming the build output
+buildLabel=${buildType}.${buildId}
+
+# Timestamp for the build.  Used in naming the build output
+timestamp=007
+
+#The value to be used for the qualifier of a plugin or feature when you want to override the value computed by pde.
+#The value will only be applied to plugin or features indicating build.properties, qualifier = context 
+#forceContextQualifier=<the value for the qualifier>
+
+#Enable / disable the generation of a suffix for the features that use .qualifier. 
+#The generated suffix is computed according to the content of the feature   
+#generateFeatureVersionSuffix=true
+
+############# BASE CONTROL #############
+# Settings for the base Eclipse components and Java class libraries 
+# against which you are building.
+# Base location for anything the build needs to compile against.  For example,
+# in most RCP app or a plug-in,  the baseLocation should be the location of a previously
+# installed Eclipse against which the application or plug-in code will be compiled and the RCP delta pack.
+
+base="Do not touch here"
+baseLocation="Do not touch here"
+
+
+#Folder containing repositories whose content is needed to compile against
+#repoBaseLocation=${base}/repos
+#Folder where the content of the repositories from ${repoBaseLocation} will be made available as a form suitable to be compiled against
+#transformedRepoLocation=${base}/transformedRepos
+
+#Os/Ws/Arch/nl of the eclipse specified by baseLocation
+baseos=linux
+basews=gtk
+basearch=x86
+
+#this property indicates whether you want the set of plug-ins and features to be considered during the build to be limited to the ones reachable from the features / plugins being built
+filteredDependencyCheck=false
+
+#this property indicates whether the resolution should be done in development mode (i.e. ignore multiple bundles with singletons)
+resolution.devMode=false
+
+#pluginPath is a list of locations in which to find plugins and features.  This list is separated by the platform file separator (; or :)
+#a location is one of:  
+#- the location of the jar or folder that is the plugin or feature : /path/to/foo.jar or /path/to/foo
+#- a directory that contains a /plugins or /features subdirectory
+#- the location of a feature.xml, or for 2.1 style plugins, the plugin.xml or fragment.xml
+#pluginPath=
+
+skipBase=true
+eclipseURL=<url for eclipse download site>
+eclipseBuildId=<Id of Eclipse build to get>
+eclipseBaseURL=${eclipseURL}/eclipse-platform-${eclipseBuildId}-win32.zip
+
+
+############# MAP FILE CONTROL ################
+# This section defines CVS tags to use when fetching the map files from the repository.
+# If you want to fetch the map file from repository / location, change the getMapFiles target in the customTargets.xml
+
+skipMaps=true
+mapsRepo=:pserver:anonymous@example.com/path/to/repo
+mapsRoot=path/to/maps
+mapsCheckoutTag=HEAD
+
+#tagMaps=true
+mapsTagTag=v${buildId}
+
+
+############ REPOSITORY CONTROL ###############
+# This section defines properties parameterizing the repositories where plugins, fragments
+# bundles and features are being obtained from. 
+
+# The tags to use when fetching elements to build.
+# By default thebuilder will use whatever is in the maps.  
+# This value takes the form of a comma separated list of repository identifier (like used in the map files) and the 
+# overriding value
+# For example fetchTag=CVS=HEAD, SVN=v20050101
+# fetchTag=HEAD
+skipFetch=true
+
+
+############# P2 OPTIONS ##############
+#p2.gathering = true
+#p2.compress=true
+
+############# JAVA COMPILER OPTIONS ##############
+# The location of the Java jars to compile against.  Typically the rt.jar for your JDK/JRE
+#bootclasspath=${java.home}/lib/rt.jar
+
+# specific JRE locations to compile against. These values are used to compile bundles specifying a 
+# Bundle-RequiredExecutionEnvironment. Uncomment and set values for environments that you support
+#CDC-1.0/Foundation-1.0= /path/to/rt.jar
+#CDC-1.1/Foundation-1.1=
+#OSGi/Minimum-1.0=
+#OSGi/Minimum-1.1=
+#JRE-1.1=
+#J2SE-1.2=
+#J2SE-1.3=
+#J2SE-1.4=
+#J2SE-1.5=
+#JavaSE-1.6=
+#PersonalJava-1.1=
+#PersonalJava-1.2=
+#CDC-1.0/PersonalBasis-1.0=
+#CDC-1.0/PersonalJava-1.0=
+#CDC-1.1/PersonalBasis-1.1=
+#CDC-1.1/PersonalJava-1.1=
+
+# Specify the output format of the compiler log when eclipse jdt is used
+logExtension=.log
+
+# Whether or not to include debug info in the output jars
+javacDebugInfo=true
+
+# Whether or not to fail the build if there are compiler errors
+javacFailOnError=true
+
+# Enable or disable verbose mode of the compiler
+javacVerbose=false
+
+# Extra arguments for the compiler. These are specific to the java compiler being used.
+#compilerArg=
+
+# Default value for the version of the source code. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacSource in build.properties
+javacSource=1.6
+
+# Default value for the version of the byte code targeted. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacTarget in build.properties.
+javacTarget=1.6
+
+
diff --git a/builder/customTargets.xml b/builder/customTargets.xml
new file mode 100644 (file)
index 0000000..6a42e92
--- /dev/null
@@ -0,0 +1,187 @@
+<project name="Build specific targets and properties" default="noDefault">
+
+       <!-- ===================================================================== -->
+       <!-- Run a given ${target} on all elements being built -->
+       <!-- Add on <ant> task for each top level element being built. -->
+       <!-- ===================================================================== -->
+       <available property="allElementsFile" file="${builder}/allElements.xml" value="${builder}/allElements.xml"/>
+       <property name="allElementsFile" location="${eclipse.pdebuild.templates}/headless-build/allElements.xml"/>
+
+       <import file="${allElementsFile}" />
+       <target name="allElements">
+               <ant antfile="${genericTargets}" target="${target}">
+                       <property name="type" value="${topLevelElementType}"/>
+                       <property name="id" value="${topLevelElementId}"/>
+               </ant>
+       </target>
+
+       <target
+               name="assemble.${topLevelElementId}.linux.gtk.x86">
+               <ant antfile="{$assembleScriptName}" dir="${buildDirectory}"/>
+       </target>
+       <target
+               name="assemble.${topLevelElementId}.win32.win32.x86">
+               <ant antfile="{$assembleScriptName}" dir="${buildDirectory}"/>
+       </target>
+       
+       <!-- ===================================================================== -->
+       <!-- ===================================================================== -->
+       <target name="getBaseComponents" depends="checkLocalBase" unless="skipBase">
+               <get src="${eclipseBaseURL}" dest="${buildDirectory}/../temp-base.zip" />
+               <unzip dest="${base}" overwrite="true" src="${buildDirectory}/../temp-base.zip" />
+       </target>
+
+       <target name="checkLocalBase">
+               <available file="${base}" property="skipBase" />
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Check out map files from correct repository -->
+       <!-- Replace values for mapsCheckoutTag as desired. -->
+       <!-- ===================================================================== -->
+       <target name="getMapFiles" depends="checkLocalMaps" unless="skipMaps">
+               <property name="mapsCheckoutTag" value="HEAD" />
+               <cvs cvsRoot="${mapsRepo}" package="${mapsRoot}" dest="${buildDirectory}/maps" tag="${mapsCheckoutTag}" />
+       </target>
+
+       <target name="checkLocalMaps">
+               <available property="skipMaps" file="${buildDirectory}/maps" />
+       </target>
+
+       <target name="tagMapFiles" if="tagMaps">
+               <cvs dest="${buildDirectory}/maps/${mapsRoot}" command="tag ${mapsTagTag}" />
+       </target>
+
+       <!-- ===================================================================== -->
+
+       <target name="clean" unless="noclean">
+               <antcall target="allElements">
+                       <param name="target" value="cleanElement" />
+               </antcall>
+       </target>
+
+       <target name="gatherLogs">
+               <mkdir dir="${buildDirectory}/${buildLabel}/compilelogs" />
+               <antcall target="allElements">
+                       <param name="target" value="gatherLogs" />
+               </antcall>
+               <unzip dest="${buildDirectory}/${buildLabel}/compilelogs" overwrite="true">
+                       <fileset dir="${buildDirectory}/features">
+                               <include name="**/*.log.zip" />
+                       </fileset>
+               </unzip>
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do before setup -->
+       <!-- ===================================================================== -->
+       <target name="preSetup">
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do after setup but before starting the build proper -->
+       <!-- ===================================================================== -->
+       <target name="postSetup">
+               <antcall target="getBaseComponents" />
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do before fetching the build elements -->
+       <!-- ===================================================================== -->
+       <target name="preFetch">
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do after fetching the build elements -->
+       <!-- ===================================================================== -->
+       <target name="postFetch">
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do before the repositories are being processed -->
+       <!-- ===================================================================== -->
+       <target name="preProcessRepos">
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do after the repositories have been processed -->
+       <!-- ===================================================================== -->
+       <target name="postProcessRepos">
+       </target>
+       
+       <!-- ===================================================================== -->
+       <!-- Steps to do before generating the build scripts. -->
+       <!-- ===================================================================== -->
+       <target name="preGenerate">
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do after generating the build scripts. -->
+       <!-- ===================================================================== -->
+       <target name="postGenerate">
+               <antcall target="clean" />
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do before running the build.xmls for the elements being built. -->
+       <!-- ===================================================================== -->
+       <target name="preProcess">
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do after running the build.xmls for the elements being built. -->
+       <!-- ===================================================================== -->
+       <target name="postProcess">
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do before running assemble. -->
+       <!-- ===================================================================== -->
+       <target name="preAssemble">
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do after  running assemble. -->
+       <!-- ===================================================================== -->
+       <target name="postAssemble">
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do before running package. -->
+       <!-- ===================================================================== -->
+       <target name="prePackage">
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do after  running package. -->
+       <!-- ===================================================================== -->
+       <target name="postPackage">
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do after the build is done. -->
+       <!-- ===================================================================== -->
+       <target name="postBuild">
+               <antcall target="gatherLogs" />
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do to test the build results -->
+       <!-- ===================================================================== -->
+       <target name="test">
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do to publish the build results -->
+       <!-- ===================================================================== -->
+       <target name="publish">
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Default target                                                        -->
+       <!-- ===================================================================== -->
+       <target name="noDefault">
+               <echo message="You must specify a target when invoking this file" />
+       </target>
+
+</project>
diff --git a/org.tizen.web.assignmenttracing.feature/.project b/org.tizen.web.assignmenttracing.feature/.project
new file mode 100644 (file)
index 0000000..7fe1403
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>org.tizen.web.assignmenttracing.feature</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.pde.FeatureBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.FeatureNature</nature>
+       </natures>
+</projectDescription>
diff --git a/org.tizen.web.assignmenttracing.feature/build.properties b/org.tizen.web.assignmenttracing.feature/build.properties
new file mode 100644 (file)
index 0000000..b3a611b
--- /dev/null
@@ -0,0 +1,2 @@
+bin.includes = feature.xml,\
+               feature.properties
diff --git a/org.tizen.web.assignmenttracing.feature/feature.properties b/org.tizen.web.assignmenttracing.feature/feature.properties
new file mode 100644 (file)
index 0000000..e4a1767
--- /dev/null
@@ -0,0 +1,53 @@
+###############################################################################
+# Copyright (C) 2000 - 2011 Samsung Electronics Co., Ltd.
+# All rights reserved. This program and the accompanying materials 
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+# 
+# Contributors:
+#      S-Core Co., Ltd
+###############################################################################
+# feature.properties
+# contains externalized strings for feature.xml
+# "%foo" in feature.xml corresponds to the key "foo" in this file
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file should be translated.
+
+# "featureName" property - name of the feature
+featureName=Tizen Assignment Tracing for JavaScript
+
+# "providerName" property - name of the company that provides the feature
+providerName=Samsung Electronics
+
+# "updateSiteName" property - label for the update site
+updateSiteName=Tizen Assignment Tracing Updates
+
+# "description" property - description of the feature
+description=Tizen Assignment Tracing for JavaScript.
+       14            %copyright
+       15         </copyright>
+# "copyright" property
+copyrightURL=https://developer.tizen.org
+copyright=Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd.\n\
+All rights reserved.\n
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=\
+Tizen SDK\n\
+\n\
+Tizen SDK contains software portions licensed under various open source licenses as well as proprietary components.  All open source software portions ("Open Source Software") are licensed under the open source licenses that accompany such Open Source Software.\n\
+ \n\
+The licenses governing the Open Source Software are available at: http://developer.tizen.org/download/tizen_sdk_opensource_license.html\n\
+ \n\
+Except for the Open Source Software contained in Tizen SDK, all other software portions contained in Tizen SDK are governed by the terms and conditions of the Tizen Software Development Kit License Agreement, available at: http://developer.tizen.org/download/samsung_sdk_license.html\n\
+ \n\
+You may access and download Tizen SDK Open Source Software at: http://developer.tizen.org/download/tizenopensdk.tar.gz\n\
+ \n\
+BY CLICKING THE "I AGREE" BUTTON OR BY USING ANY PART OF TIZEN SDK, YOU AGREE (ON BEHALF OF YOURSELF AND/OR YOUR COMPANY) TO THE OPEN SOURCE SOFTWARE LICENSE TERMS AND THE TIZEN SOFTWARE DEVELOPMENT KIT LICENSE AGREEMENT. IF YOU DO NOT AGREE WITH THE OPEN SOURCE SOFTWARE LICENSE TERMS OR THE TIZEN SOFTWARE DEVELOPMENT KIT LICENSE AGREEMENT, YOU MAY NOT DOWNLOAD OR USE TIZEN SDK.\n
+########### end of license property ##########################################
diff --git a/org.tizen.web.assignmenttracing.feature/feature.xml b/org.tizen.web.assignmenttracing.feature/feature.xml
new file mode 100644 (file)
index 0000000..1bb4803
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+      id="org.tizen.web.assignmenttracing.feature"
+      label="Tizen Assignment Tracing for JavaScript"
+      version="1.0.0.qualifier"
+      provider-name="Samsung Electronics"
+      plugin="org.tizen.base.platform"
+      license-feature="org.tizen.base.feature">
+
+   <description>
+      %description
+   </description>
+
+   <copyright>
+      %copyright
+   </copyright>
+
+   <license url="">
+      %license
+   </license>
+
+   <requires>
+      <import plugin="org.eclipse.wst.jsdt.ui"/>
+   </requires>
+
+   <plugin
+         id="org.tizen.web.assignmenttracing"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         fragment="true"
+         unpack="false"/>
+
+</feature>
diff --git a/org.tizen.web.assignmenttracing.tests/.classpath b/org.tizen.web.assignmenttracing.tests/.classpath
new file mode 100644 (file)
index 0000000..f37d8f7
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+       <classpathentry combineaccessrules="false" kind="src" path="/org.tizen.web.assignmenttracing"/>
+       <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.tizen.web.assignmenttracing.tests/.project b/org.tizen.web.assignmenttracing.tests/.project
new file mode 100644 (file)
index 0000000..170a0c6
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>org.tizen.web.assignmenttracing.tests</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.ManifestBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.SchemaBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+       </natures>
+</projectDescription>
diff --git a/org.tizen.web.assignmenttracing.tests/.settings/org.eclipse.jdt.core.prefs b/org.tizen.web.assignmenttracing.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..c537b63
--- /dev/null
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/org.tizen.web.assignmenttracing.tests/META-INF/MANIFEST.MF b/org.tizen.web.assignmenttracing.tests/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..41af812
--- /dev/null
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Tests for JavaScript Assignment Tracing
+Bundle-SymbolicName: org.tizen.web.assignmenttracing.tests
+Bundle-Version: 1.0.0.qualifier
+Bundle-Vendor: Samsung
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: org.eclipse.core.resources,
+ org.eclipse.core.runtime;version="3.4.0"
+Require-Bundle: org.eclipse.wst.jsdt.core
diff --git a/org.tizen.web.assignmenttracing.tests/build.properties b/org.tizen.web.assignmenttracing.tests/build.properties
new file mode 100644 (file)
index 0000000..aaefddf
--- /dev/null
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               bin/
diff --git a/org.tizen.web.assignmenttracing.tests/src/org/tizen/web/assignmenttracing/tests/AssignmentTracingTest.java b/org.tizen.web.assignmenttracing.tests/src/org/tizen/web/assignmenttracing/tests/AssignmentTracingTest.java
new file mode 100644 (file)
index 0000000..c9a19bb
--- /dev/null
@@ -0,0 +1,6400 @@
+/*
+ * Program Understanding / Assignment Tracing for JavaScript
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyukmin Kwon <hyukmin0530@samsung.com>
+ * Wooyoung Cho <wooyoung1.cho@samsung.com>
+ * Jaeheung Kim <jaeheung.kim@samsung.com>
+ * Woongsik Choi <woongsik76.choi@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+
+package org.tizen.web.assignmenttracing.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.wst.jsdt.core.compiler.CategorizedProblem;
+import org.eclipse.wst.jsdt.core.dom.AST;
+import org.eclipse.wst.jsdt.core.dom.JavaScriptUnit;
+import org.eclipse.wst.jsdt.core.dom.SimpleName;
+import org.eclipse.wst.jsdt.internal.compiler.CompilationResult;
+import org.eclipse.wst.jsdt.internal.compiler.DefaultErrorHandlingPolicies;
+import org.eclipse.wst.jsdt.internal.compiler.IProblemFactory;
+import org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration;
+import org.eclipse.wst.jsdt.internal.compiler.env.INameEnvironment;
+import org.eclipse.wst.jsdt.internal.compiler.env.NameEnvironmentAnswer;
+import org.eclipse.wst.jsdt.internal.compiler.impl.CompilerOptions;
+import org.eclipse.wst.jsdt.internal.compiler.impl.ITypeRequestor;
+import org.eclipse.wst.jsdt.internal.compiler.impl.ReferenceContext;
+import org.eclipse.wst.jsdt.internal.compiler.lookup.LookupEnvironment;
+import org.eclipse.wst.jsdt.internal.compiler.parser.Parser;
+import org.eclipse.wst.jsdt.internal.compiler.problem.DefaultProblemFactory;
+import org.eclipse.wst.jsdt.internal.compiler.problem.ProblemReporter;
+import org.eclipse.wst.jsdt.internal.core.CompilationUnit;
+import org.eclipse.wst.jsdt.internal.core.DefaultWorkingCopyOwner;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.tizen.web.assignmenttracing.core.CFGBuilder;
+import org.tizen.web.assignmenttracing.core.CFGNode;
+import org.tizen.web.assignmenttracing.core.ChainBuilder;
+import org.tizen.web.assignmenttracing.core.exceptions.TracingUnsupportedException;
+import org.tizen.web.assignmenttracing.ui.AssignmentTracingUI;
+
+
+/**
+* JUnit tests for Assignment Tracing for JavaScript(DU-chain and UD-chain).
+*
+* The input test case marks 'def' as '@d' and 'use' as '@u' and 'def' + 'use' as '@m'
+* and the interesting variable as '$'.
+*
+* <code>extractSourceAndMarkers</code> method extracts these marks from the test case.
+* And the <code>buildAndCheck</code> method computes DU-chain and UD-chain and compares them with given marks.
+*
+* @author Hyukmin Kwon <hyukmin0530@samsung.com>
+* @author Wooyoung Cho <wooyoung1.cho@samsung.com>
+* @author Jaeheung Kim <jaeheung.kim@samsung.com>
+*/
+@SuppressWarnings("restriction")
+public class AssignmentTracingTest {
+
+       private JavaScriptUnit ast;
+       private CFGBuilder cfgBuilder;
+       private ChainBuilder chainBuilder;
+       private List<CFGNode> selNodes;
+
+       private ArrayList<SimpleName> duChainMarks;
+       private ArrayList<SimpleName> udChainMarks;
+       private ArrayList<Integer> duChainOffsets;
+       private ArrayList<Integer> udChainOffsets;
+       private int selOffset;
+       private SimpleName selName;
+
+       @BeforeClass
+       public static void setUpBeforeClass() throws Exception {
+       }
+
+       @AfterClass
+       public static void tearDownAfterClass() throws Exception {
+       }
+
+       @Before
+       public void setUp() throws Exception {
+       }
+
+       @After
+       public void tearDown() throws Exception {
+       }
+
+       @Test
+       public void testSelection_undeclared_global_0()
+       {
+               String code = "function f() { $g; }";
+               assertNotInteresting(code);
+       }
+
+       @Test
+       public void testSelection_undeclared_global_1()
+       {
+               String code = "function f() { $g(); }";
+               assertNotInteresting(code);
+       }
+
+       @Test
+       public void testSelection_declared_global_0()
+       {
+               String code = "var g; function f() { $g; }";
+               assertNotInteresting(code);
+       }
+
+       @Test
+       public void testSelection_declared_global_1()
+       {
+               String code = "function g() {}; function f() { $f; }";
+               assertNotInteresting(code);
+       }
+
+       @Test
+       public void testSelection_declared_global_2()
+       {
+               String code = "function g() {}; function f() { $g; }";
+               assertNotInteresting(code);
+       }
+
+       @Test
+       public void testSelection_local_function_0()
+       {
+               String code =
+                               "function f() { " +
+                               "  function local_fun() {} " +
+                               "  $local_fun; " +
+                               "}";
+               assertNotInteresting(code);
+       }
+
+       @Test
+       public void testSelection_local_function_var_0()
+       {
+               String code =
+                               "function f() { " +
+                               "  var local_fun_var = function() {}; " +
+                               "  $local_fun_var; " +
+                               "}";
+               assertInteresting(code);
+       }
+
+       @Test
+       public void testSelection_local_function_var_1()
+       {
+               String code =
+                               "var fun = function f() { " +
+                               "  var local_fun_var = function() {}; " +
+                               "  $local_fun_var; " +
+                               "}";
+               assertInteresting(code);
+       }
+
+       @Test
+       public void testSelection_in_anonymous_function_0()
+       {
+               String code = "function () { var a; $a; }";
+               assertInteresting(code);
+       }
+
+       @Test
+       public void testSelection_in_nested_function_0()
+       {
+               String code =
+                               "function f() { " +
+                               "  function local_fun() {" +
+                               "    var local;" +
+                               "    $local;" +
+                               "  } " +
+                               "}";
+               assertInteresting(code);
+       }
+
+       @Test
+       public void testSelection_outer_local_var_0()
+       {
+               String code =
+                               "function f() {" +
+                               "  var outer;" +
+                               "  function local_fun() {" +
+                               "    $outer;" +
+                               "  } " +
+                               "}";
+               assertNotInteresting(code);
+       }
+
+       @Test
+       public void testSelection_unused_in_closure_0()
+       {
+               String code =
+                               "function f() {" +
+                               "  var outer;" +
+                               "  function local_fun() {" +
+                               "  }" +
+                               "  $outer;" +
+                               "}";
+               assertInteresting(code);
+       }
+
+       @Test
+       public void testSelection_use_in_closure_0()
+       {
+               String code =
+                               "function f() {" +
+                               "  var outer;" +
+                               "  function local_fun() {" +
+                               "    outer;" +
+                               "  }" +
+                               "  $outer;" +
+                               "}";
+               assertFalse(isUnSupportedExceptionOccurred(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSelection_use_in_closure_1()
+       {
+               String code =
+                               "function f() {" +
+                               "  var outer;" +
+                               "  var local_fun = function() {" +
+                               "    outer;" +
+                               "  }" +
+                               "  $outer;" +
+                               "}";
+               assertFalse(isUnSupportedExceptionOccurred(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSelection_def_in_closure_0()
+       {
+               String code =
+                               "function f() {" +
+                               "  var outer;" +
+                               "  function local_fun() {" +
+                               "    outer = 0;" +
+                               "  }" +
+                               "  $outer;" +
+                               "}";
+               assertTrue(isUnSupportedExceptionOccurred(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSelection_def_in_closure_1()
+       {
+               String code =
+                               "function f() {" +
+                               "  var outer;" +
+                               "  var local_fun = function() {" +
+                               "    outer = 0;" +
+                               "  }" +
+                               "  $outer;" +
+                               "}";
+               assertTrue(isUnSupportedExceptionOccurred(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSelection_unused_in_with_0()
+       {
+               String code =
+                               "function f() {" +
+                               "  var outer;" +
+                               "  with(o) {}" +
+                               "  $outer;" +
+                               "}";
+               assertInteresting(code);
+       }
+
+       @Test
+       public void testSelection_used_in_with_0()
+       {
+               String code =
+                               "function f() {" +
+                               "  var outer;" +
+                               "  with(o) { outer; }" +
+                               "  $outer;" +
+                               "}";
+               assertTrue(isUnSupportedExceptionOccurred(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSelection_label_0()
+       {
+               String code =
+                               "function f() {" +
+                               "  var v;" +
+                               "  $v:;" +
+                               "}";
+               assertNotInteresting(code);
+       }
+
+       @Test
+       public void testSelection_label_1()
+       {
+               String code =
+                               "function f() {" +
+                               "  var v;" +
+                               "  v: break $v;" +
+                               "}";
+               assertNotInteresting(code);
+       }
+
+       @Test
+       public void testUnsupportedExcetion_label_0()
+       {
+               String code =
+                               "function f1() {" +
+                               "  var f2 = function(){" +
+                               "    v:for(var i = 0; i < 10; i++) {" +
+                               "               if (i>5) break v;" +
+                               "    }" +
+                               "  }" +
+                               "  var $v = 0;" +
+                               "}";
+               assertFalse(isUnSupportedExceptionOccurred(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testUnsupportedExcetion_label_1()
+       {
+               String code =
+                               "function f1() {" +
+                               "  var f2 = function(u){" +
+                               "    with(u){" +
+                               "      v:for(var i = 0; i < 10; i++) {" +
+                               "                 if (i>5) break v;" +
+                               "      }" +
+                               "    }" +
+                               "  }" +
+                               "  var $v = 0;" +
+                               "}";
+               assertFalse(isUnSupportedExceptionOccurred(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testUnsupportedExcetion_label_2()
+       {
+               String code =
+                               "function f1() {" +
+                               "  var f2 = function(){" +
+                               "    v:for(var i = 0; i < 10; i++) {" +
+                               "               if (i>5) continue v;" +
+                               "    }" +
+                               "  }" +
+                               "  var $v = 0;" +
+                               "}";
+               assertFalse(isUnSupportedExceptionOccurred(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testUnsupportedExcetion_label_3()
+       {
+               String code =
+                               "function f1() {" +
+                               "  var f2 = function(u){" +
+                               "    with(u){" +
+                               "      v:for(var i = 0; i < 10; i++) {" +
+                               "                 if (i>5) continue v;" +
+                               "      }" +
+                               "    }" +
+                               "  }" +
+                               "  var $v = 0;" +
+                               "}";
+               assertFalse(isUnSupportedExceptionOccurred(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testUnsupportedExcetion_object_literal_0()
+       {
+               String code =
+                               "function f1(v) {" +
+                               "  var f2 = function(){" +
+                               "    var o1 = {v:1};" +
+                               "  }" +
+                               "  $v = 0;" +
+                               "}";
+               assertFalse(isUnSupportedExceptionOccurred(extractSourceAndMarkers(code)));
+       }
+
+
+       @Test
+       public void testUnsupportedExcetion_object_literal_1()
+       {
+               String code =
+                               "function f1(v) {" +
+                               "  var f2 = function(u){" +
+                               "    with(u){" +
+                               "      var o1 = {v:1};" +
+                               "    }" +
+                               "  }" +
+                               "  $v = 0;" +
+                               "}";
+               assertFalse(isUnSupportedExceptionOccurred(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testUnsupportedExcetion_object_literal_2()
+       {
+               String code =
+                               "function f1(v) {" +
+                               "  var f2 = function(){" +
+                               "    var o1 = {x: v + 1};" +
+                               "  }" +
+                               "  $v = 0;" +
+                               "}";
+               assertFalse(isUnSupportedExceptionOccurred(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testUnsupportedExcetion_object_literal_3()
+       {
+               String code =
+                               "function f1(v) {" +
+                               "  var f2 = function(u){" +
+                               "    with(u){" +
+                               "      var o1 = {x:v + 1};" +
+                               "    }" +
+                               "  }" +
+                               "  $v = 0;" +
+                               "}";
+               assertTrue(isUnSupportedExceptionOccurred(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testUnsupportedExcetion_field_access_0()
+       {
+               String code =
+                               "function f1(v) {" +
+                               "  var f2 = function(o1){" +
+                               "    var o1v = o1.v;" +
+                               "  }" +
+                               "  $v = 0;" +
+                               "}";
+               assertFalse(isUnSupportedExceptionOccurred(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testUnsupportedExcetion_field_access_1()
+       {
+               String code =
+                               "function f1(v) {" +
+                               "  var f2 = function(o1){" +
+                               "    with (o1){" +
+                               "      var o1v = v;" +
+                               "    }" +
+                               "  }" +
+                               "  $v = 0;" +
+                               "}";
+               assertTrue(isUnSupportedExceptionOccurred(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testUnsupportedExcetion_field_access_2()
+       {
+               String code =
+                               "function f1(v) {" +
+                               "  var f2 = function(o1){" +
+                               "    with (o1){" +
+                               "      var o1v = o1.v;" +
+                               "    }" +
+                               "  }" +
+                               "  $v = 0;" +
+                               "}";
+               assertFalse(isUnSupportedExceptionOccurred(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testUnsupportedExcetion_field_access_3()
+       {
+               String code =
+                               "function f1(v) {" +
+                               "  var f2 = function(){" +
+                               "    var vx = v.x;" +
+                               "  }" +
+                               "  $v = {x:10};" +
+                               "}";
+               assertFalse(isUnSupportedExceptionOccurred(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testUnsupportedExcetion_field_access_4()
+       {
+               String code =
+                               "function f1(v) {" +
+                               "  var f2 = function(u){" +
+                               "    with(u){" +
+                               "      var vx = v.x;" +
+                               "    }" +
+                               "  }" +
+                               "  $v = {x:10};" +
+                               "}";
+               assertTrue(isUnSupportedExceptionOccurred(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testUnsupportedExcetion_single_var_declaration_0()
+       {
+               String code =
+                               "function f1(v) {" +
+                               "  var f2 = function(v){" +
+                               "    var x = v;" +
+                               "  }" +
+                               "  $v = 0;" +
+                               "}";
+               assertFalse(isUnSupportedExceptionOccurred(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testUnsupportedExcetion_single_var_declaration_1()
+       {
+               String code =
+                               "function f1(v) {" +
+                               "  var f2 = function(v, u){" +
+                               "    with(u){" +
+                               "      var x = v;" +
+                               "    }" +
+                               "  }" +
+                               "  $v = 0;" +
+                               "}";
+               assertTrue(isUnSupportedExceptionOccurred(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testUnsupportedExcetion_assign_0()
+       {
+               String code =
+                               "function f1() {" +
+                               "  var $v = 0;" +
+                               "  var f2 = function(x){" +
+                               "     v = x;" +
+                               "  }" +
+                               "}";
+               assertTrue(isUnSupportedExceptionOccurred(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testUnsupportedExcetion_assign_1()
+       {
+               String code =
+                               "function f1() {" +
+                               "  var $v = 0;" +
+                               "  var f2 = function(x){" +
+                               "    x = v;" +
+                               "  }" +
+                               "}";
+               assertFalse(isUnSupportedExceptionOccurred(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testUnsupportedExcetion_unused_in_with_0()
+       {
+               String code =
+                               "function f() {" +
+                               "  var outer;" +
+                               "  with(o) {}" +
+                               "  $outer;" +
+                               "}";
+               assertFalse(isUnSupportedExceptionOccurred(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testUnsupportedExcetion_used_in_with_0()
+       {
+               String code =
+                               "function f() {" +
+                               "  var outer;" +
+                               "  with(o) { outer; }" +
+                               "  $outer;" +
+                               "}";
+               assertTrue(isUnSupportedExceptionOccurred(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testUnsupportedExcetion_unreachable_selection_01()
+       {
+               String code =
+                               "function fx() "+
+                               "{                                               "+
+                               "       var x = -1;                  "+
+                               "       while(1) {                       "+
+                               "               x++;                 "+
+                               "               while(1) {               "+
+                               "                       x = 1;       "+
+                               "                       continue;        "+
+                               "           $x;          "+
+                               "               }                                "+
+                               "               x;                           "+
+                               "       }                                        "+
+                               "}                       ";
+               assertTrue(isUnSupportedExceptionOccurred(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testUnsupportedExcetion_unreachable_selection_02()
+       {
+               String code =
+                               "function fx()      "+
+                               "{                                      "+
+                               "       var x = 5;              "+
+                               "       return (x=x+1); "+
+                               "       $x;                         "+
+                               "}                                      ";
+               assertTrue(isUnSupportedExceptionOccurred(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testUnsupportedExcetion_unreachable_selection_03()
+       {
+               String code =
+                               "function fx()                                          "+
+                               "{                                                                      "+
+                               "       for(var x = 0; x < 10; x++) {   "+
+                               "               try {                                           "+
+                               "                       x = x * 2;                              "+
+                               "                       throw x;                                "+
+                               "                       $x = 0;                                 "+
+                               "               } catch(e) {                            "+
+                               "                       x;                                              "+
+                               "                       break;                                  "+
+                               "                       x;                                              "+
+                               "               } finally {                                     "+
+                               "                         x;                                    "+
+                               "               }                                                       "+
+                               "               x;                                              "+
+                               "       }                                                               "+
+                               "}                                                                      ";      
+               assertTrue(isUnSupportedExceptionOccurred(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testUnsupportedExcetion_unreachable_selection_04()
+       {
+               String code =
+                               "function fx()    "+
+                               "{                "+
+                               "   var x = 1;    "+
+                               "   for( ; ; )    "+
+                               "     x = x + 1;  "+
+                               "   x = $x + 1;   "+
+                               "}                ";
+               assertTrue(isUnSupportedExceptionOccurred(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testAssignmentExpr1()
+       {
+               String code =
+                               "function f() {" +
+                               "  var i = 0;" +
+                               "  var a = [5,5,5];" +
+                               "  a[@di++]= $i;" +
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testAssignmentExpr2()
+       {
+               String code =
+                               "function f() {" +
+                               "  var @di = 0;" +
+                               "  var a = $i + 1;" +
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testAssignmentExpr3() {
+               String code =
+                               "function f() {    "+
+                               "   var $x = 0;    "+
+                               "   x = @ux + 1;   "+
+                               "   x;             "+
+                               "}                 ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testAssignmentExpr4() {
+               String code =
+                               "function f() {     "+
+                               "   var @dx = 0;    "+
+                               "   x = $x;         "+
+                               "}                  ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testAssignmentExpr5() {
+               String code =
+                               "function f() {           "+
+                               "   var x = 0,@dy=0,z;    "+
+                               "   x = $y;               "+
+                               "}                        ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testAssignmentExpr6() {
+               String code =
+                               "function f() {           "+
+                               "   var x = 0, y=0,$z;    "+
+                               "   x = @uz;              "+
+                               "}                        ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testAssignmentExpr7() {
+               String code =
+                               "function f() {                 "+
+                               "       var $that = this;               "+
+                               "       @uthat.a = 10;                  "+
+                               "       @uthat.a;                                       "+
+                               "       that = 10;                              "+
+                               "       that.scrollWidth = that.wrapper.clientWidth; "+
+                               "       that.directionX = 0;    "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testAssignmentExpr8() {
+               String code =
+                               "function f() {                 "+
+                               "       var $that = this;               "+
+                               "       @uthat.a = 10;                  "+
+                               "       @uthat.a;                                       "+
+                               "       @uthat.scrollWidth = @uthat.wrapper.clientWidth; "+
+                               "       @uthat.directionX = 0;  "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testAssignmentExpr9() {
+               String code =
+                               "function f(x,y,z) {            "+
+                               "       x=@dy=z=0;                              "+
+                               "       x+$y+z;                                 "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testAssignmentExpr10() {
+               String code =
+                               "function f(x,y,z) {            "+
+                               "       x=y=@dz=0;                              "+
+                               "       x+y+$z;                                 "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testAssignmentExpr11() {
+               String code =
+                               "function f(x,y,z) {            "+
+                               "       @dx=y=z=0;                              "+
+                               "       $x+y+z;                                 "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testAssignmentExpr12() {
+               String code =
+                               "function f(z) {                "+
+                               "       var @dx = 0;                    "+
+                               "       $x += 1;                                " +
+                               "       z = @ux + 1;                    "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testAssignmentExpr13() {
+               String code =
+                               "function f(z) {                "+
+                               "       var $x = 0;                             "+
+                               "       @ux += 1;                               " +
+                               "       z = x + 1;                              "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testAssignmentExpr14() {
+               String code =
+                               "function f(z) {                "+
+                               "       var x = 0;                              "+
+                               "       @dx += 1;                               " +
+                               "       z = $x + 1;                             "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testInfixExpr1()
+       {
+               String code =
+                               "function f(a) {" +
+                               "  var i = 0;" +
+                               "  if ((++a > 0) || ( ++@da < -10) || ($a == 5)) {" +
+                               "    i++;" +
+                               "  }" +
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testInfixExpr2()
+       {
+               String code =
+                               "function f(a) {" +
+                               "  if ((++@da > 10) || ( ++@da < -10) || (++@da == 5)) {" +
+                               "    $a++;" +
+                               "  }" +
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testInfixExpr3()
+       {
+               String code =
+                               "function f(a) {" +
+                               "  if ((++@da > 10) && ( ++@da < -10) && (++@da == 5)) {" +
+                               "    $a++;" +
+                               "  }" +
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testInfixExpr4()
+       {
+               String code =
+                               "function f(a) {" +
+                               "  return ++@da + ++@m$a + ++@ua;" +
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testInfixExpr5()
+       {
+               String code =
+                               "function f(@dx,y) {         "+
+                               "  if( $x instanceof y ) {   "+
+                               "     x = y;                "+
+                               "  }                        "+
+                               "}                          ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testInfixExpr6()
+       {
+               String code =
+                               "function f(x,$y) {         "+
+                               "  if( x instanceof @uy ) {   "+
+                               "     x = @uy;                "+
+                               "  }                        "+
+                               "}                          ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testPrefixExpr1()
+       {
+               String code =
+                               "function f() {" +
+                               "  var @di = 0;" +
+                               "  var a = [5,5,5];" +
+                               "  a[++@m$i]= @ui" +
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testPostfixExpr1()
+       {
+               String code =
+                               "function f() {" +
+                               "  var @di = 0;" +
+                               "  var a = [5,5,5];" +
+                               "  a[$i++]= @ui" +
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testFunctionInvocationExpr1()
+       {
+               String code =
+                               "function g(a, b, c) {" +
+                               "  return a + b + c;" +
+                               "}" +
+                               "function f(a) {" +
+                               "  a = g(@da++, $a++, @ua++);" +
+                               "  return a;" +
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testFunctionInvocationExpr2()
+       {
+               String code =
+                               "function g(a, b, c) {  "+
+                               "  return a + b + c;    "+
+                               "}                                              "+
+                               "function f(@da) {              "+
+                               "  a = g($a, a);                "+
+                               "  return a;                    "+
+                               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testFunctionInvocationExpr3()
+       {
+               String code =
+                               "function g(a, b, c) {  "+
+                               "  return a + b + c;    "+
+                               "}                                              "+
+                               "function f($a) {               "+
+                               "  a = g(@ua, @ua);             "+
+                               "  return a;                    "+
+                               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testParenthesizedExpr1()
+       {
+               String code =
+                               "function f() {" +
+                               "  var i = 0;" +
+                               "  var a = [5,5,5];" +
+                               "  a[((@di))++]= $i" +
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testParenthesizedExpr2()
+       {
+               String code =
+                               "function f() {" +
+                               "  var @di = 0;" +
+                               "  var a = [5,5,5];" +
+                               "  a[(($i))++]= @ui" +
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testParenthesizedExpr3()
+       {
+               String code =
+                               "function f(a, b) {" +
+                               "  var i = 0;" +
+                               "  if ((++((a)) > 10) || ( ++((@da)) < -10) || ($a == 5)) {" +
+                               "    i++;" +
+                               "  }" +
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testParenthesizedExpr4()
+       {
+               String code =
+                               "function f(b) {" +
+                               "  var $a = 0;" +
+                               "  var result = (((@ua+@ua)) + ((@ua)) - (((((@ua>10))))) ); " +
+                               "  @ua;  " +
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testArrayInitializerExpr1()
+       {
+               String code =
+                               "function f() {" +
+                               "  var i = 0;" +
+                               "  var a = [@di++, $i++, @ui++];" +
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testArrayInitializerExpr2()
+       {
+               String code =
+                               "function f(a,name,year) {              "+
+                               "  var $props = [1,2,3,a];              "+
+                               "  @uprops[name] = 'empty'              "+
+                               "  @uprops[year] = 'empty'              "+
+                               "  @uprops[name] + @uprops[year];"+
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testArrayInitializerExpr3()
+       {
+               String code =
+                               "function f(a,$name,year) {             "+
+                               "  var props = [1,2,3,a];               "+
+                               "  props[@uname] = 'empty'              "+
+                               "  props[year] = 'empty'                "+
+                               "  props[@uname+year]  = props;"+
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testArrayInitializerExpr4()
+       {
+               String code =
+                               "function f($a,name,year) {             "+
+                               "  var props = [1,2,[3,[(@ua)]]];               "+
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testClassInstanceCreationExpr1()
+       {
+               String code =
+                               "function g(a, b, c) {" +
+                               "  this.a = a + b + c;" +
+                               "}" +
+                               "function f(a) {" +
+                               "  var a = new g(@da++, $a++, @ua++);" +
+                               "  return a;" +
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testClassInstanceCreationExpr2()
+       {
+               String code =
+                               "function g(a, b, c) {                                  "+
+                               "  this.a = a + b + c;                                  "+
+                               "}                                                                              "+
+                               "function f(a) {                                                "+
+                               "  var $a = new g(a, a+1, a+a);                 "+
+                               "  return @ua;                                                  "+
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testClassInstanceCreationExpr3()
+       {
+               String code =
+                               "function g(a, b, c) {                                  "+
+                               "  this.a = a + b + c;                                  "+
+                               "}                                                                              "+
+                               "function f(a) {                                                "+
+                               "  var @da = new g(a, ((a+1), (a+a)));  "+
+                               "  return $a;                                                   "+
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+
+       @Test
+       public void testFieldAccessExpr1()
+       {
+               String code =
+                               "function f(a) {" +
+                               "  var i = 1;" +
+                               "  var a = [{a:[]}, {a:[]}, {a:[]}];" +
+                               "  a[@di++].a[$i];" +
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testFieldAccessExpr2()
+       {
+               String code =
+                               "function f(a) {" +
+                               "  var i = 1;" +
+                               "  var $a = [{a:[1,2,3]}, {a:[]}, {a:[]}];" +
+                               "  @ua[i++].a[i];" +
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testConditionalExpressionExpr1()
+       {
+               String code =
+                               "function f(a, b) {" +
+                               "  var @dx = 0, y = 0;" +
+                               "  (a > x)? $x: y= a + b" +
+                               "  return x+y;" +
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testConditionalExpressionExpr2()
+       {
+               String code =
+                               "function f(a, b) {" +
+                               "  var @dx = 0, y = 0;" +
+                               "  x = (a > b)? $x: y;" +
+                               "  return x;" +
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testConditionalExpressionExpr3()
+       {
+               String code =
+                               "function f(a, b) {" +
+                               "  var x = 0, @dy = 0;" +
+                               "  x = (a > b)? x: $y;" +
+                               "  return x;" +
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testConditionalExpressionExpr4()
+       {
+               String code =
+                               "function f(a, b) {                     "+
+                               "  var @dx = 0, y = 0;          "+
+                               "  (a > b)? x: y = 10;  "+
+                               "  return $x;                           "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testConditionalExpressionExpr5()
+       {
+               String code =
+                               "function f() {                 "+
+                               "  var $x = 0;                  "+
+                               "  (@ux > 3)? x=1: @ux; "+
+                               "  return @ux;                  "+
+                               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testListExpr1()
+       {
+               String code =
+                               "function f(a) {" +
+                               "  @da++, $a++, @ua++;" +
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testListExpr2() {
+               String code =
+                               "function f() {                   "+
+                               "       var $x = 1;                       "+
+                               "       @ux+1, @ux++,x+2,x=3; "+
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testListExpr3() {
+               String code =
+                               "function f() {                         "+
+                               "       var x = 0;                              "+
+                               "       x+1, x++,x+2,@dx=3,$x;  "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testListExpr4() {
+               String code =
+                               "function f() {                                                 "+
+                               "       var x,y,z;                                                      "+
+                               "        for(x+1,x++,x+2,$x=3,@ux;@ux<3;@ux++){}                        "+
+                               "}                                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testObjectLiteralExpr1()
+       {
+               String code =
+                               "function f() {" +
+                               "  var i = 0;" +
+                               "  var a = {a: @di++, b: $i++, c: @ui++};" +
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testObjectLiteralExpr2()
+       {
+               String code =
+                               "function f() {" +
+                               "  var @di = 0;" +
+                               "  var a = {a: i, b: $i++, c: @ui++};" +
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testObjectLiteralExpr3()
+       {
+               String code =
+                               "function f() {" +
+                               "  var $i = 0;" +
+                               "  var a = {a: @ui, b: @ui++, c:i};" +
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testObjectLiteralExpr4() {
+               String code =
+                       "function f() {                 "+
+                       "       var $name = 'Tim'    " +
+                       "       Array.isArray({name:@uname, time:time}); "+
+                       "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSimple00()
+       {
+               String code = "function f() { var @da; $a; }";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSimple01()
+       {
+               String code = "function f() { var a; @da = 0; $a; }";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSimple02()
+       {
+               String code = "function f() { var a; $a = 0; @ua; }";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSimple03()
+       {
+               String code = "function f() { var @da = 0; while(true) $@ma++; }";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSelection_in_blocked_FunctionDeclaration_0() {
+               String code =
+                               "function f() {                         "+
+                               "   {                                           "+
+                               "          function g(@dx) {      "+
+                               "           return $x;                  "+
+                               "          }                                    "+
+                               "   }                                           "+
+                           "}                                                  ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSelection_in_blocked_FunctionDeclaration_1() {
+               String code =
+                               "function f() {                         "+
+                               "   {                                           "+
+                               "          function g($x) {     "+
+                               "           return @ux;                 "+
+                               "          }                                    "+
+                               "   }                                           "+
+                           "}                                                  ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testSelection_in_blocked_FunctionDeclaration_2() {
+               String code = 
+                               "function f(x,y) {              "+
+                           "   x;                                                      "+
+                           "   if(x>10) {                                      "+
+                               "      y;                                               "+
+                               "      function g(@dy) { $y;}   "+
+                               "      x;                                               "+
+                           "      g(y);                                        "+
+                           "  }                                                        "+
+                   "}                                                          ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testSelection_in_blocked_FunctionDeclaration_3() {
+               String code = 
+                               "function f(x,y) {              "+
+                           "   x;                                                      "+
+                           "   while(x>10) {{                          "+
+                               "      y;                                               "+
+                               "      {function g($y) { @uy+@uy;}}     "+
+                               "      x;                                               "+
+                           "      g(y);                                        "+
+                           "  }}                                                       "+
+                   "}                                                          ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testSelection_in_blocked_FunctionDeclaration_4() {
+               String code = 
+                               "function f(x) {                "+
+                           "  {{{                                      "+
+                               "   function g(@dy) {   "+
+                               "     $y;                               "+
+                               "   }                                   "+
+                           " }}}                                       "+
+                               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testSelection_in_blocked_FunctionDeclaration_5() {
+               String code = 
+                               "function f(){{    "+
+                               "       function g($x){function f(x){x;} return @ux;} "+
+                   "}}                                                                                    ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testSelection_in_blocked_FunctionDeclaration_6() {
+               String code = 
+                               "function f(){{    "+
+                               "       function g(x){function f($x){@ux;} return x;} "+
+                   "}}                                                                                    ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testSelection_in_blocked_FunctionDeclaration_7() {
+               String code = 
+                               "function f(x) {           "+
+                               "  {                       "+
+                           "    x = function g(@dy) { "+
+                               "     $y;                              "+
+                           "    }                     "+
+                           "  }                                       "+
+                       "}                                             ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testSelection_in_blocked_FunctionDeclaration_8() {
+               String code = 
+                               "function f(y) {       "+
+                           "   function g(@dy) {  "+
+                               "     $y;                          "+
+                           "  }                                   "+
+                       "}                                         ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testVariable_initialize_later_0() {
+               String code =
+                               "function f() { "+
+                       "{              "+
+                       "   $val;       "+
+                       "   var @dval;  "+
+                       "}              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSelection_in_anonymous_function_1() {
+               String code =
+                               "g = function() {               "+
+                               "   var x = 0;                  "+
+                               "   f = function () {   "+
+                               "     $x;                               "+
+                               "   };                                  "+
+                               "};                                             ";
+               shouldNotInteresting(code);
+       }
+
+       @Test
+       public void testTypeOfExpr01() {
+               String code =
+                               "function f($x) {                           "+
+                               "       console.log(typeof @ux);        "+
+                               "}                                                          ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTypeOfExpr02() {
+               String code =
+                               "function f($x,y) {                         "+
+                               "       console.log(typeof (@ux) != y); "+
+                               "}                                                                  ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTypeOfExpr03() {
+               String code =
+                               "function f() {                             "+
+                               "       var $obj = {};                          "+
+                               "   @uobj.x = {};                                       "+
+                           "   while('function' == typeof @uobj.x || typeof @uobj.x.y == 'string') { "+
+                           "      result = (typeof (@uobj) != 'function')? true:false;                   "+
+                           "   }                                                                                                                                 "+
+                               "}                                                                  ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTypeOfExpr04() {
+               String code =
+                               "function f($g)                                 "+
+                               "{                                              "+
+                           "   var result = typeof (@ug) == 'function';      "+
+                           "   while( typeof @ug != 'function') { }          "+
+                           "   for(;typeof (@ug) =='function' && result;){   "+
+                               "        g();                                   "+
+                           "   }                                           "+
+                       "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTypeOfExpr05() {
+               String code =
+                               "function f($x) {                           "+
+                               "       console.log(typeof @ux.y);      "+
+                               "}                                                          ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testVariableDeclarationStmt01() {
+               String code =
+                       "function fx() {                                "+
+                       "       var $a=3,b=5;                           "+
+                       "       var bar = function(a) {         "+
+                       "               var b=7,c=11;                   "+
+                       "               a += b+c+a;                             "+
+                       "       };                                                      "+
+                       "   bar(@ua);                                   "+
+                       "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testVariableDeclarationStmt02() {
+               String code =
+                       "function fx(x,y,z) {   "+
+                       "       var $x=y=z=0;           "+
+                       "       @ux + y + z;            "+
+                       "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testVariableDeclarationStmt03() {
+               String code =
+                       "function fx(x,y,z) {   "+
+                       "       var x=@dy=z=0;          "+
+                       "       x + $y + z;                     "+
+                       "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testVariableDeclarationStmt04() {
+               String code =
+                       "function fx(x,y,z) {   "+
+                       "       var x=y=@dz=0;          "+
+                       "       x + y + $z;                     "+
+                       "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testVariableDeclarationStmt05() {
+               String code =
+                       "function fx()          {                       "+
+                       "       var $x=0,y=@ux,z=@ux+y;         "+
+                       "       @ux + y + z;                            "+
+                       "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testVariableDeclarationStmt06() {
+               String code =
+                       "function fx()          {                       "+
+                       "       var @dx=0,y=$x++,z=@ux+y;       "+
+                       "       @ux + y + z;                            "+
+                       "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testVariableDeclarationStmt07() {
+               String code =
+                       "function fx(param,@dparam)             {  "+
+                       "       var result = $param;                   "+
+                       "}                                                                     ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+
+       @Test
+       public void testVariableDeclarationStmt08() {
+               String code =
+                               "function f(){                          " +
+                               "       var $a;                                 " +
+                               "       @ua++;                                  " +
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+
+       @Test
+       public void testVariableDeclarationStmt09() {
+               String code =
+                               "function f(){                          " +
+                               "       var @da;                                " +
+                               "       $a++;                                   " +
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testVariableDeclarationStmt10() {
+               String code =
+                       "function f(x){                         " +
+                       "       var @da;                                " +
+                       "       if (x>5) {                              " +
+                       "               @da = 1;                        " +
+                       "       }                                               " +
+                       "       $a;                                             " +
+                       "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testVariableDeclarationStmt11() {
+               String code =
+                               "function f(x){                         "+
+                               "       var $a;                                 " +
+                               "       if (x>5) {                              " +
+                               "               a = 1;                          " +
+                               "       }                                               " +
+                               "       @ua;                                    " +
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testVariableDeclarationStmt12() {
+               String code =
+                               "function f(x){                         "+
+                               "       var @da;                                " +
+                               "       if (x>5) {                              " +
+                               "               var @da;                        " +
+                               "               @da = 1;                        " +
+                               "       }                                               " +
+                               "       $a;                                             " +
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testIfStmt01()
+       {
+               String code =
+                               "function fx() {      "+
+                           "   var x=0;          "+
+                               "       if(  @dx++ < 10 ) "+
+                               "               @dx = 2;      "+
+                               "       $x + 2;           "+
+                               "}                        ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testIfStmt02()
+       {
+               String code =
+                               "function fx() {      "+
+                           "   var @dx=0;        "+
+                               "       if( x < 10 )      "+
+                               "               @dx = 2;      "+
+                               "       $x + 2;           "+
+                               "}                        ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testIfStmt03()
+       {
+               String code =
+                               "function fx() {       "+
+                           "   var $x=0;          "+
+                               "       if( @ux < 10 )     "+
+                               "               y = @ux;       "+
+                               "       @ux + 2;           "+
+                               "}                         ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testIfStmt04()
+       {
+               String code =
+                               "function fx(y,$x) {  "+
+                               "       if( @ux < 10 ) {  "+
+                               "               y = @ux + 2;  "+
+                               "       } else {          "+
+                               "               y = @ux + 2;  "+
+                               "       }                 "+
+                               "}                        ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testIfStmt05()
+       {
+               String code =
+               "function fx()              "+
+               "{                                              "+
+               "       var @dx = 10;           "+
+               "       if( x > 9 )                     "+
+               "       {                                       "+
+               "               @dx = x * 2;    "+
+               "       }                                       "+
+               "       else                            "+
+               "       {                                       "+
+               "               fun(x,x+2);             "+
+               "       }                                       "+
+               "       x = $x + 10;            "+
+               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testIfStmt06()
+       {
+               String code =
+                               "function fx()                      "+
+                               "{                                                      "+
+                               "       var $x = 10;                    "+
+                               "       if( @ux > 9 )                   "+
+                               "       {                                               "+
+                               "               x = @ux * 2;            "+
+                               "       }                                               "+
+                               "       else                                    "+
+                               "       {                                               "+
+                               "               x = @ux;                "+
+                               "       }                                               "+
+                               "       x = x + 10;                             "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testIfStmt07()
+       {
+               String code =
+                               "function fx()                      "+
+                               "{                                                      "+
+                               "       var @dx = 10;                   "+
+                               "       if( x > 9 )                         "+
+                               "       {                                           "+
+                               "               x = x * 2;                  "+
+                               "       }                                               "+
+                               "       else                                    "+
+                               "       {                                               "+
+                               "               ++@m$x;             "+
+                               "       }                                               "+
+                               "       x = @ux + 10;               "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testIfStmt08()
+       {
+               String code =
+                       "function fx()                  "+
+                       "{                                                      "+
+                       "       var $x = 10;                    "+
+                       "       if( @ux > 10 )                  "+
+                       "       {                                               "+
+                       "               x = func(@ux);          "+
+                       "       }                                               "+
+                       "       else if ( @ux < 7 )             "+
+                       "       {                                               "+
+                       "               x = @ux * @ux;          "+
+                       "       }                                               "+
+                       "       x =  @ux + 1;                   "+
+                       "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testIfStmt09()
+       {
+               String code =
+                               "function fx()          "+
+                               "{                                              "+
+                               "       var @dx = 10;           "+
+                               "       if( x > 10 )            "+
+                               "       {                                       "+
+                               "               @dx = func(x);  "+
+                               "       }                                       "+
+                               "       else if ( x < 7 )       "+
+                               "       {                                       "+
+                               "               @dx = x * x;    "+
+                               "       }                                       "+
+                               "       x =  $x + 1;            "+
+                               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testIfStmt10()
+       {
+               String code =
+                               "function fx()              "+
+                               "{                                              "+
+                               "       var @dx = 10;           "+
+                               "       if( x > 10 )            "+
+                               "       {                                       "+
+                               "               x = func(x);    "+
+                               "       }                                       "+
+                               "       else if ( x < 7 )       "+
+                               "       {                                       "+
+                               "               x = $x * x;         "+
+                               "       }                                       "+
+                               "       x =  0;                 "+
+                               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt01() {
+               String code =
+                       "function fx()                      "+
+                       "{                                                              "+
+                       "       var $x = 10;                            "+
+                       "       switch(@ux)                                     "+
+                       "       {                                                       "+
+                       "               case 10: @ux;                   "+
+                       "               case 20: x = @ux + 1; break;"+
+                       "       }                                                       "+
+                       "       @ux;                                                "+
+                       "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt02()
+       {
+               String code =
+                       "function fx()                          "+
+                       "{                                                              "+
+                       "       var $x = 10;                            "+
+                       "       switch(@ux)                                     "+
+                       "       {                                                       "+
+                       "       case 10: x = @ux + 1;       "+
+                       "       case 20: x = @ux + 1; break;"+
+                       "       default: x = @ux + 2;           "+
+                       "       }                                                       "+
+                       "       x;                                                      "+
+                       "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt03()
+       {
+               String code =
+                       "function fx()                          "+
+                       "{                                                              "+
+                       "       var $x = 10, y;                         "+
+                       "       switch(@ux)                                     "+
+                       "       {                                                       "+
+                       "       case 10: x = @ux + 1; break;"+
+                       "       default: y = @ux + 2;           "+
+                       "       }                                                       "+
+                       "       @ux;                                            "+
+                       "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt04()
+       {
+               String code =
+                       "function fx()                          "+
+                       "{                                                              "+
+                       "       var x = 10;                                     "+
+                       "       switch(x)                                       "+
+                       "       {                                                       "+
+                       "       case 10: x = x + 1;                     "+
+                       "       case 20: @dx = x + 1; break;"+
+                       "       default: @dx = x + 2;           "+
+                       "       }                                                       "+
+                       "       $x;                                                     "+
+                       "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt05()
+       {
+               String code =
+                       "function fx()                  "+
+                       "{                                                      "+
+                       "       var x = 10;                             "+
+                       "       switch(x)                               "+
+                       "       {                                               "+
+                       "       case 10: $x = x + 1;    "+
+                       "       case 20: @ux + 1; break;"+
+                       "       default: x = x + 2;             "+
+                       "       }                                               "+
+                       "       @ux;                                    "+
+                       "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt06()
+       {
+               String code =
+                       "function fx()                      "+
+                       "{                                                              "+
+                       "       var @dx = 10;                           "+
+                       "       switch(x)                                       "+
+                       "       {                                                       "+
+                       "       case 10: @dx = x + 1;           "+
+                       "       case 20: x = $x + 1; break; "+
+                       "       default: x = x + 2;                     "+
+                       "       }                                                       "+
+                       "       x;                                                      "+
+                       "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt07()
+       {
+               String code =
+                       "function fx()                  "+
+                       "{                                                      "+
+                       "       var @dx = 10;                   "+
+                       "       switch(x)                               "+
+                       "       {                                               "+
+                       "       case 20: x = x + 1; break;"+
+                       "       case 10: x = $x + 1;    "+
+                       "       }                                               "+
+                       "       x + 1;                                  "+
+                       "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt08()
+       {
+               String code =
+                       "function fx()                  "+
+                       "{                                                              "+
+                       "       var @dx = 10;                           "+
+                       "       switch(x)                                       "+
+                       "       {                                                       "+
+                       "       case 10: x = x + 1;                     "+
+                       "       case 20: x = x + 1; break;  "+
+                       "       default: x = $x + 2;            "+
+                       "       }                                                       "+
+                       "       x;                                                      "+
+                       "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt09()
+       {
+               String code =
+                       "function fx()                  "+
+                       "{                                                              "+
+                       "       var x = 10;                                     "+
+                       "       switch(x)                                       "+
+                       "       {                                                       "+
+                       "       case x=10 : x = x + 1;          "+
+                       "       case @dx=5: x = x + 1; break;"+
+                       "       default: x = $x + 2;            "+
+                       "       }                                                       "+
+                       "       x;                                                      "+
+                       "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt10()
+       {
+               String code =
+                       "function fx()                  "+
+                       "{                                                              "+
+                       "       var x = 10;                                 "+
+                       "       switch(x)                                       "+
+                       "       {                                                       "+
+                       "       case $x=10: x = @ux + 1;        "+
+                       "       case 5    : x = @ux + 1; break; "+
+                       "       default   : x = @ux + 2;                "+
+                       "       }                                                       "+
+                       "       x;                                                      "+
+                       "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt11()
+       {
+               String code =
+                       "function fx()                    "+
+                       "{                                                                "+
+                       "       var x = 10;                                   "+
+                       "       switch(x)                                         "+
+                       "       {                                                         "+
+                       "       case $x=10: x = @ux + 1;          "+
+                       "       case x=5  : x = x + 1; break; "+
+                       "       default   : x = x + 2;            "+
+                       "       }                                                         "+
+                       "       x;                                                        "+
+                       "}                                                                ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt12()
+       {
+               String code =
+                       "function fx()                  "+
+                       "{                                                              "+
+                       "       var x = 10;                                 "+
+                       "       switch(x)                                       "+
+                       "       {                                                       "+
+                       "       case x=10: x = x + 1;       "+
+                       "       case 5   : @dx = x + 1; break;"+
+                       "       default  : @dx = x + 2;         "+
+                       "       }                                                       "+
+                       "       $x;                                                     "+
+                       "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt13()
+       {
+               String code =
+                       "function fx()                          "+
+                       "{                                                                      "+
+                       "       var x = 10, y;                          "+
+                       "       switch(x)                                               "+
+                       "       {                                                               "+
+                       "       case @dx=5 : x = x + 1;         "+
+                       "       case 10    : @dx = x + 1; break;"+
+                       "       default    : y = x + 2;                 "+
+                       "       }                                                               "+
+                       "       $x;                                                             "+
+                       "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt14()
+       {
+               String code =
+                       "function fx()                          "+
+                       "{                                                              "+
+                       "       var @dx = 10;                           "+
+                       "       switch(x)                                       "+
+                       "       {                                                       "+
+                       "               case 10: @dx = x + 1;   "+
+                       "               case 20: x;                             "+
+                       "               default: x = $x + 2;    "+
+                       "       }                                                       "+
+                       "       x;                                                      "+
+                       "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt15()
+       {
+               String code =
+                       "function fx()               "+
+                       "{                           "+
+                       "   var $x = 10;             "+
+                       "   switch(@ux)              "+
+                       "   {                        "+
+                       "      case 10 : x = @ux + 1;"+
+                       "      default : @ux+1;      "+
+                       "   }                        "+
+                       "   @ux;                     "+
+                       "}                           ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt16()
+       {
+               String code =
+                       "function fx()               "+
+                       "{                           "+
+                       "   var $x = 10;             "+
+                       "   switch(@ux)              "+
+                       "   {                        "+
+                       "      case x=1+2: x = x+1;  "+
+                       "      default   : x+1;          "+
+                       "   }                        "+
+                       "   x;                       "+
+                       "}                           ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt17()
+       {
+               String code =
+                        "function fx()         "+
+                "{                     "+
+                "  var @dx = 10;       "+
+                "  switch(x)           "+
+                "  {                   "+
+                "    case 10 : @dx=x+1;"+
+                "    default : x=$x+1; "+
+                "  }                               "+
+                "  x;                          "+
+                "}                     ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt18()
+       {
+               String code =
+                        "function fx()              "+
+                        "{                          "+
+                        "  var x = 10;              "+
+                        "  switch(x)                "+
+                        "  {                        "+
+                        "  case 10: $x = x+1; break;"+
+                        "  default: x = x+1;        "+
+                        "  }                        "+
+                        "  @ux;                     "+
+                        "}                          ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt19()
+       {
+               String code =
+                        "function fx()              "+
+                        "{                          "+
+                        "  var @dx = 10;            "+
+                        "  switch(x)                "+
+                        "  {                        "+
+                        "  case 10: x = x+1; break; "+
+                        "  default: x = $x+1;       "+
+                        "  }                                "+
+                        "  x;                               "+
+                        "}                                          ";
+                assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt20()
+       {
+               String code =
+                        "function fx()                         "+
+                        "{                                     "+
+                        "      var $x = 10, y;                                 "+
+                        "      switch(@ux)                                             "+
+                        "      {                                                               "+
+                        "      case @ux: x = @ux + 1; x;break; "+
+                        "      case @ux: x = @ux + 1; x;break; "+
+                        "      default: x = @ux + 2;                   "+
+                        "      }                                                               "+
+                        "      x;                                                              "+
+                        "}                                                     ";
+                assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt21() {
+               String code =
+                               "function fx()                                          "+
+                               "{                                                                      "+
+                               "       var x = 10;                                     "+
+                               "       switch(x)                                               "+
+                               "       {                                                               "+
+                               "       case @dx=5 : x = x + 1;         "+
+                               "       case 10    : x = x + 1; break;  "+
+                               "       default    : y = $x + 2;                "+
+                               "       }                                                               "+
+                               "       x;                                                              "+
+                               "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt22() {
+               String code =
+                               "function fx()                                          "+
+                               "{                                                                      "+
+                               "       var x = 10;                                     "+
+                               "       switch(x)                                               "+
+                               "       {                                                               "+
+                               "       case $x=5 : x = @ux + 1;            "+
+                               "       case 10    : x = @ux + 1;               "+
+                               "       default    : y = @ux + 2;               "+
+                               "       }                                                               "+
+                               "       @ux;                                                    "+
+                               "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt23() {
+               String code =
+                               "function fx()                                          "+
+                               "{                                                                      "+
+                               "       var x = 10;                                     "+
+                               "       switch(x)                                               "+
+                               "       {                                                               "+
+                               "       case 5   : $x = x + 1;          "+
+                               "       case x   : y = @ux + 2;             "+
+                               "       case 34  : y = @ux + 3;         "+
+                               "       case x   : y = @ux + 4;                 "+
+                               "       default  : y = @ux + 5;             "+
+                               "       }                                                               "+
+                               "       @ux;                                                    "+
+                               "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt24() {
+               String code =
+                               "function fx()                                          "+
+                               "{                                                                      "+
+                               "       var x = 10;                                     "+
+                               "       switch(x)                                               "+
+                               "       {                                                               "+
+                               "       case 5     : $x = x + 1;            "+
+                               "       case x*2   : x = @ux + 1                "+
+                               "       case 34    : x = x + 1;         "+
+                               "       case x     : x = x + 1;                 "+
+                               "       default    : y = x + 2;             "+
+                               "       }                                                               "+
+                               "       x;                                                      "+
+                               "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt25() {
+               String code =
+                               "function fx()                  "+
+                               "{                                              "+
+                               "       var x = 10;                     "+
+                               "       switch(x) {                     "+
+                               "       case $x=5: @ux+1;       "+
+                               "       case 13: x=0;           "+
+                               "       }                                       "+
+                               "       @ux;                            "+
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+
+       }
+
+       @Test
+       public void testSwitchStmt26() {
+               String code =
+                               "function fx()                                  "+
+                               "{                                                              "+
+                               "       var x = 10;                             "+
+                               "       switch(x)                                       "+
+                               "       {                                                       "+
+                               "       case @dx=0     : x = x + 1;     "+
+                               "       case x*2    : x = x + 1;        "+
+                               "       case 34     : x = x + 1;        "+
+                               "       case x      : @dx = x + 1;      "+
+                               "       default     : y = $x + 2;       "+
+                               "       }                                                       "+
+                               "       x;                                              "+
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt27() {
+               String code =
+                               "function fx()                  "+
+                               "{                                              "+
+                               "       var $x = 7,y=34;        "+
+                               "       switch(@ux) {           "+
+                               "       case 10: x=  @ux+ 1;"+
+                               "       default: y = @ux+ 1;"+
+                               "       case 20: x = @ux+ 1;"+
+                               "       }                                       "+
+                               "       x;                                      "+
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt28(){
+               String code =
+                               "function fx()                          "+
+                               "{                                                      "+
+                               "       var x = 0,y=0;                  "+
+                               "       switch(x) {                             "+
+                               "       case 10: @dx = x+1;             "+
+                               "       default: y = $x+1;              "+
+                               "       case @dx=20: x = x+1;   "+
+                               "       case x : x=x+1;                 "+
+                               "       }                                               "+
+                               "       x;                                              "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt29(){
+               String code =
+                               "function fx()                          "+
+                               "{                                                      "+
+                               "       var x = 0,y=0;                  "+
+                               "       switch(x) {                             "+
+                               "       case 10: @dx = x+1;             "+
+                               "       case @dx=0:                             "+
+                               "       default : y = $x+1;             "+
+                               "       case x=20: x= x+1;              "+
+                               "       case @dx=30: x=x+1;             "+
+                               "       }                                               "+
+                               "   x;                                          "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt30() {
+               String code =
+                               "function fx()                                          "+
+                               "{                                                                      "+
+                               "       var x = 10;                                     "+
+                               "       switch(x)                                               "+
+                               "       {                                                               "+
+                               "       case 5   : $x = x + 1;          "+
+                               "       case x   : y = @ux + 2;             "+
+                               "       case 34  : y = @ux + 3; break;  "+
+                               "       case x   : y = x + 4;               "+
+                               "       default  : y = x + 5;               "+
+                               "       }                                                               "+
+                               "       @ux;                                                    "+
+                               "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt31() {
+               String code =
+                               "function fx()                                  "+
+                               "{                                                              "+
+                               "       var x = 0,y=0;                          "+
+                               "       switch(x) {                                     "+
+                               "       case 10: x=  x+1;                       "+
+                               "       case x=0:                                       "+
+                               "       default : y=  @ux+1;break;      "+
+                               "       case x: x= x+1;                         "+
+                               "       case $x=30: x=@ux+1;            "+
+                               "       }                                                       "+
+                               "       @ux;                                            "+
+                               "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt32() {
+               String code =
+                               "function fx()                                  "+
+                               "{                                                              "+
+                               "       var $x = 0, y=0;                        "+
+                               "       switch(@ux) {                           "+
+                               "       default : y= x+1;;                      "+
+                               "       case 10: x= @ux+1;                      "+
+                               "       case x=0:                                       "+
+                               "       case x: x= x+1;                         "+
+                               "       case x=30: x=x+1;                       "+
+                               "  }                                                    "+
+                               "  x;                                                   "+
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt33() {
+               String code =
+                               "function fx()                  "+
+                               "{                                              "+
+                               "       var $x = 0;                     "+
+                               "       switch(@ux) {           "+
+                               "               default: @ux;   "+
+                               "       }                                       "+
+                               "  @ux+                                 "+
+                               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt34()
+       {
+               String code =
+                       "function fx()                          "+
+                       "{                                                              "+
+                       "       var $x = 10, y;                         "+
+                       "       switch(@ux)                                     "+
+                       "       {                                                       "+
+                       "       default: y = @ux + 2;           "+
+                       "       case 10: x = @ux + 1; break;"+
+                       "       }                                                       "+
+                       "       x;                                                      "+
+                       "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt35()
+       {
+               String code =
+                       "function fx()                          "+
+                       "{                                                              "+
+                       "       var x = 10;                                     "+
+                       "       switch(x)                                       "+
+                       "       {                                                       "+
+                       "       case 10: x = x + 1;                     "+
+                       "       default: x = x + 2;                     "+
+                       "       case 20: @dx = x + 1; break;"+
+                       "       }                                                       "+
+                       "       $x;                                                     "+
+                       "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt36()
+       {
+               String code =
+                       "function fx()                            "+
+                       "{                                                                "+
+                       "       var x = 10;                                       "+
+                       "       switch(x)                                         "+
+                       "       {                                                     "+
+                       "       default: x = @ux + 2;             "+
+                       "       case $x=5: x = @ux + 1; break;"+
+                       "       }                                                         "+
+                       "       x;                                                        "+
+                       "}                                                                ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt37() {
+               String code =
+                       "function fx()      "+
+                       "{                                      "+
+                       "       var x =10;              "+
+                       "       switch(x) {             "+
+                       "         case $x=6:;   "+
+                       "     case @ux:@ux+10;  "+
+                       "         dafault:@ux;  "+
+                       "     case @ux+1:;      "+
+                       "       }                               "+
+                       "}                                      ";
+
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt38() {
+               String code =
+                       "function fx()          "+
+                       "{                                              "+
+                       "       var $x = 10;            "+
+                       "       switch(@ux) {           "+
+                       "         case 7:x=@ux+1;       "+
+                       "     case 34:@ux+10;   "+
+                       "         default:@ux;          "+
+                       "     case 55:x=@ux+1;  "+
+                       "       }                                       "+
+                       "       x;                                      "+
+                       "}                                              ";
+
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt39()
+       {
+               String code =
+                       "function fx()                            "+
+                       "{                                                                "+
+                       "       var x = 10;                                       "+
+                       "       switch(x)                                         "+
+                       "       {                                                     "+
+                       "       default: x = @ux + 2;             "+
+                       "       case x=7:x;                                       "+
+                       "       case $x=5: x = @ux + 1; break;"+
+                       "       }                                                         "+
+                       "       x;                                                        "+
+                       "}                                                                ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt40()
+       {
+               String code =
+                       "function fx()                            "+
+                       "{                                                                "+
+                       "       var x = 10;                                       "+
+                       "       switch(x)                                         "+
+                       "       {                                                     "+
+                       "       case @dx=7:x;   break;            "+
+                       "       default: @dx=0;                           "+
+                       "       }                                                         "+
+                       "       $x;                                                       "+
+                       "}                                                                ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt41()
+       {
+               String code =
+                       "function fx()                            "+
+                       "{                                                                "+
+                       "       var $x = 10;                              "+
+                       "       switch(@ux){ }                            "+
+                       "       @ux;                                              "+
+                       "}                                                                ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt42()
+       {
+               String code =
+                       "function fx() {                          "+
+                       "       var x = 0;                                        "+
+                       "       switch(x) {                                       "+
+                       "       case $x = 10: x = @ux+1;          "+
+                       "       case x=@ux+1: x = x+1;            "+
+                       "       }                                                         "+
+                       "       x;                                                        "+
+                       "}                                                                ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt43()
+       {
+               String code =
+                       "function fx() {                        "+
+                       "       var $x = 0;                                     "+
+                       "       switch(@ux) {                           "+
+                       "       case @ux: @ux+1;                        "+
+                       "       default: @ux;                           "+
+                       "       case x=@ux+1: x = @ux+1;        "+
+                       "       }                                                       "+
+                       "       x;                                                      "+
+                       "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testSwitchStmt44()
+       {
+               String code =
+                       "function fx() {                        "+
+                       "       var $x = 0;                                     "+
+                       "       switch(@ux) {                           "+
+                       "       case x=@ux+1: x+1;                      "+
+                       "       default: x;                                     "+
+                       "       case x=x+1: x = x+1;            "+
+                       "       }                                                       "+
+                       "       x;                                                      "+
+                       "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+/**
+ * This test is related to https://bugs.eclipse.org/bugs/show_bug.cgi?id=376809.
+ * And the relevant redmine issue is #6157.
+ */
+       @Test
+       public void testSwitchStmt45()
+       {
+               String code =
+                       "function fx() {                        " +
+                       "       (function (a) {}                        " +
+                       "               (function ($x) {                " +
+                       "                       switch (@ux) {          " +
+                       "                               case @ux:               " +
+                       "                       }                                       " +
+                       "               })                                              " +
+                       "       );                                                      " +
+                       "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+
+       @Test
+       public void testNestedSwitchStmt01() {
+               String code =
+                               "function fx() {                                     "+
+                               "var result = 100;                       "+
+                               "var $tmp=0;                             "+
+                       "                                        "+
+                               "switch( result )                        "+
+                               "{                                       "+
+                               "case 10: tmp = @utmp + 1;               "+
+                               "case 20: switch ( @utmp )               "+
+                               "               {                                "+
+                               "               case 30: tmp = @utmp + 3; break; "+
+                               "               case 40: tmp = @utmp + 10; break;"+
+                               "               }                                "+
+                               "               tmp = @utmp + result;            "+
+                               "               break;                           "+
+                               "}                                       "+
+                               "result = @utmp;                         "+
+                               "}                                       ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedSwitchStmt02() {
+               String code =
+                               "function fx()                                                   "+
+                           "{                                                                           "+
+                               "var result = 100;                                               "+
+                               "var $tmp=0;                                                     "+
+                       "                                                                                "+
+                               "switch( result )                                                "+
+                               "{                                                                               "+
+                               "case 10: tmp = @utmp + 1;                               "+
+                               "case 20: switch ( @utmp )                               "+
+                               "               {                                                                "+
+                               "               case 30: tmp = @utmp + 3; break; "+
+                               "               case 40: tmp = @utmp + 10; break;"+
+                               "               default : tmp = @utmp + 5;       "+
+                               "               }                                                                "+
+                               "               tmp = tmp + result;              "+
+                               "               break;                                                   "+
+                               "}                                                                               "+
+                               "result = @utmp;                         "+
+                               "}                                       ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedSwitchStmt03() {
+               String code =
+                               "function fx()                                          "+
+                               "{                                                                                      "+
+                               "       var result = 100;                                               "+
+                               "       var @dtmp=34;                                                   "+
+                           "                                                                                   "+
+                               "       switch( result )                                                "+
+                               "       {                                                                               "+
+                               "       case 10: @dtmp = tmp + 1;                               "+
+                               "       case 20: switch ( tmp )                                 "+
+                           "           {                                                                       "+
+                               "               case 30: tmp = tmp + 3;                         "+
+                               "               case 40: @dtmp = tmp + 10; break;       "+
+                               "               }                                                                       "+
+                               "               tmp = $tmp + result;                            "+
+                               "               break;                                                          "+
+                               "       }                                                                               "+
+                               "       result = tmp;                                                   "+
+                               "}                                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedSwitchStmt04() {
+               String code =
+                               "function fx()                                          "+
+                               "{                                                                              "+
+                               "var result = 100;                                              "+
+                               "var @dtmp=34;                                                  "+
+                           "                                                                           "+
+                               "switch( result )                                               "+
+                               "{                                                                              "+
+                               "case 10: @dtmp = tmp + 1;                              "+
+                               "case 20: switch ( tmp )                                "+
+                           "           {                                                               "+
+                               "               case 30: @dtmp = tmp + 3;break; "+
+                               "               case 40: @dtmp = tmp + 10; break;"+
+                               "               }                                                               "+
+                               "               tmp = $tmp + result;                    "+
+                               "               break;                                                  "+
+                               "}                                                                              "+
+                               "result = tmp;                                                  "+
+                               "}                                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedSwitchStmt05() {
+               String code =
+                               "function fx()                                  "+
+                               "{                                                                              "+
+                               "var result = 100;                                              "+
+                               "var @dtmp=34;                                                  "+
+                           "                                                                           "+
+                               "switch( result )                                               "+
+                               "{                                                                              "+
+                               "case 10: @dtmp = tmp + 1;break;                "+
+                               "case 20: switch ( tmp )                                "+
+                           "           {                                                               "+
+                               "               case 30: tmp = tmp + 3;break;   "+
+                               "               case 40: tmp = tmp + 10; break; "+
+                               "               }                                                               "+
+                               "               @dtmp = tmp + result;                   "+
+                               "               break;                                                  "+
+                               "}                                                                              "+
+                               "result = $tmp;                                                 "+
+                               "}                                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedSwitchStmt06() {
+               String code =
+                               "function fx()                                                  "+
+                               "{                                                                                      "+
+                               "var result = 100;                                                      "+
+                               "var tmp=34;                                                            "+
+                           "                                                                                   "+
+                               "switch( result )                                                       "+
+                               "{                                                                                      "+
+                               "case 10: tmp = tmp + 1;                                        "+
+                               "case 20: switch ( tmp )                                        "+
+                           "           {                                                                       "+
+                               "               case @dtmp=0: @dtmp = tmp + 3;break;"+
+                               "               case 40: @dtmp = tmp + 10; break;       "+
+                               "               }                                                                       "+
+                               "               tmp = $tmp + result;                            "+
+                               "               break;                                                          "+
+                               "}                                                                                      "+
+                               "result = tmp;                                                          "+
+                               "}                                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedSwitchStmt07() {
+               String code =
+                               "function fx()                                                   "+
+                           "{                                                                           "+
+                               "var result = 100;                                               "+
+                               "var $tmp=0;                                                     "+
+                       "                                                                                "+
+                               "switch( result )                                                "+
+                               "{                                                                               "+
+                               "case 10: tmp = @utmp + 1;                               "+
+                               "case 20: switch ( @utmp )                               "+
+                               "               {                                                                "+
+                               "               case 30: tmp = @utmp + 3; break; "+
+                               "               case tmp=0: tmp = tmp + 10; break;"+
+                               "               default : tmp = tmp + 5;         "+
+                               "               }                                                                "+
+                               "               tmp = tmp + result;              "+
+                               "               break;                                                   "+
+                               "}                                                                               "+
+                               "result = @utmp;                         "+
+                               "}                                       ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedSwitchStmt08() {
+               String code =
+                               "function fx()                                                  "+
+                               "{                                                                                      "+
+                               "var result = 100;                                                      "+
+                               "var tmp=34;                                                            "+
+                           "                                                                                   "+
+                               "switch( result )                                                       "+
+                               "{                                                                                      "+
+                               "case 10: tmp = tmp + 1;                                        "+
+                               "case 20: switch ( tmp )                                        "+
+                           "           {                                                                       "+
+                               "               case tmp=0: tmp = tmp + 3;break;        "+
+                               "               case 40: tmp = tmp + 10; break;         "+
+                               "               }                                                                       "+
+                               "               $tmp = tmp + result;                            "+
+                               "               break;                                                          "+
+                               "}                                                                                      "+
+                               "result = @utmp;                                                        "+
+                               "}                                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedSwitchStmt09() {
+               String code =
+                               "function fx()                                                  "+
+                               "{                                                                                      "+
+                               "var result = 100;                                                      "+
+                               "var $tmp=34;                                                           "+
+                           "                                                                                   "+
+                               "label:switch( result )                                         "+
+                               "{                                                                                      "+
+                               "case 10: tmp = @utmp + 1;                                      "+
+                               "case 20: label2:switch ( @utmp )                       "+
+                           "           {                                                                       "+
+                               "               case tmp=0: tmp = tmp + 3;break;        "+
+                               "               case 40: tmp = tmp + 10; break;         "+
+                               "               }                                                                       "+
+                               "               tmp = tmp + result;                                     "+
+                               "               break;                                                          "+
+                               "}                                                                                      "+
+                               "result = @utmp;                                                        "+
+                               "}                                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt01() {
+               String code =
+                               "function fx()         "+
+                               "{                     "+
+                               "       var $x = 1;        "+
+                               "       for( ; ; )         "+
+                               "       {                  "+
+                               "               @ux + 1;       "+
+                               "       }                  "+
+                               "       x + 1;             "+
+                               "}                     ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt02() {
+               String code =
+                               "function fx()          "+
+                               "{                      "+
+                               "   var @dx = 1;    "+
+                               "   for( ; ; )          "+
+                               "     @dx = $x + 1; "+
+                               "   x = x + 1;          "+
+                               "}                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt03() {
+               String code =
+                               "function fx()            "+
+                               "{                        "+
+                               "   var $x = 10;          "+
+                               "   for( ; @ux < 10; )    "+
+                               "   {                     "+
+                               "      x = @ux + 1;       "+
+                               "   }                     "+
+                               "   x = @ux + 1;          "+
+                               "}                        ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt04() {
+               String code =
+                               "function fx()       "+
+                               "{                   "+
+                               "   var @dx = 10;    "+
+                               "   for( ; ; @dx++ ) "+
+                               "   {                "+
+                               "      x = $x + 1;   "+
+                               "   }                "+
+                               "   x = x + 1;       "+
+                               "}                   ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt05() {
+               String code =
+                               "function fx()             "+
+                               "{                         "+
+                               "       var x = 5;             "+
+                               "       for( ; ; @ux++ )       "+
+                               "       {                      "+
+                               "               $x = x + 1;        "+
+                               "       }                      "+
+                               "       x = x + 1;             "+
+                               "}                         ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt06() {
+               String code =
+                               "function fx()              "+
+                               "{                          "+
+                               "   var @dx = 5;            "+
+                               "       for( ; x < 10 ; @dx++ ) "+
+                               "       {                       "+
+                               "               x = x + 1;          "+
+                               "       }                       "+
+                               "       x = $x + 1;             "+
+                               "}                          ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt07() {
+               String code =
+                               "function fx()                                   "+
+                               "{                                       "+
+                               "       for(var @dx = 5 ; $x < 10 ; @dx++ )      "+
+                               "       {                                        "+
+                               "               y = x + 1;                       "+
+                               "       }                                    "+
+                               "   x = x + 1;                           "+
+                               "}                                       ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt08() {
+               String code =
+                               "function fx()                                  "+
+                               "{                                      "+
+                               "       for(var x = 5 ; @ux < 10 ; $x++ )       "+
+                               "       {                                       "+
+                               "               @dx = @ux + 1;                  "+
+                               "       }                                   "+
+                               "       x = @ux + 1;                        "+
+                               "}                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt09() {
+               String code =
+                               "function fx()                                                   "+
+                       "{                                               "+
+                               "       for(var @dx = 5 ; x < 10 ; @dx++ )       "+
+                               "       {                                        "+
+                               "               x = $x + 1;                      "+
+                               "       }                                        "+
+                               "       x = x + 1;                               "+
+                               "}                                       ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt10() {
+               String code =
+                               "function fx()                       "+
+                               "{                                   "+
+                               "       var x;                           "+
+                               "       for($x = 5 ; @ux < 10 ; @ux++ )  "+
+                               "       {                                "+
+                               "               continue;                    "+
+                               "               x = x + 1;                   "+
+                               "       }                                "+
+                               "       x = @ux + 1;                     "+
+                               "}                                   ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt11() {
+               String code =
+                               "function fx()                      "+
+                               "{                                  "+
+                               "       var x;                          "+
+                               "       for($x = 5 ; @ux < 10 ; x++ )   "+
+                               "       {                               "+
+                               "               break;                      "+
+                               "               x = x + 1;                  "+
+                               "       }                               "+
+                               "       x = @ux + 1;                    "+
+                               "}                                  ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt12() {
+               String code =
+                               "function fx()                      "+
+                               "{                                  "+
+                               "       var x;                          "+
+                               "       for(@dx = 5 ; x < 10 ; @dx++ )  "+
+                               "       {                               "+
+                               "               x = x + 1;                  "+
+                               "       }                               "+
+                               "       x = $x + 1;                     "+
+                               "}                                  ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt13() {
+               String code =
+                               "function fx()       "+
+                               "{                           "+
+                               "       var @dx = 1;     "+
+                               "       for( ; ; )       "+
+                               "       {                "+
+                               "               @dx = $x + 1;"+
+                               "       }                "+
+                               "       x =  x + 1;      "+
+                               "}                                       ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt14() {
+               String code =
+                               "function fx()           "+
+                               "{                       "+
+                               "       var x = 1;       "+
+                               "       for( ; ; )       "+
+                               "       {                        "+
+                               "               $x = @ux + 1;"+
+                               "       }                        "+
+                               "       x =  x + 1;      "+
+                               "}                   ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt15() {
+               String code =
+                               "function fx()             "+
+                               "{                                 "+
+                               "       var @dx = 1;       "+
+                               "       for( ; $x < 10 ; ) "+
+                               "       {                          "+
+                               "               @dx = x + 1;   "+
+                               "       }                  "+
+                               "       x =  x + 1;        "+
+                               "}                                 ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt16() {
+               String code =
+                               "function fx()                  "+
+                               "{                                      "+
+                               "       var @dx = 1;            "+
+                               "       for( ; x < 10 ; )       "+
+                               "       {                               "+
+                               "               @dx = $x + 1;   "+
+                               "       }                           "+
+                               "       x =  x + 1;         "+
+                               "}                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt17() {
+               String code =
+                               "function fx()              "+
+                               "{                                      "+
+                               "       var @dx = 1;        "+
+                               "       for( ; x < 10 ; )   "+
+                               "       {                           "+
+                               "               @dx = x + 1;    "+
+                               "       }                               "+
+                               "       x =  $x + 1;            "+
+                               "}                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt18() {
+               String code =
+                               "function fx()                  "+
+                               "{                                      "+
+                               "       var x = 1;              "+
+                               "       for( ; @ux < 10 ; ) "+
+                               "       {                               "+
+                               "               $x = @ux + 1;   "+
+                               "       }                               "+
+                               "       x =  @ux + 1;           "+
+                               "}                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt19() {
+               String code =
+                               "function fx()                  "+
+                               "{                                      "+
+                               "       var @dx = 1;            "+
+                               "       for( ; x < 10 ; )       "+
+                               "       {                               "+
+                               "               $x;                     "+
+                               "       }                               "+
+                               "       x =  x + 1;             "+
+                               "}                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt20() {
+               String code =
+                               "function fx()                          "+
+                               "{                                              "+
+                               "       var $x=0;                               "+
+                               "       for( ; @ux < 10; @ux++ )"+
+                               "       {                                       "+
+                               "               @ux;                            "+
+                               "       }                                       "+
+                               "       @ux;                                    "+
+                               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt21() {
+               String code =
+                               "function fx()                           "+
+                               "{                                               "+
+                               "       var @dx=0;                       "+
+                               "       for( ; @ux < 10; @m$x++ )"+
+                               "       {                                        "+
+                               "               @ux;                             "+
+                               "       }                                        "+
+                               "       @ux;                                     "+
+                               "}                                               ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt22() {
+               String code =
+                               "function fx()                          "+
+                               "{                                              "+
+                               "       var @dx=1;                      "+
+                               "       for( ; x < 10; @dx++ )  "+
+                               "       {                                       "+
+                               "               $x;                             "+
+                               "       }                                       "+
+                               "       x;                                      "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt23() {
+               String code =
+                               "function fx()                                   "+
+                               "{                                                       "+
+                               "       var x;                                           "+
+                               "       for($x = 5 ; @ux < 10 ; x++ )"+
+                               "       {                                                "+
+                               "               x = @ux + 1;                     "+
+                               "       }                                                "+
+                               "       x = @ux + 1;                             "+
+                               "}                                                       ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt24() {
+               String code =
+                               "function fx()                                          "+
+                               "{                                                              "+
+                               "       var x;                                                  "+
+                               "       for(@dx = 5 ; $x < 10 ; @dx++ ) "+
+                               "       {                                                       "+
+                               "               x = x + 1;                              "+
+                               "       }                                                       "+
+                               "       x = x + 1;                                      "+
+                               "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt25() {
+               String code =
+                               "function fx()                                   "+
+                               "{                                                       "+
+                               "       var x;                                           "+
+                               "       for(x = 5 ; @ux < 10 ; $x++ )"+
+                               "       {                                                "+
+                               "               @dx = @ux + 1;                   "+
+                               "       }                                                "+
+                               "       x = @ux + 1;                             "+
+                               "}                                                               ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt26() {
+               String code =
+                               "function fx()                                          "+
+                               "{                                                              "+
+                               "       var x;                                          "+
+                               "       for(@dx = 5 ; x < 10 ; @dx++ )  "+
+                               "       {                                                       "+
+                               "               x = $x + 1;                             "+
+                               "       }                                                       "+
+                               "       x = x + 1;                                      "+
+                               "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt27() {
+               String code =
+                       "function fx() {                                        "+
+                       "       var x,y,z;                                                                              "+
+                       "       for(x=5,$y=10,z=0;x<3 && @uy<3 ;x++,@uy++,z++) {"+
+                       "               z += x + @uy;                                                           "+
+                       "       }                                                                                               "+
+                       "}                                                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt28() {
+               String code =
+                       "function fx() {                                        "+
+                       "       var x,y,z;                                                                              "+
+                       "       for(x=5,y=10,@dz=0;x<3 && y<3 ;x++,@mz++,y++) {"+
+                       "               $z += x + y;                                                            "+
+                       "       }                                                                                               "+
+                       "}                                                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt29() {
+               String code =
+                       "function fx() {                                        "+
+                       "       var x,y,z;                                                                              "+
+                       "       for(x=5,$y=10,z=0;x<3 && @uy<3 ;x++,z++,@uy++) {"+
+                       "               z += x + @uy;                                                           "+
+                       "       }                                                                                               "+
+                       "}                                                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt30() {
+               String code =
+                       "function fx() {                                        "+
+                       "       var x,y,z;                                                                              "+
+                       "       for(x=5,$y=10,z=0;x<3 && @uy<3 ;x++,z++,y++) {  "+
+                       "               z += x + @uy;                                                           "+
+                       "               y = 0;                                                                          "+
+                       "       }                                                                                               "+
+                       "}                                                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt31() {
+               String code =
+                       "function fx() {                                        "+
+                       "       var x,y,z;                                                                              "+
+                       "       for(x=5,@dy=10,z=0;x<3 && $y<3 ;x++,z++,@dy++) {  "+
+                       "               z += x + y;                                                             "+
+                       "               y = 0;                                                                          "+
+                       "       }                                                                                               "+
+                       "}                                                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt32() {
+               String code =
+                               "function fx() {                                                                                "+
+                               "       for(var x=5,@dy,z=0; x<3 && y<3 ;x+=1,@dy++,z++) {      "+
+                               "                       $y;                                                                                     "+
+                               "               }                                                                                               "+
+                               "}                                                                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt33() {
+               String code =
+                               "function fx() {                                                                          "+
+                               "       for(var x=5,y,@dz=0; x<3 && y<3 ;x+=1,@dz++,y++){ "+
+                               "                       $z;                                                                               "+
+                               "               }                                                                                         "+
+                               "}                                                                                                        ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt34() {
+               String code =
+                               "function fx() {                                                                            "+
+                               "       for(var x=5,y,$z=0; x<3 && @uz<3 ;x+=1,@uz++,y++){  "+
+                               "                       @uz;                                                                        "+
+                               "               }                                                                                           "+
+                               "}                                                                                                          ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt35() {
+               String code =
+                               "function fx() {                                                                                "+
+                               "       var e = (new Date).getTime();                                           "+
+                               "       if(e > this.getTime() && e < this.getTime()) {          "+
+                               "               for(@de = 0;@ue < arguments.length ; @m$e++) {  "+
+                               "                       if(arguments[@ue] === this._dev.type) {         "+
+                               "                               return arguments[@ue];                                  "+
+                               "                       }                                                                                       "+
+                               "               }                                                                                               "+
+                               "       }                                                                                                       "+
+                               "}                                                                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForStmt36() {
+               String code =
+                               "function fx()         "+
+                               "{                     "+
+                               "       var $x = 1;        "+
+                               "       for( ; ; )         "+
+                               "       {                  "+
+                               "               @ux + 1;           "+
+                               "           if(@ux == 0 )  "+
+                               "            break;    "+
+                               "       }                  "+
+                               "       @ux + 1;                "+
+                               "}                     ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedForStmt01() {
+               String code =
+                               "functoin fx()                          "+
+                               "{                                                      "+
+                               "       var @dx=0;                              "+
+                               "       for(;x<10;@dx++) {              "+
+                               "               $x;                                     "+
+                               "               for(x=x*3;x<0;x++) {"+
+                               "                       x = 1;                  "+
+                               "                       break;          "+
+                               "               }                                       "+
+                               "               x;                                  "+
+                               "       }                                               "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedForStmt02() {
+               String code =
+                               "functoin fx()                          "+
+                               "{                                                      "+
+                               "       var @dx=0;                              "+
+                               "       for(;x<10;@dx++) {              "+
+                               "               $x;                                     "+
+                               "               for(x=x*3;x<0;x++) {"+
+                               "                       x = 1;                  "+
+                               "                       continue;        "+
+                               "               }                                       "+
+                               "               x++;                        "+
+                               "       }                                               "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedForStmt03() {
+               String code =
+                               "functoin fx()                          "+
+                               "{                                                      "+
+                               "       var @dx=0;                              "+
+                               "       for(;x<10;)     {               "+
+                               "               $x;                                     "+
+                               "               for(x=x*3;x<0;x++) {"+
+                               "                       x = 1;                  "+
+                               "                       continue;       "+
+                               "               }                                       "+
+                               "               @dx++;                      "+
+                               "       }                                               "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedForStmt04() {
+               String code =
+                               "functoin fx()                          "+
+                               "{                                                      "+
+                               "       var @dx=0;                              "+
+                               "       label:for(;x<10;)       {       "+
+                               "               $x;                                     "+
+                               "               for(x=x*3;x<0;x++) {"+
+                               "                       @dx = 1;                "+
+                               "                       continue label; "+
+                               "               }                                       "+
+                               "               @dx++;                      "+
+                               "       }                                               "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedForStmt05() {
+               String code =
+                               "functoin fx()                          "+
+                               "{                                                      "+
+                               "       var @dx=0;                              "+
+                               "       label:for(;x<10;)       {       "+
+                               "               $x;                                     "+
+                               "               for(x=x*3;x<0;x++) {"+
+                               "                       x = 1;                  "+
+                               "                       break label;    "+
+                               "               }                                       "+
+                               "               @dx++;                      "+
+                               "       }                                               "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForInStmt01() {
+               String code =
+                               "function fx() {                                        "+
+                               "       for(var @dx in {y:7,z:34}) {    "+
+                               "               $x;                                                     "+
+                               "       }                                                               "+
+                               "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForInStmt02() {
+               String code =
+                               "function fx(x) {                                       "+
+                               "       for(@dx in {y:7,z:34}) {            "+
+                               "               $x;                                                     "+
+                               "       }                                                               "+
+                               "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForInStmt03() {
+               String code =
+                               "function fx()                                  "+
+                               "{                                                              "+
+                               "       var @dlist = {x:7,y:34};        "+
+                               "       for(var x in $list) {           "+
+                               "               x;                                              "+
+                               "       }                                                       "+
+                               "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForInStmt04() {
+               String code =
+                               "function fx()                                          "+
+                               "{                                                                      "+
+                               "       var list = {x:7,y:34};                  "+
+                               "       for(var x in list) {                    "+
+                               "               @ulist;                                         "+
+                               "               $list={x:37,y:7};                   "+
+                               "       if( x == 10 ) break;            "+
+                               "       }                                                               "+
+                               "   @ulist;                                                     "+
+                               "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForInStmt05() {
+               String code =
+                               "function fx()                                          "+
+                               "{                                                                      "+
+                               "       var list = {x:7,y:34};                  "+
+                               "       var idx=0;                                              "+
+                               "       for(var x = @didx++ in list) {  "+
+                               "               x;                                                      "+
+                               "               $idx;                                           "+
+                               "       }                                                               "+
+                               "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForInStmt06() {
+               String code =
+                               "function fx()                                          "+
+                               "{                                                                      "+
+                               "       var list = {x:7,y:34};                  "+
+                               "       var @didx=0;                                    "+
+                               "       for(var x = ++$@midx in list) { "+
+                               "               x;                                                      "+
+                               "               @uidx;                                          "+
+                               "       }                                                               "+
+                               "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForInStmt07() {
+               String code =
+                               "function fx()                                          "+
+                               "{                                                                      "+
+                               "       var list = {x:7,y:34};                  "+
+                               "       var @didx=0;                                    "+
+                               "       for(var x = $idx++ in list) {   "+
+                               "               x;                                                      "+
+                               "               break;                                          "+
+                               "               idx;                                            "+
+                               "       }                                                               "+
+                               "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForInStmt08() {
+               String code =
+                               "function fx()                                          "+
+                               "{                                                                      "+
+                               "       var list = {x:7,y:34};                  "+
+                               "       for(var @dx in list) {                  "+
+                               "               x = $x;                                         "+
+                               "       }                                                               "+
+                               "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForInStmt09() {
+               String code =
+                               "function fx()                                          "+
+                               "{                                                                      "+
+                               "       var list = {x:7,y:34};                  "+
+                               "       for(var @dx in list) {                  "+
+                               "               x = $x;                                         "+
+                               "               continue;                                       "+
+                               "       }                                                               "+
+                               "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForInStmt10() {
+               String code =
+                               "function fx() {                                "+
+                               "       var list = {x:7,y:34};          "+
+                               "       var a;                                          "+
+                               "       for(var x in @da=list) {        "+
+                               "               $a;                                             "+
+                               "       }                                                       "+
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForInStmt11() {
+               String code =
+                               "function fx() {                                "+
+                               "       var list = {x:7,y:34};          "+
+                               "       var @di=0;                                      "+
+                               "       for(var x in {x:i, i:$i}) {     "+
+                               "               i++;                                    "+
+                               "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForInStmt12() {
+               String code =
+                               "function fx() {                                                                  "+
+                               "       var list = {x:7,y:34,z:37};                                       "+
+                               "       var i  =34;                                                                       "+
+                               "       for( var data in list = {x:++i, y:++@di } ) { "+
+                               "           console.log( list[data],'..', @ui );          "+
+                               "           console.log(++$@mi);                                          "+
+                               "       }                                                                                         "+
+                               "} ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForInStmt13() {
+               String code =
+                       "function fx(i) {                                               "+
+                       "       var @didx=0;                                            "+
+                       "       for( var x = ++$@midx in {x:i,y:i}) { "+
+                       "               idx = 10;                                               "+
+                       "       }                                                                       "+
+                       "       @uidx;                                                          ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForInStmt14() {
+               String code =
+                       "function fx(i) {                                               "+
+                       "       var @didx=0;                                            "+
+                       "       for( var x = ++$@midx in {}) {      "+
+                       "               idx = 10;                                               "+
+                       "       }                                                                       "+
+                       "       @uidx;                                                          ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForInStmt15() {
+               String code =
+                       "function fx(i) {                                               "+
+                       "       var idx=0;                                                      "+
+                       "       for( var x = ++idx in {x:i,y:i}) {  "+
+                       "               $idx = 10;                                              "+
+                       "       }                                                                       "+
+                       "       @uidx;                                                          "+
+                       "}                                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForInStmt16() {
+               String code =
+                       "function fx(i) {                                               "+
+                       "       var idx=0;                                                      "+
+                       "       for( var x = ++@didx in {x:i,y:i}) {"+
+                       "               @didx = 10;                                             "+
+                       "       }                                                                       "+
+                       "       $idx;                                                           "+
+                       "}                                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForInStmt17() {
+               String code =
+                       "function fx(i) {                                               "+
+                       "       var @didx=0;                                            "+
+                       "       for( var x in {x:i,y:i}) {                      "+
+                       "               @didx = 10;                                             "+
+                       "       }                                                                       "+
+                       "       $idx;                                                           "+
+                       "}                                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForInStmt18() {
+               String code =
+                               "function fx(another_stooge) {                                  "+
+                               "       var name;                                                                       "+
+                               "       for ($name in another_stooge) {                         "+
+                               "               if( typeof another_stooge[@uname] !== 'function' ) {  "+
+                               "                       document.writeln(@uname + ': ' + another_stooge); "+
+                               "               }                                                                                                       "+
+                               "       }                                                                                                               "+
+                               "       @uname;                                                                                                 "+
+                               "}                                                                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testForInStmt19() {
+               String code =
+                               "function fx($another_stooge) {                                 "+
+                               "       var name;                                                                       "+
+                               "       for (name in @uanother_stooge) {                        "+
+                               "               if( typeof @uanother_stooge[name] !== 'function' ) {  "+
+                               "                       document.writeln(name + ': ' + @uanother_stooge); "+
+                               "               }                                                                                                         "+
+                               "       }                                                                                                                 "+
+                               "       delete @uanother_stooge.nickname;                                         "+
+                               "}                                                                                                        ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testWhileStmt01() {
+               String code =
+                               "function fx()           "+
+                               "{                   "+
+                               "       var $x = 10;     "+
+                               "       while( @ux )     "+
+                               "       {                "+
+                               "               x = @ux + 1; "+
+                               "       }                "+
+                               "       @ux;             "+
+                               "}                   ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testWhileStmt02() {
+               String code =
+                               "function fx()         "+
+                               "{                                         "+
+                               "       var x = 10;                "+
+                               "       while( @ux )       "+
+                               "       {                                  "+
+                               "               $x = @ux + 1;  "+
+                               "       }                                  "+
+                               "       @ux;                       "+
+                               "}                                         ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testWhileStmt03() {
+               String code =
+                               "function fx()         "+
+                               "{                                         "+
+                               "       var @dx = 10;      "+
+                               "       while( x )                 "+
+                               "       {                                  "+
+                               "               @dx = $x + 1;  "+
+                               "       }                                  "+
+                               "       x;                                 "+
+                               "}                                     ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testWhileStmt04() {
+               String code =
+                               "function fx()         "+
+                               "{                                         "+
+                               "       var @dx = 10;      "+
+                               "       while( $x )        "+
+                               "       {                  "+
+                               "               @dx = x + 1;   "+
+                               "       }                                  "+
+                               "       x;                                 "+
+                               "}                                         ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testWhileStmt05() {
+               String code =
+                               "function fx()              "+
+                               "{                                              "+
+                               "       var @dx = 10;           "+
+                               "       while( x )                      "+
+                               "       {                                       "+
+                               "               @dx = x + 1;    "+
+                               "       }                                       "+
+                               "       $x;                             "+
+                               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testWhileStmt06() {
+               String code =
+                               "function fx()                  "+
+                               "{                                              "+
+                               "       var $x = 10;            "+
+                               "       while( @ux )            "+
+                               "       {                                       "+
+                               "               continue;               "+
+                               "               x = x + 1;              "+
+                               "       }                                       "+
+                               "       @ux;                            "+
+                               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testWhileStmt07() {
+               String code =
+                               "function fx()                  "+
+                               "{                                              "+
+                               "       var x = 10;                     "+
+                               "       while( x )                      "+
+                               "       {                                       "+
+                               "               $x = x + 1;             "+
+                               "               break;                  "+
+                               "       }                                       "+
+                               "       @ux;                            "+
+                               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testWhileStmt08() {
+               String code =
+                               "function fx()          "+
+                               "{                              "+
+                               "       var @dx = 10;   "+
+                               "       var y;                  "+
+                               "       while( x )      "+
+                               "       {                       "+
+                               "               y = x + 1;      "+
+                               "       }                       "+
+                               "       $x;                     "+
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testWhileStmt09() {
+               String code =
+                               "function fx()            "+
+                               "{                                "+
+                               "       var x = 10;       "+
+                               "       while( @ux )      "+
+                               "       {                         "+
+                               "               $x = @ux + 1; "+
+                               "       }                 "+
+                               "       @ux;              "+
+                               "}                    ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testWhileStmt10() {
+               String code =
+                               "function fx ()         "+
+                               "{                              "+
+                               "       var @dx = 10;   "+
+                               "       var y;                  "+
+                               "       while( x )      "+
+                               "       {                       "+
+                               "               y = $x + 1; "+
+                               "       }                       "+
+                               "       x++;                    "+
+                               "}                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedWhileStmt01() {
+               String code =
+                               "function fx()                      "+
+                               "{                                                      "+
+                               "       var @dx=0;                              "+
+                               "       while(1) {                              "+
+                               "               $x;                                 "+
+                               "               while(1) {                      "+
+                               "                       x = 1;                  "+
+                               "                       break;          "+
+                               "           x;              "+
+                               "               }                                       "+
+                               "               @dx=1;                          "+
+                               "       }                                               "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedWhileStmt02() {
+               String code =
+                               "function fx()       "+
+                               "{                                       "+
+                               "       var x;                   "+
+                               "       while(1) {               "+
+                               "               @ux;             "+
+                               "               while(1) {       "+
+                               "                       $x = 1;  "+
+                               "                       break;   "+
+                               "           x;       "+
+                               "               }                        "+
+                               "               @ux;             "+
+                               "       }                                "+
+                               "}                                       ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedWhileStmt03() {
+               String code =
+                               "function fx()  "+
+                               "{                                                      "+
+                               "       var @dx=0;                              "+
+                               "       while(1) {                              "+
+                               "               x;                                      "+
+                               "               while(1) {                      "+
+                               "                       @dx = 1;                "+
+                               "                       break;                  "+
+                               "               }                                       "+
+                               "               $x;                                 "+
+                               "       }                                               "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedWhileStmt04() {
+               String code =
+                               "function fx()  "+
+                               "{                                                      "+
+                               "       var x;                                  "+
+                               "       while(1) {                              "+
+                               "               @ux;                            "+
+                               "               while(1) {                      "+
+                               "                       $x = @ux + 1;   "+
+                               "                       break;                  "+
+                               "               }                                       "+
+                               "               @ux;                            "+
+                               "       }                                               "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedWhileStmt05() {
+               String code =
+                               "function fx()                      "+
+                               "{                                                      "+
+                               "       var @dx=1;                              "+
+                               "       while(1) {                              "+
+                               "               x;                                      "+
+                               "               while(1) {                      "+
+                               "                       x = $x + 1;             "+
+                               "                       break;                  "+
+                               "               }                                       "+
+                               "               @dx++;                          "+
+                               "       }                                               "+
+                               "   x++;                                    "+
+                               "}                          ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedWhileStmt06() {
+               String code =
+                               "function fx()                  "+
+                               "{                                                      "+
+                               "       var @dx=1;                              "+
+                               "       while(1) {                              "+
+                               "               x;                                      "+
+                               "               while(1) {                      "+
+                               "                       @dx = x + 1;    "+
+                               "                       break;                  "+
+                               "               }                                       "+
+                               "               $x;                                 "+
+                               "       }                                               "+
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedWhileStmt07() {
+               String code =
+                               "function fx() "+
+                               "{                                               "+
+                               "       var x;                           "+
+                               "       while(1) {                       "+
+                               "               @ux;                     "+
+                               "               while(1) {               "+
+                               "                       $x = 1;          "+
+                               "                       continue;        "+
+                               "           x;           "+
+                               "               }                                "+
+                               "               @ux;                     "+
+                               "       }                                        "+
+                               "}                       ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedWhileStmt08() {
+               String code =
+                               "function fx() "+
+                               "{                                               "+
+                               "       var $x = -1;         "+
+                               "       while(1) {                       "+
+                               "               @ux++;               "+
+                               "               while(1) {               "+
+                               "                       x = 1;       "+
+                               "                       continue;        "+
+                               "           x;           "+
+                               "               }                                "+
+                               "               x;                           "+
+                               "       }                                        "+
+                               "}                       ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedWhileStmt09() {
+               String code =
+                               "function fx()                  "+
+                               "{                                              "+
+                               "       var $x=0;                       "+
+                               "       while(1) {                      "+
+                               "               @ux;                    "+
+                               "               while(1) {              "+
+                               "                   @ux++;      "+
+                               "                       continue;       "+
+                               "               }                               "+
+                               "               @ux;                    "+
+                               "       }                                       "+
+                               "}                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedWhileStmt10() {
+               String code =
+                               "function fx()  "+
+                               "{                                                      "+
+                               "       var x;                                  "+
+                               "       while(1) {                              "+
+                               "               @ux;                            "+
+                               "               while(1) {                      "+
+                               "                       $x = @ux + 1;   "+
+                               "                       continue;               "+
+                               "               }                                       "+
+                               "               @ux;                            "+
+                               "       }                                               "+
+                               "}                          ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedWhileStmt11() {
+               String code =
+                       "function fx()                   "+
+                       "{                               "+
+                       "       var @dx=0;                               "+
+                       "       while(1) {                               "+
+                       "               x;                                       "+
+                       "               while(1) {                       "+
+                       "                       @m$x++;                  "+
+                       "                       continue;                "+
+                       "                       x;                               "+
+                       "               }                                    "+
+                       "               @ux;                             "+
+                       "               @dx=0;                           "+
+                       "   }                                    "+
+                       "}                                                       ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedWhileStmt12() {
+               String code =
+                               "function fx()         "+
+                               "{                                 "+
+                               "       var @dx=34;        "+
+                               "       while(1) {             "+
+                               "               x;                         "+
+                               "               while(1) {         "+
+                               "                       @dx = 1;   "+
+                               "                       continue;  "+
+                               "                       x++;       "+
+                               "               }                          "+
+                               "               $x;                        "+
+                               "   }                      "+
+                               "}                     ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testDoWhileStmt01() {
+               String code =
+                               "function fx()                  "+
+                               "{                                      "+
+                               "       var $x = 5;             "+
+                               "       do{                             "+
+                               "               x = @ux + 1;    "+
+                               "       } while( x < 10 );  "+
+                               "       x = x + 5;              "+
+                               "}                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testDoWhileStmt02() {
+               String code =
+                               "function fx()                   "+
+                               "{                                       "+
+                               "       var x = 5;               "+
+                               "       do{                              "+
+                               "               $x = @ux + 1;    "+
+                               "       } while( @ux < 10 ); "+
+                               "       x = @ux + 5;             "+
+                               "}                                       ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testDoWhileStmt03() {
+               String code =
+                               "function fx()                    "+
+                               "{                                        "+
+                               "       var @dx = 5;              "+
+                               "       do{                               "+
+                               "               @dx = $x + 1;     "+
+                               "       } while( x < 10 );    "+
+                               "       x = x + 5;                "+
+                               "}                                        ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testDoWhileStmt04() {
+               String code =
+                               "function testDoWhile04() "+
+                               "{                                        "+
+                               "       var x = 5;                "+
+                               "       do{                               "+
+                               "               @dx = x + 1;      "+
+                               "       } while( x < 10 );    "+
+                               "       x = $x + 5;               "+
+                               "}                                        ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testDoWhileStmt05() {
+               String code =
+                               "function fx()                          "+
+                               "{                                                  "+
+                               "       var x = 5;                      "+
+                               "       do{                                     "+
+                               "               @dx = @ux + 1;          "+
+                               "       } while( ( $x += 2 ) < 10 );"+
+                               "       x = @ux + 5;                    "+
+                               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testDoWhileStmt06() {
+               String code =
+                               "function fx()           "+
+                               "{                                       "+
+                               "       var $x = 5;          "+
+                               "       do{                              "+
+                               "               continue;        "+
+                               "               x = x + 1;       "+
+                               "       } while( @ux > 10 ); "+
+                               "       x = @ux + 5;             "+
+                               "}                                       ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testDoWhileStmt07() {
+               String code =
+                               "function fx()                           "+
+                               "{                                       "+
+                               "       var @dx = 5;             "+
+                               "       do{                                  "+
+                               "               continue;            "+
+                               "               x = x + 1;           "+
+                               "       } while( $x > 10 );      "+
+                               "       x = x + 5;                   "+
+                               "}                                           ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testDoWhileStmt08() {
+               String code =
+                               "function fx()                  "+
+                               "{                                      "+
+                               "       var x = 5;              "+
+                               "       do{                             "+
+                               "               $x = x + 1;     "+
+                               "               break;                  "+
+                               "       } while( x > 10 );  "+
+                               "       x = @ux + 5;            "+
+                               "}                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testDoWhileStmt09() {
+               String code =
+                               "function fx()                  "+
+                               "{                                              "+
+                               "       var x = 5;              "+
+                               "       do{                             "+
+                               "               @dx = x + 1;    "+
+                               "       } while( $x < 10 ); "+
+                               "       x = x + 5;              "+
+                               "}                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testDoWhileStmt10() {
+               String code =
+                               "function fx()                          "+
+                               "{                                                      "+
+                               "       var $x = 5;                     "+
+                               "       var y;                                  "+
+                               "   do{                                 "+
+                               "               y = @ux + 1;            "+
+                               "       }while( @ux < 10 );     "+
+                               "       x =  @ux + 1;               "+
+                               "}                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testDoWhileStmt11() {
+               String code =
+                               "function fx()            "+
+                               "{                                "+
+                               "       var @dx = 5;      "+
+                               "       var y;                    "+
+                               "       do{                   "+
+                               "               y = $x + 1;   "+
+                               "       }while( x < 10 ); "+
+                               "       x =  x + 1;       "+
+                               "}                    ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testDoWhileStmt12() {
+               String code =
+                               "function fx()            "+
+                               "{                                "+
+                               "       var @dx = 5;      "+
+                               "       var y;                    "+
+                               "       do{                       "+
+                               "               y = x + 1;    "+
+                               "       }while( $x < 10 );"+
+                               "       x =  x + 1;       "+
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testDoWhileStmt13() {
+               String code =
+                               "function fx()                  "+
+                               "{                                      "+
+                               "       var @dx = 5;            "+
+                               "       var y;                          "+
+                               "       do{                         "+
+                               "               y = x + 1;      "+
+                               "       }while( x < 10 );       "+
+                               "       x =  $x + 1;            "+
+                               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedDoWhileStmt01() {
+               String code =
+                               "function fx()                  "+
+                               "{                                              "+
+                               "       var $x = 10;            "+
+                               "       do{                                     "+
+                               "               do {                    "+
+                               "                       x = 1;          "+
+                               "                       break;          "+
+                               "               } while(1);             "+
+                               "               x;                              "+
+                               "       } while(1);                     "+
+                               "       x;                                      "+
+                               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedDoWhileStmt02() {
+               String code =
+                               "function fx()         "+
+                               "{                                         "+
+                               "       var x = 10;                "+
+                               "       do{                                "+
+                               "               do {               "+
+                               "                       $x = 1;    "+
+                               "                       break;     "+
+                               "               } while(1);        "+
+                               "               @ux;               "+
+                               "       } while(1);                "+
+                               "       @ux;                            "+
+                               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedDoWhileStmt03() {
+               String code =
+                               "function fx()              "+
+                               "{                                                      "+
+                               "       var x = 10;                             "+
+                               "       do{                                             "+
+                               "               do {                            "+
+                               "                       @dx = 1;                "+
+                               "                       break;                  "+
+                               "               } while(1);                     "+
+                               "               $x;                                 "+
+                               "       } while(1);                             "+
+                               "       x;                                              "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedDoWhileStmt04() {
+               String code =
+                               "function fx()  "+
+                               "{                                                      "+
+                               "       var x = 10;                             "+
+                               "       do{                                             "+
+                               "               do {                            "+
+                               "                       @dx = 1;                "+
+                               "                       break;                  "+
+                               "               } while(1);                     "+
+                               "               x;                                      "+
+                               "       } while(1);                             "+
+                               "       $x;                                         "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedDoWhileStmt05() {
+               String code =
+                               "function fx()              "+
+                               "{                                                      "+
+                               "       var @dx = 10;                   "+
+                               "       do{                                             "+
+                               "               do {                            "+
+                               "                       @dx = $x + 1;   "+
+                               "                       break;                  "+
+                               "               } while(1);                     "+
+                               "               x;                                      "+
+                               "       } while(1);                             "+
+                               "       x;                                              "+
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedDoWhileStmt06() {
+               String code =
+                               "function fx()              "+
+                               "{                                                      "+
+                               "       var x = 10;                             "+
+                               "       do{                                             "+
+                               "               do {                            "+
+                               "                       $x = @ux + 1;   "+
+                               "                       break;                  "+
+                               "               } while(1);                     "+
+                               "               @ux;                            "+
+                               "       } while(1);                             "+
+                               "       @ux;                                    "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedDoWhileStmt07() {
+               String code =
+                               "function fx()  "+
+                               "{                                                              "+
+                               "       var x = 10;                                     "+
+                               "       do{                                                     "+
+                               "               do {                                    "+
+                               "                       @dx = x + 1;            "+
+                               "                       break;                          "+
+                               "           x;                  "+
+                               "               } while(1);                             "+
+                               "               $x;                                             "+
+                               "       } while(1);                                     "+
+                               "       x;                                                      "+
+                               "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedDoWhileStmt08() {
+               String code =
+                               "function fx()                          "+
+                               "{                                                      "+
+                               "       var x = 10;                             "+
+                               "       do{                                             "+
+                               "               do {                            "+
+                               "                       @dx = x + 1;    "+
+                               "                       break;                  "+
+                               "               } while(1);                     "+
+                               "               x;                                      "+
+                               "       } while(1);                             "+
+                               "       $x;                                             "+
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedDoWhileStmt09() {
+               String code =
+                               "function fx()                      "+
+                               "{                                                      "+
+                               "       var x = 10;                             "+
+                               "       do{                                             "+
+                               "               do {                            "+
+                               "                       @dx = 1;                "+
+                               "                       continue;               "+
+                               "               } while(1);                     "+
+                               "               $x;                                 "+
+                               "       } while(1);                             "+
+                               "       x;                                              "+
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedDoWhileStmt10() {
+               String code =
+                               "function fx()                          "+
+                               "{                                                      "+
+                               "       var x = 10;                             "+
+                               "       do{                                             "+
+                               "               do {                            "+
+                               "                       @dx = 1;                "+
+                               "                       continue;               "+
+                               "               } while(1);                     "+
+                               "               x;                                      "+
+                               "       } while(1);                             "+
+                               "       $x;                                             "+
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedDoWhileStmt11() {
+               String code =
+                               "function fx()  "+
+                               "{                                                      "+
+                               "       var x = 10;                             "+
+                               "       do{                                             "+
+                               "               do {                            "+
+                               "                       $x = @ux + 1;   "+
+                               "                       continue;               "+
+                               "               } while(1);                     "+
+                               "               @ux;                            "+
+                               "       } while(1);                             "+
+                               "       @ux;                                    "+
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedDoWhileStmt12() {
+               String code =
+                               "function fx()                          "+
+                               "{                                                      "+
+                               "       var @dx = 10;                   "+
+                               "       do{                                             "+
+                               "               do {                            "+
+                               "                       @dx = $x + 1;   "+
+                               "                       continue;               "+
+                               "               } while(1);                     "+
+                               "               x;                                      "+
+                               "       } while(1);                             "+
+                               "       x;                                              "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedDoWhileStmt13() {
+               String code =
+                               "function fx()              "+
+                               "{                                                      "+
+                               "       var x = 10;                             "+
+                               "       do{                                             "+
+                               "               do {                            "+
+                               "                       @dx = x + 1;    "+
+                               "                       continue;               "+
+                               "               } while(1);                     "+
+                               "               $x;                                 "+
+                               "       } while(1);                             "+
+                               "       x;                                              "+
+                               "}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testNestedDoWhileStmt14() {
+               String code =
+                               "function fx()              "+
+                               "{                                                      "+
+                               "       var x = 10;                             "+
+                               "       do{                                             "+
+                               "               do {                            "+
+                               "                       @dx = x + 1;    "+
+                               "                       continue;               "+
+                               "               } while(1);                     "+
+                               "               x;                                      "+
+                               "       } while(1);                             "+
+                               "       $x;                                         "+
+                               "}                           ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt01() {
+               String code =
+                       "function fx() {                            "+
+                       "       var @dx = 0;                            "+
+                       "       label: while (x<3) {            "+
+                       "               label2:while($x<5) {    "+
+                       "                       x = 0;                          "+
+                       "                       break label;            "+
+                       "               }                                               "+
+                       "               x;                                              "+
+                       "       }                                                       "+
+               "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt02() {
+               String code =
+                       "function fx() {                            "+
+                       "       var @dx = 0;                            "+
+                       "       label: while (x<3) {            "+
+                       "               while(x<5) {                    "+
+                       "                       @dx = 0;                        "+
+                       "                       break label;            "+
+                       "               }                                               "+
+                       "               x;                                              "+
+                       "       }                           "+
+                       "   $x;                                                 "+
+               "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt03() {
+               String code =
+                       "function fx() {                            "+
+                       "       var x = 0;                                  "+
+                       "       label: while (x<3) {            "+
+                       "               while(x<5) {                    "+
+                       "                       $x = 0;                     "+
+                       "                       break label;            "+
+                       "               }                                               "+
+                       "               x;                                              "+
+                       "       }                           "+
+                       "   @ux;                                                "+
+               "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt04() {
+               String code =
+                       "function fx() {                            "+
+                       "       var @dx = 0;                            "+
+                       "       label: while (x<3) {            "+
+                       "               while(x<5) {                    "+
+                       "                       x = 0;                      "+
+                       "                       break label;            "+
+                       "               }                                               "+
+                       "               $x;                                             "+
+                       "       }                          " +
+               "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt05() {
+               String code =
+                       "function fx() {                        "+
+                       "       var x = 0;                              "+
+                       "       label: while (x<3) {    "+
+                       "                       $x = 0;                 "+
+                       "                       break label;    "+
+                       "                   x;                          "+
+                       "       }                       "+
+                       "   @ux;                                        "+
+               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt06() {
+               String code =
+                       "function fx() {                "+
+                       "var x=0;                               "+
+                       "label: while (@ux<3) { "+
+                       "               $x = 0;                 "+
+                       "               @ux;                    "+
+                       "               continue label; "+
+                       "               x;                              "+
+                       "    }                                  "+
+                       "    @ux;               "+
+                       "        x=0;                           "+
+                       "label: while(x) {      "+
+                       "         }                     "+
+                   "}                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt07() {
+               String code =
+                               "function fx() {                "+
+                               "var x=2;                               "+
+                               "label: while (@ux<3) { "+
+                               "               $x = 0;                 "+
+                               "               @ux;                    "+
+                               "               continue;           "+
+                               "               x;                              "+
+                               "    }                                  "+
+                           "}                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt08() {
+               String code =
+                       "function fx()                          "+
+                   "{                                                  "+
+                       "       var x;                                  "+
+                       "       label: while (@ux<3) {  "+
+                       "               while(@ux<5) {          "+
+                       "                       $x = 0;                 "+
+                       "                       continue label; "+
+                       "               }                                       "+
+                       "         @ux;                                  "+
+                       "   }                                           "+
+                   "}                                                  ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt09() {
+               String code =
+                               "function fx() {                                "+
+                               "       var x=0;                                        "+
+                               "       label_1: while (@ux<3)          "+
+                               "       {                                                       "+
+                               "               label_2:while(@ux<5) {  "+
+                               "                       $x = 0;                         "+
+                               "                       continue label_1;       "+
+                               "               }                                               "+
+                               "               @ux;                                    "+
+                               "       }                                                       "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt10() {
+               String code =
+                               "function fx() {                                "+
+                               "       var x=0;                                        "+
+                               "       label_1: while (@ux<3)          "+
+                               "       {                                                       "+
+                               "               label_2:while(@ux<5) {  "+
+                               "                       $x = 0;                         "+
+                               "                       continue label_1;       "+
+                               "               }                                               "+
+                               "               @ux;                                    "+
+                               "       }                                                       "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt11() {
+               String code =
+                               "function fx() {                                "+
+                               "       var @dx=0;                                      "+
+                               "       label_1: while (x<3)            "+
+                               "       {                                                       "+
+                               "               label_2:while(x<5) {    "+
+                               "                       @dx = 0;                        "+
+                               "                       continue label_1;       "+
+                               "               }                                               "+
+                               "               $x;                                         "+
+                               "       }                                                       "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt12() {
+               String code =
+                       "function fx(@dx) {                             "+
+                       "       label_w: while(@ux<3) {         "+
+                       "               @m$x++;                                 "+
+                       "               continue label_w;               "+
+                       "       }                                                       "+
+                       "       label_w: while( @ux < 10 ) {"+
+                       "               @ux++;                                  "+
+                       "               break label_w;                  "+
+                       "       }                                                       "+
+                       "  @ux;                                                 "+
+                       "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt13() {
+               String code =
+                       "function fx(x)                         "+
+                       "{                                                      "+
+                       "       label:do {                              "+
+                       "               x;                                      "+
+                       "               do {                            "+
+                       "                       $x = 3;                 "+
+                       "                       break label;    "+
+                       "               } while (x < 3 );       "+
+                       "               x;                                      "+
+                   "   } while (x<3);                  "+
+                       "   @ux;                                        "+
+                       "};                                                     ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt14() {
+               String code =
+                       "function fx(x)                                 "+
+                       "{                                                              "+
+                       "       label:do {                                      "+
+                       "               @ux;                                    "+
+                       "               do {                                    "+
+                       "                       $x = 3;                         "+
+                       "                       continue label;         "+
+                       "               } while (x < 3 );               "+
+                       "               x;                                              "+
+                   "   } while (@ux<3);                        "+
+                       "   @ux;                                                "+
+                       "};                                                             ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt15() {
+               String code =
+                               "function fx()                  "+
+                               "{                                              "+
+                               "       var @dx = 0;            "+
+                               "       label:do {                      "+
+                               "               do {                    "+
+                               "       } while($x<3);  "+
+                               "       } while(x<3);           "+
+                               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt16() {
+               String code =
+                               "function fx()                  "+
+                               "{                                              "+
+                               "       var @dx = 0;            "+
+                               "       label:do {                      "+
+                               "               do {                    "+
+                               "       } while(x<3);   "+
+                               "       } while($x<3);          "+
+                               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt17() {
+               String code =
+                               "function fx(y)                 "+
+                               "{                                              "+
+                               "       var $x = 0;                     "+
+                               "       label_1:do {            "+
+                               "       } while(@ux<3);         "+
+                               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt18() {
+               String code =
+                       "function fx()                  "+
+                       "{                                              "+
+                       "       var $x = 0;                     "+
+                       "       label_1: {                      "+
+                       "               @ux+1;                  "+
+                       "               break label_1;  "+
+                       "               x;                              "+
+                       "    }                                  "+
+                       "       @ux;                            "+
+                       "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt19() {
+               String code =
+                       "function fx()                                  "+
+                       "{                                                              "+
+                       "       var $x = 0;                                     "+
+                       "       while( @ux < 10 ) {                     "+
+                       "               @ux;                                    "+
+                       "               label: if( @ux != 10 ) {"+
+                       "                       @ux;                            "+
+                       "                       break label;            "+
+                       "                       x;                                      "+
+                       "               }                                               "+
+                       "               @ux;                                    "+
+                       "       }                                                       "+
+                       "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt20() {
+               String code =
+                       "function fx()                                  "+
+                       "{                                                              "+
+                       "       var y=34+7,z,x=10;                      "+
+                       "       label1:label2: for($x=0;@ux<3;x++){     "+
+                       "       if(@ux==3) {                                            "+
+                       "               y + 3;                                                  "+
+                       "               break label1;                                   "+
+                       "       } else {                                                        "+
+                       "               @ux+3;                                                  "+
+                       "               break label2;                                   "+
+                       "       }                                                                       "+
+                       "  }                                                                    "+
+                       "}                                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt21() {
+               String code =
+                       "function fx(x,y)                                       "+
+                       "{                                                                      "+
+                       "       l1:if(y) {                                              "+
+                       "               while(x) {                                      "+
+                       "                       $x = 1;                                 "+
+                       "                       break l1;                               "+
+                       "               }                                                       "+
+                       "               x;                                                      "+
+                       "       }                                                               "+
+                       "       @ux;                                                    "+
+                       "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt22() {
+               String code =
+                       "function fx(x,y)                               "+
+                       "{                                                              "+
+                       "       l2:while(y<10) {                        "+
+                       "               l1:if(y) {                              "+
+                       "                       while(@ux) {            "+
+                       "                               $x = 1;                 "+
+                       "                               break l1;               "+
+                       "                       }                                       "+
+                       "                       @ux;                            "+
+                       "               }                                               "+
+                       "               @ux;                                    "+
+                       "       }                                                       "+
+                       "       @ux;                                            "+
+                       "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt23() {
+               String code =
+                       "function fx(x,y)                               "+
+                       "{                                                              "+
+                       "       l2:while(y<10) {                        "+
+                       "               l1:if(y) {                              "+
+                       "                       while(x) {                      "+
+                       "                               $x = 1;                 "+
+                       "                               break l2;               "+
+                       "                       }                                       "+
+                       "                       x;                                      "+
+                       "               }                                               "+
+                       "               x;                                              "+
+                       "       }                                                       "+
+                       "       @ux;                                            "+
+                       "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt24() {
+               String code =
+                               "function fx(x,y)                               "+
+                               "{                                                              "+
+                               "l4:l3:l2:while(y<10) {                 "+
+                               "       l1:if(y) {                                      "+
+                               "               while(@ux) {                    "+
+                               "                       $x = 1;                         "+
+                               "                       continue l2;            "+
+                               "               }                                               "+
+                               "            @ux;                                       "+
+                               "          }                                            "+
+                               "          @ux;                                         "+
+                               "     }                                                 "+
+                           "   @ux;                                            "+
+                               "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt25() {
+               String code =
+                               "function fx(x,y)                               "+
+                               "{                                                              "+
+                               "l4:l3:l2:while(y<10) {                 "+
+                               "       l1:if(y) {                                      "+
+                               "               while(@ux) {                    "+
+                               "                       $x = 1;                         "+
+                               "                       continue l3;            "+
+                               "               }                                               "+
+                               "            @ux;                                       "+
+                               "          }                                            "+
+                               "          @ux;                                         "+
+                               "     }                                                 "+
+                           "   @ux;                                            "+
+                               "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt26()  {
+               String code =
+                               "function fx(x,y)                               "+
+                               "{                                                              "+
+                               "l4:l3:l2:while(y<10) {                 "+
+                               "       l1:if(y) {                                      "+
+                               "               while(@ux) {                    "+
+                               "                       $x = 1;                         "+
+                               "                       continue l4;            "+
+                               "               }                                               "+
+                               "            @ux;                                       "+
+                               "          }                                            "+
+                               "          @ux;                                         "+
+                               "     }                                                 "+
+                           "   @ux;                                            "+
+                               "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt27() {
+               String code =
+                               "function fx(x)                                 "+
+                               "{                                                              "+
+                               "l4:l3:l2:while(x<10) {                 "+
+                               "       l1:if(x<3) {                            "+
+                               "               while(x>7 && x<34) {    "+
+                               "                       $x = 1;                         "+
+                               "                       break l3;                       "+
+                               "               }                                               "+
+                               "            x;                                         "+
+                               "          }                                            "+
+                               "          x;                                           "+
+                               "     }                                                 "+
+                           "   @ux;                                            "+
+                               "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt28() {
+               String code =
+                               "function fx()                                                          "+
+                           "{                                                                                  "+
+                               "       var x = 30906;                                                  "+
+                               "       l4:l3:l2:for(x ; @ux<37 || @ux>7; @ux) {"+
+                               "               l1:if(@ux<100) {                                        "+
+                               "                       for(;@ux;x++) {                                 "+
+                               "                               $x = 1;                                         "+
+                               "                               continue l3;                            "+
+                               "                       }                                                               "+
+                               "                @ux;                                                           "+
+                               "           }                                                                   "+
+                               "         @ux;                                                                  "+
+                               "    }                                                                          "+
+                               "   @ux;                                                                        "+
+                           " }                                                                                 ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt29() {
+               String code =
+                       "function fx()                                                  "+
+                       "{                                                                              "+
+                       "       var @dx = 30906;                                        "+
+                       "       l4:l3:l2:for(x ; x<37 || x>7; x) {      "+
+                       "               l1:if(x<100) {                                  "+
+                       "                       for(;x;x++) {                           "+
+                       "                               @dx = 1;                                "+
+                       "                               continue l3;                    "+
+                       "                       }                                                       "+
+                       "                x;                                                             "+
+                   "      }                                                            "+
+                   "     x;                                                            "+
+               "   }                                                                   "+
+                       "       l4:l3:for(x ; x<37 || x>7; x)  {        "+
+                       "               l1:if(x<100) {                                  "+
+                       "                       for(;$x;x++) {                          "+
+                       "                               @dx = 1;                        "+
+                       "                               continue l4;                    "+
+                       "                       }                                                       "+
+                       "                x;                                                             "+
+                   "      }                                                            "+
+                   "      @dx=0;                                                       "+
+               "   }                                                                   "+
+               " x;                                                                    "+
+               "}                                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt30() {
+               String code =
+                               "function fx(x)                                 "+
+                               "{                                                              "+
+                               "       l1:l2:l3:do {                           "+
+                               "               @ux;                                    "+
+                               "               do {                                    "+
+                               "                       $x = 3;                         "+
+                               "                       continue l1;            "+
+                               "               } while (x < 3 );               "+
+                               "               x;                                              "+
+                           "   } while (@ux<3);                        "+
+                               "   @ux;                                                "+
+                               "};                                                             ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt31() {
+               String code =
+                               "function fx(x)                                 "+
+                               "{                                                              "+
+                               "       l1:l2:l3:do {                           "+
+                               "               @ux;                                    "+
+                               "               do {                                    "+
+                               "                       $x = 3;                         "+
+                               "                       continue l2;            "+
+                               "               } while (x < 3 );               "+
+                               "               x;                                              "+
+                           "   } while (@ux<3);                        "+
+                               "   @ux;                                                "+
+                               "};                                                             ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt32() {
+               String code =
+                               "function fx(x)                                 "+
+                               "{                                                              "+
+                               "       l1:l2:l3:do {                           "+
+                               "               x;                                          "+
+                               "               do {                                    "+
+                               "                       $x = 3;                         "+
+                               "                       break l2;                       "+
+                               "               } while (x < 3 );               "+
+                               "               x;                                              "+
+                           "   } while (x<3);                          "+
+                               "   @ux;                                                "+
+                               "};                                                             ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testLabeledStmt33() {
+               String code =
+                               "function fx()                                          "+
+                               "{                                                                      "+
+                               "       var list = {x:7,y:34};                  "+
+                               "       l2:l1:for(var x in list) {              "+
+                               "               @ulist;                                         "+
+                               "               $list={x:37,y:7};                   "+
+                               "       if( x == 10 ) break l2;         "+
+                               "       }                                                               "+
+                               "   @ulist;                                                     "+
+                               "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testReturnStmt01() {
+               String code =
+                               "function fx()          "+
+                               "{                                      "+
+                               "       var $x = 5;             "+
+                               "       return @ux;             "+
+                               "       x;                              "+
+                               "}                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testReturnStmt02() {
+               String code =
+                               "function fx()          "+
+                               "{                                      "+
+                               "       var @dx = 5;    "+
+                               "       return $x;              "+
+                               "       x;                              "+
+                               "}                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testReturnStmt03() {
+               String code =
+                               "function fx()      "+
+                               "{                                      "+
+                               "       var @dx = 5;    "+
+                               "       return (x=$x+1);"+
+                               "       x;                          "+
+                               "}                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testReturnStmt04() {
+               String code =
+                               "function fx()          "+
+                               "{                                      "+
+                               "       var $x = 5;             "+
+                               "       return;                 "+
+                               "       x = x+1;                "+
+                               "}                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testWithStmt01() {
+               String code =
+               "function fx() {                                "+
+               "       var $obj = {x:10, y:20};        "+
+               "       with(@uobj) {                           "+
+               "               var result = x + y;             "+
+               "       }                                                       "+
+               "       @uobj;                                          "+
+               "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testWithStmt02() {
+               String code =
+               "function fx() {                                "+
+               "       var @dobj = {x:10, y:20};       "+
+               "       with($obj) {                            "+
+               "               var result = x + y;             "+
+               "       }                                                       "+
+               "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt01() {
+               String code =
+                       "function fx()              "+
+                       "{                                              "+
+                       "       try {                           "+
+                       "               var @dx = 0;    "+
+                       "               throw 304;              "+
+                       "               x = 5;                  "+
+                       "       } catch(e) {            "+
+                       "               $x;                             "+
+                       "       }                                       "+
+                       "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt02() {
+               String code =
+                       "function fx()                  "+
+                       "{                                              "+
+                       "       try {                           "+
+                       "               var @dx = 0;    "+
+                       "               throw x;                "+
+                       "               x = 5;                  "+
+                       "       } catch(e) {            "+
+                       "               x;                              "+
+                       "       }                                       "+
+                       "       $x;                                     "+
+                       "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt03() {
+               String code =
+                       "function fx() {                "+
+                       "{                                              "+
+                       "       var x = 0;                      "+
+                       "       try {                           "+
+                       "               throw 304;              "+
+                       "               x = 5;                  "+
+                       "       } catch(e) {            "+
+                       "               @dx = x + 3;    "+
+                       "       } finally {                     "+
+                       "      $x;                              "+
+                       "   }                                   "+
+                       "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt04() {
+               String code =
+                               "function fx() {                "+
+                               "{                                              "+
+                               "       try {                           "+
+                               "               var @dx = 0;    "+
+                               "               throw 304;              "+
+                               "               x = 5;                  "+
+                               "       } catch(e) {            "+
+                               "               x = $x + 3;             "+
+                               "       } finally {                     "+
+                               "       x + 1;                  "+
+                               "   }                                   "+
+                               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt05() {
+               String code =
+                               "function fx()                  "+
+                               "{                                              "+
+                               "       try {                           "+
+                               "               var x = 10;             "+
+                               "               throw x;                "+
+                               "       } catch(@de) {          "+
+                               "               $e;                             "+
+                               "       }                                       "+
+                               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt06() {
+               String code =
+                               "function fx()                  "+
+                               "{                                              "+
+                               "   var e=0;                    "+
+                               "       try {                           "+
+                               "               var x = 10;             "+
+                               "               throw x;                "+
+                               "       } catch($e) {           "+
+                               "               @ue;                    "+
+                               "       }                                       "+
+                               "       e;                                      "+
+                               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt07() {
+               String code =
+                               "function fx()                  "+
+                               "{                                              "+
+                               "   var e=0;                    "+
+                               "       try {                           "+
+                               "               var x = 10;             "+
+                               "               throw x;                "+
+                               "       } catch(@de) {          "+
+                               "               $e;                         "+
+                               "       }                                       "+
+                               "       e;                                      "+
+                               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt08() {
+               String code =
+                               "function fx()                  "+
+                               "{                                              "+
+                               "       try {                           "+
+                               "               try {                   "+
+                               "                       var x = 3;  "+
+                               "                       return x;       "+
+                               "               } finally {             "+
+                               "                       x = 3;          "+
+                               "               }                               "+
+                               "               x = 10;                 "+
+                               "       } catch(e) {            "+
+                               "               $x;                             "+
+                               "       }                                       "+
+                               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt09() {
+               String code =
+                               "function fx()                  "+
+                               "{                                              "+
+                               "       var x = 0, y = 0;       "+
+                               "       while(x<3) {            "+
+                               "               x;                              "+
+                               "               try {                   "+
+                               "                       $x = 0;         "+
+                               "                       break;          "+
+                               "               } finally {             "+
+                               "                       @ux;            "+
+                               "               }                               "+
+                               "               x;                              "+
+                               "       }                                       "+
+                               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt10() {
+               String code =
+                               "function fx()                  "+
+                               "{                                              "+
+                               "       var x = 0, y = 0;       "+
+                               "       while(@ux<3) {          "+
+                               "               @ux;                    "+
+                               "               try {                   "+
+                               "                       $x = 0;         "+
+                               "                       continue;       "+
+                               "               } finally {             "+
+                               "                       @ux;            "+
+                               "               }                               "+
+                               "               x;                              "+
+                               "       }                                       "+
+                               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt11() {
+               String code =
+                               "function fx()                                          "+
+                               "{                                                                      "+
+                               "       for(var x = 2; x < 34; @ux++ ) {"+
+                               "               try {                                           "+
+                               "                       x = x * 2;                              "+
+                               "                       $x = 0;                                 "+
+                               "               } catch(e) {                            "+
+                               "                       x;                                              "+
+                               "                       break;                                  "+
+                               "                       x;                                              "+
+                               "               } finally {                                     "+
+                               "                       @ux;                                    "+
+                               "               }                                                       "+
+                               "               @ux;                                            "+
+                               "       }                                                               "+
+                               "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt12() {
+               String code =
+                               "function fx()                                          "+
+                               "{                                                                      "+
+                               "       for(var x = 2; x < 34; @ux++ ) {"+
+                               "               try {                                           "+
+                               "                       $x = x * 2;                             "+
+                               "                       throw @ux;                              "+
+                               "                       x = x * 3.04;                   "+
+                               "               } catch(e) {                            "+
+                               "                       @ux;                                    "+
+                               "                       continue;                               "+
+                               "                       x;                                              "+
+                               "               } finally {                                     "+
+                               "                       @ux;                                    "+
+                               "               }                                                       "+
+                               "               x;                                                  "+
+                               "       }                                                               "+
+                               "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt13() {
+               String code =
+                               "function fx()                                          "+
+                               "{                                                                      "+
+                               "       for(var x = 2; x < 34; x++ ) {  "+
+                               "               try {                                           "+
+                               "                       $x = x * 2;                             "+
+                               "                       throw @ux;                              "+
+                               "                       x = x * 3.04;                   "+
+                               "               } catch(e) {                            "+
+                               "                       @ux;                                    "+
+                               "                       return @ux;                             "+
+                               "                       x;                                              "+
+                               "               } finally {                                     "+
+                               "                       @ux;                                    "+
+                               "               }                                                       "+
+                               "               x;                                                  "+
+                               "       }                                                               "+
+                               "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt14() {
+               String code =
+                               "function fx(x)                                         "+
+                               "{                                                                      "+
+                               "  try {                                                        "+
+                               "       for(x = 2; x < 34; x++ ) {      "+
+                               "               try {                                           "+
+                               "                       $x = x * 2;                             "+
+                               "                       throw @ux;                              "+
+                               "                       x = x * 3.04;                   "+
+                               "               } catch(e) {                            "+
+                               "                       @ux;                                    "+
+                               "                       return @ux;                             "+
+                               "                       x;                                              "+
+                               "               } finally {                                     "+
+                               "                       @ux;                                    "+
+                               "               }                                                       "+
+                               "               x;                                                  "+
+                               "       }                                                               "+
+                               "  } finally {                                          "+
+                               "         @ux;                                              "+
+                               "  }                                                            "+
+                               "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt15() {
+               String code =
+                               "function fx()                  "+
+                               "{                                              "+
+                               "       var x = 50;                     "+
+                               "       while(@ux<97) {         "+
+                               "               try {                   "+
+                               "                       $x = 37;        "+
+                               "                       throw @ux;      "+
+                               "               } catch(e) {    "+
+                               "                       @ux;            "+
+                               "                       break;          "+
+                               "               } finally {             "+
+                               "                       @ux;            "+
+                               "                       continue;       "+
+                               "               }                               "+
+                               "               x;                              "+
+                               "       }                                       "+
+                               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt16() {
+               String code =
+                               "function fx()                  "+
+                               "{                                              "+
+                               "       var x = 50;                     "+
+                               "       do {                            "+
+                               "               try {                   "+
+                               "                       $x = 37;        "+
+                               "                       throw @ux;      "+
+                               "               } catch(e) {    "+
+                               "                       @ux;            "+
+                               "                       break;          "+
+                               "               } finally {             "+
+                               "                       @ux;            "+
+                               "                       continue;       "+
+                               "               }                               "+
+                               "               x;                              "+
+                               "       } while(@ux<34);        "+
+                               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt17() {
+               String code =
+                               "function fx()                  "+
+                               "{                                              "+
+                               "       var x = 50;                     "+
+                               "       while(x<97) {           "+
+                               "               try {                   "+
+                               "                       $x = 37;        "+
+                               "                       throw @ux;      "+
+                               "               } catch(e) {    "+
+                               "                       @ux;            "+
+                               "               } finally {             "+
+                               "                       @ux;            "+
+                               "                       return @ux;     "+
+                               "               }                               "+
+                               "               x;                              "+
+                               "       }                                       "+
+                               "}                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt18() {
+               String code =
+                               "function fx() {                "+
+                               "       var $a = 10;            "+
+                               "       try {                           "+
+                               "               @ua;                    "+
+                               "       } catch(c) {            "+
+                               "               a;                              "+
+                               "       }                                       "+
+                               "       @ua;                            "+
+                           "}                                          ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+
+       @Test
+       public void testTryCatchStmt19() {
+               String code =
+                               "function fx() {                "+
+                               "       var $a = 10;            "+
+                               "       try {                           "+
+                               "               @ua;                    "+
+                               "       } finally  {            "+
+                               "               @ua;                    "+
+                               "       }                                       "+
+                               "       @ua;                            "+
+                           "}                                          ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt20() {
+               String code =
+                               "function fx() {                "+
+                               "       var $a = 10;            "+
+                               "       try {                           "+
+                               "               @ua;                    "+
+                               "       } catch(e)  {           "+
+                               "               a;                          "+
+                               "       }                                       "+
+                               "       @ua;                            "+
+                           "}                                          ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt21() {
+               String code =
+                               "function fx() {                "+
+                               "       var @da = 10;           "+
+                               "       try {                           "+
+                               "               a;                              "+
+                               "       } catch(c) {            "+
+                               "               a;                              "+
+                               "       }                                       "+
+                               "       $a;                                     "+
+                           "}                                          ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt22() {
+               String code =
+                               "function fx() {                "+
+                               "       var $a= 10;                     "+
+                               "       try {                           "+
+                               "         try {                         "+
+                               "                 @ua;                  "+
+                               "                 throw @ua;    "+
+                               "         } finally {           "+
+                               "                 @ua;                  "+
+                               "         }                                     "+
+                               "         a=0;                          "+
+                               "  } finally {                  "+
+                               "         @ua;                          "+
+                               "  }                                    "+
+                               "  a;                                   "+
+                               " }                                             ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt23() {
+               String code =
+                               "function fx() {                "+
+                               "       var $a= 10;                     "+
+                               "       try {                           "+
+                               "         try {                         "+
+                               "                 @ua;                  "+
+                               "                 throw @ua;    "+
+                               "         } finally {           "+
+                               "                 @ua;                  "+
+                               "         }                                     "+
+                               "  } finally {                  "+
+                               "         @ua;                          "+
+                               "  }                                    "+
+                               "  a;                                   "+
+                               " }                                             ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt24() {
+               String code =
+                               "function fx() {                "+
+                               "       var $a= 10;                     "+
+                               "       try {                           "+
+                               "         try {                         "+
+                               "                 @ua;                  "+
+                               "                 throw @ua;    "+
+                               "         } finally {           "+
+                               "                 @ua;                  "+
+                               "         }                                     "+
+                               "  } catch(c) {                 "+
+                               "                 @ua;                  "+
+                               "  } finally {                  "+
+                               "         @ua;                          "+
+                               "  }                                    "+
+                               "  @ua;                                 "+
+                               " }                                             ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt25() {
+               String code =
+                               "function fx() {                                        "+
+                               "         var x =0;                                             "+
+                               "         try {                                                 "+
+                               "               for(x = 2; x < 34; x++ ) {  "+
+                               "                       try {                                   "+
+                               "                               @dx = x * 2;            "+
+                               "                               throw x;                        "+
+                               "                               x = x * 3.04;           "+
+                               "                       } catch(e) {                    "+
+                               "                               x;                                      "+
+                               "                               if(e==null)                     "+
+                               "                                    return x;          "+
+                               "                               x;                                      "+
+                               "                       } finally {                             "+
+                               "                               x;                                      "+
+                               "                       }                                               "+
+                               "                       x;                                              "+
+                               "               }                                                       "+
+                               "               @dx=1;                                          "+
+                               "         } finally {                                   "+
+                               "                 $x;                                           "+
+                               "         }                                                             "+
+                               "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt26() {
+               String code =
+                               "function fx(x) {                                       "+
+                               "       try {                                                   "+
+                               "               for($x=0;@ux<100;@ux++) {       "+
+                               "                       try {                                   "+
+                               "                               if(@ux) {                       "+
+                               "                                       break;                  "+
+                               "                               } else {                        "+
+                               "                                       throw 10;               "+
+                               "                               }                                       "+
+                               "                               x;                                      "+
+                               "                       } catch(e) {                    "+
+                               "                               @ux;                            "+
+                               "                       } finally {                             "+
+                               "                               @ux;                            "+
+                               "                               if(@ux){                        "+
+                               "                                       x=1;                    "+
+                               "                                       return x;               "+
+                               "                               }                                       "+
+                               "                               else                            "+
+                               "                                       continue;               "+
+                               "                       }                                               "+
+                               "                       x;                                              "+
+                               "               };                                                      "+
+                               "               @ux;                                            "+
+                               "       } finally {                                             "+
+                               "               @ux;                                            "+
+                               "       }                                                               "+
+                               "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt27() {
+               String code =
+                               "function fx(x) {                       "+
+                               "               try {                           "+
+                               "                       $x = 0;         "+
+                               "                       if( @ux < 10 )  "+
+                               "                               throw @ux;      "+
+                               "               } catch(a) {            "+
+                               "                       @ux;                    "+
+                               "                       a;                              "+
+                               "               } catch(b) {            "+
+                               "                       x;                              "+
+                               "                       b;                              "+
+                               "               } finally {                     "+
+                               "                       @ux;                    "+
+                               "               }                                       "+
+                               "               @ux;                            "+
+                               "}                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt28() {
+               String code =
+                               "function fx() {                        "+
+                               "  var x =0;                                    "+
+                               "  label_try:try {                              "+
+                               "         for($x=0;@ux<10;@ux++) {      "+
+                               "         }                                                     "+
+                               "  } finally {                                  "+
+                               "         @ux;                                          "+
+                               "  }                                                    ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt29() {
+               String code =
+                               "function fx() {                        "+
+                               "  var @dx =0;                                  "+
+                               "  label_try:try {                              "+
+                               "         while(@ux<10) {                       "+
+                               "               $@mx += 1;                              "+
+                               "         }                                                     "+
+                               "  } finally {                                  "+
+                               "         @ux;                                          "+
+                               "  }                                                    "+
+                               "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt30() {
+               String code =
+                               "function fx() {                        "+
+                               "  var @dx =0;                                  "+
+                               "  label_try:try {                              "+
+                               "         x;                                            "+
+                               "         while(@ux<10) {                       "+
+                               "               $@mx += 1;                              "+
+                               "         }                                                     "+
+                               "  } finally {                                  "+
+                               "         @ux;                                          "+
+                               "  }                                                    "+
+                               "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt31() {
+                       String code =
+                               "function fx(x) {                               "+
+                               "for(var i = 0; i< 1;i++) {             "+
+                               "               @dx = 0;                                "+
+                               "               l1:try{                                 "+
+                               "                       throw 0;                        "+
+                               "               }catch(e) {                             "+
+                               "                       $x++;                           "+
+                               "                       break l1;                       "+
+                               "               }finally{                               "+
+                               "                       @ux;                            "+
+                               "               }                                               "+
+                               "               @ux;                                    "+
+                               "       }                                                       "+
+                               "       return @ux;                                     "+
+                               "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt32() {
+               String code =
+                       "function fx() {                                                "+
+                       "       var $x=0,y=1;                                           "+
+                       "       @ux;                                                            "+
+                       "       l1:try {                                                        "+
+                       "               switch(@ux) {                                   "+
+                       "               case @ux: @ux + 1; throw @ux; break; "+
+                       "               default: x=@ux+1; break;                "+
+                       "               case @ux: break;                                "+
+                       "               }                                                               "+
+                       "       } catch(x) {                                            "+
+                       "               x;                                                              "+
+                       "       } finally {                                                     "+
+                       "               @ux;                                                    "+
+                       "       }                                                                       "+
+                       "}                                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt33() {
+               String code =
+                       "function fx() {                                        "+
+                       "       var $x=0,y=@ux,z=@ux+y;                 "+
+                       "       @ux;                                                    "+
+                       "       try {                                                   "+
+                       "               l1:try {                                        "+
+                       "                       @ux;                                    "+
+                       "                       l2:try {                                "+
+                       "                               x:{                                     "+
+                       "                                       @ux;                    "+
+                       "                                       throw @ux;              "+
+                       "                                       x;                              "+
+                       "                               }                                       "+
+                       "                               break l1;                       "+
+                       "                       } finally {                             "+
+                       "                               @ux;                            "+
+                       "                       }                                               "+
+                       "               } catch(x) {                            "+
+                       "                       x=10+x;                                 "+
+                       "               } finally {                                     "+
+                       "                       @ux;                                    "+
+                       "               }                                                       "+
+                       "               @ux;                                            "+
+                       "       } catch(x) {                                    "+
+                       "               x++;                                            "+
+                       "       }                                                               "+
+                       "       @ux;                                                    "+
+                       "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt34() {
+               String code =
+                               "function fx() {                                        "+
+                               "       var x=0,y=x,z=x+y;                              "+
+                               "       x;                                                              "+
+                               "       try {                                                   "+
+                               "               l1:try {                                        "+
+                               "               } catch(x) {                            "+
+                               "                       $x=10+x;                                "+
+                               "               } finally {                                     "+
+                               "                       x;                                              "+
+                               "               }                                                       "+
+                               "               x;                                                      "+
+                               "       } catch(x) {                                    "+
+                               "               x++;                                            "+
+                               "       }                                                               "+
+                               "       x;                                                              "+
+                               "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt35() {
+               String code =
+                               "function fx() {                                        "+
+                               "       var x=0,y=x,z=x+y;                              "+
+                               "       x;                                                              "+
+                               "       try {                                                   "+
+                               "               l1:try {                                        "+
+                               "               } catch(e) {                            "+
+                               "                       $x=10+x;                                "+
+                               "               } finally {                                     "+
+                               "                       @ux;                                    "+
+                               "               }                                                       "+
+                               "               @ux;                                            "+
+                               "       } catch(x) {                                    "+
+                               "               x++;                                            "+
+                               "       }                                                               "+
+                               "       @ux;                                                    "+
+                               "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+
+       @Test
+       public void testTryCatchStmt36() {
+               String code =
+                               "function f(x){                                 " +
+                               "       l1:try {                                        " +
+                               "       } catch(e) {                            " +
+                               "               $x++;                                   " +
+                               "               break l1;                               " +
+                               "       } finally {                                     " +
+                               "               @ux++;                                  " +
+                               "       }                                                       " +
+                               "       x;                                                      " +
+                               "       return x;                                       " +
+                               "}                                                              ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testReachability01() {
+               String code =
+                               "function fx()         "+
+                               "{                                 "+
+                               "       var @dx = 0;       "+
+                               "       while(1) {                 "+
+                               "               @dx++;         "+
+                               "               continue;      "+
+                               "               x++;           "+
+                               "       }                              "+
+                               "       $x;                            "+
+                               "}                     ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testReachability02() {
+               String code =
+                               "function fx()                                          "+
+                               "{                                                                      "+
+                               "       for(var x = 0; x < 10; x++) {   "+
+                               "               try {                                           "+
+                               "                       $x = x * 2;                             "+
+                               "                       throw @ux;                              "+
+                               "                       x = 0;                                  "+
+                               "               } catch(e) {                            "+
+                               "                       @ux;                                    "+
+                               "                       break;                                  "+
+                               "                       x;                                              "+
+                               "               } finally {                                     "+
+                               "                         @ux;                                  "+
+                               "               }                                                       "+
+                               "               x;                                              "+
+                               "       }                                                               "+
+                               "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }       
+       
+       @Test
+       public void testReachability03() {
+               String code =
+                               "function fx()                                          "+
+                               "{                                                                      "+
+                               "       for(var x = 0; x < 10; x++) {   "+
+                               "               try {                                           "+
+                               "                       x = x * 2;                              "+
+                               "                       @dx = 0;                                "+
+                               "               } catch(e) {                            "+
+                               "               if (x < 0)              "+
+                               "                               @dx++;                          "+
+                               "               } finally {                                     "+
+                               "                       $x;                                     "+
+                               "               }                                                       "+
+                               "               x;                                              "+
+                               "       }                                                               "+
+                               "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testReachability04() {
+               String code =
+                               "function fx()                                          "+
+                               "{                                                                      "+
+                               "       for(var @dx = 0; x < 10; x++) { "+
+                               "       @dx++;                      "+
+                               "       break;                      "+
+                               "               try {                                           "+
+                               "                       x = 0;                              "+
+                               "               } catch(e) {                            "+
+                               "               if (x < 0)              "+
+                               "                               x++;                            "+
+                               "               } finally {                                     "+
+                               "                       x;                                      "+
+                               "               }                                                       "+
+                               "               x;                                              "+
+                               "       }                                                               "+
+                               "   $x;                             "+
+                               "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testReachability05() {
+               String code =
+                               "function fx()                                          "+
+                               "{                                                                      "+
+                               "       for(var @dx = 0; x < 10; @dx++){"+
+                               "               try {                                           "+
+                               "                       @dx = 0;                                "+
+                               "           break;                  "+
+                               "               } catch(e) {                            "+
+                               "               if (x < 0)              "+
+                               "                               x++;                            "+
+                               "               } finally {                                     "+
+                               "               if (x < 0)              "+
+                               "                               @dx++;                  "+
+                               "               }                                                       "+
+                               "       if (x < 0)                      "+
+                               "                       x++;                                    "+
+                               "       }                                                               "+
+                               "   $x;                             "+
+                               "}                                                                      ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testHoistedMethodDeclaration01() {
+               String code = 
+                               "function fx(x) {x;}     "+
+                           "function fy($x,y) {@ux;} "+
+                               "function fy(x) {x;};     ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testHoistedMethodDeclaration02() {
+               String code = 
+                               "function fx(x) {x;}    "+
+                           "function fy($x) {@ux;}  "+
+                               "function fy(x,y) {x;}; ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testHoistedMethodDeclaration03() {
+               String code = 
+                               "function fx($x) {@ux;} "+
+                           "function fy(x) {x;}       "+
+                               "function fy(x,y) {x;};    ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testHoistedMethodDeclaration04() {
+               String code = 
+                               "function fy(x) {x;}          "+
+                           "function fy(x,y,z) {x;}     "+
+                               "function fy($x,y) {@ux;}; ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testHoistedMethodDeclaration05() {
+               String code = 
+                               "function fa(x,y,z) {x;};              "+
+                               "function fax,y,z,v,w,@dx,y,z) {$x;};"+
+                               "function fa(x,y) {x;};                         "+
+                               "function fc(x,y) {x;};                                 "+
+                               "function fc(x) {x;};                                   ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testHoistedMethodDeclaration06() {
+               String code = 
+                               "function fa(x,y,z) {x;};              "+
+                               "function fa(x,y,z,v,w,x,y,z) {x;};  "+
+                               "function fa($x,y) {@ux;};                      "+
+                               "function fc(x,y) {x;};                                 "+
+                               "function fc(x) {x;};                                   ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testHoistedMethodDeclaration07() {
+               String code = 
+                               "function fa(x,y,z) {x;};              "+
+                               "function fa(x,y,z,v,w,x,y,z) {x;}; "+
+                               "function fa(x,y) {x;};                         "+
+                               "function fc($x,y) {@ux;};                      "+
+                               "function fc(x) {x;};                                   ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testHoistedMethodDeclaration08() {
+               String code = 
+                               "function fa(x,y,z) {x;};              "+
+                               "function fa(x,y,z,v,w,x,y,z) {x;};  "+
+                               "function fa(x,y) {x;};                         "+
+                               "function fc(x,y) {x;};                                 "+
+                               "function fc($x) {@ux;};                                ";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testHoistedMethodDeclaration09() {
+               String code = 
+                               "function fx(x) {x;}            "+
+                               "function fx(x,y) {x;}          "+
+                               "function fx(x) {x;}            "+
+                               "function fz($x) {@ux;} "+
+                               "function fz(x,y) {x;}          "+
+                               "function fzzz(x,y) {x+y;}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testHoistedMethodDeclaration10() {
+               String code = 
+                               "function fx(x) {x;}            "+
+                               "function fx(x,y) {x;}          "+
+                               "function fx(x) {x;}            "+
+                               "function fz(x) {x;}            "+
+                               "function fz($x,y) {@ux;}"+
+                               "function fzzz(x,y) {x+y;}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testHoistedMethodDeclaration11() {
+               String code = 
+                               "function fx(x) {x;}            "+
+                               "function fx(x,y) {x;}          "+
+                               "function fx(x) {x;}            "+
+                               "function fz(x) {x;}            "+
+                               "function fz(x,y) {x;}"+
+                               "function fzzz($x,y) {@ux+y;}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testHoistedMethodDeclaration12() {
+               String code = 
+                               "function fx(x) {x;}            "+
+                               "function fx($x,y) {@ux;}"+
+                               "function fx(x) {x;}            "+
+                               "function fz(x) {x;}            "+
+                               "function fz(x,y) {x;}"+
+                               "function fzzz(x,y) {x+y;}";
+               assertTrue(buildAndCheck(extractSourceAndMarkers(code)));
+       }
+       
+       @Test
+       public void testHoistedMethodDeclaration13() {
+               String code = 
+                               "function fx(x) {x;}            "+
+                               "function fx(x,y) {x;}          "+
+                               "function fx($x) {x;}           "+
+                               "function fz(x) {x;}            "+
+                               "function fz(x,y) {x;}"+
+                               "function fzzz(x,y) {x+y;}";
+               assertNotInteresting(code);
+       }
+       
+       public void testHoistedMethodDeclaration14() {
+               String code = 
+                               "function fx($x) {x;}           "+
+                               "function fx(x,y) {x;}          "+
+                               "function fx(x) {x;}            "+
+                               "function fz(x) {x;}            "+
+                               "function fz(x,y) {x;}"+
+                               "function fzzz(x,y) {x+y;}";
+               assertNotInteresting(code);
+       }
+
+       private void shouldBeTrue(boolean result) {
+               assertFalse(result);
+       }
+
+       private void shouldNotInteresting(String code) {
+               assertInteresting(code);
+       }
+
+       private void assertInteresting(String code) {
+               parse(extractSourceAndMarkers(code));
+               buildMarks();
+               assertTrue(checkInteresting());
+       }
+
+       private void assertNotInteresting(String code) {
+               parse(extractSourceAndMarkers(code));
+               buildMarks();
+               assertFalse(checkInteresting());
+       }
+
+       private String extractSourceAndMarkers(String str) {
+               StringBuffer resultStr = new StringBuffer();
+               duChainOffsets = new ArrayList<Integer>();
+               udChainOffsets = new ArrayList<Integer>();
+
+               selOffset = 0;
+               for (int i = 0; i < str.length(); i++) {
+                       switch (str.charAt(i)) {
+                               case '@': i++;
+                                       if (i < str.length()) {
+                                               switch (str.charAt(i)) {
+                                                       case 'm':
+                                                               duChainOffsets.add(resultStr.length());
+                                                               udChainOffsets.add(resultStr.length());
+                                                               break;
+                                                       case 'd':
+                                                               udChainOffsets.add(resultStr.length());
+                                                               break;
+                                                       case 'u':
+                                                               duChainOffsets.add(resultStr.length());
+                                                               break;
+                                                       default:
+                                                               resultStr.append(str.charAt(i));
+                                               }
+                                       }
+                                       break;
+                               case '$':
+                                       selOffset = resultStr.length();
+                                       break;
+                               default:
+                                       resultStr.append(str.charAt(i));
+                       }
+               }
+
+               return resultStr.toString();
+       }
+
+       private boolean buildAndCheck(String code) {
+               try {
+                       parse(code);
+                       buildMarks();
+                       if (checkInteresting()) {
+                               buildCFG();
+                               buildDUChain();
+                               return checkDUChain();
+                       } else {
+                               // if the selected name is unanalyzable, there should be no du/ud chain.
+                               if (udChainMarks.size() != 0 || duChainMarks.size() != 0) {
+                                       return false;
+                               }
+                               return true;
+                       }
+               } catch(Exception exception) {
+                       return false;
+               }
+       }
+
+       private boolean isUnSupportedExceptionOccurred(String code) {
+               try{
+                       parse(code);
+                       buildMarks();
+                       if (checkInteresting()) {
+                               buildCFG();
+                               buildDUChain();
+                       } else {
+                               // if the selected name is unanalyzable, there should be no du/ud chain.
+                               assertEquals(udChainMarks.size(), 0);
+                               assertEquals(duChainMarks.size(), 0);
+                       }
+               }catch(TracingUnsupportedException e){
+                       return true;
+               }
+               return false;
+       }
+
+       class DoNothingProblemReporter extends ProblemReporter {
+
+               public DoNothingProblemReporter(CompilerOptions options, IProblemFactory problemFactory) {
+                       super(DefaultErrorHandlingPolicies.exitAfterAllProblems(), options, problemFactory);
+               }
+
+               public void record(CategorizedProblem problem,
+                               CompilationResult unitResult, ReferenceContext context) {
+
+               }
+       }
+
+       /**
+        * Parse the source string and make Public AST(<code>CompilationUnitDeclaration</code>)
+        */
+       class TestParser extends Parser {
+               public TestParser(boolean optimizeStringLiterals) {
+                       super(new DoNothingProblemReporter(new CompilerOptions(), new DefaultProblemFactory()),
+                                       optimizeStringLiterals);
+               }
+
+               public CompilationUnitDeclaration parse(String sourceCode) {
+
+                       CompilationUnitDeclaration unit;
+                       try {
+                               /* automaton initialization */
+                               initialize(true);
+                               goForCompilationUnit();
+
+                               /* unit creation */
+                               this.referenceContext =
+                                               this.compilationUnit =
+                                               new CompilationUnitDeclaration(
+                                                               this.problemReporter,
+                                                               new CompilationResult("unittest.js".toCharArray(),
+                                                                               new char [][]{}, 1, 1, 10),
+                                                               sourceCode.length());
+
+                               initializeInferenceEngine(this.compilationUnit);
+
+                               /* scanners initialization */
+                               char[] contents = sourceCode.toCharArray();
+                               this.scanner.setSource(contents);
+                               this.compilationUnit.sourceEnd = this.scanner.source.length - 1;
+
+                               /* run automaton */
+                               parse();
+                       } finally {
+                               unit = this.compilationUnit;
+                               this.compilationUnit = null; // reset parser
+                       }
+                       return unit;
+               }
+       }
+
+       class NullNameEnvoronment implements INameEnvironment {
+
+               @Override
+               public NameEnvironmentAnswer findType(char[][] compoundTypeName, ITypeRequestor requestor) {
+                       return null;
+               }
+
+               @Override
+               public NameEnvironmentAnswer findType(
+                               char[] typeName, char[][] packageName, ITypeRequestor requestor) {
+                       return null;
+               }
+
+               @Override
+               public boolean isPackage(char[][] parentPackageName, char[] packageName) {
+                       // TODO Auto-generated method stub
+                       return false;
+               }
+
+               @Override
+               public NameEnvironmentAnswer findBinding(
+                               char[] typeName, char[][] packageName, int type, ITypeRequestor requestor,
+                               boolean returnMultiple, String excludePath) {
+                       return null;
+               }
+
+               @Override
+               public void cleanup() {}
+
+       }
+
+       @SuppressWarnings("rawtypes")
+       private void parse(String code) {
+               TestParser parser = new TestParser(false);
+               CompilationUnitDeclaration ast = parser.parse(code);
+               CompilerOptions defaultOption = new CompilerOptions();
+               parser.inferTypes(ast, defaultOption);
+
+               LookupEnvironment env = new LookupEnvironment(null, defaultOption, null, new NullNameEnvoronment());
+               env.buildTypeBindings(ast, null);
+               env.completeTypeBindings();
+               if(ast.scope!=null) {
+                       ast.scope.faultInTypes();
+               }
+               ast.resolve();
+
+               CompilationUnit cu = new CompilationUnit(null, "unittest.js", DefaultWorkingCopyOwner.PRIMARY);
+
+               this.ast = AST.convertCompilationUnit(
+                                       AST.JLS3,
+                                       ast,
+                                       code.toCharArray(),
+                                       new HashMap(),
+                                       true,
+                                       cu,
+                                       0,
+                                       new NullProgressMonitor());
+               //System.out.println("public ast: "+this.ast);
+       }
+
+       /*
+        * build SimpleName arrays from offset arrays
+        * */
+       private void buildMarks() {
+               selName = pickNameFromOffset(selOffset);
+               //System.out.println("selected name: "+selName);
+               duChainMarks = new ArrayList<SimpleName>();
+               udChainMarks = new ArrayList<SimpleName>();
+               for (int offset: duChainOffsets) {
+                       duChainMarks.add(pickNameFromOffset(offset));
+               }
+               for (int offset: udChainOffsets) {
+                       udChainMarks.add(pickNameFromOffset(offset));
+               }
+       }
+
+       private boolean checkInteresting() {
+               return AssignmentTracingUI.isInteresting(selName,
+                               AssignmentTracingUI.getEnclosingFunc(selName));
+       }
+
+       /*
+        * build CFG
+        */
+       private void buildCFG() {
+               cfgBuilder = new CFGBuilder(new NullProgressMonitor());
+               selNodes = cfgBuilder.buildCFG(AssignmentTracingUI.getEnclosingFunc(selName), selName);
+               cfgBuilder.checkReachability();
+       }
+
+       private boolean checkDUChain() {
+               Set<SimpleName> duChain = chainBuilder.getDUChain();
+               Set<SimpleName> udChain = chainBuilder.getUDChain();
+
+               for (SimpleName name : duChain) {
+                       if (!duChainMarks.contains(name)) {
+                               return false;
+                       }
+               }
+               for (SimpleName name : duChainMarks) {
+                       if (!duChain.contains(name)) {
+                               return false;
+                       }
+               }
+               for (SimpleName name : udChain) {
+                       if (!udChainMarks.contains(name)) {
+                               return false;
+                       }
+               }
+               for (SimpleName name : udChainMarks) {
+                       if (!udChain.contains(name)) {
+                               return false;
+                       }
+               }
+
+               return true;
+       }
+
+       private void buildDUChain() {
+               chainBuilder = new ChainBuilder();
+               chainBuilder.buildChain(selNodes, cfgBuilder.getNodeCount());
+       }
+
+       private SimpleName pickNameFromOffset(int offset) {
+               return AssignmentTracingUI.findEnclosingName(this.ast, offset, 0);
+       }
+}
diff --git a/org.tizen.web.assignmenttracing/.classpath b/org.tizen.web.assignmenttracing/.classpath
new file mode 100644 (file)
index 0000000..ad32c83
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.tizen.web.assignmenttracing/.project b/org.tizen.web.assignmenttracing/.project
new file mode 100644 (file)
index 0000000..90b16ad
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>org.tizen.web.assignmenttracing</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.ManifestBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.SchemaBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+       </natures>
+</projectDescription>
diff --git a/org.tizen.web.assignmenttracing/.settings/org.eclipse.jdt.core.prefs b/org.tizen.web.assignmenttracing/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..c537b63
--- /dev/null
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/org.tizen.web.assignmenttracing/META-INF/MANIFEST.MF b/org.tizen.web.assignmenttracing/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..563604b
--- /dev/null
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Fragment-Host: org.eclipse.wst.jsdt.ui;bundle-version="1.1.101.qualifier"
+Bundle-Name: Tizen Assignment Tracing for JavaScript
+Bundle-SymbolicName: org.tizen.web.assignmenttracing;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Vendor: Samsung Electronics
+Export-Package: org.tizen.web.assignmenttracing.core,
+ org.tizen.web.assignmenttracing.core.exceptions,
+ org.tizen.web.assignmenttracing.ui
diff --git a/org.tizen.web.assignmenttracing/build.properties b/org.tizen.web.assignmenttracing/build.properties
new file mode 100644 (file)
index 0000000..c1e8f03
--- /dev/null
@@ -0,0 +1,11 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               fragment.xml,\
+               icons/,\
+               bin/,\
+               contexts.xml
+src.includes = icons/,\
+               fragment.xml,\
+               contexts.xml
diff --git a/org.tizen.web.assignmenttracing/contexts.xml b/org.tizen.web.assignmenttracing/contexts.xml
new file mode 100644 (file)
index 0000000..02e26e4
--- /dev/null
@@ -0,0 +1,12 @@
+<contexts>
+       <context id="viewer" title="Sample View">
+               <description>This is the context help for the sample view with a table viewer. It was generated by a PDE template.</description>
+               <topic href="/PLUGINS_ROOT/org.eclipse.platform.doc.isv/guide/ua_help_context.htm" label="Context-sensitive help">
+                       <enablement>
+                               <with variable="platform">
+                       <test property="org.eclipse.core.runtime.isBundleInstalled" args="org.eclipse.platform.doc.isv"/>
+                       </with>
+                       </enablement>
+               </topic>
+       </context>
+</contexts>
diff --git a/org.tizen.web.assignmenttracing/fragment.xml b/org.tizen.web.assignmenttracing/fragment.xml
new file mode 100644 (file)
index 0000000..f9d02d3
--- /dev/null
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<fragment>
+   <extension
+         point="org.eclipse.ui.editors.annotationTypes">
+      <type
+            name="org.tizen.web.assignmenttracing.def">
+      </type>
+      <type
+            name="org.tizen.web.assignmenttracing.use">
+      </type>
+      <type
+            name="org.tizen.web.assignmenttracing.sel">
+      </type>
+   </extension>
+   <extension
+         point="org.eclipse.ui.editors.markerAnnotationSpecification">
+      <specification
+            annotationType="org.tizen.web.assignmenttracing.def"
+            colorPreferenceKey="du.def.color"
+            colorPreferenceValue="220,30,30"
+            contributesToHeader="true"
+            highlightPreferenceKey="du.def.highlight"
+            highlightPreferenceValue="false"
+            includeOnPreferencePage="true"
+            label="JavaScript Assignment Tracing - Write Occurrences"
+            overviewRulerPreferenceKey="du.def.rulers.overview"
+            overviewRulerPreferenceValue="true"
+            presentationLayer="6"
+            textPreferenceKey="du.def.text"
+            textPreferenceValue="true"
+            textStylePreferenceKey="du.def.textstyle"
+            textStylePreferenceValue="BOX"
+            verticalRulerPreferenceKey="du.def.rulers.vertical"
+            verticalRulerPreferenceValue="false">
+      </specification>
+      <specification
+            annotationType="org.tizen.web.assignmenttracing.use"
+            colorPreferenceKey="du.use.color"
+            colorPreferenceValue="0,0,250"
+            contributesToHeader="true"
+            highlightPreferenceKey="du.use.highlight"
+            highlightPreferenceValue="false"
+            includeOnPreferencePage="true"
+            label="JavaScript Assignment Tracing - Read Occurrence"
+            overviewRulerPreferenceKey="du.use.rulers.overview"
+            overviewRulerPreferenceValue="true"
+            presentationLayer="5"
+            textPreferenceKey="du.use.text"
+            textPreferenceValue="true"
+            textStylePreferenceKey="du.use.textstyle"
+            textStylePreferenceValue="BOX"
+            verticalRulerPreferenceKey="du.use.rulers.vertical"
+            verticalRulerPreferenceValue="false">
+      </specification>
+      <specification
+            annotationType="org.tizen.web.assignmenttracing.sel"
+            colorPreferenceKey="du.sel.color"
+            colorPreferenceValue="150,150,250"
+            contributesToHeader="true"
+            highlightPreferenceKey="du.sel.highlight"
+            highlightPreferenceValue="true"
+            includeOnPreferencePage="true"
+            label="JavaScript Assignment Tracing - Selection"
+            overviewRulerPreferenceKey="du.sel.rulers.overview"
+            overviewRulerPreferenceValue="true"
+            presentationLayer="7"
+            textPreferenceKey="du.sel.text"
+            textPreferenceValue="true"
+            textStylePreferenceKey="du.sel.textstyle"
+            textStylePreferenceValue="BOX"
+            verticalRulerPreferenceKey="du.sel.rulers.vertical"
+            verticalRulerPreferenceValue="false">
+      </specification>
+   </extension>
+
+   <extension
+         point="org.eclipse.ui.editorActions">
+      <editorContribution
+            id="org.tizen.web.assignmenttracing.duchain-action"
+            targetID="org.eclipse.wst.jsdt.ui.CompilationUnitEditor">
+         <action
+               class="org.tizen.web.assignmenttracing.ui.TracingActionDelegate"
+               icon="icons/duchain.gif"
+               id="org.tizen.web.assignmenttracing.mark-duchain"
+               label="Assignment Tracing for JavaScript"
+               state="true"
+               style="toggle"
+               tooltip="Toggle Assignment Tracing for JavaScript">
+         </action>
+      </editorContribution>
+   </extension>
+   
+   
+   <!-- Accelerator key -->
+ <extension point="org.eclipse.ui.commands">
+ <category
+           id="org.tizen.web.assignmenttracing.commands"
+           name="Assignment Tracing for JavaScript"
+           description="JavaScript Assignment Tracing Commands"/>
+   <command name="Go to Previous Tracing Result"
+        description="Move caret to the previous Assignment Tracing result"
+        categoryId="org.tizen.web.assignmenttracing.commands"
+        defaultHandler="org.tizen.web.assignmenttracing.ui.TracingCommandHandler"
+        id="org.tizen.web.assignmenttracing.moveprevious">
+   </command>
+   <command name="Go to Next Tracing Result"
+        description="Move caret to the next Assignment Tracing result"
+        categoryId="org.tizen.web.assignmenttracing.commands"
+        defaultHandler="org.tizen.web.assignmenttracing.ui.TracingCommandHandler"
+        id="org.tizen.web.assignmenttracing.movenext">
+   </command>
+</extension>
+
+<extension point="org.eclipse.ui.bindings">
+    <key
+          commandId="org.tizen.web.assignmenttracing.moveprevious"
+          contextId="org.eclipse.wst.jsdt.ui.javascriptViewScope"
+          schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+          sequence="Ctrl+["/>
+    <key sequence="Ctrl+]"
+        commandId="org.tizen.web.assignmenttracing.movenext"
+        schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+        contextId="org.eclipse.wst.jsdt.ui.javascriptViewScope"/>
+</extension>
+<extension
+      point="org.eclipse.ui.editorActions">
+   <editorContribution
+         id="org.tizen.web.assignmenttracing.duchain-action-js"
+         targetID="org.tizen.web.edit.part.JsEditor">
+      <action
+            class="org.tizen.web.assignmenttracing.ui.TracingActionDelegate"
+            icon="icons/duchain.gif"
+            id="org.tizen.web.assignmenttracing.mark-duchain"
+            label="Assignment Tracing for JavaScript"
+            state="true"
+            style="toggle"
+            tooltip="Toggle Assignment Tracing for JavaScript">
+      </action>
+   </editorContribution>
+</extension>
+      
+</fragment>
diff --git a/org.tizen.web.assignmenttracing/icons/duchain.gif b/org.tizen.web.assignmenttracing/icons/duchain.gif
new file mode 100644 (file)
index 0000000..b441cfd
Binary files /dev/null and b/org.tizen.web.assignmenttracing/icons/duchain.gif differ
diff --git a/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/CFGBuilder.java b/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/CFGBuilder.java
new file mode 100644 (file)
index 0000000..7ea9d01
--- /dev/null
@@ -0,0 +1,1278 @@
+/*
+ * Program Understanding / Assignment Tracing for JavaScript
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyukmin Kwon <hyukmin0530@samsung.com>
+ * Wooyoung Cho <wooyoung1.cho@samsung.com>
+ * Jaeheung Kim <jaeheung.kim@samsung.com>
+ * Woongsik Choi <woongsik76.choi@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.web.assignmenttracing.core;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Stack;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.wst.jsdt.core.dom.ASTNode;
+import org.eclipse.wst.jsdt.core.dom.ASTVisitor;
+import org.eclipse.wst.jsdt.core.dom.ArrayAccess;
+import org.eclipse.wst.jsdt.core.dom.ArrayInitializer;
+import org.eclipse.wst.jsdt.core.dom.Assignment;
+import org.eclipse.wst.jsdt.core.dom.CatchClause;
+import org.eclipse.wst.jsdt.core.dom.ClassInstanceCreation;
+import org.eclipse.wst.jsdt.core.dom.ConditionalExpression;
+import org.eclipse.wst.jsdt.core.dom.Expression;
+import org.eclipse.wst.jsdt.core.dom.FieldAccess;
+import org.eclipse.wst.jsdt.core.dom.FunctionDeclaration;
+import org.eclipse.wst.jsdt.core.dom.FunctionExpression;
+import org.eclipse.wst.jsdt.core.dom.FunctionInvocation;
+import org.eclipse.wst.jsdt.core.dom.InfixExpression;
+import org.eclipse.wst.jsdt.core.dom.ListExpression;
+import org.eclipse.wst.jsdt.core.dom.ObjectLiteral;
+import org.eclipse.wst.jsdt.core.dom.ObjectLiteralField;
+import org.eclipse.wst.jsdt.core.dom.ParenthesizedExpression;
+import org.eclipse.wst.jsdt.core.dom.PostfixExpression;
+import org.eclipse.wst.jsdt.core.dom.PrefixExpression;
+import org.eclipse.wst.jsdt.core.dom.SimpleName;
+import org.eclipse.wst.jsdt.core.dom.SingleVariableDeclaration;
+import org.eclipse.wst.jsdt.core.dom.Statement;
+import org.eclipse.wst.jsdt.core.dom.VariableDeclarationExpression;
+import org.eclipse.wst.jsdt.core.dom.WithStatement;
+import org.eclipse.wst.jsdt.core.dom.Block;
+import org.eclipse.wst.jsdt.core.dom.ExpressionStatement;
+import org.eclipse.wst.jsdt.core.dom.ThrowStatement;
+import org.eclipse.wst.jsdt.core.dom.VariableDeclarationFragment;
+import org.eclipse.wst.jsdt.core.dom.VariableDeclarationStatement;
+import org.eclipse.wst.jsdt.core.dom.IfStatement;
+import org.eclipse.wst.jsdt.core.dom.ForStatement;
+import org.eclipse.wst.jsdt.core.dom.ForInStatement;
+import org.eclipse.wst.jsdt.core.dom.WhileStatement;
+import org.eclipse.wst.jsdt.core.dom.DoStatement;
+import org.eclipse.wst.jsdt.core.dom.SwitchStatement;
+import org.eclipse.wst.jsdt.core.dom.SwitchCase;
+import org.eclipse.wst.jsdt.core.dom.ReturnStatement;
+import org.eclipse.wst.jsdt.core.dom.BreakStatement;
+import org.eclipse.wst.jsdt.core.dom.ContinueStatement;
+import org.eclipse.wst.jsdt.core.dom.LabeledStatement;
+import org.eclipse.wst.jsdt.core.dom.TryStatement;
+import org.tizen.web.assignmenttracing.core.environment.CatchElement;
+import org.tizen.web.assignmenttracing.core.environment.EnvironmentElement;
+import org.tizen.web.assignmenttracing.core.environment.EnvironmentStack;
+import org.tizen.web.assignmenttracing.core.environment.LabeledStmtElement;
+import org.tizen.web.assignmenttracing.core.environment.LoopElement;
+import org.tizen.web.assignmenttracing.core.environment.NotInterestingElement;
+import org.tizen.web.assignmenttracing.core.environment.SwitchElement;
+import org.tizen.web.assignmenttracing.core.environment.TryElement;
+import org.tizen.web.assignmenttracing.core.exceptions.TracingCancelException;
+import org.tizen.web.assignmenttracing.core.exceptions.TracingInternalErrorException;
+import org.tizen.web.assignmenttracing.core.exceptions.TracingUnsupportedException;
+import org.tizen.web.assignmenttracing.ui.AssignmentTracingUI;
+
+/**
+ * This class builds CFG that is specifically related to a selected local variable.
+ * <p>
+ * Entry method is buildCFG and others are composed of statement and expression part. <br>
+ * Whenever it finds def/use of selected variable, it creates DefNode/UseNode and
+ * connects nodes with edges.
+ *
+ * @author Hyukmin Kwon <hyukmin0530@samsung.com>
+ * @author Jaeheung Kim <jaeheung.kim@samsung.com>
+ *
+ */
+public class CFGBuilder {
+
+       private static final int DEF = 0;
+       private static final int USE = 1;
+       private static final int DECL = 2;
+       private static final int LHS = 0;
+       private static final int RHS = 1;
+
+       private List<CFGNode> nameMatchedNode;
+
+       private CFGNode start = null;
+       // backup SimpleName for other methods
+       private SimpleName selectedName;
+
+       private Stack<EnvironmentStack> environments;
+       private EnvironmentStack currentEnv = null;
+
+       // total created node count
+       private int nodeCount;
+
+       private IProgressMonitor cancelMonitor;
+       
+       public class SelectedNameStringChecker extends ASTVisitor {
+               private boolean nameStringExists = false;
+
+               public SelectedNameStringChecker() {
+                       super(false); // do not include Javadoc tags
+                       nameStringExists = false;
+               }
+
+               public boolean getResult() {
+                       return nameStringExists;
+               }
+
+               public boolean visit(SimpleName node) {
+                       if (hasSelectedNameString(node)) {
+                               ASTNode parent = node.getParent();
+
+                               //Ignoring labels and object literal fields
+                               if (node.resolveBinding() == null) return true;
+
+                               //Ignoring fieldname of fieldaccess case
+                               if ((parent instanceof FieldAccess) &&
+                                               (((FieldAccess) parent).getName() == node)) return true;
+
+                               nameStringExists = true;
+                               return false; //Do not visit children
+                       }
+                       return true;
+               }
+       }
+       
+       public class SelectedNameContainingChecker extends ASTVisitor {
+               private boolean nameExists = false;
+
+               public SelectedNameContainingChecker() {
+                       super(false); // do not include Javadoc tags
+                       nameExists = false;
+               }
+
+               public boolean getResult() {
+                       return nameExists;
+               }
+
+               public boolean visit(SimpleName node) {
+                       if (isSelectedBinding(node)) {
+                               nameExists = true;
+                               return false; //Do not visit children
+                       }
+                       return true;
+               }
+
+               public boolean visit(WithStatement node) {
+
+                       nameExists = nameExists || checkSelectedNameContainment(node.getExpression());
+                       nameExists = nameExists || checkSelectedNameString(node.getBody());
+                       return false; //Do not visit children
+               }
+       }
+
+       /**
+        * Checks that a function declaration has a def(assignment) of a variable.
+        *
+        * <code>DefChecker</code> tries to create a CFG using the same procedure
+        * that CFGBuilder does for the function. But it doesn't actually make CFG nodes or edges and
+        * checks if a def of the variable appears.
+        * @author Wooyoung Cho <wooyoung1.cho@samsung.com>
+        *
+        */
+       private class DefChecker extends CFGBuilder {
+
+               /**
+                * Thrown when a def of the variable is found.
+                * @author Wooyoung Cho <wooyoung1.cho@samsung.com>
+                *
+                */
+               class DefFound extends RuntimeException {
+                       private static final long serialVersionUID = -2769993374371688073L;
+               }
+
+               public DefChecker(IProgressMonitor monitor) {
+                       super(monitor);
+               }
+
+               /**
+                * @param func function declaration
+                * @param name name to be found for a def in the function
+                * @return <code>true</code> if a def of the name is found in the function.
+                * <code>false</code> otherwise.
+                */
+               public boolean checkDefExists(FunctionDeclaration func, SimpleName name) {
+                       try {
+                               buildCFG(func, name);
+                       } catch (DefFound e) {
+                               return true;
+                       }
+                       return false;
+               }
+
+               @Override
+               protected CFGNode createSimpleName(CFGNode prev, SimpleName name) {
+                       if (isSelectedBinding(name)) {
+                               throw new DefFound();
+                       }
+                       return null;
+               }
+
+               @Override
+               protected CFGNode createNode(SimpleName name, Integer nodeType) {
+                       return null;
+               }
+
+               @Override
+               protected CFGNode createSkipNode() {
+                       return null;
+               }
+
+               @Override
+               protected void connectNodes(CFGNode prev, CFGNode next) {
+               }
+       }
+
+       /**
+        * Initialize all member fields
+        * @param monitor
+        */
+       public CFGBuilder(IProgressMonitor monitor) {
+               nameMatchedNode = new ArrayList<CFGNode>();
+
+               environments = new Stack<EnvironmentStack>();
+               //Default environment
+               environments.push(new EnvironmentStack());
+               currentEnv = environments.peek();
+
+               nodeCount = 0;
+
+               this.cancelMonitor = monitor;
+       }
+
+       /**
+        * Starts CFG build.
+        *
+        * @param func FunctionDeclaration enclosing a selected variable
+        * @param selName selected variable name
+        * @return list of CFGNode matched to the selected variable
+        * @exception TracingCancelException if canceled, thrown with "canceled" message
+        * @exception TracingUnsupportedException if unsupported features are found
+        */
+       @SuppressWarnings("rawtypes")
+       public List<CFGNode> buildCFG(FunctionDeclaration func, SimpleName selName) {
+               selectedName = selName;
+
+               start = createSkipNode();
+
+               //Dummy skip node between DeclNodes and another CFGNodes
+               CFGNode prev = createSkipNode();
+               connectNodes(start, prev);
+
+               List parameters = func.parameters();
+               for (Object parameter : parameters) {
+                       prev = createSingleVariableDeclaration(prev, (SingleVariableDeclaration) parameter);
+               }
+
+               createStatement(prev, func.getBody());
+
+               return nameMatchedNode;
+       }
+       
+       /**
+        * Calculate and mark CFGNode if it is reachable from start node
+        */
+       public void checkReachability() {
+               Stack<CFGNode> nodeStack = new Stack<CFGNode>();
+               
+               nodeStack.push(start);
+
+               while (!nodeStack.empty()) {
+                       CFGNode currentNode = nodeStack.pop();
+                       currentNode.setReachable();
+                       for (CFGNode succ : currentNode.getSucc()) {
+                               if (!succ.isReachable()) { 
+                                       nodeStack.push(succ);
+                               }                               
+                       }
+                       if (currentNode instanceof TrySkipNode) {
+                               CFGNode catchBeginNode = ((TrySkipNode) currentNode).getCatchBeginNode();
+                               if (catchBeginNode != null && !catchBeginNode.isReachable()) {
+                                       nodeStack.push(catchBeginNode);
+                               }
+                       }
+               }               
+       }
+
+       private CFGNode createSingleVariableDeclaration(
+                       CFGNode prev, SingleVariableDeclaration variableDecl) {
+               SimpleName name = variableDecl.getName();
+               return createSimpleName(prev, name);
+       }
+
+       private CFGNode createStatement(CFGNode prev, Statement stmt) {
+               // check job cancellation before processing each statement
+               if (cancelMonitor.isCanceled()) {
+                       throw new TracingCancelException();
+               }
+
+               // stmt can be null for error-recovered statement.
+               // e.g.) "function f(x);" has null body.
+               if (stmt == null) {
+                       return prev;
+               }
+
+               switch (stmt.getNodeType()) {
+                       case ASTNode.BLOCK:
+                               return createBlockStatement(prev, (Block) stmt);
+                       case ASTNode.EXPRESSION_STATEMENT:
+                               return createExpressionStatement(prev, (ExpressionStatement) stmt);
+                       case ASTNode.VARIABLE_DECLARATION_STATEMENT:
+                               return createVariableDeclarationStatement(prev, (VariableDeclarationStatement) stmt);
+                       case ASTNode.IF_STATEMENT:
+                               return createIfStatement(prev, (IfStatement) stmt);
+                       case ASTNode.FOR_STATEMENT:
+                               return createForStatement(prev, (ForStatement) stmt);
+                       case ASTNode.FOR_IN_STATEMENT:
+                               return createForInStatement(prev, (ForInStatement) stmt);
+                       case ASTNode.WHILE_STATEMENT:
+                               return createWhileStatement(prev, (WhileStatement) stmt);
+                       case ASTNode.DO_STATEMENT:
+                               return createDoWhileStatement(prev, (DoStatement) stmt);
+                       case ASTNode.SWITCH_STATEMENT:
+                               return createSwitchStatement(prev, (SwitchStatement) stmt);
+                       case ASTNode.SWITCH_CASE:
+                               return createCaseDefaultStatement(prev, (SwitchCase) stmt);
+                       case ASTNode.RETURN_STATEMENT:
+                               return createReturnStatement(prev, (ReturnStatement) stmt);
+                       case ASTNode.BREAK_STATEMENT:
+                               return createBreakStatement(prev, (BreakStatement) stmt);
+                       case ASTNode.CONTINUE_STATEMENT:
+                               return createContinueStatement(prev, (ContinueStatement) stmt);
+                       case ASTNode.LABELED_STATEMENT:
+                               return createLabeledStatement(prev, (LabeledStatement) stmt);
+                       case ASTNode.WITH_STATEMENT:
+                               return createWithStatement(prev, (WithStatement) stmt);
+                       case ASTNode.TRY_STATEMENT:
+                               return createTryStatement(prev, (TryStatement) stmt);
+                       case ASTNode.THROW_STATEMENT:
+                               return createThrowStatement(prev, (ThrowStatement) stmt);
+                       case ASTNode.EMPTY_STATEMENT:
+                               return prev;
+                       default:
+                               // not expected statement is detected
+                               throw new TracingInternalErrorException();
+               }
+       }
+
+       @SuppressWarnings("rawtypes")
+       private CFGNode createBlockStatement(CFGNode prev, Block stmt) {
+               currentEnv.push(new NotInterestingElement());
+
+               List statements = ((Block) stmt).statements();
+               for (Object statement : statements) {
+                       if (statement instanceof FunctionDeclaration) {
+                               //Throw exception if interesting name is contained
+                               FunctionDeclaration functionDecl = (FunctionDeclaration) statement;
+                               if (checkDefExists(functionDecl)) {
+                                       throw new TracingUnsupportedException();
+                               }
+                       } else {
+                               prev = createStatement(prev, (Statement) statement);
+                       }
+               }
+
+               currentEnv.pop();
+
+               return prev;
+       }
+
+       private CFGNode createExpressionStatement(CFGNode prev, ExpressionStatement stmt) {
+               prev = createExpr(prev, stmt.getExpression(), RHS);
+               return prev;
+       }
+
+       @SuppressWarnings("rawtypes")
+       private CFGNode createVariableDeclarationStatement(
+                       CFGNode prev, VariableDeclarationStatement stmt) {
+               List fragments = stmt.fragments();
+               for (Object fragment : fragments) {
+                       VariableDeclarationFragment declFragment = (VariableDeclarationFragment) fragment;
+                       prev = createVariableDeclarationFragment(prev, declFragment);
+               }
+               return prev;
+       }
+
+       private CFGNode createVariableDeclarationFragment(
+                       CFGNode prev, VariableDeclarationFragment fragment) {
+               Expression initializer = fragment.getInitializer();
+               SimpleName name = fragment.getName();
+               if (initializer != null) {
+                       prev = createExpr(prev, initializer, RHS);
+                       prev = createSimpleName(prev, name);
+               } else {
+                       if (isSelectedBinding(name)) {
+                               CFGNode declNode = createNode(name, DECL);
+
+                               for (CFGNode succ : start.getSucc()) {
+                                       succ.getPred().remove(start);
+                                       connectNodes(declNode, succ);
+                               }
+                               start.getSucc().clear();
+                               connectNodes(start, declNode);
+                       }
+               }
+               return prev;
+       }
+
+       private CFGNode createIfStatement(CFGNode prev, IfStatement stmt) {
+               currentEnv.push(new NotInterestingElement());
+
+               prev = createExpr(prev, stmt.getExpression(), RHS);
+
+               CFGNode thenNode = createStatement(prev, stmt.getThenStatement());
+               CFGNode joinNode = createSkipNode();
+               CFGNode elseNode = null;
+
+               connectNodes(thenNode, joinNode);
+
+               Statement elseStatement = stmt.getElseStatement();
+
+               if (elseStatement == null) {
+                       connectNodes(prev, joinNode);
+               } else {
+                       elseNode = createStatement(prev, elseStatement);
+                       connectNodes(elseNode, joinNode);
+               }
+
+               currentEnv.pop();
+               return joinNode;
+       }
+
+       @SuppressWarnings("rawtypes")
+       private CFGNode createForStatement(CFGNode prev, ForStatement stmt) {
+               CFGNode beforeCondNode = createSkipNode();
+               CFGNode beforeIterNode = createSkipNode();
+               CFGNode joinNode = createSkipNode();
+               CFGNode lastNode = null;
+
+               currentEnv.push(new LoopElement(joinNode, beforeIterNode));
+
+               // Initializers process
+               List initializers = stmt.initializers();
+
+               // initializer is ListExpression or VariableDeclarationExpression.
+               if (initializers.size() != 0) {
+                       Object initializer = initializers.get(0);
+                       prev = createExpr(prev, (Expression) initializer, RHS);
+               }
+
+               connectNodes(prev, beforeCondNode);
+
+               prev = beforeCondNode;
+               Expression condExpr = stmt.getExpression();
+               if (condExpr != null) {
+                       prev = createExpr(prev, condExpr, RHS);
+               }
+
+               lastNode = createStatement(prev, stmt.getBody());
+
+               connectNodes(lastNode, beforeIterNode);
+
+               if (condExpr != null) {
+                       // connect else edge if condition expression exists.
+                       connectNodes(prev, joinNode);
+               }
+               prev = beforeIterNode;
+
+               List updaters = stmt.updaters();
+               for (Object updater : updaters) {
+                       Expression expr = (Expression) updater;
+                       prev = createExpr(prev, expr, RHS);
+               }
+
+               connectNodes(prev, beforeCondNode);
+
+               currentEnv.pop();
+
+               return joinNode;
+       }
+
+       @SuppressWarnings("rawtypes")
+       private CFGNode createForInStatement(CFGNode prev, ForInStatement stmt) {
+               Statement iterationVariable = stmt.getIterationVariable();
+               Expression collection = stmt.getCollection();
+
+               CFGNode joinNode = createSkipNode();
+               CFGNode beforeVariableNode = createSkipNode();
+               CFGNode lastNode = null;
+               SimpleName name = null;
+
+               currentEnv.push(new LoopElement(joinNode, beforeVariableNode));
+
+               prev = createExpr(prev, collection, RHS);
+
+               if (iterationVariable instanceof VariableDeclarationStatement) {
+                       // for ( var a in {x:10, y:20} ) {}
+                       VariableDeclarationStatement declStmt = (VariableDeclarationStatement) iterationVariable;
+                       List fragments = declStmt.fragments();
+                       VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
+
+                       prev = createVariableDeclarationFragment(prev, fragment);
+
+                       name = fragment.getName();
+               } else {
+                       // for ( a in {x:10, y:20} ) {}
+                       ExpressionStatement exprStmt = (ExpressionStatement) iterationVariable;
+                       Expression expr = exprStmt.getExpression();
+
+                       name = (SimpleName) expr;
+               }
+
+               connectNodes(prev, beforeVariableNode);
+               prev = beforeVariableNode;
+
+               prev = createSimpleName(prev, name);
+
+               lastNode = createStatement(prev, stmt.getBody());
+               connectNodes(lastNode, beforeVariableNode);
+               connectNodes(prev, joinNode);
+
+               currentEnv.pop();
+
+               return joinNode;
+       }
+
+       private CFGNode createWhileStatement(CFGNode prev, WhileStatement stmt) {
+               CFGNode joinNode = createSkipNode();
+               CFGNode beforeCondNode = createSkipNode();
+               CFGNode lastNode = null;
+
+               currentEnv.push(new LoopElement(joinNode, beforeCondNode));
+
+               connectNodes(prev, beforeCondNode);
+
+               prev = createExpr(beforeCondNode, stmt.getExpression(), RHS);
+               lastNode = createStatement(prev, stmt.getBody());
+
+               connectNodes(lastNode, beforeCondNode);
+
+               // connect else edge
+               connectNodes(prev, joinNode);
+
+               currentEnv.pop();
+
+               return joinNode;
+       }
+
+       private CFGNode createDoWhileStatement(CFGNode prev, DoStatement stmt) {
+               CFGNode loopBeginNode = createSkipNode();
+               CFGNode beforeCondNode = createSkipNode();
+               CFGNode joinNode = createSkipNode();
+               CFGNode lastNode = null;
+
+               currentEnv.push(new LoopElement(joinNode, beforeCondNode));
+
+               connectNodes(prev, loopBeginNode);
+
+               lastNode = createStatement(loopBeginNode, stmt.getBody());
+
+               connectNodes(lastNode, beforeCondNode);
+
+               prev = createExpr(beforeCondNode, stmt.getExpression(), RHS);
+
+               connectNodes(prev, loopBeginNode);
+               connectNodes(prev, joinNode);
+
+               currentEnv.pop();
+
+               return joinNode;
+       }
+
+       @SuppressWarnings("rawtypes")
+       private CFGNode createSwitchStatement(CFGNode prev, SwitchStatement stmt) {
+               prev = createExpr(prev, stmt.getExpression(), RHS);
+
+               CFGNode joinNode = createSkipNode();
+
+               currentEnv.push(new SwitchElement(joinNode, prev));
+
+               currentEnv.getEnclosingSwitch().setPrevOfCaseExprChain(prev);
+
+               // switch body statement process
+               List body = stmt.statements();
+
+               //      null not to connect this stmt and the first stmt of switch body.
+               prev = null;
+               for (Object statement : body) {
+                       Statement node = (Statement) statement;
+                       prev = createStatement(prev, node);
+               }
+
+               // connect between the last statement of switch statement body and joinNode
+               connectNodes(prev, joinNode);
+
+               if (currentEnv.getEnclosingSwitch().getDefaultNode() == null) {
+                       // if default statement of this switch doesn't exist,
+                       // then connect fall-through edge to after the switch
+                       connectNodes(currentEnv.getEnclosingSwitch().getPrevOfCaseExprChain(), joinNode);
+               } else {
+                       // As default statement exists,
+                       // connect previous caseExprNode with default statement node
+                       CFGNode prevCaseExpr = currentEnv.getEnclosingSwitch().getPrevOfCaseExprChain();
+                       CFGNode defaultBeginNode = currentEnv.getEnclosingSwitch().getDefaultNode();
+                       connectNodes(prevCaseExpr, defaultBeginNode);
+               }
+
+               currentEnv.pop();
+
+               return joinNode;
+       }
+
+       private CFGNode createCaseDefaultStatement(CFGNode prev, SwitchCase stmt) {
+               CFGNode caseBeginNode = createSkipNode();
+               CFGNode caseAfterNode = createSkipNode();
+
+               connectNodes(prev, caseAfterNode);
+
+               Expression expr = stmt.getExpression();
+
+               if (expr != null) {
+                       // create case statement with the Expression of it.
+                       CFGNode prevCaseExpr = currentEnv.getEnclosingSwitch().getPrevOfCaseExprChain();
+                       connectNodes(prevCaseExpr, caseBeginNode);
+                       prev = createExpr(caseBeginNode, expr, RHS);
+                       currentEnv.getEnclosingSwitch().setPrevOfCaseExprChain(prev);
+               } else {
+                       // create default statement
+                       // put information that default statement exists.
+                       currentEnv.getEnclosingSwitch().setDefaultNode(caseBeginNode);
+                       prev = caseBeginNode;
+               }
+
+               connectNodes(prev, caseAfterNode);
+
+               return caseAfterNode;
+       }
+
+       private CFGNode createReturnStatement(CFGNode prev, ReturnStatement stmt) {
+               Expression expr = stmt.getExpression();
+
+               if (expr != null) {
+                       prev = createExpr(prev, expr, RHS);
+               }
+
+               for (int i = currentEnv.size() - 1; i >= 0; i--) {
+                       EnvironmentElement element = currentEnv.get(i);
+
+                       prev = createFinallyByEnv(prev, element, i - 1);
+               }
+
+               //Return null for non-fall-through edge
+               return null;
+       }
+
+       private CFGNode createBreakStatement(CFGNode prev, BreakStatement stmt) {
+               SimpleName labelName = stmt.getLabel();
+
+               if (labelName == null) {
+                       for (int i = currentEnv.size() - 1; i >= 0; i--) {
+                               EnvironmentElement element = currentEnv.get(i);
+                               if (element instanceof SwitchElement) {
+                                       connectNodes(prev, ((SwitchElement) element).getBreakTarget());
+                                       //Return null for non-fall-through edge
+                                       return null;
+                               } else if (element instanceof LoopElement) {
+                                       connectNodes(prev, ((LoopElement) element).getBreakTarget());
+                                       //Return null for non-fall-through edge
+                                       return null;
+                               } else {
+                                       prev = createFinallyByEnv(prev, element, i - 1);
+                               }
+                       }
+               } else {
+                       for (int i = currentEnv.size() - 1; i >= 0; i--) {
+                               EnvironmentElement element = currentEnv.get(i);
+
+                               if ((element instanceof SwitchElement) || 
+                                               (element instanceof LoopElement) ||
+                                               (element instanceof LabeledStmtElement)) {
+                                       i = currentEnv.hasCorrespondingLabel(labelName.getIdentifier(), i);
+                                       if (i == EnvironmentStack.LABEL_FOUND) {
+                                               CFGNode breakTarget = null;
+                                               if (element instanceof SwitchElement) {
+                                                       breakTarget = ((SwitchElement) element).getBreakTarget();
+                                               } else if (element instanceof LoopElement) {
+                                                       breakTarget = ((LoopElement) element).getBreakTarget();
+                                               } else if (element instanceof LabeledStmtElement) {
+                                                       breakTarget = ((LabeledStmtElement) element).getBreakTarget();
+                                               }
+                                               connectNodes(prev, breakTarget);
+                                               //Return null for non-fall-through edge
+                                               return null;
+                                       }
+                               } else {
+                                       prev = createFinallyByEnv(prev, element, i - 1);
+                               }
+                       }
+               }
+
+               throw new TracingUnsupportedException();
+       }
+
+       private CFGNode createContinueStatement(CFGNode prev, ContinueStatement stmt) {
+               SimpleName labelName = stmt.getLabel();
+
+               if (labelName == null) {
+                       for (int i = currentEnv.size() - 1; i >= 0; i--) {
+                               EnvironmentElement element = currentEnv.get(i);
+
+                               if (element instanceof LoopElement) {
+                                       connectNodes(prev, ((LoopElement) element).getContinueTarget());
+                                       //Return null for non-fall-through edge
+                                       return null;
+                               } else {
+                                       prev = createFinallyByEnv(prev, element, i - 1);
+                               }
+                       }
+               } else {
+                       for (int i = currentEnv.size() - 1; i >= 0; i--) {
+                               EnvironmentElement element = currentEnv.get(i);
+                               if (element instanceof LoopElement) {
+                                       i = currentEnv.hasCorrespondingLabel(labelName.getIdentifier(), i);
+                                       if (i == EnvironmentStack.LABEL_FOUND) {
+                                               CFGNode continueTarget = ((LoopElement) element).getContinueTarget();
+                                               connectNodes(prev, continueTarget);
+                                               //Return null for non-fall-through edge
+                                               return null;
+                                       }
+                               } else {
+                                       prev = createFinallyByEnv(prev, element, i - 1);
+                               }
+                       }
+               }
+
+               throw new TracingUnsupportedException();
+       }
+
+       private CFGNode createLabeledStatement(CFGNode prev, LabeledStatement stmt) {
+               String labelName = stmt.getLabel().getIdentifier();
+               CFGNode joinNode = createSkipNode();
+               Statement body = stmt.getBody();
+
+               currentEnv.push(new LabeledStmtElement(labelName, joinNode));
+
+               prev = createStatement(prev, body);
+               connectNodes(prev, joinNode);
+
+               // remove current label informations not to be duplicated.
+               currentEnv.pop();
+
+               return joinNode;
+       }
+
+       private CFGNode createWithStatement(CFGNode prev, WithStatement stmt) {
+               // As currently not support WithStatement body, don't process stmt.getBody()
+               prev = createExpr(prev, stmt.getExpression(), RHS);
+               if (checkSelectedNameString(stmt.getBody())) {
+                       throw new TracingUnsupportedException();
+               }
+               return prev;
+       }
+
+       @SuppressWarnings("rawtypes")
+       private CFGNode createTryStatement(CFGNode prev, TryStatement stmt) {
+               CFGNode catchBeginNode = null;
+               CFGNode finallyBeginNode = null;
+               List catchClauses = stmt.catchClauses();
+               Block finallyBlock = stmt.getFinally();
+
+               if (catchClauses.size() > 0) {
+                       catchBeginNode = createSkipNode();
+               }
+
+               if (finallyBlock != null) {
+                       finallyBeginNode = createSkipNode();
+               }
+
+               //TryBlock
+               CFGNode trySkipNode = createTrySkipNode(catchBeginNode);
+               connectNodes(prev, trySkipNode);
+               prev = trySkipNode;
+               
+               Block tryBlock = stmt.getBody();
+               currentEnv.push(new TryElement(stmt, catchBeginNode));
+
+               prev = createStatement(prev, tryBlock);
+
+               currentEnv.pop();
+
+               CFGNode prev1 = prev;
+
+               //Catch Block
+               if (catchClauses.size() > 0) {
+                       currentEnv.push(new CatchElement(stmt));
+
+                       Object catchClauseObject = catchClauses.get(0);
+
+                       prev = catchBeginNode;
+                       CatchClause catchClause = (CatchClause) catchClauseObject;
+                       SimpleName exceptionParam = catchClause.getException().getName();
+                       prev = createSimpleName(prev, exceptionParam);
+                       prev = createStatement(prev, catchClause.getBody());
+
+                       currentEnv.pop();
+               }
+
+               //Finally block
+               if (finallyBlock != null) {
+                       connectNodes(prev, finallyBeginNode);
+                       if (catchClauses.size() > 0)
+                               connectNodes(prev1, finallyBeginNode);
+                       prev = finallyBeginNode;
+                       prev = createStatement(prev, finallyBlock);
+               } else {
+                       CFGNode joinNode = createSkipNode();
+                       connectNodes(prev, joinNode);
+                       if (catchClauses.size() > 0)
+                               connectNodes(prev1, joinNode);
+                       prev = joinNode;
+               }
+
+               return prev;
+       }
+
+       private CFGNode createThrowStatement(CFGNode prev, ThrowStatement stmt) {
+               prev = createExpr(prev, stmt.getExpression(), RHS);
+
+               for (int i = currentEnv.size() - 1; i >= 0; i--) {
+                       EnvironmentElement element = currentEnv.get(i);
+
+                       if ((element instanceof TryElement) &&
+                                       (((TryElement) element).getCatchBeginNode() != null)) {
+                               connectNodes(prev, ((TryElement) element).getCatchBeginNode());
+                               //Return null for non-fall-through edge
+                               return null;
+                       }
+                       else {
+                               prev = createFinallyByEnv(prev, element, i - 1);
+                       }
+               }
+
+               //Return null for non-fall-through edge
+               return null;
+       }
+
+       private CFGNode createFinallyByEnv(CFGNode prev, EnvironmentElement element, int toIndex) {
+               if ((element instanceof TryElement) && ((TryElement) element).hasFinally()) {
+                       environments.push(currentEnv.copyEnvironmentFromBottom(toIndex));
+                       currentEnv = environments.peek();
+                       prev = createStatement(prev, ((TryElement) element).getTryStmt().getFinally());
+                       environments.pop();
+                       currentEnv = environments.peek();
+               } else if ((element instanceof CatchElement) && ((CatchElement) element).hasFinally()) {
+                       environments.push(currentEnv.copyEnvironmentFromBottom(toIndex));
+                       currentEnv = environments.peek();
+                       prev = createStatement(prev, ((CatchElement) element).getTryStmt().getFinally());
+                       environments.pop();
+                       currentEnv = environments.peek();
+               }
+               return prev;
+       }
+
+       @SuppressWarnings("rawtypes")
+       private CFGNode createExpr(CFGNode prev, Expression expr, int side) {
+               // safety check: expr might be null for some error-recovered expression.
+               if (expr == null) {
+                       return prev;
+               }
+
+               switch (expr.getNodeType()) {
+                       case ASTNode.SIMPLE_NAME: {
+                               SimpleName name = (SimpleName) expr;
+                               if (isSelectedBinding(name)) {
+                                       CFGNode node = null;
+                                       if (side == RHS) {
+                                               node = createNode(name, USE);
+                                               connectNodes(prev, node);
+                                               prev = node;
+                                       } else {
+                                               //Do nothing during evaluation step
+                                       }
+                               }
+                       } break;
+                       case ASTNode.INFIX_EXPRESSION: {
+                               InfixExpression infixExpr = (InfixExpression) expr;
+                               InfixExpression.Operator operator = infixExpr.getOperator();
+
+                               Expression operand1 = infixExpr.getLeftOperand();
+                               Expression operand2 = infixExpr.getRightOperand();
+
+                               if ((operator == InfixExpression.Operator.CONDITIONAL_OR) ||
+                                               (operator == InfixExpression.Operator.CONDITIONAL_AND)) {
+                                       prev = createExpr(prev, operand1, RHS);
+                                       CFGNode skip = createSkipNode();
+                                       connectNodes(prev, skip);
+                                       prev = createExpr(prev, operand2, RHS);
+                                       connectNodes(prev, skip);
+                                       if (infixExpr.hasExtendedOperands()) {
+                                               List extendedOperands = infixExpr.extendedOperands();
+                                               for (Object extendedOperand : extendedOperands) {
+                                                       prev = createExpr(prev, (Expression) extendedOperand, RHS);
+                                                       connectNodes(prev, skip);
+                                               }
+                                       }
+                                       prev = skip;
+                               } else {
+                                       prev = createExpr(prev, operand1, RHS);
+                                       prev = createExpr(prev, operand2, RHS);
+                                       if (infixExpr.hasExtendedOperands()) {
+                                               List extendedOperands = infixExpr.extendedOperands();
+                                               for (Object extendedOperand : extendedOperands) {
+                                                       prev = createExpr(prev, (Expression) extendedOperand, RHS);
+                                               }
+                                       }
+                               }
+                       } break;
+                       case ASTNode.POSTFIX_EXPRESSION: {
+                               PostfixExpression postfixExpr = (PostfixExpression) expr;
+                               PostfixExpression.Operator operator = postfixExpr.getOperator();
+
+                               prev = createExpr(prev, postfixExpr.getOperand(), RHS);
+
+                               if ((operator == PostfixExpression.Operator.INCREMENT) ||
+                                               (operator == PostfixExpression.Operator.DECREMENT)) {
+                                       SimpleName interestingId = searchId(postfixExpr.getOperand());
+                                       if (interestingId != null) {
+                                               CFGNode use = createNode(interestingId, USE);
+                                               connectNodes(prev, use);
+                                               CFGNode def = createNode(interestingId, DEF);
+                                               connectNodes(use, def);
+                                               prev = def;
+                                       }
+                               }
+                       } break;
+                       case ASTNode.PREFIX_EXPRESSION: {
+                               PrefixExpression prefixExpr = (PrefixExpression) expr;
+                               PrefixExpression.Operator operator = prefixExpr.getOperator();
+
+                               if ((operator == PrefixExpression.Operator.INCREMENT) ||
+                                               (operator == PrefixExpression.Operator.DECREMENT)) {
+                                       SimpleName interestingId = searchId(prefixExpr.getOperand());
+                                       if (interestingId != null) {
+                                               CFGNode use = createNode(interestingId, USE);
+                                               connectNodes(prev, use);
+                                               CFGNode def = createNode(interestingId, DEF);
+                                               connectNodes(use, def);
+                                               prev = def;
+                                       }
+                               }
+                               prev = createExpr(prev, prefixExpr.getOperand(), RHS);
+                       } break;
+                       case ASTNode.ASSIGNMENT: {
+                               Assignment assignmentExpr = (Assignment) expr;
+                               Assignment.Operator operator = assignmentExpr.getOperator();
+
+                               if (operator == Assignment.Operator.ASSIGN) {
+                                       prev = createExpr(prev, assignmentExpr.getLeftHandSide(), LHS);
+                                       prev = createExpr(prev, assignmentExpr.getRightHandSide(), RHS);
+                                       prev = evaluateLHSdef(prev, assignmentExpr.getLeftHandSide());
+                               } else {
+                                       prev = createExpr(prev, assignmentExpr.getLeftHandSide(), RHS);
+                                       prev = createExpr(prev, assignmentExpr.getRightHandSide(), RHS);
+                                       prev = evaluateLHSdef(prev, assignmentExpr.getLeftHandSide());
+                               }
+                       } break;
+                       case ASTNode.FUNCTION_INVOCATION: {
+                               FunctionInvocation functionInvocationExpr = (FunctionInvocation) expr;
+                               Expression optionalExpr = functionInvocationExpr.getExpression();
+                               if (optionalExpr != null) {
+                                       prev = createExpr(prev, optionalExpr, RHS);
+                               }
+
+                               if (functionInvocationExpr.getName() != null) {
+                                       prev = createExpr(prev, functionInvocationExpr.getName(), RHS);
+                               }
+
+                               List argumentExprList = functionInvocationExpr.arguments();
+                               for (Object argument : argumentExprList) {
+                                       prev = createExpr(prev, (Expression) argument, RHS);
+                               }
+                       } break;
+                       case ASTNode.PARENTHESIZED_EXPRESSION: {
+                               ParenthesizedExpression parenthesizedExpr = (ParenthesizedExpression) expr;
+                               prev = createExpr(prev, parenthesizedExpr.getExpression(), side);
+                       } break;
+                       case ASTNode.LIST_EXPRESSION: {
+                               ListExpression listExpression = (ListExpression) expr;
+                               List exprList = listExpression.expressions();
+                               for (Object expr1 : exprList) {
+                                       prev = createExpr(prev, (Expression) expr1, RHS);
+                               }
+                       } break;
+                       case ASTNode.ARRAY_ACCESS: {
+                               ArrayAccess arrayAccessExpr = (ArrayAccess) expr;
+                               prev = createExpr(prev, arrayAccessExpr.getArray(), RHS);
+                               prev = createExpr(prev, arrayAccessExpr.getIndex(), RHS);
+                       } break;
+                       case ASTNode.ARRAY_INITIALIZER: {
+                               ArrayInitializer arrayInitializerExpr = (ArrayInitializer) expr;
+                               List elementExprList = arrayInitializerExpr.expressions();
+                               for (Object arrayElement : elementExprList) {
+                                       prev = createExpr(prev, (Expression) arrayElement, RHS);
+                               }
+                       } break;
+                       case ASTNode.CLASS_INSTANCE_CREATION: {
+                               ClassInstanceCreation classInstanceCreationExpr = (ClassInstanceCreation) expr;
+
+                               prev = createExpr(prev, classInstanceCreationExpr.getMember(), RHS);
+
+                               List argumentExprList = classInstanceCreationExpr.arguments();
+                               for (Object argument : argumentExprList) {
+                                       prev = createExpr(prev, (Expression) argument, RHS);
+                               }
+                       } break;
+                       case ASTNode.FIELD_ACCESS: {
+                               FieldAccess fieldAccessExpr = (FieldAccess) expr;
+                               prev = createExpr(prev, fieldAccessExpr.getExpression(), RHS);
+                               prev = createExpr(prev, fieldAccessExpr.getName(), RHS);
+                       } break;
+                       case ASTNode.CONDITIONAL_EXPRESSION: {
+                               ConditionalExpression condExpr = (ConditionalExpression) expr;
+
+                               CFGNode skip = createSkipNode();
+
+                               if (side == RHS) {
+                                       prev = createExpr(prev, condExpr.getExpression(), RHS);
+                                       connectNodes(createExpr(prev, condExpr.getThenExpression(), RHS), skip);
+                                       connectNodes(createExpr(prev, condExpr.getElseExpression(), RHS), skip);
+                                       prev = skip;
+                               } else { // eg. (x > y ? x : y)= 1
+                                       prev = createExpr(prev, condExpr.getExpression(), RHS);
+                                       connectNodes(createExpr(prev, condExpr.getThenExpression(), LHS), skip);
+                                       connectNodes(createExpr(prev, condExpr.getElseExpression(), LHS), skip);
+                                       prev = skip;
+                               }
+                       } break;
+                       case ASTNode.OBJECT_LITERAL: {
+                               ObjectLiteral objectLiteral = (ObjectLiteral) expr;
+                               List fieldList = objectLiteral.fields();
+
+                               for (Object objectLiteralField : fieldList) {
+                                       prev = createExpr(prev, (Expression) objectLiteralField, RHS);
+                               }
+                       } break;
+                       case ASTNode.OBJECT_LITERAL_FIELD: {
+                               ObjectLiteralField objectLiteralField = (ObjectLiteralField) expr;
+                               prev = createExpr(prev, objectLiteralField.getFieldName(), RHS);
+                               prev = createExpr(prev, objectLiteralField.getInitializer(), RHS);
+                       } break;
+                       case ASTNode.VARIABLE_DECLARATION_EXPRESSION: {
+                               VariableDeclarationExpression varDeclExpr =
+                                               (VariableDeclarationExpression) expr;
+
+                               List fragments = varDeclExpr.fragments();
+                               for (Object fragment : fragments) {
+                                       VariableDeclarationFragment varDecl = (VariableDeclarationFragment) fragment;
+                                       prev = createVariableDeclarationFragment(prev, varDecl);
+                               }
+                       } break;
+                       case ASTNode.FUNCTION_EXPRESSION: {
+                               //Throw exception if interesting name is contained
+                               FunctionExpression functionExpr = (FunctionExpression) expr;
+                               if (checkDefExists(functionExpr.getMethod())) {
+                                       throw new TracingUnsupportedException();
+                               }
+                       } break;
+                       case ASTNode.EMPTY_EXPRESSION:
+                       case ASTNode.NULL_LITERAL:
+                       case ASTNode.UNDEFINED_LITERAL:
+                       case ASTNode.NUMBER_LITERAL:
+                       case ASTNode.STRING_LITERAL:
+                       case ASTNode.BOOLEAN_LITERAL:
+                       case ASTNode.REGULAR_EXPRESSION_LITERAL:
+                       case ASTNode.THIS_EXPRESSION:
+                               //Ignoring expression nodes
+                               break;
+                       default:
+                               /**
+                                * Missing expression node case
+                                */
+                               assert false;
+               }
+               return prev;
+       }
+
+       /**
+        * Evaluate l-value def
+        * @param prev
+        * @param expr
+        * @return
+        */
+       private CFGNode evaluateLHSdef(CFGNode prev, Expression expr) {
+               if (expr instanceof ParenthesizedExpression) {
+                       ParenthesizedExpression parenthesizedExpr = (ParenthesizedExpression) expr;
+                       prev = evaluateLHSdef(prev, parenthesizedExpr.getExpression());
+               } else if (expr instanceof ConditionalExpression) {
+                       ConditionalExpression conditionalExpr = (ConditionalExpression) expr;
+
+                       CFGNode skip = createSkipNode();
+
+                       connectNodes(evaluateLHSdef(prev, conditionalExpr.getThenExpression()), skip);
+                       connectNodes(evaluateLHSdef(prev, conditionalExpr.getElseExpression()), skip);
+                       prev = skip;
+               } else if (expr instanceof SimpleName) {
+                       SimpleName name = (SimpleName) expr;
+                       prev = createSimpleName(prev, name);
+               }
+
+               return prev;
+       }
+
+       /**
+        * Checks that the def of the selected name exists in the function
+        * @param func
+        * @return
+        * @see DefChecker#checkDefExists(FunctionDeclaration func, SimpleName name)
+        */
+       private boolean checkDefExists(FunctionDeclaration func) {
+               return new DefChecker(cancelMonitor).checkDefExists(func, selectedName);
+       }
+
+       /**
+        * Check the existence of SimpleName node whose binding is same as selected SimpleName
+        * by visiting from given root node to descendants.
+        * @param root
+        * @return
+        */
+       private boolean checkSelectedNameContainment(ASTNode root) {
+               SelectedNameContainingChecker checker = new SelectedNameContainingChecker();
+               root.accept(checker);
+               return checker.getResult();
+       }
+
+       /**
+        * Compare name string of given SimpleName node with the name of the selected SimpleName.
+        * @param name
+        * @return
+        */
+       private boolean hasSelectedNameString(SimpleName name) {
+               return selectedName.getIdentifier().equals(name.getIdentifier());
+       }
+
+       /**
+        * Check the existence of SimpleName node whose name string is same as selected SimpleName
+        * by visiting from given root node to descendants.
+        * @param root
+        * @return boolean
+        */
+       private boolean checkSelectedNameString(ASTNode root) {
+               SelectedNameStringChecker checker = new SelectedNameStringChecker();
+               root.accept(checker);
+               return checker.getResult();
+
+       }
+
+       protected void connectNodes(CFGNode prev, CFGNode next) {
+               if (prev == null || next == null) {
+                       return;
+               }
+               prev.addSucc(next);
+               next.addPred(prev);
+       }
+
+       /**
+        * Create a new cfgNode only if selectedName and name have the same bindings.
+        *
+        * @param name name that have the same bindings with selectedName
+        * @param nodeType cfgNode type to create
+        * @return created cfgNode
+        */
+       protected CFGNode createNode(SimpleName name, Integer nodeType) {
+               CFGNode node = null;
+
+               if (nodeType == DEF) {
+                       node = new DefNode(name, nodeCount);
+               } else if (nodeType == USE) {
+                       node = new UseNode(name, nodeCount);
+               } else if (nodeType == DECL) {
+                       node = new DeclNode(name, nodeCount);
+               } else {
+                       throw new IllegalArgumentException();
+               }
+
+               if (name == selectedName) {
+                       // if the selectedName and name are equal then add created node
+                       // to be used in ChainBuilder
+                       nameMatchedNode.add(node);
+               }
+
+               nodeCount++;
+               return node;
+       }
+
+       protected CFGNode createSkipNode() {
+               return new SkipNode(nodeCount++);
+       }
+       
+       protected CFGNode createTrySkipNode(CFGNode catchBeginNode) {
+               return new TrySkipNode(nodeCount++, catchBeginNode);
+       }
+
+       /**
+        * Create a DEF node and connect with previous node only if selected SimpleName and
+        * given SimpleName have the same bindings.
+        *
+        * @param prev previous cfgNode
+        * @param name currently processing SimpleName
+        * @return <code>created cfgNode</code> if both have the same bindings.
+        * <code>prev</code> otherwise.
+        */
+       protected CFGNode createSimpleName(CFGNode prev, SimpleName name) {
+               if (isSelectedBinding(name)) {
+                       CFGNode node = createNode(name, DEF);
+                       connectNodes(prev, node);
+                       prev = node;
+               }
+               return prev;
+       }
+
+       protected boolean isSelectedBinding(SimpleName name) {
+               return selectedName.resolveBinding().isEqualTo(name.resolveBinding());
+       }
+
+       // (((x))) case. return ID
+       private SimpleName searchId(Expression expr) { // expr must be lvalue
+               if (expr instanceof SimpleName) {
+                       SimpleName idExpr = (SimpleName) expr;
+                       if (isSelectedBinding(idExpr)) {
+                               // interesting
+                               return idExpr;
+                       } else { // non interesting
+                               return null;
+                       }
+               } else if (expr instanceof ParenthesizedExpression) {
+                       ParenthesizedExpression parenthesizedExpr = (ParenthesizedExpression) expr;
+                       /* ( xxxxx ) */
+                       return searchId(parenthesizedExpr.getExpression());
+               } else {
+                       // a.b cases
+                       return null;
+               }
+       }
+
+       /**
+        * Get the count of all CFG nodes.
+        *
+        * @return the count of all CFG nodes
+        */
+       public int getNodeCount() {
+               return nodeCount;
+       }
+}
diff --git a/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/CFGNode.java b/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/CFGNode.java
new file mode 100644 (file)
index 0000000..2e256c0
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * Program Understanding / Assignment Tracing for JavaScript
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Jaeheung Kim <jaeheung.kim@samsung.com>
+ * Woongsik Choi <woongsik76.choi@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.web.assignmenttracing.core;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * The super class node of all types of CFG nodes.<p>
+ * A node can have incoming and outgoing edges connected to other nodes.<br>
+ * All nodes must have unique ID.
+ *
+ * @author Jaeheung Kim <jaeheung.kim@samsung.com>
+ */
+public class CFGNode {
+       private List<CFGNode> pred;
+       private List<CFGNode> succ;
+       private boolean reachable = false;
+
+       private int id;
+
+       CFGNode(int id) {
+               this.id = id;
+
+               pred = new ArrayList<CFGNode>();
+               succ = new ArrayList<CFGNode>();
+       }
+
+       /**
+        * Get unique CFGNode ID
+        * @return unique CFGNode ID
+        */
+       public int getID() {
+               return id;
+       }
+
+       /**
+        * Get all predecessor CFGNodes of this node.
+        * @return list of CFGNodes
+        */
+       public List<CFGNode> getPred() {
+               return pred;
+       }
+
+       /**
+        * Get all successor CFGNodes of this node.
+        * @return list of CFGNodes
+        */
+       public List<CFGNode> getSucc() {
+               return succ;
+       }
+
+       /**
+        * Add successor CFGNode to this node.
+        * @param node
+        */
+       public void addSucc(CFGNode node) {
+               succ.add(node);
+       }
+
+       /**
+        * Add predecessor CFGNode to this node.
+        * @param node
+        */
+       public void addPred(CFGNode node) {
+               pred.add(node);
+       }
+       
+       /**
+        * Set reachable flag
+        */
+       public void setReachable() {
+               reachable = true;
+       }
+       
+       /**
+        * Returns if this node is reachable or not
+        * @return boolean
+        */
+       public boolean isReachable() {
+               return reachable;
+       }
+}
\ No newline at end of file
diff --git a/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/ChainBuilder.java b/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/ChainBuilder.java
new file mode 100644 (file)
index 0000000..2f72e44
--- /dev/null
@@ -0,0 +1,177 @@
+/*
+ * Program Understanding / Assignment Tracing for JavaScript
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyukmin Kwon <hyukmin0530@samsung.com>
+ * Woongsik Choi <woongsik76.choi@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.web.assignmenttracing.core;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.Stack;
+
+import org.eclipse.wst.jsdt.core.dom.SimpleName;
+import org.tizen.web.assignmenttracing.core.exceptions.TracingUnsupportedException;
+import org.tizen.web.assignmenttracing.ui.AssignmentTracingUI;
+
+
+/**
+ * This class builds Def-Use chain and Use-Def chain for given node
+ * by traversing the CFG (Control Flow Graph).
+ *
+ * @author Hyukmin Kwon <hyukmin0530@samsung.com>
+ */
+public class ChainBuilder {
+       private HashSet<SimpleName> udChain;
+       private HashSet<SimpleName> duChain;
+       private boolean[] explored;
+       private int visitedNodes, visitedSkipNodes, visitedUseNodes, visitedDefNodes, visitedDeclNodes;
+
+       public void buildChain(List<CFGNode> selNodes, int nodeCount) {
+               explored = new boolean[nodeCount];
+               duChain = new HashSet<SimpleName>();
+               udChain = new HashSet<SimpleName>();
+
+               if (AssignmentTracingUI.DEBUG) initStat();
+
+               for (CFGNode selNode : selNodes) {
+                       if (selNode.isReachable()) {
+                               if ((selNode instanceof DefNode) || (selNode instanceof DeclNode)) {
+                                       initializeFlagArray();
+                                       calcDUChain(selNode);
+                               } else if (selNode instanceof UseNode) {
+                                       initializeFlagArray();
+                                       calcUDChain(selNode);
+                               }
+                       } else {
+                               throw new TracingUnsupportedException();
+                       }
+               }
+
+               if (AssignmentTracingUI.DEBUG) printStat();
+
+               explored = null;
+       }
+
+       /**
+        * @return Return uses of the def node
+        */
+       public Set<SimpleName> getDUChain() {
+               return duChain;
+       }
+
+       /**
+        * @return Return defs for the use node
+        */
+       public Set<SimpleName> getUDChain() {
+               return udChain;
+       }
+
+       private void initializeFlagArray() {
+               for (int i = 0; i < explored.length; i++) {
+                       explored[i] = false;
+               }
+       }
+
+       private void calcDUChain(CFGNode node) {
+               Stack<CFGNode> nodeStack = new Stack<CFGNode>();
+               nodeStack.push(node);
+
+               while (!nodeStack.empty()) {
+                       CFGNode currentNode = nodeStack.pop();
+
+                       if (AssignmentTracingUI.DEBUG) checkStat(currentNode);
+
+                       explored[currentNode.getID()] = true;
+                       for (CFGNode succ : currentNode.getSucc()) {
+                               if (!explored[succ.getID()]) {
+                                       if (succ instanceof UseNode) {
+                                               UseNode useNode = (UseNode) succ;
+                                               duChain.add(useNode.getASTName());
+                                       }
+                                       if (!(succ instanceof DefNode)) {
+                                               nodeStack.push(succ);
+                                       }
+                               }
+                       }
+               }
+       }
+
+       private void calcUDChain(CFGNode node) {
+               Stack<CFGNode> nodeStack = new Stack<CFGNode>();
+               nodeStack.push(node);
+
+               while (!nodeStack.empty()) {
+                       CFGNode currentNode = nodeStack.pop();
+
+                       if (AssignmentTracingUI.DEBUG) checkStat(currentNode);
+
+                       explored[currentNode.getID()] = true;
+                       for (CFGNode pred : currentNode.getPred()) {
+                               int predId = pred.getID(); 
+                               if ((!explored[predId]) && pred.isReachable()) {
+                                       if (pred instanceof DefNode) {
+                                               explored[predId] = true;
+                                               DefNode defNode = (DefNode) pred;
+                                               udChain.add(defNode.getASTName());
+                                       } else if (pred instanceof DeclNode) {
+                                               DeclNode declNode = (DeclNode) pred;
+                                               udChain.add(declNode.getASTName());
+                                               nodeStack.push(pred);
+                                       } else {
+                                               nodeStack.push(pred);
+                                       }
+                               }
+                       }
+               }
+       }
+
+       private void initStat() {
+               visitedNodes = 0;
+               visitedSkipNodes = 0;
+               visitedUseNodes = 0;
+               visitedDefNodes = 0;
+               visitedDeclNodes = 0;
+       }
+
+       private void checkStat(CFGNode node) {
+               visitedNodes++;
+               if (node instanceof UseNode) {
+                       visitedUseNodes++;
+               } else if (node instanceof DefNode) {
+                       visitedDefNodes++;
+               } else if (node instanceof SkipNode) {
+                       visitedSkipNodes++;
+               } else if (node instanceof DeclNode) {
+                       visitedDeclNodes++;
+               }
+       }
+
+       private void printStat() {
+               System.out.println("ChainBuilder visited " + visitedNodes +
+                               "(skip " + visitedSkipNodes +
+                               ",use " + visitedUseNodes +
+                               ",def " + visitedDefNodes +
+                               ",decl " + visitedDeclNodes +
+                               ")");
+       }
+}
diff --git a/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/DeclNode.java b/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/DeclNode.java
new file mode 100644 (file)
index 0000000..07f3adf
--- /dev/null
@@ -0,0 +1,51 @@
+/*\r
+ * Program Understanding / Assignment Tracing for JavaScript\r
+ *\r
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyukmin Kwon <hyukmin0530@samsung.com>\r
+ * Woongsik Choi <woongsik76.choi@samsung.com>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.web.assignmenttracing.core;\r
+\r
+import org.eclipse.wst.jsdt.core.dom.SimpleName;\r
+\r
+/**\r
+ * DeclNode is introduced for variable declaration with out initialization.\r
+ * During making udchain DeclNode is collected but traversing is not terminated.\r
+ *\r
+ * @author Hyukmin Kwon <hyukmin0530@samsung.com>\r
+ */\r
+public class DeclNode extends CFGNode {\r
+\r
+       private SimpleName name;\r
+\r
+       DeclNode(SimpleName name, int id) {\r
+               super(id);\r
+               this.name = name;\r
+       }\r
+\r
+       /**\r
+        * Get SimpleName of UseNode\r
+        * @return SimpleName of UseNode\r
+        */\r
+       public SimpleName getASTName() {\r
+               return name;\r
+       }\r
+}
\ No newline at end of file
diff --git a/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/DefNode.java b/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/DefNode.java
new file mode 100644 (file)
index 0000000..7fef142
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Program Understanding / Assignment Tracing for JavaScript
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Jaeheung Kim <jaeheung.kim@samsung.com>
+ * Woongsik Choi <woongsik76.choi@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.web.assignmenttracing.core;
+
+import org.eclipse.wst.jsdt.core.dom.SimpleName;
+
+/**
+ * DefNode is used to find variables in write position that
+ * assigned the current values at the interested read position.
+ *
+ * @author Jaeheung Kim <jaeheung.kim@samsung.com>
+ */
+public class DefNode extends CFGNode {
+
+       private SimpleName name;
+
+       DefNode(SimpleName name, int id) {
+               super(id);
+               this.name = name;
+       }
+
+       /**
+        * Get SimpleName of DefNode
+        * @return SimpleName of DefNode
+        */
+       public SimpleName getASTName() {
+               return name;
+       }
+}
\ No newline at end of file
diff --git a/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/SkipNode.java b/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/SkipNode.java
new file mode 100644 (file)
index 0000000..ac7ed7c
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Program Understanding / Assignment Tracing for JavaScript
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Jaeheung Kim <jaeheung.kim@samsung.com>
+ * Woongsik Choi <woongsik76.choi@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.web.assignmenttracing.core;
+
+/**
+ * SkipNode is used only to connect <code>CFGNode</code>'s, 
+ * so it doesn't have associated SimpleName field.
+ *
+ * @author Jaeheung Kim <jaeheung.kim@samsung.com>
+ */
+public class SkipNode extends CFGNode {
+       SkipNode(int id) {
+               super(id);
+       }
+}
\ No newline at end of file
diff --git a/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/TrySkipNode.java b/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/TrySkipNode.java
new file mode 100644 (file)
index 0000000..4343d51
--- /dev/null
@@ -0,0 +1,41 @@
+/*\r
+ * Program Understanding / Assignment Tracing for JavaScript\r
+ *\r
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyukmin Kwon <hyukmin0530@samsung.com>\r
+ * Woongsik Choi <woongsik76.choi@samsung.com>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.web.assignmenttracing.core;\r
+\r
+/**\r
+ * TrySkipNode is used to check reachability from startnode\r
+ *\r
+ * @author Hyukmin Kwon <hyukmin0530@samsung.com>\r
+ */\r
+public class TrySkipNode extends SkipNode {\r
+       private CFGNode catchBeginNode = null;\r
+       public TrySkipNode(int id, CFGNode catchBeginNode) {\r
+               super(id);\r
+               this.catchBeginNode = catchBeginNode;\r
+       }\r
+       public CFGNode getCatchBeginNode() {\r
+               return catchBeginNode;\r
+       }       \r
+}\r
diff --git a/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/UseNode.java b/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/UseNode.java
new file mode 100644 (file)
index 0000000..99c8034
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Program Understanding / Assignment Tracing for JavaScript
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Jaeheung Kim <jaeheung.kim@samsung.com>
+ * Woongsik Choi <woongsik76.choi@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.web.assignmenttracing.core;
+
+import org.eclipse.wst.jsdt.core.dom.SimpleName;
+
+/**
+ * UseNode is used to find variables in read position of values assigned at the
+ * selected write position.
+ *
+ * @author Jaeheung Kim <jaeheung.kim@samsung.com>
+ */
+public class UseNode extends CFGNode {
+
+       private SimpleName name;
+
+       UseNode(SimpleName name, int id) {
+               super(id);
+               this.name = name;
+       }
+
+       /**
+        * Get SimpleName of UseNode
+        * @return SimpleName of UseNode
+        */
+       public SimpleName getASTName() {
+               return name;
+       }
+}
diff --git a/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/environment/CatchElement.java b/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/environment/CatchElement.java
new file mode 100644 (file)
index 0000000..05450a1
--- /dev/null
@@ -0,0 +1,66 @@
+/*\r
+ * Program Understanding / Assignment Tracing for JavaScript\r
+ *\r
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyukmin Kwon <hyukmin0530@samsung.com>\r
+ * Woongsik Choi <woongsik76.choi@samsung.com>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.web.assignmenttracing.core.environment;\r
+\r
+import org.eclipse.wst.jsdt.core.dom.TryStatement;\r
+\r
+/**\r
+ * This class represents enclosing catch block.\r
+ *\r
+ * @author Hyukmin Kwon <hyukmin0530@samsung.com>\r
+ */\r
+public class CatchElement extends EnvironmentElement {\r
+       private TryStatement tryStmt = null;\r
+\r
+       /**\r
+        * Constructor\r
+        * @param tryStmt TryStatement ASTNode of corresponding try statement\r
+        */\r
+       public CatchElement(TryStatement tryStmt) {\r
+               this.tryStmt = tryStmt;\r
+       }\r
+\r
+       @Override\r
+       public EnvironmentElement getCopy() {\r
+               CatchElement copy = new CatchElement(getTryStmt());\r
+               return copy;\r
+       }\r
+\r
+       /**\r
+        *\r
+        * @return TryStatement ASTNode of corresponding try statement\r
+        */\r
+       public TryStatement getTryStmt() {\r
+               return tryStmt;\r
+       }\r
+\r
+       /**\r
+        *\r
+        * @return Whether the try statement has finally clause\r
+        */\r
+       public boolean hasFinally() {\r
+               return (tryStmt.getFinally() != null);\r
+       }\r
+}\r
diff --git a/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/environment/EnvironmentElement.java b/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/environment/EnvironmentElement.java
new file mode 100644 (file)
index 0000000..3d18625
--- /dev/null
@@ -0,0 +1,42 @@
+/*\r
+ * Program Understanding / Assignment Tracing for JavaScript\r
+ *\r
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyukmin Kwon <hyukmin0530@samsung.com>\r
+ * Woongsik Choi <woongsik76.choi@samsung.com>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.web.assignmenttracing.core.environment;\r
+\r
+/**\r
+ * This class is an abstract class for enclosing elements such as loop, switch, try,...\r
+ *\r
+ * @author Hyukmin Kwon <hyukmin0530@samsung.com>\r
+ */\r
+abstract public class EnvironmentElement {\r
+       public EnvironmentElement() {\r
+\r
+       }\r
+\r
+       /**\r
+        * Abstract method for EnvironmentElement class.\r
+        * It returns a copy of given EnvironmentElement object.\r
+        * */\r
+       abstract public EnvironmentElement getCopy();\r
+}\r
diff --git a/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/environment/EnvironmentStack.java b/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/environment/EnvironmentStack.java
new file mode 100644 (file)
index 0000000..4cc53cc
--- /dev/null
@@ -0,0 +1,132 @@
+/*\r
+ * Program Understanding / Assignment Tracing for JavaScript\r
+ *\r
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyukmin Kwon <hyukmin0530@samsung.com>\r
+ * Woongsik Choi <woongsik76.choi@samsung.com>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.web.assignmenttracing.core.environment;\r
+\r
+import java.util.Stack;\r
+\r
+/**\r
+ * This class represents enclosing environment as a stack of environment elements.\r
+ *\r
+ * @author Hyukmin Kwon <hyukmin0530@samsung.com>\r
+ */\r
+public class EnvironmentStack {\r
+       private Stack<EnvironmentElement> envStack;\r
+       static public final int LABEL_FOUND = -10;\r
+\r
+       /**\r
+        * Constructor\r
+        */\r
+       public EnvironmentStack() {\r
+               envStack = new Stack<EnvironmentElement>();\r
+       }\r
+\r
+       /**\r
+        * Copy EnvironmentStack from bottom to toIndex.\r
+        * @param toIndex\r
+        * @return Copied EnvironmentStack\r
+        */\r
+       public EnvironmentStack copyEnvironmentFromBottom(int toIndex) {\r
+               EnvironmentStack copy = new EnvironmentStack();\r
+               for (int i = 0; i <= toIndex; i++) {\r
+                       copy.envStack.push(envStack.get(i).getCopy());\r
+               }\r
+               return copy;\r
+       }\r
+\r
+       /**\r
+        *\r
+        * @return size of the environment stack.\r
+        */\r
+       public int size() {\r
+               return envStack.size();\r
+       }\r
+\r
+       /**\r
+        * Returns EnvironmentElement stored in EnvironmentStack at the specified position.\r
+        * @param index\r
+        * @return EnvironmentElement corresponding to the index\r
+        */\r
+       public EnvironmentElement get(int index) {\r
+               return envStack.get(index);\r
+       }\r
+\r
+       /**\r
+        * Get nearest enclosing switch EnvironmentElement.\r
+        * @return SwitchElement\r
+        */\r
+       public SwitchElement getEnclosingSwitch() {\r
+               for (int i = envStack.size() - 1; i >= 0; i--) {\r
+                       EnvironmentElement element = envStack.get(i);\r
+                       if (element instanceof SwitchElement) return (SwitchElement)element;\r
+               }\r
+               return null;\r
+       }\r
+\r
+       /**\r
+        * Check if the EnvironmentElement at the specified position has corresponding label.\r
+        * @param labelName Label name string\r
+        * @param index Index of EnvironmentElement\r
+        * @return Nearest non labeled index from index + 1.\r
+        */\r
+       public int hasCorrespondingLabel(String labelName, int index) {\r
+               int i = index;\r
+               for(; i >= 0 ; i--) {\r
+                       EnvironmentElement element = envStack.get(i);\r
+                       if (element instanceof LabeledStmtElement) {\r
+                               if(((LabeledStmtElement)element).getLabelName().equals(labelName)) {\r
+                                       return LABEL_FOUND;\r
+                               }\r
+                       } else if(i < index) {\r
+                               break;\r
+                       }\r
+               }\r
+               return i + 1;\r
+       }\r
+\r
+       /**\r
+        * Pop EnvironmentStack\r
+        * @return\r
+        */\r
+       public EnvironmentElement pop() {\r
+               return envStack.pop();\r
+       }\r
+\r
+       /**\r
+        * Push EnvironmentStack\r
+        * @param element\r
+        * @return\r
+        */\r
+       public EnvironmentElement push(EnvironmentElement element) {\r
+               return envStack.push(element);\r
+       }\r
+\r
+       /**\r
+        * Peek EnvironmentStack\r
+        * @return\r
+        */\r
+       public EnvironmentElement peek() {\r
+               return envStack.peek();\r
+       }\r
+}\r
diff --git a/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/environment/LabeledStmtElement.java b/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/environment/LabeledStmtElement.java
new file mode 100644 (file)
index 0000000..8ee4528
--- /dev/null
@@ -0,0 +1,69 @@
+/*\r
+ * Program Understanding / Assignment Tracing for JavaScript\r
+ *\r
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyukmin Kwon <hyukmin0530@samsung.com>\r
+ * Woongsik Choi <woongsik76.choi@samsung.com>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.web.assignmenttracing.core.environment;\r
+\r
+import org.tizen.web.assignmenttracing.core.CFGNode;\r
+\r
+/**\r
+ * This class represents enclosing label.\r
+ *\r
+ * @author Hyukmin Kwon <hyukmin0530@samsung.com>\r
+ */\r
+public class LabeledStmtElement extends EnvironmentElement {\r
+       private String labelName = null;\r
+       private CFGNode breakTarget = null;\r
+\r
+       /**\r
+        * Constructor\r
+        * @param labelName Label name string\r
+        * @param breakTarget Break target CFGNode\r
+        */\r
+       public LabeledStmtElement(String labelName, CFGNode breakTarget) {\r
+               this.labelName = labelName;\r
+               this.breakTarget = breakTarget;\r
+       }\r
+\r
+       @Override\r
+       public EnvironmentElement getCopy() {\r
+               LabeledStmtElement copy = new LabeledStmtElement(getLabelName(), breakTarget);\r
+               return copy;\r
+       }\r
+\r
+       /**\r
+        * Returns break target CFGNode\r
+        * @return\r
+        */\r
+       public CFGNode getBreakTarget() {\r
+               return breakTarget;\r
+       }\r
+\r
+       /**\r
+        * Returns label name String\r
+        * @return\r
+        */\r
+       public String getLabelName() {\r
+               return labelName;\r
+       }\r
+}
\ No newline at end of file
diff --git a/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/environment/LoopElement.java b/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/environment/LoopElement.java
new file mode 100644 (file)
index 0000000..701f4ff
--- /dev/null
@@ -0,0 +1,69 @@
+/*\r
+ * Program Understanding / Assignment Tracing for JavaScript\r
+ *\r
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyukmin Kwon <hyukmin0530@samsung.com>\r
+ * Woongsik Choi <woongsik76.choi@samsung.com>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.web.assignmenttracing.core.environment;\r
+\r
+import org.tizen.web.assignmenttracing.core.CFGNode;\r
+\r
+/**\r
+ * This class represents enclosing loop.\r
+ *\r
+ * @author Hyukmin Kwon <hyukmin0530@samsung.com>\r
+ */\r
+public class LoopElement extends EnvironmentElement {\r
+       private CFGNode breakTarget = null;\r
+       private CFGNode continueTarget = null;\r
+\r
+       /**\r
+        * Constructor\r
+        * @param breakTarget Break target CFGNode\r
+        * @param continueTarget Continue target CFGNode\r
+        */\r
+       public LoopElement(CFGNode breakTarget, CFGNode continueTarget) {\r
+               this.breakTarget = breakTarget;\r
+               this.continueTarget = continueTarget;\r
+       }\r
+\r
+       /**\r
+        * Returns break target CFGNode\r
+        * @return\r
+        */\r
+       public CFGNode getBreakTarget() {\r
+               return breakTarget;\r
+       }\r
+\r
+       /**\r
+        * Returns continue target CFGNode\r
+        * @return\r
+        */\r
+       public CFGNode getContinueTarget() {\r
+               return continueTarget;\r
+       }\r
+\r
+       @Override\r
+       public EnvironmentElement getCopy() {\r
+               LoopElement copy = new LoopElement(breakTarget, continueTarget);\r
+               return copy;\r
+       }\r
+}\r
diff --git a/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/environment/NotInterestingElement.java b/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/environment/NotInterestingElement.java
new file mode 100644 (file)
index 0000000..9050217
--- /dev/null
@@ -0,0 +1,41 @@
+/*\r
+ * Program Understanding / Assignment Tracing for JavaScript\r
+ *\r
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyukmin Kwon <hyukmin0530@samsung.com>\r
+ * Woongsik Choi <woongsik76.choi@samsung.com>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.web.assignmenttracing.core.environment;\r
+\r
+/**\r
+ * This class represents non interesting enclosing environment elements such as if,{}.\r
+ * (This environment elements have no intersting features for CFG such as breakTarget,label name...)\r
+ * This EnvironmentElement is introduced for consistency of label finding process.\r
+ */\r
+public class NotInterestingElement extends EnvironmentElement {\r
+       public NotInterestingElement() {\r
+\r
+       }\r
+\r
+       @Override\r
+       public EnvironmentElement getCopy() {\r
+               return new NotInterestingElement();\r
+       }\r
+}\r
diff --git a/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/environment/SwitchElement.java b/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/environment/SwitchElement.java
new file mode 100644 (file)
index 0000000..be16ba4
--- /dev/null
@@ -0,0 +1,97 @@
+/*\r
+ * Program Understanding / Assignment Tracing for JavaScript\r
+ *\r
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyukmin Kwon <hyukmin0530@samsung.com>\r
+ * Woongsik Choi <woongsik76.choi@samsung.com>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.web.assignmenttracing.core.environment;\r
+\r
+import org.tizen.web.assignmenttracing.core.CFGNode;\r
+\r
+/**\r
+ * This class represents enclosing switch.\r
+ *\r
+ * @author Hyukmin Kwon <hyukmin0530@samsung.com>\r
+ */\r
+public class SwitchElement extends EnvironmentElement {\r
+       private CFGNode breakTarget = null;\r
+       private CFGNode prevOfSwitchBody = null;\r
+       private CFGNode prevOfCaseExprChain = null;\r
+       private CFGNode defaultNode = null;\r
+\r
+       /**\r
+        * Constructor\r
+        * @param breakTarget Break target CFGNode\r
+        * @param prevOfSwitchBody Previous CFGNode of switch body\r
+        */\r
+       public SwitchElement(CFGNode breakTarget, CFGNode prevOfSwitchBody) {\r
+               this.breakTarget = breakTarget;\r
+               this.prevOfSwitchBody = prevOfSwitchBody;\r
+       }\r
+\r
+       @Override\r
+       public EnvironmentElement getCopy() {\r
+               SwitchElement copy = new SwitchElement(breakTarget, prevOfSwitchBody);\r
+               copy.setPrevOfCaseExprChain(prevOfCaseExprChain);\r
+               copy.setDefaultNode(defaultNode);\r
+               return copy;\r
+       }\r
+\r
+       /**\r
+        * Returns break target CFGNode\r
+        * @return\r
+        */\r
+       public CFGNode getBreakTarget() {\r
+               return breakTarget;\r
+       }\r
+\r
+       /**\r
+        * Returns previous CFGNode of switch body\r
+        * @return\r
+        */\r
+       public CFGNode getPrevOfCaseExprChain() {\r
+               return prevOfCaseExprChain;\r
+       }\r
+\r
+       /**\r
+        * Set previous CFGNode of switch body\r
+        * @param latestCaseExpr\r
+        */\r
+       public void setPrevOfCaseExprChain(CFGNode latestCaseExpr) {\r
+               this.prevOfCaseExprChain = latestCaseExpr;\r
+       }\r
+\r
+       /**\r
+        * Returns CFGNode of default statement\r
+        * @return\r
+        */\r
+       public CFGNode getDefaultNode() {\r
+               return defaultNode;\r
+       }\r
+\r
+       /**\r
+        * Set CFGNode of default statement\r
+        * @param defaultNode\r
+        */\r
+       public void setDefaultNode(CFGNode defaultNode) {\r
+               this.defaultNode = defaultNode;\r
+       }\r
+}
\ No newline at end of file
diff --git a/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/environment/TryElement.java b/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/environment/TryElement.java
new file mode 100644 (file)
index 0000000..acb1eb6
--- /dev/null
@@ -0,0 +1,78 @@
+/*\r
+ * Program Understanding / Assignment Tracing for JavaScript\r
+ *\r
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyukmin Kwon <hyukmin0530@samsung.com>\r
+ * Woongsik Choi <woongsik76.choi@samsung.com>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.web.assignmenttracing.core.environment;\r
+\r
+import org.eclipse.wst.jsdt.core.dom.TryStatement;\r
+import org.tizen.web.assignmenttracing.core.CFGNode;\r
+\r
+/**\r
+ * This class represents enclosing try block.\r
+ *\r
+ * @author Hyukmin Kwon <hyukmin0530@samsung.com>\r
+ */\r
+public class TryElement extends EnvironmentElement {\r
+       private CFGNode catchBeginNode = null;\r
+       private TryStatement tryStmt = null;\r
+\r
+       /**\r
+        * Constructor\r
+        * @param tryStmt TryStatement ASTNode of corresponding try statement\r
+        * @param catchBeginNode CFGNode representing begin of catch clause\r
+        */\r
+       public TryElement(TryStatement tryStmt, CFGNode catchBeginNode) {\r
+               this.tryStmt = tryStmt;\r
+               this.catchBeginNode = catchBeginNode;\r
+       }\r
+\r
+       @Override\r
+       public EnvironmentElement getCopy() {\r
+               TryElement copy = new TryElement(getTryStmt(), getCatchBeginNode());\r
+               return copy;\r
+       }\r
+\r
+       /**\r
+        * Returns CFGNode representing begin of catch clause\r
+        * @return\r
+        */\r
+       public CFGNode getCatchBeginNode() {\r
+               return catchBeginNode;\r
+       }\r
+\r
+       /**\r
+        * Returns TryStatement ASTNode of corresponding try statement\r
+        * @return\r
+        */\r
+       public TryStatement getTryStmt() {\r
+               return tryStmt;\r
+       }\r
+\r
+       /**\r
+        * Returns whether the try statement has finally clause\r
+        * @return\r
+        */\r
+       public boolean hasFinally() {\r
+               return (tryStmt.getFinally() != null);\r
+       }\r
+}\r
diff --git a/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/exceptions/TracingCancelException.java b/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/exceptions/TracingCancelException.java
new file mode 100644 (file)
index 0000000..f304c7f
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Program Understanding / Assignment Tracing for JavaScript
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Wooyoung Cho <wooyoung1.cho@samsung.com>
+ * Woongsik Choi <woongsik76.choi@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.web.assignmenttracing.core.exceptions;
+
+/**
+ * This exception is thrown when tracing canceling situation is detected via
+ * progress monitor.
+ * @author Wooyoung Cho <wooyoung1.cho@samsung.com>
+ *
+ */
+public class TracingCancelException extends RuntimeException {
+       private static final long serialVersionUID = 3108884062859062414L;
+}
diff --git a/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/exceptions/TracingInternalErrorException.java b/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/exceptions/TracingInternalErrorException.java
new file mode 100644 (file)
index 0000000..70ac24e
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Program Understanding / Assignment Tracing for JavaScript
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Jaeheung Kim <jaeheung.kim@samsung.com>
+ * Woongsik Choi <woongsik76.choi@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.web.assignmenttracing.core.exceptions;
+
+/**
+ * This exception is thrown when AssignmentTracing internal error is occurred.
+ * Internal errors are as follows.
+ * <ul>
+ * <li> unexpected statement is detected while processing createStatement
+ * </ul>
+ * @author Jaeheung Kim <jaeheung.kim@samsung.com>
+ *
+ */
+public class TracingInternalErrorException extends RuntimeException {
+       static final long serialVersionUID = -117692798552616745L;
+}
diff --git a/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/exceptions/TracingUnsupportedException.java b/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/core/exceptions/TracingUnsupportedException.java
new file mode 100644 (file)
index 0000000..f7f87bc
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Program Understanding / Assignment Tracing for JavaScript
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Wooyoung Cho <wooyoung1.cho@samsung.com>
+ * Woongsik Choi <woongsik76.choi@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.web.assignmenttracing.core.exceptions;
+
+/**
+ * This exception is thrown when unsupported JavaScript features are detected while building
+ * control flow graph. Unsupported features are as follows:
+ * <ul>
+ * <li> TODO ...
+ * </ul>
+ * @author Wooyoung Cho <wooyoung1.cho@samsung.com>
+ *
+ */
+public class TracingUnsupportedException extends RuntimeException {
+       private static final long serialVersionUID = 6444357005988592631L;
+}
diff --git a/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/ui/AssignmentTracingUI.java b/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/ui/AssignmentTracingUI.java
new file mode 100644 (file)
index 0000000..59bae74
--- /dev/null
@@ -0,0 +1,863 @@
+/*
+ * Program Understanding / Assignment Tracing for JavaScript
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Wooyoung Cho <wooyoung1.cho@samsung.com>
+ * Woongsik Choi <woongsik76.choi@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.web.assignmenttracing.ui;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IDocumentExtension4;
+import org.eclipse.jface.text.ISynchronizable;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.IAnnotationModel;
+import org.eclipse.jface.text.source.IAnnotationModelExtension;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.FileStoreEditorInput;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.texteditor.AbstractTextEditor;
+import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.wst.jsdt.core.IJavaScriptUnit;
+import org.eclipse.wst.jsdt.core.dom.ASTNode;
+import org.eclipse.wst.jsdt.core.dom.FunctionDeclaration;
+import org.eclipse.wst.jsdt.core.dom.FunctionExpression;
+import org.eclipse.wst.jsdt.core.dom.IBinding;
+import org.eclipse.wst.jsdt.core.dom.IFunctionBinding;
+import org.eclipse.wst.jsdt.core.dom.IVariableBinding;
+import org.eclipse.wst.jsdt.core.dom.JavaScriptUnit;
+import org.eclipse.wst.jsdt.core.dom.SimpleName;
+import org.eclipse.wst.jsdt.internal.core.DefaultWorkingCopyOwner;
+import org.eclipse.wst.jsdt.internal.core.JavaModelManager;
+import org.eclipse.wst.jsdt.internal.corext.dom.NodeFinder;
+import org.eclipse.wst.jsdt.internal.ui.javaeditor.ASTProvider;
+import org.eclipse.wst.jsdt.internal.ui.javaeditor.JavaEditor;
+import org.tizen.web.assignmenttracing.core.CFGBuilder;
+import org.tizen.web.assignmenttracing.core.CFGNode;
+import org.tizen.web.assignmenttracing.core.ChainBuilder;
+import org.tizen.web.assignmenttracing.core.exceptions.TracingCancelException;
+import org.tizen.web.assignmenttracing.core.exceptions.TracingInternalErrorException;
+import org.tizen.web.assignmenttracing.core.exceptions.TracingUnsupportedException;
+
+/**
+ * Main class for Assignment Tracing(aka. def/use chain) fragment and UI.
+ * <p>
+ * Notes:
+ * This class should be used as singleton object by <code>getInstance()</code> method.
+ * Most codes require UI context to run properly.
+ *
+ * @author Wooyoung Cho <wooyoung1.cho@samsung.com>
+ *
+ */
+public class AssignmentTracingUI {
+       /**
+        * Official name of this feature
+        */
+       private static final String ASSIGNMENT_TRACING_NAME = "Assignment Tracing for JavaScript";
+
+       /**
+        *  def annotation type
+        */
+       public static final String DEF_ANNOT_TYPE = "org.tizen.web.assignmenttracing.def";
+       private static final String DEF_ANNOT_MESSAGE = "Assignment Tracing (write)";
+
+       /**
+        * use annotation type
+        */
+       public static final String USE_ANNOT_TYPE = "org.tizen.web.assignmenttracing.use";
+       private static final String USE_ANNOT_MESSAGE = "Assignment Tracing (read)";
+
+       /**
+        * selection annotation type
+        */
+       public static final String SEL_ANNOT_TYPE = "org.tizen.web.assignmenttracing.sel";
+       private static final String SEL_ANNOT_MESSAGE = "Assignment Tracing (selection)";
+
+       /**
+        * Set true for debug mode
+        */
+       public static final boolean DEBUG = false;
+
+       // The singleton instance
+       private static AssignmentTracingUI singleton;
+
+       /**
+        * Def/use annotations applied currently in the current editor
+        */
+       private Annotation[] annotations = null;
+       private IEditorPart currentEditor;
+       private Job currentUpdater;
+
+       private long lastModificationStamp = IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP;
+
+       // working states
+       private boolean isOn = false;
+       private boolean isLoading = true;
+
+       // for Tracing result navigation Mode
+       private boolean navigationMode = false;
+       private List<Position> astNamePositionList = null;
+       private int positionIndex = 0;
+
+       // for debug and statistics
+       private long startCFGBuild, endCFGBuild, startChainBuild;
+       private long endChainBuild, startVisualize, endVisualize;
+       private long nodeCount;
+
+       /**
+        *  The listener we register with the selection service.
+        *  When a text is selected, process du-chain for the selection.
+        */
+       private ISelectionListener listener = new ISelectionListener() {
+               public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+                       // if other than editor is selected, ignore.
+                       if (!(part instanceof IEditorPart)) {
+                               return;
+                       }
+                       msg("selected");
+
+                       if (currentEditor == null) return;
+                       // currentEditor is always JS editor and set before selection event is fired.
+                       // Thus if currentEditor doesn't equal to part, it's not a JS editor.
+                       if (!currentEditor.equals(part)) {
+                               return;
+                       }
+
+                       // Only consider text selections
+                       if (selection instanceof ITextSelection) {
+                               showDUSelection((ITextSelection) selection);
+                       } else {
+                               removeAllAnnotations();
+                       }
+               }
+       };
+
+       /**
+        * Does not allow to create instance by other class.
+        */
+       private AssignmentTracingUI() {
+       }
+
+       /**
+        * Returns the singleton instance
+        *
+        * @return the singleton instance
+        */
+       public static AssignmentTracingUI getInstance() {
+               if (singleton == null)
+                       singleton = new AssignmentTracingUI();
+               return singleton;
+       }
+
+       private JavaEditor getActiveJavaEditor() {
+               IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+                               .getActiveEditor();
+               if (editor instanceof JavaEditor) {
+                       return (JavaEditor) editor;
+               } else {
+                       return null;
+               }
+       }
+
+       /**
+        * Installs duchain annotation updater. Add selection listener.
+        */
+       private void installUpdater() {
+               IWorkbench wb = PlatformUI.getWorkbench();
+               IWorkbenchWindow wbw = wb.getActiveWorkbenchWindow();
+               ISelectionService ss = wbw.getSelectionService();
+               ss.addPostSelectionListener(listener);
+       }
+
+       /**
+        * Uninstalls duchain annotation updater. Remove selection listener.
+        */
+       public void uninstallUpdater() {
+               IWorkbenchWindow ww = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+               // if eclipse is not exiting.
+               if (ww != null) {
+                       ww.getSelectionService().removePostSelectionListener(listener);
+               }
+       }
+
+       /**
+        *  Move cursor to the next occurrence
+        */
+       public void moveNext() {
+               if (astNamePositionList != null) {
+                       navigationMode = true;
+                       int listSize = astNamePositionList.size();
+                       positionIndex++;
+                       if (positionIndex >= listSize) {
+                               positionIndex = 0;
+                       } else {
+                               // check if duplicated offsets are exist
+                               while (astNamePositionList.get(positionIndex).getOffset() == astNamePositionList.get(
+                                               positionIndex - 1).getOffset()) {
+                                       positionIndex++;
+                                       if (positionIndex >= listSize) {
+                                               positionIndex = 0;
+                                               break;
+                                       }
+                               }
+                       }
+                       Position pos = astNamePositionList.get(positionIndex);
+                       getActiveJavaEditor().selectAndReveal(pos.getOffset(), pos.getLength());
+               }
+       }
+
+       /**
+        *  Move cursor to the previous occurrence
+        */
+       public void movePrevious() {
+               if (astNamePositionList != null) {
+                       navigationMode = true;
+                       int listSize = astNamePositionList.size();
+                       positionIndex--;
+                       if (positionIndex < 0) {
+                               positionIndex = listSize - 1;
+                       } else {
+                               // check if duplicated offsets are exist
+                               while (astNamePositionList.get(positionIndex).getOffset() == astNamePositionList.get(
+                                               positionIndex + 1).getOffset()) {
+                                       positionIndex--;
+                                       if (positionIndex < 0) {
+                                               positionIndex = listSize - 1;
+                                               break;
+                                       }
+                               }
+                       }
+                       Position pos = astNamePositionList.get(positionIndex);
+                       getActiveJavaEditor().selectAndReveal(pos.getOffset(), pos.getLength());
+               }
+       }
+
+       /**
+        * Check if the selection and the navigation variable's offset and length are equal or not.
+        * @param selection text selection
+        * @return <code>true</code> if both are equal
+        */
+       private boolean isNavigationModeSelection(ITextSelection selection) {
+               if (astNamePositionList != null) {
+                       Position pos = astNamePositionList.get(positionIndex);
+                       if ((pos.getOffset() == selection.getOffset()) &&
+                                       (pos.getLength() == selection.getLength())) {
+                               return true;
+                       }
+               }
+               return false;
+       }
+
+       /**
+        * Creates and schedules a job which actually analyzes and visualizes the result.
+        * If there is no working copy of the file, ignore it.
+        * If an older job is not finished, cancel it. Then the older job will be finished as soon as
+        * it recognizes the cancellation and new job will be executed.
+        * This job analyzes code and saves selected name and def-use information in member fields
+        * and other methods can use them.
+        *
+        * @param selection a text selection that start to analyze
+        */
+       public void showDUSelection(final ITextSelection selection) {
+               // ignore selection occurred by navigation operations
+               if (navigationMode && isNavigationModeSelection(selection)) {
+                       navigationMode = false;
+                       return;
+               }
+               navigationMode = false;
+
+               lastModificationStamp = getCurrentModificationStamp();
+
+               final IJavaScriptUnit jsUnit = getCurrentJavaScriptUnit();
+               if (jsUnit == null) {
+                       msg("no file or translation unit");
+                       return;
+               }
+               
+               Job job = new Job(ASSIGNMENT_TRACING_NAME) {
+                       private IProgressMonitor cancelMonitor = new NullProgressMonitor();
+
+                       protected void canceling() {
+                               msg("canceling " + this);
+                               cancelMonitor.setCanceled(true);
+                       }
+
+                       public IStatus run(IProgressMonitor monitor) {
+                               msg("start " + this);
+                               if (cancelMonitor.isCanceled()) {
+                                       return Status.CANCEL_STATUS;
+                               }
+
+                               // synchronize among updater jobs
+                               synchronized (AssignmentTracingUI.this) {
+                                       JavaScriptUnit ast = ASTProvider.getASTProvider().getAST(jsUnit, 
+                                                       ASTProvider.WAIT_ACTIVE_ONLY,
+                                                       new NullProgressMonitor());
+                                       if (ast == null) {
+                                               msg("no ast");
+                                               return Status.CANCEL_STATUS;
+                                       }
+
+                                       // initialize astNamePositionList to NULL not to move cursor
+                                       // using Ctrl + '[', ']'
+                                       astNamePositionList = null;
+
+                                       // find SimpleName for the given selection
+                                       SimpleName name = findEnclosingName(
+                                                       ast, selection.getOffset(), selection.getLength());
+                                       if (name == null) {
+                                               msg("Cannot find enclosing name");
+                                               removeAllAnnotations();
+                                               return Status.CANCEL_STATUS;
+                                       }
+                                       msg("selected node: " + name);
+                                       if (cancelMonitor.isCanceled()) {
+                                               return Status.CANCEL_STATUS;
+                                       }
+
+                                       FunctionDeclaration func = getEnclosingFunc(name);
+                                       // if name is not in function definition
+                                       if (func == null) {
+                                               return Status.CANCEL_STATUS;
+                                       }
+                                       msg("selected function: " + func);
+
+                                       if (!isInteresting(name, func)) {
+                                               msg("not interesting");
+                                               removeAllAnnotations();
+                                               return Status.CANCEL_STATUS;
+                                       }
+
+                                       if (cancelMonitor.isCanceled()) {
+                                               return Status.CANCEL_STATUS;
+                                       }
+
+                                       // build CFG
+                                       if (DEBUG) startCFGBuild = System.nanoTime();
+                                       CFGBuilder cfgBuilder = new CFGBuilder(cancelMonitor);
+                                       List<CFGNode> cfgNodes;
+                                       try {
+                                               cfgNodes = cfgBuilder.buildCFG(func, name);
+                                               cfgBuilder.checkReachability();
+                                       } catch (TracingCancelException re) {
+                                               return Status.CANCEL_STATUS;
+                                       } catch (TracingUnsupportedException re) {
+                                               // when unsupported features are found,
+                                               // remove all annotations and cancel the process.
+                                               removeAllAnnotations();
+                                               return Status.CANCEL_STATUS;
+                                       } catch (TracingInternalErrorException re) {
+                                               return Status.CANCEL_STATUS;
+                                       }
+                                       if (DEBUG) endCFGBuild = System.nanoTime();
+                                       if (DEBUG) nodeCount = cfgBuilder.getNodeCount();
+
+                                       if (cancelMonitor.isCanceled()) {
+                                               return Status.CANCEL_STATUS;
+                                       }
+
+                                       // build DU-chain
+                                       if (DEBUG) startChainBuild = System.nanoTime();
+                                       ChainBuilder chainBuilder = new ChainBuilder();
+                                       try {
+                                               chainBuilder.buildChain(cfgNodes, cfgBuilder.getNodeCount());
+                                       } catch (TracingUnsupportedException re) {
+                                               // when unsupported features are found,
+                                               // remove all annotations and cancel the process.
+                                               removeAllAnnotations();
+                                               return Status.CANCEL_STATUS;
+                                       }                                               
+                                       if (DEBUG) endChainBuild = System.nanoTime();
+
+                                       if (cancelMonitor.isCanceled()) {
+                                               return Status.CANCEL_STATUS;
+                                       }
+
+                                       // visualize
+                                       if (DEBUG) startVisualize = System.nanoTime();
+                                       IStatus status = visualizeDUChain(chainBuilder, name, cancelMonitor);
+                                       if (DEBUG) endVisualize = System.nanoTime();
+
+                                       keepNamePositions(name, chainBuilder);
+
+                                       if (status.isOK()) {
+                                               if (DEBUG) {
+                                                       printStat();
+                                               }
+                                       } else {
+                                               return status;
+                                       }
+
+                                       return Status.OK_STATUS;
+                               }
+                       }
+               };
+
+               // if last updater is not finished, cancel it
+               if (currentUpdater != null && currentUpdater.getResult() == null) {
+                       currentUpdater.cancel();
+               }
+
+               currentUpdater = job;
+
+               // Assignment Tracing runs very fast and frequently.
+               // So, prevent showing each running status by setting it as a system job.
+               job.setSystem(true);
+
+               job.schedule();
+       }
+
+       private static final Comparator<Position> positionComparator = new Comparator<Position>() {
+               public int compare(Position arg0, Position arg1) {
+                       return arg0.getOffset() - arg1.getOffset();
+               }
+       };
+
+       /**
+        * Keeps positions of the selected name and use/def names for navigating (Ctrl+[,])
+        * @param selectedName selected name
+        * @param chainBuilder chain builder for retrieving use/def chains
+        */
+       private void keepNamePositions(SimpleName selectedName, ChainBuilder chainBuilder) {
+               astNamePositionList = new ArrayList<Position>();
+
+               // add position of selected name to astNamePositionList
+               astNamePositionList.add(new Position(
+                               selectedName.getStartPosition(), selectedName.getLength()));
+
+               for (SimpleName astName : chainBuilder.getDUChain()) {
+                       // add all positions of DUChain to astNamePositionList
+                       astNamePositionList.add(
+                                       new Position(astName.getStartPosition(), astName.getLength()));
+               }
+
+               for (SimpleName astName : chainBuilder.getUDChain()) {
+                       // add all positions of UDChain to astNamePositionList
+                       astNamePositionList.add(
+                                       new Position(astName.getStartPosition(), astName.getLength()));
+               }
+
+               // Sort astNamePositionList in ascending-order using position offset.
+               Collections.sort(astNamePositionList, positionComparator);
+
+               // Initialize positionIndex to properly move cursor
+               // to previous or next DUChain occurrence.
+               positionIndex = 0;
+               for (Position pos : astNamePositionList) {
+                       if (selectedName.getStartPosition() == pos.getOffset()) {
+                               break;
+                       }
+                       positionIndex++;
+               }
+       }
+
+       /**
+        * Finds the enclosing name of given range from AST
+        * @param ast
+        * @param offset
+        * @param length
+        * @return <code>SimpleName</code> if found. <code>null</code> otherwise.
+        */
+       public static SimpleName findEnclosingName(JavaScriptUnit ast, int offset, int length) {
+               ASTNode node = NodeFinder.perform(ast, offset, length);
+               if (node instanceof SimpleName) {
+                       return (SimpleName) node;
+               } else {
+                       return null;
+               }
+       }
+
+       /**
+        * @return javascript unit of the current editor. <code>null</code> if not found.
+        */
+       private IJavaScriptUnit getCurrentJavaScriptUnit() {
+               if (currentEditor == null) {
+                       return null;
+               }
+
+               IEditorInput input = currentEditor.getEditorInput();
+               // if no input
+               if (input == null) {
+                       return null;
+               }
+
+               URI uri;
+               if (input instanceof FileEditorInput) {
+                       // if file in workspace
+                       uri = ((FileEditorInput) input).getFile().getRawLocationURI();
+               } else if (input instanceof FileStoreEditorInput) {
+                       // if file not in workspace
+                       uri = ((FileStoreEditorInput) input).getURI();
+               } else {
+                       // shouldn't be reached here
+                       return null;
+               }
+               IJavaScriptUnit wc = getWorkingCopy(uri);
+
+               if (wc == null) {
+                       msg("No Working Copy");
+                       return null;
+               }
+               return wc;
+       }
+
+       /**
+        * Find javascript unit of given URI
+        * @param uri File URI
+        * @return javascript unit for the URI
+        */
+       private IJavaScriptUnit getWorkingCopy(URI uri) {
+               JavaModelManager manager = JavaModelManager.getJavaModelManager();
+               IJavaScriptUnit[] workingCopies = manager.getWorkingCopies(
+                               DefaultWorkingCopyOwner.PRIMARY, false);
+               for (IJavaScriptUnit wc : workingCopies) {
+                       URI wcURI = wc.getResource().getLocationURI();
+                       if (wcURI.equals(uri)) {
+                               return wc;
+                       }
+               }
+               return null;
+       }
+
+       /**
+        * Check if a name can be analyzed. Namely, local variable or function
+        *      declared in the given function.
+        * @param name name to be checked
+        * @param func enclosing function of the name
+        * @return true if name is analyzable, false otherwise
+        */
+       public static boolean isInteresting(SimpleName name, FunctionDeclaration func) {
+               IBinding binding = name.resolveBinding();
+               IFunctionBinding funcBinding;
+               IFunctionBinding enclosingFuncBinding;
+               if (binding instanceof IVariableBinding) {
+                       funcBinding = ((IVariableBinding) binding).getDeclaringMethod();
+               } else {
+                       msg("not variable binding: " + binding);
+                       return false;
+               }
+               enclosingFuncBinding = func.resolveBinding();
+               if (enclosingFuncBinding == null) {
+                       msg("enclosing function binding is null");
+                       return false;
+               } else if (enclosingFuncBinding.isEqualTo(funcBinding)) {
+                       return true;
+               } else {
+                       msg("not enclosing local");
+                       return false;
+               }
+
+       }
+
+       /**
+        * Return enclosing function declaration of given name
+        * @param name
+        * @return If given name is in a function declaration, return the function declaration.
+        *                      Otherwise, return null.
+        */
+       public static FunctionDeclaration getEnclosingFunc(SimpleName name) {
+               ASTNode n = name;
+               // Find enclosing function definition
+               while (!((n instanceof FunctionDeclaration) || (n instanceof FunctionExpression))) {
+                       if (n == null) {
+                               return null;
+                       }
+                       n = n.getParent();
+               }
+               if (n instanceof FunctionDeclaration) {
+                       return (FunctionDeclaration) n;
+               } else if (n instanceof FunctionExpression) {
+                       return ((FunctionExpression) n).getMethod();
+               }
+               return null;
+       }
+
+       /**
+        * Visualize Def-Use Chain information using annotation mechanism of the editor.
+        * @param chainBuilder Chain builder that already built the chain information
+        * @param selectedName ast node of the selection
+        * @param cancelMonitor monitor
+        */
+       private IStatus visualizeDUChain(
+                       ChainBuilder chainBuilder, SimpleName selectedName, IProgressMonitor cancelMonitor) {
+               Set<SimpleName> uses = chainBuilder.getDUChain();
+               Set<SimpleName> defs = chainBuilder.getUDChain();
+               int length = uses.size() + defs.size();
+
+               if (!(currentEditor instanceof AbstractTextEditor)) {
+                       return Status.CANCEL_STATUS;
+               }
+
+               AbstractTextEditor editor = (AbstractTextEditor) currentEditor;
+               IDocumentProvider documentProvider = editor.getDocumentProvider();
+               if (documentProvider == null) {
+                       return Status.CANCEL_STATUS;
+               }
+
+               IAnnotationModel annotationModel =
+                               documentProvider.getAnnotationModel(editor.getEditorInput());
+               if (annotationModel == null) {
+                       return Status.CANCEL_STATUS;
+               }
+
+               Map<Annotation, Position> annotationMap = new HashMap<Annotation, Position>(length);
+
+               for (SimpleName use : uses) {
+                       Position position = new Position(use.getStartPosition(), use.getLength());
+                       Annotation an = new Annotation(USE_ANNOT_TYPE, false, new String(USE_ANNOT_MESSAGE));
+                       annotationMap.put(an, position);
+               }
+               for (SimpleName def : defs) {
+                       Position position = new Position(def.getStartPosition(), def.getLength());
+                       Annotation an = new Annotation(DEF_ANNOT_TYPE, false, new String(DEF_ANNOT_MESSAGE));
+                       annotationMap.put(an, position);
+               }
+               Position position = new Position(selectedName.getStartPosition(), selectedName.getLength());
+               Annotation an = new Annotation(SEL_ANNOT_TYPE, false, new String(SEL_ANNOT_MESSAGE));
+               annotationMap.put(an, position);
+
+               synchronized (getLockObject(annotationModel)) {
+                       // check code change
+                       long currentModificationStamp = getCurrentModificationStamp();
+
+                       // If canceled by UI thread, cancel it. If not canceled,
+                       // currentModificationStamp is valid.
+                       if (cancelMonitor.isCanceled()) {
+                               return Status.CANCEL_STATUS;
+                       }
+
+                       if (lastModificationStamp != IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP &&
+                                       currentModificationStamp != lastModificationStamp) {
+                               msg("code changed");
+                               return Status.CANCEL_STATUS;
+                       }
+                       // use replaceAnnotations() if available because it's faster
+                       if (annotationModel instanceof IAnnotationModelExtension) {
+                               ((IAnnotationModelExtension) annotationModel).replaceAnnotations(
+                                               annotations, annotationMap);
+                       } else {
+                               removeAllAnnotations();
+                               Iterator<Map.Entry<Annotation, Position>> iter =
+                                               annotationMap.entrySet().iterator();
+                               while (iter.hasNext()) {
+                                       Map.Entry<Annotation, Position> mapEntry = iter.next();
+                                       annotationModel.addAnnotation(mapEntry.getKey(), mapEntry.getValue());
+                               }
+                       }
+                       annotations = annotationMap.keySet().toArray(
+                                       new Annotation[annotationMap.keySet().size()]);
+               }
+               return Status.OK_STATUS;
+       }
+
+       /**
+        * @param annotationModel
+        * @return Lock object for concurrently accessing the given annotation model
+        */
+       private Object getLockObject(IAnnotationModel annotationModel) {
+               if (annotationModel instanceof ISynchronizable) {
+                       Object lock = ((ISynchronizable) annotationModel).getLockObject();
+                       if (lock != null) {
+                               return lock;
+                       }
+               }
+               return annotationModel;
+       }
+
+       /**
+        * @return current modification stamp of the document in the current editor
+        */
+       private long getCurrentModificationStamp() {
+               try {
+                       AbstractTextEditor editor = (AbstractTextEditor) currentEditor;
+                       IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
+                       return ((IDocumentExtension4) document).getModificationStamp();
+               } catch (NullPointerException e) {
+                       return IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP;
+               }
+       }
+
+       /**
+        * Remove all annotations.
+        */
+       private void removeAllAnnotations() {
+               if (currentEditor == null) {
+                       return;
+               }
+               if (annotations == null) {
+                       return;
+               }
+
+               IDocumentProvider documentProvider =
+                               ((AbstractTextEditor) currentEditor).getDocumentProvider();
+               if (documentProvider == null) {
+                       return;
+               }
+               IAnnotationModel annotationModel =
+                               documentProvider.getAnnotationModel(currentEditor.getEditorInput());
+               if (annotationModel == null) {
+                       return;
+               }
+
+               synchronized (getLockObject(annotationModel)) {
+                       // return if annotations is changed to null by UI thread
+                       if (annotations == null) return;
+                       if (annotationModel instanceof IAnnotationModelExtension) {
+                               ((IAnnotationModelExtension) annotationModel).replaceAnnotations(annotations, null);
+                       } else {
+                               for (Annotation an : annotations) {
+                                       annotationModel.removeAnnotation(an);
+                               }
+                       }
+                       annotations = null;
+               }
+       }
+
+       /**
+        * @return <code>true</code> if assignment tracing is on
+        */
+       public boolean isOn() {
+               return isOn;
+       }
+
+       /**
+        * Turns on and off assignment tracing feature.
+        * If trying to set same state, do nothing.
+        * If off to on, install the selection listener for as-you-type mechanism and run analysis
+        * for the currently selected selection.
+        * If on to off, uninstall the listener and remove all visualizations.
+        * @param turnOn
+        */
+       public void setOn(boolean turnOn) {
+               if (isOn == turnOn) {
+                       return;
+               }
+               if (turnOn) {
+                       installUpdater();
+                       if (currentEditor != null && currentEditor instanceof ITextEditor) {
+                               IEditorInput input = currentEditor.getEditorInput();
+                               if (input instanceof IFileEditorInput) {
+                                       ISelectionProvider sp =
+                                                       ((ITextEditor) currentEditor).getSelectionProvider();
+                                       ISelection sel = sp.getSelection();
+                                       if (sel instanceof ITextSelection) {
+                                               ITextSelection ts = (ITextSelection) sel;
+                                               showDUSelection(ts);
+                                       }
+                               }
+                       }
+                       isOn = true;
+               } else {
+                       uninstallUpdater();
+                       removeAllAnnotations();
+                       isOn = false;
+               }
+       }
+
+       /**
+        * Sets the currently selected editor in which assignment tracing runs.
+        * If the editor is showing JS file, turn on assignment tracing.
+        * If not, disable the action.
+        * @param action action
+        * @param editorPart
+        */
+       public void setEditor(IAction action, IEditorPart editorPart) {
+               // when active editor(JS editor) is changed, cancel the updater,
+               // remove annotations in older editor, and set new editor.
+               if (currentUpdater != null && currentUpdater.getResult() == null) {
+                       currentUpdater.cancel();
+               }
+               removeAllAnnotations();
+               currentEditor = editorPart;
+
+               IJavaScriptUnit tu = getCurrentJavaScriptUnit();
+               if (tu == null) {
+                       action.setEnabled(false);
+                       setOn(false);
+               } else {
+                       action.setEnabled(true);
+                       setOn(true);
+               }
+       }
+
+       /**
+        * @return <code>true</code> if no JS editor is selected ever since start.
+        */
+       public boolean isLoading() {
+               return isLoading;
+       }
+
+       /**
+        * Sets that one JS editor is selected at least once.
+        */
+       public void setLoaded() {
+               this.isLoading = false;
+       }
+
+       /**
+        * Prints a message for debugging
+        * @param msg
+        */
+       static void msg(String msg) {
+               if (DEBUG) {
+                       System.out.println(msg);
+               }
+       }
+
+       /**
+        * Print statistics
+        */
+       protected void printStat() {
+               msg("CFG " + ((endCFGBuild - startCFGBuild) / 1000000.0f) + "ms, " +
+                               "Chain " + ((endChainBuild - startChainBuild) / 1000000.0f) + "ms, " +
+                               "Visualize " + ((endVisualize - startVisualize) / 1000000.0f) + "ms, " +
+                               "#Nodes " + nodeCount);
+       }
+
+}
diff --git a/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/ui/TracingActionDelegate.java b/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/ui/TracingActionDelegate.java
new file mode 100644 (file)
index 0000000..5ab6eeb
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Program Understanding / Assignment Tracing for JavaScript
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Wooyoung Cho <wooyoung1.cho@samsung.com>
+ * Woongsik Choi <woongsik76.choi@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.web.assignmenttracing.ui;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IEditorActionDelegate;
+import org.eclipse.ui.IEditorPart;
+
+/**
+ * Action Delegate for Assignment Tracing action 
+ * @author Wooyoung Cho <wooyoung1.cho@samsung.com>
+ *
+ */
+public class TracingActionDelegate implements IEditorActionDelegate {
+       /**
+        * turn on/off assignment tracing when button is clicked.
+        */
+       public void run(IAction action) {
+               AssignmentTracingUI.msg("TracingActionDelegate run");
+               // when button is pressed, apply the event to plugin.
+               AssignmentTracingUI p = AssignmentTracingUI.getInstance();
+               p.setOn(!p.isOn());
+       }
+
+       public void selectionChanged(IAction action, ISelection selection) {
+               // ignore
+       }
+
+       /**
+        * When active editor is changed, set the editor as current.
+        */
+       public void setActiveEditor(IAction action, IEditorPart targetEditor) {
+               AssignmentTracingUI.msg("TracingActionDelegate set active editor");
+               AssignmentTracingUI p = AssignmentTracingUI.getInstance();
+               if (p.isLoading()) {
+                       p.setOn(true);
+                       p.setLoaded();
+               }
+               if (p.isOn()) {
+                       action.setChecked(true);
+               } else {
+                       action.setChecked(false);
+               }
+
+               p.setEditor(action, targetEditor);
+       }
+}
diff --git a/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/ui/TracingCommandHandler.java b/org.tizen.web.assignmenttracing/src/org/tizen/web/assignmenttracing/ui/TracingCommandHandler.java
new file mode 100644 (file)
index 0000000..1f74091
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Program Understanding / Assignment Tracing for JavaScript
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Wooyoung Cho <wooyoung1.cho@samsung.com>
+ * Woongsik Choi <woongsik76.choi@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.web.assignmenttracing.ui;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+
+/**
+ * Handler for shortcut keys. This is called when a shortcut key is pressed and move the cursor
+ * to previous or next location according to the event type.
+ * @author Jaeheung Kim <jaeheung.kim@samsung.com>
+ *
+ */
+public class TracingCommandHandler extends AbstractHandler {
+
+       public Object execute(ExecutionEvent event) throws ExecutionException {
+               if (event.getCommand().getId().equals(
+                               "org.tizen.web.assignmenttracing.moveprevious")) {
+                       AssignmentTracingUI.getInstance().movePrevious();
+               } else {
+                       AssignmentTracingUI.getInstance().moveNext();
+               }
+               return null;
+       }
+}
\ No newline at end of file
diff --git a/package/build.linux b/package/build.linux
new file mode 100644 (file)
index 0000000..c0a3fb3
--- /dev/null
@@ -0,0 +1,301 @@
+#!/bin/bash -xe
+
+build_path=${SRCDIR}/build_result
+
+__set_parameter()
+{
+    build_id=${package_name}
+    build_type=N
+    build_result_directory=${build_type}.${build_id}
+    build_result_path="$build_path/$build_result_directory"
+    architecture=x86
+    ide_root_path_name=ide
+
+    case ${platform} in
+        ubuntu-32|ubuntu-64)
+            archive_platform_name=linux
+            windowing=gtk
+            ;;
+        windows-32|windows-64)
+            archive_platform_name=win32
+            windowing=win32
+            ;;
+        macos-64)
+            archive_platform_name=macosx
+            windowing=cocoa
+            architecture=x86_64
+            ;;
+        *)
+            echo "${platform} is not support yet."
+            ;;
+    esac
+
+    result_archive_file=${build_id}-${archive_platform_name}.${windowing}.${architecture}.zip
+}
+
+__set_build_parameter()
+{
+    case ${platform} in
+        ubuntu-32|ubuntu-64)
+            reference_ide_path=${ROOTDIR}/indigo-pde/eclipse
+            ;;
+        windows-32|windows-64)
+            reference_ide_path=${ROOTDIR}/indigo-winpde/eclipse
+            ;;
+        macos-64)
+            reference_ide_path=${ROOTDIR}/indigo-macpde/eclipse
+            ;;
+        *)
+            echo "${platform} is not support yet."
+            ;;
+    esac
+}
+
+__set_install_parameter()
+{
+    INSTALL_DIR=${SRCDIR}/package/${package_name}.package.${platform}/data
+}
+
+__clean_build_environment()
+{
+    if [ -d $build_path ]
+    then
+        echo "Build result directory : [$build_path]"
+    else
+        echo "Make build result directory [$build_path]"
+        mkdir -p $build_path
+    fi
+
+    echo "Remove legacy build files..."
+    if [ -d ${build_result_path}/${archive_platform_name}.${windowing}.${architecture} ]
+    then
+        rm -rf ${build_result_path}/${archive_platform_name}.${windowing}.${architecture}
+    fi
+    if [ -e ${build_result_path}/${result_archive_file} ]
+    then
+        rm -rf ${build_result_path}/${result_archive_file}
+    fi
+    if [ -d ${build_path}/tmp ]
+    then
+        rm -rf ${build_path}/tmp
+    fi
+
+    if [ -d ${build_path}/buildRepo ]
+    then
+        rm -rf ${build_path}/buildRepo
+    fi
+
+    rm -rf ${build_path}/*.xml
+    rm -rf ${build_path}/*.properties
+    rm -rf ${build_path}/*.clean
+
+
+    if [ -d $build_path/plugins ]
+    then
+        echo "plugins directory recreate..."
+        rm -rf $build_path/plugins
+        mkdir $build_path/plugins
+    else
+        echo "Make plugins directory..."
+        mkdir $build_path/plugins
+    fi
+    if [ -d $build_path/features/ ]
+    then
+        echo "features directory recreate..."
+        rm -rf $build_path/features
+        mkdir $build_path/features
+    else
+        echo "Make features directory..."
+        mkdir $build_path/features
+    fi
+
+}
+
+__copy_build_sources()
+{
+    echo "Copy features from $SRCDIR to $build_path/features"
+    temp_dir="`mktemp -d /tmp/ide.XXXXX`"
+    cp -r $SRCDIR/* $temp_dir
+    cp -r $temp_dir/* $build_path/features
+    rm -rf $temp_dir
+
+    echo "Copy plugins from $SRCDIR to $build_path/plugins"
+    temp_dir="`mktemp -d /tmp/ide.XXXXX`"
+    cp -r $SRCDIR/* $temp_dir
+    cp -r $temp_dir/* $build_path/plugins
+    rm -rf $temp_dir
+}
+
+__copy_dependency_plugins()
+{
+    dependency_plugin_path=${ROOTDIR}/${ide_root_path_name}
+    if [ -d ${dependency_plugin_path} ]
+    then
+        cp -rf ${dependency_plugin_path}/features/* ${build_path}/features/
+        cp -rf ${dependency_plugin_path}/plugins/* ${build_path}/plugins/
+    fi
+}
+
+__make_ant_build_properties_file()
+{
+    builder_path="${SRCDIR}/builder"
+    parent_path_of_based_eclipse=${reference_ide_path}/..
+
+    echo "Make build.properties file..."
+    if [ ! -e $builder_path/build.properties.clean ] ; then
+        echo "ERROR : \"build.properties.clean\" file does not exist..."
+        exit 1
+    fi
+    cp $builder_path/build.properties.clean $build_path
+    cp $builder_path/customTargets.xml $build_path
+
+    if [ -d $reference_ide_path ] 
+    then
+        sed -e "s;\(^buildDirectory=\).*;\1${build_path};g" \
+        -e "s;\(^base=\).*;\1${parent_path_of_based_eclipse};g" \
+        -e "s;\(^baseLocation=\).*;\1${reference_ide_path};g" \
+        -e "s;\(^configs=\).*;\1${archive_platform_name},${windowing},${architecture};g" \
+        -e "s;\(^buildType=\).*;\1${build_type};g" \
+        -e "s;\(^buildId=\).*;\1${build_id};g" \
+        -e "s;\(^archivePrefix=\).*;\1${build_id};g" \
+        < $build_path/build.properties.clean > $build_path/build.properties
+
+    else
+        echo "ERROR : target eclipse is not exist."
+        exit 1
+    fi
+}
+
+__execute_pde_build()
+{
+    echo "Execute Product Ant Builder..."
+    equinox_launcher=`echo org.eclipse.equinox.launcher_*.jar`
+    pde_build=`echo org.eclipse.pde.build_*`
+
+    java -jar ${reference_ide_path}/plugins/$equinox_launcher -application org.eclipse.ant.core.antRunner -buildfile ${reference_ide_path}/plugins/$pde_build/scripts/productBuild/productBuild.xml -Dbuilder=$build_path -Dosgi.locking=none 2>&1
+
+    if [ $? != 0 ];
+    then
+        echo "Build failed..."
+        exit 1
+    fi
+}
+
+__unzip_plugin_pack()
+{
+    echo "unzip to $build_result_path"
+    unzip -a $build_result_path/${result_archive_file} -d $build_result_path/${archive_platform_name}.${windowing}.${architecture}
+}
+
+build_plugins()
+{
+    case ${platform} in
+        ubuntu-32|ubuntu-64|windows-32|windows-64|macos-64)
+            echo "build plugin for ${platform}"
+            ;;
+        *)
+            echo "${platform} is not support yet."
+            exit 1
+            ;;
+    esac
+
+    __set_parameter
+    __set_build_parameter
+    __clean_build_environment
+    __copy_build_sources
+    __copy_dependency_plugins
+    __make_ant_build_properties_file
+    __execute_pde_build
+    __unzip_plugin_pack
+
+    echo "Build SUCCESS. You will find SDK IDE in \"${build_result_path}\"."
+}
+
+__clean_packaging_environment()
+{
+
+    if [ -d ${INSTALL_DIR} ]
+    then
+        rm -rf ${INSTALL_DIR}
+    else
+        mkdir -p ${INSTALL_DIR}
+    fi
+}
+
+__copy_necessary_binaries()
+{
+    echo "add necessary files."
+    ## ex) cp -rf ~~~~/file.file ${INSTALL_DIR}/${ide_root_path_name}/
+}
+
+packaging_plugins()
+{
+    __set_parameter
+    __set_install_parameter
+
+    __clean_packaging_environment
+    __copy_necessary_binaries
+
+    install_ide_path=${INSTALL_DIR}/${ide_root_path_name}
+    
+    if [ ! -d ${install_ide_path} ]
+    then
+        mkdir -p ${install_ide_path}
+    fi
+
+    cp -rf ${build_result_path}/${archive_platform_name}.${windowing}.${architecture}/${package_name}/* ${install_ide_path}/
+}
+
+# clean
+clean()
+{
+    echo "=========================================CLEAN============================================"
+    rm -rf ${SRCDIR}/*.zip
+    rm -rf ${SRCDIR}/*.tar.gz
+    rm -rf ${build_path}
+}
+
+# build
+build() 
+{
+    echo "=========================================BUILD============================================"
+    pkgname_and_platform_list=`awk 'BEGIN{RS="\n\n"; FS="\n"} /Package:/{for(i=1;i<NF;i++){if($i ~ /^OS:/){print $1,$i}}}' ${SRCDIR}/package/pkginfo.manifest | tr ' ' '@'`
+    for pkgname_and_platform in ${pkgname_and_platform_list}
+    do
+        pkgname_and_platform=`echo $pkgname_and_platform | tr '@' ' '`
+        package_name=`echo ${pkgname_and_platform} | cut -f1 -d " " | cut -f2 -d ":"`
+        platform=`echo ${pkgname_and_platform} | cut -f2 -d " " | cut -f2 -d ":"`
+    
+        if [ "x${TARGET_OS}" = "x${platform}" ]
+        then
+            build_plugins
+        else
+            echo ""
+        fi
+    done
+}
+
+# install
+install() 
+{
+    pkgname_and_platform_list=`awk 'BEGIN{RS="\n\n"; FS="\n"} /Package:/{for(i=1;i<NF;i++){if($i ~ /^OS:/){print $1,$i}}}' ${SRCDIR}/package/pkginfo.manifest | tr ' ' '@'`
+    for pkgname_and_platform in ${pkgname_and_platform_list}
+    do
+        echo "=========================================INSTALL============================================"
+        pkgname_and_platform=`echo $pkgname_and_platform | tr '@' ' '`
+        package_name=`echo ${pkgname_and_platform} | cut -f1 -d " " | cut -f2 -d ":"`
+        platform=`echo ${pkgname_and_platform} | cut -f2 -d " " | cut -f2 -d ":"`
+
+        if [ "x${TARGET_OS}" = "x${platform}" ]
+        then
+            packaging_plugins
+        else
+            echo ""
+        fi
+    done    
+}
+
+[ "$1" = "clean" ] && clean
+[ "$1" = "build" ] && build
+[ "$1" = "install" ] && install
+exit 0
diff --git a/package/pkginfo.manifest b/package/pkginfo.manifest
new file mode 100644 (file)
index 0000000..2316c3b
--- /dev/null
@@ -0,0 +1,40 @@
+Version:1.0.9
+Maintainer:Woongsik Choi <woongsik76.choi@samsung.com>, Hyukmin Kwon <hyukmin0530.kwon@samsung.com>, Wooyoung Cho <wooyoung1.cho@samsung.com>, Jaeheung Kim <jaeheung.kim@samsung.com>
+Source: js-assignmenttracing-eplugin
+
+Package:js-assignmenttracing-eplugin
+OS:ubuntu-32
+Build-dependency:indigo-pde [ubuntu-32], common-eplugin [ubuntu-32]
+Build-host-os:ubuntu-32
+Install-dependency:common-eplugin [ubuntu-32], base-ide-product [ubuntu-32]
+Description: JavaScript Assignment Tracing plugin
+
+Package:js-assignmenttracing-eplugin
+OS:ubuntu-64
+Build-dependency:indigo-pde [ubuntu-64], common-eplugin [ubuntu-64]
+Build-host-os:ubuntu-32
+Install-dependency:common-eplugin [ubuntu-64], base-ide-product [ubuntu-64]
+Description: JavaScript Assignment Tracing plugin
+
+Package:js-assignmenttracing-eplugin
+OS:windows-32
+Build-dependency:indigo-winpde [windows-32], common-eplugin [windows-32]
+Build-host-os:ubuntu-32
+Install-dependency:common-eplugin [windows-32], base-ide-product [windows-32]
+Description: JavaScript Assignment Tracing plugin
+
+Package:js-assignmenttracing-eplugin
+OS:windows-64
+Build-dependency:indigo-winpde [windows-64], common-eplugin [windows-64]
+Build-host-os:ubuntu-32
+Install-dependency:common-eplugin [windows-64], base-ide-product [windows-64]
+Description: JavaScript Assignment Tracing plugin
+
+Package:js-assignmenttracing-eplugin
+OS:macos-64
+Build-dependency:indigo-macpde [macos-64], common-eplugin [macos-64]
+Build-host-os:ubuntu-32
+Install-dependency:common-eplugin [macos-64], base-ide-product [macos-64]
+Description: JavaScript Assignment Tracing plugin
+
+