Permalink
Browse files

Merge MPS2.5

  • Loading branch information...
2 parents e582e7a + 75c4652 commit 42343084dc87bea95754cada5ae05ea96c63b2af @inspirer inspirer committed Oct 12, 2012
Showing with 3,057 additions and 5,345 deletions.
  1. +1 −1 core/generator/source/jetbrains/mps/generator/impl/TemplateGenerator.java
  2. +38 −28 core/generator/source/jetbrains/mps/generator/impl/TemplateProcessor.java
  3. +109 −97 core/generator/source/jetbrains/mps/generator/impl/interpreted/TemplateReductionRuleInterpreted.java
  4. +119 −83 core/kernel/kernelSolution/jetbrains/mps/kernel/model.mps
  5. +198 −390 core/kernel/kernelSolution/jetbrains/mps/smodel/search.mps
  6. +17 −10 core/kernel/source/jetbrains/mps/cache/AbstractCache.java
  7. +28 −23 core/kernel/source/jetbrains/mps/project/structure/ProjectStructureModule.java
  8. +30 −25 core/kernel/source/jetbrains/mps/smodel/Language.java
  9. +41 −2 core/kernel/source/jetbrains/mps/smodel/NodeReadEventsCaster.java
  10. +8 −3 core/kernel/source/jetbrains/mps/smodel/behaviour/OldBehaviorManager.java
  11. +1 −0 core/kernel/source_gen.caches/jetbrains/mps/kernel/model/dependencies
  12. +6 −36 core/kernel/source_gen.caches/jetbrains/mps/kernel/model/generated
  13. +0 −2 core/kernel/source_gen.caches/jetbrains/mps/smodel/search/dependencies
  14. +10 −94 core/kernel/source_gen.caches/jetbrains/mps/smodel/search/generated
  15. +15 −10 core/kernel/source_gen/jetbrains/mps/kernel/model/SModelUtil.java
  16. +218 −211 core/kernel/source_gen/jetbrains/mps/kernel/model/trace.info
  17. +6 −32 core/kernel/source_gen/jetbrains/mps/smodel/search/ConceptAndSuperConceptsScope.java
  18. +76 −106 core/kernel/source_gen/jetbrains/mps/smodel/search/trace.info
  19. +20 −14 core/typesystemEngine/source/jetbrains/mps/newTypesystem/rules/DoubleTermRules.java
  20. +21 −13 core/typesystemEngine/source/jetbrains/mps/newTypesystem/rules/SingleTermRules.java
  21. +10 −25 languages/baseLanguage/baseLanguage/generator/java/templates/closures/util.mps
  22. +3 −22 ...tions/jetbrains.mps.baseLanguage.util/source_gen.caches/jetbrains/mps/baseLanguage/util/generated
  23. +63 −1,107 languages/baseLanguage/baseLanguage/source_gen.caches/jetbrains/mps/baseLanguage/behavior/generated
  24. +0 −2 ...seLanguage/source_gen.caches/jetbrains/mps/baseLanguage/generator/java/closures/util/dependencies
  25. +6 −23 .../baseLanguage/source_gen.caches/jetbrains/mps/baseLanguage/generator/java/closures/util/generated
  26. +2 −4 ...baseLanguage/source_gen/jetbrains/mps/baseLanguage/generator/java/closures/util/_QueriesUtil.java
  27. +106 −106 ...nguage/baseLanguage/source_gen/jetbrains/mps/baseLanguage/generator/java/closures/util/trace.info
  28. +41 −6 languages/baseLanguage/collections/generators/baseLanguage/templates/main@generator.mps
  29. +5 −9 ..._gen.caches/jetbrains/mps/baseLanguage/collections/generator/baseLanguage/template/main/generated
  30. +5 −1 ...jetbrains/mps/baseLanguage/collections/generator/baseLanguage/template/main/QueriesGenerated.java
  31. +770 −764 ...source_gen/jetbrains/mps/baseLanguage/collections/generator/baseLanguage/template/main/trace.info
  32. +1 −0 languages/languageDesign/constraints/constraints.mpl
  33. +48 −48 languages/languageDesign/constraints/generators/baseLanguage/templates/main@generator.mps
  34. +2 −10 languages/languageDesign/constraints/source_gen.caches/jetbrains/mps/lang/constraints/generated
  35. +9 −17 ...s/source_gen.caches/jetbrains/mps/lang/constraints/generator/baseLanguage/template/main/generated
  36. +6 −6 ...rce_gen/jetbrains/mps/lang/constraints/generator/baseLanguage/template/main/QueriesGenerated.java
  37. +9 −9 ...traints/source_gen/jetbrains/mps/lang/constraints/generator/baseLanguage/template/main/trace.info
  38. +277 −278 languages/languageDesign/smodel/generator/baseLanguage/template/main@generator.mps
  39. +9 −60 languages/languageDesign/smodel/generator/baseLanguage/util.mps
  40. +61 −69 ...smodel/source_gen.caches/jetbrains/mps/lang/smodel/generator/baseLanguage/template/main/generated
  41. +0 −1 ...esign/smodel/source_gen.caches/jetbrains/mps/lang/smodel/generator/baseLanguage/util/dependencies
  42. +5 −30 ...geDesign/smodel/source_gen.caches/jetbrains/mps/lang/smodel/generator/baseLanguage/util/generated
  43. +10 −10 ...l/source_gen/jetbrains/mps/lang/smodel/generator/baseLanguage/template/main/QueriesGenerated.java
  44. +20 −20 ...esign/smodel/source_gen/jetbrains/mps/lang/smodel/generator/baseLanguage/template/main/trace.info
  45. +4 −5 ...geDesign/smodel/source_gen/jetbrains/mps/lang/smodel/generator/baseLanguage/util/QueriesUtil.java
  46. +143 −143 ...languageDesign/smodel/source_gen/jetbrains/mps/lang/smodel/generator/baseLanguage/util/trace.info
  47. +1 −0 languages/util/ypath/solutions/sandbox/sandbox.msd
  48. +9 −84 languages/util/ypath/solutions/sandbox/source_gen.caches/treepathFeatures/generated
  49. +9 −9 languages/util/ypath/solutions/sandbox/treepathFeatures.mps
  50. +3 −4 plugins/debugger-api/api/jetbrains/mps/debug/api.mps
  51. +10 −172 plugins/debugger-api/api/source_gen.caches/jetbrains/mps/debug/api/generated
  52. +1 −0 plugins/debugger-api/languages/jetbrains.mps.debugger.api.lang/api.mpl
  53. +5 −5 plugins/debugger-api/languages/jetbrains.mps.debugger.api.lang/languageModels/scripts.mps
  54. +1 −9 ...uages/jetbrains.mps.debugger.api.lang/source_gen.caches/jetbrains/mps/debugger/api/lang/generated
  55. +6 −24 ...tbrains.mps.debugger.api.lang/source_gen.caches/jetbrains/mps/debugger/api/lang/scripts/generated
  56. +5 −5 plugins/debugger-api/languages/nanoc/pluginSolution/jetbrains/mps/nanoc/pluginutil.mps
  57. +1 −0 plugins/debugger-api/languages/nanoc/pluginSolution/pluginSolution.msd
  58. +3 −33 ...ger-api/languages/nanoc/pluginSolution/source_gen.caches/jetbrains/mps/nanoc/pluginutil/generated
  59. +1 −0 ...cution-configurations/languages/unitTests/runtime/jetbrains.mps.baseLanguage.unitTest.runtime.msd
  60. +4 −4 ...nfigurations/languages/unitTests/runtime/jetbrains/mps/baseLanguage/unitTest/execution/client.mps
  61. +10 −122 ...nitTests/runtime/source_gen.caches/jetbrains/mps/baseLanguage/unitTest/execution/client/generated
  62. +171 −172 plugins/mps-build/languages/build/languageModels/behavior.mps
  63. +78 −411 plugins/mps-build/languages/build/source_gen.caches/jetbrains/mps/build/behavior/generated
  64. +2 −2 ...s/mps-build/languages/build/source_gen/jetbrains/mps/build/behavior/BuildLayout_Jar_Behavior.java
  65. +2 −2 ...s/mps-build/languages/build/source_gen/jetbrains/mps/build/behavior/BuildLayout_Tar_Behavior.java
  66. +2 −2 ...s/mps-build/languages/build/source_gen/jetbrains/mps/build/behavior/BuildLayout_Zip_Behavior.java
  67. +30 −30 plugins/mps-build/languages/build/source_gen/jetbrains/mps/build/behavior/trace.info
  68. +88 −88 plugins/vcs/common/models/diff/ui/common.mps
  69. +1 −0 plugins/vcs/common/platform.msd
  70. +25 −178 plugins/vcs/common/source_gen.caches/jetbrains/mps/vcs/diff/ui/common/generated
  71. +1 −0 workbench/mps-platform/base.msd
  72. +7 −7 workbench/mps-platform/models/datatransfer.mps
  73. +4 −27 workbench/mps-platform/source_gen.caches/jetbrains/mps/ide/datatransfer/generated
@@ -71,7 +71,7 @@
private final IGenerationTracer myGenerationTracer;
private IPerformanceTracer ttrace;
- private DependenciesBuilder myDependenciesBuilder;
+ private final DependenciesBuilder myDependenciesBuilder;
public TemplateGenerator(GenerationSessionContext operationContext, ProgressMonitor progressMonitor,
IGeneratorLogger logger, RuleManager ruleManager,
@@ -62,41 +62,51 @@ public TemplateProcessor(@NotNull TemplateGenerator generator, @NotNull Reductio
public List<SNode> processTemplateNode(String mappingName, SNode templateNode, @NotNull TemplateContext context)
throws DismissTopMappingRuleException, TemplateProcessingFailureException, GenerationFailureException, GenerationCanceledException {
IGeneratorLogger logger = myGenerator.getLogger();
-
- if (myGenerator.getProgressMonitor().isCanceled()) {
- if (myGenerator.getGenerationTracer().isTracing() && logger.needsInfo()) {
- logger.info("generation canceled when processing branch:");
- GeneratorUtil.logCurrentGenerationBranch(logger, myGenerator.getGenerationTracer(), false);
- }
- throw new GenerationCanceledException();
+ if (myGenerator.isIncremental()) {
+ // turn off tracing
+ NodeReadEventsCaster.setNodesReadListener(null);
}
-
try {
- List<SNode> outputNodes = createOutputNodesForTemplateNode(mappingName, templateNode, context.subContext(mappingName), 0);
- if (outputNodes == null) {
- throw new TemplateProcessingFailureException();
+ if (myGenerator.getProgressMonitor().isCanceled()) {
+ if (myGenerator.getGenerationTracer().isTracing() && logger.needsInfo()) {
+ logger.info("generation canceled when processing branch:");
+ GeneratorUtil.logCurrentGenerationBranch(logger, myGenerator.getGenerationTracer(), false);
+ }
+ throw new GenerationCanceledException();
}
- return outputNodes;
- } catch (StackOverflowError e) {
- // this is critical
- logger.error("generation thread run out of stack space :(");
- if (myGenerator.getGenerationTracer().isTracing()) {
- logger.error("failed branch was:");
- GeneratorUtil.logCurrentGenerationBranch(logger, myGenerator.getGenerationTracer(), true);
- } else {
- logger.error("try to increase JVM stack size (-Xss option)");
- logger.error("to get more diagnostic generate model with the 'save transient models' option");
+
+ try {
+ List<SNode> outputNodes = createOutputNodesForTemplateNode(mappingName, templateNode, context.subContext(mappingName), 0);
+ if (outputNodes == null) {
+ throw new TemplateProcessingFailureException();
+ }
+ return outputNodes;
+ } catch (StackOverflowError e) {
+ // this is critical
+ logger.error("generation thread run out of stack space :(");
+ if (myGenerator.getGenerationTracer().isTracing()) {
+ logger.error("failed branch was:");
+ GeneratorUtil.logCurrentGenerationBranch(logger, myGenerator.getGenerationTracer(), true);
+ } else {
+ logger.error("try to increase JVM stack size (-Xss option)");
+ logger.error("to get more diagnostic generate model with the 'save transient models' option");
+ }
+ myGenerator.showErrorMessage(context.getInput(), templateNode, "couldn't process template");
+ throw new GenerationFailureException(e);
+ }
+ } finally {
+ if (myGenerator.isIncremental()) {
+ // restore tracing
+ NodeReadEventsCaster.removeNodesReadListener();
}
- myGenerator.showErrorMessage(context.getInput(), templateNode, "couldn't process template");
- throw new GenerationFailureException(e);
}
}
@Nullable
private List<SNode> createOutputNodesForTemplateNode(String mappingName,
- SNode templateNode,
- @NotNull TemplateContext context,
- int nodeMacrosToSkip)
+ SNode templateNode,
+ @NotNull TemplateContext context,
+ int nodeMacrosToSkip)
throws DismissTopMappingRuleException, GenerationFailureException, GenerationCanceledException {
IGenerationTracer generationTracer = myGenerator.getGenerationTracer();
@@ -640,8 +650,8 @@ private SNode getNewInputNode(SNode nodeMacro, @NotNull TemplateContext context)
@Nullable
private List<SNode> createOutputNodesForExternalTemplateNode(String mappingName,
- SNode templateNode,
- TemplateContext context)
+ SNode templateNode,
+ TemplateContext context)
throws
DismissTopMappingRuleException,
GenerationFailureException, GenerationCanceledException {
@@ -24,6 +24,7 @@
import jetbrains.mps.generator.runtime.TemplateReductionRule;
import jetbrains.mps.generator.template.BaseMappingRuleContext;
import jetbrains.mps.generator.template.TemplateFunctionMethodName;
+import jetbrains.mps.smodel.NodeReadEventsCaster;
import jetbrains.mps.smodel.SNode;
import jetbrains.mps.smodel.SNodePointer;
import jetbrains.mps.util.NameUtil;
@@ -42,114 +43,125 @@
*/
public class TemplateReductionRuleInterpreted implements TemplateReductionRule {
- private final SNode ruleNode;
- private final SNode applicableConcept;
-
- public TemplateReductionRuleInterpreted(SNode ruleNode) {
- this.ruleNode = ruleNode;
- this.applicableConcept = RuleUtil.getBaseRuleApplicableConcept(ruleNode);
- }
-
- @Override
- public SNodePointer getRuleNode() {
- return new SNodePointer(ruleNode);
- }
-
- @Override
- public String getApplicableConcept() {
- return NameUtil.nodeFQName(this.applicableConcept);
- }
-
- @Override
- public boolean applyToInheritors() {
- return RuleUtil.getBaseRuleApplyToConceptInheritors(ruleNode);
- }
-
- @Override
- public Collection<SNode> tryToApply(TemplateExecutionEnvironment environment, TemplateContext context) throws GenerationException {
- if (!checkCondition(RuleUtil.getBaseRuleCondition(ruleNode), false, context.getInput(), environment.getGenerator())) {
- return null;
+ private final SNode ruleNode;
+ private final SNode applicableConcept;
+ private final SNode baseRuleCondition;
+
+ public TemplateReductionRuleInterpreted(SNode ruleNode) {
+ this.ruleNode = ruleNode;
+ this.applicableConcept = RuleUtil.getBaseRuleApplicableConcept(ruleNode);
+ this.baseRuleCondition = RuleUtil.getBaseRuleCondition(ruleNode);
}
- SNodePointer ruleNodeId = new SNodePointer(ruleNode);
- environment.getTracer().pushRule(ruleNodeId);
- try {
- return apply(context, environment.getEnvironment(context.getInput(), this));
- } catch (AbandonRuleInputException e) {
- return Collections.emptyList();
- } finally {
- environment.getTracer().closeRule(ruleNodeId);
+ @Override
+ public SNodePointer getRuleNode() {
+ return new SNodePointer(ruleNode);
}
- }
- public boolean checkCondition(SNode condition, boolean required, SNode inputNode, TemplateGenerator generator) throws GenerationFailureException {
- if (condition == null) {
- if (required) {
- generator.showErrorMessage(inputNode, null, ruleNode, "rule condition required");
- return false;
- }
- return true;
+ @Override
+ public String getApplicableConcept() {
+ return NameUtil.nodeFQName(this.applicableConcept);
}
- String methodName = TemplateFunctionMethodName.baseMappingRule_Condition(condition);
- try {
- return (Boolean) QueryMethodGenerated.invoke(
- methodName,
- generator.getGeneratorSessionContext(),
- new BaseMappingRuleContext(inputNode, ruleNode, generator),
- ruleNode.getModel(),
- true);
- } catch (ClassNotFoundException e) {
- generator.getLogger().warning(condition, "cannot find condition method '" + methodName + "' : evaluate to FALSE");
- } catch (NoSuchMethodException e) {
- generator.getLogger().warning(condition, "cannot find condition method '" + methodName + "' : evaluate to FALSE");
- } catch (Throwable t) {
- generator.getLogger().handleException(t);
- generator.getLogger().error(condition, "error executing condition " + methodName + " (see exception)");
- throw new GenerationFailureException(t);
+ @Override
+ public boolean applyToInheritors() {
+ return RuleUtil.getBaseRuleApplyToConceptInheritors(ruleNode);
}
- return false;
- }
-
- @Nullable
- private Collection<SNode> apply(TemplateContext context, @NotNull TemplateExecutionEnvironment environment)
- throws DismissTopMappingRuleException, AbandonRuleInputException, GenerationFailureException, GenerationCanceledException {
-
- String ruleMappingName = RuleUtil.getBaseRuleLabel(ruleNode);
- SNode ruleConsequence = RuleUtil.getReductionRuleConsequence(ruleNode);
- if (ruleConsequence == null) {
- environment.getGenerator().showErrorMessage(context.getInput(), null, ruleNode, "error processing reduction rule: no rule consequence");
- return null;
+
+ @Override
+ public Collection<SNode> tryToApply(TemplateExecutionEnvironment environment, TemplateContext context) throws GenerationException {
+ if (!checkCondition(baseRuleCondition, false, context.getInput(), environment.getGenerator())) {
+ return null;
+ }
+
+ SNodePointer ruleNodeId = new SNodePointer(ruleNode);
+ environment.getTracer().pushRule(ruleNodeId);
+ try {
+ if (environment.getGenerator().isIncremental()) {
+ // turn off tracing
+ NodeReadEventsCaster.setNodesReadListener(null);
+ }
+
+ return apply(context, environment.getEnvironment(context.getInput(), this));
+ } catch (AbandonRuleInputException e) {
+ return Collections.emptyList();
+ } finally {
+ if (environment.getGenerator().isIncremental()) {
+ // restore tracing
+ NodeReadEventsCaster.removeNodesReadListener();
+ }
+ environment.getTracer().closeRule(ruleNodeId);
+ }
}
- TemplateContext conseqContext = GeneratorUtil.createConsequenceContext(context.getInput(), context, environment.getReductionContext(), ruleConsequence, context.getInput(), environment.getGenerator());
- List<Pair<SNode, String>> nodeAndMappingNamePairs = GeneratorUtilEx.getTemplateNodesFromRuleConsequence(ruleConsequence, context.getInput(), ruleNode, environment.getReductionContext(), environment.getGenerator());
- if (nodeAndMappingNamePairs == null) {
- environment.getGenerator().showErrorMessage(context.getInput(), null, ruleConsequence, "error processing reduction rule consequence");
- return null;
+ public boolean checkCondition(SNode condition, boolean required, SNode inputNode, TemplateGenerator generator) throws GenerationFailureException {
+ if (condition == null) {
+ if (required) {
+ generator.showErrorMessage(inputNode, null, ruleNode, "rule condition required");
+ return false;
+ }
+ return true;
+ }
+
+ String methodName = TemplateFunctionMethodName.baseMappingRule_Condition(condition);
+ try {
+ return (Boolean) QueryMethodGenerated.invoke(
+ methodName,
+ generator.getGeneratorSessionContext(),
+ new BaseMappingRuleContext(inputNode, ruleNode, generator),
+ ruleNode.getModel(),
+ true);
+ } catch (ClassNotFoundException e) {
+ generator.getLogger().warning(condition, "cannot find condition method '" + methodName + "' : evaluate to FALSE");
+ } catch (NoSuchMethodException e) {
+ generator.getLogger().warning(condition, "cannot find condition method '" + methodName + "' : evaluate to FALSE");
+ } catch (Throwable t) {
+ generator.getLogger().handleException(t);
+ generator.getLogger().error(condition, "error executing condition " + methodName + " (see exception)");
+ throw new GenerationFailureException(t);
+ }
+ return false;
}
- List<SNode> result = new ArrayList<SNode>(nodeAndMappingNamePairs.size());
- TemplateProcessor templateProcessor = new TemplateProcessor(environment.getGenerator(), environment.getReductionContext());
- for (Pair<SNode, String> nodeAndMappingNamePair : nodeAndMappingNamePairs) {
- SNode templateNode = nodeAndMappingNamePair.o1;
- String mappingName = nodeAndMappingNamePair.o2 != null ? nodeAndMappingNamePair.o2 : ruleMappingName;
- try {
- result.addAll(templateProcessor.processTemplateNode(mappingName, templateNode, conseqContext));
- } catch (DismissTopMappingRuleException e) {
- throw e;
- } catch (TemplateProcessingFailureException e) {
- environment.getGenerator().showErrorMessage(context.getInput(), templateNode, ruleNode, "error processing reduction rule");
- } catch (GenerationFailureException e) {
- throw e;
- } catch (GenerationCanceledException e) {
- throw e;
- } catch (Throwable t) {
- environment.getGenerator().getLogger().handleException(t);
- environment.getGenerator().showErrorMessage(context.getInput(), templateNode, ruleNode, "error processing reduction rule");
- }
+ @Nullable
+ private Collection<SNode> apply(TemplateContext context, @NotNull TemplateExecutionEnvironment environment)
+ throws DismissTopMappingRuleException, AbandonRuleInputException, GenerationFailureException, GenerationCanceledException {
+
+ String ruleMappingName = RuleUtil.getBaseRuleLabel(ruleNode);
+ SNode ruleConsequence = RuleUtil.getReductionRuleConsequence(ruleNode);
+ if (ruleConsequence == null) {
+ environment.getGenerator().showErrorMessage(context.getInput(), null, ruleNode, "error processing reduction rule: no rule consequence");
+ return null;
+ }
+ TemplateContext conseqContext = GeneratorUtil.createConsequenceContext(context.getInput(), context, environment.getReductionContext(), ruleConsequence, context.getInput(), environment.getGenerator());
+
+ List<Pair<SNode, String>> nodeAndMappingNamePairs = GeneratorUtilEx.getTemplateNodesFromRuleConsequence(ruleConsequence, context.getInput(), ruleNode, environment.getReductionContext(), environment.getGenerator());
+ if (nodeAndMappingNamePairs == null) {
+ environment.getGenerator().showErrorMessage(context.getInput(), null, ruleConsequence, "error processing reduction rule consequence");
+ return null;
+ }
+
+ List<SNode> result = new ArrayList<SNode>(nodeAndMappingNamePairs.size());
+ TemplateProcessor templateProcessor = new TemplateProcessor(environment.getGenerator(), environment.getReductionContext());
+ for (Pair<SNode, String> nodeAndMappingNamePair : nodeAndMappingNamePairs) {
+ SNode templateNode = nodeAndMappingNamePair.o1;
+ String mappingName = nodeAndMappingNamePair.o2 != null ? nodeAndMappingNamePair.o2 : ruleMappingName;
+ try {
+ result.addAll(templateProcessor.processTemplateNode(mappingName, templateNode, conseqContext));
+ } catch (DismissTopMappingRuleException e) {
+ throw e;
+ } catch (TemplateProcessingFailureException e) {
+ environment.getGenerator().showErrorMessage(context.getInput(), templateNode, ruleNode, "error processing reduction rule");
+ } catch (GenerationFailureException e) {
+ throw e;
+ } catch (GenerationCanceledException e) {
+ throw e;
+ } catch (Throwable t) {
+ environment.getGenerator().getLogger().handleException(t);
+ environment.getGenerator().showErrorMessage(context.getInput(), templateNode, ruleNode, "error processing reduction rule");
+ }
+ }
+ return result;
}
- return result;
- }
}
Oops, something went wrong.

0 comments on commit 4234308

Please sign in to comment.