diff --git a/NewAndNoteworthy/CDT-11.0.md b/NewAndNoteworthy/CDT-11.0.md index 1eb6fbdb11b..ef5a8540687 100644 --- a/NewAndNoteworthy/CDT-11.0.md +++ b/NewAndNoteworthy/CDT-11.0.md @@ -10,6 +10,13 @@ This is the New & Noteworthy page for CDT 11.0 which is part of Eclipse 2022-12 Jave 17 is now required to build and run Eclipse CDT. See https://github.com/eclipse-cdt/cdt/issues/80 +## Removed plug-ins and features + +Various plug-ins and features are no longer part of the CDT release. +Please see the corresponding issue for more details. + +- Qt plug-ins (`org.eclipse.cdt.qt.ui/core/feature`) https://github.com/eclipse-cdt/cdt/issues/123 _Note:_ the `org.eclipse.cdt.testsrunner.qttest` plug-in is still part of CDT. + # Debug ## C/C++ Dynamic Printf Breakpoints @@ -27,7 +34,7 @@ See [Bug 580873](https://bugs.eclipse.org/bugs/show_bug.cgi?id=580873). Please see [CHANGELOG-API](CHANGELOG-API.md) for details on the breaking API changes in this release as well as future planned API changes. -## New Job Family for backgrond build settings update +## New Job Family for background build settings update When the project is modified the managed build settings needs to update settings. diff --git a/NewAndNoteworthy/CHANGELOG-API.md b/NewAndNoteworthy/CHANGELOG-API.md index afee2e99e1b..7ad64116462 100644 --- a/NewAndNoteworthy/CHANGELOG-API.md +++ b/NewAndNoteworthy/CHANGELOG-API.md @@ -13,6 +13,7 @@ This section describes API removals that occurred in past releases, and upcoming - [Removal of deprecated CommandLauncher.execute() method](#executeCommandLauncher) - [Removal of deprecated CBuildConfiguration.watchProcess() methods](#watchProcessCBuildConfig) - [Rework of API to determine GDB command line in org.eclipse.cdt.dsf.gdb](#gdbBackendDebuggerCommandLine) +- [Removal of Qt plug-ins and features](#qt-plugins) ## API Changes in CDT 10.5.0 @@ -150,6 +151,18 @@ instead. See [Bug 572944](https://bugs.eclipse.org/bugs/show_bug.cgi?id=572944) and https://github.com/eclipse-cdt/cdt/pull/112. +### Removal of Qt plug-ins and features + +For a while now the Qt plug-ins have had at least some issues. +They rely on the Nashorn script engine which was removed in Java 15. +The plug-ins have been removed in CDT 11. +The following bundles and all their related API has been removed: + +- org.eclipse.cdt.qt.ui +- org.eclipse.cdt.qt.core + +See https://github.com/eclipse-cdt/cdt/issues/123 + --- ## API Changes in CDT 10.5.0. diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/templateengine/processes/AddLanguageSettingsProvider.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/templateengine/processes/AddLanguageSettingsProvider.java index 2833edef3d1..58749e7b9d5 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/templateengine/processes/AddLanguageSettingsProvider.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/templateengine/processes/AddLanguageSettingsProvider.java @@ -40,7 +40,7 @@ import org.eclipse.core.runtime.IProgressMonitor; <process type="org.eclipse.cdt.managedbuilder.core.AddLanguageSettingsProvider"> <simple name="projectName" value="$(projectName)"/> <simple-array name="languageSettingsProviders"> - <element value="org.eclipse.cdt.qt.core.QtPathsProvider"/> + <element value="com.yourcompany.core.YourPathsProvider"/> </simple-array> </process> * diff --git a/pom.xml b/pom.xml index 84880b77846..68131eb7c42 100644 --- a/pom.xml +++ b/pom.xml @@ -216,10 +216,6 @@ native/org.eclipse.cdt.native.serial - qt/org.eclipse.cdt.qt.core - qt/org.eclipse.cdt.qt.ui - qt/org.eclipse.cdt.qt-feature - remote/org.eclipse.cdt.remote.core testsrunner/org.eclipse.cdt.testsrunner @@ -322,7 +318,6 @@ lsp/org.eclipse.cdt.lsp.core.tests lsp/org.eclipse.cdt.lsp.cquery.tests memory/org.eclipse.cdt.debug.core.memory.tests - qt/org.eclipse.cdt.qt.ui.tests testsrunner/org.eclipse.cdt.testsrunner.tests releng/org.eclipse.cdt.testing @@ -332,10 +327,7 @@ - - + diff --git a/qt/org.eclipse.cdt.qt-feature/.project b/qt/org.eclipse.cdt.qt-feature/.project deleted file mode 100644 index c8573d52a68..00000000000 --- a/qt/org.eclipse.cdt.qt-feature/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - org.eclipse.cdt.qt-feature - - - - - - org.eclipse.pde.FeatureBuilder - - - - - - org.eclipse.pde.FeatureNature - - diff --git a/qt/org.eclipse.cdt.qt-feature/.settings/org.eclipse.core.resources.prefs b/qt/org.eclipse.cdt.qt-feature/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 99f26c0203a..00000000000 --- a/qt/org.eclipse.cdt.qt-feature/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/qt/org.eclipse.cdt.qt-feature/build.properties b/qt/org.eclipse.cdt.qt-feature/build.properties deleted file mode 100644 index b3a611b5c93..00000000000 --- a/qt/org.eclipse.cdt.qt-feature/build.properties +++ /dev/null @@ -1,2 +0,0 @@ -bin.includes = feature.xml,\ - feature.properties diff --git a/qt/org.eclipse.cdt.qt-feature/feature.properties b/qt/org.eclipse.cdt.qt-feature/feature.properties deleted file mode 100644 index 2d4cb7e64ca..00000000000 --- a/qt/org.eclipse.cdt.qt-feature/feature.properties +++ /dev/null @@ -1,37 +0,0 @@ -############################################################################### -# Copyright (c) 2008, 2010 Wind River Systems -# -# This program and the accompanying materials -# are made available under the terms of the Eclipse Public License 2.0 -# which accompanies this distribution, and is available at -# https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0 -# -# Contributors: -# Wind River Systems - initial implementation -# IBM Corporation -############################################################################### -# features.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=C/C++ Qt Support - Preview - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse CDT - -# "description" property - description of the feature -description=Support for Qt projects and objects in the indexer. - -# copyright -copyright=\ -Copyright (c) 2013 QNX Software Systems and others.\n\ -This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License 2.0\n\ -which accompanies this distribution, and is available at\n\ -https://www.eclipse.org/legal/epl-2.0/ - diff --git a/qt/org.eclipse.cdt.qt-feature/feature.xml b/qt/org.eclipse.cdt.qt-feature/feature.xml deleted file mode 100644 index 33f1111ae78..00000000000 --- a/qt/org.eclipse.cdt.qt-feature/feature.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - %description - - - - %copyright - - - - %license - - - - - - - - - - - diff --git a/qt/org.eclipse.cdt.qt.core.tests/.classpath b/qt/org.eclipse.cdt.qt.core.tests/.classpath deleted file mode 100644 index 675a5e2962b..00000000000 --- a/qt/org.eclipse.cdt.qt.core.tests/.classpath +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/qt/org.eclipse.cdt.qt.core.tests/.project b/qt/org.eclipse.cdt.qt.core.tests/.project deleted file mode 100644 index 290b8294e74..00000000000 --- a/qt/org.eclipse.cdt.qt.core.tests/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - org.eclipse.cdt.qt.core.tests - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/qt/org.eclipse.cdt.qt.core.tests/.settings/org.eclipse.core.resources.prefs b/qt/org.eclipse.cdt.qt.core.tests/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 99f26c0203a..00000000000 --- a/qt/org.eclipse.cdt.qt.core.tests/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/qt/org.eclipse.cdt.qt.core.tests/.settings/org.eclipse.jdt.core.prefs b/qt/org.eclipse.cdt.qt.core.tests/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index afec999c9e1..00000000000 --- a/qt/org.eclipse.cdt.qt.core.tests/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,486 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.builder.cleanOutputFolder=clean -org.eclipse.jdt.core.builder.duplicateResourceTask=warning -org.eclipse.jdt.core.builder.invalidClasspath=abort -org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore -org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch, *.xtend -org.eclipse.jdt.core.circularClasspath=error -org.eclipse.jdt.core.classpath.exclusionPatterns=enabled -org.eclipse.jdt.core.classpath.mainOnlyProjectHasTestOnlyDependency=error -org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled -org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error -org.eclipse.jdt.core.codeComplete.argumentPrefixes= -org.eclipse.jdt.core.codeComplete.argumentSuffixes= -org.eclipse.jdt.core.codeComplete.fieldPrefixes= -org.eclipse.jdt.core.codeComplete.fieldSuffixes= -org.eclipse.jdt.core.codeComplete.localPrefixes= -org.eclipse.jdt.core.codeComplete.localSuffixes= -org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= -org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= -org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled -org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore -org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull -org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= -org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullable.secondary= -org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.methodParameters=generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=17 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.doc.comment.support=enabled -org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 -org.eclipse.jdt.core.compiler.problem.APILeak=warning -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=warning -org.eclipse.jdt.core.compiler.problem.deprecation=ignore -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore -org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore -org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore -org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.invalidJavadoc=ignore -org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error -org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag -org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning -org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error -org.eclipse.jdt.core.compiler.problem.nullReference=error -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error -org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore -org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning -org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore -org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore -org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore -org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning -org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled -org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore -org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.release=enabled -org.eclipse.jdt.core.compiler.source=17 -org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false -org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 -org.eclipse.jdt.core.formatter.align_type_members_on_columns=false -org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false -org.eclipse.jdt.core.formatter.align_with_spaces=false -org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 -org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 -org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 -org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 -org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 -org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 -org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 -org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 -org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 -org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 -org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0 -org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0 -org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 -org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_after_package=1 -org.eclipse.jdt.core.formatter.blank_lines_before_field=0 -org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 -org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 -org.eclipse.jdt.core.formatter.blank_lines_before_method=1 -org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 -org.eclipse.jdt.core.formatter.blank_lines_before_package=0 -org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 -org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 -org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=true -org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false -org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=true -org.eclipse.jdt.core.formatter.comment.format_block_comments=false -org.eclipse.jdt.core.formatter.comment.format_header=false -org.eclipse.jdt.core.formatter.comment.format_html=true -org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false -org.eclipse.jdt.core.formatter.comment.format_line_comments=false -org.eclipse.jdt.core.formatter.comment.format_source_code=true -org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false -org.eclipse.jdt.core.formatter.comment.indent_root_tags=false -org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert -org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert -org.eclipse.jdt.core.formatter.comment.line_length=80 -org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true -org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true -org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false -org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=2 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 -org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off -org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on -org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true -org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_empty_lines=false -org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true -org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false -org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert -org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert -org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert -org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert -org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert -org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert -org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.join_lines_in_comments=true -org.eclipse.jdt.core.formatter.join_wrapped_lines=true -org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false -org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false -org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false -org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false -org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false -org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false -org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false -org.eclipse.jdt.core.formatter.lineSplit=120 -org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 -org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true -org.eclipse.jdt.core.formatter.tabulation.char=tab -org.eclipse.jdt.core.formatter.tabulation.size=4 -org.eclipse.jdt.core.formatter.use_on_off_tags=true -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true -org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true -org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true -org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true -org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true -org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true -org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true -org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true -org.eclipse.jdt.core.incompatibleJDKLevel=ignore -org.eclipse.jdt.core.incompleteClasspath=error -org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter diff --git a/qt/org.eclipse.cdt.qt.core.tests/.settings/org.eclipse.jdt.launching.prefs b/qt/org.eclipse.cdt.qt.core.tests/.settings/org.eclipse.jdt.launching.prefs deleted file mode 100644 index f8a131b56e0..00000000000 --- a/qt/org.eclipse.cdt.qt.core.tests/.settings/org.eclipse.jdt.launching.prefs +++ /dev/null @@ -1,3 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.launching.PREF_COMPILER_COMPLIANCE_DOES_NOT_MATCH_JRE=warning -org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=warning diff --git a/qt/org.eclipse.cdt.qt.core.tests/.settings/org.eclipse.jdt.ui.prefs b/qt/org.eclipse.cdt.qt.core.tests/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index d35ba9b5231..00000000000 --- a/qt/org.eclipse.cdt.qt.core.tests/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,213 +0,0 @@ -cleanup.add_all=false -cleanup.add_default_serial_version_id=true -cleanup.add_generated_serial_version_id=false -cleanup.add_missing_annotations=true -cleanup.add_missing_deprecated_annotations=true -cleanup.add_missing_methods=false -cleanup.add_missing_nls_tags=false -cleanup.add_missing_override_annotations=true -cleanup.add_missing_override_annotations_interface_methods=true -cleanup.add_serial_version_id=false -cleanup.always_use_blocks=true -cleanup.always_use_parentheses_in_expressions=false -cleanup.always_use_this_for_non_static_field_access=false -cleanup.always_use_this_for_non_static_method_access=false -cleanup.array_with_curly=false -cleanup.arrays_fill=false -cleanup.bitwise_conditional_expression=false -cleanup.boolean_literal=false -cleanup.boolean_value_rather_than_comparison=false -cleanup.break_loop=false -cleanup.collection_cloning=false -cleanup.comparing_on_criteria=false -cleanup.comparison_statement=false -cleanup.controlflow_merge=false -cleanup.convert_functional_interfaces=false -cleanup.convert_to_enhanced_for_loop=false -cleanup.convert_to_enhanced_for_loop_if_loop_var_used=true -cleanup.convert_to_switch_expressions=false -cleanup.correct_indentation=false -cleanup.do_while_rather_than_while=true -cleanup.double_negation=false -cleanup.else_if=false -cleanup.embedded_if=false -cleanup.evaluate_nullable=false -cleanup.extract_increment=false -cleanup.format_source_code=true -cleanup.format_source_code_changes_only=false -cleanup.hash=false -cleanup.if_condition=false -cleanup.insert_inferred_type_arguments=false -cleanup.instanceof=false -cleanup.instanceof_keyword=false -cleanup.invert_equals=false -cleanup.join=false -cleanup.lazy_logical_operator=false -cleanup.make_local_variable_final=true -cleanup.make_parameters_final=false -cleanup.make_private_fields_final=true -cleanup.make_type_abstract_if_missing_method=false -cleanup.make_variable_declarations_final=false -cleanup.map_cloning=false -cleanup.merge_conditional_blocks=false -cleanup.multi_catch=false -cleanup.never_use_blocks=false -cleanup.never_use_parentheses_in_expressions=true -cleanup.no_string_creation=false -cleanup.no_super=false -cleanup.number_suffix=false -cleanup.objects_equals=false -cleanup.one_if_rather_than_duplicate_blocks_that_fall_through=false -cleanup.operand_factorization=false -cleanup.organize_imports=true -cleanup.overridden_assignment=false -cleanup.plain_replacement=false -cleanup.precompile_regex=false -cleanup.primitive_comparison=false -cleanup.primitive_parsing=false -cleanup.primitive_rather_than_wrapper=false -cleanup.primitive_serialization=false -cleanup.pull_out_if_from_if_else=false -cleanup.pull_up_assignment=false -cleanup.push_down_negation=false -cleanup.qualify_static_field_accesses_with_declaring_class=false -cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -cleanup.qualify_static_member_accesses_with_declaring_class=false -cleanup.qualify_static_method_accesses_with_declaring_class=false -cleanup.reduce_indentation=false -cleanup.redundant_comparator=false -cleanup.redundant_falling_through_block_end=false -cleanup.remove_private_constructors=true -cleanup.remove_redundant_modifiers=false -cleanup.remove_redundant_semicolons=true -cleanup.remove_redundant_type_arguments=true -cleanup.remove_trailing_whitespaces=true -cleanup.remove_trailing_whitespaces_all=true -cleanup.remove_trailing_whitespaces_ignore_empty=false -cleanup.remove_unnecessary_array_creation=false -cleanup.remove_unnecessary_casts=true -cleanup.remove_unnecessary_nls_tags=false -cleanup.remove_unused_imports=true -cleanup.remove_unused_local_variables=false -cleanup.remove_unused_method_parameters=false -cleanup.remove_unused_private_fields=true -cleanup.remove_unused_private_members=false -cleanup.remove_unused_private_methods=true -cleanup.remove_unused_private_types=true -cleanup.return_expression=false -cleanup.simplify_lambda_expression_and_method_ref=false -cleanup.single_used_field=false -cleanup.sort_members=false -cleanup.sort_members_all=false -cleanup.standard_comparison=false -cleanup.static_inner_class=false -cleanup.strictly_equal_or_different=false -cleanup.stringbuffer_to_stringbuilder=false -cleanup.stringbuilder=false -cleanup.stringbuilder_for_local_vars=true -cleanup.stringconcat_to_textblock=false -cleanup.substring=false -cleanup.switch=false -cleanup.system_property=false -cleanup.system_property_boolean=false -cleanup.system_property_file_encoding=false -cleanup.system_property_file_separator=false -cleanup.system_property_line_separator=false -cleanup.system_property_path_separator=false -cleanup.ternary_operator=false -cleanup.try_with_resource=false -cleanup.unlooped_while=false -cleanup.unreachable_block=false -cleanup.use_anonymous_class_creation=false -cleanup.use_autoboxing=false -cleanup.use_blocks=false -cleanup.use_blocks_only_for_return_and_throw=false -cleanup.use_directly_map_method=false -cleanup.use_lambda=true -cleanup.use_parentheses_in_expressions=false -cleanup.use_string_is_blank=false -cleanup.use_this_for_non_static_field_access=false -cleanup.use_this_for_non_static_field_access_only_if_necessary=true -cleanup.use_this_for_non_static_method_access=false -cleanup.use_this_for_non_static_method_access_only_if_necessary=true -cleanup.use_unboxing=false -cleanup.use_var=false -cleanup.useless_continue=false -cleanup.useless_return=false -cleanup.valueof_rather_than_instantiation=false -cleanup_profile=_CDT -cleanup_settings_version=2 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_CDT -formatter_settings_version=14 -internal.default.compliance=user -org.eclipse.jdt.ui.exception.name=e -org.eclipse.jdt.ui.gettersetter.use.is=true -org.eclipse.jdt.ui.ignorelowercasenames=true -org.eclipse.jdt.ui.importorder=java;javax;org;com; -org.eclipse.jdt.ui.keywordthis=false -org.eclipse.jdt.ui.ondemandthreshold=1000 -org.eclipse.jdt.ui.overrideannotation=true -org.eclipse.jdt.ui.staticondemandthreshold=1000 -org.eclipse.jdt.ui.text.custom_code_templates= -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=true -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_missing_override_annotations_interface_methods=true -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_functional_interfaces=false -sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.correct_indentation=false -sp_cleanup.format_source_code=true -sp_cleanup.format_source_code_changes_only=false -sp_cleanup.insert_inferred_type_arguments=false -sp_cleanup.make_local_variable_final=true -sp_cleanup.make_parameters_final=false -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=false -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=true -sp_cleanup.organize_imports=true -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=false -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_redundant_modifiers=false -sp_cleanup.remove_redundant_semicolons=true -sp_cleanup.remove_redundant_type_arguments=true -sp_cleanup.remove_trailing_whitespaces=true -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=true -sp_cleanup.remove_unnecessary_nls_tags=false -sp_cleanup.remove_unused_imports=true -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_anonymous_class_creation=false -sp_cleanup.use_blocks=false -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_lambda=true -sp_cleanup.use_parentheses_in_expressions=false -sp_cleanup.use_this_for_non_static_field_access=false -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=false -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/qt/org.eclipse.cdt.qt.core.tests/.settings/org.eclipse.pde.api.tools.prefs b/qt/org.eclipse.cdt.qt.core.tests/.settings/org.eclipse.pde.api.tools.prefs deleted file mode 100644 index ec9fbf321d0..00000000000 --- a/qt/org.eclipse.cdt.qt.core.tests/.settings/org.eclipse.pde.api.tools.prefs +++ /dev/null @@ -1,184 +0,0 @@ -ANNOTATION_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error -ANNOTATION_ELEMENT_TYPE_ADDED_FIELD=Error -ANNOTATION_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error -ANNOTATION_ELEMENT_TYPE_ADDED_INTERFACE_BOUNDS=Error -ANNOTATION_ELEMENT_TYPE_ADDED_METHOD=Error -ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error -ANNOTATION_ELEMENT_TYPE_ADDED_TYPE_MEMBER=Error -ANNOTATION_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -ANNOTATION_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error -ANNOTATION_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -ANNOTATION_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error -ANNOTATION_ELEMENT_TYPE_CHANGED_INTERFACE_BOUNDS=Error -ANNOTATION_ELEMENT_TYPE_CHANGED_RESTRICTIONS=Error -ANNOTATION_ELEMENT_TYPE_CHANGED_TO_CLASS=Error -ANNOTATION_ELEMENT_TYPE_CHANGED_TO_ENUM=Error -ANNOTATION_ELEMENT_TYPE_CHANGED_TO_INTERFACE=Error -ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD_WITHOUT_DEFAULT_VALUE=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD_WITH_DEFAULT_VALUE=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_PARAMETERS=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error -API_USE_SCAN_FIELD_SEVERITY=Error -API_USE_SCAN_METHOD_SEVERITY=Error -API_USE_SCAN_TYPE_SEVERITY=Error -CLASS_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error -CLASS_ELEMENT_TYPE_ADDED_FIELD=Error -CLASS_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error -CLASS_ELEMENT_TYPE_ADDED_INTERFACE_BOUNDS=Error -CLASS_ELEMENT_TYPE_ADDED_METHOD=Error -CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error -CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -CLASS_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error -CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERCLASS_SET=Error -CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -CLASS_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error -CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error -CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -CLASS_ELEMENT_TYPE_CHANGED_RESTRICTIONS=Error -CLASS_ELEMENT_TYPE_CHANGED_SUPERCLASS=Error -CLASS_ELEMENT_TYPE_CHANGED_TO_ANNOTATION=Error -CLASS_ELEMENT_TYPE_CHANGED_TO_ENUM=Error -CLASS_ELEMENT_TYPE_CHANGED_TO_INTERFACE=Error -CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -CLASS_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error -CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error -CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error -CLASS_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error -CLASS_ELEMENT_TYPE_REMOVED_INTERFACE_BOUNDS=Error -CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error -CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error -CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETERS=Error -CONSTRUCTOR_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error -CONSTRUCTOR_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error -CONSTRUCTOR_ELEMENT_TYPE_ADDED_INTERFACE_BOUNDS=Error -CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_TYPE_PARAMETER=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error -CONSTRUCTOR_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error -CONSTRUCTOR_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error -CONSTRUCTOR_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error -CONSTRUCTOR_ELEMENT_TYPE_REMOVED_INTERFACE_BOUNDS=Error -CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETERS=Error -ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -ENUM_ELEMENT_TYPE_CHANGED_RESTRICTIONS=Error -ENUM_ELEMENT_TYPE_CHANGED_TO_ANNOTATION=Error -ENUM_ELEMENT_TYPE_CHANGED_TO_CLASS=Error -ENUM_ELEMENT_TYPE_CHANGED_TO_INTERFACE=Error -ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error -ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error -ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error -ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -FIELD_ELEMENT_TYPE_ADDED_VALUE=Error -FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error -FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error -FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error -FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error -FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error -FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error -FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENTS=Error -FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error -ILLEGAL_EXTEND=Warning -ILLEGAL_IMPLEMENT=Warning -ILLEGAL_INSTANTIATE=Warning -ILLEGAL_OVERRIDE=Warning -ILLEGAL_REFERENCE=Warning -INTERFACE_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error -INTERFACE_ELEMENT_TYPE_ADDED_DEFAULT_METHOD=Error -INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error -INTERFACE_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error -INTERFACE_ELEMENT_TYPE_ADDED_INTERFACE_BOUNDS=Error -INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error -INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error -INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error -INTERFACE_ELEMENT_TYPE_ADDED_TYPE_MEMBER=Error -INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETERS=Error -INTERFACE_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error -INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -INTERFACE_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error -INTERFACE_ELEMENT_TYPE_CHANGED_INTERFACE_BOUNDS=Error -INTERFACE_ELEMENT_TYPE_CHANGED_RESTRICTIONS=Error -INTERFACE_ELEMENT_TYPE_CHANGED_TO_ANNOTATION=Error -INTERFACE_ELEMENT_TYPE_CHANGED_TO_CLASS=Error -INTERFACE_ELEMENT_TYPE_CHANGED_TO_ENUM=Error -INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -INTERFACE_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error -INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error -INTERFACE_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error -INTERFACE_ELEMENT_TYPE_REMOVED_INTERFACE_BOUNDS=Error -INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error -INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -INVALID_ANNOTATION=Ignore -INVALID_JAVADOC_TAG=Error -INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Warning -LEAK_EXTEND=Warning -LEAK_FIELD_DECL=Warning -LEAK_IMPLEMENT=Warning -LEAK_METHOD_PARAM=Warning -LEAK_METHOD_RETURN_TYPE=Warning -METHOD_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error -METHOD_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error -METHOD_ELEMENT_TYPE_ADDED_INTERFACE_BOUNDS=Error -METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error -METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -METHOD_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error -METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -METHOD_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error -METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error -METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error -METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error -METHOD_ELEMENT_TYPE_CHANGED_TYPE_PARAMETER=Error -METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error -METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error -METHOD_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error -METHOD_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error -METHOD_ELEMENT_TYPE_REMOVED_INTERFACE_BOUNDS=Error -METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETERS=Error -MISSING_EE_DESCRIPTIONS=Warning -TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error -UNUSED_PROBLEM_FILTERS=Warning -automatically_removed_unused_problem_filters=false -changed_execution_env=Error -eclipse.preferences.version=1 -incompatible_api_component_version=Error -incompatible_api_component_version_include_major_without_breaking_change=Disabled -incompatible_api_component_version_include_minor_without_api_change=Disabled -incompatible_api_component_version_report_major_without_breaking_change=Warning -incompatible_api_component_version_report_minor_without_api_change=Warning -invalid_since_tag_version=Error -malformed_since_tag=Error -missing_since_tag=Error -report_api_breakage_when_major_version_incremented=Disabled -report_resolution_errors_api_component=Warning diff --git a/qt/org.eclipse.cdt.qt.core.tests/.settings/org.eclipse.pde.prefs b/qt/org.eclipse.cdt.qt.core.tests/.settings/org.eclipse.pde.prefs deleted file mode 100644 index 51a63ec9988..00000000000 --- a/qt/org.eclipse.cdt.qt.core.tests/.settings/org.eclipse.pde.prefs +++ /dev/null @@ -1,35 +0,0 @@ -compilers.f.unresolved-features=1 -compilers.f.unresolved-plugins=1 -compilers.incompatible-environment=1 -compilers.p.build=1 -compilers.p.build.bin.includes=1 -compilers.p.build.encodings=2 -compilers.p.build.java.compiler=2 -compilers.p.build.java.compliance=1 -compilers.p.build.missing.output=2 -compilers.p.build.output.library=1 -compilers.p.build.source.library=1 -compilers.p.build.src.includes=1 -compilers.p.deprecated=1 -compilers.p.discouraged-class=1 -compilers.p.internal=1 -compilers.p.missing-packages=2 -compilers.p.missing-version-export-package=2 -compilers.p.missing-version-import-package=2 -compilers.p.missing-version-require-bundle=2 -compilers.p.no-required-att=0 -compilers.p.no.automatic.module=1 -compilers.p.not-externalized-att=2 -compilers.p.service.component.without.lazyactivation=1 -compilers.p.unknown-attribute=1 -compilers.p.unknown-class=1 -compilers.p.unknown-element=1 -compilers.p.unknown-identifier=1 -compilers.p.unknown-resource=1 -compilers.p.unresolved-ex-points=0 -compilers.p.unresolved-import=0 -compilers.s.create-docs=false -compilers.s.doc-folder=doc -compilers.s.open-tags=1 -compilers.use-project=true -eclipse.preferences.version=1 diff --git a/qt/org.eclipse.cdt.qt.core.tests/META-INF/MANIFEST.MF b/qt/org.eclipse.cdt.qt.core.tests/META-INF/MANIFEST.MF deleted file mode 100644 index c468ea40de3..00000000000 --- a/qt/org.eclipse.cdt.qt.core.tests/META-INF/MANIFEST.MF +++ /dev/null @@ -1,15 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: org.eclipse.cdt.qt.core.tests -Bundle-Vendor: %providerName -Bundle-Version: 2.0.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-17 -Require-Bundle: org.eclipse.osgi;bundle-version="3.10.100", - org.junit, - org.eclipse.cdt.qt.core;bundle-version="2.0.0" -Bundle-ClassPath: . -Bundle-Activator: org.eclipse.cdt.qt.core.tests.Activator -Bundle-ActivationPolicy: lazy -Automatic-Module-Name: org.eclipse.cdt.qt.core.tests -Bundle-Localization: plugin diff --git a/qt/org.eclipse.cdt.qt.core.tests/about.html b/qt/org.eclipse.cdt.qt.core.tests/about.html deleted file mode 100644 index b3134865230..00000000000 --- a/qt/org.eclipse.cdt.qt.core.tests/about.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - About - - - -

About This Content

- -

November 30, 2017

-

License

- -

- The Eclipse Foundation makes available all content in this plug-in - ("Content"). Unless otherwise indicated below, the Content - is provided to you under the terms and conditions of the Eclipse - Public License Version 2.0 ("EPL"). A copy of the EPL is - available at https://www.eclipse.org/legal/epl-2.0. - For purposes of the EPL, "Program" will mean the Content. -

- -

- If you did not receive this Content directly from the Eclipse - Foundation, the Content is being redistributed by another party - ("Redistributor") and different terms and conditions may - apply to your use of any object code in the Content. Check the - Redistributor's license that was provided with the Content. If no such - license exists, contact the Redistributor. Unless otherwise indicated - below, the terms and conditions of the EPL still apply to any source - code in the Content and such source code may be obtained at https://www.eclipse.org. -

- - - - \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core.tests/build.properties b/qt/org.eclipse.cdt.qt.core.tests/build.properties deleted file mode 100644 index 2b112c46131..00000000000 --- a/qt/org.eclipse.cdt.qt.core.tests/build.properties +++ /dev/null @@ -1,7 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - plugin.properties,\ - about.html -src.includes = about.html diff --git a/qt/org.eclipse.cdt.qt.core.tests/plugin.properties b/qt/org.eclipse.cdt.qt.core.tests/plugin.properties deleted file mode 100644 index c425c9670f4..00000000000 --- a/qt/org.eclipse.cdt.qt.core.tests/plugin.properties +++ /dev/null @@ -1,14 +0,0 @@ -################################################################################## -# Copyright (c) 2020 Torbjörn Svensson and others. All rights reserved. -# This program and the accompanying materials are made available under the terms -# of the Eclipse Public License 2.0 which accompanies this distribution, and is -# available at https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0 -# -# Contributors: -# Torbjörn Svensson - initial API and implementation -################################################################################## - -pluginName = QML Tests -providerName = Eclipse CDT diff --git a/qt/org.eclipse.cdt.qt.core.tests/scripts/ecma5-defs.js b/qt/org.eclipse.cdt.qt.core.tests/scripts/ecma5-defs.js deleted file mode 100644 index 4535e2d73e6..00000000000 --- a/qt/org.eclipse.cdt.qt.core.tests/scripts/ecma5-defs.js +++ /dev/null @@ -1,968 +0,0 @@ -ecma5defs = { - "!name": "ecma5", - "!define": { - "Error.prototype": "Error.prototype" - }, - "Infinity": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Infinity", - "!doc": "A numeric value representing infinity." - }, - "undefined": { - "!type": "?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/undefined", - "!doc": "The value undefined." - }, - "NaN": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/NaN", - "!doc": "A value representing Not-A-Number." - }, - "Object": { - "!type": "fn()", - "getPrototypeOf": { - "!type": "fn(obj: ?) -> ?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getPrototypeOf", - "!doc": "Returns the prototype (i.e. the internal prototype) of the specified object." - }, - "create": { - "!type": "fn(proto: ?) -> !custom:Object_create", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/create", - "!doc": "Creates a new object with the specified prototype object and properties." - }, - "defineProperty": { - "!type": "fn(obj: ?, prop: string, desc: ?) -> !custom:Object_defineProperty", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperty", - "!doc": "Defines a new property directly on an object, or modifies an existing property on an object, and returns the object. If you want to see how to use the Object.defineProperty method with a binary-flags-like syntax, see this article." - }, - "defineProperties": { - "!type": "fn(obj: ?, props: ?) -> !custom:Object_defineProperties", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperty", - "!doc": "Defines a new property directly on an object, or modifies an existing property on an object, and returns the object. If you want to see how to use the Object.defineProperty method with a binary-flags-like syntax, see this article." - }, - "getOwnPropertyDescriptor": { - "!type": "fn(obj: ?, prop: string) -> ?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor", - "!doc": "Returns a property descriptor for an own property (that is, one directly present on an object, not present by dint of being along an object's prototype chain) of a given object." - }, - "keys": { - "!type": "fn(obj: ?) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/keys", - "!doc": "Returns an array of a given object's own enumerable properties, in the same order as that provided by a for-in loop (the difference being that a for-in loop enumerates properties in the prototype chain as well)." - }, - "getOwnPropertyNames": { - "!type": "fn(obj: ?) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames", - "!doc": "Returns an array of all properties (enumerable or not) found directly upon a given object." - }, - "seal": { - "!type": "fn(obj: ?)", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/seal", - "!doc": "Seals an object, preventing new properties from being added to it and marking all existing properties as non-configurable. Values of present properties can still be changed as long as they are writable." - }, - "isSealed": { - "!type": "fn(obj: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/isSealed", - "!doc": "Determine if an object is sealed." - }, - "freeze": { - "!type": "fn(obj: ?) -> !0", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/freeze", - "!doc": "Freezes an object: that is, prevents new properties from being added to it; prevents existing properties from being removed; and prevents existing properties, or their enumerability, configurability, or writability, from being changed. In essence the object is made effectively immutable. The method returns the object being frozen." - }, - "isFrozen": { - "!type": "fn(obj: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/isFrozen", - "!doc": "Determine if an object is frozen." - }, - "preventExtensions": { - "!type": "fn(obj: ?)", - "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/preventExtensions", - "!doc": "Prevents new properties from ever being added to an object." - }, - "isExtensible": { - "!type": "fn(obj: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible", - "!doc": "The Object.isExtensible() method determines if an object is extensible (whether it can have new properties added to it)." - }, - "prototype": { - "!stdProto": "Object", - "toString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/toString", - "!doc": "Returns a string representing the object." - }, - "toLocaleString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/toLocaleString", - "!doc": "Returns a string representing the object. This method is meant to be overriden by derived objects for locale-specific purposes." - }, - "valueOf": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/valueOf", - "!doc": "Returns the primitive value of the specified object" - }, - "hasOwnProperty": { - "!type": "fn(prop: string) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/hasOwnProperty", - "!doc": "Returns a boolean indicating whether the object has the specified property." - }, - "propertyIsEnumerable": { - "!type": "fn(prop: string) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable", - "!doc": "Returns a Boolean indicating whether the specified property is enumerable." - }, - "isPrototypeOf": { - "!type": "fn(obj: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isPrototypeOf", - "!doc": "Tests for an object in another object's prototype chain." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object", - "!doc": "Creates an object wrapper." - }, - "Function": { - "!type": "fn(body: string) -> fn()", - "prototype": { - "!stdProto": "Function", - "apply": { - "!type": "fn(this: ?, args: [?])", - "!effects": [ - "call and return !this this=!0 !1. !1. !1." - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/apply", - "!doc": "Calls a function with a given this value and arguments provided as an array (or an array like object)." - }, - "call": { - "!type": "fn(this: ?, args?: ?) -> !this.!ret", - "!effects": [ - "call and return !this this=!0 !1 !2 !3 !4" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/call", - "!doc": "Calls a function with a given this value and arguments provided individually." - }, - "bind": { - "!type": "fn(this: ?, args?: ?) -> !custom:Function_bind", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/bind", - "!doc": "Creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function was called." - }, - "prototype": "?" - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function", - "!doc": "Every function in JavaScript is actually a Function object." - }, - "Array": { - "!type": "fn(size: number) -> !custom:Array_ctor", - "isArray": { - "!type": "fn(value: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/isArray", - "!doc": "Returns true if an object is an array, false if it is not." - }, - "prototype": { - "!stdProto": "Array", - "length": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/length", - "!doc": "An unsigned, 32-bit integer that specifies the number of elements in an array." - }, - "concat": { - "!type": "fn(other: [?]) -> !this", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/concat", - "!doc": "Returns a new array comprised of this array joined with other array(s) and/or value(s)." - }, - "join": { - "!type": "fn(separator?: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/join", - "!doc": "Joins all elements of an array into a string." - }, - "splice": { - "!type": "fn(pos: number, amount: number)", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/splice", - "!doc": "Changes the content of an array, adding new elements while removing old elements." - }, - "pop": { - "!type": "fn() -> !this.", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/pop", - "!doc": "Removes the last element from an array and returns that element." - }, - "push": { - "!type": "fn(newelt: ?) -> number", - "!effects": [ - "propagate !0 !this." - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/push", - "!doc": "Mutates an array by appending the given elements and returning the new length of the array." - }, - "shift": { - "!type": "fn() -> !this.", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/shift", - "!doc": "Removes the first element from an array and returns that element. This method changes the length of the array." - }, - "unshift": { - "!type": "fn(newelt: ?) -> number", - "!effects": [ - "propagate !0 !this." - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/unshift", - "!doc": "Adds one or more elements to the beginning of an array and returns the new length of the array." - }, - "slice": { - "!type": "fn(from: number, to?: number) -> !this", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/slice", - "!doc": "Returns a shallow copy of a portion of an array." - }, - "reverse": { - "!type": "fn()", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/reverse", - "!doc": "Reverses an array in place. The first array element becomes the last and the last becomes the first." - }, - "sort": { - "!type": "fn(compare?: fn(a: ?, b: ?) -> number)", - "!effects": [ - "call !0 !this. !this." - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/sort", - "!doc": "Sorts the elements of an array in place and returns the array." - }, - "indexOf": { - "!type": "fn(elt: ?, from?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/indexOf", - "!doc": "Returns the first index at which a given element can be found in the array, or -1 if it is not present." - }, - "lastIndexOf": { - "!type": "fn(elt: ?, from?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/lastIndexOf", - "!doc": "Returns the last index at which a given element can be found in the array, or -1 if it is not present. The array is searched backwards, starting at fromIndex." - }, - "every": { - "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> bool", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/every", - "!doc": "Tests whether all elements in the array pass the test implemented by the provided function." - }, - "some": { - "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> bool", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/some", - "!doc": "Tests whether some element in the array passes the test implemented by the provided function." - }, - "filter": { - "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> !this", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/filter", - "!doc": "Creates a new array with all elements that pass the test implemented by the provided function." - }, - "forEach": { - "!type": "fn(f: fn(elt: ?, i: number), context?: ?)", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach", - "!doc": "Executes a provided function once per array element." - }, - "map": { - "!type": "fn(f: fn(elt: ?, i: number) -> ?, context?: ?) -> [!0.!ret]", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/map", - "!doc": "Creates a new array with the results of calling a provided function on every element in this array." - }, - "reduce": { - "!type": "fn(combine: fn(sum: ?, elt: ?, i: number) -> ?, init?: ?) -> !0.!ret", - "!effects": [ - "call !0 !1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/Reduce", - "!doc": "Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value." - }, - "reduceRight": { - "!type": "fn(combine: fn(sum: ?, elt: ?, i: number) -> ?, init?: ?) -> !0.!ret", - "!effects": [ - "call !0 !1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/ReduceRight", - "!doc": "Apply a function simultaneously against two values of the array (from right-to-left) as to reduce it to a single value." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array", - "!doc": "The JavaScript Array global object is a constructor for arrays, which are high-level, list-like objects." - }, - "String": { - "!type": "fn(value: ?) -> string", - "fromCharCode": { - "!type": "fn(code: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/fromCharCode", - "!doc": "Returns a string created by using the specified sequence of Unicode values." - }, - "prototype": { - "!stdProto": "String", - "length": { - "!type": "number", - "!url": "https://developer.mozilla.org/en/docs/JavaScript/Reference/Global_Objects/String/length", - "!doc": "Represents the length of a string." - }, - "": "string", - "charAt": { - "!type": "fn(i: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/charAt", - "!doc": "Returns the specified character from a string." - }, - "charCodeAt": { - "!type": "fn(i: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/charCodeAt", - "!doc": "Returns the numeric Unicode value of the character at the given index (except for unicode codepoints > 0x10000)." - }, - "indexOf": { - "!type": "fn(char: string, from?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/indexOf", - "!doc": "Returns the index within the calling String object of the first occurrence of the specified value, starting the search at fromIndex,\nreturns -1 if the value is not found." - }, - "lastIndexOf": { - "!type": "fn(char: string, from?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/lastIndexOf", - "!doc": "Returns the index within the calling String object of the last occurrence of the specified value, or -1 if not found. The calling string is searched backward, starting at fromIndex." - }, - "substring": { - "!type": "fn(from: number, to?: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/substring", - "!doc": "Returns a subset of a string between one index and another, or through the end of the string." - }, - "substr": { - "!type": "fn(from: number, length?: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/substr", - "!doc": "Returns the characters in a string beginning at the specified location through the specified number of characters." - }, - "slice": { - "!type": "fn(from: number, to?: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/slice", - "!doc": "Extracts a section of a string and returns a new string." - }, - "trim": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/Trim", - "!doc": "Removes whitespace from both ends of the string." - }, - "toUpperCase": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toUpperCase", - "!doc": "Returns the calling string value converted to uppercase." - }, - "toLowerCase": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLowerCase", - "!doc": "Returns the calling string value converted to lowercase." - }, - "toLocaleUpperCase": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase", - "!doc": "Returns the calling string value converted to upper case, according to any locale-specific case mappings." - }, - "toLocaleLowerCase": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase", - "!doc": "Returns the calling string value converted to lower case, according to any locale-specific case mappings." - }, - "split": { - "!type": "fn(pattern: string) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/split", - "!doc": "Splits a String object into an array of strings by separating the string into substrings." - }, - "concat": { - "!type": "fn(other: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/concat", - "!doc": "Combines the text of two or more strings and returns a new string." - }, - "localeCompare": { - "!type": "fn(other: string) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/localeCompare", - "!doc": "Returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order." - }, - "match": { - "!type": "fn(pattern: +RegExp) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/match", - "!doc": "Used to retrieve the matches when matching a string against a regular expression." - }, - "replace": { - "!type": "fn(pattern: string|+RegExp, replacement: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/replace", - "!doc": "Returns a new string with some or all matches of a pattern replaced by a replacement. The pattern can be a string or a RegExp, and the replacement can be a string or a function to be called for each match." - }, - "search": { - "!type": "fn(pattern: +RegExp) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/search", - "!doc": "Executes the search for a match between a regular expression and this String object." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String", - "!doc": "The String global object is a constructor for strings, or a sequence of characters." - }, - "Number": { - "!type": "fn(value: ?) -> number", - "MAX_VALUE": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/MAX_VALUE", - "!doc": "The maximum numeric value representable in JavaScript." - }, - "MIN_VALUE": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/MIN_VALUE", - "!doc": "The smallest positive numeric value representable in JavaScript." - }, - "POSITIVE_INFINITY": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/POSITIVE_INFINITY", - "!doc": "A value representing the positive Infinity value." - }, - "NEGATIVE_INFINITY": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/NEGATIVE_INFINITY", - "!doc": "A value representing the negative Infinity value." - }, - "prototype": { - "!stdProto": "Number", - "toString": { - "!type": "fn(radix?: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toString", - "!doc": "Returns a string representing the specified Number object" - }, - "toFixed": { - "!type": "fn(digits: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toFixed", - "!doc": "Formats a number using fixed-point notation" - }, - "toExponential": { - "!type": "fn(digits: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toExponential", - "!doc": "Returns a string representing the Number object in exponential notation" - }, - "toPrecision": { - "!type": "fn(digits: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toPrecision", - "!doc": "The toPrecision() method returns a string representing the number to the specified precision." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number", - "!doc": "The Number JavaScript object is a wrapper object allowing you to work with numerical values. A Number object is created using the Number() constructor." - }, - "Boolean": { - "!type": "fn(value: ?) -> bool", - "prototype": { - "!stdProto": "Boolean" - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean", - "!doc": "The Boolean object is an object wrapper for a boolean value." - }, - "RegExp": { - "!type": "fn(source: string, flags?: string)", - "prototype": { - "!stdProto": "RegExp", - "exec": { - "!type": "fn(input: string) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/exec", - "!doc": "Executes a search for a match in a specified string. Returns a result array, or null." - }, - "test": { - "!type": "fn(input: string) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/test", - "!doc": "Executes the search for a match between a regular expression and a specified string. Returns true or false." - }, - "global": { - "!type": "bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", - "!doc": "Creates a regular expression object for matching text with a pattern." - }, - "ignoreCase": { - "!type": "bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", - "!doc": "Creates a regular expression object for matching text with a pattern." - }, - "multiline": { - "!type": "bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/multiline", - "!doc": "Reflects whether or not to search in strings across multiple lines.\n" - }, - "source": { - "!type": "string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/source", - "!doc": "A read-only property that contains the text of the pattern, excluding the forward slashes.\n" - }, - "lastIndex": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/lastIndex", - "!doc": "A read/write integer property that specifies the index at which to start the next match." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", - "!doc": "Creates a regular expression object for matching text with a pattern." - }, - "Date": { - "!type": "fn(ms: number)", - "parse": { - "!type": "fn(source: string) -> +Date", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/parse", - "!doc": "Parses a string representation of a date, and returns the number of milliseconds since January 1, 1970, 00:00:00 UTC." - }, - "UTC": { - "!type": "fn(year: number, month: number, date: number, hour?: number, min?: number, sec?: number, ms?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/UTC", - "!doc": "Accepts the same parameters as the longest form of the constructor, and returns the number of milliseconds in a Date object since January 1, 1970, 00:00:00, universal time." - }, - "now": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/now", - "!doc": "Returns the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC." - }, - "prototype": { - "toUTCString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toUTCString", - "!doc": "Converts a date to a string, using the universal time convention." - }, - "toISOString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toISOString", - "!doc": "JavaScript provides a direct way to convert a date object into a string in ISO format, the ISO 8601 Extended Format." - }, - "toDateString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toDateString", - "!doc": "Returns the date portion of a Date object in human readable form in American English." - }, - "toTimeString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toTimeString", - "!doc": "Returns the time portion of a Date object in human readable form in American English." - }, - "toLocaleDateString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toLocaleDateString", - "!doc": "Converts a date to a string, returning the \"date\" portion using the operating system's locale's conventions.\n" - }, - "toLocaleTimeString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toLocaleTimeString", - "!doc": "Converts a date to a string, returning the \"time\" portion using the current locale's conventions." - }, - "getTime": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getTime", - "!doc": "Returns the numeric value corresponding to the time for the specified date according to universal time." - }, - "getFullYear": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getFullYear", - "!doc": "Returns the year of the specified date according to local time." - }, - "getYear": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getYear", - "!doc": "Returns the year in the specified date according to local time." - }, - "getMonth": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMonth", - "!doc": "Returns the month in the specified date according to local time." - }, - "getUTCMonth": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCMonth", - "!doc": "Returns the month of the specified date according to universal time.\n" - }, - "getDate": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getDate", - "!doc": "Returns the day of the month for the specified date according to local time." - }, - "getUTCDate": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCDate", - "!doc": "Returns the day (date) of the month in the specified date according to universal time.\n" - }, - "getDay": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getDay", - "!doc": "Returns the day of the week for the specified date according to local time." - }, - "getUTCDay": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCDay", - "!doc": "Returns the day of the week in the specified date according to universal time.\n" - }, - "getHours": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getHours", - "!doc": "Returns the hour for the specified date according to local time." - }, - "getUTCHours": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCHours", - "!doc": "Returns the hours in the specified date according to universal time.\n" - }, - "getMinutes": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMinutes", - "!doc": "Returns the minutes in the specified date according to local time." - }, - "getUTCMinutes": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date", - "!doc": "Creates JavaScript Date instances which let you work with dates and times." - }, - "getSeconds": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getSeconds", - "!doc": "Returns the seconds in the specified date according to local time." - }, - "getUTCSeconds": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCSeconds", - "!doc": "Returns the seconds in the specified date according to universal time.\n" - }, - "getMilliseconds": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMilliseconds", - "!doc": "Returns the milliseconds in the specified date according to local time." - }, - "getUTCMilliseconds": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCMilliseconds", - "!doc": "Returns the milliseconds in the specified date according to universal time.\n" - }, - "getTimezoneOffset": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset", - "!doc": "Returns the time-zone offset from UTC, in minutes, for the current locale." - }, - "setTime": { - "!type": "fn(date: +Date) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setTime", - "!doc": "Sets the Date object to the time represented by a number of milliseconds since January 1, 1970, 00:00:00 UTC.\n" - }, - "setFullYear": { - "!type": "fn(year: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setFullYear", - "!doc": "Sets the full year for a specified date according to local time.\n" - }, - "setUTCFullYear": { - "!type": "fn(year: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCFullYear", - "!doc": "Sets the full year for a specified date according to universal time.\n" - }, - "setMonth": { - "!type": "fn(month: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMonth", - "!doc": "Set the month for a specified date according to local time." - }, - "setUTCMonth": { - "!type": "fn(month: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMonth", - "!doc": "Sets the month for a specified date according to universal time.\n" - }, - "setDate": { - "!type": "fn(day: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setDate", - "!doc": "Sets the day of the month for a specified date according to local time." - }, - "setUTCDate": { - "!type": "fn(day: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCDate", - "!doc": "Sets the day of the month for a specified date according to universal time.\n" - }, - "setHours": { - "!type": "fn(hour: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setHours", - "!doc": "Sets the hours for a specified date according to local time, and returns the number of milliseconds since 1 January 1970 00:00:00 UTC until the time represented by the updated Date instance." - }, - "setUTCHours": { - "!type": "fn(hour: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCHours", - "!doc": "Sets the hour for a specified date according to universal time.\n" - }, - "setMinutes": { - "!type": "fn(min: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMinutes", - "!doc": "Sets the minutes for a specified date according to local time." - }, - "setUTCMinutes": { - "!type": "fn(min: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMinutes", - "!doc": "Sets the minutes for a specified date according to universal time.\n" - }, - "setSeconds": { - "!type": "fn(sec: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setSeconds", - "!doc": "Sets the seconds for a specified date according to local time." - }, - "setUTCSeconds": { - "!type": "fn(sec: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCSeconds", - "!doc": "Sets the seconds for a specified date according to universal time.\n" - }, - "setMilliseconds": { - "!type": "fn(ms: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMilliseconds", - "!doc": "Sets the milliseconds for a specified date according to local time.\n" - }, - "setUTCMilliseconds": { - "!type": "fn(ms: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMilliseconds", - "!doc": "Sets the milliseconds for a specified date according to universal time.\n" - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date", - "!doc": "Creates JavaScript Date instances which let you work with dates and times." - }, - "Error": { - "!type": "fn(message: string)", - "prototype": { - "name": { - "!type": "string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error/name", - "!doc": "A name for the type of error." - }, - "message": { - "!type": "string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error/message", - "!doc": "A human-readable description of the error." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error", - "!doc": "Creates an error object." - }, - "SyntaxError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/SyntaxError", - "!doc": "Represents an error when trying to interpret syntactically invalid code." - }, - "ReferenceError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/ReferenceError", - "!doc": "Represents an error when a non-existent variable is referenced." - }, - "URIError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/URIError", - "!doc": "Represents an error when a malformed URI is encountered." - }, - "EvalError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/EvalError", - "!doc": "Represents an error regarding the eval function." - }, - "RangeError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RangeError", - "!doc": "Represents an error when a number is not within the correct range allowed." - }, - "TypeError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/TypeError", - "!doc": "Represents an error an error when a value is not of the expected type." - }, - "parseInt": { - "!type": "fn(string: string, radix?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/parseInt", - "!doc": "Parses a string argument and returns an integer of the specified radix or base." - }, - "parseFloat": { - "!type": "fn(string: string) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/parseFloat", - "!doc": "Parses a string argument and returns a floating point number." - }, - "isNaN": { - "!type": "fn(value: number) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/isNaN", - "!doc": "Determines whether a value is NaN or not. Be careful, this function is broken. You may be interested in ECMAScript 6 Number.isNaN." - }, - "isFinite": { - "!type": "fn(value: number) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/isFinite", - "!doc": "Determines whether the passed value is a finite number." - }, - "eval": { - "!type": "fn(code: string) -> ?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/eval", - "!doc": "Evaluates JavaScript code represented as a string." - }, - "encodeURI": { - "!type": "fn(uri: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURI", - "!doc": "Encodes a Uniform Resource Identifier (URI) by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two \"surrogate\" characters)." - }, - "encodeURIComponent": { - "!type": "fn(uri: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent", - "!doc": "Encodes a Uniform Resource Identifier (URI) component by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two \"surrogate\" characters)." - }, - "decodeURI": { - "!type": "fn(uri: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/decodeURI", - "!doc": "Decodes a Uniform Resource Identifier (URI) previously created by encodeURI or by a similar routine." - }, - "decodeURIComponent": { - "!type": "fn(uri: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/decodeURIComponent", - "!doc": "Decodes a Uniform Resource Identifier (URI) component previously created by encodeURIComponent or by a similar routine." - }, - "Math": { - "E": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/E", - "!doc": "The base of natural logarithms, e, approximately 2.718." - }, - "LN2": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LN2", - "!doc": "The natural logarithm of 2, approximately 0.693." - }, - "LN10": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LN10", - "!doc": "The natural logarithm of 10, approximately 2.302." - }, - "LOG2E": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LOG2E", - "!doc": "The base 2 logarithm of E (approximately 1.442)." - }, - "LOG10E": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LOG10E", - "!doc": "The base 10 logarithm of E (approximately 0.434)." - }, - "SQRT1_2": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/SQRT1_2", - "!doc": "The square root of 1/2; equivalently, 1 over the square root of 2, approximately 0.707." - }, - "SQRT2": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/SQRT2", - "!doc": "The square root of 2, approximately 1.414." - }, - "PI": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/PI", - "!doc": "The ratio of the circumference of a circle to its diameter, approximately 3.14159." - }, - "abs": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/abs", - "!doc": "Returns the absolute value of a number." - }, - "cos": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/cos", - "!doc": "Returns the cosine of a number." - }, - "sin": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/sin", - "!doc": "Returns the sine of a number." - }, - "tan": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/tan", - "!doc": "Returns the tangent of a number." - }, - "acos": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/acos", - "!doc": "Returns the arccosine (in radians) of a number." - }, - "asin": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/asin", - "!doc": "Returns the arcsine (in radians) of a number." - }, - "atan": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/atan", - "!doc": "Returns the arctangent (in radians) of a number." - }, - "atan2": { - "!type": "fn(y: number, x: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/atan2", - "!doc": "Returns the arctangent of the quotient of its arguments." - }, - "ceil": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/ceil", - "!doc": "Returns the smallest integer greater than or equal to a number." - }, - "floor": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/floor", - "!doc": "Returns the largest integer less than or equal to a number." - }, - "round": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/round", - "!doc": "Returns the value of a number rounded to the nearest integer." - }, - "exp": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/exp", - "!doc": "Returns Ex, where x is the argument, and E is Euler's constant, the base of the natural logarithms." - }, - "log": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/log", - "!doc": "Returns the natural logarithm (base E) of a number." - }, - "sqrt": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/sqrt", - "!doc": "Returns the square root of a number." - }, - "pow": { - "!type": "fn(number, number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/pow", - "!doc": "Returns base to the exponent power, that is, baseexponent." - }, - "max": { - "!type": "fn(number, number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/max", - "!doc": "Returns the largest of zero or more numbers." - }, - "min": { - "!type": "fn(number, number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/min", - "!doc": "Returns the smallest of zero or more numbers." - }, - "random": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/random", - "!doc": "Returns a floating-point, pseudo-random number in the range [0, 1) that is, from 0 (inclusive) up to but not including 1 (exclusive), which you can then scale to your desired range." - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math", - "!doc": "A built-in object that has properties and methods for mathematical constants and functions." - }, - "JSON": { - "parse": { - "!type": "fn(json: string) -> ?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/parse", - "!doc": "Parse a string as JSON, optionally transforming the value produced by parsing." - }, - "stringify": { - "!type": "fn(value: ?) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/stringify", - "!doc": "Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified." - }, - "!url": "https://developer.mozilla.org/en-US/docs/JSON", - "!doc": "JSON (JavaScript Object Notation) is a data-interchange format. It closely resembles a subset of JavaScript syntax, although it is not a strict subset. (See JSON in the JavaScript Reference for full details.) It is useful when writing any kind of JavaScript-based application, including websites and browser extensions. For example, you might store user information in JSON format in a cookie, or you might store extension preferences in JSON in a string-valued browser preference." - } -}; diff --git a/qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/Activator.java b/qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/Activator.java deleted file mode 100644 index 133e3d59b99..00000000000 --- a/qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/Activator.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.cdt.qt.core.tests; - -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; - -public class Activator implements BundleActivator { - - private static BundleContext context; - - @Override - public void start(BundleContext context) throws Exception { - Activator.context = context; - } - - @Override - public void stop(BundleContext context) throws Exception { - Activator.context = null; - } - - public static Bundle getBundle() { - return context != null ? context.getBundle() : null; - } - - public static T getService(Class service) { - ServiceReference ref = context.getServiceReference(service); - return ref != null ? context.getService(ref) : null; - } - -} diff --git a/qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/NashornTests.java b/qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/NashornTests.java deleted file mode 100644 index cece6b52de8..00000000000 --- a/qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/NashornTests.java +++ /dev/null @@ -1,350 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.cdt.qt.core.tests; - -import static org.hamcrest.CoreMatchers.instanceOf; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.fail; - -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.cdt.qt.core.IQMLAnalyzer; -import org.eclipse.cdt.qt.core.QMLTernCompletion; -import org.eclipse.cdt.qt.core.qmljs.IJSBinaryExpression; -import org.eclipse.cdt.qt.core.qmljs.IJSBinaryExpression.BinaryOperator; -import org.eclipse.cdt.qt.core.qmljs.IQmlASTNode; -import org.eclipse.cdt.qt.core.qmljs.IQmlHeaderItem; -import org.eclipse.cdt.qt.core.qmljs.IQmlImport; -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectMember; -import org.eclipse.cdt.qt.core.qmljs.IQmlProgram; -import org.eclipse.cdt.qt.core.qmljs.IQmlPropertyBinding; -import org.eclipse.cdt.qt.core.qmljs.IQmlRootObject; -import org.eclipse.cdt.qt.core.qmljs.IQmlScriptBinding; -import org.junit.BeforeClass; -import org.junit.Test; - -@SuppressWarnings("nls") -public class NashornTests { - - protected static IQMLAnalyzer analyzer; - - @BeforeClass - public static void loadAnalyzer() { - analyzer = Activator.getService(IQMLAnalyzer.class); - } - - protected void getCompletions(String code, QMLTernCompletion... expected) throws Throwable { - int pos = code.indexOf('|'); - code = code.substring(0, pos) + code.substring(pos + 1); - - Collection QMLTernCompletions = analyzer.getCompletions("test1.qml", code, pos, false); - - Map set = new HashMap<>(); - Set unexpected = new HashSet<>(); - for (QMLTernCompletion QMLTernCompletion : expected) { - set.put(QMLTernCompletion.getName(), QMLTernCompletion); - } - for (QMLTernCompletion QMLTernCompletion : QMLTernCompletions) { - String name = QMLTernCompletion.getName(); - QMLTernCompletion c = set.get(name); - if (c != null) { - assertEquals(c.getType(), QMLTernCompletion.getType()); - assertEquals(c.getOrigin(), QMLTernCompletion.getOrigin()); - set.remove(name); - } else { - unexpected.add(name); - } - } - if (!set.isEmpty()) { - fail("Missing names: " + String.join(", ", set.keySet())); - } - if (!unexpected.isEmpty()) { - fail("Unexpected names: " + String.join(", ", unexpected)); - } - } - - @Test - public void testParseFile1() throws Throwable { - IQmlASTNode node = analyzer.parseFile("main.qml", ""); - assertEquals("Unexpected program node type", "QMLProgram", node.getType()); - } - - @Test - public void testParseFile2() throws Throwable { - IQmlASTNode node = analyzer.parseFile("main.qml", "import QtQuick 2.2"); - assertThat(node, instanceOf(IQmlProgram.class)); - IQmlProgram program = (IQmlProgram) node; - List headerItems = program.getHeaderItemList().getItems(); - assertEquals("Unexpected number of header items", 1, headerItems.size()); - assertThat(headerItems.get(0), instanceOf(IQmlImport.class)); - IQmlImport imp = (IQmlImport) headerItems.get(0); - assertEquals("Unexpected module identifier", "QtQuick", imp.getModule().getIdentifier().getName()); - assertEquals("Unexpected module raw version", "2.2", imp.getModule().getVersion().getRaw()); - assertEquals("Unexpected module version", 2.2, imp.getModule().getVersion().getValue(), 0.0001d); - } - - @Test - public void testParseString1() throws Throwable { - IQmlASTNode node = analyzer.parseString("", "qml", true, true); - assertEquals("Unexpected program node type", "QMLProgram", node.getType()); - } - - @Test - public void testParseString2() throws Throwable { - IQmlASTNode node = analyzer.parseString("import QtQuick 2.2", "qml", true, true); - assertThat(node, instanceOf(IQmlProgram.class)); - IQmlProgram program = (IQmlProgram) node; - List headerItems = program.getHeaderItemList().getItems(); - assertEquals("Unexpected number of header items", 1, headerItems.size()); - assertThat(headerItems.get(0), instanceOf(IQmlImport.class)); - IQmlImport imp = (IQmlImport) headerItems.get(0); - assertEquals("Unexpected module identifier", "QtQuick", imp.getModule().getIdentifier().getName()); - assertEquals("Unexpected module raw version", "2.2", imp.getModule().getVersion().getRaw()); - assertEquals("Unexpected module version", 2.2, imp.getModule().getVersion().getValue(), 0.0001d); - } - - @Test - public void testParseString3() throws Throwable { - IQmlASTNode node = analyzer.parseString("import QtQuick 2.2", "qml", true, true); - assertThat(node, instanceOf(IQmlProgram.class)); - IQmlProgram program = (IQmlProgram) node; - List headerItems = program.getHeaderItemList().getItems(); - assertEquals("Unexpected number of header items", 1, headerItems.size()); - assertThat(headerItems.get(0), instanceOf(IQmlImport.class)); - IQmlImport imp = (IQmlImport) headerItems.get(0); - assertEquals("Unexpected start range", 0, imp.getRange()[0]); - assertEquals("Unexpected end range", 18, imp.getRange()[1]); - } - - @Test - public void testParseString4() throws Throwable { - IQmlASTNode node = analyzer.parseString("import QtQuick 2.2", "qml", true, true); - assertThat(node, instanceOf(IQmlProgram.class)); - IQmlProgram program = (IQmlProgram) node; - List headerItems = program.getHeaderItemList().getItems(); - assertEquals("Unexpected number of header items", 1, headerItems.size()); - assertThat(headerItems.get(0), instanceOf(IQmlImport.class)); - IQmlImport imp = (IQmlImport) headerItems.get(0); - assertEquals("Unexpected start line", 1, imp.getLocation().getStart().getLine()); - assertEquals("Unexpected start column", 0, imp.getLocation().getStart().getColumn()); - assertEquals("Unexpected start line", 1, imp.getLocation().getEnd().getLine()); - assertEquals("Unexpected start column", 18, imp.getLocation().getEnd().getColumn()); - } - - @Test - public void testParseString5() throws Throwable { - IQmlASTNode node = analyzer.parseString("QtObject {}", "qml", true, true); - assertThat(node, instanceOf(IQmlProgram.class)); - IQmlProgram program = (IQmlProgram) node; - List headerItems = program.getHeaderItemList().getItems(); - assertEquals("Unexpected number of header items", 0, headerItems.size()); - assertNotNull("Root object was null", program.getRootObject()); - IQmlRootObject root = program.getRootObject(); - assertEquals("Unexpected root object type", "QMLObjectDefinition", root.getType()); - assertEquals("Unexpected root object identifier", "QtObject", root.getIdentifier().getName()); - } - - @Test - public void testParseString6() throws Throwable { - IQmlASTNode node = analyzer.parseString("QtObject {s: 3 + 3}", "qml", true, true); - assertThat(node, instanceOf(IQmlProgram.class)); - IQmlProgram program = (IQmlProgram) node; - assertNotNull("Root object was null", program.getRootObject()); - IQmlRootObject root = program.getRootObject(); - List members = root.getBody().getMembers(); - assertEquals("Unexpected number of root object members", 1, members.size()); - assertThat(members.get(0), instanceOf(IQmlPropertyBinding.class)); - IQmlPropertyBinding bind = (IQmlPropertyBinding) members.get(0); - assertThat(bind.getBinding(), instanceOf(IQmlScriptBinding.class)); - IQmlScriptBinding scriptBinding = (IQmlScriptBinding) bind.getBinding(); - assertFalse("Script binding was not a JavaScript expression", scriptBinding.isBlock()); - assertThat(scriptBinding.getScript(), instanceOf(IJSBinaryExpression.class)); - assertEquals("Unexpected expression type", "BinaryExpression", scriptBinding.getScript().getType()); - IJSBinaryExpression expr = (IJSBinaryExpression) scriptBinding.getScript(); - assertEquals("Unexpected binary operator", BinaryOperator.Add, expr.getOperator()); - } - - @Test - public void testCompletions1() throws Throwable { - if (analyzer == null) { - return; - } - getCompletions("Window {\n\tproperty int height\n\the|\n}", - new QMLTernCompletion("height", "number", "test1.qml")); - } - - @Test - public void testCompletions2() throws Throwable { - if (analyzer == null) { - return; - } - getCompletions("Window {\n\tproperty int height\n\tproperty int width\n\tproperty string text\n\t|\n}", - new QMLTernCompletion("height", "number", "test1.qml"), - new QMLTernCompletion("text", "string", "test1.qml"), - new QMLTernCompletion("width", "number", "test1.qml")); - } - - @Test - public void testCompletions3() throws Throwable { - if (analyzer == null) { - return; - } - getCompletions("Window {\n\tproperty int height\n\tObject {\n\t\t|\n\t}\n}"); - } - - @Test - public void testCompletions4() throws Throwable { - if (analyzer == null) { - return; - } - getCompletions("Window {\n\tproperty var test: |\n}", - new QMLTernCompletion("decodeURI", "fn(uri: string) -> string", "ecma5"), - new QMLTernCompletion("decodeURIComponent", "fn(uri: string) -> string", "ecma5"), - new QMLTernCompletion("encodeURI", "fn(uri: string) -> string", "ecma5"), - new QMLTernCompletion("encodeURIComponent", "fn(uri: string) -> string", "ecma5"), - new QMLTernCompletion("eval", "fn(code: string)", "ecma5"), - new QMLTernCompletion("isFinite", "fn(value: number) -> bool", "ecma5"), - new QMLTernCompletion("isNaN", "fn(value: number) -> bool", "ecma5"), - new QMLTernCompletion("parseFloat", "fn(string: string) -> number", "ecma5"), - new QMLTernCompletion("parseInt", "fn(string: string, radix?: number) -> number", "ecma5"), - new QMLTernCompletion("test", "?", "test1.qml"), new QMLTernCompletion("undefined", "?", "ecma5"), - new QMLTernCompletion("Array", "fn(size: number)", "ecma5"), - new QMLTernCompletion("Boolean", "fn(value: ?) -> bool", "ecma5"), - new QMLTernCompletion("Date", "fn(ms: number)", "ecma5"), - new QMLTernCompletion("Error", "fn(message: string)", "ecma5"), - new QMLTernCompletion("EvalError", "fn(message: string)", "ecma5"), - new QMLTernCompletion("Function", "fn(body: string) -> fn()", "ecma5"), - new QMLTernCompletion("Infinity", "number", "ecma5"), new QMLTernCompletion("JSON", "JSON", "ecma5"), - new QMLTernCompletion("Math", "Math", "ecma5"), new QMLTernCompletion("NaN", "number", "ecma5"), - new QMLTernCompletion("Number", "fn(value: ?) -> number", "ecma5"), - new QMLTernCompletion("Object", "fn()", "ecma5"), - new QMLTernCompletion("RangeError", "fn(message: string)", "ecma5"), - new QMLTernCompletion("ReferenceError", "fn(message: string)", "ecma5"), - new QMLTernCompletion("RegExp", "fn(source: string, flags?: string)", "ecma5"), - new QMLTernCompletion("String", "fn(value: ?) -> string", "ecma5"), - new QMLTernCompletion("SyntaxError", "fn(message: string)", "ecma5"), - new QMLTernCompletion("TypeError", "fn(message: string)", "ecma5"), - new QMLTernCompletion("URIError", "fn(message: string)", "ecma5")); - } - - @Test - public void testCompletions5() throws Throwable { - if (analyzer == null) { - return; - } - getCompletions("Window {\n\ttest: |\n}", - new QMLTernCompletion("decodeURI", "fn(uri: string) -> string", "ecma5"), - new QMLTernCompletion("decodeURIComponent", "fn(uri: string) -> string", "ecma5"), - new QMLTernCompletion("encodeURI", "fn(uri: string) -> string", "ecma5"), - new QMLTernCompletion("encodeURIComponent", "fn(uri: string) -> string", "ecma5"), - new QMLTernCompletion("eval", "fn(code: string)", "ecma5"), - new QMLTernCompletion("isFinite", "fn(value: number) -> bool", "ecma5"), - new QMLTernCompletion("isNaN", "fn(value: number) -> bool", "ecma5"), - new QMLTernCompletion("parseFloat", "fn(string: string) -> number", "ecma5"), - new QMLTernCompletion("parseInt", "fn(string: string, radix?: number) -> number", "ecma5"), - new QMLTernCompletion("undefined", "?", "ecma5"), - new QMLTernCompletion("Array", "fn(size: number)", "ecma5"), - new QMLTernCompletion("Boolean", "fn(value: ?) -> bool", "ecma5"), - new QMLTernCompletion("Date", "fn(ms: number)", "ecma5"), - new QMLTernCompletion("Error", "fn(message: string)", "ecma5"), - new QMLTernCompletion("EvalError", "fn(message: string)", "ecma5"), - new QMLTernCompletion("Function", "fn(body: string) -> fn()", "ecma5"), - new QMLTernCompletion("Infinity", "number", "ecma5"), new QMLTernCompletion("JSON", "JSON", "ecma5"), - new QMLTernCompletion("Math", "Math", "ecma5"), new QMLTernCompletion("NaN", "number", "ecma5"), - new QMLTernCompletion("Number", "fn(value: ?) -> number", "ecma5"), - new QMLTernCompletion("Object", "fn()", "ecma5"), - new QMLTernCompletion("RangeError", "fn(message: string)", "ecma5"), - new QMLTernCompletion("ReferenceError", "fn(message: string)", "ecma5"), - new QMLTernCompletion("RegExp", "fn(source: string, flags?: string)", "ecma5"), - new QMLTernCompletion("String", "fn(value: ?) -> string", "ecma5"), - new QMLTernCompletion("SyntaxError", "fn(message: string)", "ecma5"), - new QMLTernCompletion("TypeError", "fn(message: string)", "ecma5"), - new QMLTernCompletion("URIError", "fn(message: string)", "ecma5")); - } - - @Test - public void testCompletions6() throws Throwable { - if (analyzer == null) { - return; - } - getCompletions("Window {\n\ttest: {\n\t\t|\n\t}\n}", - new QMLTernCompletion("decodeURI", "fn(uri: string) -> string", "ecma5"), - new QMLTernCompletion("decodeURIComponent", "fn(uri: string) -> string", "ecma5"), - new QMLTernCompletion("encodeURI", "fn(uri: string) -> string", "ecma5"), - new QMLTernCompletion("encodeURIComponent", "fn(uri: string) -> string", "ecma5"), - new QMLTernCompletion("eval", "fn(code: string)", "ecma5"), - new QMLTernCompletion("isFinite", "fn(value: number) -> bool", "ecma5"), - new QMLTernCompletion("isNaN", "fn(value: number) -> bool", "ecma5"), - new QMLTernCompletion("parseFloat", "fn(string: string) -> number", "ecma5"), - new QMLTernCompletion("parseInt", "fn(string: string, radix?: number) -> number", "ecma5"), - new QMLTernCompletion("undefined", "?", "ecma5"), - new QMLTernCompletion("Array", "fn(size: number)", "ecma5"), - new QMLTernCompletion("Boolean", "fn(value: ?) -> bool", "ecma5"), - new QMLTernCompletion("Date", "fn(ms: number)", "ecma5"), - new QMLTernCompletion("Error", "fn(message: string)", "ecma5"), - new QMLTernCompletion("EvalError", "fn(message: string)", "ecma5"), - new QMLTernCompletion("Function", "fn(body: string) -> fn()", "ecma5"), - new QMLTernCompletion("Infinity", "number", "ecma5"), new QMLTernCompletion("JSON", "JSON", "ecma5"), - new QMLTernCompletion("Math", "Math", "ecma5"), new QMLTernCompletion("NaN", "number", "ecma5"), - new QMLTernCompletion("Number", "fn(value: ?) -> number", "ecma5"), - new QMLTernCompletion("Object", "fn()", "ecma5"), - new QMLTernCompletion("RangeError", "fn(message: string)", "ecma5"), - new QMLTernCompletion("ReferenceError", "fn(message: string)", "ecma5"), - new QMLTernCompletion("RegExp", "fn(source: string, flags?: string)", "ecma5"), - new QMLTernCompletion("String", "fn(value: ?) -> string", "ecma5"), - new QMLTernCompletion("SyntaxError", "fn(message: string)", "ecma5"), - new QMLTernCompletion("TypeError", "fn(message: string)", "ecma5"), - new QMLTernCompletion("URIError", "fn(message: string)", "ecma5")); - } - - @Test - public void testCompletions7() throws Throwable { - if (analyzer == null) { - return; - } - getCompletions("Window {\n\tfunction test() {\n\t\t|\n\t}\n}", - new QMLTernCompletion("decodeURI", "fn(uri: string) -> string", "ecma5"), - new QMLTernCompletion("decodeURIComponent", "fn(uri: string) -> string", "ecma5"), - new QMLTernCompletion("encodeURI", "fn(uri: string) -> string", "ecma5"), - new QMLTernCompletion("encodeURIComponent", "fn(uri: string) -> string", "ecma5"), - new QMLTernCompletion("eval", "fn(code: string)", "ecma5"), - new QMLTernCompletion("isFinite", "fn(value: number) -> bool", "ecma5"), - new QMLTernCompletion("isNaN", "fn(value: number) -> bool", "ecma5"), - new QMLTernCompletion("parseFloat", "fn(string: string) -> number", "ecma5"), - new QMLTernCompletion("parseInt", "fn(string: string, radix?: number) -> number", "ecma5"), - new QMLTernCompletion("test", "fn()", "test1.qml"), new QMLTernCompletion("undefined", "?", "ecma5"), - new QMLTernCompletion("Array", "fn(size: number)", "ecma5"), - new QMLTernCompletion("Boolean", "fn(value: ?) -> bool", "ecma5"), - new QMLTernCompletion("Date", "fn(ms: number)", "ecma5"), - new QMLTernCompletion("Error", "fn(message: string)", "ecma5"), - new QMLTernCompletion("EvalError", "fn(message: string)", "ecma5"), - new QMLTernCompletion("Function", "fn(body: string) -> fn()", "ecma5"), - new QMLTernCompletion("Infinity", "number", "ecma5"), new QMLTernCompletion("JSON", "JSON", "ecma5"), - new QMLTernCompletion("Math", "Math", "ecma5"), new QMLTernCompletion("NaN", "number", "ecma5"), - new QMLTernCompletion("Number", "fn(value: ?) -> number", "ecma5"), - new QMLTernCompletion("Object", "fn()", "ecma5"), - new QMLTernCompletion("RangeError", "fn(message: string)", "ecma5"), - new QMLTernCompletion("ReferenceError", "fn(message: string)", "ecma5"), - new QMLTernCompletion("RegExp", "fn(source: string, flags?: string)", "ecma5"), - new QMLTernCompletion("String", "fn(value: ?) -> string", "ecma5"), - new QMLTernCompletion("SyntaxError", "fn(message: string)", "ecma5"), - new QMLTernCompletion("TypeError", "fn(message: string)", "ecma5"), - new QMLTernCompletion("URIError", "fn(message: string)", "ecma5")); - } -} diff --git a/qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/QMLDirectoryLexerTests.java b/qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/QMLDirectoryLexerTests.java deleted file mode 100644 index e93627d2b56..00000000000 --- a/qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/QMLDirectoryLexerTests.java +++ /dev/null @@ -1,212 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.tests; - -import static org.junit.Assert.assertEquals; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; - -import org.eclipse.cdt.internal.qt.core.location.Position; -import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryLexer; -import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryLexer.Token; -import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryLexer.TokenType; -import org.junit.Test; - -@SuppressWarnings("nls") -public class QMLDirectoryLexerTests { - private void assertToken(TokenType type, String text, int start, int end, Position locStart, Position locEnd, - Token actual) { - // Check token type and text - assertEquals("Unexpected token type", type, actual.getType()); - assertEquals("Unexpected token text", text, actual.getText()); - - // Check position offsets - assertEquals("Unexpected start position", start, actual.getStart()); - assertEquals("Unexpected end position", end, actual.getEnd()); - - // Check SourceLocation start - assertEquals("Unexpected location start line", locStart.getLine(), actual.getLocation().getStart().getLine()); - assertEquals("Unexpected location start column", locStart.getColumn(), - actual.getLocation().getStart().getColumn()); - - // Check SourceLocation end - assertEquals("Unexpected location end line", locEnd.getLine(), actual.getLocation().getEnd().getLine()); - assertEquals("Unexpected location end column", locEnd.getColumn(), actual.getLocation().getEnd().getColumn()); - } - - private InputStream createInputStream(String s) { - return new ByteArrayInputStream(s.getBytes()); - } - - @Test - public void testCommentToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(new ByteArrayInputStream("# This is a comment".getBytes())); - assertToken(TokenType.COMMENT, "# This is a comment", 0, 19, new Position(1, 0), new Position(1, 19), - lexer.nextToken(false)); - } - - @Test - public void testMultipleCommentTokens() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("# This is a comment\n# This is another comment\n")); - assertToken(TokenType.COMMENT, "# This is a comment", 0, 19, new Position(1, 0), new Position(1, 19), - lexer.nextToken(false)); - assertEquals(TokenType.COMMAND_END, lexer.nextToken(false).getType()); - assertToken(TokenType.COMMENT, "# This is another comment", 20, 45, new Position(2, 0), new Position(2, 25), - lexer.nextToken(false)); - assertEquals(TokenType.COMMAND_END, lexer.nextToken(false).getType()); - assertEquals(TokenType.EOF, lexer.nextToken(false).getType()); - } - - @Test - public void testModuleToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("module")); - assertToken(TokenType.MODULE, "module", 0, 6, new Position(1, 0), new Position(1, 6), lexer.nextToken()); - } - - @Test - public void testTypeInfoToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("typeinfo")); - assertToken(TokenType.TYPEINFO, "typeinfo", 0, 8, new Position(1, 0), new Position(1, 8), lexer.nextToken()); - } - - @Test - public void testSingletonToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("singleton")); - assertToken(TokenType.SINGLETON, "singleton", 0, 9, new Position(1, 0), new Position(1, 9), lexer.nextToken()); - } - - @Test - public void testInternalToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("internal")); - assertToken(TokenType.INTERNAL, "internal", 0, 8, new Position(1, 0), new Position(1, 8), lexer.nextToken()); - } - - @Test - public void testPluginToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("plugin")); - assertToken(TokenType.PLUGIN, "plugin", 0, 6, new Position(1, 0), new Position(1, 6), lexer.nextToken()); - } - - @Test - public void testClassnameToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("classname")); - assertToken(TokenType.CLASSNAME, "classname", 0, 9, new Position(1, 0), new Position(1, 9), lexer.nextToken()); - } - - @Test - public void testDependsToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("depends")); - assertToken(TokenType.DEPENDS, "depends", 0, 7, new Position(1, 0), new Position(1, 7), lexer.nextToken()); - } - - @Test - public void testDesignerSupportedToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("designersupported")); - assertToken(TokenType.DESIGNERSUPPORTED, "designersupported", 0, 17, new Position(1, 0), new Position(1, 17), - lexer.nextToken()); - } - - @Test - public void testWordToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("QtQuick.Control")); - assertToken(TokenType.WORD, "QtQuick.Control", 0, 15, new Position(1, 0), new Position(1, 15), - lexer.nextToken()); - } - - @Test - public void testWordTokenContainsKeyword() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("plugins.test")); - assertToken(TokenType.WORD, "plugins.test", 0, 12, new Position(1, 0), new Position(1, 12), lexer.nextToken()); - } - - @Test - public void testWordTokenAsRelativePath() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("./test/something/")); - assertToken(TokenType.WORD, "./test/something/", 0, 17, new Position(1, 0), new Position(1, 17), - lexer.nextToken()); - } - - @Test - public void testWordTokenAsAbsoluteWindowsPath() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("C:\\Users\\someone\\test\\something\\")); - assertToken(TokenType.WORD, "C:\\Users\\someone\\test\\something\\", 0, 32, new Position(1, 0), - new Position(1, 32), lexer.nextToken()); - } - - @Test - public void testWordTokenAsAbsoluteUnixPath() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("/usr/local/test/something/")); - assertToken(TokenType.WORD, "/usr/local/test/something/", 0, 26, new Position(1, 0), new Position(1, 26), - lexer.nextToken()); - } - - @Test - public void testDecimalToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("2.3")); - assertToken(TokenType.DECIMAL, "2.3", 0, 3, new Position(1, 0), new Position(1, 3), lexer.nextToken()); - } - - @Test - public void testIntegerToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("3")); - assertToken(TokenType.INTEGER, "3", 0, 1, new Position(1, 0), new Position(1, 1), lexer.nextToken()); - } - - @Test - public void testWhitespaceToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream(" \t\n")); - assertToken(TokenType.WHITESPACE, " \t", 0, 2, new Position(1, 0), new Position(1, 2), lexer.nextToken(false)); - } - - @Test - public void testCommandEndToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("\n")); - assertToken(TokenType.COMMAND_END, "\\n", 0, 1, new Position(1, 0), new Position(1, 1), lexer.nextToken()); - } - - @Test - public void testEOFToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("")); - assertToken(TokenType.EOF, "", 0, 0, new Position(1, 0), new Position(1, 0), lexer.nextToken()); - } - - @Test - public void testEOFTokenAfterCommand() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("\n")); - lexer.nextToken(); - assertToken(TokenType.EOF, "", 1, 1, new Position(2, 0), new Position(2, 0), lexer.nextToken()); - } -} diff --git a/qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/QMLDirectoryParserTests.java b/qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/QMLDirectoryParserTests.java deleted file mode 100644 index d1515119a00..00000000000 --- a/qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/QMLDirectoryParserTests.java +++ /dev/null @@ -1,309 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.tests; - -import static org.hamcrest.CoreMatchers.instanceOf; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.fail; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; - -import org.eclipse.cdt.internal.qt.core.location.Position; -import org.eclipse.cdt.qt.core.location.IPosition; -import org.eclipse.cdt.qt.core.qmldir.IQDirAST; -import org.eclipse.cdt.qt.core.qmldir.IQDirASTNode; -import org.eclipse.cdt.qt.core.qmldir.IQDirClassnameCommand; -import org.eclipse.cdt.qt.core.qmldir.IQDirCommentCommand; -import org.eclipse.cdt.qt.core.qmldir.IQDirDependsCommand; -import org.eclipse.cdt.qt.core.qmldir.IQDirDesignerSupportedCommand; -import org.eclipse.cdt.qt.core.qmldir.IQDirInternalCommand; -import org.eclipse.cdt.qt.core.qmldir.IQDirModuleCommand; -import org.eclipse.cdt.qt.core.qmldir.IQDirPluginCommand; -import org.eclipse.cdt.qt.core.qmldir.IQDirResourceCommand; -import org.eclipse.cdt.qt.core.qmldir.IQDirSingletonCommand; -import org.eclipse.cdt.qt.core.qmldir.IQDirSyntaxError; -import org.eclipse.cdt.qt.core.qmldir.IQDirTypeInfoCommand; -import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryParser; -import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryParser.SyntaxError; -import org.junit.Test; - -@SuppressWarnings("nls") -public class QMLDirectoryParserTests { - - public void assertLocation(int start, int end, IPosition locStart, IPosition locEnd, IQDirASTNode node) { - // Check position offsets - assertEquals("Unexpected start position", start, node.getStart()); - assertEquals("Unexpected end position", end, node.getEnd()); - - // Check SourceLocation start - assertEquals("Unexpected location start line", locStart.getLine(), node.getLocation().getStart().getLine()); - assertEquals("Unexpected location start column", locStart.getColumn(), - node.getLocation().getStart().getColumn()); - } - - private InputStream createInputStream(String s) { - return new ByteArrayInputStream(s.getBytes()); - } - - @Test - public void testModuleCommand() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("module QtQuick.Controls\n"), false); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirModuleCommand.class)); - IQDirModuleCommand mod = (IQDirModuleCommand) ast.getCommands().get(0); - assertEquals("Unexpected qualified ID", "QtQuick.Controls", mod.getModuleIdentifier().getText()); - assertLocation(0, 24, new Position(1, 0), new Position(1, 24), mod); - } - - @Test - public void testModuleNoIdentifier() { - try { - QMLDirectoryParser parser = new QMLDirectoryParser(); - parser.parse(createInputStream("module\n"), false); - fail("Parser did not throw SyntaxError"); - } catch (SyntaxError e) { - assertEquals("Unexpected token '\\n' (1:6)", e.getMessage()); - } - } - - @Test - public void testSingletonCommand() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("singleton Singleton 2.3 Singleton.qml\n"), false); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirSingletonCommand.class)); - IQDirSingletonCommand singleton = (IQDirSingletonCommand) ast.getCommands().get(0); - assertEquals("Unexpected type name", "Singleton", singleton.getTypeName().getText()); - assertEquals("Unexpected initial version", "2.3", singleton.getInitialVersion().getVersionString()); - assertEquals("Unexpected file name", "Singleton.qml", singleton.getFile().getText()); - assertLocation(0, 38, new Position(1, 0), new Position(1, 38), singleton); - } - - @Test - public void testInvalidVersionNumber() { - try { - QMLDirectoryParser parser = new QMLDirectoryParser(); - parser.parse(createInputStream("singleton Singleton 2 Singleton.qml\n"), false); - fail("Parser did not throw SyntaxError"); - } catch (SyntaxError e) { - assertEquals("Unexpected token '2' (1:20)", e.getMessage()); - } - } - - @Test - public void testInternalCommand() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("internal MyPrivateType MyPrivateType.qml\n"), false); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirInternalCommand.class)); - IQDirInternalCommand internal = (IQDirInternalCommand) ast.getCommands().get(0); - assertEquals("Unexpected type name", "MyPrivateType", internal.getTypeName().getText()); - assertEquals("Unexpected file name", "MyPrivateType.qml", internal.getFile().getText()); - assertLocation(0, 41, new Position(1, 0), new Position(1, 41), internal); - } - - @Test - public void testResourceCommand() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("MyScript 1.0 MyScript.qml\n"), false); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirResourceCommand.class)); - IQDirResourceCommand resource = (IQDirResourceCommand) ast.getCommands().get(0); - assertEquals("Unexpected type name", "MyScript", resource.getResourceIdentifier().getText()); - assertEquals("Unexpected initial version", "1.0", resource.getInitialVersion().getVersionString()); - assertEquals("Unexpected file name", "MyScript.qml", resource.getFile().getText()); - assertLocation(0, 26, new Position(1, 0), new Position(1, 26), resource); - } - - @Test - public void testPluginCommand() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("plugin MyPluginLibrary\n"), false); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirPluginCommand.class)); - IQDirPluginCommand plugin = (IQDirPluginCommand) ast.getCommands().get(0); - assertEquals("Unexpected identifier", "MyPluginLibrary", plugin.getName().getText()); - assertEquals("Unexpected path", null, plugin.getPath()); - assertLocation(0, 23, new Position(1, 0), new Position(1, 23), plugin); - } - - @Test - public void testPluginCommandWithPath() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("plugin MyPluginLibrary ./lib/\n"), false); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirPluginCommand.class)); - IQDirPluginCommand plugin = (IQDirPluginCommand) ast.getCommands().get(0); - assertEquals("Unexpected identifier", "MyPluginLibrary", plugin.getName().getText()); - assertEquals("Unexpected path", "./lib/", plugin.getPath().getText()); - assertLocation(0, 30, new Position(1, 0), new Position(1, 30), plugin); - } - - @Test - public void testClassnameCommand() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("classname MyClass\n"), false); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirClassnameCommand.class)); - IQDirClassnameCommand classname = (IQDirClassnameCommand) ast.getCommands().get(0); - assertEquals("Unexpected class name", "MyClass", classname.getIdentifier().getText()); - assertLocation(0, 18, new Position(1, 0), new Position(1, 18), classname); - } - - @Test - public void testTypeInfoCommand() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("typeinfo mymodule.qmltypes\n"), false); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirTypeInfoCommand.class)); - IQDirTypeInfoCommand typeinfo = (IQDirTypeInfoCommand) ast.getCommands().get(0); - assertEquals("Unexpected file name", "mymodule.qmltypes", typeinfo.getFile().getText()); - assertLocation(0, 27, new Position(1, 0), new Position(1, 27), typeinfo); - } - - @Test - public void testDependsCommand() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("depends MyOtherModule 1.0\n"), false); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirDependsCommand.class)); - IQDirDependsCommand depends = (IQDirDependsCommand) ast.getCommands().get(0); - assertEquals("Unexpected module identifier", "MyOtherModule", depends.getModuleIdentifier().getText()); - assertEquals("Unexpected initial version", "1.0", depends.getInitialVersion().getVersionString()); - assertLocation(0, 26, new Position(1, 0), new Position(1, 26), depends); - } - - @Test - public void testDesignerSupportedCommand() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("designersupported\n"), false); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirDesignerSupportedCommand.class)); - assertLocation(0, 18, new Position(1, 0), new Position(1, 18), ast.getCommands().get(0)); - } - - @Test - public void testCommentCommand() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("# This is a comment command\n"), false); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirCommentCommand.class)); - IQDirCommentCommand comment = (IQDirCommentCommand) ast.getCommands().get(0); - assertEquals("Unexpected text", "# This is a comment command", comment.getText()); - } - - @Test - public void testSyntaxErrorCommand() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("classname")); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirSyntaxError.class)); - IQDirSyntaxError err = (IQDirSyntaxError) ast.getCommands().get(0); - assertEquals("Unexpected message", "Unexpected token 'EOF' (1:9)", err.getSyntaxError().getMessage()); - assertLocation(0, 9, new Position(1, 0), new Position(1, 9), err); - } - - @Test - public void testSyntaxErrorCommandIncludesWholeLine() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("classname class extra\n")); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirSyntaxError.class)); - IQDirSyntaxError err = (IQDirSyntaxError) ast.getCommands().get(0); - assertEquals("Unexpected message", "Expected token '\\n' or 'EOF', but saw 'extra' (1:16)", - err.getSyntaxError().getMessage()); - assertLocation(0, 22, new Position(1, 0), new Position(1, 22), err); - } - - @Test - public void testExampleQMLDirFile() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("module QtQuick\n" + "plugin qtquick2plugin\n" - + "classname QtQuick2Plugin\n" + "typeinfo plugins.qmltypes\n" + "designersupported\n")); - - assertEquals("Unexpected command list size", 5, ast.getCommands().size()); - // Module Command (index 0) - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirModuleCommand.class)); - IQDirModuleCommand mod = (IQDirModuleCommand) ast.getCommands().get(0); - assertEquals("Unexpected module qualified ID", "QtQuick", mod.getModuleIdentifier().getText()); - // Plugin Command (index 1) - assertThat("Unexpected command", ast.getCommands().get(1), instanceOf(IQDirPluginCommand.class)); - IQDirPluginCommand plugin = (IQDirPluginCommand) ast.getCommands().get(1); - assertEquals("Unexpected plugin identifier", "qtquick2plugin", plugin.getName().getText()); - assertEquals("Unexpected plugin path", null, plugin.getPath()); - // Classname Command (index 2) - assertThat("Unexpected command", ast.getCommands().get(2), instanceOf(IQDirClassnameCommand.class)); - IQDirClassnameCommand classname = (IQDirClassnameCommand) ast.getCommands().get(2); - assertEquals("Unexpected class name", "QtQuick2Plugin", classname.getIdentifier().getText()); - // Type Info Command (index 3) - assertThat("Unexpected command", ast.getCommands().get(3), instanceOf(IQDirTypeInfoCommand.class)); - IQDirTypeInfoCommand typeinfo = (IQDirTypeInfoCommand) ast.getCommands().get(3); - assertEquals("Unexpected type info file name", "plugins.qmltypes", typeinfo.getFile().getText()); - // Designer Supported Command (index 4) - assertThat("Unexpected command", ast.getCommands().get(4), instanceOf(IQDirDesignerSupportedCommand.class)); - } - - @Test - public void testExampleQMLDirFileWithError() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("module QtQuick\n" + "plugin qtquick2plugin\n" - + "classnames QtQuick2Plugin\n" + "typeinfo plugins.qmltypes\n" + "designersupported\n")); - - assertEquals("Unexpected command list size", 5, ast.getCommands().size()); - // Module Command (index 0) - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirModuleCommand.class)); - IQDirModuleCommand mod = (IQDirModuleCommand) ast.getCommands().get(0); - assertEquals("Unexpected module qualified ID", "QtQuick", mod.getModuleIdentifier().getText()); - // Plugin Command (index 1) - assertThat("Unexpected command", ast.getCommands().get(1), instanceOf(IQDirPluginCommand.class)); - IQDirPluginCommand plugin = (IQDirPluginCommand) ast.getCommands().get(1); - assertEquals("Unexpected plugin identifier", "qtquick2plugin", plugin.getName().getText()); - assertEquals("Unexpected plugin path", null, plugin.getPath()); - // Syntax Error Command (index 2) - assertThat("Unexpected command", ast.getCommands().get(2), instanceOf(IQDirSyntaxError.class)); - IQDirSyntaxError err = (IQDirSyntaxError) ast.getCommands().get(2); - assertEquals("Unexpected error message", "Unexpected token 'QtQuick2Plugin' (3:11)", - err.getSyntaxError().getMessage()); - // Type Info Command (index 3) - assertThat("Unexpected command", ast.getCommands().get(3), instanceOf(IQDirTypeInfoCommand.class)); - IQDirTypeInfoCommand typeinfo = (IQDirTypeInfoCommand) ast.getCommands().get(3); - assertEquals("Unexpected type info file name", "plugins.qmltypes", typeinfo.getFile().getText()); - // Designer Supported Command (index 4) - assertThat("Unexpected command", ast.getCommands().get(4), instanceOf(IQDirDesignerSupportedCommand.class)); - } - - @Test - public void testParseTwoDifferentStreams() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - - // Parse module QtQuick.Controls - IQDirAST ast = parser.parse(createInputStream("module QtQuick.Controls\n"), false); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirModuleCommand.class)); - IQDirModuleCommand mod = (IQDirModuleCommand) ast.getCommands().get(0); - assertEquals("Unexpected qualified ID", "QtQuick.Controls", mod.getModuleIdentifier().getText()); - assertLocation(0, 24, new Position(1, 0), new Position(1, 24), mod); - - // Parse a second module MyModule - ast = parser.parse(createInputStream("module MyModule\n"), false); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirModuleCommand.class)); - mod = (IQDirModuleCommand) ast.getCommands().get(0); - assertEquals("Unexpected qualified ID", "MyModule", mod.getModuleIdentifier().getText()); - assertLocation(0, 16, new Position(1, 0), new Position(1, 16), mod); - } -} diff --git a/qt/org.eclipse.cdt.qt.core/.classpath b/qt/org.eclipse.cdt.qt.core/.classpath deleted file mode 100644 index 81fe078c20c..00000000000 --- a/qt/org.eclipse.cdt.qt.core/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/qt/org.eclipse.cdt.qt.core/.project b/qt/org.eclipse.cdt.qt.core/.project deleted file mode 100644 index 8aaa1e708b1..00000000000 --- a/qt/org.eclipse.cdt.qt.core/.project +++ /dev/null @@ -1,34 +0,0 @@ - - - org.eclipse.cdt.qt.core - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - org.eclipse.pde.api.tools.apiAnalysisBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - org.eclipse.pde.api.tools.apiAnalysisNature - - diff --git a/qt/org.eclipse.cdt.qt.core/.settings/org.eclipse.core.resources.prefs b/qt/org.eclipse.cdt.qt.core/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 99f26c0203a..00000000000 --- a/qt/org.eclipse.cdt.qt.core/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/qt/org.eclipse.cdt.qt.core/.settings/org.eclipse.jdt.core.prefs b/qt/org.eclipse.cdt.qt.core/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 9df862f8d49..00000000000 --- a/qt/org.eclipse.cdt.qt.core/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,486 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.builder.cleanOutputFolder=clean -org.eclipse.jdt.core.builder.duplicateResourceTask=warning -org.eclipse.jdt.core.builder.invalidClasspath=abort -org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore -org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch, *.xtend -org.eclipse.jdt.core.circularClasspath=error -org.eclipse.jdt.core.classpath.exclusionPatterns=enabled -org.eclipse.jdt.core.classpath.mainOnlyProjectHasTestOnlyDependency=error -org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled -org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error -org.eclipse.jdt.core.codeComplete.argumentPrefixes= -org.eclipse.jdt.core.codeComplete.argumentSuffixes= -org.eclipse.jdt.core.codeComplete.fieldPrefixes= -org.eclipse.jdt.core.codeComplete.fieldSuffixes= -org.eclipse.jdt.core.codeComplete.localPrefixes= -org.eclipse.jdt.core.codeComplete.localSuffixes= -org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= -org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= -org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled -org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore -org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull -org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= -org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullable.secondary= -org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.methodParameters=generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=17 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.doc.comment.support=enabled -org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 -org.eclipse.jdt.core.compiler.problem.APILeak=warning -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=warning -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=warning -org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore -org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=warning -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=error -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.invalidJavadoc=ignore -org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error -org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag -org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning -org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning -org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error -org.eclipse.jdt.core.compiler.problem.nullReference=error -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error -org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning -org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning -org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning -org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning -org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore -org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore -org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning -org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled -org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.release=enabled -org.eclipse.jdt.core.compiler.source=17 -org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false -org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 -org.eclipse.jdt.core.formatter.align_type_members_on_columns=false -org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false -org.eclipse.jdt.core.formatter.align_with_spaces=false -org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 -org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 -org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 -org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 -org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 -org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 -org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 -org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 -org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 -org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 -org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0 -org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0 -org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 -org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_after_package=1 -org.eclipse.jdt.core.formatter.blank_lines_before_field=0 -org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 -org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 -org.eclipse.jdt.core.formatter.blank_lines_before_method=1 -org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 -org.eclipse.jdt.core.formatter.blank_lines_before_package=0 -org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 -org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 -org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=true -org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false -org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=true -org.eclipse.jdt.core.formatter.comment.format_block_comments=false -org.eclipse.jdt.core.formatter.comment.format_header=false -org.eclipse.jdt.core.formatter.comment.format_html=true -org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false -org.eclipse.jdt.core.formatter.comment.format_line_comments=false -org.eclipse.jdt.core.formatter.comment.format_source_code=true -org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false -org.eclipse.jdt.core.formatter.comment.indent_root_tags=false -org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert -org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert -org.eclipse.jdt.core.formatter.comment.line_length=80 -org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true -org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true -org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false -org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=2 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 -org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off -org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on -org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true -org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_empty_lines=false -org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true -org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false -org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert -org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert -org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert -org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert -org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert -org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert -org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.join_lines_in_comments=true -org.eclipse.jdt.core.formatter.join_wrapped_lines=true -org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false -org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false -org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false -org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false -org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false -org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false -org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false -org.eclipse.jdt.core.formatter.lineSplit=120 -org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 -org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true -org.eclipse.jdt.core.formatter.tabulation.char=tab -org.eclipse.jdt.core.formatter.tabulation.size=4 -org.eclipse.jdt.core.formatter.use_on_off_tags=true -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true -org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true -org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true -org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true -org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true -org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true -org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true -org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true -org.eclipse.jdt.core.incompatibleJDKLevel=ignore -org.eclipse.jdt.core.incompleteClasspath=error -org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter diff --git a/qt/org.eclipse.cdt.qt.core/.settings/org.eclipse.jdt.launching.prefs b/qt/org.eclipse.cdt.qt.core/.settings/org.eclipse.jdt.launching.prefs deleted file mode 100644 index f8a131b56e0..00000000000 --- a/qt/org.eclipse.cdt.qt.core/.settings/org.eclipse.jdt.launching.prefs +++ /dev/null @@ -1,3 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.launching.PREF_COMPILER_COMPLIANCE_DOES_NOT_MATCH_JRE=warning -org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=warning diff --git a/qt/org.eclipse.cdt.qt.core/.settings/org.eclipse.jdt.ui.prefs b/qt/org.eclipse.cdt.qt.core/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index d35ba9b5231..00000000000 --- a/qt/org.eclipse.cdt.qt.core/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,213 +0,0 @@ -cleanup.add_all=false -cleanup.add_default_serial_version_id=true -cleanup.add_generated_serial_version_id=false -cleanup.add_missing_annotations=true -cleanup.add_missing_deprecated_annotations=true -cleanup.add_missing_methods=false -cleanup.add_missing_nls_tags=false -cleanup.add_missing_override_annotations=true -cleanup.add_missing_override_annotations_interface_methods=true -cleanup.add_serial_version_id=false -cleanup.always_use_blocks=true -cleanup.always_use_parentheses_in_expressions=false -cleanup.always_use_this_for_non_static_field_access=false -cleanup.always_use_this_for_non_static_method_access=false -cleanup.array_with_curly=false -cleanup.arrays_fill=false -cleanup.bitwise_conditional_expression=false -cleanup.boolean_literal=false -cleanup.boolean_value_rather_than_comparison=false -cleanup.break_loop=false -cleanup.collection_cloning=false -cleanup.comparing_on_criteria=false -cleanup.comparison_statement=false -cleanup.controlflow_merge=false -cleanup.convert_functional_interfaces=false -cleanup.convert_to_enhanced_for_loop=false -cleanup.convert_to_enhanced_for_loop_if_loop_var_used=true -cleanup.convert_to_switch_expressions=false -cleanup.correct_indentation=false -cleanup.do_while_rather_than_while=true -cleanup.double_negation=false -cleanup.else_if=false -cleanup.embedded_if=false -cleanup.evaluate_nullable=false -cleanup.extract_increment=false -cleanup.format_source_code=true -cleanup.format_source_code_changes_only=false -cleanup.hash=false -cleanup.if_condition=false -cleanup.insert_inferred_type_arguments=false -cleanup.instanceof=false -cleanup.instanceof_keyword=false -cleanup.invert_equals=false -cleanup.join=false -cleanup.lazy_logical_operator=false -cleanup.make_local_variable_final=true -cleanup.make_parameters_final=false -cleanup.make_private_fields_final=true -cleanup.make_type_abstract_if_missing_method=false -cleanup.make_variable_declarations_final=false -cleanup.map_cloning=false -cleanup.merge_conditional_blocks=false -cleanup.multi_catch=false -cleanup.never_use_blocks=false -cleanup.never_use_parentheses_in_expressions=true -cleanup.no_string_creation=false -cleanup.no_super=false -cleanup.number_suffix=false -cleanup.objects_equals=false -cleanup.one_if_rather_than_duplicate_blocks_that_fall_through=false -cleanup.operand_factorization=false -cleanup.organize_imports=true -cleanup.overridden_assignment=false -cleanup.plain_replacement=false -cleanup.precompile_regex=false -cleanup.primitive_comparison=false -cleanup.primitive_parsing=false -cleanup.primitive_rather_than_wrapper=false -cleanup.primitive_serialization=false -cleanup.pull_out_if_from_if_else=false -cleanup.pull_up_assignment=false -cleanup.push_down_negation=false -cleanup.qualify_static_field_accesses_with_declaring_class=false -cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -cleanup.qualify_static_member_accesses_with_declaring_class=false -cleanup.qualify_static_method_accesses_with_declaring_class=false -cleanup.reduce_indentation=false -cleanup.redundant_comparator=false -cleanup.redundant_falling_through_block_end=false -cleanup.remove_private_constructors=true -cleanup.remove_redundant_modifiers=false -cleanup.remove_redundant_semicolons=true -cleanup.remove_redundant_type_arguments=true -cleanup.remove_trailing_whitespaces=true -cleanup.remove_trailing_whitespaces_all=true -cleanup.remove_trailing_whitespaces_ignore_empty=false -cleanup.remove_unnecessary_array_creation=false -cleanup.remove_unnecessary_casts=true -cleanup.remove_unnecessary_nls_tags=false -cleanup.remove_unused_imports=true -cleanup.remove_unused_local_variables=false -cleanup.remove_unused_method_parameters=false -cleanup.remove_unused_private_fields=true -cleanup.remove_unused_private_members=false -cleanup.remove_unused_private_methods=true -cleanup.remove_unused_private_types=true -cleanup.return_expression=false -cleanup.simplify_lambda_expression_and_method_ref=false -cleanup.single_used_field=false -cleanup.sort_members=false -cleanup.sort_members_all=false -cleanup.standard_comparison=false -cleanup.static_inner_class=false -cleanup.strictly_equal_or_different=false -cleanup.stringbuffer_to_stringbuilder=false -cleanup.stringbuilder=false -cleanup.stringbuilder_for_local_vars=true -cleanup.stringconcat_to_textblock=false -cleanup.substring=false -cleanup.switch=false -cleanup.system_property=false -cleanup.system_property_boolean=false -cleanup.system_property_file_encoding=false -cleanup.system_property_file_separator=false -cleanup.system_property_line_separator=false -cleanup.system_property_path_separator=false -cleanup.ternary_operator=false -cleanup.try_with_resource=false -cleanup.unlooped_while=false -cleanup.unreachable_block=false -cleanup.use_anonymous_class_creation=false -cleanup.use_autoboxing=false -cleanup.use_blocks=false -cleanup.use_blocks_only_for_return_and_throw=false -cleanup.use_directly_map_method=false -cleanup.use_lambda=true -cleanup.use_parentheses_in_expressions=false -cleanup.use_string_is_blank=false -cleanup.use_this_for_non_static_field_access=false -cleanup.use_this_for_non_static_field_access_only_if_necessary=true -cleanup.use_this_for_non_static_method_access=false -cleanup.use_this_for_non_static_method_access_only_if_necessary=true -cleanup.use_unboxing=false -cleanup.use_var=false -cleanup.useless_continue=false -cleanup.useless_return=false -cleanup.valueof_rather_than_instantiation=false -cleanup_profile=_CDT -cleanup_settings_version=2 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_CDT -formatter_settings_version=14 -internal.default.compliance=user -org.eclipse.jdt.ui.exception.name=e -org.eclipse.jdt.ui.gettersetter.use.is=true -org.eclipse.jdt.ui.ignorelowercasenames=true -org.eclipse.jdt.ui.importorder=java;javax;org;com; -org.eclipse.jdt.ui.keywordthis=false -org.eclipse.jdt.ui.ondemandthreshold=1000 -org.eclipse.jdt.ui.overrideannotation=true -org.eclipse.jdt.ui.staticondemandthreshold=1000 -org.eclipse.jdt.ui.text.custom_code_templates= -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=true -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_missing_override_annotations_interface_methods=true -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_functional_interfaces=false -sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.correct_indentation=false -sp_cleanup.format_source_code=true -sp_cleanup.format_source_code_changes_only=false -sp_cleanup.insert_inferred_type_arguments=false -sp_cleanup.make_local_variable_final=true -sp_cleanup.make_parameters_final=false -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=false -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=true -sp_cleanup.organize_imports=true -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=false -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_redundant_modifiers=false -sp_cleanup.remove_redundant_semicolons=true -sp_cleanup.remove_redundant_type_arguments=true -sp_cleanup.remove_trailing_whitespaces=true -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=true -sp_cleanup.remove_unnecessary_nls_tags=false -sp_cleanup.remove_unused_imports=true -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_anonymous_class_creation=false -sp_cleanup.use_blocks=false -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_lambda=true -sp_cleanup.use_parentheses_in_expressions=false -sp_cleanup.use_this_for_non_static_field_access=false -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=false -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/qt/org.eclipse.cdt.qt.core/.settings/org.eclipse.pde.api.tools.prefs b/qt/org.eclipse.cdt.qt.core/.settings/org.eclipse.pde.api.tools.prefs deleted file mode 100644 index ec9fbf321d0..00000000000 --- a/qt/org.eclipse.cdt.qt.core/.settings/org.eclipse.pde.api.tools.prefs +++ /dev/null @@ -1,184 +0,0 @@ -ANNOTATION_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error -ANNOTATION_ELEMENT_TYPE_ADDED_FIELD=Error -ANNOTATION_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error -ANNOTATION_ELEMENT_TYPE_ADDED_INTERFACE_BOUNDS=Error -ANNOTATION_ELEMENT_TYPE_ADDED_METHOD=Error -ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error -ANNOTATION_ELEMENT_TYPE_ADDED_TYPE_MEMBER=Error -ANNOTATION_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -ANNOTATION_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error -ANNOTATION_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -ANNOTATION_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error -ANNOTATION_ELEMENT_TYPE_CHANGED_INTERFACE_BOUNDS=Error -ANNOTATION_ELEMENT_TYPE_CHANGED_RESTRICTIONS=Error -ANNOTATION_ELEMENT_TYPE_CHANGED_TO_CLASS=Error -ANNOTATION_ELEMENT_TYPE_CHANGED_TO_ENUM=Error -ANNOTATION_ELEMENT_TYPE_CHANGED_TO_INTERFACE=Error -ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD_WITHOUT_DEFAULT_VALUE=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD_WITH_DEFAULT_VALUE=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_PARAMETERS=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error -API_USE_SCAN_FIELD_SEVERITY=Error -API_USE_SCAN_METHOD_SEVERITY=Error -API_USE_SCAN_TYPE_SEVERITY=Error -CLASS_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error -CLASS_ELEMENT_TYPE_ADDED_FIELD=Error -CLASS_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error -CLASS_ELEMENT_TYPE_ADDED_INTERFACE_BOUNDS=Error -CLASS_ELEMENT_TYPE_ADDED_METHOD=Error -CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error -CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -CLASS_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error -CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERCLASS_SET=Error -CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -CLASS_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error -CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error -CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -CLASS_ELEMENT_TYPE_CHANGED_RESTRICTIONS=Error -CLASS_ELEMENT_TYPE_CHANGED_SUPERCLASS=Error -CLASS_ELEMENT_TYPE_CHANGED_TO_ANNOTATION=Error -CLASS_ELEMENT_TYPE_CHANGED_TO_ENUM=Error -CLASS_ELEMENT_TYPE_CHANGED_TO_INTERFACE=Error -CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -CLASS_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error -CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error -CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error -CLASS_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error -CLASS_ELEMENT_TYPE_REMOVED_INTERFACE_BOUNDS=Error -CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error -CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error -CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETERS=Error -CONSTRUCTOR_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error -CONSTRUCTOR_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error -CONSTRUCTOR_ELEMENT_TYPE_ADDED_INTERFACE_BOUNDS=Error -CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_TYPE_PARAMETER=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error -CONSTRUCTOR_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error -CONSTRUCTOR_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error -CONSTRUCTOR_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error -CONSTRUCTOR_ELEMENT_TYPE_REMOVED_INTERFACE_BOUNDS=Error -CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETERS=Error -ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -ENUM_ELEMENT_TYPE_CHANGED_RESTRICTIONS=Error -ENUM_ELEMENT_TYPE_CHANGED_TO_ANNOTATION=Error -ENUM_ELEMENT_TYPE_CHANGED_TO_CLASS=Error -ENUM_ELEMENT_TYPE_CHANGED_TO_INTERFACE=Error -ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error -ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error -ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error -ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -FIELD_ELEMENT_TYPE_ADDED_VALUE=Error -FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error -FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error -FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error -FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error -FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error -FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error -FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENTS=Error -FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error -ILLEGAL_EXTEND=Warning -ILLEGAL_IMPLEMENT=Warning -ILLEGAL_INSTANTIATE=Warning -ILLEGAL_OVERRIDE=Warning -ILLEGAL_REFERENCE=Warning -INTERFACE_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error -INTERFACE_ELEMENT_TYPE_ADDED_DEFAULT_METHOD=Error -INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error -INTERFACE_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error -INTERFACE_ELEMENT_TYPE_ADDED_INTERFACE_BOUNDS=Error -INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error -INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error -INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error -INTERFACE_ELEMENT_TYPE_ADDED_TYPE_MEMBER=Error -INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETERS=Error -INTERFACE_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error -INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -INTERFACE_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error -INTERFACE_ELEMENT_TYPE_CHANGED_INTERFACE_BOUNDS=Error -INTERFACE_ELEMENT_TYPE_CHANGED_RESTRICTIONS=Error -INTERFACE_ELEMENT_TYPE_CHANGED_TO_ANNOTATION=Error -INTERFACE_ELEMENT_TYPE_CHANGED_TO_CLASS=Error -INTERFACE_ELEMENT_TYPE_CHANGED_TO_ENUM=Error -INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -INTERFACE_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error -INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error -INTERFACE_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error -INTERFACE_ELEMENT_TYPE_REMOVED_INTERFACE_BOUNDS=Error -INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error -INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -INVALID_ANNOTATION=Ignore -INVALID_JAVADOC_TAG=Error -INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Warning -LEAK_EXTEND=Warning -LEAK_FIELD_DECL=Warning -LEAK_IMPLEMENT=Warning -LEAK_METHOD_PARAM=Warning -LEAK_METHOD_RETURN_TYPE=Warning -METHOD_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error -METHOD_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error -METHOD_ELEMENT_TYPE_ADDED_INTERFACE_BOUNDS=Error -METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error -METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -METHOD_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error -METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -METHOD_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error -METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error -METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error -METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error -METHOD_ELEMENT_TYPE_CHANGED_TYPE_PARAMETER=Error -METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error -METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error -METHOD_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error -METHOD_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error -METHOD_ELEMENT_TYPE_REMOVED_INTERFACE_BOUNDS=Error -METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETERS=Error -MISSING_EE_DESCRIPTIONS=Warning -TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error -UNUSED_PROBLEM_FILTERS=Warning -automatically_removed_unused_problem_filters=false -changed_execution_env=Error -eclipse.preferences.version=1 -incompatible_api_component_version=Error -incompatible_api_component_version_include_major_without_breaking_change=Disabled -incompatible_api_component_version_include_minor_without_api_change=Disabled -incompatible_api_component_version_report_major_without_breaking_change=Warning -incompatible_api_component_version_report_minor_without_api_change=Warning -invalid_since_tag_version=Error -malformed_since_tag=Error -missing_since_tag=Error -report_api_breakage_when_major_version_incremented=Disabled -report_resolution_errors_api_component=Warning diff --git a/qt/org.eclipse.cdt.qt.core/.settings/org.eclipse.pde.prefs b/qt/org.eclipse.cdt.qt.core/.settings/org.eclipse.pde.prefs deleted file mode 100644 index d2dc703ba9e..00000000000 --- a/qt/org.eclipse.cdt.qt.core/.settings/org.eclipse.pde.prefs +++ /dev/null @@ -1,35 +0,0 @@ -compilers.f.unresolved-features=1 -compilers.f.unresolved-plugins=1 -compilers.incompatible-environment=1 -compilers.p.build=1 -compilers.p.build.bin.includes=1 -compilers.p.build.encodings=2 -compilers.p.build.java.compiler=2 -compilers.p.build.java.compliance=1 -compilers.p.build.missing.output=2 -compilers.p.build.output.library=1 -compilers.p.build.source.library=1 -compilers.p.build.src.includes=1 -compilers.p.deprecated=1 -compilers.p.discouraged-class=1 -compilers.p.internal=1 -compilers.p.missing-packages=2 -compilers.p.missing-version-export-package=2 -compilers.p.missing-version-import-package=2 -compilers.p.missing-version-require-bundle=2 -compilers.p.no-required-att=0 -compilers.p.no.automatic.module=1 -compilers.p.not-externalized-att=1 -compilers.p.service.component.without.lazyactivation=1 -compilers.p.unknown-attribute=1 -compilers.p.unknown-class=1 -compilers.p.unknown-element=1 -compilers.p.unknown-identifier=1 -compilers.p.unknown-resource=1 -compilers.p.unresolved-ex-points=0 -compilers.p.unresolved-import=0 -compilers.s.create-docs=false -compilers.s.doc-folder=doc -compilers.s.open-tags=1 -compilers.use-project=true -eclipse.preferences.version=1 diff --git a/qt/org.eclipse.cdt.qt.core/META-INF/MANIFEST.MF b/qt/org.eclipse.cdt.qt.core/META-INF/MANIFEST.MF deleted file mode 100644 index 9a8a94ca777..00000000000 --- a/qt/org.eclipse.cdt.qt.core/META-INF/MANIFEST.MF +++ /dev/null @@ -1,40 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: org.eclipse.cdt.qt.core;singleton:=true -Bundle-Version: 2.4.0.qualifier -Bundle-Activator: org.eclipse.cdt.internal.qt.core.Activator -Bundle-Vendor: %providerName -Require-Bundle: org.eclipse.core.runtime, - org.eclipse.core.resources, - org.eclipse.core.expressions;bundle-version="[3.2.0,4.0.0)", - org.eclipse.cdt.core, - org.eclipse.cdt.codan.core, - org.eclipse.cdt.codan.core.cxx, - org.eclipse.core.filesystem, - org.eclipse.launchbar.core;bundle-version="1.0.1", - org.eclipse.remote.core;bundle-version="2.0.0", - org.eclipse.debug.core;bundle-version="3.10.0", - org.eclipse.cdt.debug.core, - org.freemarker;bundle-version="2.3.22", - org.eclipse.cdt.dsf.gdb;bundle-version="5.0.0", - org.eclipse.cdt.dsf;bundle-version="2.6.0", - org.eclipse.tools.templates.freemarker;bundle-version="1.0.0", - org.eclipse.cdt.build.gcc.core;bundle-version="1.0.0" -Bundle-RequiredExecutionEnvironment: JavaSE-17 -Bundle-ActivationPolicy: lazy -Bundle-Localization: plugin -Export-Package: org.eclipse.cdt.internal.qt.core;x-friends:="org.eclipse.cdt.qt.ui,org.eclipse.cdt.qt.ui.tests", - org.eclipse.cdt.internal.qt.core.build;x-friends:="org.eclipse.cdt.qt.ui", - org.eclipse.cdt.internal.qt.core.index;x-friends:="org.eclipse.cdt.qt.ui.tests", - org.eclipse.cdt.internal.qt.core.location;x-friends:="org.eclipse.cdt.qt.core.tests", - org.eclipse.cdt.internal.qt.core.parser;x-friends:="org.eclipse.cdt.qt.ui", - org.eclipse.cdt.internal.qt.core.project;x-friends:="org.eclipse.cdt.qt.ui", - org.eclipse.cdt.internal.qt.core.qmldir;x-friends:="org.eclipse.cdt.qt.core.tests", - org.eclipse.cdt.qt.core, - org.eclipse.cdt.qt.core.location, - org.eclipse.cdt.qt.core.qmldir, - org.eclipse.cdt.qt.core.qmljs -Import-Package: javax.xml.bind;version="[2.3.3,3.0.0)" -Automatic-Module-Name: org.eclipse.cdt.qt.core - diff --git a/qt/org.eclipse.cdt.qt.core/about.html b/qt/org.eclipse.cdt.qt.core/about.html deleted file mode 100644 index b3134865230..00000000000 --- a/qt/org.eclipse.cdt.qt.core/about.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - About - - - -

About This Content

- -

November 30, 2017

-

License

- -

- The Eclipse Foundation makes available all content in this plug-in - ("Content"). Unless otherwise indicated below, the Content - is provided to you under the terms and conditions of the Eclipse - Public License Version 2.0 ("EPL"). A copy of the EPL is - available at https://www.eclipse.org/legal/epl-2.0. - For purposes of the EPL, "Program" will mean the Content. -

- -

- If you did not receive this Content directly from the Eclipse - Foundation, the Content is being redistributed by another party - ("Redistributor") and different terms and conditions may - apply to your use of any object code in the Content. Check the - Redistributor's license that was provided with the Content. If no such - license exists, contact the Redistributor. Unless otherwise indicated - below, the terms and conditions of the EPL still apply to any source - code in the Content and such source code may be obtained at https://www.eclipse.org. -

- - - - \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/acorn-qml/.gitignore b/qt/org.eclipse.cdt.qt.core/acorn-qml/.gitignore deleted file mode 100644 index 30bc1627986..00000000000 --- a/qt/org.eclipse.cdt.qt.core/acorn-qml/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/node_modules \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/acorn-qml/bin/acorn-qml.js b/qt/org.eclipse.cdt.qt.core/acorn-qml/bin/acorn-qml.js deleted file mode 100644 index a46770d1a2f..00000000000 --- a/qt/org.eclipse.cdt.qt.core/acorn-qml/bin/acorn-qml.js +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env node -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -var path = require("path"); -var fs = require("fs"); -var acorn = require(".."); - -var infile, parsed, tokens, options = {}, silent = false, compact = false, tokenize = false; - -function help(status) { - var print = (status == 0) ? console.log : console.error; - print("usage: " + path.basename(process.argv[1]) + "[--ecma3|--ecma5|--ecma6]"); - print(" [--tokenize] [--locations] [---allow-hash-bang] [--compact] [--silent] [--module] [--help] [--] infile"); - process.exit(status); -} - -for (var i = 2; i < process.argv.length; ++i) { - var arg = process.argv[i]; - if (arg[0] != "-" && !infile) infile = arg; - else if (arg == "--" && !infile && i + 2 == process.argv.length) - infile = process.argv[++i]; - else if (arg == "--ecma3") - options.ecmaVersion = 3; - else if (arg == "--ecma5") - options.ecmaVersion = 5; - else if (arg == "--ecma6") - options.ecmaVersion = 6; - else if (arg == "--ecma7") - options.ecmaVersion = 7; - else if (arg == "--locations") - options.locations = true; - else if (arg == "--allow-hash-bang") - options.allowHashBang = true; - else if (arg == "--silent") - silent = true; - else if (arg == "--compact") - compact = true; - else if (arg == "--help") - help(0); - else if (arg == "--tokenize") - tokenize = true; - else if (arg == "--module") - options.sourceType = 'module'; - else - help(1); -} - -// Enable qml parser -options.plugins = { qml: true } - -try { - var code = fs.readFileSync(infile, "utf8"); - - if (!tokenize) - parsed = acorn.parse(code, options); - else { - var get = acorn.tokenize(code, options); - tokens = []; - while (true) { - var token = get(); - tokens.push(token); - if (token.type.type == "eof") - break; - } - } -} catch(e) { - console.log(e.message); - process.exit(1); -} - -if (!silent) - console.log(JSON.stringify(tokenize ? tokens : parsed, null, compact ? null : 2)); diff --git a/qt/org.eclipse.cdt.qt.core/acorn-qml/index.js b/qt/org.eclipse.cdt.qt.core/acorn-qml/index.js deleted file mode 100644 index f8a70f505d7..00000000000 --- a/qt/org.eclipse.cdt.qt.core/acorn-qml/index.js +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -(function (mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - return mod(require("./inject.js"), require("acorn")); - if (typeof define == "function" && define.amd) // AMD - return define(["./inject.js", "acorn/dist/acorn"], mod); - mod(acornQMLInjector, acorn); // Plain browser env -})(function (acornQMLInjector, acorn) { - 'use strict'; - - acornQMLInjector.inject(acorn); -}); \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/acorn-qml/inject.js b/qt/org.eclipse.cdt.qt.core/acorn-qml/inject.js deleted file mode 100644 index 5d4029c6813..00000000000 --- a/qt/org.eclipse.cdt.qt.core/acorn-qml/inject.js +++ /dev/null @@ -1,653 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -(function (root, mod) { - if (typeof exports === "object" && typeof module === "object") // CommonJS - return mod(exports); - if (typeof define === "function" && define.amd) // AMD - return define(["exports"], mod); - mod(root.acornQMLInjector || (root.acornQMLInjector = {})); // Plain browser env -})(this, function (exports) { - 'use strict'; - - exports.inject = function (acorn) { - // Add the 'mode' option to acorn - acorn.defaultOptions.mode = "qml"; - - // Acorn token types - var tt = acorn.tokTypes; - - // QML token types - var qtt = acorn.qmlTokTypes = {}; - var keywords = acorn.qmlKeywords = {}; - - /* - * Shorthand for defining keywords in the 'keywords' variable with the following - * format: - * keywords[name].isPrimitive : if this is a primitive type - * keywords[name].isQMLContextual : if this is a contextual keyword for QML - * - * Also stores the token's name in qtt._ for easy referencing later. None - * of these keywords will be tokenized and, as such, are allowed to be used in - * JavaScript expressions by acorn. The 'isQMLContextual' boolean in keywords refers - * to those contextual keywords that are also contextual in QML's parser rules such - * as 'color', 'list', 'alias', etc. - */ - function kw(name, options) { - if (options === undefined) - options = {}; - qtt["_" + name] = name; - keywords[name] = {}; - keywords[name].isPrimitive = options.isPrimitive ? true : false; - keywords[name].isQMLContextual = options.isQMLContextual ? true : false; - } - - // QML keywords - kw("import"); - kw("pragma"); - kw("property", { isQMLContextual: true }); - kw("readonly", { isQMLContextual: true }); - kw("signal", { isQMLContextual: true }); - kw("as"); - kw("on", { isQMLContextual: true }); - kw("boolean", { isPrimitive: true }); - kw("double", { isPrimitive: true }); - kw("int", { isPrimitive: true }); - kw("alias", { isPrimitive: true, isQMLContextual: true }); - kw("list", { isPrimitive: true, isQMLContextual: true }); - kw("color", { isPrimitive: true, isQMLContextual: true }); - kw("real", { isPrimitive: true, isQMLContextual: true }); - kw("string", { isPrimitive: true, isQMLContextual: true }); - kw("url", { isPrimitive: true, isQMLContextual: true }); - - // Future reserved words - kw("transient"); - kw("synchronized"); - kw("abstract"); - kw("volatile"); - kw("native"); - kw("goto"); - kw("byte"); - kw("long"); - kw("char"); - kw("short"); - kw("float"); - - // QML parser methods - var pp = acorn.Parser.prototype; - - /* - * Parses a set of QML Header Items (QMLImport or QMLPragma) - */ - pp.qml_parseHeaderItemList = function () { - var node = this.startNode(); - node.items = []; - - var loop = true; - while (loop) { - if (this.isContextual(qtt._import)) { - node.items.push(this.qml_parseImport()); - } else if (this.isContextual(qtt._pragma)) { - node.items.push(this.qml_parsePragma()); - } else { - loop = false; - } - } - - return this.finishNode(node, "QMLHeaderItemList"); - }; - - /* - * Parses a QML Pragma statement of the form: - * 'pragma' - */ - pp.qml_parsePragma = function () { - var node = this.startNode(); - this.expectContextual(qtt._pragma); - node.id = this.qml_parseQualifiedId(true); - this.semicolon(); - return this.finishNode(node, "QMLPragma"); - }; - - /* - * Parses a QML Import of the form: - * 'import' [as ] - * 'import' [as ] - * - * as specified by http://doc.qt.io/qt-5/qtqml-syntax-imports.html - */ - pp.qml_parseImport = function () { - var node = this.startNode(); - - if (!this.eatContextual(qtt._import)) { - this.unexpected(); - } - - switch (this.type) { - case tt.name: - node.module = this.qml_parseModule(); - node.directory = null; - break; - case tt.string: - node.module = null; - node.directory = this.parseLiteral(this.value); - break; - default: - this.unexpected(); - } - - // Parse the qualifier, if any - if (this.isContextual(qtt._as)) { - node.qualifier = this.qml_parseQualifier(); - } - this.semicolon(); - - return this.finishNode(node, "QMLImport"); - }; - - /* - * Parses a QML Module of the form: - * - */ - pp.qml_parseModule = function () { - var node = this.startNode(); - - node.id = this.qml_parseQualifiedId(false); - if (this.type === tt.num) { - node.version = this.qml_parseVersionLiteral(); - } else { - this.unexpected(); - } - - return this.finishNode(node, "QMLModule"); - }; - - /* - * Parses a QML Version Literal which consists of a major and minor - * version separated by a '.' - */ - pp.qml_parseVersionLiteral = function () { - var node = this.startNode(); - - node.value = this.value; - node.raw = this.input.slice(this.start, this.end); - if (!(/(\d+)\.(\d+)/.exec(node.raw))) { - this.raise(this.start, "QML module must specify major and minor version"); - } - this.next(); - - return this.finishNode(node, "QMLVersionLiteral"); - }; - - /* - * Parses a QML Qualifier of the form: - * 'as' - */ - pp.qml_parseQualifier = function () { - var node = this.startNode(); - this.expectContextual(qtt._as); - node.id = this.qml_parseIdent(false); - return this.finishNode(node, "QMLQualifier"); - }; - - /* - * Parses a QML Object Definition of the form: - * { ()* } - * - * http://doc.qt.io/qt-5/qtqml-syntax-basics.html#object-declarations - */ - pp.qml_parseObjectDefinition = function (node, isBinding) { - if (!node) { - node = this.startNode(); - } - if (!node.id) { - node.id = this.qml_parseQualifiedId(false); - } - node.body = this.qml_parseObjectInitializer(); - return this.finishNode(node, isBinding ? "QMLObjectBinding" : "QMLObjectDefinition"); - }; - - /* - * Parses a QML Object Initializer of the form: - * '{' * '}' - */ - pp.qml_parseObjectInitializer = function () { - var node = this.startNode(); - this.expect(tt.braceL); - node.members = []; - while (this.type !== tt.braceR) { - node.members.push(this.qml_parseObjectMember()); - } - this.expect(tt.braceR); - return this.finishNode(node, "QMLObjectInitializer"); - }; - - /* - * Parses a QML Object Member which can be one of the following: - * - a QML Property Binding - * - a QML Property Declaration - * - a QML Property Modifier - * - a QML Object Literal - * - a JavaScript Function Declaration - * - a QML Signal Definition - */ - pp.qml_parseObjectMember = function () { - if (this.type === tt._default || this.isContextual(qtt._readonly) || this.isContextual(qtt._property)) { - return this.qml_parsePropertyDeclaration(); - } else if (this.isContextual(qtt._signal)) { - return this.qml_parseSignalDefinition(); - } else if (this.type === tt._function) { - return this.qml_parseFunctionMember(); - } - return this.qml_parseObjectDefinitionOrPropertyBinding(); - }; - - /* - * Parses a JavaScript function as a member of a QML Object Literal - */ - pp.qml_parseFunctionMember = function () { - var node = this.startNode(); - this.expect(tt._function); - return this.parseFunction(node, true); - }; - - /* - * Parses a QML Object Definition or Property Binding depending on the tokens found. - */ - pp.qml_parseObjectDefinitionOrPropertyBinding = function (node) { - if (!node) { - node = this.startNode(); - } - if (!node.id) { - node.id = this.qml_parseQualifiedId(false); - } - switch (this.type) { - case tt.braceL: - return this.qml_parseObjectDefinition(node); - case tt.colon: - return this.qml_parsePropertyBinding(node); - } - this.unexpected(); - }; - - /* - * Parses a QML Property Modifier of the form: - * 'on' - - * TODO: Call this method in the normal parser once we can do lookahead - * Without lookahead, telling the difference between an Object Declaration, - * Property Binding, and Property Modifier would be too difficult. For now, - * we've implemented a workaround for Object Declarations and Property Bindings - * until Acorn gets lookahead. - */ - pp.qml_parsePropertyModifier = function () { - var node = this.startNode(); - node.kind = this.qml_parseQualifiedID(false); - this.expectContextual(qtt._on); - node.id = this.qml_parseQualifiedID(false); - node.body = this.qml_parseObjectInitializer(); - return this.finishNode(node, "QMLPropertyModifier"); - }; - - /* - * Parses a QML Property Binding of the form: - * - */ - pp.qml_parsePropertyBinding = function (node) { - if (!node) { - node = this.startNode(); - } - if (!node.id) { - node.id = this.qml_parseQualifiedId(false); - } - this.expect(tt.colon); - node.binding = this.qml_parseBinding(); - return this.finishNode(node, "QMLPropertyBinding"); - }; - - /* - * Parses a QML Signal Definition of the form: - * 'signal' [( [',' ]* )]? - */ - pp.qml_parseSignalDefinition = function () { - var node = this.startNode(); - - // Parse as a qualified id in case this is not a signal definition - var signal = this.qml_parseQualifiedId(true); - if (signal.parts.length === 1) { - if (signal.name !== qtt._signal) { - this.unexpected(); - } - - if (this.type === tt.colon || this.type === tt.braceL) { - // This is a property binding or object literal - node.id = signal; - return this.qml_parseObjectDefinitionOrPropertyBinding(node); - } - } else { - // Signal keyword is a qualified ID. This is not a signal definition - node.id = signal; - return this.qml_parseObjectDefinitionOrPropertyBinding(node); - } - - node.id = this.qml_parseIdent(false); - this.qml_parseSignalParams(node); - this.semicolon(); - return this.finishNode(node, "QMLSignalDefinition"); - }; - - /* - * Parses QML Signal Parameters of the form: - * [( [',' ]* )]? - */ - pp.qml_parseSignalParams = function (node) { - node.params = []; - if (this.eat(tt.parenL)) { - if (!this.eat(tt.parenR)) { - do { - var param = this.startNode(); - param.kind = this.qml_parsePropertyType(); - param.id = this.qml_parseIdent(false); - node.params.push(this.finishNode(param, "QMLParameter")); - } while (this.eat(tt.comma)); - this.expect(tt.parenR); - } - } - }; - - /* - * Parses a QML Property Declaration of the form: - * ['default'|'readonly'] 'property' [] - */ - pp.qml_parsePropertyDeclaration = function () { - var node = this.startNode(); - - // Parse 'default' or 'readonly' - node.default = false; - node.readonly = false; - if (this.eat(tt._default)) { - node.default = true; - } else if (this.isContextual(qtt._readonly)) { - // Parse as a qualified id in case this is not a property declaration - var readonly = this.qml_parseQualifiedId(true); - if (readonly.parts.length === 1) { - if (this.type === tt.colon || this.type === tt.braceL) { - // This is a property binding or object literal. - node.id = readonly; - return this.qml_parseObjectDefinitionOrPropertyBinding(node); - } - node.readonly = true; - } else { - // Readonly keyword is a qualified ID. This is not a property declaration. - node.id = readonly; - return this.qml_parseObjectDefinitionOrPropertyBinding(node); - } - } - - // Parse as a qualified id in case this is not a property declaration - var property = this.qml_parseQualifiedId(true); - if (property.parts.length === 1 || node.default || node.readonly) { - if (property.name !== qtt._property) { - this.unexpected(); - } - - if (this.type === tt.colon || this.type === tt.braceL) { - // This is a property binding or object literal. - node.default = undefined; - node.readonly = undefined; - node.id = property; - return this.qml_parseObjectDefinitionOrPropertyBinding(node); - } - } else { - // Property keyword is a qualified ID. This is not a property declaration. - node.default = undefined; - node.readonly = undefined; - node.id = property; - return this.qml_parseObjectDefinitionOrPropertyBinding(node); - } - - node.kind = this.qml_parsePropertyType(); - if (this.value === "<") { - this.expect(tt.relational); // '<' - node.modifier = this.qml_parsePropertyType(); - if (this.value !== ">") { - this.unexpected(); - } - this.expect(tt.relational); // '>' - } - - node.id = this.qml_parseIdent(false); - if (!this.eat(tt.colon)) { - node.binding = null; - this.semicolon(); - } else { - node.binding = this.qml_parseBinding(); - } - - return this.finishNode(node, "QMLPropertyDeclaration"); - }; - - /* - * Parses a QML Property Type of the form: - * - */ - pp.qml_parsePropertyType = function () { - var node = this.startNode(); - node.primitive = false; - if (this.qml_isPrimitiveType(this.type, this.value)) { - node.primitive = true; - } - node.id = this.qml_parseIdent(true); - return this.finishNode(node, "QMLPropertyType"); - }; - - /* - * Parses one of the following possibilities for a QML Property assignment: - * - QML Object Binding - * - QML Array Binding - * - QML Script Binding - */ - pp.qml_parseBinding = function () { - if (this.options.mode === "qmltypes") { - return this.qml_parseScriptBinding(false); - } - - // TODO: solve ambiguity where a QML Object Literal starts with a - // Qualified Id that looks very similar to a MemberExpression in - // JavaScript. For now, we just won't parse statements like: - // test: QMLObject { } - // test: QMLObject.QualifiedId { } - return this.qml_parseScriptBinding(true); - }; - - /* - * Parses a QML Array Binding of the form: - * '[' [ (',' )*] ']' - * - * TODO: call this in the parser once we can use lookahead to distinguish between - * a QML Array Binding and a JavaScript array. - */ - pp.qml_parseArrayBinding = function () { - var node = this.startNode(); - this.expect(tt.bracketL); - node.members = []; - while (!this.eat(tt.bracketR)) { - node.members.push(this.qml_parseObjectDefinition()); - } - return this.finishNode(node, "QMLArrayBinding"); - }; - - /* - * Parses one of the following Script Bindings: - * - Single JavaScript Expression - * - QML Statement Block (A block of JavaScript statements) - */ - pp.qml_parseScriptBinding = function (allowStatementBlock) { - var node = this.startNode(); - node.block = false; - if (allowStatementBlock && this.type === tt.braceL) { - node.block = true; - node.script = this.qml_parseStatementBlock(); - } else { - node.script = this.parseExpression(false); - this.semicolon(); - } - return this.finishNode(node, "QMLScriptBinding"); - }; - - /* - * Parses a QML Statement Block of the form: - * { * } - */ - pp.qml_parseStatementBlock = function () { - var node = this.startNode(); - this.expect(tt.braceL); - node.body = []; - while (!this.eat(tt.braceR)) { - node.body.push(this.parseStatement(true, false)); - } - return this.finishNode(node, "QMLStatementBlock"); - }; - - /* - * Parses a Qualified ID of the form: - * ('.' )* - * - * If 'liberal' is true then this method will allow non-contextual QML keywords as - * identifiers. - */ - pp.qml_parseQualifiedId = function (liberal) { - var node = this.startNode(); - node.parts = []; - node.parts.push(this.qml_parseIdent(liberal)); - while (this.eat(tt.dot)) { - node.parts.push(this.qml_parseIdent(liberal)); - } - - node.name = ""; - for (var i = 0; i < node.parts.length; i++) { - node.name += node.parts[i].name; - if (i < node.parts.length - 1) { - node.name += "."; - } - } - - return this.finishNode(node, "QMLQualifiedID"); - }; - - /* - * Parses an Identifier in a QML Context. That is, this method uses 'isQMLContextual' - * to throw an error if a non-contextual QML keyword is found. - * - * If 'liberal' is true then this method will allow non-contextual QML keywords as - * identifiers. - */ - pp.qml_parseIdent = function (liberal) { - // Check for non-contextual QML keywords - if (!liberal) { - if (!this.qml_isIdent(this.type, this.value)) { - this.unexpected(); - } - } - return this.parseIdent(liberal); - }; - - /* - * Returns whether or not a given token type and name can be a QML Identifier. - * Uses the 'isQMLContextual' boolean of 'keywords' to determine this. - */ - pp.qml_isIdent = function (type, name) { - if (type === tt.name) { - var key; - if ((key = keywords[name])) { - return key.isQMLContextual; - } - return true; - } - return false; - }; - - /* - * Returns whether or not the current token is a QML primitive type and consumes - * it as a side effect if it is. - */ - pp.qml_eatPrimitiveType = function (type, name) { - if (this.qml_isPrimitiveType(type, name)) { - this.next(); - return true; - } - return false; - }; - - /* - * Returns whether or not the current token is a QML primitive type. - */ - pp.qml_isPrimitiveType = function (type, name) { - if (name === "var") { - return true; - } - - if (type === tt.name) { - var key; - if ((key = keywords[name])) { - return key.isPrimitive; - } - } - return false; - }; - - acorn.plugins.qml = function (instance) { - - // Extend acorn's 'parseTopLevel' method - instance.extend("parseTopLevel", function (nextMethod) { - return function (node) { - // Make parsing simpler by only allowing ECMA Version 5 or older ('import' is - // not a keyword in this version of ECMA Script). Qt 5.5 runs with ECMA Script - // 5 anyway, so this makes sense. - if (!this.options.ecmaVersion || this.options.ecmaVersion > 5) { - throw new Error("QML only supports ECMA Script Language Specification 5 or older"); - } - - // Disabled 'qmltypes' mode for now since the normal parser can't parse it anyway - if (this.options.mode === "qml") { - // Force strict mode - this.strict = true; - - // Most of QML's constructs sit at the top-level of the parse tree, - // replacing JavaScripts top-level. Here we are parsing such things - // as the root object literal and header statements of QML. Eventually, - // these rules will delegate down to JavaScript expressions. - node.mode = this.options.mode; - node.headerItemList = this.qml_parseHeaderItemList(); - node.rootObject = null; - if (this.type !== tt.eof) { - node.rootObject = this.qml_parseObjectDefinition(); - } - - if (!this.eat(tt.eof)) { - this.raise(this.pos, "Expected EOF after QML Root Object"); - } - - return this.finishNode(node, "QMLProgram"); - } else if (this.options.mode === "js") { - return nextMethod.call(this, node); - } else { - throw new Error("Unknown mode '" + this.options.mode + "'"); - } - }; - }); - }; - - return acorn; - }; -}); \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/acorn-qml/loose/index.js b/qt/org.eclipse.cdt.qt.core/acorn-qml/loose/index.js deleted file mode 100644 index bd266eb30c4..00000000000 --- a/qt/org.eclipse.cdt.qt.core/acorn-qml/loose/index.js +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -(function (mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - return mod(require("./inject.js"), require("acorn"), require("acorn/dist/acorn_loose")); - if (typeof define == "function" && define.amd) // AMD - return define(["./inject.js", "acorn", "acorn/dist/acorn_loose"], mod); - mod(acornQMLLooseInjector, acorn, acorn); // Plain browser env -})(function (acornQMLLooseInjector, acorn, acorn_loose) { - "use strict"; - - acornQMLLooseInjector.inject(acorn); -}); \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/acorn-qml/loose/inject.js b/qt/org.eclipse.cdt.qt.core/acorn-qml/loose/inject.js deleted file mode 100644 index ee346de5048..00000000000 --- a/qt/org.eclipse.cdt.qt.core/acorn-qml/loose/inject.js +++ /dev/null @@ -1,681 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ - -// This will only be visible globally if we are in a browser environment -var injectQMLLoose; - -(function (root, mod) { - if (typeof exports === "object" && typeof module === "object") // CommonJS - return mod(module.exports); - if (typeof define === "function" && define.amd) // AMD - return define(["exports"], mod); - mod(root.acornQMLLooseInjector || (root.acornQMLLooseInjector = {})); // Plain browser env -})(this, function (exports) { - "use strict"; - - exports.inject = function (acorn) { - // Acorn token types - var tt = acorn.tokTypes; - - // QML token types - var qtt = acorn.qmlTokTypes; - var keywords = acorn.qmlKeywords; - - // QML parser methods - var lp = acorn.LooseParser.prototype; - var pp = acorn.Parser.prototype; - - /* - * Parses a set of QML Header Items (QMLImport or QMLPragma) - */ - lp.qml_parseHeaderItemList = function () { - var node = this.startNode(); - node.items = []; - - var loop = true; - while (loop) { - if (this.isContextual(qtt._import)) { - node.items.push(this.qml_parseImport()); - } else if (this.isContextual(qtt._pragma)) { - node.items.push(this.qml_parsePragma()); - } else { - loop = false; - } - } - - return this.finishNode(node, "QMLHeaderItemList"); - }; - - /* - * Parses a QML Pragma statement of the form: - * 'pragma' - */ - lp.qml_parsePragma = function () { - var node = this.startNode(); - this.expectContextual(qtt._pragma); - node.id = this.qml_parseQualifiedId(true); - this.semicolon(); - return this.finishNode(node, "QMLPragma"); - }; - - /* - * Parses a QML Import of the form: - * 'import' [as ] - * 'import' [as ] - * - * as specified by http://doc.qt.io/qt-5/qtqml-syntax-imports.html - */ - lp.qml_parseImport = function () { - var node = this.startNode(); - this.expectContextual(qtt._import); - - switch (this.tok.type) { - case tt.string: - node.module = null; - node.directory = this.parseExprAtom(); - break; - default: - node.module = this.qml_parseModule(); - node.directory = null; - break; - } - - // Parse the qualifier, if any - if (this.isContextual(qtt._as)) { - node.qualifier = this.qml_parseQualifier(); - } - this.semicolon(); - - return this.finishNode(node, "QMLImport"); - }; - - /* - * Parses a QML Module of the form: - * - */ - lp.qml_parseModule = function () { - var node = this.startNode(); - - node.id = this.qml_parseQualifiedId(false); - node.version = this.qml_parseVersionLiteral(); - - return this.finishNode(node, "QMLModule"); - }; - - /* - * Parses a QML Version Literal which consists of a major and minor - * version separated by a '.' - */ - lp.qml_parseVersionLiteral = function () { - var node = this.startNode(); - - var matches; - if (this.tok.type === tt.num) { - node.raw = this.input.slice(this.tok.start, this.tok.end); - node.value = this.tok.value; - this.next(); - } else { - node.value = 0; - node.raw = "0.0"; - } - - return this.finishNode(node, "QMLVersionLiteral"); - }; - - /* - * Parses a QML Qualifier of the form: - * 'as' - */ - lp.qml_parseQualifier = function () { - var node = this.startNode(); - this.expectContextual(qtt._as); - node.id = this.qml_parseIdent(false); - return this.finishNode(node, "QMLQualifier"); - }; - - /* - * Parses a QML Object Definition of the form: - * { ()* } - * - * http://doc.qt.io/qt-5/qtqml-syntax-basics.html#object-declarations - */ - lp.qml_parseObjectDefinition = function (isBinding) { - var node = this.startNode(); - node.id = this.qml_parseQualifiedId(false); - node.body = this.qml_parseObjectInitializer(); - return this.finishNode(node, isBinding ? "QMLObjectBinding" : "QMLObjectDefinition"); - }; - - /* - * Parses a QML Object Initializer of the form: - * '{' * '}' - */ - lp.qml_parseObjectInitializer = function () { - var node = this.startNode(); - this.pushCx(); - this.expect(tt.braceL); - var blockIndent = this.curIndent, - line = this.curLineStart; - node.members = []; - while (!this.closes(tt.braceR, blockIndent, line, true)) { - var member = this.qml_parseObjectMember(); - if (member) { - node.members.push(member); - } - } - this.popCx(); - this.eat(tt.braceR); - return this.finishNode(node, "QMLObjectInitializer"); - }; - - /* - * Parses a QML Object Member which can be one of the following: - * - a QML Property Binding - * - a QML Property Declaration - * - a QML Property Modifier - * - a QML Object Literal - * - a JavaScript Function Declaration - * - a QML Signal Definition - */ - lp.qml_parseObjectMember = function () { - if (this.tok.type === tt._default || this.isContextual(qtt._readonly) || this.isContextual(qtt._property) || this.qml_isPrimitiveType(this.tok.type, this.tok.value)) { - return this.qml_parsePropertyDeclaration(); - } else if (this.isContextual(qtt._signal)) { - return this.qml_parseSignalDefinition(); - } else if (this.tok.type === tt._function) { - return this.qml_parseFunctionMember(); - } else if (this.qml_isIdent(this.tok.type, this.tok.value) || this.tok.type === tt.dot) { - var la = this.lookAhead(1); - if (this.qml_isIdent(la.type, la.value) && la.value !== qtt._on) { - // Two identifiers in a row means this is most likely a property declaration - // with the 'property' token missing. - return this.qml_parsePropertyDeclaration(); - } else { - return this.qml_parseMemberStartsWithIdentifier() || this.qml_parsePropertyBinding(); - } - } else if (this.tok.type === tt.colon) { - return this.qml_parsePropertyBinding(); - } else if (this.tok.type === tt.braceL) { - return this.qml_parseObjectDefinition(); - } - // ignore the current token if it didn't pass the previous tests - this.next(); - }; - - /* - * Parses a QML Object Member that starts with an identifier. This method solves the - * ambiguities that arise from QML having multiple Object Members that start with - * Qualified IDs as well as the fact that several of its keywords can be used as part - * of these Qualified IDs. - */ - lp.qml_parseMemberStartsWithIdentifier = function () { - // Jump past the potential Qualified ID - var i = 1, - la = this.tok; - if (this.qml_isIdent(la.type, la.value)) { - la = this.lookAhead(i++); - } - while (la.type === tt.dot) { - la = this.lookAhead(i++); - if (this.qml_isIdent(la.type, la.value)) { - la = this.lookAhead(i++); - } - } - - // Check the last lookahead token - switch (la.type) { - case tt.braceL: - return this.qml_parseObjectDefinition(); - case tt.colon: - return this.qml_parsePropertyBinding(); - case tt.name: - if (la.value === qtt._on) { - return this.qml_parsePropertyModifier(); - } - break; - } - return null; - }; - - /* - * Parses a JavaScript function as a member of a QML Object Literal - */ - lp.qml_parseFunctionMember = function () { - var node = this.startNode(); - this.expect(tt._function); - return this.qml_parseFunction(node, true); - }; - - /* - * QML version of 'parseFunction' needed to have proper error tolerant parsing - * for QML member functions versus their JavaScript counterparts. The main - * difference between the two functions is that this implementation will not - * forcefully insert '(' and '{' tokens for the body and parameters. Instead, - * it will silently create an empty parameter list or body and let parsing - * continue normally. - */ - lp.qml_parseFunction = function (node, isStatement) { - this.initFunction(node); - if (this.tok.type === tt.name) node.id = this.parseIdent(); - else if (isStatement) node.id = this.dummyIdent(); - node.params = this.tok.type === tt.parenL ? this.parseFunctionParams() : []; - if (this.tok.type === tt.braceL) { - node.body = this.parseBlock(); - } else { - if (this.options.locations) { - node.body = this.startNodeAt([this.last.end, this.last.loc.end]); - } else { - node.body = this.startNodeAt(this.last.end); - } - node.body.body = []; - this.finishNode(node.body, "BlockStatement"); - } - return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression"); - }; - - /* - * Parses a QML Property Modifier of the form: - * 'on' - */ - lp.qml_parsePropertyModifier = function () { - var node = this.startNode(); - node.kind = this.qml_parseQualifiedId(false); - this.expectContextual(qtt._on); - node.id = this.qml_parseQualifiedId(false); - node.body = this.qml_parseObjectInitializer(); - return this.finishNode(node, "QMLPropertyModifier"); - }; - - /* - * Parses a QML Property of the form: - * - */ - lp.qml_parsePropertyBinding = function () { - var node = this.startNode(); - node.id = this.qml_parseQualifiedId(false); - var start = this.storeCurrentPos(); - this.expect(tt.colon); - node.binding = this.qml_parseBinding(start); - return this.finishNode(node, "QMLPropertyBinding"); - }; - - /* - * Parses a QML Signal Definition of the form: - * 'signal' [( [',' ]* )]? - */ - lp.qml_parseSignalDefinition = function () { - var node = this.startNode(); - - // Check if this is an object literal or property binding first - var objOrBind = this.qml_parseMemberStartsWithIdentifier(); - if (objOrBind) { - return objOrBind; - } - this.expectContextual(qtt._signal); - - node.id = this.qml_parseIdent(false); - this.qml_parseSignalParams(node); - this.semicolon(); - return this.finishNode(node, "QMLSignalDefinition"); - }; - - /* - * Checks if the given node is a dummy identifier - */ - function isDummy(node) { - return node.name === "✖"; - } - - /* - * Parses QML Signal Parameters of the form: - * [( [',' ]* )]? - */ - lp.qml_parseSignalParams = function (node) { - this.pushCx(); - var indent = this.curIndent, - line = this.curLineStart; - node.params = []; - if (this.eat(tt.parenL)) { - while (!this.closes(tt.parenR, indent + 1, line) && this.tok.type !== tt.braceR) { - var param = this.startNode(); - param.kind = this.qml_parsePropertyType(); - - // Break out of an infinite loop where we continously consume dummy ids - if (isDummy(param.kind.id) && this.tok.type !== tt.comma) { - break; - } - - param.id = this.qml_parseIdent(false); - node.params.push(this.finishNode(param, "QMLParameter")); - - // Break out of an infinite loop where we continously consume dummy ids - if (isDummy(param.id) && this.tok.type !== tt.comma) { - break; - } - this.eat(tt.comma); - } - this.popCx(); - if (!this.eat(tt.parenR)) { - // If there is no closing brace, make the node span to the start - // of the next token (this is useful for Tern) - this.last.end = this.tok.start; - if (this.options.locations) this.last.loc.end = this.tok.loc.start; - } - } - }; - - /* - * Parses a QML Property Declaration of the form: - * ['default'|'readonly'] 'property' [] - */ - lp.qml_parsePropertyDeclaration = function () { - var node = this.startNode(); - var objOrBind = null; - - // Parse 'default' or 'readonly' - node.default = false; - node.readonly = false; - if (this.eat(tt._default)) { - node.default = true; - } else if (this.isContextual(qtt._readonly)) { - objOrBind = this.qml_parseMemberStartsWithIdentifier(); - if (objOrBind) { - objOrBind.default = undefined; - objOrBind.readonly = undefined; - return objOrBind; - } - this.expectContextual(qtt._readonly); - node.readonly = true; - } - - if (!node.default && !node.readonly) { - objOrBind = this.qml_parseMemberStartsWithIdentifier(); - if (objOrBind) { - return objOrBind; - } - this.expectContextual(qtt._property); - } else { - this.expectContextual(qtt._property); - } - - - node.kind = this.qml_parsePropertyType(); - if (this.tok.value === "<") { - this.expect(tt.relational); // '<' - node.modifier = this.qml_parsePropertyType(); - this.expect(tt.relational); // '>' - } - - node.id = this.qml_parseIdent(false); - - var start = this.storeCurrentPos(); - if (this.eat(tt.colon)) { - node.binding = this.qml_parseBinding(start); - } else { - node.binding = null; - this.semicolon(); - } - - return this.finishNode(node, "QMLPropertyDeclaration"); - }; - - /* - * Parses a QML Property Type of the form: - * - */ - lp.qml_parsePropertyType = function () { - var node = this.startNode(); - node.primitive = false; - if (this.qml_isPrimitiveType(this.tok.type, this.tok.value)) { - node.primitive = true; - } - node.id = this.qml_parseIdent(true); - return this.finishNode(node, "QMLPropertyType"); - }; - - /* - * Parses one of the following possibilities for a QML Property assignment: - * - QML Object Binding - * - QML Array Binding - * - QML Script Binding - */ - lp.qml_parseBinding = function (start) { - var i, la; - if (this.options.mode === "qmltypes") { - return this.qml_parseScriptBinding(start, false); - } - - if (this.tok.type === tt.braceL) { - return this.qml_parseScriptBinding(start, true); - } else if (this.tok.type === tt.bracketL) { - // Perform look ahead to determine whether this is an expression or - // a QML Array Binding - i = 1; - la = this.lookAhead(i++); - if (la.type === tt.name) { - while (la.type === tt.dot || la.type === tt.name) { - la = this.lookAhead(i++); - } - if (la.type === tt.braceL) { - return this.qml_parseArrayBinding(); - } - } - return this.qml_parseScriptBinding(start, true); - } - // Perform look ahead to determine whether this is an expression or - // a QML Object Literal - i = 1; - la = this.tok; - if (this.qml_isIdent(la.type, la.value)) { - la = this.lookAhead(i++); - } - while (la.type === tt.dot) { - la = this.lookAhead(i++); - if (this.qml_isIdent(la.type, la.value)) { - la = this.lookAhead(i++); - } - } - - if (la.type === tt.braceL) { - return this.qml_parseObjectDefinition(true); - } else { - return this.qml_parseScriptBinding(start, true); - } - }; - - /* - * Parses a QML Array Binding of the form: - * '[' [ (',' )*] ']' - */ - lp.qml_parseArrayBinding = function () { - var node = this.startNode(); - var indent = this.curIndent, - line = this.curLineStart; - this.pushCx(); - this.expect(tt.bracketL); - node.elements = []; - while (!this.closes(tt.bracketR, indent + 1, line) && this.tok.type !== tt.braceR) { - var obj = this.qml_parseObjectDefinition(); - node.elements.push(obj); - - // Break out of an infinite loop where we continously consume dummy ids - if (isDummy(obj.id) && this.tok.type !== tt.comma) { - break; - } - - this.eat(tt.comma); - } - this.popCx(); - if (!this.eat(tt.bracketR)) { - // If there is no closing brace, make the node span to the start - // of the next token (this is useful for Tern) - this.last.end = this.tok.start; - if (this.options.locations) this.last.loc.end = this.tok.loc.start; - } - return this.finishNode(node, "QMLArrayBinding"); - }; - - /* - * Parses one of the following Script Bindings: - * - Single JavaScript Expression - * - QML Statement Block (A block of JavaScript statements) - */ - lp.qml_parseScriptBinding = function (start, allowStatementBlock) { - // Help out Tern a little by starting the Script Binding at the end of - // the colon token (only if we consume invalid syntax). - var node = this.startNodeAt(start); - node.block = false; - if (allowStatementBlock && this.tok.type === tt.braceL) { - node.block = true; - node.script = this.qml_parseStatementBlock(); - } else { - node.script = this.parseExpression(false); - this.semicolon(); - } - - // If this node consumed valid syntax, reset its start position - if (node.script.type !== "Identifier" || node.script.name !== "✖") { - if (node.loc) { - node.loc.start = node.script.loc.start; - } - if (node.range) { - node.range = node.script.range; - } - node.start = node.script.start; - node.end = node.script.end; - } - - return this.finishNode(node, "QMLScriptBinding"); - }; - - /* - * Parses a QML Statement Block of the form: - * { * } - */ - lp.qml_parseStatementBlock = function () { - var node = this.startNode(); - this.pushCx(); - this.expect(tt.braceL); - var blockIndent = this.curIndent, - line = this.curLineStart; - node.body = []; - while (!this.closes(tt.braceR, blockIndent, line, true)) { - node.body.push(this.parseStatement(true, false)); - } - this.popCx(); - this.eat(tt.braceR); - return this.finishNode(node, "QMLStatementBlock"); - }; - - /* - * Parses a Qualified ID of the form: - * ('.' )* - * - * If 'liberal' is true then this method will allow non-contextual QML keywords as - * identifiers. - */ - lp.qml_parseQualifiedId = function (liberal) { - var node = this.startNode(); - node.parts = []; - node.parts.push(this.qml_parseIdent(liberal)); - while (this.eat(tt.dot)) { - node.parts.push(this.qml_parseIdent(liberal)); - } - - node.name = ""; - for (var i = 0; i < node.parts.length; i++) { - node.name += node.parts[i].name; - if (i < node.parts.length - 1) { - node.name += "."; - } - } - - return this.finishNode(node, "QMLQualifiedID"); - }; - - /* - * Parses an Identifier in a QML Context. That is, this method uses 'isQMLContextual' - * to throw an error if a non-contextual QML keyword is found. - * - * If 'liberal' is true then this method will allow non-contextual QML keywords as - * identifiers. - */ - lp.qml_parseIdent = function (liberal) { - // Check for non-contextual QML keywords - if (!liberal) { - if (!this.qml_isIdent(this.tok.type, this.tok.value)) { - return this.dummyIdent(); - } - } - return this.parseIdent(); - }; - - /* - * Checks the next token to see if it matches the given contextual keyword. If the - * contextual keyword was not found, this function looks ahead at the next two tokens - * and jumps ahead if it was found there. Returns whether or not the keyword was found. - */ - lp.expectContextual = function (name) { - if (this.eatContextual(name)) return true; - for (var i = 1; i <= 2; i++) { - if (this.lookAhead(i).type == tt.name && this.lookAhead(i).value === name) { - for (var j = 0; j < i; j++) this.next(); - return true; - } - } - }; - - // Functions left un-changed from the main parser - lp.qml_isIdent = pp.qml_isIdent; - lp.qml_eatPrimitiveType = pp.qml_eatPrimitiveType; - lp.qml_isPrimitiveType = pp.qml_isPrimitiveType; - - acorn.pluginsLoose.qml = function (instance) { - - // Extend acorn's 'parseTopLevel' method - instance.extend("parseTopLevel", function (nextMethod) { - return function () { - // Make parsing simpler by only allowing ECMA Version 5 or older ('import' is - // not a keyword in this version of ECMA Script). Qt 5.5 runs with ECMA Script - // 5 anyway, so this makes sense. - if (!this.options.ecmaVersion || this.options.ecmaVersion > 5) { - throw new Error("QML only supports ECMA Script Language Specification 5 or older"); - } - - if (this.options.mode === "qml" || this.options.mode === "qmltypes") { - // Most of QML's constructs sit at the top-level of the parse tree, - // replacing JavaScripts top-level. Here we are parsing such things - // as the root object literal and header statements of QML. Eventually, - // these rules will delegate down to JavaScript expressions. - var node = this.startNode(); - node.mode = this.options.mode; - node.headerItemList = this.qml_parseHeaderItemList(); - node.rootObject = null; - if (this.tok.type !== tt.eof) { - node.rootObject = this.qml_parseObjectDefinition(); - } - - return this.finishNode(node, "QMLProgram"); - } else if (this.options.mode === "js") { - return nextMethod.call(this); - } else { - throw new Error("Unknown mode '" + this.options.mode + "'"); - } - }; - }); - }; - - return acorn; - }; -}); \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/acorn-qml/package.json b/qt/org.eclipse.cdt.qt.core/acorn-qml/package.json deleted file mode 100644 index 12ed66314d6..00000000000 --- a/qt/org.eclipse.cdt.qt.core/acorn-qml/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "acorn-qml", - "description": "QML Parser", - "license": "EPL-1.0", - "version": "0.0.0", - "scripts": { - "test": "node test/run.js" - }, - "dependencies": { - "acorn": "^2.6.4" - } -} \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/acorn-qml/test/driver.js b/qt/org.eclipse.cdt.qt.core/acorn-qml/test/driver.js deleted file mode 100644 index d06ed99818e..00000000000 --- a/qt/org.eclipse.cdt.qt.core/acorn-qml/test/driver.js +++ /dev/null @@ -1,116 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -"use strict"; - -var tests = []; - -exports.test = function(code, ast, options) { - tests.push({code: code, ast: ast, options: options}); -}; -exports.testFail = function(code, message, options) { - tests.push({code: code, error: message, options: options}); -}; -exports.testAssert = function(code, assert, options) { - tests.push({code: code, assert: assert, options: options}); -}; - -exports.runTests = function(config, callback) { - var parse = config.parse; - var opts = config.options || {}; - - for (var i = 0; i < tests.length; ++i) { - var test = tests[i]; - if (config.filter && !config.filter(test)) continue; - try { - var testOpts = test.options || {locations: true}; - for (var opt in opts) { - testOpts[opt] = opts[opt]; - } - var expected = {}; - if ((expected.onComment = testOpts.onComment)) { - testOpts.onComment = []; - } - if ((expected.onToken = testOpts.onToken)) { - testOpts.onToken = []; - } - testOpts.plugins = { qml: true }; - testOpts.pluginsLoose = { qml: true }; - var ast = parse(test.code, testOpts); - if (test.error) { - if (config.loose) { - callback("ok", test.code); - } else { - callback("fail", test.code, "Expected error message: " + test.error + "\nBut parsing succeeded."); - } - } - else if (test.assert) { - var error = test.assert(ast); - if (error) callback("fail", test.code, - "\n Assertion failed:\n " + error); - else callback("ok", test.code); - } else { - var mis = misMatch(test.ast, ast); - for (var name in expected) { - if (mis) break; - if (expected[name]) { - mis = misMatch(expected[name], testOpts[name]); - testOpts[name] = expected[name]; - } - } - if (mis) callback("fail", test.code, mis); - else callback("ok", test.code); - } - } catch(e) { - if (!(e instanceof SyntaxError || e instanceof Error)) { - throw e; - } - if (test.error) { - if (e.message == test.error) callback("ok", test.code); - else callback("fail", test.code, - "Expected error message: " + test.error + "\nGot error message: " + e.message); - } else { - callback("error", test.code, e.stack || e.toString()); - } - } - } -}; - -function ppJSON(v) { return v instanceof RegExp ? v.toString() : JSON.stringify(v, null, 2); } -function addPath(str, pt) { - if (str.charAt(str.length-1) == ")") - return str.slice(0, str.length-1) + "/" + pt + ")"; - return str + " (" + pt + ")"; -} - -var misMatch = exports.misMatch = function(exp, act) { - var mis = null; - if (!exp || !act || (typeof exp != "object") || (typeof act != "object")) { - if (exp !== act) return ppJSON(exp) + " !== " + ppJSON(act); - } else if (exp instanceof RegExp || act instanceof RegExp) { - var left = ppJSON(exp), right = ppJSON(act); - if (left !== right) return left + " !== " + right; - } else if (exp.splice) { - if (!act.slice) return ppJSON(exp) + " != " + ppJSON(act); - if (act.length != exp.length) return "array length mismatch " + exp.length + " != " + act.length; - for (var i = 0; i < act.length; ++i) { - mis = misMatch(exp[i], act[i]); - if (mis) return addPath(mis, i); - } - } else { - for (var prop in exp) { - mis = misMatch(exp[prop], act[prop]); - if (mis) return addPath(mis, prop); - } - } -}; \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/acorn-qml/test/run.js b/qt/org.eclipse.cdt.qt.core/acorn-qml/test/run.js deleted file mode 100644 index 81ceac806aa..00000000000 --- a/qt/org.eclipse.cdt.qt.core/acorn-qml/test/run.js +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -"use strict"; - -// Get the driver and test code -var driver = require("./driver.js"); -require("./tests-qml.js"); - -// Get and inject the QML plugin into Acorn -var acorn = require("acorn"); -require("acorn/dist/acorn_loose"); -require(".."); -require("../loose"); - -function group(name) { - if (typeof console === "object" && console.group) { - console.group(name); - } -} - -function groupEnd() { - if (typeof console === "object" && console.groupEnd) { - console.groupEnd(name); - } -} - -function log(title, message) { - if (typeof console === "object") console.log(title, message); -} - -var stats, modes = { - "Normal QML": { - config: { - parse: acorn.parse, - filter: function (test) { - var opts = test.options || {}; - return opts.normal !== false && opts.qmltypes !== true; - } - } - }, - "Loose QML": { - config: { - parse: acorn.parse_dammit, - filter: function (test) { - var opts = test.options || {}; - return opts.loose !== false && opts.qmltypes !== true; - } - } - }, - "Loose QMLTypes": { - config: { - parse: acorn.parse_dammit, - options: { - mode: "qmltypes" - }, - filter: function (test) { - var opts = test.options || {}; - return opts.loose !== false && opts.qmltypes !== false; - } - } - } -}; - -function report(state, code, message) { - if (state != "ok") {++stats.failed; log(code, message);} - ++stats.testsRun; -} - -group("Errors"); - -for (var name in modes) { - group(name); - var mode = modes[name]; - stats = mode.stats = {testsRun: 0, failed: 0}; - var t0 = +new Date(); - driver.runTests(mode.config, report); - mode.stats.duration = +new Date() - t0; - groupEnd(); -} - -groupEnd(); - -function outputStats(name, stats) { - log(name + ":", stats.testsRun + " tests run in " + stats.duration + "ms; " + - (stats.failed ? stats.failed + " failures." : "all passed.")); -} - -var total = {testsRun: 0, failed: 0, duration: 0}; - -group("Stats"); - -for (var name in modes) { - var stats = modes[name].stats; - outputStats(name + " parser", stats); - for (var key in stats) total[key] += stats[key]; -} - -outputStats("Total", total); - -groupEnd(); - -if (total.failed && typeof process === "object") { - process.stdout.write("", function () { - process.exit(1); - }); -} \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/acorn-qml/test/tests-qml.js b/qt/org.eclipse.cdt.qt.core/acorn-qml/test/tests-qml.js deleted file mode 100644 index 5fff0568bdd..00000000000 --- a/qt/org.eclipse.cdt.qt.core/acorn-qml/test/tests-qml.js +++ /dev/null @@ -1,4025 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -"use strict"; - -var driver = require("./driver.js"); -var test = driver.test; -var testFail = driver.testFail; -var tokTypes = driver.tokTypes; - -testFail('', "QML only supports ECMA Script Language Specification 5 or older", - { locations: true, ecmaVersion: 6, allowReserved: false }); - -test('import QtQuick 2.02', headerItemList([{ - type: "QMLImport", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 19 } - }, - module: { - type: "QMLModule", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 19 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 14 } - }, - parts: [{ type: "Identifier", name: "QtQuick" }], - name: "QtQuick" - }, - version: { - type: "QMLVersionLiteral", - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 19 } - }, - value: 2.02, - raw: "2.02" - } - } -}])); - -test('import "./file.js"', headerItemList([{ - type: "QMLImport", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 18 } - }, - directory: { - type: "Literal", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 18 } - }, - value: "./file.js", - raw: "\"./file.js\"" - } -}])); - -test('import "./file.js" as MyModule', headerItemList([{ - type: "QMLImport", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 30 } - }, - directory: { - type: "Literal", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 18 } - }, - value: "./file.js", - raw: "\"./file.js\"" - }, - qualifier: { - type: "QMLQualifier", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 30 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 22 }, - end: { line: 1, column: 30 } - }, - name: "MyModule" - } - } -}])); - -testFail('import QtQuick ver', - "Unexpected token (1:15)", - { locations: true, loose: false }); - -testFail('import QtQuick 0x01', - "QML module must specify major and minor version (1:15)", - { locations: true, loose: false }); - -testFail('import QtQuick 1', - "QML module must specify major and minor version (1:15)", - { locations: true, loose: false }); - -test('import QtQuick 2.2\nimport "./file.js"', headerItemList([ - { - type: "QMLImport", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 18 } - }, - module: { - type: "QMLModule", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 18 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 14 } - }, - parts: [{ type: "Identifier", name: "QtQuick" }], - name: "QtQuick" - }, - version: { - type: "QMLVersionLiteral", - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 18 } - }, - value: 2.2, - raw: "2.2" - } - } - }, - { - type: "QMLImport", - loc: { - start: { line: 2, column: 0 }, - end: { line: 2, column: 18 } - }, - directory: { - type: "Literal", - loc: { - start: { line: 2, column: 7 }, - end: { line: 2, column: 18 } - }, - value: "./file.js", - raw: "\"./file.js\"" - } - } -])); - -test('import QtQuick 2.2;import "./file.js"', headerItemList([ - { - type: "QMLImport", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 19 } - }, - module: { - type: "QMLModule", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 18 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 14 } - }, - parts: [{ type: "Identifier", name: "QtQuick" }], - name: "QtQuick" - }, - version: { - type: "QMLVersionLiteral", - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 18 } - }, - value: 2.2, - raw: "2.2" - } - } - }, - { - type: "QMLImport", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 37 } - }, - directory: { - type: "Literal", - loc: { - start: { line: 1, column: 26 }, - end: { line: 1, column: 37 } - }, - value: "./file.js", - raw: "\"./file.js\"" - } - } -])); - -test('import Module 1.0 as MyModule', headerItemList([ - { - type: "QMLImport", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 29 } - }, - module: { - type: "QMLModule", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 17 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 13 } - }, - parts: [{ type: "Identifier", name: "Module" }], - name: "Module" - }, - version: { - type: "QMLVersionLiteral", - loc: { - start: { line: 1, column: 14 }, - end: { line: 1, column: 17 } - }, - value: 1, - raw: "1.0" - } - }, - qualifier: { - type: "QMLQualifier", - loc: { - start: { line: 1, column: 18 }, - end: { line: 1, column: 29 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 21 }, - end: { line: 1, column: 29 } - }, - name: "MyModule" - } - } - } -])); - -test('import Qualified.Id.Test 1.0', headerItemList([ - { - type: "QMLImport", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 28 } - }, - module: { - type: "QMLModule", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 28 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 24 } - }, - parts: [ - { type: "Identifier", name: "Qualified" }, - { type: "Identifier", name: "Id" }, - { type: "Identifier", name: "Test" } - ], - name: "Qualified.Id.Test" - }, - version: { - type: "QMLVersionLiteral", - loc: { - start: { line: 1, column: 25 }, - end: { line: 1, column: 28 } - }, - value: 1, - raw: "1.0" - } - } - } -])); - -test('pragma Singleton', headerItemList([ - { - type: "QMLPragma", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 16 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 16 } - }, - parts: [{ type: "Identifier", name: "Singleton" }], - name: "Singleton" - } - } -])); - -test('pragma Singleton\npragma Other', headerItemList([ - { - type: "QMLPragma", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 16 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 16 } - }, - parts: [{ type: "Identifier", name: "Singleton" }], - name: "Singleton" - } - }, - { - type: "QMLPragma", - loc: { - start: { line: 2, column: 0 }, - end: { line: 2, column: 12 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 2, column: 7 }, - end: { line: 2, column: 12 } - }, - parts: [{ type: "Identifier", name: "Other" }], - name: "Other" - } - } -])); - -test('pragma Singleton;pragma Other', headerItemList([ - { - type: "QMLPragma", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 17 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 16 } - }, - parts: [{ type: "Identifier", name: "Singleton" }], - name: "Singleton" - } - }, - { - type: "QMLPragma", - loc: { - start: { line: 1, column: 17 }, - end: { line: 1, column: 29 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 24 }, - end: { line: 1, column: 29 } - }, - parts: [{ type: "Identifier", name: "Other" }], - name: "Other" - } - } -])); - -test('Window {}', rootObject({ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 9 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 6 } - }, - parts: [{ type: "Identifier", name: "Window" }], - name: "Window" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 9 } - }, - members: [] - } -})); - -test('QtQuick.Window {}', rootObject({ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 17 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 14 } - }, - parts: [ - { type: "Identifier", name: "QtQuick" }, - { type: "Identifier", name: "Window" } - ], - name: "QtQuick.Window" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 17 } - }, - members: [] - } -})); - -test('property {}', rootObject({ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 11 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 8 } - }, - parts: [{ type: "Identifier", name: "property" }], - name: "property" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 9 }, - end: { line: 1, column: 11 } - }, - members: [] - } -})); - -test('readonly {}', rootObject({ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 11 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 8 } - }, - parts: [{ type: "Identifier", name: "readonly" }], - name: "readonly" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 9 }, - end: { line: 1, column: 11 } - }, - members: [] - } -})); - -test('signal {}', rootObject({ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 9 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 6 } - }, - parts: [{ type: "Identifier", name: "signal" }], - name: "signal" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 9 } - }, - members: [] - } -})); - -test('alias {}', rootObject({ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 8 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 5 } - }, - parts: [{ type: "Identifier", name: "alias" }], - name: "alias" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 8 } - }, - members: [] - } -})); - -test('list {}', rootObject({ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 7 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 4 } - }, - parts: [{ type: "Identifier", name: "list" }], - name: "list" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 5 }, - end: { line: 1, column: 7 } - }, - members: [] - } -})); - -test('color {}', rootObject({ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 8 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 5 } - }, - parts: [{ type: "Identifier", name: "color" }], - name: "color" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 8 } - }, - members: [] - } -})); - -test('real {}', rootObject({ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 7 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 4 } - }, - parts: [{ type: "Identifier", name: "real" }], - name: "real" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 5 }, - end: { line: 1, column: 7 } - }, - members: [] - } -})); - -test('string {}', rootObject({ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 9 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 6 } - }, - parts: [{ type: "Identifier", name: "string" }], - name: "string" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 9 } - }, - members: [] - } -})); - -test('url {}', rootObject({ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 6 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 3 } - }, - parts: [{ type: "Identifier", name: "url" }], - name: "url" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 6 } - }, - members: [] - } -})); - -test('Window {Button {}}', rootObjectMembers([{ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 8 }, - end: { line: 1, column: 17 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 8 }, - end: { line: 1, column: 14 } - }, - parts: [{ type: "Identifier", name: "Button" }], - name: "Button" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 17 } - }, - members: [] - } -}])); - -test('a{ property {} }', rootObjectMembers([{ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 14 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 11 } - }, - parts: [{ type: "Identifier", name: "property" }], - name: "property" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 14 } - }, - members: [] - } -}])); - -test('a{ readonly {} }', rootObjectMembers([{ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 14 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 11 } - }, - parts: [{ type: "Identifier", name: "readonly" }], - name: "readonly" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 14 } - }, - members: [] - } -}])); - -test('a{ signal {} }', rootObjectMembers([{ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 12 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 9 } - }, - parts: [{ type: "Identifier", name: "signal" }], - name: "signal" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 10 }, - end: { line: 1, column: 12 } - }, - members: [] - } -}])); - -testFail('a{ readonly property var as: 3 }', - "Unexpected token (1:25)", - { locations: true, loose: false }); - -test('a{ readonly property var w: 3 }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 29 } - }, - default: false, - readonly: true, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 21 }, - end: { line: 1, column: 24 } - }, - primitive: true, - id: { type: "Identifier", name: "var"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 25 }, - end: { line: 1, column: 26 } - }, - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 28 }, - end: { line: 1, column: 29 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ default property var w: 3 }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 28 } - }, - default: true, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 20 }, - end: { line: 1, column: 23 } - }, - primitive: true, - id: { type: "Identifier", name: "var"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 24 }, - end: { line: 1, column: 25 } - }, - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 27 }, - end: { line: 1, column: 28 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -testFail('a{ property var public: 3 }', - "The keyword 'public' is reserved (1:16)", - { locations: true, loose: false }); - -testFail('a{ property var export: 3 }', - "The keyword 'export' is reserved (1:16)", - { locations: true, loose: false }); - -test('a{ property var w: 3 }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 20 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 15 } - }, - primitive: true, - id: { type: "Identifier", name: "var"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 16 }, - end: { line: 1, column: 17 } - }, - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 20 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ property boolean w: 3 }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 24 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 19 } - }, - primitive: true, - id: { type: "Identifier", name: "boolean"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 20 }, - end: { line: 1, column: 21 } - }, - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 23 }, - end: { line: 1, column: 24 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ property double w: 3 }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 23 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 18 } - }, - primitive: true, - id: { type: "Identifier", name: "double"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 20 } - }, - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 22 }, - end: { line: 1, column: 23 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ property int w: 3 }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 20 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 15 } - }, - primitive: true, - id: { type: "Identifier", name: "int"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 16 }, - end: { line: 1, column: 17 } - }, - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 20 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ property list w: 3 }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 27 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 16 } - }, - primitive: true, - id: { type: "Identifier", name: "list"}, - }, - modifier: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 17 }, - end: { line: 1, column: 21 } - }, - primitive: false, - id: { type: "Identifier", name: "Type" } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 23 }, - end: { line: 1, column: 24 } - }, - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 26 }, - end: { line: 1, column: 27 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ property color w: 3 }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 22 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 17 } - }, - primitive: true, - id: { type: "Identifier", name: "color"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 18 }, - end: { line: 1, column: 19 } - }, - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 21 }, - end: { line: 1, column: 22 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ property real w: 3 }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 21 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 16 } - }, - primitive: true, - id: { type: "Identifier", name: "real"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 17 }, - end: { line: 1, column: 18 } - }, - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 20 }, - end: { line: 1, column: 21 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ property string w: 3 }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 23 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 18 } - }, - primitive: true, - id: { type: "Identifier", name: "string"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 20 } - }, - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 22 }, - end: { line: 1, column: 23 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ property url w: 3 }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 20 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 15 } - }, - primitive: true, - id: { type: "Identifier", name: "url"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 16 }, - end: { line: 1, column: 17 } - }, - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 20 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - - -test('a{ property QtObject w: 3 }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 25 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 20 } - }, - primitive: false, - id: { type: "Identifier", name: "QtObject"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 21 }, - end: { line: 1, column: 22 } - }, - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 24 }, - end: { line: 1, column: 25 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ property alias w: 3 }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 22 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 17 } - }, - primitive: true, - id: { type: "Identifier", name: "alias"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 18 }, - end: { line: 1, column: 19 } - }, - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 21 }, - end: { line: 1, column: 22 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ w: 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 7 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 4 } - }, - parts: [{ type: "Identifier", name: "w" }], - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 7 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ x.y.z: 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 11 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 8 } - }, - parts: [ - { type: "Identifier", name: "x" }, - { type: "Identifier", name: "y" }, - { type: "Identifier", name: "z" } - ], - name: "x.y.z" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 10 }, - end: { line: 1, column: 11 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -testFail('a{ import: 3 }', - "Unexpected token (1:3)", - { locations: true, loose: false }); - -testFail('a{ pragma: 3 }', - "Unexpected token (1:3)", - { locations: true, loose: false }); - -testFail('a{ as: 3 }', - "Unexpected token (1:3)", - { locations: true, loose: false }); - -testFail('a{ boolean: 3 }', - "Unexpected token (1:3)", - { locations: true, loose: false }); - -testFail('a{ double: 3 }', - "Unexpected token (1:3)", - { locations: true, loose: false }); - -testFail('a{ int: 3 }', - "Unexpected token (1:3)", - { locations: true, loose: false }); - -test('a{ alias: 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 11 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 8 } - }, - parts: [{ type: "Identifier", name: "alias" }], - name: "alias" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 10 }, - end: { line: 1, column: 11 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ list: 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 10 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 7 } - }, - parts: [{ type: "Identifier", name: "list" }], - name: "list" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 9 }, - end: { line: 1, column: 10 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ property: 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 14 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 11 } - }, - parts: [{ type: "Identifier", name: "property" }], - name: "property" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 13 }, - end: { line: 1, column: 14 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ readonly: 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 14 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 11 } - }, - parts: [{ type: "Identifier", name: "readonly" }], - name: "readonly" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 13 }, - end: { line: 1, column: 14 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ signal: 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 12 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 9 } - }, - parts: [{ type: "Identifier", name: "signal" }], - name: "signal" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 11 }, - end: { line: 1, column: 12 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ color: 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 11 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 8 } - }, - parts: [{ type: "Identifier", name: "color" }], - name: "color" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 10 }, - end: { line: 1, column: 11 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ real: 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 10 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 7 } - }, - parts: [{ type: "Identifier", name: "real" }], - name: "real" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 9 }, - end: { line: 1, column: 10 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ string: 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 12 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 9 } - }, - parts: [{ type: "Identifier", name: "string" }], - name: "string" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 11 }, - end: { line: 1, column: 12 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ url: 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 9 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 6 } - }, - parts: [{ type: "Identifier", name: "url" }], - name: "url" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 8 }, - end: { line: 1, column: 9 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ onClicked: Qt.quit(0) }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 24 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 12 } - }, - parts: [{ type: "Identifier", name: "onClicked" }], - name: "onClicked" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 14 }, - end: { line: 1, column: 24 } - }, - script: { - type: "CallExpression", - callee: { - type: "MemberExpression", - loc: { - start: { line: 1, column: 14 }, - end: { line: 1, column: 21 } - }, - object: { - type: "Identifier", - loc: { - start: { line: 1, column: 14 }, - end: { line: 1, column: 16 } - }, - name: "Qt" - }, - property: { - type: "Identifier", - loc: { - start: { line: 1, column: 17 }, - end: { line: 1, column: 21 } - }, - name: "quit" - }, - computed: false - }, - arguments: [{ - type: "Literal", - loc: { - start: { line: 1, column: 22 }, - end: { line: 1, column: 23 } - }, - value: 0, - raw: "0" - }] - } - } -}])); - -test('a{b:pragma}', javaScript({ - type: "Identifier", - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 10 } - }, - name: "pragma" -})); - -test('a{b:property}', javaScript({ - type: "Identifier", - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 12 } - }, - name: "property" -})); - -test('a{b:readonly}', javaScript({ - type: "Identifier", - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 12 } - }, - name: "readonly" -})); - -test('a{b:signal}', javaScript({ - type: "Identifier", - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 10 } - }, - name: "signal" -})); - -test('a{b:alias}', javaScript({ - type: "Identifier", - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 9 } - }, - name: "alias" -})); - -test('a{b:list}', javaScript({ - type: "Identifier", - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 8 } - }, - name: "list" -})); - -test('a{b:color}', javaScript({ - type: "Identifier", - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 9 } - }, - name: "color" -})); - -test('a{b:real}', javaScript({ - type: "Identifier", - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 8 } - }, - name: "real" -})); - -test('a{b:string}', javaScript({ - type: "Identifier", - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 10 } - }, - name: "string" -})); - -test('a{b:url}', javaScript({ - type: "Identifier", - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 7 } - }, - name: "url" -})); - -test('a{b:[]}', javaScript({ - type: "ArrayExpression", - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 6 } - }, - elements: [] -})); - -test('a{b:[{}]}', javaScript({ - type: "ArrayExpression", - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 8 } - }, - elements: [{ - type: "ObjectExpression", - loc: { - start: { line: 1, column: 5 }, - end: { line: 1, column: 7 } - }, - }] -})); - -test('a{ function fn() {} }', rootObjectMembers([{ - type: "FunctionDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 19 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 14 } - }, - name: "fn" - }, - params: [], - body: { - type: "BlockStatement", - loc: { - start: { line: 1, column: 17 }, - end: { line: 1, column: 19 } - }, - body: [] - } -}])); - -test('a{ function add(a, b) { return a + b } }', rootObjectMembers([{ - type: "FunctionDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 38 } - }, - id: { - type: "Identifier", - name: "add" - }, - params: [ - { type: "Identifier", name: "a" }, - { type: "Identifier", name: "b" } - ], - body: { - type: "BlockStatement", - loc: { - start: { line: 1, column: 22 }, - end: { line: 1, column: 38 } - }, - body: [{ - type: "ReturnStatement", - argument: { - type: "BinaryExpression", - left: { type: "Identifier", name: "a" }, - operator: "+", - right: { type: "Identifier", name: "b" } - } - }] - } -}])); - -testFail('a{ function () {} }', - "Unexpected token (1:12)", - { locations: true, loose: false }); - -test('a{ signal b }', rootObjectMembers([{ - type: "QMLSignalDefinition", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 11 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 10 }, - end: { line: 1, column: 11 } - }, - name: "b" - }, - params: [] -}])); - -test('a{ signal b () }', rootObjectMembers([{ - type: "QMLSignalDefinition", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 14 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 10 }, - end: { line: 1, column: 11 } - }, - name: "b" - }, - params: [] -}])); - -test('a{ signal b (type param)}', rootObjectMembers([{ - type: "QMLSignalDefinition", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 24 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 10 }, - end: { line: 1, column: 11 } - }, - name: "b" - }, - params: [{ - type: "QMLParameter", - loc: { - start: { line: 1, column: 13 }, - end: { line: 1, column: 23 } - }, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 13 }, - end: { line: 1, column: 17 } - }, - primitive: false, - id: { type: "Identifier", name: "type" } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 18 }, - end: { line: 1, column: 23 } - }, - name: "param" - } - }] -}])); - -test('a{ signal b (type1 param1, type2 param2, type3 param3)}', rootObjectMembers([{ - type: "QMLSignalDefinition", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 54 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 10 }, - end: { line: 1, column: 11 } - }, - name: "b" - }, - params: [ - { - type: "QMLParameter", - loc: { - start: { line: 1, column: 13 }, - end: { line: 1, column: 25 } - }, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 13 }, - end: { line: 1, column: 18 } - }, - primitive: false, - id: { type: "Identifier", name: "type1" } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 25 } - }, - name: "param1" - } - }, - { - type: "QMLParameter", - loc: { - start: { line: 1, column: 27 }, - end: { line: 1, column: 39 } - }, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 27 }, - end: { line: 1, column: 32 } - }, - primitive: false, - id: { type: "Identifier", name: "type2" } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 33 }, - end: { line: 1, column: 39 } - }, - name: "param2" - } - }, - { - type: "QMLParameter", - loc: { - start: { line: 1, column: 41 }, - end: { line: 1, column: 53 } - }, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 41 }, - end: { line: 1, column: 46 } - }, - primitive: false, - id: { type: "Identifier", name: "type3" } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 47 }, - end: { line: 1, column: 53 } - }, - name: "param3" - } - } - ] -}])); - -test('a{ id: test }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 11 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 5 } - }, - parts: [{ - type: "Identifier", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 5 } - }, - name: "id" - }], - name: "id" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 11 } - }, - script: { - type: "Identifier", - name: "test" - } - } -}])); - -/* -* Test the base QML Hello World program created by Eclipse CDT. -*/ -test('import QtQuick 2.3\nimport QtQuick.Window 2.2\nWindow {\n\tvisible: true\n\n\tMouseArea {\n\t\tanchors.fill: parent\n\t\tonClicked: {\n\t\t\tQt.quit();\n\t\t}\n\t}\n\tText {\n\t\ttext: qsTr("Hello World")\n\t\tanchors.centerIn: parent\n\t}\n}', - program([{ - type: "QMLImport", - loc: { - start: { line: 1, column: 0 - }, - end: { line: 1, column: 18 } - }, - module: { - type: "QMLModule", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 18 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 14 } - }, - parts: [{ type: "Identifier", name: "QtQuick" }], - name: "QtQuick" - }, - version: { - type: "QMLVersionLiteral", - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 18 } - }, - raw: "2.3", - } - } - }, - { - type: "QMLImport", - loc: { - start: { line: 2, column: 0 }, - end: { line: 2, column: 25 } - }, - module: { - type: "QMLModule", - loc: { - start: { line: 2, column: 7 }, - end: { line: 2, column: 25 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 2, column: 7 }, - end: { line: 2, column: 21 } - }, - parts: [ - { type: "Identifier", name: "QtQuick" }, - { type: "Identifier", name: "Window" } - ], - name: "QtQuick.Window" - }, - version: { - type: "QMLVersionLiteral", - loc: { - start: { line: 2, column: 22 }, - end: { line: 2, column: 25 } - }, - raw: "2.2", - } - } - }],{ - type: "QMLObjectDefinition", - loc: { - start: { line: 3, column: 0 }, - end: { line: 16, column: 1 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 3, column: 0 }, - end: { line: 3, column: 6 } - }, - parts: [{ type: "Identifier", name: "Window" }], - name: "Window" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 3, column: 7 }, - end: { line: 16, column: 1 } - }, - members: [ - { - type: "QMLPropertyBinding", - loc: { - start: { line: 4, column: 1 }, - end: { line: 4, column: 14 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 4, column: 1 }, - end: { line: 4, column: 8 } - }, - parts: [{ type: "Identifier", name: "visible" }], - name: "visible" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 4, column: 10 }, - end: { line: 4, column: 14 } - }, - script: { - type: "Literal", - value: true, - raw: "true" - } - } - }, - { - type: "QMLObjectDefinition", - loc: { - start: { line: 6, column: 1 }, - end: { line: 11, column: 2 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 6, column: 1 }, - end: { line: 6, column: 10 } - }, - parts: [{ type: "Identifier", name: "MouseArea" }], - name: "MouseArea" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 6, column: 11 }, - end: { line: 11, column: 2 } - }, - members: [ - { - type: "QMLPropertyBinding", - loc: { - start: { line: 7, column: 2 }, - end: { line: 7, column: 22 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 7, column: 2 }, - end: { line: 7, column: 14 } - }, - parts: [ - { type: "Identifier", name: "anchors" }, - { type: "Identifier", name: "fill" } - ], - name: "anchors.fill" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 7, column: 16 }, - end: { line: 7, column: 22 } - }, - script: { - type: "Identifier", - name: "parent" - } - } - }, - { - type: "QMLPropertyBinding", - loc: { - start: { line: 8, column: 2 }, - end: { line: 10, column: 3 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 8, column: 2 }, - end: { line: 8, column: 11 } - }, - parts: [{ type: "Identifier", name: "onClicked" }], - name: "onClicked" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 8, column: 13 }, - end: { line: 10, column: 3 } - }, - script: { - type: "QMLStatementBlock", - body: [{ - type: "ExpressionStatement", - expression: { - type: "CallExpression", - callee: { - type: "MemberExpression", - object: { - type: "Identifier", - name: "Qt" - }, - property: { - type: "Identifier", - name: "quit" - }, - computed: false - }, - arguments: [] - } - }] - } - } - } - ] - } - }, - { - type: "QMLObjectDefinition", - loc: { - start: { line: 12, column: 1 }, - end: { line: 15, column: 2 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 12, column: 1 }, - end: { line: 12, column: 5 } - }, - parts: [{ type: "Identifier", name: "Text" }], - name: "Text" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 12, column: 6 }, - end: { line: 15, column: 2 } - }, - members: [ - { - type: "QMLPropertyBinding", - loc: { - start: { line: 13, column: 2 }, - end: { line: 13, column: 27 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 13, column: 2 }, - end: { line: 13, column: 6 } - }, - parts: [{ type: "Identifier", name: "text" }], - name: "text" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 13, column: 8 }, - end: { line: 13, column: 27 } - }, - script: { - type: "CallExpression", - callee: { - type: "Identifier", - name: "qsTr" - }, - arguments: [{ - type: "Literal", - value: "Hello World", - raw: "\"Hello World\"" - }] - } - } - }, - { - type: "QMLPropertyBinding", - loc: { - start: { line: 14, column: 2 }, - end: { line: 14, column: 26 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 14, column: 2 }, - end: { line: 14, column: 18 } - }, - parts: [ - { type: "Identifier", name: "anchors" }, - { type: "Identifier", name: "centerIn" } - ], - name: "anchors.centerIn" - }, - binding: { - type: "QMLScriptBinding", - script: { - type: "Identifier", - name: "parent" - } - } - } - ] - } - } - ] - } - } -), { locations: true, qmltypes: false }); - -/*************************************************************************** -* Loose Parser Tests * -****************************************************************************/ -function testLoose(code, ast, options) { - var opts = options || {}; - opts.loose = true; - opts.normal = false; - opts.locations = true; - test(code, ast, opts); -} - -testLoose('import QtQuick', headerItemList([{ - type: "QMLImport", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 14 } - }, - module: { - type: "QMLModule", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 14 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 14 } - }, - parts: [{ type: "Identifier", name: "QtQuick" }], - name: "QtQuick" - }, - version: { - type: "QMLVersionLiteral", - loc: { - start: { line: 1, column: 14 }, - end: { line: 1, column: 14 } - }, - value: 0, - raw: "0.0" - } - } -}])); - -testLoose('import ', headerItemList([{ - type: "QMLImport", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 7 } - }, - module: { - type: "QMLModule", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 7 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 7 } - }, - parts: [{ type: "Identifier", name: "✖" }], - name: "✖" - }, - version: { - type: "QMLVersionLiteral", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 7 } - }, - value: 0, - raw: "0.0" - } - } -}])); - -testLoose('import QtQuick 0x01', headerItemList([{ - type: "QMLImport", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 19 } - }, - module: { - type: "QMLModule", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 19 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 14 } - }, - parts: [{ type: "Identifier", name: "QtQuick" }], - name: "QtQuick" - }, - version: { - type: "QMLVersionLiteral", - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 19 } - }, - value: 1, - raw: "0x01" - } - } -}])); - -testLoose('import QtQuick 1', headerItemList([{ - type: "QMLImport", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 16 } - }, - module: { - type: "QMLModule", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 16 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 14 } - }, - parts: [{ type: "Identifier", name: "QtQuick" }], - name: "QtQuick" - }, - version: { - type: "QMLVersionLiteral", - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 16 } - }, - value: 1, - raw: "1" - } - } -}])); - -testLoose('import "./file.js', headerItemList([{ - type: "QMLImport", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 17 } - }, - directory: { - type: "Literal", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 17 } - }, - value: "./file.js", - raw: "\"./file.js" - } -}])); - -testLoose('import QtQuick 2.2 as ', headerItemList([{ - type: "QMLImport", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 22 } - }, - module: { - type: "QMLModule", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 18 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 14 } - }, - parts: [{ type: "Identifier", name: "QtQuick" }], - name: "QtQuick" - }, - version: { - type: "QMLVersionLiteral", - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 18 } - }, - value: 2.2, - raw: "2.2" - } - }, - qualifier: { - type: "QMLQualifier", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 22 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 22 }, - end: { line: 1, column: 22 } - }, - name: "✖" - } - } -}])); - -testLoose('Window {', rootObject({ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 8 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 6 } - }, - parts: [{ type: "Identifier", name: "Window" }], - name: "Window" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 8 } - }, - members: [] - } -})); - -testLoose('Window {\n\tprop: 3', rootObject({ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 0 }, - end: { line: 2, column: 8 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 6 } - }, - parts: [{ type: "Identifier", name: "Window" }], - name: "Window" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 7 }, - end: { line: 2, column: 8 } - }, - members: [{ - type: "QMLPropertyBinding", - loc: { - start: { line: 2, column: 1 }, - end: { line: 2, column: 8 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 2, column: 1 }, - end: { line: 2, column: 5 } - }, - parts: [{ type: "Identifier", name: "prop" }], - name: "prop" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 2, column: 7 }, - end: { line: 2, column: 8 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } - }] - } -})); - -testLoose('a {\n\tb {\n\n\tc {\n}', rootObject({ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 0 }, - end: { line: 5, column: 1 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 1 } - }, - parts: [{ type: "Identifier", name: "a" }], - name: "a" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 2 }, - end: { line: 5, column: 1 } - }, - members: [{ - type: "QMLObjectDefinition", - loc: { - start: { line: 2, column: 1 }, - end: { line: 5, column: 1 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 2, column: 1 }, - end: { line: 2, column: 2 } - }, - parts: [{ type: "Identifier", name: "b" }], - name: "b" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 2, column: 3 }, - end: { line: 5, column: 1 } - }, - members: [{ - type: "QMLObjectDefinition", - loc: { - start: { line: 4, column: 1 }, - end: { line: 5, column: 1 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 4, column: 1 }, - end: { line: 4, column: 2 } - }, - parts: [{ type: "Identifier", name: "c" }], - name: "c" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 4, column: 3 }, - end: { line: 5, column: 1 } - }, - members: [] - } - }] - } - }] - } -})); - -testLoose('a{ property var }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 17 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 15 } - }, - primitive: true, - id: { type: "Identifier", name: "var"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 17 }, - end: { line: 1, column: 17 } - }, - name: "✖" - }, - binding: null -}])); - -testLoose('a{ w }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 5 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 4 } - }, - parts: [{ type: "Identifier", name: "w" }], - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 5 }, - end: { line: 1, column: 5 } - }, - script: { - type: "Identifier", - name: "✖" - } - } -}])); - -testLoose('a{ w: }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 7 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 4 } - }, - parts: [{ type: "Identifier", name: "w" }], - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 7 } - }, - script: { - type: "Identifier", - name: "✖" - } - } -}])); - -testLoose('a{ : 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 6 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 3 } - }, - parts: [{ type: "Identifier", name: "✖" }], - name: "✖" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 5 }, - end: { line: 1, column: 6 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -testLoose('a{ anchors.: 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 14 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 11 } - }, - parts: [ - { type: "Identifier", name: "anchors" }, - { type: "Identifier", name: "✖" } - ], - name: "anchors.✖" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 13 }, - end: { line: 1, column: 14 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -testLoose('a{ anchors..: 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 15 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 12 } - }, - parts: [ - { type: "Identifier", name: "anchors" }, - { type: "Identifier", name: "✖" }, - { type: "Identifier", name: "✖" } - ], - name: "anchors.✖.✖" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 14 }, - end: { line: 1, column: 15 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -testLoose('a{ ..: 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 8 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 5 } - }, - parts: [ - { type: "Identifier", name: "✖" }, - { type: "Identifier", name: "✖" }, - { type: "Identifier", name: "✖" } - ], - name: "✖.✖.✖" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 8 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -testLoose('a{ var }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 7 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 6 } - }, - primitive: true, - id: { type: "Identifier", name: "var"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 7 } - }, - name: "✖" - }, - binding: null -}])); - -testLoose('a{ var w }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 8 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 6 } - }, - primitive: true, - id: { type: "Identifier", name: "var"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 8 } - }, - name: "w" - }, - binding: null -}])); - -testLoose('a{ obj w }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 8 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 6 } - }, - primitive: false, - id: { type: "Identifier", name: "obj"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 8 } - }, - name: "w" - }, - binding: null -}])); - -// TODO: Allow this to run with the normal parser once the ambiguity is solved -testLoose('a{ property var b: Window {} }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 28 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 15 } - }, - primitive: true, - id: { type: "Identifier", name: "var"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 16 }, - end: { line: 1, column: 17 } - }, - name: "b" - }, - binding: { - type: "QMLObjectBinding", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 28 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 25 } - }, - parts: [{ type: "Identifier", name: "Window" }], - name: "Window" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 26 }, - end: { line: 1, column: 28 } - }, - members: [] - } - } -}]), { locations: true, qmltypes: false }); - -// TODO: Allow this to run with the normal parser once the ambiguity is solved -testLoose('a{ b: Window {} }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 15 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 4 } - }, - parts: [{ type: "Identifier", name: "b" }], - name: "b" - }, - binding: { - type: "QMLObjectBinding", - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 15 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 12 } - }, - parts: [{ type: "Identifier", name: "Window" }], - name: "Window" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 13 }, - end: { line: 1, column: 15 } - }, - members: [] - } - } -}]), { locations: true, qmltypes: false }); - -testLoose('a{ signal }', rootObjectMembers([{ - type: "QMLSignalDefinition", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 10 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 10 }, - end: { line: 1, column: 10 } - }, - name: "✖" - }, - params: [] -}])); - -testLoose('a{ signal () }', rootObjectMembers([{ - type: "QMLSignalDefinition", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 12 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 10 }, - end: { line: 1, column: 10 } - }, - name: "✖" - }, - params: [] -}])); - -testLoose('a{ signal test( }', rootObjectMembers([{ - type: "QMLSignalDefinition", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 16 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 10 }, - end: { line: 1, column: 14 } - }, - name: "test" - }, - params: [] -}])); - -testLoose('a{ signal test(int test }', rootObjectMembers([{ - type: "QMLSignalDefinition", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 24 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 10 }, - end: { line: 1, column: 14 } - }, - name: "test" - }, - params: [{ - type: "QMLParameter", - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 23 } - }, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 18 } - }, - primitive: true, - id: { type: "Identifier", name: "int" } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 23 } - }, - name: "test" - } - }] -}])); - -testLoose('Window {\n\tfunction\n\tproperty var prop\n}', rootObjectMembers([ - { - type: "FunctionDeclaration", - loc: { - start: { line: 2, column: 1 }, - end: { line: 3, column: 9 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 3, column: 1 }, - end: { line: 3, column: 9 } - }, - name: "property" - }, - params: [], - body: { - type: "BlockStatement", - loc: { - start: { line: 3, column: 9 }, - end: { line: 3, column: 9 } - }, - body: [] - } - }, - { - type: "QMLPropertyDeclaration", - loc: { - start: { line: 3, column: 10 }, - end: { line: 3, column: 18 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 3, column: 10 }, - end: { line: 3, column: 13 } - }, - primitive: true, - id: { type: "Identifier", name: "var"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 3, column: 14 }, - end: { line: 3, column: 18 } - }, - name: "prop" - }, - binding: null - } -])); - -testLoose('Window {\n\tfunction (something)\n\tproperty var prop\n}', rootObjectMembers([ - { - type: "FunctionDeclaration", - loc: { - start: { line: 2, column: 1 }, - end: { line: 2, column: 21 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 2, column: 10 }, - end: { line: 2, column: 10 } - }, - name: "✖" - }, - params: [ - { - type: "Identifier", - loc: { - start: { line: 2, column: 11 }, - end: { line: 2, column: 20 } - }, - name: "something" - } - ], - body: { - type: "BlockStatement", - loc: { - start: { line: 2, column: 21 }, - end: { line: 2, column: 21 } - }, - body: [] - } - }, - { - type: "QMLPropertyDeclaration", - loc: { - start: { line: 3, column: 1 }, - end: { line: 3, column: 18 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 3, column: 10 }, - end: { line: 3, column: 13 } - }, - primitive: true, - id: { type: "Identifier", name: "var"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 3, column: 14 }, - end: { line: 3, column: 18 } - }, - name: "prop" - }, - binding: null - } -])); - -testLoose('Window {\n\tfunction (\n\tproperty var prop\n}', rootObjectMembers([ - { - type: "FunctionDeclaration", - loc: { - start: { line: 2, column: 1 }, - end: { line: 3, column: 1 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 2, column: 10 }, - end: { line: 2, column: 10 } - }, - name: "✖" - }, - params: [], - body: { - type: "BlockStatement", - loc: { - start: { line: 3, column: 1 }, - end: { line: 3, column: 1 } - }, - body: [] - } - }, - { - type: "QMLPropertyDeclaration", - loc: { - start: { line: 3, column: 1 }, - end: { line: 3, column: 18 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 3, column: 10 }, - end: { line: 3, column: 13 } - }, - primitive: true, - id: { type: "Identifier", name: "var"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 3, column: 14 }, - end: { line: 3, column: 18 } - }, - name: "prop" - }, - binding: null - } -])); - -// TODO: Allow this to run on the normal parser once the ambiguity is solved -testLoose("a{ QtObject on test {} }", rootObjectMembers([{ - type: "QMLPropertyModifier", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 22 } - }, - kind: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 11 } - }, - parts: [{ type: "Identifier", name: "QtObject" }], - name: "QtObject" - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 19 } - }, - parts: [{ type: "Identifier", name: "test" }], - name: "test" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 20 }, - end: { line: 1, column: 22 } - }, - members: [] - } -}])); - -// TODO: Allow this to run on the normal parser once the ambiguity is solved -testLoose("a{ QtObject on test {} }", rootObjectMembers([{ - type: "QMLPropertyModifier", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 22 } - }, - kind: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 11 } - }, - parts: [{ type: "Identifier", name: "QtObject" }], - name: "QtObject" - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 19 } - }, - parts: [{ type: "Identifier", name: "test" }], - name: "test" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 20 }, - end: { line: 1, column: 22 } - }, - members: [] - } -}])); - -testLoose("a{ QtObject. on test {} }", rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 23 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 15 } - }, - parts: [ - { type: "Identifier", name: "QtObject" }, - { type: "Identifier", name: "on" } - ], - name: "QtObject.on" - }, - binding: { - type: "QMLObjectBinding", - loc: { - start: { line: 1, column: 16 }, - end: { line: 1, column: 23 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 16 }, - end: { line: 1, column: 20 } - }, - parts: [{ type: "Identifier", name: "test" }], - name: "test" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 21 }, - end: { line: 1, column: 23 } - }, - members: [] - } - } -}]), { locations: true, qmltypes: false } ); - -// TODO: Allow this to run on the normal parser once the ambiguity is solved -testLoose("a{ s: [ QtObject {} ] }", rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 21 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 4 } - }, - parts: [{ type: "Identifier", name: "s" }], - name: "s" - }, - binding: { - type: "QMLArrayBinding", - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 21 } - }, - elements: [ - { - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 8 }, - end: { line: 1, column: 19 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 8 }, - end: { line: 1, column: 16 } - }, - parts: [{ type: "Identifier", name: "QtObject" }], - name: "QtObject" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 17 }, - end: { line: 1, column: 19 } - }, - members: [] - } - } - ] - } -}]), { locations: true, qmltypes: false }); - -// TODO: Allow this to run on the normal parser once the ambiguity is solved -testLoose("a{ s: [ QtObject {}, QtObject {} ] }", rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 34 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 4 } - }, - parts: [{ type: "Identifier", name: "s" }], - name: "s" - }, - binding: { - type: "QMLArrayBinding", - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 34 } - }, - elements: [ - { - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 8 }, - end: { line: 1, column: 19 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 8 }, - end: { line: 1, column: 16 } - }, - parts: [{ type: "Identifier", name: "QtObject" }], - name: "QtObject" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 17 }, - end: { line: 1, column: 19 } - }, - members: [] - } - }, - { - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 21 }, - end: { line: 1, column: 32 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 21 }, - end: { line: 1, column: 29 } - }, - parts: [{ type: "Identifier", name: "QtObject" }], - name: "QtObject" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 30 }, - end: { line: 1, column: 32 } - }, - members: [] - } - } - ] - } -}]), { locations: true, qmltypes: false }); - -// TODO: Allow this to run on the normal parser once the ambiguity is solved -testLoose("a{ s: [ QtObject ] }", rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 18 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 4 } - }, - parts: [{ type: "Identifier", name: "s" }], - name: "s" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 18 } - }, - block: false, - script: { - type: "ArrayExpression", - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 18 } - }, - elements: [ - { - type: "Identifier", - loc: { - start: { line: 1, column: 8 }, - end: { line: 1, column: 16 } - }, - name: "QtObject" - } - ] - } - } -}] -), { locations: true, qmltypes: false }); - -// TODO: Allow this to run on the normal parser once the ambiguity is solved -testLoose("a{ property var s: [ QtObject {} ] }", rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 34 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 15 } - }, - primitive: true, - id: { type: "Identifier", name: "var" } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 16 }, - end: { line: 1, column: 17 } - }, - name: "s" - }, - binding: { - type: "QMLArrayBinding", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 34 } - }, - elements: [ - { - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 21 }, - end: { line: 1, column: 32 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 21 }, - end: { line: 1, column: 29 } - }, - parts: [{ type: "Identifier", name: "QtObject" }], - name: "QtObject" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 30 }, - end: { line: 1, column: 32 } - }, - members: [] - } - } - ] - } -}]), { locations: true, qmltypes: false }); - -// TODO: Allow this to run on the normal parser once the ambiguity is solved -testLoose("a{ property var s: [ QtObject ] }", rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 31 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 15 } - }, - primitive: true, - id: { type: "Identifier", name: "var" } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 16 }, - end: { line: 1, column: 17 } - }, - name: "s" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 31 } - }, - block: false, - script: { - type: "ArrayExpression", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 31 } - }, - elements: [ - { - type: "Identifier", - loc: { - start: { line: 1, column: 21 }, - end: { line: 1, column: 29 } - }, - name: "QtObject" - } - ] - } - } -}]), { locations: true, qmltypes: false }); - -testLoose("a{ s: [ QtObject {} }", rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 20 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 4 } - }, - parts: [{ type: "Identifier", name: "s" }], - name: "s" - }, - binding: { - type: "QMLArrayBinding", - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 20 } - }, - elements: [ - { - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 8 }, - end: { line: 1, column: 19 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 8 }, - end: { line: 1, column: 16 } - }, - parts: [{ type: "Identifier", name: "QtObject" }], - name: "QtObject" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 17 }, - end: { line: 1, column: 19 } - }, - members: [] - } - } - ] - } -}]), { locations: true, qmltypes: false }); - -testLoose("a{ s: [ QtObject { ] }", rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 22 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 4 } - }, - parts: [{ type: "Identifier", name: "s" }], - name: "s" - }, - binding: { - type: "QMLArrayBinding", - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 22 } - }, - elements: [ - { - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 8 }, - end: { line: 1, column: 22 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 8 }, - end: { line: 1, column: 16 } - }, - parts: [{ type: "Identifier", name: "QtObject" }], - name: "QtObject" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 17 }, - end: { line: 1, column: 22 } - }, - members: [] - } - } - ] - } -}]), { locations: true, qmltypes: false }); - -/*************************************************************************** -* QMLTypes Parser Tests * -****************************************************************************/ -function testQMLTypes(code, ast, options) { - var opts = options || {}; - opts.qmltypes = true; - opts.locations = true; - test(code, ast, opts); -} - -testQMLTypes("a{ b: {} }", javaScript({ - type: "ObjectExpression", - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 8 } - }, - properties: [] -})); - -testQMLTypes('a{ b: "test" }', javaScript({ - type: "Literal", - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 12 } - }, - value: "test", - raw: '"test"' -})); - -testQMLTypes('a{ b: ["one", "two"] }', javaScript({ - type: "ArrayExpression", - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 20 } - }, - elements: [ - { - type: "Literal", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 12 } - }, - value: "one", - raw: '"one"' - }, - { - type: "Literal", - loc: { - start: { line: 1, column: 14 }, - end: { line: 1, column: 19 } - }, - value: "two", - raw: '"two"' - } - ] -})); - -/* -* Creates a Program with 'headerItemList' and 'rootObject' as the program's expected -* body. -*/ -function program(headerItemList, rootObject) { - return { - type: "QMLProgram", - headerItemList: { - type: "QMLHeaderItemList", - items: headerItemList || [] - }, - rootObject: rootObject || null - }; -} - -/* -* Creates a QMLHeaderItemList with 'stmts' as the expected statements and 'prog' as the -* parent Program. A value of null for 'prog' will append the QMLHeaderItemList AST to -* the Program returned by program(). -*/ -function headerItemList(items, prog) { - prog = prog || program(); - prog.headerItemList.items = items; - return prog; -} - -/* -* Creates a QMLObjectDefinition with 'stmts' as the expected statements and 'prog' as the parent -* Program. A value of null for 'prog' will append the QMLObjectDefinition AST to the Program -* returned by program(). -*/ -function rootObject(obj, prog) { - prog = prog || program(); - prog.rootObject = obj; - return prog; -} - -/* -* Creates a QMLObjectInitializer with 'members' as the expected members and 'obj' as the parent -* QMLObjectDefinition. A value of null for 'obj' will append the QMLObjectInitializer AST to the -* QMLObjectDefinition returned by rootObject(). -*/ -function rootObjectMembers(members, obj) { - var rootObj = obj || rootObject({ - type: "QMLObjectDefinition", - body: { - type: "QMLObjectInitializer", - members: members - } - }); - return rootObj; -} - -/* -* Creates a JavaScript Expression with 'expr' as the expected expression and 'objMembers' as -* the parent QMLObjectInitializer. A value of null for 'objMembers' will append the JavaScript -* Expression to the QMLObjectInitializer returned by rootObjectMembers(). -*/ -function javaScript(expr, objMembers) { - objMembers = objMembers || rootObjectMembers([{ - type: "QMLPropertyBinding", - binding: { - type: "QMLScriptBinding", - script: expr - } - }]); - return objMembers; -} \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/acorn-qml/walk/index.js b/qt/org.eclipse.cdt.qt.core/acorn-qml/walk/index.js deleted file mode 100644 index 85852618d66..00000000000 --- a/qt/org.eclipse.cdt.qt.core/acorn-qml/walk/index.js +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -(function (mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - return mod(require("acorn/dist/walk")); - if (typeof define == "function" && define.amd) // AMD - return define(["acorn/dist/walk"], mod); - mod(acorn.walk); // Plain browser env -})(function (walk) { - "use strict"; - - function skipThrough(node, st, c) { - c(node, st); - } - - function ignore(node, st, c) {} - - function extendWalk(walker, funcs) { - for (var prop in funcs) { - walker[prop] = funcs[prop]; - } - } - - extendWalk(walk.base, { - QMLProgram: function (node, st, c) { - c(node.headerItemList, st); - if (node.rootObject) { - c(node.rootObject, st, "QMLRootObject"); - } - }, - QMLHeaderItemList: function (node, st, c) { - for (var i = 0; i < node.items.length; i++) { - c(node.items[i], st, "QMLHeaderItem"); - } - }, - QMLHeaderItem: skipThrough, - QMLImport: ignore, - QMLPragma: ignore, - QMLRootObject: skipThrough, - QMLObjectDefinition: function (node, st, c) { - c(node.body, st); - }, - QMLObjectInitializer: function (node, st, c) { - for (var i = 0; i < node.members.length; i++) { - c(node.members[i], st, "QMLObjectMember"); - } - }, - QMLObjectMember: skipThrough, - QMLPropertyDeclaration: function (node, st, c) { - if (node.binding) { - c(node.binding, st, "QMLBinding"); - } - }, - QMLSignalDefinition: ignore, - QMLPropertyBinding: function (node, st, c) { - c(node.binding, st, "QMLBinding"); - }, - QMLBinding: skipThrough, - QMLObjectBinding: function (node, st, c) { - c(node.body, st); - }, - QMLArrayBinding: function (node, st, c) { - for (var i = 0; i < node.elements.length; i++) { - c(node.elements[i], st); - } - }, - QMLScriptBinding: function (node, st, c) { - c(node.script, st); - }, - QMLQualifiedID: ignore, - QMLStatementBlock: function (node, st, c) { - for (var i = 0; i < node.body.length; i++) { - c(node.body[i], st, "Statement"); - } - } - }); -}); \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/build.properties b/qt/org.eclipse.cdt.qt.core/build.properties deleted file mode 100644 index eff337fe3b9..00000000000 --- a/qt/org.eclipse.cdt.qt.core/build.properties +++ /dev/null @@ -1,18 +0,0 @@ -bin.includes = META-INF/,\ - plugin.xml,\ - templates/,\ - about.html,\ - plugin.properties,\ - tern-qml/dist/,\ - tern-qml/qml-nsh.js,\ - tern-qml/qml.js,\ - tern-qml/ecma5-defs.js,\ - .,\ - acorn-qml/index.js,\ - acorn-qml/inject.js,\ - acorn-qml/loose/,\ - acorn-qml/walk/ -src.includes = about.html,\ - schema/ -source.. = src/ -output.. = bin/ diff --git a/qt/org.eclipse.cdt.qt.core/plugin.properties b/qt/org.eclipse.cdt.qt.core/plugin.properties deleted file mode 100644 index a125c876cdb..00000000000 --- a/qt/org.eclipse.cdt.qt.core/plugin.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2013 QNX Software Systems and others. -# -# This program and the accompanying materials -# are made available under the terms of the Eclipse Public License 2.0 -# which accompanies this distribution, and is available at -# https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0 - -pluginName=C/C++ Qt Support Core -providerName=Eclipse CDT - -qtProjectFile.name = Qt Project File -qmlFile.name = QML File -qrcFile.name = Qt Resource Collection File -qmakeEnvProvider.name = QMake Environment Provider -QtInstallHeaders.pathProvider.name = Qt Installed Headers -qtNature.name=Qt Nature \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/plugin.xml b/qt/org.eclipse.cdt.qt.core/plugin.xml deleted file mode 100644 index c31e3954f56..00000000000 --- a/qt/org.eclipse.cdt.qt.core/plugin.xml +++ /dev/null @@ -1,175 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/qt/org.eclipse.cdt.qt.core/schema/qtInstallProvider.exsd b/qt/org.eclipse.cdt.qt.core/schema/qtInstallProvider.exsd deleted file mode 100644 index e065898df18..00000000000 --- a/qt/org.eclipse.cdt.qt.core/schema/qtInstallProvider.exsd +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - [Enter description of this extension point.] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [Enter the first release in which this extension point appears.] - - - - - - - - - [Enter extension point usage example here.] - - - - - - - - - [Enter API information here.] - - - - - - - - - [Enter information about supplied implementation of this extension point.] - - - - - diff --git a/qt/org.eclipse.cdt.qt.core/schema/qtToolChainMapper.exsd b/qt/org.eclipse.cdt.qt.core/schema/qtToolChainMapper.exsd deleted file mode 100644 index 5e0211e0299..00000000000 --- a/qt/org.eclipse.cdt.qt.core/schema/qtToolChainMapper.exsd +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - - - [Enter description of this extension point.] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [Enter the first release in which this extension point appears.] - - - - - - - - - [Enter extension point usage example here.] - - - - - - - - - [Enter API information here.] - - - - - - - - - [Enter information about supplied implementation of this extension point.] - - - - - diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/ASTUtil.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/ASTUtil.java deleted file mode 100644 index 246b075ec55..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/ASTUtil.java +++ /dev/null @@ -1,281 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core; - -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.Set; -import java.util.regex.Pattern; - -import org.eclipse.cdt.core.dom.ast.DOMException; -import org.eclipse.cdt.core.dom.ast.IASTDeclaration; -import org.eclipse.cdt.core.dom.ast.IASTExpression; -import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression; -import org.eclipse.cdt.core.dom.ast.IASTIdExpression; -import org.eclipse.cdt.core.dom.ast.IASTInitializerClause; -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.cdt.core.dom.ast.IASTNode; -import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; -import org.eclipse.cdt.core.dom.ast.IBinding; -import org.eclipse.cdt.core.dom.ast.IScope; -import org.eclipse.cdt.core.dom.ast.IType; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFieldReference; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTInitializerClause; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisibilityLabel; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; -import org.eclipse.cdt.core.model.ICProject; -import org.eclipse.cdt.core.model.ITranslationUnit; -import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer; -import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation; -import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding; -import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics; -import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor; -import org.eclipse.cdt.internal.qt.core.index.IQMethod; -import org.eclipse.cdt.internal.qt.core.index.IQObject; -import org.eclipse.core.resources.IProject; - -@SuppressWarnings("restriction") -public class ASTUtil { - - /** - * A convenience method to find the project that contains the given node. Returns null if - * the project cannot be found. - */ - public static IProject getProject(IASTNode node) { - IASTTranslationUnit astTU = node.getTranslationUnit(); - if (astTU == null) - return null; - - ITranslationUnit tu = astTU.getOriginatingTranslationUnit(); - if (tu == null) - return null; - - ICProject cProject = tu.getCProject(); - if (cProject == null) - return null; - - return cProject.getProject(); - } - - /** - * Return the fully qualified name of the binding for the given name. Returns null - * if the name has no binding. Tries to resolve the binding if needed. - */ - public static String getFullyQualifiedName(IASTName name) { - return getFullyQualifiedName(name.resolveBinding()); - } - - /** - * Return the fully qualified name of the given binding. Returns null if there - * is no binding. - */ - public static String getFullyQualifiedName(IBinding binding) { - if (binding == null) - return null; - if (binding instanceof ICPPBinding) - try { - return getFullyQualifiedName(((ICPPBinding) binding).getQualifiedName()); - } catch (DOMException e) { - Activator.log(e); - return null; - } - - String ownerName = getFullyQualifiedName(binding.getOwner()); - return (ownerName == null ? "" : ownerName) + "::" + binding.getName(); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * Create and return a string representation of the fully qualified name in the - * input array's elements. - */ - public static String getFullyQualifiedName(String[] qualName) { - boolean first = true; - StringBuilder str = new StringBuilder(); - for (String name : qualName) { - if (first) - first = false; - else - str.append("::"); //$NON-NLS-1$ - str.append(name); - } - return str.toString(); - } - - // NOTE: This expression allows embedded line terminators (?s) for cases where the code looks like: - // QObject::connect( &a, SIGNAL( - // sig1( - // int - // ), ... - // The regex trims leading and trailing whitespace within the expansion parameter. This is needed - // so that the start of the capture group provides the proper offset into the expansion. - public static final Pattern Regex_MacroExpansion = Pattern - .compile("(?s)([_a-zA-Z]\\w*)\\s*\\(\\s*(.*?)\\s*\\)\\s*"); //$NON-NLS-1$ - - public static IType getBaseType(IType type) { - while (type instanceof ITypeContainer) - type = ((ITypeContainer) type).getType(); - return type; - } - - public static IType getBaseType(IASTNode node) { - if (node instanceof IASTIdExpression) - return getBaseType((IASTIdExpression) node); - if (node instanceof IASTFunctionCallExpression) - return getBaseType((IASTFunctionCallExpression) node); - if (node instanceof IASTExpression) - return getBaseType(((IASTExpression) node).getExpressionType()); - - return null; - } - - public static IType getBaseType(IASTInitializerClause init) { - if (!(init instanceof ICPPASTInitializerClause)) - return null; - - ICPPASTInitializerClause cppInit = (ICPPASTInitializerClause) init; - ICPPEvaluation eval = cppInit.getEvaluation(); - try { - CPPSemantics.pushLookupPoint(cppInit); - return eval == null ? null : getBaseType(eval.getType()); - } finally { - CPPSemantics.popLookupPoint(); - } - } - - public static ICPPClassType getReceiverType(IASTFunctionCallExpression fncall) { - // If the expression is calling a member function then find the type of the - // receiver. - IASTExpression fnName = fncall.getFunctionNameExpression(); - if (fnName instanceof ICPPASTFieldReference) { - ICPPASTFieldReference fieldRef = (ICPPASTFieldReference) fnName; - ICPPASTExpression receiver = fieldRef.getFieldOwner(); - - IType recvType = getBaseType(receiver); - if (recvType instanceof ICPPClassType) - return (ICPPClassType) recvType; - } - - // Otherwise check for a call to implicit 'this'. See details in the thread that - // starts at http://dev.eclipse.org/mhonarc/lists/cdt-dev/msg26972.html - try { - for (IScope scope = CPPVisitor.getContainingScope(fncall); scope != null; scope = scope.getParent()) - if (scope instanceof ICPPClassScope) - return ((ICPPClassScope) scope).getClassType(); - } catch (DOMException e) { - Activator.log(e); - } - - return null; - } - - /** - * Does not return null. - */ - public static Collection findMethods(IQObject qobj, QtMethodReference ref) { - Set bindings = new LinkedHashSet<>(); - - Iterable methods = null; - switch (ref.getType()) { - case Signal: - methods = qobj.getSignals().withoutOverrides(); - break; - case Slot: - methods = qobj.getSlots().withoutOverrides(); - break; - } - - if (methods != null) { - String qtNormalizedSig = QtMethodUtil.getQtNormalizedMethodSignature(ref.getRawSignature()); - if (qtNormalizedSig == null) - return bindings; - - for (IQMethod method : methods) - for (String signature : method.getSignatures()) - if (signature.equals(qtNormalizedSig)) - bindings.add(method); - } - return bindings; - } - - public static T resolveFunctionBinding(Class cls, IASTFunctionCallExpression fnCall) { - IASTName fnName = null; - IASTExpression fnNameExpr = fnCall.getFunctionNameExpression(); - if (fnNameExpr instanceof IASTIdExpression) - fnName = ((IASTIdExpression) fnNameExpr).getName(); - else if (fnNameExpr instanceof ICPPASTFieldReference) - fnName = ((ICPPASTFieldReference) fnNameExpr).getFieldName(); - - IBinding binding = fnName == null ? null : fnName.resolveBinding(); - if (binding == null) - return null; - - return cls.isAssignableFrom(binding.getClass()) ? cls.cast(binding) : null; - } - - public static ICPPASTVisibilityLabel findVisibilityLabel(ICPPMethod method, IASTNode ast) { - // the visibility cannot be found without an ast - if (ast == null) - return null; - - // We need to get the CompTypeSpec in order to see the token that created the method's - // visibility specifier. The ast parameter will be either the method definition or a - // declaration. If it happens to be a declaration, then the CompTypeSpec is a parent of - // the AST and it can be accessed through public API. However, if the ast parameter happens - // to be a definition, then there isn't any public API (that I've found) to get to the - // CompTypeSpec. Instead, we cheat and use the InternalBinding. - - MethodSpec methodSpec = new MethodSpec(ast); - if (methodSpec.clsSpec == null && method instanceof ICPPInternalBinding) { - ICPPInternalBinding internalBinding = (ICPPInternalBinding) method; - IASTNode[] decls = internalBinding.getDeclarations(); - for (int i = 0; methodSpec.clsSpec == null && i < decls.length; ++i) - methodSpec = new MethodSpec(decls[i]); - } - - if (methodSpec.clsSpec == null) - return null; - - ICPPASTVisibilityLabel lastLabel = null; - for (IASTDeclaration decl : methodSpec.clsSpec.getMembers()) { - if (decl instanceof ICPPASTVisibilityLabel) - lastLabel = (ICPPASTVisibilityLabel) decl; - else if (decl == methodSpec.methodDecl) - return lastLabel; - } - - return null; - } - - private static class MethodSpec { - public final ICPPASTCompositeTypeSpecifier clsSpec; - public final IASTNode methodDecl; - - public MethodSpec(IASTNode node) { - ICPPASTCompositeTypeSpecifier cls = null; - IASTNode mth = node; - while (mth != null && cls == null) { - IASTNode parent = mth.getParent(); - if (parent instanceof ICPPASTCompositeTypeSpecifier) - cls = (ICPPASTCompositeTypeSpecifier) parent; - else - mth = parent; - } - - clsSpec = cls; - methodDecl = mth; - } - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/Activator.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/Activator.java deleted file mode 100644 index 2242fc17106..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/Activator.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core; - -import java.io.IOException; - -import javax.script.ScriptException; - -import org.eclipse.cdt.core.model.CModelException; -import org.eclipse.cdt.qt.core.IQMLAnalyzer; -import org.eclipse.cdt.qt.core.IQtInstallManager; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.QualifiedName; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; - -public class Activator extends Plugin { - - public static final String ID = "org.eclipse.cdt.qt.core"; //$NON-NLS-1$ - public static final String SIGNAL_SLOT_TAGGER_ID = ID + ".signalslot.tagger"; //$NON-NLS-1$ - - public static final int SignalSlot_Mask_signal = 1; - public static final int SignalSlot_Mask_slot = 2; - - public static final String QMAKE_ENV_PROVIDER_EXT_POINT_NAME = "qmakeEnvProvider"; //$NON-NLS-1$ - public static final String QMAKE_ENV_PROVIDER_ID = ID + "." + QMAKE_ENV_PROVIDER_EXT_POINT_NAME; //$NON-NLS-1$ - - public static final String QT_SYNTAX_ERR_ID = "org.eclipse.cdt.qt.core.qtproblem"; //$NON-NLS-1$ - - /** - * Instances of QtIndex are cached within the session properties of the - * project from which they are created. This name is used to store the - * property. - */ - public static final QualifiedName QTINDEX_PROP_NAME = new QualifiedName(ID, "qtindex"); //$NON-NLS-1$ - - private static Activator instance; - - public static Activator getDefault() { - return instance; - } - - public Activator() { - instance = this; - } - - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - - context.registerService(IQtInstallManager.class, new QtInstallManager(), null); - - QMLAnalyzer qmlAnalyzer = new QMLAnalyzer(); - context.registerService(IQMLAnalyzer.class, qmlAnalyzer, null); - Job startupJob = new Job("Load QML Analyzer") { //$NON-NLS-1$ - @Override - protected IStatus run(IProgressMonitor monitor) { - try { - qmlAnalyzer.load(); - } catch (NoSuchMethodException | ScriptException | IOException e) { - log(e); - } - return Status.OK_STATUS; - } - }; - startupJob.setSystem(true); - startupJob.schedule(); - } - - @Override - public void stop(BundleContext context) throws Exception { - // QMakeProjectInfoManager.stop(); - - super.stop(context); - } - - public static CoreException coreException(String msg) { - return new CoreException(new Status(IStatus.INFO, ID, msg)); - } - - public static IStatus info(String msg) { - return new Status(IStatus.INFO, ID, msg); - } - - public static IStatus error(String msg) { - return error(msg, null); - } - - public static IStatus error(String msg, Throwable e) { - return new Status(IStatus.ERROR, ID, msg, e); - } - - public static void log(String e) { - log(IStatus.INFO, e, null); - } - - public static void log(Throwable e) { - String msg = e.getMessage(); - if (msg == null) { - log("Error", e); //$NON-NLS-1$ - } else { - log("Error: " + msg, e); //$NON-NLS-1$ - } - } - - public static void log(String message, Throwable e) { - Throwable nestedException; - if (e instanceof CModelException && (nestedException = ((CModelException) e).getException()) != null) { - e = nestedException; - } - log(IStatus.ERROR, message, e); - } - - public static void log(int code, String msg, Throwable e) { - getDefault().getLog().log(new Status(code, ID, msg, e)); - } - - public static T getService(Class service) { - BundleContext context = instance.getBundle().getBundleContext(); - ServiceReference ref = context.getServiceReference(service); - return ref != null ? context.getService(ref) : null; - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/Messages.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/Messages.java deleted file mode 100644 index 9a6f0ec4f5e..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/Messages.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.eclipse.cdt.internal.qt.core; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.qt.core.messages"; //$NON-NLS-1$ - public static String QtBuildConfiguration_ConfigNotFound; - public static String QtBuildConfiguration_MakeNotFound; - public static String QtBuilder_0; - public static String QtBuildTab_Name; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QMLAnalyzer.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QMLAnalyzer.java deleted file mode 100644 index 5f04092fcf3..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QMLAnalyzer.java +++ /dev/null @@ -1,365 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.URL; -import java.nio.charset.StandardCharsets; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import javax.script.Bindings; -import javax.script.Invocable; -import javax.script.ScriptContext; -import javax.script.ScriptEngine; -import javax.script.ScriptEngineManager; -import javax.script.ScriptException; - -import org.eclipse.cdt.qt.core.IQMLAnalyzer; -import org.eclipse.cdt.qt.core.QMLTernCompletion; -import org.eclipse.cdt.qt.core.qmljs.IQmlASTNode; - -@SuppressWarnings("nls") -public class QMLAnalyzer implements IQMLAnalyzer { - - private QMLModuleResolver moduleResolver; - private ScriptEngine engine; - private Boolean supported; - private Invocable invoke; - private Object tern; - - @Override - public void load() throws ScriptException, IOException, NoSuchMethodException { - moduleResolver = new QMLModuleResolver(this); - engine = new ScriptEngineManager().getEngineByName("nashorn"); - if (engine == null) { - synchronized (this) { - supported = false; - notifyAll(); - } - throw new ScriptException( - "Nashorn script engine is not available in Java 15 and above. The QML Analyzer is not supported."); - } - invoke = (Invocable) engine; - - loadDep("/tern-qml/node_modules/acorn/dist/acorn.js"); - loadDep("/tern-qml/node_modules/acorn/dist/acorn_loose.js"); - loadDep("/tern-qml/node_modules/acorn/dist/walk.js"); - - loadDep("/tern-qml/node_modules/tern/lib/signal.js"); - loadDep("/tern-qml/node_modules/tern/lib/tern.js"); - loadDep("/tern-qml/node_modules/tern/lib/def.js"); - loadDep("/tern-qml/node_modules/tern/lib/comment.js"); - loadDep("/tern-qml/node_modules/tern/lib/infer.js"); - - load("/acorn-qml/inject.js"); - load("/acorn-qml/index.js"); - load("/acorn-qml/loose/inject.js"); - load("/acorn-qml/loose/index.js"); - load("/acorn-qml/walk/index.js"); - - load("/tern-qml/qml.js"); - load("/tern-qml/qml-nsh.js"); - - Bindings options = (Bindings) engine.eval("new Object()"); - options.put("ecmaVersion", 5); - - Bindings plugins = (Bindings) engine.eval("new Object()"); - plugins.put("qml", true); - options.put("plugins", plugins); - - Bindings defs = (Bindings) engine.eval("new Array()"); - load("/tern-qml/ecma5-defs.js"); - invoke.invokeMethod(defs, "push", engine.get("ecma5defs")); - options.put("defs", defs); - - ResolveDirectory resolveDirectory = (file, pathString) -> { - String filename = (String) file.get("name"); - String fileDirectory = new File(filename).getParent(); - if (fileDirectory == null) { - fileDirectory = ""; - } - if (pathString == null) { - return fixPathString(fileDirectory); - } - Path fileDirectoryPath = Paths.get(fileDirectory); - Path path = Paths.get(pathString); - if (!path.isAbsolute()) { - path = fileDirectoryPath.toAbsolutePath().resolve(path); - } - return fixPathString(path.normalize().toString()); - }; - options.put("resolveDirectory", invoke.invokeFunction("resolveDirectory", resolveDirectory)); - options.put("resolveModule", invoke.invokeFunction("resolveModule", moduleResolver)); - - synchronized (this) { - tern = invoke.invokeFunction("newTernServer", options); - supported = tern != null; - notifyAll(); - } - } - - @FunctionalInterface - public interface ResolveDirectory { - public String resolveDirectory(Bindings file, String path); - } - - private Object load(String file) throws ScriptException, IOException { - URL scriptURL = Activator.getDefault().getBundle().getEntry(file); - if (scriptURL == null) { - throw new FileNotFoundException(file); - } - engine.getContext().setAttribute(ScriptEngine.FILENAME, file, ScriptContext.ENGINE_SCOPE); - return engine.eval(new BufferedReader(new InputStreamReader(scriptURL.openStream(), StandardCharsets.UTF_8))); - } - - private Object loadDep(String file) throws ScriptException, IOException { - try { - return load(file); - } catch (FileNotFoundException e) { - return load(file.replace("/tern-qml/node_modules/", "/tern-qml/dist/")); - } - } - - @Override - public boolean isSupported() { - synchronized (this) { - while (supported == null) { - try { - wait(); - } catch (InterruptedException e) { - Activator.log(e); - return false; - } - } - return supported; - } - } - - private void waitUntilLoaded() throws ScriptException { - if (!isSupported()) { - throw new ScriptException( - "Nashorn script engine is not available in Java 15 and above. The QML Analyzer is not supported."); - } - } - - @FunctionalInterface - public interface RequestCallback { - void callback(Object err, Object data); - } - - private String fixPathString(String fileName) { - fileName = fileName.replaceAll("\\\\", "/"); - if (fileName.startsWith("/")) { - fileName = fileName.substring(1); - } - return fileName; - } - - @Override - public void addFile(String fileName, String code) throws NoSuchMethodException, ScriptException { - waitUntilLoaded(); - invoke.invokeMethod(tern, "addFile", fixPathString(fileName), code); - } - - @Override - public void deleteFile(String fileName) throws NoSuchMethodException, ScriptException { - waitUntilLoaded(); - invoke.invokeMethod(tern, "delFile", fixPathString(fileName)); - } - - private static class ASTCallback implements RequestCallback { - private IQmlASTNode ast; - - @Override - public void callback(Object err, Object data) { - if (err != null) { - throw new RuntimeException(err.toString()); - } else { - try { - ast = QmlASTNodeHandler.createQmlASTProxy((Bindings) ((Bindings) data).get("ast")); - } catch (Throwable e) { - throw new RuntimeException(e); - } - } - } - - public IQmlASTNode getAST() { - return ast; - } - } - - @Override - public IQmlASTNode parseFile(String fileName, String text) throws NoSuchMethodException, ScriptException { - waitUntilLoaded(); - fileName = fixPathString(fileName); - - Bindings query = engine.createBindings(); - query.put("type", "parseFile"); - query.put("file", fileName); - Bindings request = engine.createBindings(); - request.put("query", query); - - if (text != null) { - Bindings file = engine.createBindings(); - file.put("type", "full"); - file.put("name", fileName); - file.put("text", text); - Bindings files = (Bindings) engine.eval("new Array()"); - invoke.invokeMethod(files, "push", file); - request.put("files", files); - } - - ASTCallback callback = new ASTCallback(); - invoke.invokeMethod(tern, "request", request, invoke.invokeFunction("requestCallback", callback)); - return callback.getAST(); - } - - @Override - public IQmlASTNode parseString(String text) throws NoSuchMethodException, ScriptException { - return parseString(text, "qml", false, false); - } - - @Override - public IQmlASTNode parseString(String text, String mode, boolean locations, boolean ranges) - throws NoSuchMethodException, ScriptException { - waitUntilLoaded(); - Bindings options = engine.createBindings(); - options.put("mode", mode); - options.put("locations", locations); - options.put("ranges", ranges); - - ASTCallback callback = new ASTCallback(); - invoke.invokeMethod(tern, "parseString", text, options, invoke.invokeFunction("requestCallback", callback)); - return callback.getAST(); - } - - protected T[] toJavaArray(Bindings binding, Class clazz) throws NoSuchMethodException, ScriptException { - return clazz.cast(invoke.invokeMethod(engine.get("Java"), "to", binding, - clazz.getCanonicalName() + (clazz.isArray() ? "" : "[]"))); - } - - @Override - public Collection getCompletions(String fileName, String text, int pos) - throws NoSuchMethodException, ScriptException { - return getCompletions(fileName, text, pos, true); - } - - @Override - public Collection getCompletions(String fileName, String text, int pos, boolean includeKeywords) - throws NoSuchMethodException, ScriptException { - waitUntilLoaded(); - fileName = fixPathString(fileName); - - Bindings query = engine.createBindings(); - query.put("type", "completions"); - query.put("lineCharPositions", true); - query.put("file", fileName); - query.put("end", pos); - query.put("types", true); - query.put("docs", false); - query.put("urls", false); - query.put("origins", true); - query.put("filter", true); - query.put("caseInsensitive", true); - query.put("guess", false); - query.put("sort", true); - query.put("expandWordForward", false); - query.put("includeKeywords", includeKeywords); - - Bindings request = engine.createBindings(); - request.put("query", query); - if (text != null) { - Bindings file = engine.createBindings(); - file.put("type", "full"); - file.put("name", fileName); - file.put("text", text); - Bindings files = (Bindings) engine.eval("new Array()"); - invoke.invokeMethod(files, "push", file); - request.put("files", files); - } - - List completions = new ArrayList<>(); - - RequestCallback callback = (err, data) -> { - if (err != null) { - throw new RuntimeException(err.toString()); - } else { - try { - Bindings comps = (Bindings) ((Bindings) data).get("completions"); - for (Bindings completion : toJavaArray(comps, Bindings[].class)) { - completions.add(new QMLTernCompletion((String) completion.get("name"), - (String) completion.get("type"), (String) completion.get("origin"))); - } - } catch (Throwable e) { - throw new RuntimeException(e); - } - } - }; - - invoke.invokeMethod(tern, "request", request, invoke.invokeFunction("requestCallback", callback)); - - return completions; - } - - @Override - public List getDefinition(String identifier, String fileName, String text, int pos) - throws NoSuchMethodException, ScriptException { - waitUntilLoaded(); - fileName = fixPathString(fileName); - - Bindings query = engine.createBindings(); - query.put("type", "definition"); - query.put("file", fileName); - query.put("end", pos); - query.put("types", true); - query.put("docs", false); - query.put("urls", false); - query.put("origins", true); - query.put("caseInsensitive", true); - query.put("lineCharPositions", true); - query.put("expandWordForward", false); - query.put("includeKeywords", true); - query.put("guess", false); - Bindings request = engine.createBindings(); - request.put("query", query); - if (text != null) { - Bindings file = engine.createBindings(); - file.put("type", "full"); - file.put("name", fileName); - file.put("text", text); - Bindings files = (Bindings) engine.eval("new Array()"); - invoke.invokeMethod(files, "push", file); - request.put("files", files); - } - - List definitions = new ArrayList<>(); - - RequestCallback callback = (err, data) -> { - if (err != null) { - throw new RuntimeException(err.toString()); - } else { - definitions.add((Bindings) data); - } - }; - - invoke.invokeMethod(tern, "request", request, invoke.invokeFunction("requestCallback", callback)); - return definitions; - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QMLModuleResolver.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QMLModuleResolver.java deleted file mode 100644 index 387b0f20b9f..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QMLModuleResolver.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.nio.file.Path; - -import javax.script.ScriptException; - -import org.eclipse.cdt.internal.qt.core.qmltypes.QMLModelBuilder; -import org.eclipse.cdt.internal.qt.core.qmltypes.QMLModuleInfo; -import org.eclipse.cdt.qt.core.IQtInstall; -import org.eclipse.cdt.qt.core.IQtInstallManager; -import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryInfo; -import org.eclipse.cdt.qt.core.qmljs.IQmlASTNode; - -public class QMLModuleResolver { - private final QMLAnalyzer analyzer; - private final IQtInstallManager manager; - private final QMLModelBuilder builder; - - public QMLModuleResolver(QMLAnalyzer analyzer) { - this.analyzer = analyzer; - this.manager = Activator.getService(IQtInstallManager.class); - this.builder = new QMLModelBuilder(); - } - - // TODO: determine exactly how to give this to Tern. For now we'll just return the reference to the QMLModuleInfo - // that we found - public QMLModuleInfo resolveModule(String module) throws NoSuchMethodException, ScriptException { - QMLModuleInfo info = builder.getModule(module); - if (info == null) { - Path path = getModulePath(module); - if (path != null) { - File qmldir = path.resolve("qmldir").normalize().toFile(); //$NON-NLS-1$ - try { - String types = getQmlTypesFile(qmldir); - File qmlTypes = path.resolve(types).toFile(); - String typeContents = fileToString(qmlTypes); - IQmlASTNode ast = analyzer.parseString(typeContents, "qmltypes", false, false); //$NON-NLS-1$ - info = builder.addModule(module, ast); - } catch (IOException e) { - Activator.log(e); - } - } - } - return info; - } - - private String fileToString(File file) throws IOException { - try (InputStream stream = new FileInputStream(file)) { - StringBuilder sb = new StringBuilder(); - int read = -1; - while ((read = stream.read()) != -1) { - sb.append((char) read); - } - return sb.toString(); - } - } - - private String getQmlTypesFile(File qmldir) throws IOException { - try (InputStream stream = new FileInputStream(qmldir)) { - QMLDirectoryInfo info = new QMLDirectoryInfo(stream); - return info.getTypesFileName(); - } - } - - private Path getModulePath(String module) { - if (module != null) { - for (IQtInstall install : manager.getInstalls()) { - Path qmlPath = install.getQmlPath(); - Path modPath = null; - if (module.equals("QtQuick")) { //$NON-NLS-1$ - modPath = qmlPath.resolve("QtQuick.2").normalize(); //$NON-NLS-1$ - } else { - modPath = qmlPath; - for (String part : module.split("\\.")) { //$NON-NLS-1$ - modPath = modPath.resolve(part).normalize(); - } - } - if (modPath.toFile().exists()) { - return modPath; - } - } - } - return null; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QmlASTNodeHandler.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QmlASTNodeHandler.java deleted file mode 100644 index 7a329c8203e..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QmlASTNodeHandler.java +++ /dev/null @@ -1,252 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015, 2016 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core; - -import java.lang.invoke.MethodHandles; -import java.lang.reflect.Array; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.script.Bindings; - -import org.eclipse.cdt.internal.qt.core.location.Position; -import org.eclipse.cdt.internal.qt.core.location.SourceLocation; -import org.eclipse.cdt.qt.core.IQMLAnalyzer; -import org.eclipse.cdt.qt.core.location.ISourceLocation; -import org.eclipse.cdt.qt.core.qmljs.IJSLiteral; -import org.eclipse.cdt.qt.core.qmljs.IJSRegExpLiteral; -import org.eclipse.cdt.qt.core.qmljs.IQmlASTNode; -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectDefinition; -import org.eclipse.cdt.qt.core.qmljs.IQmlRootObject; - -/** - * Translates a JavaScript {@link Bindings} object into a QML AST. This class employs {@link java.lang.reflect.Proxy} in order to - * dynamically create the AST at runtime. - *

- * To begin translation simply call the static method createQmlASTProxy. The AST is translated only when it needs to be - * (i.e. when one of its 'get' methods are called). - */ -public class QmlASTNodeHandler implements InvocationHandler { - private static final String NODE_QML_PREFIX = "QML"; //$NON-NLS-1$ - private static final String NODE_TYPE_PROPERTY = "type"; //$NON-NLS-1$ - private static final String NODE_REGEX_PROPERTY = "regex"; //$NON-NLS-1$ - private static final String CREATE_ENUM_METHOD = "fromObject"; //$NON-NLS-1$ - private static final String AST_PACKAGE = "org.eclipse.cdt.qt.core.qmljs."; //$NON-NLS-1$ - private static final String AST_QML_PREFIX = "IQml"; //$NON-NLS-1$ - private static final String AST_JS_PREFIX = "IJS"; //$NON-NLS-1$ - - private static String getPropertyName(String method) { - String name = ""; //$NON-NLS-1$ - if (method.startsWith("is")) { //$NON-NLS-1$ - name = method.substring(2, 3).toLowerCase() + method.substring(3); - } else if (method.startsWith("get")) { //$NON-NLS-1$ - name = method.substring(3, 4).toLowerCase() + method.substring(4); - } - if (name.equalsIgnoreCase("identifier")) { //$NON-NLS-1$ - return "id"; //$NON-NLS-1$ - } else if (name.equalsIgnoreCase("location")) { //$NON-NLS-1$ - return "loc"; //$NON-NLS-1$ - } - return name; - } - - /** - * Constructs a new {@link IQmlASTNode} from the given {@link Bindings}. This is a helper method equivalent to - * createQmlASTProxy(node, null) - * - * @param node - * the AST node as retrieved from Nashorn - * @return a Proxy representing the given node - * @throws ClassNotFoundException - * if the node does not represent a valid QML AST Node - * @see {@link QmlASTNodeHandler#createQmlASTProxy(Bindings, Class)} - */ - public static IQmlASTNode createQmlASTProxy(Bindings node) throws ClassNotFoundException { - return createQmlASTProxy(node, null); - } - - /** - * Constructs a new {@link IQmlASTNode} from the given {@link Bindings}. If a return type is specified, it will take precedence - * over the type retrieved from the binding. This is useful for nodes that extend, but do not add functionality to, an acorn AST - * element. A good example of this is {@link IQmlRootObject} which extends {@link IQmlObjectDefinition}. We can easily determine - * the location in the AST at which we want an IQmlRootObject over an IQmlObjectDefinition and set the returnType accordingly. - * - * @param node - * the node as retrieved from acorn - * @param returnType - * the expected node to return or null - * @return a Proxy representing the given node - * @throws ClassNotFoundException - * if the node does not represent a valid QML AST Node - */ - public static IQmlASTNode createQmlASTProxy(Bindings node, Class returnType) throws ClassNotFoundException { - String type = (String) node.getOrDefault(NODE_TYPE_PROPERTY, ""); //$NON-NLS-1$ - if (type.startsWith(NODE_QML_PREFIX)) { - type = AST_QML_PREFIX + type.substring(3); - } else { - type = AST_JS_PREFIX + type; - } - Class astClass = Class.forName(AST_PACKAGE + type); - if (astClass.equals(IJSLiteral.class)) { - // If this is a Literal, we have to distinguish it between a RegExp Literal using the 'regex' property - if (node.get(NODE_REGEX_PROPERTY) != null) { - astClass = IJSRegExpLiteral.class; - } - } - if (returnType != null) { - if (!IQmlASTNode.class.isAssignableFrom(astClass)) { - throw new ClassCastException(astClass + " cannot be cast to " + IQmlASTNode.class); //$NON-NLS-1$ - } - if (astClass.isAssignableFrom(returnType)) { - astClass = returnType; - } - } - return (IQmlASTNode) Proxy.newProxyInstance(QmlASTNodeHandler.class.getClassLoader(), - new Class[] { astClass }, new QmlASTNodeHandler(node)); - } - - private final QMLAnalyzer analyzer; - private final Bindings node; - private final Map methodResults; - - private QmlASTNodeHandler(Bindings node) { - this.analyzer = (QMLAnalyzer) Activator.getService(IQMLAnalyzer.class); - this.node = node; - this.methodResults = new HashMap<>(); - } - - @Override - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - String mName = method.getName(); - if (!methodResults.containsKey(method.getName())) { - // Invoke the default implementation of the method if possible - if (method.isDefault()) { - final Class declaringClass = method.getDeclaringClass(); - Constructor constructor = MethodHandles.Lookup.class - .getDeclaredConstructor(Class.class, int.class); - constructor.setAccessible(true); - methodResults.put(mName, constructor.newInstance(declaringClass, MethodHandles.Lookup.PRIVATE) - .unreflectSpecial(method, declaringClass).bindTo(proxy).invokeWithArguments(args)); - } else { - // Use the return type of the method as well as its contents of the node to get the Object to return - String pName = getPropertyName(mName); - methodResults.put(mName, handleObject(node.get(pName), method.getReturnType())); - } - } - return methodResults.get(mName); - } - - private Object handleObject(Object value, Class expectedType) throws Throwable { - if (expectedType.isArray()) { - Object arr = Array.newInstance(expectedType.getComponentType(), ((Bindings) value).size()); - int ctr = 0; - for (Object obj : ((Bindings) value).values()) { - Array.set(arr, ctr++, handleObject(obj, expectedType.getComponentType())); - } - return arr; - } else if (expectedType.equals(Object.class)) { - return value; - } else if (expectedType.isAssignableFrom(ISourceLocation.class)) { - // ISourceLocation doesn't correspond to an AST Node and needs to be created manually from - // the given Bindings. - if (value instanceof Bindings) { - Bindings bind = (Bindings) value; - SourceLocation loc = new SourceLocation(); - loc.setSource((String) bind.get("source")); //$NON-NLS-1$ - Bindings start = (Bindings) bind.get("start"); //$NON-NLS-1$ - loc.setStart(new Position(((Number) start.get("line")).intValue(), //$NON-NLS-1$ - ((Number) start.get("column")).intValue())); //$NON-NLS-1$ - Bindings end = (Bindings) bind.get("end"); //$NON-NLS-1$ - loc.setEnd(new Position(((Number) end.get("line")).intValue(), //$NON-NLS-1$ - ((Number) end.get("column")).intValue())); //$NON-NLS-1$ - return loc; - } - return new SourceLocation(); - } else if (expectedType.isAssignableFrom(List.class)) { - if (value instanceof Bindings) { - List list = new ArrayList<>(); - for (Bindings object : analyzer.toJavaArray((Bindings) value, Bindings[].class)) { - list.add(QmlASTNodeHandler.createQmlASTProxy(object)); - } - return list; - } - return null; - } else if (expectedType.isPrimitive()) { - return handlePrimitive(value, expectedType); - } else if (expectedType.isAssignableFrom(Number.class)) { - if (value instanceof Number) { - return value; - } - return 0; - } else if (expectedType.isEnum()) { - return expectedType.getMethod(CREATE_ENUM_METHOD, Object.class).invoke(null, value); - } else if (value instanceof Bindings) { - return QmlASTNodeHandler.createQmlASTProxy((Bindings) value, expectedType); - } - return value; - } - - private Object handlePrimitive(Object value, Class expectedType) throws Throwable { - if (expectedType.isPrimitive()) { - if (expectedType.equals(Boolean.TYPE)) { - if (value instanceof Boolean) { - return value; - } - return false; - } else if (expectedType.equals(Character.TYPE)) { - if (value instanceof Character) { - return value; - } - return '\0'; - } else if (expectedType.equals(Byte.TYPE)) { - if (value instanceof Number) { - return ((Number) value).byteValue(); - } - return (byte) 0; - } else if (expectedType.equals(Short.TYPE)) { - if (value instanceof Number) { - return ((Number) value).shortValue(); - } - return (short) 0; - } else if (expectedType.equals(Integer.TYPE)) { - if (value instanceof Number) { - return ((Number) value).intValue(); - } - return 0; - } else if (expectedType.equals(Long.TYPE)) { - if (value instanceof Number) { - return ((Number) value).longValue(); - } - return 0l; - } else if (expectedType.equals(Float.TYPE)) { - if (value instanceof Number) { - return ((Number) value).floatValue(); - } - return 0.0f; - } else if (expectedType.equals(Double.TYPE)) { - if (value instanceof Number) { - return ((Number) value).doubleValue(); - } - return 0.0d; - } - } - throw new IllegalArgumentException("expectedType was not a primitive type"); //$NON-NLS-1$ - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtFunctionCall.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtFunctionCall.java deleted file mode 100644 index cf046ae0c54..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtFunctionCall.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (c) 2014, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; - -import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression; -import org.eclipse.cdt.core.dom.ast.IASTInitializerClause; -import org.eclipse.cdt.core.dom.ast.IASTNode; -import org.eclipse.cdt.core.dom.ast.IBasicType; -import org.eclipse.cdt.core.dom.ast.IEnumeration; -import org.eclipse.cdt.core.dom.ast.IType; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter; - -/** - * Extracts required information from FunctionCallExpressions that call - * QObject::connect. This implementation handles all overloads of QObject::connect - * except the QMetaMethod related ones. QMetaMethods cannot be statically analyzed - * so they are ignored. - *

- * The binding is found by identifying the overload and then looking at the appropriate - * parameters. - */ -public class QtFunctionCall { - - private QtFunctionCall() { - } - - /** - * Returns a collection of all Qt method references within the given function call. Returns - * null if there are no Qt method references. - */ - public static Collection getReferences(IASTFunctionCallExpression call) { - ICPPFunction function = ASTUtil.resolveFunctionBinding(ICPPFunction.class, call); - if (function == null) - return null; - - if (QtKeywords.is_QObject_connect(function)) - return getReferencesInConnect(function, call); - if (QtKeywords.is_QObject_disconnect(function)) - return getReferencesInDisconnect(function, call); - return null; - } - - private static Collection getReferencesInConnect(ICPPFunction function, - IASTFunctionCallExpression call) { - if (function == null) - return null; - - // There are 3 overloads of QObject::connect (Qt 4.8.4). They can be - // distinguished by examining - // the type of the forth parameter. - // connect( , , , const char *, ) - // connect( , , , QMetaMethod&, ) - // connect( , , , Qt::ConnectionType = ) - ICPPParameter[] params = function.getParameters(); - if (params.length < 4) - return null; - - IASTInitializerClause[] args = call.getArguments(); - IType type3 = ASTUtil.getBaseType(params[3].getType()); - - // static bool connect( const QObject *sender, const QMetaMethod &signal, - // const QObject *receiver, const QMetaMethod &method, - // Qt::ConnectionType type = Qt::AutoConnection ) - if (QtKeywords.isQMetaMethod(type3)) { - // QMetaMethod cannot be statically analyzed. - return null; - } - - // Otherwise find the signal and member parameters based on the overload. - QtMethodReference signal = null; - QtMethodReference member = null; - - // static bool connect( const QObject *sender, const char *signal, - // const QObject *receiver, const char *member, - // Qt::ConnectionType = Qt::AutoConnection ); - if (type3 instanceof IBasicType && ((IBasicType) type3).getKind() == IBasicType.Kind.eChar) { - signal = QtMethodReference.parse(call, ASTUtil.getBaseType(safeArgsAt(args, 0)), safeArgsAt(args, 1)); - member = QtMethodReference.parse(call, ASTUtil.getBaseType(safeArgsAt(args, 2)), safeArgsAt(args, 3)); - } - - // inline bool connect( const QObject *sender, const char *signal, - // const char *member, - // Qt::ConnectionType type = Qt::AutoConnection ) const; - else if (type3 instanceof IEnumeration) { - signal = QtMethodReference.parse(call, ASTUtil.getBaseType(safeArgsAt(args, 0)), safeArgsAt(args, 1)); - member = QtMethodReference.parse(call, ASTUtil.getReceiverType(call), safeArgsAt(args, 2)); - } - - return mergeNonNull(signal, member); - } - - private static Collection getReferencesInDisconnect(ICPPFunction function, - IASTFunctionCallExpression call) { - if (function == null) - return null; - - // There are 4 overloads of QObject::disconnect (Qt 4.8.4). They can be distinguished by examining - // the type of the second parameter. The number of parameters is used to disambiguate one conflict. - // disconnect( , const char *, , ) && 4 params - // disconnect( , QMetaMethod&, , ) - // disconnect( , const QObject *, ) - // disconnect( , const char * ) && 2 params - ICPPParameter[] params = function.getParameters(); - if (params.length < 2) - return null; - - IASTInitializerClause[] args = call.getArguments(); - IType type1 = ASTUtil.getBaseType(params[1].getType()); - - // static bool disconnect( const QObject *sender, const QMetaMethod &signal, - // const QObject *receiver, const QMetaMethod &member ); - if (QtKeywords.isQMetaMethod(type1)) { - // QMetaMethod cannot be statically analyzed. - return Collections.emptyList(); - } - - // Otherwise find the signal and member parameters based on the overload. - QtMethodReference signal = null; - QtMethodReference member = null; - - if (type1 instanceof IBasicType && ((IBasicType) type1).getKind() == IBasicType.Kind.eChar) { - switch (params.length) { - // static bool disconnect( const QObject *sender, const char *signal, - // const QObject *receiver, const char *member ); - case 4: - signal = QtMethodReference.parse(call, ASTUtil.getBaseType(safeArgsAt(args, 0)), safeArgsAt(args, 1)); - member = QtMethodReference.parse(call, ASTUtil.getBaseType(safeArgsAt(args, 2)), safeArgsAt(args, 3)); - break; - - // inline bool disconnect( const QObject *receiver, const char *member = 0 ); - case 2: - member = QtMethodReference.parse(call, ASTUtil.getBaseType(safeArgsAt(args, 0)), safeArgsAt(args, 1)); - break; - } - } - - // inline bool disconnect( const char *signal = 0, - // const QObject *receiver = 0, const char *member = 0 ); - else if (QtKeywords.isQObject(type1)) { - ICPPClassType recvr = ASTUtil.getReceiverType(call); - signal = QtMethodReference.parse(call, recvr, safeArgsAt(args, 0)); - member = QtMethodReference.parse(call, ASTUtil.getBaseType(safeArgsAt(args, 1)), safeArgsAt(args, 2)); - } - - return mergeNonNull(signal, member); - } - - private static IASTNode safeArgsAt(IASTNode[] args, int index) { - return args.length > index ? args[index] : null; - } - - private static Collection mergeNonNull(T... withNulls) { - T firstNonNull = null; - ArrayList list = null; - for (T t : withNulls) { - if (t == null) - continue; - else if (list != null) - list.add(t); - else if (firstNonNull == null) - firstNonNull = t; - else { - list = new ArrayList<>(withNulls.length); - list.add(firstNonNull); - list.add(t); - } - } - - if (list != null) - return list; - if (firstNonNull != null) - return Collections.singletonList(firstNonNull); - return null; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtFunctionCallUtil.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtFunctionCallUtil.java deleted file mode 100644 index d7253c8a6ef..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtFunctionCallUtil.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.eclipse.cdt.core.dom.ast.IASTCompletionContext; -import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression; -import org.eclipse.cdt.core.dom.ast.IASTInitializerClause; -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.cdt.core.dom.ast.IBinding; -import org.eclipse.cdt.core.dom.ast.IType; - -/** - * Utility for managing interaction with QObject::connect and QObject::disconnect function - * calls. These function calls can contain two expansions. The first is always SIGNAL, - * the second is either SIGNAL (which will cause the second signal to be emitted when the - * first is received) or SLOT (which will cause the slot to be evaluate when the signal - * is received). This class follows the Qt convention of calling the first SIGNAL expansion - * the sender and the second (which could be SIGNAL or SLOT) the receiver. - * - * In the following examples, the type of the signal is the type of the q_sender variable. - * The type of the method is the type of the q_receiver variable. The variable q_unrelated is - * some instance that is not needed for either case. - *

- * QObject::connect( q_sender, SIGNAL(destroyed()), q_receiver, SIGNAL() );
- * QObject::connect( q_sender, SIGNAL(destroyed()), q_receiver, SLOT(deleteLater()) );
- * QObject::connect( q_sender, SIGNAL(destroyed()), q_receiver, SIGNAL(), Qt::AutoConnection );
- * QObject::connect( q_sender, SIGNAL(destroyed()), q_receiver, SLOT(deleteLater()), Qt::AutoConnection );
- * q_unrelated->connect( q_sender, SIGNAL(destroyed()), q_receiver, SIGNAL() );
- * q_unrelated->connect( q_sender, SIGNAL(destroyed()), q_receiver, SLOT(deleteLater()) );
- * q_unrelated->connect( q_sender, SIGNAL(destroyed()), q_receiver, SIGNAL(), Qt::AutoConnection );
- * q_unrelated->connect( q_sender, SIGNAL(destroyed()), q_receiver, SLOT(deleteLater()), Qt::AutoConnection );
- *
- * q_receiver->connect( q_sender, SIGNAL(destroyed()), SIGNAL() );
- * q_receiver->connect( q_sender, SIGNAL(destroyed()), SLOT() );
- * q_receiver->connect( q_sender, SIGNAL(destroyed()), SIGNAL(), Qt::AutoConnection );
- * q_receiver->connect( q_sender, SIGNAL(destroyed()), SLOT(), Qt::AutoConnection );
- *
- * QObject::disconnect( q_sender, SIGNAL(), q_receiver, SIGNAL() );
- * QObject::disconnect( q_sender, SIGNAL(), q_receiver, SLOT() );
- * q_unrelated->disconnect( q_sender, SIGNAL(), q_receiver, SIGNAL() );
- * q_unrelated->disconnect( q_sender, SIGNAL(), q_receiver, SLOT() );
- *
- * q_sender->disconnect( SIGNAL(), q_receiver, SIGNAL() );
- * q_sender->disconnect( SIGNAL(), q_receiver, SLOT() );
- * q_sender->disconnect( SIGNAL(), q_receiver );
- * q_sender->disconnect( SIGNAL() );
- * q_sender->disconnect();
- * 
- */ -public class QtFunctionCallUtil { - - private static final Pattern SignalRegex = Pattern.compile("^\\s*" + QtKeywords.SIGNAL + ".*"); //$NON-NLS-1$ //$NON-NLS-2$ - private static final Pattern MethodRegex = Pattern - .compile("^\\s*(?:" + QtKeywords.SIGNAL + '|' + QtKeywords.SLOT + ").*"); //$NON-NLS-1$ //$NON-NLS-2$ - - /** - * Return true if the specified name is a QObject::connect or QObject::disconnect function - * and false otherwise. - */ - public static boolean isQObjectFunctionCall(IASTCompletionContext astContext, boolean isPrefix, IASTName name) { - if (name == null || name.getSimpleID() == null || name.getSimpleID().length <= 0) - return false; - - // Bug332201: Qt content assist should always be applied to the most specific part of - // the target name. - IBinding[] funcBindings = astContext.findBindings(name.getLastName(), isPrefix); - for (IBinding funcBinding : funcBindings) - if (QtKeywords.is_QObject_connect(funcBinding) || QtKeywords.is_QObject_disconnect(funcBinding)) - return true; - - return false; - } - - /** - * If the given argument is a SIGNAL or SLOT expansion then find and return the node in the AST - * that will be used for this method. Returns null if the argument is not a Qt method call or - * if the associated node cannot be found. - */ - public static IType getTargetType(IASTFunctionCallExpression call, IASTInitializerClause[] args, int argIndex) { - int sigExpIndex = getExpansionArgIndex(args, 0, SignalRegex); - if (argIndex == sigExpIndex) - return getSignalTargetType(sigExpIndex, call, args); - - int methodExpIndex = getExpansionArgIndex(args, sigExpIndex + 1, MethodRegex); - if (argIndex == methodExpIndex) - return getMethodTargetType(methodExpIndex, sigExpIndex, call, args); - - // Otherwise the given argument is not a SIGNAL or SLOT expansion. - return null; - } - - private static IType getSignalTargetType(int sigExpIndex, IASTFunctionCallExpression call, - IASTInitializerClause[] args) { - // When the SIGNAL expansion is first, the type is based on the receiver of - // the function call. Otherwise the type is the previous argument. - return ASTUtil.getBaseType(sigExpIndex == 0 ? call : args[sigExpIndex - 1]); - } - - private static IType getMethodTargetType(int methodExpIndex, int sigExpIndex, IASTFunctionCallExpression call, - IASTInitializerClause[] args) { - // If the method is right after the signal, then the type is based on the receiver - // of the function call. Otherwise the method type is based on the parameter right - // before the expansion. - if (methodExpIndex == (sigExpIndex + 1)) - return ASTUtil.getReceiverType(call); - return ASTUtil.getBaseType(args[methodExpIndex - 1]); - } - - private static int getExpansionArgIndex(IASTInitializerClause[] args, int begin, Pattern macroNameRegex) { - for (int i = begin; i < args.length; ++i) { - IASTInitializerClause arg = args[i]; - String raw = arg.getRawSignature(); - Matcher m = macroNameRegex.matcher(raw); - if (m.matches()) - return i; - } - return -1; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtIncludePaths.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtIncludePaths.java deleted file mode 100644 index f9996d70036..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtIncludePaths.java +++ /dev/null @@ -1,277 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileFilter; -import java.io.IOException; -import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsSerializableProvider; -import org.eclipse.cdt.core.settings.model.CIncludePathEntry; -import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; -import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; -import org.eclipse.cdt.core.settings.model.ICSettingEntry; -import org.eclipse.cdt.utils.spawner.ProcessFactory; -import org.eclipse.core.resources.IResource; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -/** - * Discovers and persists the list of Qt include paths for a particular installation of - * Qt. The Qt installation is described by the path to qmake. - *

- * Qt uses a tool called qmake to generate makefiles for Qt projects. The tool has a - * query mode that can be used to discover information about the Qt installation. Here - * qmake is used to build a list of all installed Qt include paths. - *

- * These paths are persisted into a file called language-settings.xml in the workspace - * metadata area. - * - * @see QtIncludePathsProvider - */ -public class QtIncludePaths extends LanguageSettingsSerializableProvider { - - /** - * The path to the qmake executable uniquely identifies this installation. - */ - private final String qmakePath; - - /** - * The cached data is reloaded when the qmake executable is modified. - */ - private long qmakeModTime; - - /** - * The cached data is reloaded when the folder holding the include paths - * is removed. - */ - private String qtInstallHeadersPath; - - /** - * The cached data is reloaded when the folder containing the include folders is - * modified. - */ - private long qtInstallHeadersModTime; - - private static final String ATTR_QMAKE = "qmake"; //$NON-NLS-1$ - private static final String ATTR_QMAKE_MOD = "qmakeModification"; //$NON-NLS-1$ - private static final String ATTR_QT_INSTALL_HEADERS = "QT_INSTALL_HEADERS"; //$NON-NLS-1$ - private static final String ATTR_QT_INSTALL_HEADERS_MOD = "qtInstallHeadersModification"; //$NON-NLS-1$ - - /** - * Create a new instance of the include path wrapper for the Qt installation for - * the given qmake binary. - */ - public QtIncludePaths(String qmakePath) { - this.qmakePath = qmakePath; - } - - /** - * Create and load an instance of QtIncludePaths from data that was serialized into the - * given XML element. Return null if an instance cannot be loaded or if the installation - * is no longer valid. - */ - public static QtIncludePaths loadFrom(Node node) { - if (node.getNodeType() != Node.ELEMENT_NODE) - return null; - - Element element = (Element) node; - String qmakePath = element.getAttribute(ATTR_QMAKE); - if (qmakePath == null || qmakePath.isEmpty()) - return null; - - QtIncludePaths qtIncludePaths = new QtIncludePaths(qmakePath); - qtIncludePaths.load(element); - return qtIncludePaths; - } - - public String getQMakePath() { - return qmakePath; - } - - /** - * Return true if the receiver points to a valid Qt installation and false otherwise. - * The installation is considered valid if an executable qmake binary exists at the - * expected location. - */ - public boolean isValid() { - if (qmakePath == null || qmakePath.isEmpty()) - return false; - - File qmake = new File(qmakePath); - return qmake.exists() && qmake.canExecute(); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof QtIncludePaths)) - return super.equals(obj); - - // Include paths are equivalent when they point to the same qmake binary. All other - // values are reloaded from that binary and do not need to be directly compared. - QtIncludePaths other = (QtIncludePaths) obj; - return qmakePath == null ? other.qmakePath == null : qmakePath.equals(other.qmakePath); - } - - @Override - public int hashCode() { - return qmakePath == null ? 0 : qmakePath.hashCode(); - } - - /** - * Return a current list of the include paths for this Qt installation. Return null if - * no such paths can be found. - *

- * Updates the cached results if needed. If the settings are updated then the new list - * will be serialized into the workspace metadata area. - */ - @Override - public List getSettingEntries(ICConfigurationDescription configDesc, IResource rc, - String languageId) { - List entries = null; - - File qmake = new File(qmakePath); - if (!qmake.exists() || qmakeModTime != qmake.lastModified()) - entries = reload(); - else { - File qtInstallHeadersDir = new File(qtInstallHeadersPath); - if (!qtInstallHeadersDir.exists() || qtInstallHeadersModTime != qtInstallHeadersDir.lastModified()) - entries = reload(); - } - - // If the cache was not reloaded, then return the previously discovered entries. - if (entries == null) - return super.getSettingEntries(configDesc, rc, languageId); - - // Otherwise store, persist, and return the newly discovered values. - setSettingEntries(configDesc, rc, languageId, entries); - serializeLanguageSettingsInBackground(null); - return entries; - } - - @Override - public Element serializeAttributes(Element parentElement) { - parentElement.setAttribute(ATTR_QMAKE, qmakePath); - parentElement.setAttribute(ATTR_QMAKE_MOD, Long.toString(qmakeModTime)); - parentElement.setAttribute(ATTR_QT_INSTALL_HEADERS, qtInstallHeadersPath); - parentElement.setAttribute(ATTR_QT_INSTALL_HEADERS_MOD, Long.toString(qtInstallHeadersModTime)); - - // The parent implementation tries to create a new child node (provider) that is used - // as the part for later entries. This isn't needed in this case, we just want to - // use the part that serializes the languages. - return parentElement; - } - - @Override - public void loadAttributes(Element element) { - qmakeModTime = getLongAttribute(element, ATTR_QMAKE_MOD); - qtInstallHeadersPath = element.getAttribute(ATTR_QT_INSTALL_HEADERS); - qtInstallHeadersModTime = getLongAttribute(element, ATTR_QT_INSTALL_HEADERS_MOD); - - // The parent implementation tries to create a new child node (provider) that is used - // as the part for later entries. This isn't needed in this case, we just want to - // use the part that serializes the languages. - } - - /** - * Parse and return the given attribute as a long. Return 0 if the attribute does - * not have a valid value. - */ - private static long getLongAttribute(Element element, String attr) { - String value = element.getAttribute(attr); - if (value == null || value.isEmpty()) - return 0; - - try { - return Long.parseLong(value); - } catch (NumberFormatException e) { - Activator.log("attribute name:" + attr + " value:" + value, e); //$NON-NLS-1$ //$NON-NLS-2$ - return 0; - } - } - - /** - * Reload and return the entries if possible, return null otherwise. - */ - private List reload() { - // All keys are reset and then updated as their values are discovered. This allows partial - // success to skip over previously calculated values. - qmakeModTime = 0; - qtInstallHeadersPath = null; - qtInstallHeadersModTime = 0; - - File qmake = new File(qmakePath); - if (!qmake.exists() || !qmake.canExecute()) - return Collections.emptyList(); - - qmakeModTime = qmake.lastModified(); - - // Run `qmake -query QT_INSTALL_HEADERS` to get output like "/opt/qt-5.0.0/include". - BufferedReader reader = null; - Process process = null; - try { - process = ProcessFactory.getFactory().exec(new String[] { qmakePath, "-query", "QT_INSTALL_HEADERS" }); //$NON-NLS-1$ //$NON-NLS-2$ - reader = new BufferedReader(new InputStreamReader(process.getInputStream())); - qtInstallHeadersPath = reader.readLine(); - } catch (IOException e) { - Activator.log(e); - } finally { - try { - if (reader != null) - reader.close(); - } catch (IOException e) { - /* ignore */ - } finally { - if (process != null) - process.destroy(); - } - } - - if (qtInstallHeadersPath == null) - return Collections.emptyList(); - - File qtInstallHeadersDir = new File(qtInstallHeadersPath); - - qtInstallHeadersModTime = qtInstallHeadersDir.lastModified(); - if (!qtInstallHeadersDir.exists() || !qtInstallHeadersDir.canRead() || !qtInstallHeadersDir.isDirectory()) - return Collections.emptyList(); - - // Create an include path entry for all sub-folders in the QT_INSTALL_HEADERS location, including - // the QT_INSTALL_HEADERS folder itself. - File[] files = qtInstallHeadersDir.listFiles(new FileFilter() { - @Override - public boolean accept(File pathname) { - return pathname.exists() && pathname.isDirectory(); - } - }); - - List entries = new ArrayList<>(files.length + 1); - safeAdd(entries, qtInstallHeadersDir); - for (File file : files) - safeAdd(entries, file); - - return entries; - } - - private static void safeAdd(List entries, File file) { - try { - entries.add( - new CIncludePathEntry(file.getCanonicalPath(), ICSettingEntry.READONLY | ICSettingEntry.RESOLVED)); - } catch (IOException e) { - Activator.log(e); - } - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtIncludePathsProvider.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtIncludePathsProvider.java deleted file mode 100644 index cdbb579134e..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtIncludePathsProvider.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2013 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.envvar.IEnvironmentVariable; -import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsSerializableProvider; -import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; -import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; -import org.eclipse.core.resources.IResource; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -/** - * This provider uses persistent cache to store the include paths for different - * Qt installations. A Qt installation is uniquely identified by the path to - * the qmake binary within the installation. - *

- * This result is shared among all Build Configurations that use the provider - * with the same value for the QMAKE environment variable. - */ -public class QtIncludePathsProvider extends LanguageSettingsSerializableProvider { - - /** - * The provider identifies Qt installations by the absolute path to the qmake binary. The - * include paths relevant to the installations are computed and persisted in {@link QtIncludePaths}. - */ - private final Map qtInstallHeaders = new HashMap<>(); - - /** - * The build configuration stores the path to the qmake binary as an environment variable. - */ - private static final String ENVVAR_QMAKE = "QMAKE"; //$NON-NLS-1$ - - private static final String ELEMENT_QMAKE = "qmake"; //$NON-NLS-1$ - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof QtIncludePathsProvider)) - return super.equals(obj); - - /** - * Providers are equal when they have the same cached values. - */ - QtIncludePathsProvider other = (QtIncludePathsProvider) obj; - if (qtInstallHeaders == null) - return other.qtInstallHeaders == null; - return qtInstallHeaders.equals(other.qtInstallHeaders); - } - - @Override - public int hashCode() { - return qtInstallHeaders == null ? 0 : qtInstallHeaders.hashCode(); - } - - @Override - public void loadEntries(Element providerNode) { - super.loadEntries(providerNode); - - // Find and load all qmake child nodes. There will be one node for each Qt - // installation that has been used. Qt installations that are no longer valid - // are not loaded. This means they will be removed from the file the next time - // that the language setting providers are serialized. - NodeList children = providerNode.getChildNodes(); - for (int i = 0; i < children.getLength(); ++i) { - Node child = children.item(i); - if (ELEMENT_QMAKE.equals(child.getNodeName())) { - QtIncludePaths qtIncludePaths = QtIncludePaths.loadFrom(child); - if (qtIncludePaths != null && qtIncludePaths.isValid()) - qtInstallHeaders.put(qtIncludePaths.getQMakePath(), qtIncludePaths); - } - } - } - - @Override - public void serializeEntries(Element parent) { - // NOTE: This creates its own XML structure where children of the provider node are qmake nodes. - // Within each qmake node is a list of include paths for that installation. Calling the - // base #serializeEntries here would try to write this instance's (empty) list of settings - // to the file. - - // Each value is serialized into a new element in the XML document. - Document document = parent instanceof Document ? (Document) parent : parent.getOwnerDocument(); - for (QtIncludePaths qtIncludePaths : qtInstallHeaders.values()) { - Element child = document.createElement(ELEMENT_QMAKE); - qtIncludePaths.serialize(child); - parent.appendChild(child); - } - } - - /** - * The given build configuration's QMAKE environment variable is used to identify the appropriate - * Qt installation. The language settings are then either returned from the previously persisted - * data or loaded, serialized, and returned. - */ - @Override - public synchronized List getSettingEntries(ICConfigurationDescription configDesc, - IResource rc, String languageId) { - // Make sure the requested language is in scope for this provider. - if (!getLanguageScope().contains(languageId)) - return null; - - // The value of the build configuration's QMAKE environment variable is used to select the - // right version of qmake. - IEnvironmentVariable qmake_var = CCorePlugin.getDefault().getBuildEnvironmentManager().getVariable(ENVVAR_QMAKE, - configDesc, true); - if (qmake_var == null) - return null; - - String qmake = qmake_var.getValue(); - if (qmake == null) - return null; - - // The path to qmake is used as the key into the in-memory cache of header paths. - QtIncludePaths paths = qtInstallHeaders.get(qmake); - if (paths == null) { - paths = new QtIncludePaths(qmake); - qtInstallHeaders.put(qmake, paths); - } - - return paths.getSettingEntries(configDesc, null, languageId); - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtInstall.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtInstall.java deleted file mode 100644 index 405e9bfc727..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtInstall.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.cdt.qt.core.IQtInstall; - -public class QtInstall implements IQtInstall { - - private final Path qmakePath; - private String spec; - private Map properties = new HashMap<>(); - - public QtInstall(Path qmakePath) { - this.qmakePath = qmakePath; - } - - @Override - public Path getQmakePath() { - return qmakePath; - } - - @Override - public Path getLibPath() { - return qmakePath.resolve("../lib"); //$NON-NLS-1$ - } - - @Override - public Path getQmlPath() { - return qmakePath.resolve("../../qml"); //$NON-NLS-1$ - } - - public static String getSpec(Path qmakePath) throws IOException { - if (Files.exists(qmakePath)) { - Process proc = new ProcessBuilder(qmakePath.toString(), "-query", "QMAKE_XSPEC").start(); //$NON-NLS-1$ //$NON-NLS-2$ - try (BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream()))) { - String line = reader.readLine(); - if (line != null) { - return line.trim(); - } - } - } - return null; - } - - @Override - public String getSpec() { - if (spec == null) { - try { - spec = getSpec(getQmakePath()); - } catch (IOException e) { - Activator.log(e); - } - } - return spec; - } - - @Override - public void setProperty(String key, String value) { - properties.put(key, value); - } - - @Override - public Map getProperties() { - return Collections.unmodifiableMap(properties); - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtInstallManager.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtInstallManager.java deleted file mode 100644 index 7e5407ae623..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtInstallManager.java +++ /dev/null @@ -1,195 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core; - -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.eclipse.cdt.core.build.IToolChain; -import org.eclipse.cdt.qt.core.IQtInstall; -import org.eclipse.cdt.qt.core.IQtInstallListener; -import org.eclipse.cdt.qt.core.IQtInstallManager; -import org.eclipse.cdt.qt.core.IQtInstallProvider; -import org.eclipse.cdt.qt.core.QtInstallEvent; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.preferences.InstanceScope; -import org.osgi.service.prefs.BackingStoreException; -import org.osgi.service.prefs.Preferences; - -public class QtInstallManager implements IQtInstallManager { - - private Map installs; - private Map toolChainMap; - private List listeners = new LinkedList<>(); - - private Preferences getPreferences() { - return InstanceScope.INSTANCE.getNode(Activator.ID).node("qtInstalls"); //$NON-NLS-1$ - } - - private void initInstalls() { - if (installs == null) { - installs = new HashMap<>(); - try { - Preferences prefs = getPreferences(); - for (String key : prefs.keys()) { - QtInstall install = new QtInstall(Paths.get(prefs.get(key, "/"))); //$NON-NLS-1$ - installs.put(install.getQmakePath(), install); - } - } catch (BackingStoreException e) { - Activator.log(e); - } - - // Auto installs - IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(Activator.ID, - "qtInstallProvider"); //$NON-NLS-1$ - for (IConfigurationElement element : point.getConfigurationElements()) { - try { - IQtInstallProvider provider = (IQtInstallProvider) element.createExecutableExtension("class"); //$NON-NLS-1$ - for (IQtInstall install : provider.getInstalls()) { - installs.put(install.getQmakePath(), install); - } - } catch (CoreException e) { - Activator.log(e); - } - } - } - } - - private void saveInstalls() { - try { - Preferences prefs = getPreferences(); - - // Remove ones that aren't valid - for (String key : prefs.keys()) { - if (installs.get(Paths.get(key)) == null) { - prefs.remove(key); - } - } - - // Add new ones - for (Path path : installs.keySet()) { - String key = path.toString(); - if (prefs.get(key, null) == null) { - prefs.put(key, installs.get(path).getQmakePath().toString()); - } - } - - prefs.flush(); - } catch (BackingStoreException e) { - Activator.log(e); - } - } - - @Override - public Collection getInstalls() { - initInstalls(); - return Collections.unmodifiableCollection(installs.values()); - } - - @Override - public void addInstall(IQtInstall qt) { - initInstalls(); - installs.put(qt.getQmakePath(), qt); - saveInstalls(); - } - - @Override - public IQtInstall getInstall(Path qmakePath) { - initInstalls(); - return installs.get(qmakePath); - } - - @Override - public Collection getInstall(String spec) { - initInstalls(); - List installList = new ArrayList<>(); - for (IQtInstall install : installs.values()) { - if (install.getSpec().equals(spec)) { - installList.add(install); - } - } - return installList; - } - - @Override - public void removeInstall(IQtInstall install) { - fireEvent(new QtInstallEvent(QtInstallEvent.REMOVED, install)); - installs.remove(install.getQmakePath()); - saveInstalls(); - } - - @Override - public boolean supports(IQtInstall install, IToolChain toolChain) { - if (toolChainMap == null) { - toolChainMap = new HashMap<>(); - IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(Activator.ID, - "qtToolChainMapper"); //$NON-NLS-1$ - for (IConfigurationElement element : point.getConfigurationElements()) { - if (element.getName().equals("mapping")) { //$NON-NLS-1$ - String spec = element.getAttribute("spec"); //$NON-NLS-1$ - toolChainMap.put(spec, element); - } - } - } - - IConfigurationElement element = toolChainMap.get(install.getSpec()); - if (element != null) { - for (IConfigurationElement property : element.getChildren("property")) { //$NON-NLS-1$ - String key = property.getAttribute("key"); //$NON-NLS-1$ - String value = property.getAttribute("value"); //$NON-NLS-1$ - if (!value.equals(toolChain.getProperty(key))) { - return false; - } - } - - for (Entry property : install.getProperties().entrySet()) { - String tcValue = toolChain.getProperty(property.getKey()); - // Treat null as a wildcard - if (tcValue != null && !property.getValue().equals(tcValue)) { - return false; - } - } - - return true; - } else { - // Don't know so returning false - return false; - } - } - - @Override - public void addListener(IQtInstallListener listener) { - listeners.add(listener); - } - - @Override - public void removeListener(IQtInstallListener listener) { - listeners.remove(listener); - } - - private void fireEvent(QtInstallEvent event) { - for (IQtInstallListener listener : listeners) { - listener.installChanged(event); - } - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtKeywords.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtKeywords.java deleted file mode 100644 index 28de83e6b80..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtKeywords.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ - -package org.eclipse.cdt.internal.qt.core; - -import org.eclipse.cdt.core.dom.ast.DOMException; -import org.eclipse.cdt.core.dom.ast.IBinding; -import org.eclipse.cdt.core.dom.ast.IType; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction; - -/** - * Declares constants related to tokens that are special in Qt applications. - */ -public class QtKeywords { - public static final String CONNECT = "connect"; //$NON-NLS-1$ - public static final String DISCONNECT = "disconnect"; //$NON-NLS-1$ - public static final String Q_CLASSINFO = "Q_CLASSINFO"; //$NON-NLS-1$ - public static final String Q_DECLARE_FLAGS = "Q_DECLARE_FLAGS"; //$NON-NLS-1$ - public static final String Q_ENUMS = "Q_ENUMS"; //$NON-NLS-1$ - public static final String Q_FLAGS = "Q_FLAGS"; //$NON-NLS-1$ - public static final String Q_GADGET = "Q_GADGET"; //$NON-NLS-1$ - public static final String Q_INVOKABLE = "Q_INVOKABLE"; //$NON-NLS-1$ - public static final String Q_OBJECT = "Q_OBJECT"; //$NON-NLS-1$ - public static final String Q_PROPERTY = "Q_PROPERTY"; //$NON-NLS-1$ - public static final String Q_REVISION = "Q_REVISION"; //$NON-NLS-1$ - public static final String Q_SIGNAL = "Q_SIGNAL"; //$NON-NLS-1$ - public static final String Q_SIGNALS = "Q_SIGNALS"; //$NON-NLS-1$ - public static final String Q_SLOT = "Q_SLOT"; //$NON-NLS-1$ - public static final String Q_SLOTS = "Q_SLOTS"; //$NON-NLS-1$ - public static final String QMETAMETHOD = "QMetaMethod"; //$NON-NLS-1$ - public static final String QML_ATTACHED_PROPERTIES = "qmlAttachedProperties"; //$NON-NLS-1$ - public static final String QML_REGISTER_TYPE = "qmlRegisterType"; //$NON-NLS-1$ - public static final String QML_REGISTER_UNCREATABLE_TYPE = "qmlRegisterUncreatableType"; //$NON-NLS-1$ - public static final String QOBJECT = "QObject"; //$NON-NLS-1$ - public static final String SIGNAL = "SIGNAL"; //$NON-NLS-1$ - public static final String SIGNALS = "signals"; //$NON-NLS-1$ - public static final String SLOT = "SLOT"; //$NON-NLS-1$ - public static final String SLOTS = "slots"; //$NON-NLS-1$ - - /** - * Returns true if the argument type is for Qt's QObject class and false otherwise. - */ - public static boolean isQObject(IType type) { - if (!(type instanceof ICPPClassType)) - return false; - - ICPPClassType clsType = (ICPPClassType) type; - return QtKeywords.QOBJECT.equals(clsType.getName()); - } - - /** - * Returns true if the argument type is for Qt's QMetaMethod class and false otherwise. - */ - public static boolean isQMetaMethod(IType type) { - if (!(type instanceof ICPPClassType)) - return false; - - ICPPClassType clsType = (ICPPClassType) type; - return QMETAMETHOD.equals(clsType.getName()); - } - - /** - * Returns true if the argument binding is for the QObject::connect function - * and false otherwise. - */ - public static boolean is_QObject_connect(IBinding binding) { - String[] qualName = getFunctionQualifiedName(binding); - return qualName != null && qualName.length == 2 && QOBJECT.equals(qualName[0]) && CONNECT.equals(qualName[1]); - } - - /** - * Returns true if the argument binding is for the QObject::disconnect function - * and false otherwise. - */ - public static boolean is_QObject_disconnect(IBinding binding) { - String[] qualName = getFunctionQualifiedName(binding); - return qualName != null && qualName.length == 2 && QOBJECT.equals(qualName[0]) - && DISCONNECT.equals(qualName[1]); - } - - /** - * Returns true if the given binding will register a type with the QML type system and false - * otherwise. - */ - public static boolean is_QmlType(IBinding binding) { - String[] qualName = getFunctionQualifiedName(binding); - return qualName != null && qualName.length == 1 - && (QML_REGISTER_TYPE.equals(qualName[0]) || QML_REGISTER_UNCREATABLE_TYPE.equals(qualName[0])); - } - - private static String[] getFunctionQualifiedName(IBinding binding) { - // IBinding#getAdapter returns null when binding is an instance of - // PDOMCPPMethod. - if (binding instanceof ICPPFunction) - try { - return ((ICPPFunction) binding).getQualifiedName(); - } catch (DOMException e) { - Activator.log(e); - } - return null; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtMethodReference.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtMethodReference.java deleted file mode 100644 index 79b045eea85..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtMethodReference.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (c) 2014, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core; - -import java.util.regex.Matcher; - -import org.eclipse.cdt.core.dom.ast.DOMException; -import org.eclipse.cdt.core.dom.ast.IASTFileLocation; -import org.eclipse.cdt.core.dom.ast.IASTMacroExpansionLocation; -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.cdt.core.dom.ast.IASTNode; -import org.eclipse.cdt.core.dom.ast.IASTNodeLocation; -import org.eclipse.cdt.core.dom.ast.IASTPreprocessorMacroDefinition; -import org.eclipse.cdt.core.dom.ast.IASTPreprocessorMacroExpansion; -import org.eclipse.cdt.core.dom.ast.IBinding; -import org.eclipse.cdt.core.dom.ast.IType; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; -import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics; -import org.eclipse.cdt.internal.qt.core.index.IQMethod; -import org.eclipse.cdt.internal.qt.core.index.IQObject; -import org.eclipse.cdt.internal.qt.core.index.QtIndex; -import org.eclipse.cdt.internal.qt.core.pdom.ASTNameReference; -import org.eclipse.cdt.internal.qt.core.pdom.QtASTImageLocation; -import org.eclipse.core.resources.IProject; - -/** - * Qt signals and slots are referenced using the SIGNAL and SLOT macros. The expansion - * parameter is the signature of the signal or slot and they are associated with a type. - * This utility class is used to convert from these AST nodes to an IASTName that can be - * used as a reference to the IBinding for the C++ method. - */ -@SuppressWarnings("restriction") -public class QtMethodReference extends ASTNameReference { - - public static enum Type { - Signal("sender", "SIGNAL", "signal"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - Slot("receiver", "SLOT", "member"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - - public final String roleName; - public final String macroName; - public final String paramName; - - public boolean matches(Type other) { - if (other == null) - return false; - - // The signal parameter must be a SIGNAL, but the slot could be a - // SLOT or a SIGNAL. - return this == Signal ? other == Signal : true; - } - - /** - * Return the type of method reference within the expansion of the given macro name. - */ - public static Type from(IASTName name) { - String nameStr = String.valueOf(name); - if (QtKeywords.SIGNAL.equals(nameStr)) - return Signal; - if (QtKeywords.SLOT.equals(nameStr)) - return Slot; - return null; - } - - private Type(String roleName, String macroName, String paramName) { - this.roleName = roleName; - this.macroName = macroName; - this.paramName = paramName; - } - } - - private final Type type; - private final ICPPClassType cls; - private final String expansionParam; - - private QtMethodReference(Type type, ICPPClassType cls, IASTName macroRefName, String expansionParam, - IASTFileLocation location) { - super(macroRefName, location); - - this.type = type; - this.cls = cls; - this.expansionParam = expansionParam; - } - - /** - * Return the C++ class that defines the Qt method that is being referenced. - */ - public ICPPClassType getContainingType() { - return cls; - } - - /** - * Look for SIGNAL or SLOT macro expansions at the location of the given node. Return the - * QMethod reference is an expansion is found and null otherwise. - *

- * QMetaMethod references cannot be statically resolved so null will be returned in this case. - */ - public static QtMethodReference parse(IASTNode parent, IType cppType, IASTNode arg) { - if (!(cppType instanceof ICPPClassType) || arg == null) - return null; - ICPPClassType cls = (ICPPClassType) cppType; - - // Look for a SIGNAL or SLOT expansion as this location. - Type type = null; - IASTName macroReferenceName = null; - for (IASTNodeLocation location : arg.getNodeLocations()) { - if (!(location instanceof IASTMacroExpansionLocation)) - continue; - - IASTPreprocessorMacroExpansion expansion = ((IASTMacroExpansionLocation) location).getExpansion(); - macroReferenceName = expansion.getMacroReference(); - IASTPreprocessorMacroDefinition macroDefn = expansion.getMacroDefinition(); - - type = Type.from(macroDefn.getName()); - if (type != null) - break; - } - - // There is nothing to do if the expected type of expansion is not found. - if (macroReferenceName == null || type == null) - return null; - - // This check will miss cases like: - // #define MY_SIG1 SIGNAL - // #define MY_SIG2(s) SIGNAL(s) - // #define MY_SIG3(s) SIGNAL(signal()) - // connect( &a, MY_SIG1(signal()), ... - // connect( &a, MY_SIG2(signal()), ... - // connect( &a, MY_SIG2, ... - // This could be improved by adding tests when arg represents a macro expansion. However, I'm - // not sure if we would be able to follow the more complicated case of macros that call functions - // that use the SIGNAL macro. For now I've implemented the simpler check of forcing the call to - // use the SIGNAL/SLOT macro directly. - String raw = arg.getRawSignature(); - Matcher m = ASTUtil.Regex_MacroExpansion.matcher(raw); - if (!m.matches()) - return null; - - // Get the argument to the SIGNAL/SLOT macro and the offset/length of that argument within the - // complete function argument. E.g., with this argument to QObject::connect - // SIGNAL( signal(int) ) - // the values are - // expansionArgs: "signal(int)" - // expansionOffset: 8 - // expansionLength: 11 - String expansionArgs = m.group(2); - int expansionOffset = m.start(2); - int expansionLength = m.end(2) - expansionOffset; - - IASTFileLocation location = new QtASTImageLocation(macroReferenceName.getFileLocation(), expansionOffset, - expansionLength); - return new QtMethodReference(type, cls, macroReferenceName, expansionArgs, location); - } - - public Type getType() { - return type; - } - - @Override - public String getRawSignature() { - return expansionParam; - } - - @Override - public char[] getSimpleID() { - return expansionParam.toCharArray(); - } - - private IQObject findQObject() { - String[] qualName = null; - try { - qualName = cls.getQualifiedName(); - } catch (DOMException e) { - Activator.log(e); - } - - IProject project = ASTUtil.getProject(delegate); - if (project == null) - return null; - - QtIndex qtIndex = QtIndex.getIndex(project); - if (qtIndex == null) - return null; - - return qtIndex.findQObject(qualName); - } - - public IQMethod getMethod() { - IQObject qobj = findQObject(); - if (qobj == null) - return null; - - // Return the first matching method. - for (IQMethod method : ASTUtil.findMethods(qobj, this)) - return method; - - return null; - } - - @Override - public IBinding resolveBinding() { - if (binding != null) - return binding; - - // Qt method references return the C++ method that is being referenced in the SIGNAL or - // SLOT macro expansion. - String methodName = expansionParam; - int paren = methodName.indexOf('('); - if (paren > 0) - methodName = methodName.substring(0, paren); - IBinding[] methods = CPPSemantics.findBindings(cls.getCompositeScope(), methodName.trim(), false); - - // TODO find the one binding that matches the parameter of the macro expansion - // 1) Normalize expansionParam - // 2) Use it to filter the matching methods - binding = methods.length > 0 ? methods[0] : null; - return binding; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtMethodUtil.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtMethodUtil.java deleted file mode 100644 index f197f946c18..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtMethodUtil.java +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Copyright (c) 2013 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.xml.bind.DatatypeConverter; - -import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier; -import org.eclipse.cdt.core.dom.ast.IASTDeclarator; -import org.eclipse.cdt.core.dom.ast.IASTNode; -import org.eclipse.cdt.core.dom.ast.IASTPointer; -import org.eclipse.cdt.core.dom.ast.IASTPointerOperator; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclarator; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTParameterDeclaration; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTReferenceOperator; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateId; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTypeId; -import org.eclipse.cdt.internal.core.dom.parser.ASTAmbiguousNode; -import org.eclipse.cdt.internal.qt.core.parser.QtParser; - -/** - * A collection of utility functions for dealing with Qt methods. A Qt method is a normal - * C++ method that has been annotated with empty macro expansions. - */ -@SuppressWarnings("restriction") -public class QtMethodUtil { - - /** - * The Qt implementation uses specific rules for generating a signature that is used - * to map between invokable function declarations and their use. This function has - * be implemented by comparing the output of moc to the various test cases in the - * qt test suite. - */ - public static String getQtNormalizedMethodSignature(String signature) { - - ICPPASTFunctionDeclarator function = QtParser.parseQtMethodReference(signature); - if (function == null) - return null; - - // NOTE: This implementation (both here and in methods that are invoked) used call #getRawSignature - // to get the original tokens. This has been changed to use #toString instead. They seem to - // provide the same value, so this should be OK. The problem with #getRawSignature is that it - // looks for the characters in the file (using offset and length). There isn't a file backing - // the StringScanner, so the result is the empty String. If we find cases where #toString - // returns the wrong value, then this can be changed back to #getRawSignature. Implement the - // AST and LocationResolver to work with ASTNode#getRawSignatureChars: - // protected char[] getRawSignatureChars() { - // final IASTFileLocation floc= getFileLocation(); - // final IASTTranslationUnit ast = getTranslationUnit(); - // if (floc != null && ast != null) { - // ILocationResolver lr= (ILocationResolver) ast.getAdapter(ILocationResolver.class); - // if (lr != null) { - // return lr.getUnpreprocessedSignature(getFileLocation()); - // } - // } - - StringBuilder result = new StringBuilder(); - - // raw sig tries to find the file - String fnName = function.getName().getLastName().toString(); - result.append(stripWS(fnName)); - result.append('('); - - boolean first = true; - for (ICPPASTParameterDeclaration param : function.getParameters()) { - if (first) - first = false; - else - result.append(','); - - IASTDeclSpecifier spec = param.getDeclSpecifier(); - ICPPASTDeclarator declarator = param.getDeclarator(); - - // The parameters are encoded so that we can rely on , being used to separate - // parameters. All other commas (e.g., to separate template arguments within - // the parameter type) will be encoded. - StringBuilder paramSig = new StringBuilder(); - append(paramSig, spec, declarator, true); - - result.append(stripWS(paramSig.toString())); - } - - result.append(')'); - - // Whitespace around operators is not needed, remove it to normalize the signature. - return result.toString(); - } - - public static Collection getDecodedQtMethodSignatures(String qtEncSignatures) { - if (qtEncSignatures == null) - return null; - - StringBuilder signature = new StringBuilder(); - int i = qtEncSignatures.indexOf('('); - String name = qtEncSignatures.substring(0, i); - - signature.append(name); - signature.append('('); - - boolean first = true; - List signatures = new ArrayList<>(); - qtEncSignatures = qtEncSignatures.substring(i + 1); - Pattern p = Pattern.compile("^([a-zA-Z0-9+/=]*)(@?).*$"); //$NON-NLS-1$ - while (!qtEncSignatures.isEmpty()) { - Matcher m = p.matcher(qtEncSignatures); - if (!m.matches()) - break; - - int next = m.end(2) + 1; - qtEncSignatures = qtEncSignatures.substring(next); - - String param = new String(DatatypeConverter.parseBase64Binary(m.group(1))); - - // If this parameter has a default value, then add a signature for the method up - // to this point. - if (!m.group(2).isEmpty()) - signatures.add(signature.toString() + ')'); - - if (first) - first = false; - else - signature.append(','); - signature.append(param); - } - - signature.append(')'); - signatures.add(signature.toString()); - return signatures; - } - - /** - * The Qt implementation has specific rules for generating a signature that is used - * to map between invokable function declarations and their use. This function has - * been implemented by comparing the output of moc to the various test cases in the - * Qt test suite. - */ - public static String getEncodedQtMethodSignatures(ICPPASTFunctionDeclarator function) { - StringBuilder result = new StringBuilder(); - - String fnName = function.getName().getLastName().toString(); - result.append(stripWS(fnName)); - result.append('('); - - boolean first = true; - for (ICPPASTParameterDeclaration param : function.getParameters()) { - if (first) - first = false; - else - result.append(','); - - IASTDeclSpecifier spec = param.getDeclSpecifier(); - ICPPASTDeclarator declarator = param.getDeclarator(); - - // The parameters are encoded so that we can rely on , being used to separate - // parameters. All other commas (e.g., to separate template arguments within - // the parameter type) will be encoded. - StringBuilder paramSig = new StringBuilder(); - append(paramSig, spec, declarator, true); - - String paramStr = stripWS(paramSig.toString()); - result.append(DatatypeConverter.printBase64Binary(paramStr.getBytes())); - - // A special character is used as a suffix on parameters that have a default value. - // A previous version of this implementation used '=' within the Base64 encoded - // payload. Now that the initializer flag is outside of the payload, '=' is a bad - // choice because it is also a valid Base64 encoded character. - // Like all the other parts of this encoder, the @ must match the value that is used - // in the decoder. - if (declarator.getInitializer() != null) - result.append('@'); - } - - result.append(')'); - - // Whitespace around operators is not needed, remove it to normalize the signature. - return result.toString(); - } - - private static String stripWS(String str) { - return str.trim().replaceAll("\\s+", " "). //$NON-NLS-1$ //$NON-NLS-2$ - replaceAll(" ([\\*&,()<>]+)", "$1"). //$NON-NLS-1$ //$NON-NLS-2$ - replaceAll("([\\*&,()<>]+) ", "$1"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - private static String asString(IASTPointerOperator ptr) { - if (ptr instanceof ICPPASTReferenceOperator) - return "&"; //$NON-NLS-1$ - if (ptr instanceof IASTPointer) { - StringBuilder str = new StringBuilder(); - IASTPointer astPtr = (IASTPointer) ptr; - str.append('*'); - if (astPtr.isConst()) - str.append(" const"); //$NON-NLS-1$ - if (astPtr.isVolatile()) - str.append(" volatile"); //$NON-NLS-1$ - return str.toString(); - } - - return ptr.toString(); - } - - private static void append(StringBuilder result, IASTDeclSpecifier spec, IASTDeclarator declarator, - boolean pruneConst) { - IASTPointerOperator[] ptrs = declarator.getPointerOperators(); - if (ptrs == null) - ptrs = new IASTPointerOperator[0]; - - if (!(spec instanceof ICPPASTDeclSpecifier)) { - result.append(spec.toString()); - return; - } - - ICPPASTDeclSpecifier cppSpec = (ICPPASTDeclSpecifier) spec; - - // Qt considers the type const if it is marked as const, or if it is a reference - // and the previous pointer is const. I.e., we need this: - // const T& -> T - // const T* const & -> T* - boolean isConst = cppSpec.isConst(); - boolean stripLastPtrConst = pruneConst && !isConst - && (ptrs.length >= 2 && ptrs[ptrs.length - 1] instanceof ICPPASTReferenceOperator - && ptrs[ptrs.length - 2] instanceof IASTPointer - && ((IASTPointer) ptrs[ptrs.length - 2]).isConst()); - - if (isConst || stripLastPtrConst) { - if (!pruneConst) - result.append("const "); //$NON-NLS-1$ - else { - // Qt signature generation converts const value and const reference types - // into simple value types. E.g., - // const T => T - // const T & => T - // From observation, they also convert const pointer to const to const - // pointers although I think that is a bug, because simple pointer to - // const are not converted to simple pointers. E.g., - // const T * => const T * - // const T * const => T * const - if (ptrs.length > 0) { - IASTPointerOperator lastPtr = ptrs[ptrs.length - 1]; - if (lastPtr instanceof ICPPASTReferenceOperator) - ptrs = Arrays.copyOf(ptrs, ptrs.length - 1); - else if (!(lastPtr instanceof IASTPointer) || !((IASTPointer) lastPtr).isConst()) - result.append("const "); //$NON-NLS-1$ - } - } - } - - // Qt does no special handling for volatile. This is likely an oversight. - if (cppSpec.isVolatile()) - result.append("volatile "); //$NON-NLS-1$ - - IASTNode[] children = cppSpec.getChildren(); - if (children == null || children.length <= 0) { - // We use the raw signature to get the text that was used to reference the - // type (without following typedefs, etc.), and then strip out all const - // which has already been handled. - String raw = cppSpec.toString(); - raw = raw.replaceAll("const\\s", ""); //$NON-NLS-1$ //$NON-NLS-2$ - raw = raw.replaceAll("\\sconst", ""); //$NON-NLS-1$ //$NON-NLS-2$ - result.append(raw); - } else { - for (IASTNode child : children) { - result.append(' '); - if (child instanceof ICPPASTTemplateId) { - ICPPASTTemplateId templId = (ICPPASTTemplateId) child; - result.append(templId.getTemplateName()); - result.append('<'); - for (IASTNode templArg : templId.getTemplateArguments()) { - append(result, templArg); - } - result.append('>'); - } else - result.append(child.toString()); - } - } - - // exclude param name, use '=' to indicate an initial value - for (int i = 0; i < ptrs.length; ++i) { - if (!stripLastPtrConst || i < ptrs.length - 1) - result.append(asString(ptrs[i])); - else - result.append(asString(ptrs[i]).replaceAll("const", "")); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - private static void append(StringBuilder result, IASTNode node) { - - // JI476551: When the code is parsed without full context, e.g., when parsing a Qt method ref, an - // ambiguous node could be created. Since we only need the original text, we can use - // any of the nodes that triggered the ambiguity. Arbitrarily choose the first one. - if (node instanceof ASTAmbiguousNode) { - IASTNode[] nodes = ((ASTAmbiguousNode) node).getNodes(); - if (nodes != null && nodes.length > 0) { - append(result, nodes[0]); - return; - } - } - - if (node instanceof ICPPASTTypeId) { - ICPPASTTypeId typeId = (ICPPASTTypeId) node; - IASTDeclSpecifier spec = typeId.getDeclSpecifier(); - IASTDeclarator declarator = typeId.getAbstractDeclarator(); - append(result, spec, declarator, false); - return; - } - - if (!(node instanceof ICPPASTTemplateId)) { - result.append(node.toString()); - return; - } - - ICPPASTTemplateId templId = (ICPPASTTemplateId) node; - result.append(templId.getTemplateName()); - result.append('<'); - boolean first = true; - for (IASTNode child : templId.getTemplateArguments()) { - if (first) - first = false; - else - result.append(", "); //$NON-NLS-1$ - append(result, child); - } - result.append('>'); - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtNature.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtNature.java deleted file mode 100644 index e8f1e79ba36..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtNature.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Doug Schaefer (QNX) - Initial implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core; - -import java.util.Arrays; - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.build.CBuilder; -import org.eclipse.cdt.core.dom.ILinkage; -import org.eclipse.cdt.core.index.IIndex; -import org.eclipse.cdt.core.index.IIndexLinkage; -import org.eclipse.cdt.core.model.ICProject; -import org.eclipse.cdt.internal.core.index.CIndex; -import org.eclipse.cdt.internal.core.index.IIndexFragment; -import org.eclipse.core.resources.ICommand; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.IProjectNature; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; - -@SuppressWarnings("restriction") -public class QtNature implements IProjectNature { - public static final String ID = "org.eclipse.cdt.qt.core.qtNature"; //$NON-NLS-1$ - - private IProject project; - - public static boolean hasNature(IProject project) { - try { - return project.hasNature(ID); - } catch (CoreException e) { - Activator.log(e); - return false; - } - } - - public static void addNature(IProject project, IProgressMonitor monitor) throws CoreException { - if (project.isOpen()) { - if (hasNature(project)) - return; - - IProjectDescription desc = project.getDescription(); - String[] oldIds = desc.getNatureIds(); - String[] newIds = Arrays.copyOf(oldIds, oldIds.length + 1); - newIds[oldIds.length] = ID; - desc.setNatureIds(newIds); - project.setDescription(desc, monitor); - } - } - - public static void setupBuilder(IProjectDescription projDesc) { - ICommand command = projDesc.newCommand(); - CBuilder.setupBuilder(command); - projDesc.setBuildSpec(new ICommand[] { command }); - } - - @Override - public void configure() throws CoreException { - IProjectDescription projDesc = project.getDescription(); - setupBuilder(projDesc); - project.setDescription(projDesc, new NullProgressMonitor()); - } - - // TODO no longer needed? - public void configurex() throws CoreException { - ICProject cProject = CCorePlugin.getDefault().getCoreModel().create(project); - if (cProject == null) - return; - - IIndex index = CCorePlugin.getIndexManager().getIndex(cProject); - if (!(index instanceof CIndex)) - return; - - // Don't reindex the project if it already has a Qt linkage. The index - // will be updated - // by the normal triggers. - for (IIndexFragment fragment : ((CIndex) index).getFragments()) - for (IIndexLinkage linkage : fragment.getLinkages()) - if (linkage.getLinkageID() == ILinkage.QT_LINKAGE_ID) - return; - - // We need to force the index to be rebuilt the first time the Qt nature - // is added. If - // this doesn't happen then the PDOM could have the current version (so - // nothing would trigger - // an update) but no Qt content. - CCorePlugin.log(IStatus.INFO, "Reindexing " + project.getName() + " because Qt nature has been added"); //$NON-NLS-1$ //$NON-NLS-2$ - CCorePlugin.getIndexManager().reindex(cProject); - } - - @Override - public void deconfigure() throws CoreException { - // This space intentionally left blank. - } - - @Override - public IProject getProject() { - return project; - } - - @Override - public void setProject(IProject project) { - this.project = project; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtTemplateGenerator.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtTemplateGenerator.java deleted file mode 100644 index 84b818264bd..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QtTemplateGenerator.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.IOException; -import java.io.StringWriter; -import java.net.URISyntaxException; -import java.net.URL; -import java.nio.charset.StandardCharsets; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; - -import freemarker.template.Configuration; -import freemarker.template.Template; -import freemarker.template.TemplateException; - -public class QtTemplateGenerator { - - private final Configuration config; - - public QtTemplateGenerator() throws CoreException { - config = new Configuration(Configuration.VERSION_2_3_22); - URL templateDirURL = FileLocator.find(Activator.getDefault().getBundle(), new Path("/templates"), null); //$NON-NLS-1$ - try { - config.setDirectoryForTemplateLoading(new File(FileLocator.toFileURL(templateDirURL).toURI())); - } catch (IOException | URISyntaxException e) { - throw new CoreException(new Status(IStatus.ERROR, Activator.ID, "Template configuration", e)); - } - } - - public void generateFile(final Object model, String templateFile, final IFile outputFile, IProgressMonitor monitor) - throws CoreException { - try { - final Template template = config.getTemplate(templateFile); - try (StringWriter writer = new StringWriter()) { - template.process(model, writer); - try (ByteArrayInputStream in = new ByteArrayInputStream( - writer.getBuffer().toString().getBytes(StandardCharsets.UTF_8))) { - if (outputFile.exists()) { - outputFile.setContents(in, true, true, monitor); - } else { - outputFile.create(in, true, monitor); - } - } - } - } catch (IOException | TemplateException e) { - throw new CoreException(new Status(IStatus.ERROR, Activator.ID, "Processing template " + templateFile, e)); - } - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/Messages.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/Messages.java deleted file mode 100644 index fe38c1ebcfc..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/Messages.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.eclipse.cdt.internal.qt.core.build; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.qt.core.build.messages"; //$NON-NLS-1$ - public static String QtBuildConfigurationProvider_NoQtInstall; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfiguration.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfiguration.java deleted file mode 100644 index 189ed99053d..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfiguration.java +++ /dev/null @@ -1,503 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015, 2022 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.build; - -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStreamReader; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.ConsoleOutputStream; -import org.eclipse.cdt.core.ErrorParserManager; -import org.eclipse.cdt.core.IConsoleParser; -import org.eclipse.cdt.core.build.CBuildConfiguration; -import org.eclipse.cdt.core.build.IToolChain; -import org.eclipse.cdt.core.envvar.IEnvironmentVariable; -import org.eclipse.cdt.core.model.ICModelMarker; -import org.eclipse.cdt.core.parser.ExtendedScannerInfo; -import org.eclipse.cdt.core.parser.IExtendedScannerInfo; -import org.eclipse.cdt.core.parser.IScannerInfo; -import org.eclipse.cdt.core.resources.IConsole; -import org.eclipse.cdt.internal.qt.core.Activator; -import org.eclipse.cdt.internal.qt.core.Messages; -import org.eclipse.cdt.internal.qt.core.QtInstallManager; -import org.eclipse.cdt.qt.core.IQtBuildConfiguration; -import org.eclipse.cdt.qt.core.IQtInstall; -import org.eclipse.cdt.qt.core.IQtInstallListener; -import org.eclipse.cdt.qt.core.IQtInstallManager; -import org.eclipse.cdt.qt.core.QtInstallEvent; -import org.eclipse.core.resources.IBuildConfiguration; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.osgi.service.prefs.BackingStoreException; -import org.osgi.service.prefs.Preferences; - -public class QtBuildConfiguration extends CBuildConfiguration implements IQtBuildConfiguration, IQtInstallListener { - - public static final String QMAKE_COMMAND = "cdt.qt.qmake.command"; //$NON-NLS-1$ - public static final String QMAKE_ARGS = "cdt.qt.qmake.args"; //$NON-NLS-1$ - public static final String BUILD_COMMAND = "cdt.qt.buildCommand"; //$NON-NLS-1$ - - private static final String QTINSTALL_NAME = "cdt.qt.install.name"; //$NON-NLS-1$ - private static final String QTINSTALL_SPEC = "cdt.qt.install.spec"; //$NON-NLS-1$ - private static final String LAUNCH_MODE = "cdt.qt.launchMode"; //$NON-NLS-1$ - - private final String qtInstallSpec; - private IQtInstall qtInstall; - private Map qtProperties; - private boolean doFullBuild; - - private IEnvironmentVariable pathVar = new IEnvironmentVariable() { - @Override - public String getValue() { - return getQmakeCommand().getParent().toString(); - } - - @Override - public int getOperation() { - return IEnvironmentVariable.ENVVAR_PREPEND; - } - - @Override - public String getName() { - return "PATH"; //$NON-NLS-1$ - } - - @Override - public String getDelimiter() { - return File.pathSeparator; - } - }; - - public QtBuildConfiguration(IBuildConfiguration config, String name) throws CoreException { - super(config, name); - - IQtInstallManager manager = Activator.getService(IQtInstallManager.class); - manager.addListener(this); - - Preferences settings = getSettings(); - String installName = settings.get(QTINSTALL_NAME, ""); //$NON-NLS-1$ - qtInstallSpec = settings.get(QTINSTALL_SPEC, ""); //$NON-NLS-1$ - if (!installName.isEmpty()) { - qtInstall = manager.getInstall(Paths.get(installName)); - if (qtInstallSpec.isEmpty()) { - // save the spec if it wasn't set - settings.put(QTINSTALL_SPEC, qtInstall.getSpec()); - try { - settings.flush(); - } catch (BackingStoreException e) { - Activator.log(e); - } - } - } - - if (getQtInstall() == null) { - throw new CoreException(new Status(IStatus.ERROR, Activator.ID, CCorePlugin.STATUS_BUILD_CONFIG_NOT_VALID, - String.format(Messages.QtBuildConfiguration_ConfigNotFound, name), null)); - } - - String oldLaunchMode = settings.get(LAUNCH_MODE, null); - if (oldLaunchMode != null) { - setLaunchMode(oldLaunchMode); - settings.remove(LAUNCH_MODE); - try { - settings.flush(); - } catch (BackingStoreException e) { - Activator.log(e); - } - } - } - - QtBuildConfiguration(IBuildConfiguration config, String name, IToolChain toolChain, IQtInstall qtInstall, - String launchMode) throws CoreException { - super(config, name, toolChain, launchMode); - this.qtInstall = qtInstall; - this.qtInstallSpec = qtInstall.getSpec(); - - IQtInstallManager manager = Activator.getService(IQtInstallManager.class); - manager.addListener(this); - - Preferences settings = getSettings(); - settings.put(QTINSTALL_NAME, qtInstall.getQmakePath().toString()); - settings.put(QTINSTALL_SPEC, qtInstallSpec); - if (launchMode != null) { - settings.put(LAUNCH_MODE, launchMode); - } - - try { - settings.flush(); - } catch (BackingStoreException e) { - Activator.log(e); - } - } - - @SuppressWarnings("unchecked") - @Override - public T getAdapter(Class adapter) { - if (adapter.equals(IQtBuildConfiguration.class)) { - return (T) this; - } else { - return super.getAdapter(adapter); - } - } - - @Override - public IQtInstall getQtInstall() { - if (qtInstall == null && !qtInstallSpec.isEmpty()) { - // find one that matches the spec - IQtInstallManager manager = Activator.getService(IQtInstallManager.class); - Collection candidates = manager.getInstall(qtInstallSpec); - if (!candidates.isEmpty()) { - qtInstall = candidates.iterator().next(); - } - } - return qtInstall; - } - - @Override - public void installChanged(QtInstallEvent event) { - if (event.getType() == QtInstallEvent.REMOVED && event.getInstall().equals(qtInstall)) { - // clear the cache so we refetch later - qtInstall = null; - } - } - - @Override - public Path getQmakeCommand() { - return getQtInstall().getQmakePath(); - } - - @Override - public String[] getQmakeConfig() { - String qmakeArgs = getProperty(QMAKE_ARGS); - if (qmakeArgs != null) { - return qmakeArgs.split(" "); //$NON-NLS-1$ - } - - String launchMode = getLaunchMode(); - if (launchMode != null) { - switch (launchMode) { - case "run": //$NON-NLS-1$ - return new String[] { "CONFIG-=debug_and_release", "CONFIG+=release" }; //$NON-NLS-1$ //$NON-NLS-2$ - case "debug": //$NON-NLS-1$ - return new String[] { "CONFIG-=debug_and_release", "CONFIG+=debug" }; //$NON-NLS-1$ //$NON-NLS-2$ - default: - return new String[] { "CONFIG-=debug_and_release", "CONFIG+=launch_mode_" + launchMode }; //$NON-NLS-1$ //$NON-NLS-2$ - } - } - return new String[] { "CONFIG+=debug_and_release", "CONFIG+=launch_modeall" }; //$NON-NLS-1$ //$NON-NLS-2$ - } - - public Path getProjectFile() { - File projectDir = getProject().getLocation().toFile(); - File[] proFiles = projectDir.listFiles((dir, name) -> name.endsWith(".pro")); //$NON-NLS-1$ - if (proFiles.length > 0) { - // TODO what if there are more than one. - return proFiles[0].toPath(); - } else { - return null; - } - } - - @Deprecated - @Override - public Path getProgramPath() throws CoreException { - // TODO get the app name from the .pro file. - String projectName = getProject().getName(); - switch (Platform.getOS()) { - case Platform.OS_MACOSX: - Path appFolder = getBuildDirectory().resolve(projectName + ".app"); //$NON-NLS-1$ - Path contentsFolder = appFolder.resolve("Contents"); //$NON-NLS-1$ - Path macosFolder = contentsFolder.resolve("MacOS"); //$NON-NLS-1$ - return macosFolder.resolve(projectName); - case Platform.OS_WIN32: - return getBuildDirectory().resolve(projectName + ".exe"); //$NON-NLS-1$ - case Platform.OS_LINUX: - return getBuildDirectory().resolve(projectName); - default: - Path releaseFolder = getBuildDirectory().resolve("release"); //$NON-NLS-1$ - return releaseFolder.resolve(projectName); - } - } - - public String getQtProperty(String key) { - if (qtProperties == null) { - List cmd = new ArrayList<>(); - cmd.add(getQmakeCommand().toString()); - cmd.add("-E"); //$NON-NLS-1$ - - String[] config = getQmakeConfig(); - if (config != null) { - for (String str : config) { - cmd.add(str); - } - } - - cmd.add(getProjectFile().toString()); - - try { - ProcessBuilder processBuilder = new ProcessBuilder(cmd) - .directory(getProjectFile().getParent().toFile()); - setBuildEnvironment(processBuilder.environment()); - Process proc = processBuilder.start(); - try (BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream()))) { - qtProperties = new HashMap<>(); - for (String line = reader.readLine(); line != null; line = reader.readLine()) { - int i = line.indexOf('='); - if (i >= 0) { - String k = line.substring(0, i); - String v = line.substring(i + 1); - qtProperties.put(k.trim(), v.trim()); - } - } - } - } catch (IOException e) { - Activator.log(e); - } - } - - return qtProperties != null ? qtProperties.get(key) : null; - } - - @Override - public IEnvironmentVariable getVariable(String name) { - if ("PATH".equals(name)) { //$NON-NLS-1$ - return pathVar; - } else { - return null; - } - } - - @Override - public IEnvironmentVariable[] getVariables() { - return new IEnvironmentVariable[] { pathVar }; - } - - @Override - public IScannerInfo getScannerInformation(IResource resource) { - IQtInstall qtInstall = getQtInstall(); - - String cxx = getQtProperty("QMAKE_CXX"); //$NON-NLS-1$ - if (cxx == null) { - Activator.log("No QMAKE_CXX for " + qtInstall.getSpec()); //$NON-NLS-1$ - return null; - } - String[] cxxSplit = cxx.split(" "); //$NON-NLS-1$ - Path command = Paths.get(cxxSplit[0]); - - List args = new ArrayList<>(); - for (int i = 1; i < cxxSplit.length; ++i) { - args.add(cxxSplit[i]); - } - args.addAll(Arrays.asList(getQtProperty("QMAKE_CXXFLAGS").split(" "))); //$NON-NLS-1$ //$NON-NLS-2$ - args.add("-o"); //$NON-NLS-1$ - args.add("-"); //$NON-NLS-1$ - - String srcFile; - if (resource instanceof IFile) { - srcFile = resource.getLocation().toOSString(); - // Only add file if it's an IFile - args.add(srcFile); - } else { - // Doesn't matter, the toolchain will create a tmp file for this - srcFile = "scannerInfo.cpp"; //$NON-NLS-1$ - } - - String[] includePaths = getQtProperty("INCLUDEPATH").split(" "); //$NON-NLS-1$ //$NON-NLS-2$ - for (int i = 0; i < includePaths.length; ++i) { - Path path = Paths.get(includePaths[i]); - if (!path.isAbsolute()) { - Path projectDir = getProjectFile().getParent(); - includePaths[i] = projectDir.resolve(path).toString(); - } - } - - IExtendedScannerInfo baseScannerInfo = new ExtendedScannerInfo(null, includePaths); - try { - return getToolChain().getScannerInfo(getBuildConfiguration(), command, - args.toArray(new String[args.size()]), baseScannerInfo, resource, - getBuildContainer().getLocationURI()); - } catch (CoreException e) { - Activator.log(e); - return null; - } - } - - @Override - public IProject[] build(int kind, Map args, IConsole console, IProgressMonitor monitor) - throws CoreException { - IProject project = getProject(); - try { - project.deleteMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_INFINITE); - - ConsoleOutputStream errStream = console.getErrorStream(); - ConsoleOutputStream outStream = console.getOutputStream(); - - String[] makeCommand = getMakeCommand(); - if (makeCommand == null) { - errStream.write(Messages.QtBuildConfiguration_MakeNotFound); - return null; - } - - Path buildDir = getBuildDirectory(); - - if (doFullBuild || !buildDir.resolve("Makefile").toFile().exists()) { //$NON-NLS-1$ - // Need to run qmake - List command = new ArrayList<>(); - command.add(getQmakeCommand().toString()); - - String[] config = getQmakeConfig(); - if (config != null) { - for (String str : config) { - command.add(str); - } - } - - IFile projectFile = project.getFile(project.getName() + ".pro"); //$NON-NLS-1$ - command.add(projectFile.getLocation().toOSString()); - - startBuildProcess(command, new IEnvironmentVariable[0], - new org.eclipse.core.runtime.Path(buildDir.toString()), console, monitor); - - StringBuffer msg = new StringBuffer(); - for (String arg : command) { - msg.append(arg).append(' '); - } - msg.append('\n'); - outStream.write(msg.toString()); - - // TODO qmake error parser - watchProcess(console, monitor); - doFullBuild = false; - } - - try (ErrorParserManager epm = new ErrorParserManager(project, getBuildDirectoryURI(), this, - getToolChain().getErrorParserIds())) { - epm.setOutputStream(console.getOutputStream()); - // run make - List command = new ArrayList<>(Arrays.asList(makeCommand)); - command.add("all"); //$NON-NLS-1$ - - startBuildProcess(command, new IEnvironmentVariable[0], - new org.eclipse.core.runtime.Path(buildDir.toString()), console, monitor); - outStream.write(String.join(" ", command) + '\n'); //$NON-NLS-1$ - watchProcess(new IConsoleParser[] { epm }, monitor); - } - - getProject().refreshLocal(IResource.DEPTH_INFINITE, monitor); - return new IProject[] { project }; - } catch (IOException e) { - throw new CoreException(new Status(IStatus.ERROR, Activator.ID, "Building " + project.getName(), e)); //$NON-NLS-1$ - } - } - - @Override - public void clean(IConsole console, IProgressMonitor monitor) throws CoreException { - IProject project = getProject(); - try { - project.deleteMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_INFINITE); - - ConsoleOutputStream errStream = console.getErrorStream(); - ConsoleOutputStream outStream = console.getOutputStream(); - - String[] makeCommand = getMakeCommand(); - if (makeCommand == null) { - errStream.write(Messages.QtBuildConfiguration_MakeNotFound); - return; - } - - Path buildDir = getBuildDirectory(); - - try (ErrorParserManager epm = new ErrorParserManager(project, getBuildDirectoryURI(), this, - getToolChain().getErrorParserIds())) { - epm.setOutputStream(console.getOutputStream()); - // run make - List command = new ArrayList<>(Arrays.asList(makeCommand)); - command.add("clean"); //$NON-NLS-1$ - startBuildProcess(command, new IEnvironmentVariable[0], - new org.eclipse.core.runtime.Path(buildDir.toString()), console, monitor); - outStream.write(String.join(" ", command) + '\n'); //$NON-NLS-1$ - watchProcess(new IConsoleParser[] { epm }, monitor); - } - - project.refreshLocal(IResource.DEPTH_INFINITE, monitor); - } catch (IOException e) { - throw new CoreException(new Status(IStatus.ERROR, Activator.ID, "Cleaning " + project.getName(), e)); //$NON-NLS-1$ - } - } - - public String[] getMakeCommand() { - String buildCommandStr = getProperty(BUILD_COMMAND); - if (buildCommandStr != null) { - String[] buildCommand = buildCommandStr.split(" "); //$NON-NLS-1$ - Path command = findCommand(buildCommand[0]); - if (command == null) { - command = findCommand("make"); //$NON-NLS-1$ - if (command == null) { - command = findCommand("mingw32-make"); //$NON-NLS-1$ - } - } - - if (command != null) { - buildCommand[0] = command.toString(); - } - return buildCommand; - } else { - Path command = findCommand("make"); //$NON-NLS-1$ - if (command == null) { - command = findCommand("mingw32-make"); //$NON-NLS-1$ - } - - if (command != null) { - return new String[] { command.toString() }; - } else { - return null; - } - } - } - - @Override - public boolean setProperties(Map properties) { - if (super.setProperties(properties)) { - String qmakeCommand = properties.get(QMAKE_COMMAND); - if (qmakeCommand != null && !qmakeCommand.equals(qtInstall.getQmakePath().toString())) { - // TODO change the qtInstall - QtInstallManager installManager = Activator.getService(QtInstallManager.class); - IQtInstall newInstall = installManager.getInstall(Paths.get(qmakeCommand)); - if (newInstall != null) { - qtInstall = newInstall; - } - } - - // Do a full build to take in new properties - doFullBuild = true; - return true; - } else { - return false; - } - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfigurationProvider.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfigurationProvider.java deleted file mode 100644 index dc07a563f1b..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfigurationProvider.java +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.build; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.cdt.core.build.ICBuildConfiguration; -import org.eclipse.cdt.core.build.ICBuildConfigurationManager; -import org.eclipse.cdt.core.build.ICBuildConfigurationProvider; -import org.eclipse.cdt.core.build.IToolChain; -import org.eclipse.cdt.core.build.IToolChainManager; -import org.eclipse.cdt.internal.qt.core.Activator; -import org.eclipse.cdt.qt.core.IQtBuildConfiguration; -import org.eclipse.cdt.qt.core.IQtInstall; -import org.eclipse.cdt.qt.core.IQtInstallManager; -import org.eclipse.core.resources.IBuildConfiguration; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Platform; - -public class QtBuildConfigurationProvider implements ICBuildConfigurationProvider { - - public static final String ID = "org.eclipse.cdt.qt.core.qtBuildConfigProvider"; //$NON-NLS-1$ - - private IToolChainManager toolChainManager = Activator.getService(IToolChainManager.class); - private IQtInstallManager qtInstallManager = Activator.getService(IQtInstallManager.class); - private ICBuildConfigurationManager configManager = Activator.getService(ICBuildConfigurationManager.class); - - @Override - public String getId() { - return ID; - } - - @Override - public ICBuildConfiguration getCBuildConfiguration(IBuildConfiguration config, String name) { - try { - if (config.getName().equals(IBuildConfiguration.DEFAULT_CONFIG_NAME)) { - // try the toolchain for the local target - Map properties = new HashMap<>(); - properties.put(IToolChain.ATTR_OS, Platform.getOS()); - properties.put(IToolChain.ATTR_ARCH, Platform.getOSArch()); - for (IToolChain toolChain : toolChainManager.getToolChainsMatching(properties)) { - for (IQtInstall qtInstall : qtInstallManager.getInstalls()) { - if (qtInstallManager.supports(qtInstall, toolChain)) { - return new QtBuildConfiguration(config, name, toolChain, qtInstall, null); - } - } - } - - // local didn't work, try and find one that does - for (IToolChain toolChain : toolChainManager.getToolChainsMatching(new HashMap<>())) { - for (IQtInstall qtInstall : qtInstallManager.getInstalls()) { - if (qtInstallManager.supports(qtInstall, toolChain)) { - return new QtBuildConfiguration(config, name, toolChain, qtInstall, null); - } - } - } - - // No valid combinations - return null; - } else { - return new QtBuildConfiguration(config, name); - } - } catch (CoreException e) { - // Failed to create the build config. Return null so it gets - // recreated. - Activator.log(e); - return null; - } - } - - @Override - public ICBuildConfiguration createBuildConfiguration(IProject project, IToolChain toolChain, String launchMode, - IProgressMonitor monitor) throws CoreException { - IQtInstall qtInstall = getQtInstall(toolChain); - if (qtInstall != null) { - // See if one exists - for (IBuildConfiguration config : project.getBuildConfigs()) { - ICBuildConfiguration cconfig = config.getAdapter(ICBuildConfiguration.class); - if (cconfig != null) { - IQtBuildConfiguration qtConfig = cconfig.getAdapter(IQtBuildConfiguration.class); - if (qtConfig != null && launchMode.equals(qtConfig.getLaunchMode()) - && qtConfig.getToolChain().equals(toolChain)) { - return qtConfig; - } - } - } - - // TODO what if multiple matches, this returns first match - String configName = "qt." + qtInstall.getSpec() + "." + launchMode; //$NON-NLS-1$ //$NON-NLS-2$ - IBuildConfiguration config = configManager.createBuildConfiguration(this, project, configName, monitor); - QtBuildConfiguration qtConfig = new QtBuildConfiguration(config, configName, toolChain, qtInstall, - launchMode); - configManager.addBuildConfiguration(config, qtConfig); - return qtConfig; - } else { - return null; - } - } - - private IQtInstall getQtInstall(IToolChain toolChain) { - for (IQtInstall qtInstall : qtInstallManager.getInstalls()) { - if (qtInstallManager.supports(qtInstall, toolChain)) { - return qtInstall; - } - } - - return null; - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/messages.properties b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/messages.properties deleted file mode 100644 index 315dfe3dffa..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/messages.properties +++ /dev/null @@ -1 +0,0 @@ -QtBuildConfigurationProvider_NoQtInstall=No Qt install available for this target diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/codan/Messages.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/codan/Messages.java deleted file mode 100644 index 5d1f0bd5de3..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/codan/Messages.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2014 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.codan; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.qt.core.codan.messages"; //$NON-NLS-1$ - public static String Function_Not_Resolved_Msg; - public static String Parameter_Not_Resolved_Msg; - public static String Missing_Parameter_Msg; - public static String SignalSlot_Not_Defined_Msg; - - public static String QtConnect_macro_without_method_1; - public static String QtConnect_macro_method_not_found_3; - - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/codan/QtSyntaxChecker.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/codan/QtSyntaxChecker.java deleted file mode 100644 index f515bf8ed08..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/codan/QtSyntaxChecker.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2014, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.codan; - -import java.util.Collection; - -import org.eclipse.cdt.codan.core.cxx.model.AbstractIndexAstChecker; -import org.eclipse.cdt.codan.core.model.CheckerLaunchMode; -import org.eclipse.cdt.codan.core.model.IProblemWorkingCopy; -import org.eclipse.cdt.core.dom.ast.ASTVisitor; -import org.eclipse.cdt.core.dom.ast.IASTExpression; -import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression; -import org.eclipse.cdt.core.dom.ast.IASTNode; -import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; -import org.eclipse.cdt.internal.qt.core.ASTUtil; -import org.eclipse.cdt.internal.qt.core.Activator; -import org.eclipse.cdt.internal.qt.core.QtFunctionCall; -import org.eclipse.cdt.internal.qt.core.QtMethodReference; -import org.eclipse.cdt.internal.qt.core.QtNature; -import org.eclipse.cdt.internal.qt.core.index.IQMethod; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.osgi.util.NLS; - -/** - * A Codan checker for QObject::connect and QObject::disconnect function calls. The checker - * confirms that SIGNAL and SLOT macro expansions reference a valid Qt signal or slot. - */ -public class QtSyntaxChecker extends AbstractIndexAstChecker { - private final Checker checker = new Checker(); - - @Override - public boolean runInEditor() { - return true; - } - - @Override - public void initPreferences(IProblemWorkingCopy problem) { - // don't run on full or incremental builds - getTopLevelPreference(problem); - getLaunchModePreference(problem).enableInLaunchModes(CheckerLaunchMode.RUN_ON_FILE_OPEN, - CheckerLaunchMode.RUN_AS_YOU_TYPE, CheckerLaunchMode.RUN_ON_DEMAND); - } - - @Override - public synchronized boolean processResource(IResource resource) throws OperationCanceledException { - if (QtNature.hasNature(resource.getProject())) - return super.processResource(resource); - return false; - } - - @Override - public void processAst(IASTTranslationUnit ast) { - // Run the checker only on Qt-enabled projects. - if (QtNature.hasNature(ASTUtil.getProject(ast))) - ast.accept(checker); - } - - private class Checker extends ASTVisitor { - public Checker() { - shouldVisitExpressions = true; - } - - @Override - public int visit(IASTExpression expr) { - if (!(expr instanceof IASTFunctionCallExpression)) - return PROCESS_CONTINUE; - IASTFunctionCallExpression fncall = (IASTFunctionCallExpression) expr; - - Collection refs = QtFunctionCall.getReferences(fncall); - if (refs != null) - for (QtMethodReference ref : refs) { - IQMethod method = ref.getMethod(); - if (method != null) - continue; - - // Either the macro expansion didn't have an argument, or the argument was not a valid method. - if (ref.getRawSignature().isEmpty()) - report(ref, Messages.QtConnect_macro_without_method_1, ref.getType().macroName); - else - report(ref, Messages.QtConnect_macro_method_not_found_3, ref.getType().paramName, - ref.getContainingType().getName(), ref.getRawSignature()); - } - - return PROCESS_CONTINUE; - } - - private void report(IASTNode node, String message, Object... args) { - if (args.length <= 0) - reportProblem(Activator.QT_SYNTAX_ERR_ID, node, message); - else - reportProblem(Activator.QT_SYNTAX_ERR_ID, node, NLS.bind(message, args)); - } - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/codan/messages.properties b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/codan/messages.properties deleted file mode 100644 index 42e8c35d583..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/codan/messages.properties +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (c) 2014 QNX Software Systems and others. -# -# This program and the accompanying materials -# are made available under the terms of the Eclipse Public License 2.0 -# which accompanies this distribution, and is available at -# https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0 - -Function_Not_Resolved_Msg=Function "{0}" can not be resolved -Parameter_Not_Resolved_Msg="{0}" is not a valid parameter -Missing_Parameter_Msg=Missing parameter -SignalSlot_Not_Defined_Msg=Signal/Slot "{0}" is not defined - -QtConnect_macro_without_method_1 = The {0} parameter does not specify a method -QtConnect_macro_method_not_found_3 = {1}::{2} has not been tagged as a Qt {0}; make sure all parameter types are fully qualified diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/AbstractQField.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/AbstractQField.java deleted file mode 100644 index 1cfb8069bc2..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/AbstractQField.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -import org.eclipse.cdt.internal.qt.core.index.IQObject.IMember; - -public abstract class AbstractQField implements IQObject.IMember { - - private final IQObject owner; - protected String name; - - protected AbstractQField(IQObject owner) { - this.owner = owner; - } - - @Override - public IQObject getOwner() { - return owner; - } - - @Override - public boolean isOverride(IMember member) { - if (!AbstractQField.class.isAssignableFrom(member.getClass())) - return false; - - // I haven't been able to find Qt documentation describing how things like - // Q_PROPERY are overridden, but the docs suggest it is just by name. - - AbstractQField other = (AbstractQField) member; - return name == null ? other.name == null : name.equals(other.name); - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/CDTIndex.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/CDTIndex.java deleted file mode 100644 index 46e35f3a25e..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/CDTIndex.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -import org.eclipse.cdt.core.index.IIndex; -import org.eclipse.cdt.internal.qt.core.Activator; -import org.eclipse.core.runtime.CoreException; - -/** - * A wrapper around the CDT index that manages the read lock. - */ -public class CDTIndex { - - private final IIndex index; - - public CDTIndex(IIndex index) { - this.index = index; - } - - /** - * An object used for reading from the CDT index. The {@link #access(IIndex)} method - * will only be invoked when the index's read lock has been properly acquired. - */ - public static interface Accessor { - /** - * A method that performs the lookup within the CDT index. The read-lock will - * be acquired before invoking this method. - *

- * The implementation of access must not make calls to {@link CDTIndex#get(Accessor)}. - * If other objects are needed, then have the accessor return a qualified name and - * lookup the object after the implementation of #access completes. - */ - public T access(IIndex index) throws CoreException; - } - - /** - * Use the given accessor to find and return a value from the index. This method ensures - * that the read-lock has been acquired. - */ - public T get(Accessor accessor) { - try { - index.acquireReadLock(); - } catch (InterruptedException e) { - return null; - } - - try { - return accessor.access(index); - } catch (CoreException e) { - Activator.log(e); - } finally { - index.releaseReadLock(); - } - - return null; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQElement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQElement.java deleted file mode 100644 index 58f31625973..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQElement.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -import org.eclipse.cdt.core.dom.ast.IBinding; - -/** - * Base interface for things that are accessed from the {@link QtIndex}. - */ -public interface IQElement { - /** - * Returns the IBinding from the CDT index for the receiver element. - */ - public IBinding getBinding(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQEnum.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQEnum.java deleted file mode 100644 index 1aaf9354d2c..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQEnum.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -import java.util.Collection; - -/** - * Represents expansions of the Q_ENUMS macro within a class declaration. - *

- * class B : public QObject
- * {
- * Q_OBJECT
- * enum E { enumerator };
- * Q_ENUMS( E )
- * };
- *
- * class Q : public QObject
- * {
- * Q_OBJECT
- * Q_ENUMS( B::E E0 )
- * Q_ENUMS( E1 )
- * enum E0 { e0a, e0b = 2 };
- * enum E1 { e1 };
- * }
- * 
- * NOTE: http://qt-project.org/doc/qt-4.8/qobject.html#Q_ENUMS - *
- * If you want to register an enum that is declared in another class, the enum must be fully qualified - * with the name of the class defining it. In addition, the class defining the enum has to inherit - * QObject as well as declare the enum using Q_ENUMS(). - *
- * So, the lookup for the C++ enum only needs to look in the same class spec when the name is not - * qualified. When it is qualified, then it needs to find the QObject and then look at its Q_ENUMS. - */ -public interface IQEnum { - /** - * Returns the name of the enumerator as referenced in parameter in the Q_ENUMS - * macro expansion. In the sample code in the class declaration, this would return - * "B::E", "E0", or "E1". - */ - public String getName(); - - /** - * Returns true if this enumeration was introduced to the Qt meta-object system with - * a Q_FLAGS expansion and false if it was introduced with Q_ENUMS. - */ - public boolean isFlag(); - - /** - * Returns an unsorted collection of the enumerators contained in the enum references - * in the Q_ENUMS macro expansion. - *

- * NOTE: It would be nice if the textual order of the enumerators was preserved by the - * underlying CDT index, but it is not. The {@link Enumerator#getOrdinal()} method can - * be used to recover some ordering information. - */ - public Collection getEnumerators(); - - /** - * A small wrapper class for the enumerators that are declared within the enum that is - * referenced by the parameter of the Q_ENUMS macro expansion. - */ - public interface Enumerator { - /** - * Returns the name of the enumerator. - */ - public String getName(); - - /** - * Returns the ordinal (either explicitly or implicitly) assigned to the enumerator. - */ - public Long getOrdinal(); - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQGadget.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQGadget.java deleted file mode 100644 index 995f438bc77..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQGadget.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2014, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -import java.util.Collection; - -/** - * Represents classes that have been tagged as Q_GADGETs. Q_GADGETs are normal - * C++ class declarations that have been tagged with the Q_GADGET macro and are - * therefore able to add enums and flags to the Qt meta-object system. - */ -public interface IQGadget { - /** - * Returns the name of the class. - */ - public String getName(); - - /** - * Returns an unsorted collection of all Q_ENUMS macro expansions within this QObject's class - * declaration. - * @see IQEnum - */ - public Collection getEnums(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMakeEnv.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMakeEnv.java deleted file mode 100644 index 16ef9d72e85..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMakeEnv.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -/** - * Represents a QMake environment. It is usually created by IQMakeEnvProvider.createEnv() method for a specific project configuration. - * - * Note that IQMakeEnv has destroy method only and it is expected that the instance is already initialized in the constructor. - * This means that it may happen that IQMakeEnv instance is created and destroyed immediately. - * - * See IQMakeEnv2 interface if you want to get an explicit notification when IQMakeEnv gets really used. In that case, the instance initialization - * needs to be done in init method completely - not in the constructor. - */ -public interface IQMakeEnv { - - /** - * Notifies that this environment is no longer used. - * This method should not use any workspace-lock or sync-locks that might call QMake-related structures. - */ - void destroy(); - - /** - * Returns an actual QMake environment information that is used for a single qmake run to retrieve QMake information. - * - * @return the actual QMake environment information - */ - QMakeEnvInfo getQMakeEnvInfo(); - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMakeEnv2.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMakeEnv2.java deleted file mode 100644 index 299bd91f6d3..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMakeEnv2.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2014, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -/** - * Represents a QMake environment similarly to IQMakeEnv but it has an explicit init method which is called to notify - * that the IQMakeEnv is used for active listening on change of QMakeEnvInfo and therefore it should initialize - * its listener for such changes. - * - * Note that it is expected that IQMakeEnv2 does complete initialization in init method - not in the constructor - * i.e. the IQMakeEnv2 instance should start listening on possible changes of its IQMakeEnvInfo. - */ -public interface IQMakeEnv2 extends IQMakeEnv { - - /** - * Notifies that this IQMakeEnv is used. - * This method should not use any workspace-lock or sync-locks that might call QMake-related structures. - */ - void init(); - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMakeEnvProvider.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMakeEnvProvider.java deleted file mode 100644 index 1e539ae6a9b..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMakeEnvProvider.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; - -/** - * Represents a provider for IQMakeEnv which is used to specify an environment for qmake run. - * This class needs to be registered via org.eclipse.cdt.qt.core.qmakeEnvProvider extension point. - */ -public interface IQMakeEnvProvider { - - /** - * Creates a QMake environment for a specific IController (aka a project configuration). - * - * @param controller the controller - * @return the IQMakeEnv instance that is used for qmake run; - * or null if this provider cannot create IQMakeEnv instance for the specified IController. - */ - IQMakeEnv createEnv(IController controller); - - /** - * Represents a project configuration and provides a control over the environment. - * - * This class is not meant to be implemented. - */ - public interface IController { - - /** - * Returns a project configuration for which a QMake environment should be supplied. - * - * @return the project configuration - */ - ICConfigurationDescription getConfiguration(); - - /** - * Request the controller to schedule a new qmake run to retrieve new QMake information. - * This method should be called when there is any change in IQMakeEnv that might affect resulting IQMakeEnvInfo. - * - * Note that calculation of new QMakeInfo is done immediately if this controller is still active and used. - */ - void scheduleUpdate(); - - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMakeInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMakeInfo.java deleted file mode 100644 index 4db6a0e2a72..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMakeInfo.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -import java.util.List; -import java.util.Map; - -/** - * Represents a QMake information. - * - * Note that current implementation of does not handle support QMake 2.0 in full range so provided information might be incomplete. - * - * This class is not meant to be implemented. - */ -public interface IQMakeInfo { - - /** - * Returns whether this information is valid. If invalid, then returned value of the other method is unspecified. - * - * @return true if this information is valid - */ - boolean isValid(); - - /** - * Returns a map of key-value pairs provided by "qmake -query" command. - * - * @return the map - */ - Map getQMakeQueryMap(); - - /** - * Returns a Qt version as provided by "qmake -query" command. - * - * @return the Qt version - */ - IQtVersion getQtVersion(); - - /** - * Returns a list of QMake files (.pro, .pri, .prf, ...) that are involved in resolving this information as retrieved - * via "qmake -E file.pro" command. - * - * @return the list of involved QMake files - */ - List getInvolvedQMakeFiles(); - - /** - * Returns a list of Qt Import paths. Represents QT_IMPORT_PATH that is used by QDeclarativeEngine (aka QtQuick1) runtime to load QML modules. - * - * @return the list of Qt Import paths - */ - List getQtImportPath(); - - /** - * Returns a list of Qt Qml paths that is used by QQmlEngine (aka QtQuick2) runtime to load QML modules. - * - * @return the list of Qt Qml paths - */ - List getQtQmlPath(); - - /** - * Returns a list of Qt Documentation paths. - * - * @return the list of Qt Documentation paths - */ - List getQtDocPath(); - - /** - * Returns a list of include paths that are used for compilation of a related project. - * - * @return the list of include paths - */ - List getIncludePath(); - - /** - * Returns a list of defines that are used for compilation of a related project i.e. specified via DEFINES QMake variable. - * - * @return the list of defines. - */ - List getDefines(); - - /** - * Returns a list of source file paths i.e. specified via SOURCES QMake variable. - * - * @return the list of source file paths - */ - List getSourceFiles(); - - /** - * Returns a list of header file paths i.e. specified via HEADERS QMake variable. - * - * @return the list of header file paths - */ - List getHeaderFiles(); - - /** - * Returns a list of resource file paths i.e. specified via RESOURCES QMake variable. - * - * @return the list of other file paths - */ - List getResourceFiles(); - - /** - * Returns a list of other file paths i.e. specified via FORMS QMake variable. - * - * @return the list of other file paths - */ - List getFormFiles(); - - /** - * Returns a list of other file paths i.e. specified via OTHER_FILES QMake variable. - * - * @return the list of other file paths - */ - List getOtherFiles(); - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMakeProjectInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMakeProjectInfo.java deleted file mode 100644 index 06d7adca3d5..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMakeProjectInfo.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -/** - * Represents provider of QMake information. - * - * This class is not meant to be implemented. - */ -public interface IQMakeProjectInfo { - - /** - * Add a listener that notifies about possible changes of IQMakeInfo retrieved from getActualInfo() method. - * - * @param listener the listener - */ - void addListener(IQMakeProjectInfoListener listener); - - /** - * Removes a listener that was added via addListener() method. - * - * @param listener the listener - */ - void removeListener(IQMakeProjectInfoListener listener); - - /** - * Returns an actual QMake information. - * - * @return non-null IQMakeInfo instance representing the actual QMake information - */ - IQMakeInfo getActualInfo(); - - /** - * Updates the actual QMake information and returns it. - * - * Note that this is a long-term operation and the method call is blocked until an actual QMake information is calculated. - * - * @return non-null IQMakeInfo instance representing the actual QMake information calculated at the time of this method call. - */ - IQMakeInfo updateActualInfo(); - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMakeProjectInfoListener.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMakeProjectInfoListener.java deleted file mode 100644 index 3a54091d7d9..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMakeProjectInfoListener.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -/** - * A listener used for notifying that a QMake information provided by IQMakeProjectInfo might have changed. - */ -public interface IQMakeProjectInfoListener { - - /** - * Notifies that a QMake information provided by IQMakeProjectInfo might have changed. - * A new QMake information can be read via IQMakeProjectInfo.getQMakeInfo() method. - * - * Note that this method might be called even after the listener is removed from - * IQMakeProjectInfo. To prevent this, your implementation should maintain a flag - * representing whether qmakeInfoChanged() notifications should be processed or not. - */ - void qmakeInfoChanged(); - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMethod.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMethod.java deleted file mode 100644 index 643b273a352..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQMethod.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -import java.util.Collection; - -/** - * Qt provides macros for marking member functions as special. The moc compiler - * recognizes these annotations and generates extra code to implement the special - * behaviour. - * - * This interface is used to represent these methods in the Qt index. It is used - * for member functions that have been marked as signals, slots, and invokables. - */ -public interface IQMethod extends IQElement, IQObject.IMember { - - /** - * The kind of Qt annotation that has been applied to this member function. - * Signals and slots are implicitly invokable, if a single member function - * has been tagged with both signal/slot and invokable, the kind will be - * Signal or Slot. - */ - public static enum Kind { - Unspecified, Invokable, Signal, Slot; - } - - /** - * The kind of Qt annotation that has been applied to this member function. Signals and - * slots are implicitly invokable, if a single member function has been tagged with both - * signal and invokable, the kind will be Signal (and likewise for Slot). - */ - public Kind getKind(); - - /** - * Returns the function name of the method. - */ - public String getName(); - - /** - * Returns the normalized C++ function signatures of the receiver method. There is - * more than one signature only when at least one parameter has a default value. - * E.g., for - * #signal1 in: - *

-	 * class T : public QObject
-	 * {
-	 * Q_OBJECT
-	 * Q_SIGNAL void signal1( int = 5 );
-	 * };
-	 * 
- * This would return "{ signal1(int), signal1() }". - */ - public Collection getSignatures(); - - /** - * Return the revision if this method was tagged with the Q_REVISION macro and null - * otherwise. The return type is Long in order to accommodate unsigned C++ 32-bit - * values. - */ - public Long getRevision(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQObject.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQObject.java deleted file mode 100644 index 3e80b65b08f..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQObject.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -import java.util.Collection; -import java.util.List; - -/** - * A class that inherits the Qt QObject and contains an expansion of Q_OBJECT. This - * provides a handle for retrieving signals, slots, and other Qt-related elements. - * @see IQMethod - */ -public interface IQObject extends IQElement { - - /** - * The interface to be implemented by elements that can be returned as members of an - * implementation of {@link IQObject}. - */ - public static interface IMember { - /** - * Return the QObject class that declares this member. Does not return null. - */ - public IQObject getOwner(); - - /** - * Returns true if it is *possible* for this member and the parameter - * to override each the other. A true result indicates that *if* the members - * owner's are related by inheritance then one will override the other; the implementation - * does not check that there actually is such an inheritance relationship. - */ - public boolean isOverride(IMember member); - } - - /** - * A wrapper for unmodifiable collections of members of a class. Accessors provide filtered - * views of the member list. - * - * @see #all() - * @see #locals() - * @see #withoutOverrides() - */ - public static interface IMembers { - /** - * Returns an unmodifiable collection with all locally declared, inherited, and overridden - * members. Does not return null. - */ - public Collection all(); - - /** - * Returns an unmodifiable collection with only the members that are locally declared in the - * source class. Does not return null. - */ - public Collection locals(); - - /** - * Returns an unmodifiable collection of all locally declared and inherited members with the - * overridden members filtered out. Does not return null. - */ - public Collection withoutOverrides(); - } - - /** - * Returns the fully qualified name of the class. - */ - public String getName(); - - /** - * Returns a list of the QObject's that are bases of this class. - * E.g. in: - *
-	 * class T {};
-	 * class B1 : public QObject { Q_OBJECT };
-	 * class B2 : public QObject { Q_OBJECT };
-	 * class B3 : public T, public QObject { };
-	 * class D : public B1, public B2, public B3, public T { Q_OBJECT };
-	 * 
- * The list of bases for D will contain B1 and B2, but not B3 or T. - *

- * The list will be ordered as in the C++ code and will include only the directly declared - * base classes. - */ - public List getBases(); - - /** - * Returns the methods that have been tagged as Qt slots. Does not return null. - */ - public IMembers getSlots(); - - /** - * Returns the methods that have been tagged as Qt signals. Does not return null. - */ - public IMembers getSignals(); - - /** - * Returns the methods that have been tagged with Q_INVOKABLE. Does not return null. - */ - public IMembers getInvokables(); - - /** - * Returns the expansions of the Q_PROPERTY macro. Does not return null. - */ - public IMembers getProperties(); - - /** - * Returns the methods that have been tagged with Q_INVOKABLE. Does not return null. - */ - public Collection getQmlRegistrations(); - - /** - * Examines the Q_CLASSINFO expansions to return the value associated with the given - * key. Returns null if there isn't a Q_CLASSINFO for the given key. - */ - public String getClassInfo(String key); - - /** - * Returns an unsorted collection of all Q_ENUMS macro expansions within this QObject's class - * declaration. - * @see IQEnum - */ - public Collection getEnums(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQProperty.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQProperty.java deleted file mode 100644 index c5351c6eeae..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQProperty.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -/** - * A container for things declared as Q_PROPERTY within a subclass of QObject. In Qt 4.8, - * Q_PROPERTY looks like: - *

- * Q_PROPERTY( type name
- *             READ getFunction
- *             [WRITE setFunction]
- *             [RESET resetFunction]
- *             [NOTIFY notifySignal]
- *             [REVISION int]
- *             [DESIGNABLE bool]
- *             [SCRIPTABLE bool]
- *             [STORED bool]
- *             [USER bool]
- *             [CONSTANT]
- *             [FINAL] )
- * 
- * This interface provides structured access to the elements of the Q_PROPERTY expansion. - */ -public interface IQProperty extends IQObject.IMember { - - /** - * The attributes that were defined in Qt 4.8. This is the full set of attributes - * that will be parsed from Q_PROPERTY expansions. - */ - public static enum Attribute { - // This enum is used when scanning Q_PROPERTY expansions, only attributes listed here - // will be extracted from the expansion. This enum should be expanded with new values - // as needed (based on the version of Qt). See QProperty#scanAttributes. - READ("getFunction"), //$NON-NLS-1$ - WRITE("setFunction"), //$NON-NLS-1$ - RESET("resetFunction"), //$NON-NLS-1$ - NOTIFY("notifySignal"), //$NON-NLS-1$ - REVISION("int"), //$NON-NLS-1$ - DESIGNABLE("bool"), //$NON-NLS-1$ - SCRIPTABLE("bool"), //$NON-NLS-1$ - STORED("bool"), //$NON-NLS-1$ - USER("bool"), //$NON-NLS-1$ - CONSTANT(null), FINAL(null); - - /** - * A string containing the C++ identifier for this attribute. - */ - public final String identifier = toString(); - - /** - * Stores the attribute parameter name if it exists and null for attributes - * without parameters. The parameter name comes from the Qt documentation - * and is only intended for documentation. - */ - public final String paramName; - - /** - * True when this attribute is expected to have a value and false otherwise. - */ - public final boolean hasValue; - - private Attribute(String paramName) { - this.paramName = paramName; - this.hasValue = paramName != null; - } - - /** - * A convenience method to access the value of a property through this - * enum, e.g., - *
-		 * IQProperty qprop;
-		 * String readFunction = IQProperty.Attribute.READ.valueId( qprop );
-		 * 
- * Returns null if there is no associated value in the given property. - */ - public String valueIn(IQProperty qprop) { - return qprop == null ? null : qprop.getValue(this); - } - } - - /** - * Returns the type of the property. This is the first field in the Q_PROPERTY expansion. - */ - public String getType(); - - /** - * Returns the name of the property. This is the second field in the Q_PROPERTY expansion. - */ - public String getName(); - - /** - * Return the value of the attribute associated with the given key. E.g., in - *
-	 * Q_PROPERTY( bool allowed READ isAllowed )
-	 * 
-	 * The parameter Attribute.READ would return "isAllowed".
-	 *
-	 * Returns null if the given key is not described in the property.
-	 */
-	public String getValue(Attribute attr);
-
-	/**
-	 * Return the value of READ or null if READ is not described in the property.
-	 */
-	public String getReadMethodName();
-
-	/**
-	 * Return the value of WRITE or null if WRITE is not described in the property.
-	 */
-	public String getWriteMethodName();
-
-	/**
-	 * Return the value of RESET or null if RESET is not described in the property.
-	 */
-	public String getResetMethodName();
-
-	/**
-	 * Return the value of NOTIFY or null if NOTIFY is not described in the property.
-	 */
-	public String getNotifyMethodName();
-
-	/**
-	 * Return the value of REVISION or null if REVISION is not described in the property.
-	 * The return type is Long in order to accommodate unsigned C++ 32-bit values.
-	 */
-	public Long getRevision();
-
-	/**
-	 * Return the value of DESIGNABLE or null if DESIGNABLE is not described in the property.
-	 */
-	public String getDesignable();
-
-	/**
-	 * Return the value of SCRIPTABLE or null if SCRIPTABLE is not described in the property.
-	 */
-	public String getScriptable();
-
-	/**
-	 * Return the value of STORED or null if STORED is not described in the property.
-	 */
-	public String getStored();
-
-	/**
-	 * Return the value of USER or null if USER is not described in the property.
-	 */
-	public String getUser();
-
-	/**
-	 * Return true if CONSTANT was specified in the Q_PROPERTY expansion and false otherwise.
-	 */
-	public boolean isConstant();
-
-	/**
-	 * Return true if FINAL was specified in the Q_PROPERTY expansion and false otherwise.
-	 */
-	public boolean isFinal();
-}
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQmlRegistration.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQmlRegistration.java
deleted file mode 100644
index 02669dd86ac..00000000000
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQmlRegistration.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2014, 2015 QNX Software Systems and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.eclipse.cdt.internal.qt.core.index;
-
-/**
- * Represents a specific QML type registration.
- * 

- * Qt allows types to be registered with QML by calling the qmlRegisterType function, - * e.g., - *

- * class Q : public QObject { Q_OBJECT };
- * qmlRegisterType<Q>( "uri", 1, 0, "Q" );
- * 
- * Registers Q in the QML system with the name "Q", in the library imported from "uri" - * having the version number 1.0. - */ -public interface IQmlRegistration extends IQObject.IMember { - /** - * Identifies the kind of qmlRegister* function that was used to register the - * type. Qt 4.8 only defines two kinds, but in 5.0 there several more. - *

- * If a type has been registered more than once, then there will be several - * entries for it in the collection returned by {@link QtIndex#getQmlRegistrations()}. - */ - public enum Kind { - /** - * Indicates that the type has been registered with a function call to - * qmlRegisterType. - */ - Type, - - /** - * Indicates that the type has been registered with a function call to - * qmlRegisterUncreatableType. - */ - Uncreatable - } - - /** - * Returns the kind of function that was used for this registration. In Qt 4.8, - * there are two variations of the qmlRegister* function; qmlRegisterType and - * qmlRegisterUncreatableType. In Qt 5.0 there are several more. - *

- * It is possible for the same type to be registered in different ways, although - * this generally indicates a problem in the client code. - */ - public IQmlRegistration.Kind getKind(); - - /** - * Returns QObject to which this registration applies. In the sample at {@link IQmlRegistration} - * this would return the IQObject for Q. - */ - public IQObject getQObject(); - - /** - * Returns the specific revision of the IQObject that was registered. Returns null if no - * revision was specified. - *

- * E.g., - * - * class Q : public QObject - * { - * Q_OBJECT - * signals: - * Q_REVISION(2) void sig(); - * }; - * - * qmlRegisterType( "uri", 1, 0, "Q1" ); - * qmlRegisterType( "uri", 1, 0, "Q2" ); - * - * - * The QML type "Q2" would have access to the "sig" signal, while "Q1" would not. - * - * @see IQMethod#getRevision() - * @see IQProperty#getRevision() - */ - public Long getVersion(); - - /** - * Returns the literal value of the first argument to the function if it can be - * resolved and null otherwise. - */ - public String getURI(); - - /** - * Returns the literal value of the second argument to the function if it can be - * resolved and null otherwise. - */ - public Long getMajor(); - - /** - * Returns the literal value of the third argument to the function if it can be - * resolved and null otherwise. - */ - public Long getMinor(); - - /** - * Returns the literal value of the fourth argument to the function if it can be - * resolved and null otherwise. - */ - public String getQmlName(); - - /** - * Returns the literal value of the fifth argument to qmlRegisterUncreatableType if it - * can be resolved and null otherwise. - */ - public String getReason(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQtVersion.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQtVersion.java deleted file mode 100644 index ec61420e75b..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/IQtVersion.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -/** - * Represents a Qt version in form of major and minor number. - */ -public interface IQtVersion { - - /** - * Returns major version number. - * @return the major version number - */ - int getMajor(); - - /** - * Returns minor version number. - * @return the minor version number - */ - int getMinor(); - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QEnum.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QEnum.java deleted file mode 100644 index d904a628ef2..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QEnum.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.eclipse.cdt.core.dom.ast.IEnumerator; -import org.eclipse.cdt.core.dom.ast.IValue; - -public class QEnum implements IQEnum { - - private final String name; - private final boolean isFlag; - private final List enumerators; - - public QEnum(String name, boolean isFlag, List enumerators) { - this.name = name; - this.isFlag = isFlag; - this.enumerators = new ArrayList<>(enumerators.size()); - for (IEnumerator enumerator : enumerators) - this.enumerators.add(new Enumerator(enumerator)); - } - - @Override - public String getName() { - return name; - } - - @Override - public boolean isFlag() { - return isFlag; - } - - @Override - public Collection getEnumerators() { - return enumerators; - } - - private static class Enumerator implements IQEnum.Enumerator { - - private final String name; - private final Long ordinal; - - public Enumerator(IEnumerator enumerator) { - this.name = enumerator.getName(); - - IValue val = enumerator.getValue(); - this.ordinal = val == null ? null : val.numberValue().longValue(); - } - - @Override - public String getName() { - return name; - } - - @Override - public Long getOrdinal() { - return ordinal; - } - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QGadget.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QGadget.java deleted file mode 100644 index 6174ec9e6ca..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QGadget.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2014, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.eclipse.cdt.internal.qt.core.pdom.AbstractQtPDOMClass; -import org.eclipse.cdt.internal.qt.core.pdom.QtPDOMQEnum; -import org.eclipse.core.runtime.CoreException; - -public class QGadget implements IQGadget { - - private final String name; - private final List enums; - - public QGadget(QtIndexImpl qtIndex, CDTIndex cdtIndex, AbstractQtPDOMClass pdomQGadget) throws CoreException { - this.name = pdomQGadget.getName(); - - this.enums = new ArrayList<>(); - for (QtPDOMQEnum pdom : pdomQGadget.getChildren(QtPDOMQEnum.class)) - this.enums.add(new QEnum(pdom.getName(), pdom.isFlag(), pdom.getEnumerators())); - } - - @Override - public String getName() { - return name; - } - - @Override - public Collection getEnums() { - return enums; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeEnvInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeEnvInfo.java deleted file mode 100644 index 0565d3d6ccc..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeEnvInfo.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.eclipse.core.resources.IFile; - -/** - * Holds data describing QMake environment (pro file, qmake file, env. vars.) for a specific QMake run provided by QMakeEnv instance. - */ -public final class QMakeEnvInfo { - - private final IFile proFile; - private final String qmakeFilePath; - private final Map environment; - private final Set sensitiveFiles; - - /** - * Creates QMakeEnvInfo. - * - * @param proFile the root-level .pro file - * @param qmakeFilePath the absolute path of qmake executable - * @param environment environment variables - * @param sensitiveFiles the list of IFile that needs to be tracked by IQMakeProjectInfo since their change might affect - * an environment for running qmake. - */ - public QMakeEnvInfo(IFile proFile, String qmakeFilePath, Map environment, - Collection sensitiveFiles) { - this.proFile = proFile; - this.qmakeFilePath = qmakeFilePath; - this.environment = environment != null ? new HashMap<>(environment) : Collections.emptyMap(); - this.sensitiveFiles = sensitiveFiles != null ? new HashSet<>(sensitiveFiles) : Collections.emptySet(); - } - - /** - * Returns IFile of .pro file. - * - * @return the .pro file - */ - public IFile getProFile() { - return proFile; - } - - /** - * Returns an absolute path of qmake executable. - * - * @return the qmake path - */ - public String getQMakeFilePath() { - return qmakeFilePath; - } - - /** - * Returns a map of environment variables that are used for qmake run. - * - * @return the environment - */ - public Map getEnvironment() { - return environment; - } - - /** - * Returns a list of IFile that might affect environment of qmake run. - * - * @return the list sensitive files - */ - public Set getSensitiveFiles() { - return sensitiveFiles; - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeEnvProviderDescriptor.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeEnvProviderDescriptor.java deleted file mode 100644 index 1d46f15cd9f..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeEnvProviderDescriptor.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -import java.util.Arrays; -import java.util.concurrent.atomic.AtomicReference; - -import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; -import org.eclipse.cdt.internal.qt.core.Activator; -import org.eclipse.cdt.internal.qt.core.index.IQMakeEnvProvider.IController; -import org.eclipse.core.expressions.EvaluationContext; -import org.eclipse.core.expressions.EvaluationResult; -import org.eclipse.core.expressions.Expression; -import org.eclipse.core.expressions.ExpressionConverter; -import org.eclipse.core.expressions.ExpressionTagNames; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; - -/** - * Represents a IQMakeEnvProvider that is registered via qmakeEnvProvider extension point. - */ -public final class QMakeEnvProviderDescriptor implements Comparable { - - private static final String ATTR_CLASS = "class"; //$NON-NLS-1$ - private static final String ATTR_PRIORITY = "priority"; //$NON-NLS-1$ - private static final String VAR_PROJECTNATURES = "projectNatures"; //$NON-NLS-1$ - - private final IConfigurationElement element; - private final String id; - private final int priority; - private final AtomicReference evaluation = new AtomicReference<>(); - private final Expression enablementExpression; - - QMakeEnvProviderDescriptor(IConfigurationElement element) { - this.element = element; - - id = element.getContributor().getName(); - - // parse priority - int prio = 0; - String priorityString = element.getAttribute(ATTR_PRIORITY); - if (priorityString != null) { - try { - prio = Integer.parseInt(priorityString); - } catch (NumberFormatException e) { - Activator.log("Invalid priority value of " + id, e); //$NON-NLS-1$ - } - } - this.priority = prio; - - // parse enablement expression - Expression expr = null; - IConfigurationElement[] children = element.getChildren(ExpressionTagNames.ENABLEMENT); - switch (children.length) { - case 0: - evaluation.set(Boolean.TRUE); - break; - case 1: - try { - ExpressionConverter parser = ExpressionConverter.getDefault(); - expr = parser.perform(children[0]); - } catch (CoreException e) { - Activator.log("Error in enablement expression of " + id, e); //$NON-NLS-1$ - } - break; - default: - Activator.log("Too many enablement expressions for " + id); //$NON-NLS-1$ - evaluation.set(Boolean.FALSE); - break; - } - enablementExpression = expr; - } - - @Override - public int compareTo(QMakeEnvProviderDescriptor that) { - if (that == null) { - return -1; - } - return this.priority - that.priority; - } - - /** - * Used by QMakeEnvProviderManager to ask for creating a IQMakeEnv for a specific IQMakeEnvProvider.IController using the related IQMakeEnvProvider - * - * @param controller the controller - * @return the IQMakeEnv instance; or null if no instance is provided - */ - public IQMakeEnv createEnv(IController controller) { - if (!matches(controller)) { - return null; - } - IQMakeEnvProvider provider; - try { - provider = (IQMakeEnvProvider) element.createExecutableExtension(ATTR_CLASS); - } catch (CoreException e) { - Activator.log("Error in class attribute of " + id, e); //$NON-NLS-1$ - return null; - } - return provider.createEnv(controller); - } - - /** - * Checks whether an enablement expression evaluation is true. - * - * @param controller the controller - * @return true if the provider can be used; false otherwise - */ - private boolean matches(IController controller) { - Boolean eval = evaluation.get(); - if (eval != null) { - return eval.booleanValue(); - } - if (enablementExpression != null) { - ICConfigurationDescription configuration = controller != null ? controller.getConfiguration() : null; - IProject project = configuration != null ? configuration.getProjectDescription().getProject() : null; - EvaluationContext evalContext = new EvaluationContext(null, project); - try { - if (project != null) { - String[] natures = project.getDescription().getNatureIds(); - evalContext.addVariable(VAR_PROJECTNATURES, Arrays.asList(natures)); - } - return enablementExpression.evaluate(evalContext) == EvaluationResult.TRUE; - } catch (CoreException e) { - Activator.log("Error while evaluating enablement expression for " + id, e); //$NON-NLS-1$ - } - } - evaluation.set(Boolean.FALSE); - return false; - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeEnvProviderManager.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeEnvProviderManager.java deleted file mode 100644 index d63c9a56546..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeEnvProviderManager.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.envvar.IEnvironmentVariable; -import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; -import org.eclipse.cdt.internal.qt.core.Activator; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.Platform; - -/** - * Represents a manager of registered qmakeEnvProvider extensions. - */ -public final class QMakeEnvProviderManager { - - private static QMakeEnvProviderManager INSTANCE = new QMakeEnvProviderManager(); - - private final List descriptors; - - public static QMakeEnvProviderManager getInstance() { - return INSTANCE; - } - - private QMakeEnvProviderManager() { - descriptors = loadDescriptors(); - } - - /** - * Returns a list of all registerd qmakeEnvProvider extensions. - * - * @return the list of extensions - */ - private static List loadDescriptors() { - List descriptors = new ArrayList<>(); - IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(Activator.ID, - Activator.QMAKE_ENV_PROVIDER_EXT_POINT_NAME); - for (IConfigurationElement element : elements) { - descriptors.add(new QMakeEnvProviderDescriptor(element)); - } - Collections.sort(descriptors); - return descriptors; - } - - /** - * Called by QMakeProjectInfo to create IQMakeEnv for a specified IController. - * It asks each qmakeEnvProvider extensions to provide the instance. If none of them provides, then the default IQMakeEnvProvider is returned. - * - * @param controller the controller - * @return the IQMakeEnv instance for specifying the QMake environment - */ - public IQMakeEnv createEnv(IQMakeEnvProvider.IController controller) { - for (QMakeEnvProviderDescriptor descriptor : descriptors) { - IQMakeEnv env = descriptor.createEnv(controller); - if (env != null) { - return env; - } - } - return new ConfigurationQMakeEnv(controller.getConfiguration()); - } - - /** - * Represents a fallback IQMakeEnvProvider that is used for a project that has QtNature - * while there is no registered IQMakeEnvProvider that would provide any IQMakeEnv. - */ - private static class ConfigurationQMakeEnv implements IQMakeEnv2 { - - private static final String PRO_FILE_SUFFIX = ".pro"; //$NON-NLS-1$ - private static final String ENV_VAR_QMAKE = "QMAKE"; //$NON-NLS-1$ - - private final ICConfigurationDescription configuration; - - public ConfigurationQMakeEnv(ICConfigurationDescription configuration) { - this.configuration = configuration; - } - - @Override - public void init() { - } - - @Override - public void destroy() { - } - - /** - * Returns QMakeEnvInfo resolved from a project in a generic way. - * If exists, the root-level .pro file is resolved as the one that is located directly under the project and has the same name. - * If exists, qmake executable is resolved from "QMAKE" environment variable that is stored in the project configuration. - * - * @return the QMakeEnvInfo instance if the project configuration exists; otherwise null. - */ - @Override - public QMakeEnvInfo getQMakeEnvInfo() { - if (configuration == null) { - return null; - } - IProject project = configuration.getProjectDescription().getProject(); - IFile proFile = project != null ? project.getFile(project.getName() + PRO_FILE_SUFFIX) : null; - - IEnvironmentVariable variable = CCorePlugin.getDefault().getBuildEnvironmentManager() - .getVariable(ENV_VAR_QMAKE, configuration, true); - String qmakeFilePath = variable != null ? variable.getValue() : null; - return new QMakeEnvInfo(proFile, qmakeFilePath, Collections.emptyMap(), - Collections.emptyList()); - } - - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeInfo.java deleted file mode 100644 index bc2330b4f4c..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeInfo.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.regex.Pattern; - -import org.eclipse.cdt.internal.qt.core.Activator; -import org.eclipse.cdt.utils.spawner.ProcessFactory; - -/** - * Holder for QMake information. - */ -public final class QMakeInfo implements IQMakeInfo { - - // reg. exp. for parsing output of "qmake -query" command - public static final Pattern PATTERN_QUERY_LINE = Pattern.compile("^(\\w+):(.*)$"); //$NON-NLS-1$ - // reg. exp. for parsing output of "qmake -E file.pro" command (for QMake 3.0 only) - public static final Pattern PATTERN_EVAL_LINE = Pattern.compile("^([a-zA-Z0-9_\\.]+)\\s*=\\s*(.*)$"); //$NON-NLS-1$ - - /** - * Instance that is used to present an invalid IQMakeInfo. - */ - public static final IQMakeInfo INVALID = new QMakeInfo(false, Collections.emptyMap(), - Collections.emptyMap()); - - private final boolean valid; - private final Map qmakeQueryMap; - private final IQtVersion qtVersion; - private final List involvedQMakeFiles; - private final List qtImportPath; - private final List qtQmlPath; - private final List qtDocPath; - private final List includePath; - private final List defines; - private final List sourceFiles; - private final List headerFiles; - private final List resourceFiles; - private final List formFiles; - private final List otherFiles; - - public QMakeInfo(boolean valid, Map queryMap, Map proMap) { - this.valid = valid; - this.qmakeQueryMap = Collections.unmodifiableMap(queryMap); - - this.qtVersion = QMakeVersion.create(queryMap.get(QMakeParser.KEY_QT_VERSION)); - List tmpQtImportPaths = new ArrayList<>( - QMakeParser.singleValue(queryMap, QMakeParser.KEY_QT_INSTALL_IMPORTS)); - List tmpQtQmlPaths = new ArrayList<>(QMakeParser.singleValue(queryMap, QMakeParser.KEY_QT_INSTALL_QML)); - this.qtDocPath = QMakeParser.singleValue(queryMap, QMakeParser.KEY_QT_INSTALL_DOCS); - - this.involvedQMakeFiles = QMakeParser.qmake3DecodeValueList(proMap, - QMakeParser.KEY_QMAKE_INTERNAL_INCLUDED_FILES); - this.includePath = QMakeParser.qmake3DecodeValueList(proMap, QMakeParser.KEY_INCLUDEPATH); - this.defines = QMakeParser.qmake3DecodeValueList(proMap, QMakeParser.KEY_DEFINES); - this.sourceFiles = QMakeParser.qmake3DecodeValueList(proMap, QMakeParser.KEY_SOURCES); - this.headerFiles = QMakeParser.qmake3DecodeValueList(proMap, QMakeParser.KEY_HEADERS); - this.resourceFiles = QMakeParser.qmake3DecodeValueList(proMap, QMakeParser.KEY_RESOURCES); - this.formFiles = QMakeParser.qmake3DecodeValueList(proMap, QMakeParser.KEY_FORMS); - this.otherFiles = QMakeParser.qmake3DecodeValueList(proMap, QMakeParser.KEY_OTHER_FILES); - - // combine qtImportPath and qtQmlPath from both qmake runs - List qmlImportPath = QMakeParser.qmake3DecodeValueList(proMap, QMakeParser.KEY_QML_IMPORT_PATH); - tmpQtImportPaths.addAll(qmlImportPath); - tmpQtQmlPaths.addAll(qmlImportPath); - this.qtImportPath = Collections.unmodifiableList(tmpQtImportPaths); - this.qtQmlPath = Collections.unmodifiableList(tmpQtQmlPaths); - } - - public static IQMakeInfo create(String proPath, String qmakePath, String[] extraEnv) { - if (proPath == null || qmakePath == null) { - return INVALID; - } - - // run "qmake -query" - Map qmake1; - try { - qmake1 = exec(PATTERN_QUERY_LINE, extraEnv, qmakePath, "-query"); //$NON-NLS-1$ - } catch (IOException e) { - Activator.log(e); - return INVALID; - } - - // check the qmake version - QMakeVersion version = QMakeVersion.create(qmake1.get(QMakeParser.KEY_QMAKE_VERSION)); - - // TODO - no support for pre-3.0 - // for QMake version 3.0 or newer, run "qmake -E file.pro" - Map qmake2 = Collections.emptyMap(); - if (version != null && version.getMajor() >= 3) { - try { - qmake2 = exec(PATTERN_EVAL_LINE, extraEnv, qmakePath, "-E", proPath); //$NON-NLS-1$ - } catch (IOException e) { - Activator.log(e); - // Continue with an empty map. - } - } - return new QMakeInfo(true, qmake1, qmake2); - } - - @Override - public boolean isValid() { - return valid; - } - - @Override - public Map getQMakeQueryMap() { - return qmakeQueryMap; - } - - @Override - public IQtVersion getQtVersion() { - return qtVersion; - } - - @Override - public List getInvolvedQMakeFiles() { - return involvedQMakeFiles; - } - - @Override - public List getQtImportPath() { - return qtImportPath; - } - - @Override - public List getQtQmlPath() { - return qtQmlPath; - } - - @Override - public List getQtDocPath() { - return qtDocPath; - } - - @Override - public List getIncludePath() { - return includePath; - } - - @Override - public List getDefines() { - return defines; - } - - @Override - public List getSourceFiles() { - return sourceFiles; - } - - @Override - public List getHeaderFiles() { - return headerFiles; - } - - @Override - public List getResourceFiles() { - return resourceFiles; - } - - @Override - public List getFormFiles() { - return formFiles; - } - - @Override - public List getOtherFiles() { - return otherFiles; - } - - /** - * Executes a command and parses its output into a map. - * - * @param regex the reg. exp. used for parsing the output - * @param extraEnv the extra environment for command - * @param cmd the command line - * @return the map of resolved key-value pairs - * @throws IOException If command execution failed - */ - private static Map exec(Pattern regex, String[] extraEnv, String... command) throws IOException { - if (command.length < 1 || !new File(command[0]).exists()) { - throw new IOException("qmake: cannot run command: " + (command.length > 0 ? command[0] : "")); //$NON-NLS-1$ //$NON-NLS-2$ - } - Process process = null; - try { - if (extraEnv != null && extraEnv.length > 0) { - process = ProcessFactory.getFactory().exec(command, extraEnv); - } else { - process = ProcessFactory.getFactory().exec(command); - } - try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) { - return QMakeParser.parse(regex, reader); - } - } finally { - if (process != null) { - process.destroy(); - } - } - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeParser.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeParser.java deleted file mode 100644 index 658c1a533f8..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeParser.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -import java.io.BufferedReader; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.eclipse.cdt.internal.qt.core.Activator; - -/** - * Provides a parser for QMake output. - */ -public final class QMakeParser { - - public static final String KEY_QMAKE_VERSION = "QMAKE_VERSION"; //$NON-NLS-1$ - public static final String KEY_QT_VERSION = "QT_VERSION"; //$NON-NLS-1$ - public static final String KEY_QT_INSTALL_IMPORTS = "QT_INSTALL_IMPORTS"; //$NON-NLS-1$ - public static final String KEY_QT_INSTALL_QML = "QT_INSTALL_QML"; //$NON-NLS-1$ - public static final String KEY_QT_INSTALL_DOCS = "QT_INSTALL_DOCS"; //$NON-NLS-1$ - public static final String KEY_QMAKE_INTERNAL_INCLUDED_FILES = "QMAKE_INTERNAL_INCLUDED_FILES"; //$NON-NLS-1$ - public static final String KEY_SOURCES = "SOURCES"; //$NON-NLS-1$ - public static final String KEY_HEADERS = "HEADERS"; //$NON-NLS-1$ - public static final String KEY_INCLUDEPATH = "INCLUDEPATH"; //$NON-NLS-1$ - public static final String KEY_DEFINES = "DEFINES"; //$NON-NLS-1$ - public static final String KEY_RESOURCES = "RESOURCES"; //$NON-NLS-1$ - public static final String KEY_FORMS = "FORMS"; //$NON-NLS-1$ - public static final String KEY_OTHER_FILES = "OTHER_FILES"; //$NON-NLS-1$ - public static final String KEY_QML_IMPORT_PATH = "QML_IMPORT_PATH"; //$NON-NLS-1$ - - /** - * Parses QMake output via a specified reg. exp. - * - * @param regex the reg. exp. - * @param reader the QMake output - * @return the modifiable map of parsed key-value pairs - * @throws IOException when io error happens - */ - public static Map parse(Pattern regex, BufferedReader reader) throws IOException { - Map result = new LinkedHashMap<>(); - - String line; - while ((line = reader.readLine()) != null) { - Matcher m = regex.matcher(line); - if (!m.matches() || m.groupCount() != 2) { - Activator.log("qmake: cannot decode query line '" + line + '\''); //$NON-NLS-1$ - } else { - String key = m.group(1); - String value = m.group(2); - String oldValue = result.put(key, value); - if (oldValue != null) - Activator.log("qmake: duplicate keys in query info '" + line + "' was '" + oldValue + '\''); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - return result; - } - - /** - * Returns an unmodifiable list with 0-1 values for a specific QMake variable. - * - * @param map the map - * @param key the QMake variable - * @return the unmodifiable list of values - */ - public static List singleValue(Map map, String key) { - String value = map.get(key); - return value == null ? Collections.emptyList() : Collections.singletonList(value); - } - - /** - * Returns an unmodifiable list of values for a specific QMake variable that is decoded as a list of values. - * - * @param map the map - * @param key the QMake variable - * @return the unmodifiable list of values - */ - public static List qmake3DecodeValueList(Map map, String key) { - String value = map.get(key); - if (value == null) { - return Collections.emptyList(); - } - - List result = new ArrayList<>(); - for (String item : qmake3SplitValueList(value)) { - result.add(qmake3DecodeValue(item)); - } - return Collections.unmodifiableList(result); - } - - /** - * Decodes a specified QMake variable value. - * - * @param value the value - * @return the decoded value - */ - public static String qmake3DecodeValue(String value) { - int length = value.length(); - if (length >= 2 && value.charAt(0) == '"' && value.charAt(length - 1) == '"') { - value = value.substring(1, length - 1); - length = value.length(); - } - StringBuilder sb = new StringBuilder(length); - for (int i = 0; i < length; i++) { - char c = value.charAt(i); - if (c == '\\') { - ++i; - if (i < length) { - char next = value.charAt(i); - switch (next) { - case 'r': - sb.append('\r'); - break; - case 'n': - sb.append('\n'); - break; - case 't': - sb.append('\t'); - break; - case '\\': - case '\'': - case '"': - sb.append(next); - break; - case 'x': - i += 2; - if (i < length) { - char first = value.charAt(i - 1); - char second = value.charAt(i); - if (first >= '0' && first <= '9' && second >= '0' && second <= '9') { - sb.append((char) ((first - '0') * 16 + (second - '0'))); - } - } - } - } - } else { - sb.append(c); - } - } - return sb.toString(); - } - - /** - * Splits a specified QMake variable value into a list of values. - * - * @param value the value - * @return the modifiable list of values - */ - private static List qmake3SplitValueList(String value) { - List result = new ArrayList<>(); - StringBuilder sb = new StringBuilder(); - char quote = 0; - boolean hadWord = false; - final int length = value.length(); - for (int i = 0; i < length; i++) { - char c = value.charAt(i); - if (quote == c) { - quote = 0; - hadWord = true; - sb.append(c); - continue; - } - - switch (c) { - case '"': - case '\'': - quote = c; - hadWord = true; - break; - case ' ': - case '\t': - if (quote == 0) { - if (hadWord) { - result.add(sb.toString()); - sb.delete(0, sb.length()); - hadWord = false; - } - continue; - } - break; - case '\\': - if (i + 1 < length) { - char nextChar = value.charAt(i + 1); - if (nextChar == '\'' || nextChar == '"' || nextChar == '\\') { - sb.append(c); - c = nextChar; - ++i; - } - } - //$FALL-THROUGH$ - default: - hadWord = true; - break; - } - sb.append(c); - } - - if (hadWord) { - result.add(sb.toString()); - } - - return Collections.unmodifiableList(result); - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeProjectInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeProjectInfo.java deleted file mode 100644 index 9641c288b84..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeProjectInfo.java +++ /dev/null @@ -1,293 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.CopyOnWriteArrayList; - -import org.eclipse.cdt.core.model.CoreModel; -import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; -import org.eclipse.cdt.core.settings.model.ICProjectDescription; -import org.eclipse.cdt.internal.qt.core.index.IQMakeEnvProvider.IController; -import org.eclipse.core.filesystem.URIUtil; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; - -/** - * Represents a QMake project information that is based on an activate project configuration of a specified related IProject. - * Allows to resolve actual information and listen its change. - */ -public final class QMakeProjectInfo implements IQMakeProjectInfo { - - private final State STATE_FREEZE = new State(); - private final State STATE_INVALID = new State(); - - // listeners - private final List listeners = new CopyOnWriteArrayList<>(); - - private final IProject project; - - private final Object stateSync = new Object(); - - // represents a current state of QMakeProjectInfo - private State state = STATE_INVALID; - - QMakeProjectInfo(IProject project) { - this.project = project; - } - - void destroy() { - setState(STATE_FREEZE); - } - - // must not be called under any QMake-related sync-lock, except for workspace lock - private void updateStateFrom(State fromState) { - synchronized (stateSync) { - if (state != fromState) { - return; - } - } - updateState(); - } - - // must not be called under any QMake-related sync-lock, except for workspace lock - // we are running outside of synchronized block to prevent deadlock involving workspace lock - // this means that theoretically there might be multiple thread calculating the same results but only the last one wins - State updateState() { - // note that getProjectDescription might acquire workspace lock - ICProjectDescription projectDescription = CoreModel.getDefault().getProjectDescriptionManager() - .getProjectDescription(project); - ICConfigurationDescription configuration = projectDescription != null - ? projectDescription.getActiveConfiguration() - : null; - State newState = configuration != null ? new State(configuration) : STATE_INVALID; - setState(newState); - return newState; - } - - private void setState(State newState) { - State oldState = null; - synchronized (stateSync) { - if (newState == null || state == newState) { - return; - } - if (state == STATE_FREEZE) { - newState.destroyBeforeInit(); - return; - } - oldState = state; - state = newState; - if (oldState != null) { - oldState.destroy(); - } - newState.init(); - } - for (IQMakeProjectInfoListener listener : listeners) { - listener.qmakeInfoChanged(); - } - } - - @Override - public void addListener(IQMakeProjectInfoListener listener) { - listeners.add(listener); - } - - @Override - public void removeListener(IQMakeProjectInfoListener listener) { - listeners.remove(listener); - } - - IProject getProject() { - return project; - } - - @Override - public IQMakeInfo getActualInfo() { - synchronized (stateSync) { - return state.getQMakeInfo(); - } - } - - @Override - public IQMakeInfo updateActualInfo() { - return updateState().getQMakeInfo(); - } - - // converts IFile to absolute path - private static String toFilePath(IFile file) { - if (file != null) { - IPath rawLocation = file.getRawLocation(); - if (rawLocation != null) { - rawLocation = rawLocation.makeAbsolute(); - if (rawLocation != null) { - File f = rawLocation.toFile(); - if (f != null) { - return f.getAbsolutePath(); - } - } - } - } - return null; - } - - // checks if any of the specified files is a sensitive file - boolean containsAnySensitiveFile(Set files) { - synchronized (stateSync) { - return state.containsAnySensitiveFile(files); - } - } - - /** - * Represents a state of QMakeInfo for a specific QMakeProjectInfo. - */ - private final class State implements IController { - - // an active project configuration - private final ICConfigurationDescription configuration; - // an active project qmake env - private final IQMakeEnv qmakeEnv; - // the last calculated QMake info; null if not calculated - private final IQMakeInfo qmakeInfo; - // a set of sensitive files that might affects actual QMake information - private final SensitiveSet sensitiveFilePathSet; - - State() { - configuration = null; - qmakeEnv = null; - qmakeInfo = QMakeInfo.INVALID; - sensitiveFilePathSet = new SensitiveSet(); - } - - State(ICConfigurationDescription configuration) { - this.configuration = configuration; - // qmakeEnv created from registry of qmakeEnvProvider extensions - this.qmakeEnv = QMakeEnvProviderManager.getInstance().createEnv(this); - - // retrieves IQMakeEnvInfo from IQMakeEnv - QMakeEnvInfo qmakeEnvInfo = qmakeEnv.getQMakeEnvInfo(); - - // retrieves .pro file path - String proFilePath = toFilePath(qmakeEnvInfo != null ? qmakeEnvInfo.getProFile() : null); - // retrieves qmake executable path - String qmakeFilePath = qmakeEnvInfo != null ? qmakeEnvInfo.getQMakeFilePath() : null; - // retries environment - List envList = new ArrayList<>(); - Map envMap = qmakeEnvInfo != null ? qmakeEnvInfo.getEnvironment() - : Collections.emptyMap(); - for (Map.Entry entry : envMap.entrySet()) { - envList.add(entry.getKey() + "=" + entry.getValue()); //$NON-NLS-1$ - } - - // calculates actual QMake info - qmakeInfo = QMakeInfo.create(proFilePath, qmakeFilePath, envList.toArray(new String[envList.size()])); - - // calculates a new set of sensitive file paths - sensitiveFilePathSet = new SensitiveSet(); - Set envSensFiles = qmakeEnvInfo != null ? qmakeEnvInfo.getSensitiveFiles() - : Collections.emptySet(); - for (IFile sensitiveFile : envSensFiles) { - if (sensitiveFile != null) { - sensitiveFilePathSet.addSensitiveFile(sensitiveFile); - } - } - if (proFilePath != null) { - sensitiveFilePathSet.addSensitiveFile(proFilePath); - } - List sensitiveFiles = qmakeInfo.getInvolvedQMakeFiles(); - if (sensitiveFiles != null) { - for (String sensitiveFile : sensitiveFiles) { - sensitiveFilePathSet.addSensitiveFile(sensitiveFile); - } - } - } - - private boolean containsAnySensitiveFile(Set files) { - for (Iterator iterator = files.iterator(); iterator.hasNext();) { - IPath path = iterator.next(); - if (sensitiveFilePathSet.contains(path)) { - return true; - } - } - return false; - } - - @Override - public ICConfigurationDescription getConfiguration() { - return configuration; - } - - public void destroyBeforeInit() { - // see IQMakeEnv JavaDoc for details - if (qmakeEnv != null && !(qmakeEnv instanceof IQMakeEnv2)) { - qmakeEnv.destroy(); - } - } - - public void init() { - if (qmakeEnv instanceof IQMakeEnv2) { - ((IQMakeEnv2) qmakeEnv).init(); - } - } - - public void destroy() { - if (qmakeEnv != null) { - qmakeEnv.destroy(); - } - } - - @Override - public void scheduleUpdate() { - updateStateFrom(this); - } - - IQMakeInfo getQMakeInfo() { - return qmakeInfo; - } - - } - - private static final class SensitiveSet extends HashSet { - - private static final long serialVersionUID = 2684086006933209512L; - - // adds a sensitive file in form of a specified absolute path - private void addSensitiveFile(String sensitiveFile) { - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - IFile[] files = root - .findFilesForLocationURI(URIUtil.toURI(Path.fromOSString(sensitiveFile).makeAbsolute())); - if (files != null && files.length > 0) { - IFile file = files[0]; - addSensitiveFile(file); - } - } - - // adds a sensitive file in form of a IFile - private void addSensitiveFile(IFile file) { - IPath fullPath = file.getFullPath(); - if (fullPath != null) { - add(fullPath); - } - } - - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeProjectInfoFactory.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeProjectInfoFactory.java deleted file mode 100644 index 7f497828468..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeProjectInfoFactory.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -import org.eclipse.core.resources.IProject; - -/** - * A factory for QMakeProjectInfo instances. - */ -public final class QMakeProjectInfoFactory { - - private QMakeProjectInfoFactory() { - } - - /** - * Provides a IQMakeProjectInfo for an active project configuration - * in a specified project. - * - * @param project the project - * @return IQMakeProjectInfo representing an activate project configuration - * in the specified project. - */ - public static IQMakeProjectInfo getForActiveConfigurationIn(IProject project) { - return QMakeProjectInfoManager.getQMakeProjectInfoFor(project); - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeProjectInfoManager.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeProjectInfoManager.java deleted file mode 100644 index 04337a12b2d..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeProjectInfoManager.java +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright (c) 2014 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.cdt.core.model.CoreModel; -import org.eclipse.cdt.core.settings.model.CProjectDescriptionEvent; -import org.eclipse.cdt.core.settings.model.ICDescriptionDelta; -import org.eclipse.cdt.core.settings.model.ICProjectDescriptionListener; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.resources.IResourceDeltaVisitor; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; - -/** - * Represents a management of QMakeProjectInfo instances and manages life-cycle of all QMakeProjectInfo instances. - */ -public class QMakeProjectInfoManager { - - private static final PDListener PD_LISTENER = new PDListener(); - private static final RCListener RC_LISTENER = new RCListener(); - - // sync object for CACHE field - private static final Object CACHE_SYNC = new Object(); - // a list of all QMakeProjectInfo instances - private static Map CACHE; - - // called by QtPlugin activator to setup this class - public static final void start() { - synchronized (CACHE_SYNC) { - CACHE = new HashMap<>(); - } - CoreModel.getDefault().addCProjectDescriptionListener(PD_LISTENER, - CProjectDescriptionEvent.LOADED | CProjectDescriptionEvent.APPLIED); - ResourcesPlugin.getWorkspace().addResourceChangeListener(RC_LISTENER, - IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.PRE_CLOSE | IResourceChangeEvent.PRE_DELETE); - } - - // called by QtPlugin activator to clean up this class - public static final void stop() { - ResourcesPlugin.getWorkspace().removeResourceChangeListener(RC_LISTENER); - CoreModel.getDefault().removeCProjectDescriptionListener(PD_LISTENER); - List infos; - synchronized (CACHE_SYNC) { - infos = new ArrayList<>(CACHE.values()); - CACHE = null; - } - for (QMakeProjectInfo info : infos) { - if (info != null) { - info.destroy(); - } - } - } - - /** - * Returns a QMakeProjectInfo for an active project configuration of a specified project. - * - * @param project the project - * @return the QMakeProjectInfo; or null if the project does not have QtNature - */ - public static QMakeProjectInfo getQMakeProjectInfoFor(IProject project) { - return getQMakeProjectInfoFor(project, true); - } - - private static QMakeProjectInfo getQMakeProjectInfoFor(IProject project, boolean create) { - QMakeProjectInfo info; - synchronized (CACHE_SYNC) { - // If the cache is null then this must be a late notification after shutdown. We - // can't do anything so don't try. - if (CACHE == null) - return null; - - info = CACHE.get(project); - if (info != null) { - return info; - } - if (!create) { - // do not create, just return null - return null; - } - info = new QMakeProjectInfo(project); - CACHE.put(project, info); - } - info.updateState(); - return info; - } - - // removes the project from the CACHE - private static void removeProjectFromCache(IResource project) { - QMakeProjectInfo info; - synchronized (CACHE_SYNC) { - // If the cache is null then this must be a late notification after shutdown. We - // can't do anything so don't try. - if (CACHE == null) - return; - - info = CACHE.remove(project); - } - if (info != null) { - info.destroy(); - } - } - - private static final class PDListener implements ICProjectDescriptionListener { - - // called on active project configuration change - @Override - public void handleEvent(CProjectDescriptionEvent event) { - ICDescriptionDelta projectDelta = event.getProjectDelta(); - if (projectDelta != null) { - if ((projectDelta.getChangeFlags() & ICDescriptionDelta.ACTIVE_CFG) != 0) { - QMakeProjectInfo info = getQMakeProjectInfoFor(event.getProject(), false); - if (info != null) { - info.updateState(); - } - } - } - } - - } - - /** - * Listens on Eclipse file system changes. - */ - private static final class RCListener implements IResourceChangeListener { - - @Override - public void resourceChanged(IResourceChangeEvent event) { - RDVisitor visitor = new RDVisitor(); - - // collect project to delete and changed files - switch (event.getType()) { - case IResourceChangeEvent.PRE_CLOSE: - case IResourceChangeEvent.PRE_DELETE: - IResource project = event.getResource(); - if (project != null && project.getType() == IResource.PROJECT) { - visitor.addProjectToDelete(project); - } - break; - case IResourceChangeEvent.POST_CHANGE: - IResourceDelta delta = event.getDelta(); - if (delta != null) { - try { - delta.accept(visitor); - } catch (CoreException e) { - // empty - } - } - break; - } - - // process collected data - visitor.process(); - } - - } - - private static final class RDVisitor implements IResourceDeltaVisitor { - - private final Set projectsToDelete = new HashSet<>(); - private final Set projectsToUpdate = new HashSet<>(); - private final Set changedFiles = new HashSet<>(); - - @Override - public boolean visit(IResourceDelta delta) throws CoreException { - IResource resource = delta.getResource(); - if (resource != null) { - switch (resource.getType()) { - case IResource.FILE: - addChangedFile(resource); - return false; - case IResource.PROJECT: - switch (delta.getKind()) { - case IResourceDelta.CHANGED: - if ((delta.getFlags() & IResourceDelta.DESCRIPTION) != 0) { - addProjectToUpdate(resource); - } - return true; - case IResourceDelta.REMOVED: - addProjectToDelete(resource); - return false; - } - break; - } - } - return true; - } - - private void addProjectToUpdate(IResource project) { - projectsToUpdate.add(project); - } - - private void addProjectToDelete(IResource project) { - projectsToDelete.add(project); - } - - private void addChangedFile(IResource file) { - IPath fullPath = file.getFullPath(); - if (fullPath != null) { - changedFiles.add(fullPath); - } - } - - public void process() { - // removing projects from CACHE - for (IResource project : projectsToDelete) { - removeProjectFromCache(project); - } - - List infos; - synchronized (CACHE_SYNC) { - // If the cache is null then this must be a late notification after shutdown. We - // can't do anything so don't try. - if (CACHE == null) - return; - - infos = new ArrayList<>(CACHE.values()); - } - for (QMakeProjectInfo info : infos) { - // checking if any project description change or any of the changed files affect QMakeProjectInfo - if (projectsToUpdate.contains(info.getProject()) || info.containsAnySensitiveFile(changedFiles)) { - // if so then updating - info.updateState(); - } - } - } - - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeVersion.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeVersion.java deleted file mode 100644 index 592443e8e3c..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMakeVersion.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.eclipse.cdt.internal.qt.core.Activator; - -/** - * A container class to interpret and store value of the the qmake version. - */ -public final class QMakeVersion implements IQtVersion { - - // QMAKE_VERSION looks like 2.01a or 3.0 - private static final Pattern REGEXP = Pattern.compile("([\\d]+)\\.([\\d]+).*"); //$NON-NLS-1$ - - // parses major and minor version numbers only - public static QMakeVersion create(String version) { - if (version == null) { - return null; - } - - Matcher m = REGEXP.matcher(version.trim()); - if (!m.matches()) { - return null; - } - - try { - int major = Integer.parseInt(m.group(1)); - int minor = Integer.parseInt(m.group(2)); - return new QMakeVersion(major, minor); - } catch (NumberFormatException e) { - Activator.log(e); - } - return null; - } - - private final int major; - private final int minor; - - private QMakeVersion(int major, int minor) { - this.major = major; - this.minor = minor; - } - - @Override - public int getMajor() { - return major; - } - - @Override - public int getMinor() { - return minor; - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMethod.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMethod.java deleted file mode 100644 index 57076a43a5d..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QMethod.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -import java.util.Collection; -import java.util.Collections; - -import org.eclipse.cdt.core.dom.ast.IBinding; -import org.eclipse.cdt.internal.qt.core.QtMethodUtil; -import org.eclipse.cdt.internal.qt.core.index.IQObject.IMember; -import org.eclipse.cdt.internal.qt.core.pdom.QtPDOMQMethod; -import org.eclipse.core.runtime.CoreException; - -public class QMethod implements IQMethod { - - private final IQObject owner; - private final String name; - private final IQMethod.Kind kind; - private final Collection signatures; - private final Long revision; - - public QMethod(IQObject owner, QtPDOMQMethod pdom) throws CoreException { - this.owner = owner; - this.name = pdom.getName(); - this.kind = pdom.getKind(); - this.signatures = QtMethodUtil.getDecodedQtMethodSignatures(pdom.getQtEncodedSignatures()); - this.revision = pdom.getRevision(); - } - - @Override - public boolean isOverride(IMember member) { - if (!IQMethod.class.isAssignableFrom(member.getClass())) - return false; - - // Methods override when they have the same name and type. - - IQMethod other = (IQMethod) member; - - if (name == null) { - if (other.getName() != null) - return false; - } else if (!name.equals(other.getName())) - return false; - - IBinding otherBinding = other.getBinding(); - if (otherBinding == null) - return getBinding() == null; - - return false;// TODO - // if (!ICPPMethod.class.isAssignableFrom(otherBinding.getClass())) - // return false; - // - // IType thisType = method.getType(); - // IType otherType = ((ICPPMethod) otherBinding).getType(); - // return thisType == null ? otherType == null : thisType.isSameType(otherType); - } - - @Override - public IBinding getBinding() { - return null; // TODO method; - } - - @Override - public IQObject getOwner() { - return owner; - } - - @Override - public Kind getKind() { - return kind; - } - - @Override - public String getName() { - return name; - } - - @Override - public Collection getSignatures() { - return signatures == null ? Collections.emptyList() : signatures; - } - - @Override - public Long getRevision() { - return revision; - } - - @Override - public String toString() { - return kind.toString() + ' ' + signatures; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QObject.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QObject.java deleted file mode 100644 index 44b6948379b..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QObject.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; - -import org.eclipse.cdt.core.dom.ast.IBinding; -import org.eclipse.cdt.internal.qt.core.pdom.QtPDOMProperty; -import org.eclipse.cdt.internal.qt.core.pdom.QtPDOMQEnum; -import org.eclipse.cdt.internal.qt.core.pdom.QtPDOMQMethod; -import org.eclipse.cdt.internal.qt.core.pdom.QtPDOMQObject; -import org.eclipse.cdt.internal.qt.core.pdom.QtPDOMQmlRegistration; -import org.eclipse.core.runtime.CoreException; - -public class QObject implements IQObject { - - private final String name; - private final QtPDOMQObject pdomQObject; - private final List bases; - private final IQObject.IMembers slots; - private final IQObject.IMembers signals; - private final IQObject.IMembers invokables; - private final IQObject.IMembers properties; - private final List qmlRegistrations; - private final List enums; - private final Map classInfos; - - public QObject(QtIndexImpl qtIndex, CDTIndex cdtIndex, QtPDOMQObject pdomQObject) throws CoreException { - this.name = pdomQObject.getName(); - this.pdomQObject = pdomQObject; - - List baseSlots = new ArrayList<>(); - List baseSignals = new ArrayList<>(); - List baseInvokables = new ArrayList<>(); - List baseProps = new ArrayList<>(); - - this.bases = new ArrayList<>(); - for (QtPDOMQObject base : pdomQObject.findBases()) { - QObject baseQObj = new QObject(qtIndex, cdtIndex, base); - this.bases.add(baseQObj); - baseSlots.addAll(baseQObj.getSlots().all()); - baseSignals.addAll(baseQObj.getSignals().all()); - baseInvokables.addAll(baseQObj.getInvokables().all()); - baseProps.addAll(baseQObj.getProperties().all()); - } - - this.classInfos = pdomQObject.getClassInfos(); - - List slots = new ArrayList<>(); - List signals = new ArrayList<>(); - List invokables = new ArrayList<>(); - for (QtPDOMQMethod pdom : pdomQObject.getChildren(QtPDOMQMethod.class)) - switch (pdom.getKind()) { - case Slot: - slots.add(new QMethod(this, pdom)); - break; - case Signal: - signals.add(new QMethod(this, pdom)); - break; - case Invokable: - invokables.add(new QMethod(this, pdom)); - break; - case Unspecified: - break; - } - - this.slots = QObjectMembers.create(slots, baseSlots); - this.signals = QObjectMembers.create(signals, baseSignals); - this.invokables = QObjectMembers.create(invokables, baseInvokables); - - this.enums = new ArrayList<>(); - for (QtPDOMQEnum pdom : pdomQObject.getChildren(QtPDOMQEnum.class)) - this.enums.add(new QEnum(pdom.getName(), pdom.isFlag(), pdom.getEnumerators())); - - List props = new ArrayList<>(); - for (QtPDOMProperty pdom : pdomQObject.getChildren(QtPDOMProperty.class)) { - QProperty qProp = new QProperty(this, pdom.getType(), pdom.getName()); - for (QtPDOMProperty.Attribute attr : pdom.getAttributes()) - qProp.setAttribute(attr.attr, attr.value); - props.add(qProp); - } - this.properties = QObjectMembers.create(props, baseProps); - - this.qmlRegistrations = new ArrayList<>(); - for (QtPDOMQmlRegistration pdom : QtPDOMQmlRegistration.findFor(pdomQObject)) - this.qmlRegistrations.add(QmlRegistration.create(qtIndex, pdom)); - } - - @Override - public IBinding getBinding() { - return pdomQObject; - } - - @Override - public String getName() { - return name; - } - - @Override - public List getBases() { - return bases; - } - - @Override - public IMembers getSlots() { - return slots; - } - - @Override - public IMembers getSignals() { - return signals; - } - - @Override - public IMembers getInvokables() { - return invokables; - } - - @Override - public IQObject.IMembers getProperties() { - return properties; - } - - @Override - public Collection getQmlRegistrations() { - return qmlRegistrations; - } - - @Override - public String getClassInfo(String key) { - String value = classInfos.get(key); - if (value != null) - return value; - - for (IQObject base : bases) { - value = base.getClassInfo(key); - if (value != null) - return value; - } - - return null; - } - - @Override - public Collection getEnums() { - return enums; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QObjectMembers.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QObjectMembers.java deleted file mode 100644 index 6dc717b808b..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QObjectMembers.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -public class QObjectMembers implements IQObject.IMembers { - - private final List all; - private final Collection locals; - private Collection withoutOverrides; - - public static QObjectMembers create(Collection locals, Collection inherited) { - // NOTE: All must be ordered with the locals before the inherited members. This ensures that - // the algorithm for computing #withoutOverrides will filter out the parent members and - // not the local ones. - // @see withoutOverrides() - ArrayList all = new ArrayList<>(locals.size() + inherited.size()); - all.addAll(locals); - all.addAll(inherited); - return new QObjectMembers<>(all, locals); - } - - private QObjectMembers(List all, Collection locals) { - this.all = Collections.unmodifiableList(all); - this.locals = Collections.unmodifiableCollection(locals); - } - - @Override - public Collection all() { - return all; - } - - @Override - public Collection locals() { - return locals; - } - - @Override - public Collection withoutOverrides() { - - if (withoutOverrides == null) - synchronized (all) { - if (withoutOverrides == null) { - - // Naively tests each existing element for override before inserting the new - // element. Most member lists have less than 3 elements, and the largest that - // I've found (in the Qt impl) is about 20; so performance may not be as bad - // as it seems. - // - // An earlier approach tried to use a SortedSet with the #isOverride result in - // the Comparator. The problem with the approach is finding a stable sort order - // when the members don't override each other. - // E.g., if o1 and o2 override each other and m is unrelated, we could get a - // tree like: - // m - // / \ - // o1 o2 - - ArrayList filtered = new ArrayList<>(all.size()); - for (T member : all) { - boolean isOverridden = false; - for (Iterator i = filtered.iterator(); !isOverridden && i.hasNext();) - isOverridden = member.isOverride(i.next()); - if (!isOverridden) - filtered.add(member); - } - - withoutOverrides = Collections.unmodifiableCollection(filtered); - } - } - - return withoutOverrides; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QProperty.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QProperty.java deleted file mode 100644 index 5f5b25cb167..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QProperty.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -public class QProperty extends AbstractQField implements IQProperty { - - private String type; - private final String[] values = new String[Attribute.values().length]; - - public QProperty(IQObject owner, String type, String name) { - super(owner); - this.type = type; - this.name = name; - } - - public void setAttribute(IQProperty.Attribute attr, String value) { - values[attr.ordinal()] = (value == null ? "" : value); //$NON-NLS-1$ - } - - @Override - public String getType() { - return type; - } - - @Override - public String getName() { - return name; - } - - @Override - public String getValue(Attribute attr) { - return values[attr.ordinal()]; - } - - @Override - public String getReadMethodName() { - return Attribute.READ.valueIn(this); - } - - @Override - public String getWriteMethodName() { - return Attribute.WRITE.valueIn(this); - } - - @Override - public String getResetMethodName() { - return Attribute.RESET.valueIn(this); - } - - @Override - public String getNotifyMethodName() { - return Attribute.NOTIFY.valueIn(this); - } - - @Override - public Long getRevision() { - String revision = Attribute.REVISION.valueIn(this); - if (revision != null) - try { - return Long.valueOf(revision); - } catch (NumberFormatException e) { - // This is a problem with the user's C++ code, there is no need to log this exception, - // just ignore the value. - } - - return null; - } - - @Override - public String getDesignable() { - return Attribute.DESIGNABLE.valueIn(this); - } - - @Override - public String getScriptable() { - return Attribute.SCRIPTABLE.valueIn(this); - } - - @Override - public String getStored() { - return Attribute.STORED.valueIn(this); - } - - @Override - public String getUser() { - return Attribute.USER.valueIn(this); - } - - @Override - public boolean isConstant() { - return Attribute.CONSTANT.valueIn(this) != null; - } - - @Override - public boolean isFinal() { - return Attribute.FINAL.valueIn(this) != null; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QmlRegistration.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QmlRegistration.java deleted file mode 100644 index fbefaa5f282..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QmlRegistration.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2014, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -import org.eclipse.cdt.core.dom.ast.IBinding; -import org.eclipse.cdt.internal.qt.core.index.IQObject.IMember; -import org.eclipse.cdt.internal.qt.core.pdom.QtPDOMQmlRegistration; -import org.eclipse.cdt.internal.qt.core.pdom.QtPDOMQmlUncreatable; -import org.eclipse.core.runtime.CoreException; - -public class QmlRegistration implements IQmlRegistration { - - private final QtIndexImpl qtIndex; - private final IQmlRegistration.Kind kind; - private final String[] ownerName; - private final Long version; - private final String uri; - private final Long major; - private final Long minor; - private final String qmlName; - private final String reason; - private IQObject qObject; - - public static QmlRegistration create(QtIndexImpl qtIndex, IBinding pdom) throws CoreException { - if (pdom instanceof QtPDOMQmlUncreatable) - return new QmlRegistration(qtIndex, (QtPDOMQmlUncreatable) pdom); - if (pdom instanceof QtPDOMQmlRegistration) - return new QmlRegistration(qtIndex, (QtPDOMQmlRegistration) pdom); - return null; - } - - private QmlRegistration(QtIndexImpl qtIndex, QtPDOMQmlRegistration pdom) throws CoreException { - this.qtIndex = qtIndex; - this.kind = IQmlRegistration.Kind.Type; - - String qobjName = pdom.getQObjectName(); - this.ownerName = qobjName == null ? null : qobjName.split("::"); //$NON-NLS-1$ - - this.version = pdom.getVersion(); - this.uri = pdom.getUri(); - this.major = pdom.getMajor(); - this.minor = pdom.getMinor(); - this.qmlName = pdom.getQmlName(); - this.reason = null; - } - - private QmlRegistration(QtIndexImpl qtIndex, QtPDOMQmlUncreatable pdom) throws CoreException { - this.qtIndex = qtIndex; - this.kind = IQmlRegistration.Kind.Uncreatable; - - String qobjName = pdom.getQObjectName(); - this.ownerName = qobjName == null ? null : qobjName.split("::"); //$NON-NLS-1$ - - this.version = pdom.getVersion(); - this.uri = pdom.getUri(); - this.major = pdom.getMajor(); - this.minor = pdom.getMinor(); - this.qmlName = pdom.getQmlName(); - this.reason = pdom.getReason(); - } - - @Override - public IQmlRegistration.Kind getKind() { - return kind; - } - - @Override - public IQObject getQObject() { - if (qObject == null && ownerName != null) - qObject = qtIndex.findQObject(ownerName); - return qObject; - } - - // TODO remove getQObject from the API - @Override - public IQObject getOwner() { - return getQObject(); - } - - @Override - public boolean isOverride(IMember member) { - // TODO I think that qmlRegistrations are never overridden - return false; - } - - @Override - public Long getVersion() { - return version; - } - - @Override - public String getURI() { - return uri; - } - - @Override - public Long getMajor() { - return major; - } - - @Override - public Long getMinor() { - return minor; - } - - @Override - public String getQmlName() { - return qmlName; - } - - @Override - public String getReason() { - return reason; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QtFactory.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QtFactory.java deleted file mode 100644 index 0b7b02cf557..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QtFactory.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -import java.util.SortedSet; -import java.util.TreeSet; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.index.IIndex; -import org.eclipse.cdt.core.index.IIndexMacro; -import org.eclipse.cdt.core.index.IndexFilter; -import org.eclipse.cdt.core.model.CoreModel; -import org.eclipse.cdt.core.model.ICProject; -import org.eclipse.cdt.internal.qt.core.Activator; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; - -public class QtFactory { - - private static final char[] QT_VERSION = "QT_VERSION".toCharArray(); //$NON-NLS-1$ - - public static QtIndex create(IProject project) { - CDTIndex cdtIndex = getCDTIndex(project); - if (cdtIndex == null) { - Activator.log("could not get CDT index from project " + project.getName()); //$NON-NLS-1$ - return null; - } - - QtVersion qtVersion = cdtIndex.get(QtVersionAccessor); - if (qtVersion == null) { - Activator.log("could not find Qt version in CDT index from project " + project.getName()); //$NON-NLS-1$ - return null; - } - - if (qtVersion.major == 4 && qtVersion.minor == 8) - return new QtIndexImpl(cdtIndex); - - // Qt 4.8 is the default implementation, 5.0 support will need to come soon - return new QtIndexImpl(cdtIndex); - } - - private static CDTIndex getCDTIndex(IProject project) { - if (project == null) - return null; - - ICProject cProject = CoreModel.getDefault().create(project); - if (cProject == null) - return null; - - IIndex index = null; - try { - index = CCorePlugin.getIndexManager().getIndex(cProject); - } catch (CoreException e) { - Activator.log(e); - return null; - } - - return index == null ? null : new CDTIndex(index); - } - - /** - * A small wrapper to hold the result of index lookups for the Qt version. - */ - private static class QtVersion { - public final int major; - public final int minor; - @SuppressWarnings("unused") - public final int patch; - - // QT_VERSION looks like 0x040805 - private static final Pattern Version_regex = Pattern - .compile("0x([a-fA-F\\d]{1,2})([a-fA-F\\d]{2})([a-fA-F\\d]{2})"); //$NON-NLS-1$ - - public static QtVersion create(String version) { - Matcher m = Version_regex.matcher(version); - if (!m.matches()) - return null; - - try { - int major = Integer.parseInt(m.group(1), 16); - int minor = Integer.parseInt(m.group(2), 16); - int patch = Integer.parseInt(m.group(3), 16); - return new QtVersion(major, minor, patch); - } catch (NumberFormatException e) { - Activator.log(e); - } - return null; - } - - private QtVersion(int major, int minor, int patch) { - this.major = major; - this.minor = minor; - this.patch = patch; - } - } - - private static final CDTIndex.Accessor QtVersionAccessor = new CDTIndex.Accessor<>() { - @Override - public QtVersion access(IIndex index) throws CoreException { - // Multiple macros might be found, sort the values and choose the highest version. - SortedSet versions = new TreeSet<>(); - try { - for (IIndexMacro macro : index.findMacros(QT_VERSION, IndexFilter.ALL, null)) - versions.add(new String(macro.getExpansion()).toLowerCase()); - } catch (CoreException e) { - } - - // don't create the Qt index if there is no Qt information in the CDT index - if (versions.size() <= 0) - return null; - - // the highest version has been sorted to the last position - return QtVersion.create(versions.last()); - } - }; -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QtIndex.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QtIndex.java deleted file mode 100644 index 5d0f3fedf72..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QtIndex.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -import java.util.Collection; - -import org.eclipse.cdt.internal.qt.core.Activator; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; - -/** - * The public interface to the Qt index. The Qt index is a small wrapper around the - * core CDT's CIndex that adds Qt specific information. The Qt index is designed to - * interpret multiple versions of Qt, however only 4.8 has been implemented for now. - * - * @see #getIndex(IProject) - */ -public abstract class QtIndex { - /** - * Return an instance of the Qt index for the argument project. The CDT index is - * examined to discover appropriate version of Qt (using the value of QT_VERSION). - * Returns null if the Qt index cannot be created. This could happen if the argument - * project does not have the qtnature, or if the value of QT_VERSION is not supported - * by this implementation. - * - * @param project A Qt enabled project that should be indexed with Qt-specific information. - * @return The Qt index or null if the index cannot be created. - */ - public static QtIndex getIndex(IProject project) { - - if (project == null) - return null; - - try { - Object index = project.getSessionProperty(Activator.QTINDEX_PROP_NAME); - if (index instanceof QtIndex) - return (QtIndex) index; - } catch (CoreException e) { - Activator.log(e); - } - - // create and store a new instance when needed - QtIndex index = QtFactory.create(project); - if (index == null) - return null; - - try { - project.setSessionProperty(Activator.QTINDEX_PROP_NAME, index); - } catch (CoreException e) { - Activator.log(e); - } - - return index; - } - - /** - * Find and return a subclass of QObject with the given qualified name. Returns null if - * the index does not have a subclass of QObject with the given name. - */ - public abstract IQObject findQObject(String[] qualifiedName); - - /** - * Find and return a class that has been marked with the Q_GADGET macro. These are - * normal C++ classes that are able to introduce Q_ENUMS and Q_FLAGS to the Qt - * meta-object system. Returns null if the index does not have a Q_GADGET with - * the given name. - */ - public abstract IQGadget findQGadget(String[] qualifiedName); - - /** - * Find and return the types that have been registered with the Qt meta type system. This - * is the result of the function calls like: - *

-	 * qmlRegisterType( "uri", 1, 2, "Qv1.2" );
-	 * 
- */ - public abstract Collection getQmlRegistrations(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QtIndexImpl.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QtIndexImpl.java deleted file mode 100644 index a9572ff6ef8..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/index/QtIndexImpl.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.index; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.regex.Pattern; - -import org.eclipse.cdt.core.dom.ILinkage; -import org.eclipse.cdt.core.dom.ast.IBinding; -import org.eclipse.cdt.core.index.IIndex; -import org.eclipse.cdt.core.index.IIndexBinding; -import org.eclipse.cdt.core.index.IndexFilter; -import org.eclipse.cdt.internal.qt.core.ASTUtil; -import org.eclipse.cdt.internal.qt.core.QtKeywords; -import org.eclipse.cdt.internal.qt.core.pdom.AbstractQtPDOMClass; -import org.eclipse.cdt.internal.qt.core.pdom.QtPDOMQObject; -import org.eclipse.core.runtime.CoreException; - -public class QtIndexImpl extends QtIndex { - - private final CDTIndex cdtIndex; - - private static final Pattern QmlTypeNameRegex = Pattern.compile( - "^(?:" + QtKeywords.QML_REGISTER_TYPE + '|' + QtKeywords.QML_REGISTER_UNCREATABLE_TYPE + ")<.*>\0(.*)$"); //$NON-NLS-1$ //$NON-NLS-2$ - - private static final IndexFilter QtLinkageFilter = new IndexFilter() { - @Override - public boolean acceptLinkage(ILinkage linkage) { - return linkage.getLinkageID() == ILinkage.QT_LINKAGE_ID; - } - - @Override - public boolean acceptBinding(IBinding binding) throws CoreException { - return true; - } - }; - - public QtIndexImpl(CDTIndex cdtIndex) { - this.cdtIndex = cdtIndex; - } - - @Override - public IQObject findQObject(String[] name) { - return name == null ? null : cdtIndex.get(new QObjectImplAccessor(name)); - } - - @Override - public IQGadget findQGadget(String[] name) { - return name == null ? null : cdtIndex.get(new QGadgetImplAccessor(name)); - } - - @Override - public Collection getQmlRegistrations() { - return cdtIndex.get(new QmlRegistrationAccessor()); - } - - private class QObjectImplAccessor implements CDTIndex.Accessor { - - private final char[] name; - - public QObjectImplAccessor(String[] qualName) { - // QObjects are stored in the Qt linkage using their fully qualified name. - name = ASTUtil.getFullyQualifiedName(qualName).toCharArray(); - } - - @Override - public IQObject access(IIndex index) throws CoreException { - - // TODO can there be more than one result? - for (IIndexBinding binding : index.findBindings(name, QtLinkageFilter, null)) - if (binding instanceof QtPDOMQObject) - return new QObject(QtIndexImpl.this, cdtIndex, (QtPDOMQObject) binding); - - return null; - } - } - - private class QGadgetImplAccessor implements CDTIndex.Accessor { - - private final char[][] name; - - public QGadgetImplAccessor(String[] qualName) { - name = new char[qualName.length][]; - for (int i = 0; i < name.length; ++i) - name[i] = qualName[i].toCharArray(); - } - - @Override - public IQGadget access(IIndex index) throws CoreException { - - // TODO can there be more than one result? - for (IIndexBinding binding : index.findBindings(name, QtLinkageFilter, null)) - if (binding instanceof AbstractQtPDOMClass) - return new QGadget(QtIndexImpl.this, cdtIndex, (AbstractQtPDOMClass) binding); - - return null; - } - } - - private class QmlRegistrationAccessor implements CDTIndex.Accessor> { - - @Override - public Collection access(IIndex index) throws CoreException { - Collection types = null; - for (IIndexBinding binding : index.findBindings(QmlTypeNameRegex, false, QtLinkageFilter, null)) { - IQmlRegistration qml = QmlRegistration.create(QtIndexImpl.this, binding); - if (qml != null) { - if (types == null) - types = new ArrayList<>(); - types.add(qml); - } - } - - return types == null ? Collections.emptyList() : types; - } - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/location/Position.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/location/Position.java deleted file mode 100644 index c2c337b0c7d..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/location/Position.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.location; - -import org.eclipse.cdt.qt.core.location.IPosition; - -public class Position implements IPosition { - private final int line; - private final int column; - - public Position(int line, int column) { - this.line = line; - this.column = column; - } - - @Override - public int getLine() { - return line; - } - - @Override - public int getColumn() { - return column; - } - - @Override - public String toString() { - return "(" + line + ":" + column + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/location/SourceLocation.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/location/SourceLocation.java deleted file mode 100644 index bc61052998c..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/location/SourceLocation.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.location; - -import org.eclipse.cdt.qt.core.location.IPosition; -import org.eclipse.cdt.qt.core.location.ISourceLocation; - -public class SourceLocation implements ISourceLocation { - private String source; - private IPosition start; - private IPosition end; - - public SourceLocation() { - this(null, null, null); - } - - public SourceLocation(String source, IPosition start, IPosition end) { - this.source = source; - this.start = start; - this.end = end; - } - - public void setSource(String value) { - this.source = value; - } - - @Override - public String getSource() { - return source; - } - - public void setStart(IPosition value) { - this.start = value; - } - - @Override - public IPosition getStart() { - return start; - } - - public void setEnd(IPosition value) { - this.end = value; - } - - @Override - public IPosition getEnd() { - return end; - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/messages.properties b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/messages.properties deleted file mode 100644 index 2c7efdfea3d..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/messages.properties +++ /dev/null @@ -1,4 +0,0 @@ -QtBuildConfiguration_ConfigNotFound=Qt Install for build configuration %s not found. -QtBuildConfiguration_MakeNotFound='make' not found.\n -QtBuilder_0=Error: Qt has not been configured.\nPlease add a Qt install in the Qt preferences page.\n -QtBuildTab_Name=Qt Build diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/parser/QtParser.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/parser/QtParser.java deleted file mode 100644 index 89796ec4e4c..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/parser/QtParser.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2013 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.parser; - -import org.eclipse.cdt.core.dom.ast.IASTDeclarator; -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclarator; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTParameterDeclaration; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTypeId; -import org.eclipse.cdt.core.dom.parser.cpp.GPPParserExtensionConfiguration; -import org.eclipse.cdt.core.parser.EndOfFileException; -import org.eclipse.cdt.core.parser.IToken; -import org.eclipse.cdt.core.parser.NullLogService; -import org.eclipse.cdt.core.parser.ParserMode; -import org.eclipse.cdt.internal.core.dom.parser.BacktrackException; -import org.eclipse.cdt.internal.core.dom.parser.DeclarationOptions; -import org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser; - -/** - * A parser that use a special StringScanner to extract small sections of C++ syntax that - * are used in Qt macro expansions. - * - * @see StringScanner - */ -@SuppressWarnings("restriction") -public class QtParser extends GNUCPPSourceParser { - - private QtParser(String str) { - super(new StringScanner(str), ParserMode.QUICK_PARSE, new NullLogService(), - GPPParserExtensionConfiguration.getInstance()); - } - - /** - * The argument String is the expansion parameter for SIGNAL and SLOT macros. The text - * is parsed and the function declarator is returned if possible. Returns null if the - * string is not a valid function declarator reference. - */ - public static ICPPASTFunctionDeclarator parseQtMethodReference(String str) { - // Reject strings that have embedded line terminators. This is needed to properly check that - // one that is about to be added. - if (str == null || str.contains(";")) //$NON-NLS-1$ - return null; - - QtParser parser = new QtParser(str + ';'); - try { - IASTDeclarator declarator = parser.declarator(GNUCPPSourceParser.DtorStrategy.PREFER_FUNCTION, - DeclarationOptions.CPP_MEMBER); - if (!(declarator instanceof ICPPASTFunctionDeclarator)) - return null; - - // JI 439374: Make sure the ; was the last token read to prevent errors where extra strings - // appear in the expansion parameter. - if (parser.lastTokenFromScanner == null || parser.lastTokenFromScanner.getType() != IToken.tSEMI) - return null; - - // JI 439374: Make sure the ; was the last token read to prevent errors where extra strings - // appear in the expansion parameter. - if (parser.lastTokenFromScanner == null || parser.lastTokenFromScanner.getType() != IToken.tSEMI) - return null; - - // make sure this is a legal declarator for a Qt method reference - ICPPASTFunctionDeclarator function = (ICPPASTFunctionDeclarator) declarator; - - // 1) parameters must not have names - for (ICPPASTParameterDeclaration param : function.getParameters()) { - ICPPASTDeclarator decltor = param.getDeclarator(); - if (decltor == null) - continue; - - IASTName paramName = decltor.getName(); - if (paramName == null) - continue; - - char[] name = paramName.getSimpleID(); - if (name == null || name.length <= 0) - continue; - - // The Qt normalization code treats a reference with a trailing const as a special case (this - // seems to be a bug in the way they normalize const pointers. We could support this case by - // allowing reference parameters to be named 'const'. However, since this seems to be a bug - // in Qt they will likely fix it at some point, and there doesn't seem to be a case where the - // user would need to reference the Qt method in this way. - - // the parameter has a non-empty name, so reject the declarator - return null; - } - - // All tests have passed, so return this declarator. - return function; - } catch (BacktrackException e) { - return null; - } catch (EndOfFileException e) { - return null; - } - } - - public static ICPPASTTypeId parseTypeId(String str) { - QtParser parser = new QtParser(str); - try { - return parser.typeId(new DeclarationOptions(DeclarationOptions.NO_INITIALIZER)); - } catch (BacktrackException e) { - return null; - } catch (EndOfFileException e) { - return null; - } - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/parser/StringScanner.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/parser/StringScanner.java deleted file mode 100644 index 225976f853e..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/parser/StringScanner.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Andrew Eidness (QNX) - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.parser; - -import java.util.Map; - -import org.eclipse.cdt.core.dom.ast.IMacroBinding; -import org.eclipse.cdt.core.parser.EndOfFileException; -import org.eclipse.cdt.core.parser.IScanner; -import org.eclipse.cdt.core.parser.IToken; -import org.eclipse.cdt.core.parser.IncludeExportPatterns; -import org.eclipse.cdt.core.parser.Keywords; -import org.eclipse.cdt.core.parser.OffsetLimitReachedException; -import org.eclipse.cdt.core.parser.util.CharArrayIntMap; -import org.eclipse.cdt.internal.core.parser.scanner.ILexerLog; -import org.eclipse.cdt.internal.core.parser.scanner.ILocationResolver; -import org.eclipse.cdt.internal.core.parser.scanner.Lexer; -import org.eclipse.cdt.internal.core.parser.scanner.Lexer.LexerOptions; - -/** - * The standard CDT scanner is CPreprocessor, which uses a Lexer to read from a file. - * The relationships look like: - *
- * GNUCPPSourceParser - CPreprocessor - Lexer - *

- * The implementation of CPreprocessor depends on reading from a file. It might be possible - * to configure it to get content from a String instead, but it seems like a complex change. - * This simpler solution replaces the CPreprocessor with a simple scanner. In this context, - * the only part of CPreprocessor that seems to be needed is replacing the token type for - * keywords. In this case the relationships look like: - *
- * QtParser - StringScanner - Lexer - */ -@SuppressWarnings("restriction") -public class StringScanner implements IScanner { - private final Lexer lexer; - private final CharArrayIntMap keywords; - - public StringScanner(String str) { - this.lexer = new Lexer(str.toCharArray(), new LexerOptions(), ILexerLog.NULL, null); - keywords = new CharArrayIntMap(40, -1); - Keywords.addKeywordsCpp(keywords); - } - - @Override - public IToken nextToken() throws EndOfFileException { - IToken token = lexer.nextToken(); - if (token.getType() != IToken.tIDENTIFIER) - return token; - - char[] name = token.getCharImage(); - int tokenType = keywords.get(name); - if (tokenType != keywords.undefined) - token.setType(tokenType); - - return token; - } - - @Override - public Map getMacroDefinitions() { - return null; - } - - @Override - public boolean isOnTopContext() { - return false; - } - - @Override - public void cancel() { - } - - @Override - public ILocationResolver getLocationResolver() { - return null; - } - - @Override - public void setTrackIncludeExport(IncludeExportPatterns patterns) { - } - - @Override - public void setContentAssistMode(int offset) { - } - - @Override - public void setSplitShiftROperator(boolean val) { - } - - @Override - public void setComputeImageLocations(boolean val) { - } - - @Override - public void setProcessInactiveCode(boolean val) { - } - - @Override - public void skipInactiveCode() throws OffsetLimitReachedException { - } - - @Override - public int getCodeBranchNesting() { - return 0; - } - - @Override - public char[] getAdditionalNumericLiteralSuffixes() { - return new char[] {}; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/ASTDelegatedName.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/ASTDelegatedName.java deleted file mode 100644 index d5c067d335f..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/ASTDelegatedName.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright (c) 2013, 2014 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import org.eclipse.cdt.core.dom.ILinkage; -import org.eclipse.cdt.core.dom.ast.ASTNodeProperty; -import org.eclipse.cdt.core.dom.ast.ASTVisitor; -import org.eclipse.cdt.core.dom.ast.ExpansionOverlapsBoundaryException; -import org.eclipse.cdt.core.dom.ast.IASTCompletionContext; -import org.eclipse.cdt.core.dom.ast.IASTFileLocation; -import org.eclipse.cdt.core.dom.ast.IASTImageLocation; -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.cdt.core.dom.ast.IASTNode; -import org.eclipse.cdt.core.dom.ast.IASTNodeLocation; -import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; -import org.eclipse.cdt.core.dom.ast.IBinding; -import org.eclipse.cdt.core.parser.IToken; - -/** - * The Qt linkage introduces several names that are based on names from the C++ linkage. This - * utility class is used to delegate operations to that base C++ name. Methods can be overridden - * by implementing in a subclass. - * - * @see QObjectName - */ -public abstract class ASTDelegatedName implements IASTName { - - protected final IASTName delegate; - - protected IBinding binding; - - protected ASTDelegatedName(IASTName delegate) { - this.delegate = delegate; - } - - @Override - public IASTTranslationUnit getTranslationUnit() { - return delegate.getTranslationUnit(); - } - - @Override - public IASTNodeLocation[] getNodeLocations() { - return delegate.getNodeLocations(); - } - - @Override - public IASTFileLocation getFileLocation() { - return delegate.getFileLocation(); - } - - @Override - public String getContainingFilename() { - return delegate.getContainingFilename(); - } - - @Override - public boolean isPartOfTranslationUnitFile() { - return delegate.isPartOfTranslationUnitFile(); - } - - @Override - public IASTNode getParent() { - return delegate.getParent(); - } - - @Override - public IASTNode[] getChildren() { - return delegate.getChildren(); - } - - @Override - public void setParent(IASTNode node) { - delegate.setParent(node); - } - - @Override - public ASTNodeProperty getPropertyInParent() { - return delegate.getPropertyInParent(); - } - - @Override - public void setPropertyInParent(ASTNodeProperty property) { - delegate.setPropertyInParent(property); - } - - @Override - public boolean accept(ASTVisitor visitor) { - return delegate.accept(visitor); - } - - @Override - public String getRawSignature() { - return delegate.getRawSignature(); - } - - @Override - public boolean contains(IASTNode node) { - return delegate.contains(node); - } - - @Override - public IToken getLeadingSyntax() throws ExpansionOverlapsBoundaryException, UnsupportedOperationException { - return delegate.getLeadingSyntax(); - } - - @Override - public IToken getTrailingSyntax() throws ExpansionOverlapsBoundaryException, UnsupportedOperationException { - return delegate.getTrailingSyntax(); - } - - @Override - public IToken getSyntax() throws ExpansionOverlapsBoundaryException { - return delegate.getSyntax(); - } - - @Override - public boolean isFrozen() { - return delegate.isFrozen(); - } - - @Override - public boolean isActive() { - return delegate.isActive(); - } - - @Override - public IASTNode getOriginalNode() { - return delegate.getOriginalNode(); - } - - @Override - public boolean isDeclaration() { - return delegate.isDeclaration(); - } - - @Override - public boolean isReference() { - return delegate.isReference(); - } - - @Override - public boolean isDefinition() { - return delegate.isDefinition(); - } - - @Override - public char[] getSimpleID() { - return delegate.getSimpleID(); - } - - @Override - public char[] toCharArray() { - return getSimpleID(); - } - - @Override - public char[] getLookupKey() { - return getSimpleID(); - } - - @Override - public IBinding getBinding() { - return binding; - } - - @Override - public IBinding resolveBinding() { - return null; - } - - @Override - public int getRoleOfName(boolean allowResolution) { - return delegate.getRoleOfName(allowResolution); - } - - @Override - public IASTCompletionContext getCompletionContext() { - return delegate.getCompletionContext(); - } - - @Override - public ILinkage getLinkage() { - return delegate.getLinkage(); - } - - @Override - public IASTImageLocation getImageLocation() { - return delegate.getImageLocation(); - } - - @Override - public IASTName getLastName() { - return delegate.getLastName(); - } - - @Override - public IASTName copy() { - return delegate.copy(); - } - - @Override - public IASTName copy(CopyStyle style) { - return delegate.copy(style); - } - - @Override - public void setBinding(IBinding binding) { - this.binding = binding; - } - - @Override - public IBinding getPreBinding() { - return binding; - } - - @Override - public IBinding resolvePreBinding() { - return resolveBinding(); - } - - @Override - public boolean isQualified() { - return delegate.isQualified(); - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/ASTNameReference.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/ASTNameReference.java deleted file mode 100644 index a511194017d..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/ASTNameReference.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2013, 2014 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import org.eclipse.cdt.core.dom.ast.IASTFileLocation; -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.cdt.core.dom.ast.IASTNameOwner; -import org.eclipse.cdt.core.dom.ast.IBinding; -import org.eclipse.cdt.core.index.IIndexName; -import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding; -import org.eclipse.cdt.internal.core.index.IIndexFragmentName; -import org.eclipse.cdt.internal.core.pdom.dom.IPDOMIterator; -import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; -import org.eclipse.cdt.internal.core.pdom.dom.PDOMName; -import org.eclipse.core.runtime.CoreException; - -/** - * Some Qt elements are introduced with empty macro expansions. The Qt linkage handles this - * by creating a new name and then adding it as a reference to the C++ language element. - * This utility helps by containing that C++ name and the location of the Qt name. - */ -@SuppressWarnings("restriction") -public class ASTNameReference extends ASTDelegatedName { - - private final IASTFileLocation location; - - /** - * Create and return a name that will reference the given name. - */ - public ASTNameReference(IASTName name) { - super(name); - this.location = name.getFileLocation(); - } - - /** - * Create and return a name that will reference the given name from the given location. - */ - public ASTNameReference(IASTName name, IASTFileLocation location) { - super(name); - this.location = location; - } - - /** - * Find and return the Qt binding that annotates the given PDOMBinding. E.g., if the input binding - * is an instance of PDOMCPPClassType, then this method will return the QtPDOMQObject that was created - * from that class (or null if there is no such Qt element). - *

- * This is implemented by creating an ASTNameReference within the Qt element binding's definition. That - * name is added as reference from the C++ PDOM binding. - */ - public static T findFromBinding(Class cls, PDOMBinding binding) throws CoreException { - if (binding == null) - return null; - - // Look for external references to the binding. - IPDOMIterator pdomIterator = binding.getExternalReferences(); - while (pdomIterator.hasNext()) { - PDOMName extRef = pdomIterator.next(); - IIndexName caller = extRef.getEnclosingDefinition(); - if (caller instanceof IIndexFragmentName) { - IIndexFragmentBinding extRefBinding = ((IIndexFragmentName) caller).getBinding(); - if (cls.isAssignableFrom(extRefBinding.getClass())) - return cls.cast(extRefBinding); - } - } - - return null; - } - - @Override - public IBinding resolveBinding() { - if (binding == null) - binding = delegate.resolveBinding(); - return binding; - } - - @Override - public IASTFileLocation getFileLocation() { - return location; - } - - @Override - public boolean isReference() { - return true; - } - - @Override - public boolean isDefinition() { - return false; - } - - @Override - public boolean isDeclaration() { - return false; - } - - @Override - public int getRoleOfName(boolean allowResolution) { - return IASTNameOwner.r_reference; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/AbstractQClassName.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/AbstractQClassName.java deleted file mode 100644 index cdc9d3a54f8..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/AbstractQClassName.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2014 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import org.eclipse.cdt.core.dom.ILinkage; -import org.eclipse.cdt.core.dom.ast.ASTNodeProperty; -import org.eclipse.cdt.core.dom.ast.ASTVisitor; -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.cdt.core.dom.ast.IASTNode; -import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier; -import org.eclipse.cdt.internal.core.dom.Linkage; -import org.eclipse.core.runtime.CoreException; - -/** - * Qt provides two types of annotations for C++ classes (Q_GADGET and Q_OBJECT). This - * class. This class is used to store the common parts of these Qt classes to the - * Qt linkage. - */ -@SuppressWarnings("restriction") -public abstract class AbstractQClassName extends ASTDelegatedName implements IQtASTName { - - private final ICPPASTCompositeTypeSpecifier spec; - - private IASTNode parent; - private ASTNodeProperty propertyInParent; - - public AbstractQClassName(ICPPASTCompositeTypeSpecifier spec) { - super(spec.getName()); - this.spec = spec; - this.parent = delegate.getParent(); - this.propertyInParent = delegate.getPropertyInParent(); - } - - protected abstract QtPDOMBinding createPDOMBinding(QtPDOMLinkage linkage, IASTName name) throws CoreException; - - protected abstract IASTName copy(CopyStyle style, ICPPASTCompositeTypeSpecifier spec); - - @Override - public QtPDOMBinding createPDOMBinding(QtPDOMLinkage linkage) throws CoreException { - return createPDOMBinding(linkage, spec.getName()); - } - - @Override - public IASTTranslationUnit getTranslationUnit() { - return spec.getTranslationUnit(); - } - - @Override - public IASTNode[] getChildren() { - return IASTNode.EMPTY_NODE_ARRAY; - } - - @Override - public IASTNode getParent() { - return parent; - } - - @Override - public void setParent(IASTNode node) { - parent = node; - } - - @Override - public ASTNodeProperty getPropertyInParent() { - return propertyInParent; - } - - @Override - public void setPropertyInParent(ASTNodeProperty property) { - propertyInParent = property; - } - - @Override - public boolean accept(ASTVisitor visitor) { - return false; - } - - @Override - public boolean contains(IASTNode node) { - return false; - } - - @Override - public ILinkage getLinkage() { - return Linkage.QT_LINKAGE; - } - - @Override - public IASTName copy() { - return copy(CopyStyle.withoutLocations); - } - - @Override - public IASTName copy(CopyStyle style) { - return copy(style, spec); - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/AbstractQObjectMemberName.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/AbstractQObjectMemberName.java deleted file mode 100644 index 9af3447d08b..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/AbstractQObjectMemberName.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2013, 2014 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import org.eclipse.cdt.core.dom.ILinkage; -import org.eclipse.cdt.core.dom.ast.ASTNodeProperty; -import org.eclipse.cdt.core.dom.ast.IASTFileLocation; -import org.eclipse.cdt.core.dom.ast.IASTImageLocation; -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.cdt.core.dom.ast.IASTNameOwner; -import org.eclipse.cdt.core.dom.ast.IASTNode; -import org.eclipse.cdt.internal.core.dom.Linkage; -import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; -import org.eclipse.core.runtime.CoreException; - -@SuppressWarnings("restriction") -public abstract class AbstractQObjectMemberName extends ASTDelegatedName { - - private final IQtASTName owner; - private final String name; - private final IASTImageLocation location; - private ASTNodeProperty propertyInParent; - - protected AbstractQObjectMemberName(IQtASTName owner, IASTName ast, String name, IASTImageLocation location) { - super(ast); - this.owner = owner; - this.name = name; - this.location = location; - } - - protected PDOMBinding getOwner(QtPDOMLinkage linkage) throws CoreException { - return linkage.getBinding(owner); - } - - public String getFieldName() { - return name; - } - - @Override - public IASTFileLocation getFileLocation() { - return location; - } - - @Override - public IASTNode getParent() { - return owner; - } - - @Override - public IASTNode[] getChildren() { - return IASTNode.EMPTY_NODE_ARRAY; - } - - @Override - public void setParent(IASTNode node) { - throw new IllegalStateException("attempt to modify parent of QObject field"); //$NON-NLS-1$ - } - - @Override - public ASTNodeProperty getPropertyInParent() { - return propertyInParent; - } - - @Override - public void setPropertyInParent(ASTNodeProperty property) { - propertyInParent = property; - } - - @Override - public char[] getSimpleID() { - return name.toCharArray(); - } - - @Override - public String getRawSignature() { - return name; - } - - @Override - public boolean isDeclaration() { - return false; - } - - @Override - public boolean isReference() { - return false; - } - - @Override - public boolean isDefinition() { - return true; - } - - @Override - public int getRoleOfName(boolean allowResolution) { - return IASTNameOwner.r_definition; - } - - @Override - public ILinkage getLinkage() { - return Linkage.QT_LINKAGE; - } - - @Override - public IASTImageLocation getImageLocation() { - return location; - } - - @Override - public IASTName copy() { - return copy(CopyStyle.withoutLocations); - } - - @Override - public IASTName copy(CopyStyle style) { - throw new UnsupportedOperationException("attempt to copy QObject field"); //$NON-NLS-1$ - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/AbstractQtPDOMClass.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/AbstractQtPDOMClass.java deleted file mode 100644 index 8900d6b4a46..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/AbstractQtPDOMClass.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2014, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.cdt.core.dom.ILinkage; -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.cdt.core.dom.ast.IBinding; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; -import org.eclipse.cdt.internal.core.pdom.db.Database; -import org.eclipse.cdt.internal.core.pdom.db.PDOMNodeLinkedList; -import org.eclipse.cdt.internal.core.pdom.dom.IPDOMBinding; -import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; -import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage; -import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode; -import org.eclipse.cdt.internal.qt.core.Activator; -import org.eclipse.core.runtime.CoreException; - -/** - * Qt has two types of annotation that can be applied to classes (Q_GADGET and G_OBJECT). - * This class stores the information that is common to each. - */ -@SuppressWarnings("restriction") -public abstract class AbstractQtPDOMClass extends QtPDOMBinding { - - private static int offsetInitializer = QtPDOMBinding.Field.Last.offset; - - protected static enum Field { - CppRecord(Database.PTR_SIZE), Children(4 /* From PDOMNodeLinkedList.RECORD_SIZE, which is protected */), - Last(0); - - public final int offset; - - private Field(int sizeof) { - this.offset = offsetInitializer; - offsetInitializer += sizeof; - } - - public long getRecord(long baseRec) { - return baseRec + offset; - } - } - - private final PDOMNodeLinkedList children; - - protected AbstractQtPDOMClass(QtPDOMLinkage linkage, long record) throws CoreException { - super(linkage, record); - children = new PDOMNodeLinkedList(linkage, Field.Children.getRecord(record)); - } - - public AbstractQtPDOMClass(QtPDOMLinkage linkage, IASTName qtName, IASTName cppName) throws CoreException { - super(linkage, null, qtName); - - IBinding cppBinding = getPDOM().findBinding(cppName); - if (cppBinding != null) { - IPDOMBinding cppPDOMBinding = cppBinding.getAdapter(IPDOMBinding.class); - if (cppPDOMBinding != null) { - if (cppPDOMBinding.getLinkage() != null - && cppPDOMBinding.getLinkage().getLinkageID() == ILinkage.CPP_LINKAGE_ID) - getDB().putRecPtr(Field.CppRecord.getRecord(record), cppPDOMBinding.getRecord()); - } - } - - children = new PDOMNodeLinkedList(linkage, Field.Children.getRecord(record)); - } - - public ICPPClassType getCppClassType() throws CoreException { - long cppRec = getDB().getRecPtr(Field.CppRecord.getRecord(record)); - if (cppRec == 0) - return null; - - PDOMLinkage cppLinkage = getPDOM().getLinkage(ILinkage.CPP_LINKAGE_ID); - if (cppLinkage == null) - return null; - - PDOMBinding cppBinding = cppLinkage.getBinding(cppRec); - return cppBinding instanceof ICPPClassType ? (ICPPClassType) cppBinding : null; - } - - @Override - protected int getRecordSize() { - return Field.Last.offset; - } - - // This forwarding method is to get rid of compilation warnings when clients try to call - // #getName on the non-accessible parent. - @Override - public String getName() { - return super.getName(); - } - - @Override - public void addChild(PDOMNode child) throws CoreException { - children.addMember(child); - } - - public List getChildren(Class cls) throws CoreException { - QtPDOMVisitor.All collector = new QtPDOMVisitor.All<>(cls); - try { - children.accept(collector); - } catch (CoreException e) { - Activator.log(e); - return Collections.emptyList(); - } - - return collector.list; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/IQtASTName.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/IQtASTName.java deleted file mode 100644 index 338b9944c65..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/IQtASTName.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2013 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.core.runtime.CoreException; - -public interface IQtASTName extends IASTName { - /** - * Create and return a new instance of PDOMBinding for the receiver. The implementation - * is allowed to return null if there is no possibility of creating a PDOMBinding. - * The value that is returned must be consistent -- if null is returned one time then - * it must be returned every time. - */ - public QtPDOMBinding createPDOMBinding(QtPDOMLinkage linkage) throws CoreException; -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/IQtPDOMCodec.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/IQtPDOMCodec.java deleted file mode 100644 index 3b5e7690ec8..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/IQtPDOMCodec.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2013 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import org.eclipse.core.runtime.CoreException; - -/** - * A utility interface for encoding and decoding fixed-sized elements to and - * from the Database. - */ -public interface IQtPDOMCodec { - /** - * Return the number of bytes needed to store a single element. - */ - public int getElementSize(); - - /** - * Allocate and return a new array to hold the specified number of elements. - */ - public T[] allocArray(int count); - - /** - * Examine the database at the specified record to decode an element instance. - */ - public T decode(QtPDOMLinkage linkage, long record) throws CoreException; - - /** - * Encode the given element into the database at the specified record. The codec is - * responsible for releasing storage that is about to be overwritten (if needed). - * The element will be null when the implementation should delete all memory used - * for storage at record. - */ - public void encode(QtPDOMLinkage linkage, long record, T element) throws CoreException; -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/PDOMQtLinkageFactory.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/PDOMQtLinkageFactory.java deleted file mode 100644 index c195958dcb5..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/PDOMQtLinkageFactory.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import org.eclipse.cdt.internal.core.pdom.PDOM; -import org.eclipse.cdt.internal.core.pdom.dom.IPDOMLinkageFactory; -import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage; -import org.eclipse.cdt.internal.qt.core.Activator; -import org.eclipse.core.runtime.CoreException; - -@SuppressWarnings("restriction") -public class PDOMQtLinkageFactory implements IPDOMLinkageFactory { - - @Override - public PDOMLinkage getLinkage(PDOM pdom, long record) { - try { - return new QtPDOMLinkage(pdom, record); - } catch (CoreException e) { - Activator.log(e); - } - return null; - } - - @Override - public PDOMLinkage createLinkage(PDOM pdom) throws CoreException { - return new QtPDOMLinkage(pdom); - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QGadgetName.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QGadgetName.java deleted file mode 100644 index 4278585392f..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QGadgetName.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2014 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier; -import org.eclipse.core.runtime.CoreException; - -/** - * QGadgets are C++ classes that have been annotated with Qt marker macros. This class is - * used to introduce the QGadget to the Qt linkage. The only feature of Q_GADGET is the - * ability to host Q_ENUMs. - */ -public class QGadgetName extends AbstractQClassName { - - public QGadgetName(ICPPASTCompositeTypeSpecifier spec) { - super(spec); - } - - @Override - protected QtPDOMBinding createPDOMBinding(QtPDOMLinkage linkage, IASTName name) throws CoreException { - return new QtPDOMQGadget(linkage, this, name); - } - - @Override - protected IASTName copy(CopyStyle style, ICPPASTCompositeTypeSpecifier spec) { - return new QGadgetName(spec); - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QMethodName.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QMethodName.java deleted file mode 100644 index f0f6529901d..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QMethodName.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.cdt.internal.qt.core.index.IQMethod; -import org.eclipse.core.runtime.CoreException; - -public class QMethodName extends AbstractQObjectMemberName implements IQtASTName { - - private final IQMethod.Kind kind; - private final String qtEncSignatures; - private final Long revision; - - public QMethodName(QObjectName qobjName, IASTName cppName, IQMethod.Kind kind, String qtEncSignatures, - Long revision) { - super(qobjName, cppName, cppName.getLastName().toString(), cppName.getImageLocation()); - this.kind = kind; - this.qtEncSignatures = qtEncSignatures; - this.revision = revision; - } - - @Override - public QtPDOMBinding createPDOMBinding(QtPDOMLinkage linkage) throws CoreException { - return new QtPDOMQMethod(linkage, getOwner(linkage), this, delegate, kind, qtEncSignatures, revision); - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QObjectName.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QObjectName.java deleted file mode 100644 index 0c707c535e1..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QObjectName.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2013, 2014 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier; -import org.eclipse.cdt.internal.qt.core.ASTUtil; -import org.eclipse.core.runtime.CoreException; - -/** - * QObjects are C++ classes that have been annotated with Qt marker macros. This class is - * used to introduce the QObject to the Qt linkage. - */ -public class QObjectName extends AbstractQClassName { - - private final char[] fullyQualifiedName; - private final List properties = new ArrayList<>(); - private final Map classInfos = new LinkedHashMap<>(); - - public QObjectName(ICPPASTCompositeTypeSpecifier spec) { - super(spec); - - String fqn = ASTUtil.getFullyQualifiedName(spec.getName()); - fullyQualifiedName = fqn == null ? new char[0] : fqn.toCharArray(); - } - - @Override - public char[] getSimpleID() { - // The Qt linkage uses the full qualified name when storing QObjects into the index. - return fullyQualifiedName; - } - - public List getProperties() { - return properties; - } - - public void addProperty(QtPropertyName property) { - properties.add(property); - } - - public Map getClassInfos() { - return classInfos; - } - - public String addClassInfo(String key, String value) { - return classInfos.put(key, value); - } - - @Override - protected QtPDOMBinding createPDOMBinding(QtPDOMLinkage linkage, IASTName name) throws CoreException { - return new QtPDOMQObject(linkage, this, name); - } - - @Override - protected IASTName copy(CopyStyle style, ICPPASTCompositeTypeSpecifier spec) { - return new QObjectName(spec); - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QmlTypeRegistration.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QmlTypeRegistration.java deleted file mode 100644 index 2c7409102ad..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QmlTypeRegistration.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 2014, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import org.eclipse.cdt.core.dom.ast.ASTTypeUtil; -import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression; -import org.eclipse.cdt.core.dom.ast.IASTInitializerClause; -import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression; -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.cdt.core.dom.ast.IType; -import org.eclipse.cdt.core.dom.ast.IValue; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance; -import org.eclipse.cdt.internal.qt.core.ASTUtil; -import org.eclipse.cdt.internal.qt.core.QtKeywords; -import org.eclipse.cdt.internal.qt.core.index.IQmlRegistration; -import org.eclipse.core.runtime.CoreException; - -public class QmlTypeRegistration extends ASTDelegatedName implements IQtASTName { - - private final ICPPTemplateInstance functionInstanceBinding; - private final IASTFunctionCallExpression fnCall; - private final IQmlRegistration.Kind kind; - private char[] simpleID; - - public QmlTypeRegistration(IASTName ast, ICPPTemplateInstance functionInstanceBinding, - IASTFunctionCallExpression fnCall) { - super(ast); - this.functionInstanceBinding = functionInstanceBinding; - this.fnCall = fnCall; - - if (QtKeywords.QML_REGISTER_UNCREATABLE_TYPE.equals(functionInstanceBinding.getName())) - this.kind = IQmlRegistration.Kind.Uncreatable; - else - this.kind = IQmlRegistration.Kind.Type; - } - - @Override - public char[] getSimpleID() { - if (simpleID == null) { - IASTInitializerClause[] args = fnCall.getArguments(); - simpleID = (functionInstanceBinding.getName() - + ASTTypeUtil.getArgumentListString(functionInstanceBinding.getTemplateArguments(), true) + "\0(" //$NON-NLS-1$ - + asStringForName(args, 0) + ',' + asStringForName(args, 1) + ',' + asStringForName(args, 2) + ',' - + asStringForName(args, 3) + ')').toCharArray(); - } - - return simpleID; - } - - @Override - public QtPDOMBinding createPDOMBinding(QtPDOMLinkage linkage) throws CoreException { - switch (kind) { - case Type: - return new QtPDOMQmlRegistration(linkage, this, delegate); - case Uncreatable: - return new QtPDOMQmlUncreatable(linkage, this, delegate); - } - return null; - } - - public String getQObjectName() { - ICPPTemplateArgument[] args = functionInstanceBinding.getTemplateArguments(); - if (args.length < 1) - return null; - - IType type = args[0].getTypeValue(); - return type instanceof ICPPBinding ? ASTUtil.getFullyQualifiedName((ICPPBinding) type) : null; - } - - public Long getVersion() { - ICPPTemplateArgument[] args = functionInstanceBinding.getTemplateArguments(); - if (args.length < 2) - return null; - - IValue val = args[1].getNonTypeValue(); - return val == null ? null : val.numberValue().longValue(); - } - - public String getUri() { - return getArgAsStringOrNull(0); - } - - public Long getMajor() { - return getArgAsLongOrNull(1); - } - - public Long getMinor() { - return getArgAsLongOrNull(2); - } - - public String getQmlName() { - return getArgAsStringOrNull(3); - } - - public String getReason() { - return getArgAsStringOrNull(4); - } - - private String asStringForName(IASTInitializerClause[] args, int index) { - String arg = args.length <= index ? null : asString(args[index]); - return arg == null ? "" : arg; //$NON-NLS-1$ - } - - private String getArgAsStringOrNull(int index) { - IASTInitializerClause[] args = fnCall.getArguments(); - if (args.length <= index) - return null; - - return asString(args[index]); - } - - private Long getArgAsLongOrNull(int index) { - IASTInitializerClause[] args = fnCall.getArguments(); - if (args.length <= index) - return null; - - String str = asString(args[index]); - if (str != null) - try { - return Long.parseLong(str); - } catch (NumberFormatException e) { - // This is caused by invalid user code, do not log it - } - - return null; - } - - private static String asString(IASTInitializerClause init) { - if (init instanceof IASTLiteralExpression) { - IASTLiteralExpression literal = (IASTLiteralExpression) init; - switch (literal.getKind()) { - case IASTLiteralExpression.lk_integer_constant: - return new String(literal.getValue()); - case IASTLiteralExpression.lk_string_literal: - char[] value = literal.getValue(); - return new String(value, 1, value.length - 2); - } - } - return null; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtASTClass.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtASTClass.java deleted file mode 100644 index 78a02a7328a..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtASTClass.java +++ /dev/null @@ -1,380 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.eclipse.cdt.core.dom.ast.IASTDeclaration; -import org.eclipse.cdt.core.dom.ast.IASTFileLocation; -import org.eclipse.cdt.core.dom.ast.IASTMacroExpansionLocation; -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.cdt.core.dom.ast.IASTNodeLocation; -import org.eclipse.cdt.core.dom.ast.IASTPreprocessorMacroExpansion; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisibilityLabel; -import org.eclipse.cdt.internal.qt.core.QtKeywords; -import org.eclipse.cdt.internal.qt.core.index.IQMethod; - -/** - * The AST for a QObject is separated into regions based on macro expansions. These - * regions determine the Qt kind for methods that are declared within them. - *

- * This utility class makes one pass over the C++ class specification to identify - * all such regions. It also provides an iterator that can be used while examining - * the class spec's members. - */ -public class QtASTClass { - - private final Iterator regions; - private final Iterator tags; - private final Iterator revisions; - private Region region; - private Tag tag; - private Revision revision; - - /** - * Must only be called with increasing offset. Internal pointers may be advanced on - * each call. - */ - public IQMethod.Kind getKindFor(int offset) { - - // There are 3 steps: - // 1) The tags counter must always be advanced. Tags only apply to the next declaration - // and therefore the internal counter must always be advanced. Multiple tags are - // collapsed to find the highest precedence value. - // 2) The region counter is advanced to find a region that either contains the offset - // or is the first region after the offset. Regions override tags, so we use the - // region kind if one is found. - // 3) The final result is based on tags (if they were present). - // - // This precedence is based on experimentation with the moc (ver 63). It - // ignores macros tagging a single method when that method is declared within - // a signal/slot region. E.g., the following example has two signals and one slot: - // - // class Q : public QObject - // { - // Q_OBJECT - // signals: void signal1(); - // Q_SLOT void signal2(); /* Tagged with Q_SLOT, but the declaration is within the - // * signals region, so the moc considers it a signal. */ - // public: - // Q_SLOT void slot1(); - // }; - - // Consume all tags since the last declaration to find the highest precedence tag. - IQMethod.Kind kind = IQMethod.Kind.Unspecified; - while (tag != null && tag.offset < offset) { - kind = getHigherPrecedence(kind, tag.kind); - tag = tags.hasNext() ? tags.next() : null; - } - - // Advance regions to find one that does not end before this offset. - while (region != null && region.end < offset) - region = regions.hasNext() ? regions.next() : null; - - // If the offset is within this region, then use its kind. - if (region != null && region.contains(offset)) - kind = region.kind; - - return kind; - } - - /** - * Must only be called with increasing offset. Internal pointers may be advanced on - * each call. - */ - public Long getRevisionFor(int offset) { - - // Consume all revisions since the last declaration to find one (if any) that applies - // to this declaration. - Long rev = null; - while (revision != null && revision.offset < offset) { - rev = revision.revision; - revision = revisions.hasNext() ? revisions.next() : null; - } - - return rev; - } - - private static IQMethod.Kind getHigherPrecedence(IQMethod.Kind kind1, IQMethod.Kind kind2) { - switch (kind1) { - case Unspecified: - return kind2; - case Invokable: - switch (kind2) { - case Slot: - case Signal: - return kind2; - default: - return kind1; - } - case Signal: - if (kind2 == IQMethod.Kind.Slot) - return kind2; - return kind2; - case Slot: - return kind1; - } - return IQMethod.Kind.Unspecified; - } - - public static QtASTClass create(ICPPASTCompositeTypeSpecifier spec) { - - // There is more detail in Bug 401696 describing why this needs to look at all - // the node locations. Briefly, the CDT parser does not associate empty macros - // with the function when they are the first thing in the declaration. E.g., - // - // #define X - // void func1() {} - // X void func2() {} - // - // Could also look like: - // void func1() {} X - // void func2() {} - // - // The nodes are processed in three stages which are described in detail below. Only - // the first stage looks at the nodes, the later stages just cleanup results from the - // first walk over all node locations. - - // 1) Examine the locations to find all macro expansions. This finds a beginning and - // highest possible end for the regions. It also locates the offset for single-method - // tags (including resolving precedence). - // This allows single-method tags to overlap regions because regions may be shortened - // by a later step. - ArrayList tags = new ArrayList<>(); - ArrayList revisions = new ArrayList<>(); - ArrayList regions = new ArrayList<>(); - Region currRegion = null; - for (IASTNodeLocation location : spec.getNodeLocations()) { - - Tag tag = Tag.create(location); - if (tag != null) - tags.add(tag); - - Revision revision = Revision.create(location); - if (revision != null) - revisions.add(revision); - - Region region = Region.create(location); - if (region != null) { - if (currRegion != null) - currRegion.end = region.begin; - - currRegion = region; - regions.add(region); - } - } - - // 2) Make the regions smaller where visibility labels are introduced. - if (!regions.isEmpty()) { - Iterator iterator = regions.iterator(); - Region region = iterator.next(); - for (IASTDeclaration decl : spec.getMembers()) { - - // Ignore everything other than visibility labels. - if (!(decl instanceof ICPPASTVisibilityLabel)) - continue; - - int offset = decl.getFileLocation().getNodeOffset(); - - // Otherwise terminate all regions that start before this label and advance - // to the first one that follows. - while (region != null && region.begin < offset) { - region.end = offset; - region = iterator.hasNext() ? iterator.next() : null; - } - - // Stop searching for visibility labels after the last region has been terminated. - if (region == null) - break; - } - } - - // 3) Eliminate tags that are within regions. - if (!tags.isEmpty()) { - Iterator iterator = tags.iterator(); - Tag tag = iterator.next(); - for (Region region : regions) { - - // Keep all tags that are before the start of this region. - while (tag != null && tag.offset < region.begin) - tag = iterator.hasNext() ? iterator.next() : null; - - // Delete all tags that are within this region. - while (tag != null && region.contains(tag.offset)) { - iterator.remove(); - tag = iterator.hasNext() ? iterator.next() : null; - } - - // Stop searching when there are no more tags to be examined. - if (tag == null) - break; - } - } - - return new QtASTClass(regions, tags, revisions); - } - - private QtASTClass(List regions, List tags, List revisions) { - this.regions = regions.iterator(); - this.tags = tags.iterator(); - this.revisions = revisions.iterator(); - - this.region = this.regions.hasNext() ? this.regions.next() : null; - this.tag = this.tags.hasNext() ? this.tags.next() : null; - this.revision = this.revisions.hasNext() ? this.revisions.next() : null; - } - - private static class Region { - public final int begin; - public int end = Integer.MAX_VALUE; - public final IQMethod.Kind kind; - - public Region(int begin, IQMethod.Kind kind) { - this.begin = begin; - this.kind = kind; - } - - public boolean contains(int offset) { - return offset >= begin && offset < end; - } - - /** - * Return a region for the given location or null if the location does not - * introduce a region. - */ - public static Region create(IASTNodeLocation location) { - if (!(location instanceof IASTMacroExpansionLocation)) - return null; - - IASTMacroExpansionLocation macroLocation = (IASTMacroExpansionLocation) location; - IASTFileLocation fileLocation = macroLocation.asFileLocation(); - if (fileLocation == null) - return null; - - int offset = fileLocation.getNodeOffset(); - IASTPreprocessorMacroExpansion expansion = macroLocation.getExpansion(); - String macroName = getMacroName(expansion); - if (QtKeywords.Q_SLOTS.equals(macroName) || QtKeywords.SLOTS.equals(macroName)) - return new Region(offset, IQMethod.Kind.Slot); - if (QtKeywords.Q_SIGNALS.equals(macroName) || QtKeywords.SIGNALS.equals(macroName)) - return new Region(offset, IQMethod.Kind.Signal); - return null; - } - } - - private static class Tag { - public final int offset; - public IQMethod.Kind kind; - - private Tag(int begin, IQMethod.Kind kind) { - this.offset = begin; - this.kind = kind; - } - - /** - * Return a tag for the given location or null if the location does not - * introduce a tag. - */ - public static Tag create(IASTNodeLocation location) { - if (!(location instanceof IASTMacroExpansionLocation)) - return null; - - IASTMacroExpansionLocation macroLocation = (IASTMacroExpansionLocation) location; - IASTFileLocation fileLocation = macroLocation.asFileLocation(); - if (fileLocation == null) - return null; - - int offset = fileLocation.getNodeOffset(); - IASTPreprocessorMacroExpansion expansion = macroLocation.getExpansion(); - String macroName = getMacroName(expansion); - if (QtKeywords.Q_SLOT.equals(macroName)) - return new Tag(offset, IQMethod.Kind.Slot); - if (QtKeywords.Q_SIGNAL.equals(macroName)) - return new Tag(offset, IQMethod.Kind.Signal); - if (QtKeywords.Q_INVOKABLE.equals(macroName)) - return new Tag(offset, IQMethod.Kind.Invokable); - return null; - } - } - - private static class Revision { - private final int offset; - private final Long revision; - - // This regular expression matches Q_REVISION macro expansions. It allows C++ integer - // literals as the expansion parameter. The integer literal is provided in capture - // group 1. Hexadecimal and octal prefixes are included in the capture group. Unsigned - // and long suffixes are allowed but are excluded from the capture group. The matcher's - // input string should be trimmed and have all newlines replaced. - private static final Pattern QREVISION_REGEX = Pattern - .compile("^Q_REVISION\\s*\\(\\s*((?:0x)?[\\da-fA-F]+)[ulUL]*\\s*\\)$"); //$NON-NLS-1$ - - public Revision(int offset, Long revision) { - this.offset = offset; - this.revision = revision; - } - - /** - * Return a tag for the given location or null if the location does not - * introduce a tag. - */ - public static Revision create(IASTNodeLocation location) { - if (!(location instanceof IASTMacroExpansionLocation)) - return null; - - IASTMacroExpansionLocation macroLocation = (IASTMacroExpansionLocation) location; - IASTFileLocation fileLocation = macroLocation.asFileLocation(); - if (fileLocation == null) - return null; - - int offset = fileLocation.getNodeOffset(); - IASTPreprocessorMacroExpansion expansion = macroLocation.getExpansion(); - String macroName = getMacroName(expansion); - if (!QtKeywords.Q_REVISION.equals(macroName)) - return null; - - String raw = expansion.getRawSignature(); - if (raw == null) - return null; - - // Trim leading and trailing whitespace and remove all newlines. - Matcher m = QREVISION_REGEX.matcher(raw.trim().replaceAll("\\s+", "")); //$NON-NLS-1$ //$NON-NLS-2$ - if (m.matches()) { - try { - return new Revision(offset, Long.parseLong(m.group(1))); - } catch (NumberFormatException e) { - // The number will be parsed incorrectly when the C++ client code does not - // contain a valid integer. We can't do anything about that, so the exception - // is ignored. A codan checker could notify the user of this problem. - } - } - - return null; - } - } - - /** - * Find and return the simple name of the macro that is being expanded or null if the name - * cannot be found. - */ - private static String getMacroName(IASTPreprocessorMacroExpansion expansion) { - if (expansion == null) - return null; - - IASTName name = expansion.getMacroReference(); - return name == null ? null : name.toString(); - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtASTImageLocation.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtASTImageLocation.java deleted file mode 100644 index facb5d10140..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtASTImageLocation.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2013 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import org.eclipse.cdt.core.dom.ast.IASTFileLocation; -import org.eclipse.cdt.core.dom.ast.IASTImageLocation; -import org.eclipse.cdt.core.dom.ast.IASTPreprocessorIncludeStatement; - -/** - * The location of the signal/slot reference is stored as the location of the parent - * macro expansion + an offset, which is the number of characters between the start - * of the expansion and the start of the argument (including whitespace). E.g. in, - * - *

- * MACRO( expansionParameter )
- * ^      ^                ^ c: end of reference name
- * |      +----------------- b: start of reference name
- * +------------------------ a: start of macro expansion
- * 
- * - * The offset is b - a and length is c - b. This means that the result of 'Find - * References' will highlight just "parameter". - */ -public class QtASTImageLocation implements IASTImageLocation { - - private final IASTFileLocation refLocation; - private final int offset; - private final int length; - - public QtASTImageLocation(IASTFileLocation refLocation, int offset, int length) { - this.refLocation = refLocation; - this.offset = offset; - this.length = length; - } - - public int getOffset() { - return offset; - } - - public int getLength() { - return length; - } - - @Override - public IASTFileLocation asFileLocation() { - return this; - } - - @Override - public String getFileName() { - return refLocation.getFileName(); - } - - @Override - public int getNodeOffset() { - return refLocation.getNodeOffset() + offset; - } - - @Override - public int getNodeLength() { - return length; - } - - @Override - public int getStartingLineNumber() { - return refLocation.getStartingLineNumber(); - } - - @Override - public int getEndingLineNumber() { - return refLocation.getEndingLineNumber(); - } - - @Override - public IASTPreprocessorIncludeStatement getContextInclusionStatement() { - return refLocation.getContextInclusionStatement(); - } - - @Override - public int getLocationKind() { - return REGULAR_CODE; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtASTVisitor.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtASTVisitor.java deleted file mode 100644 index 05a898d93d6..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtASTVisitor.java +++ /dev/null @@ -1,534 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.eclipse.cdt.core.dom.ast.ASTVisitor; -import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier; -import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier; -import org.eclipse.cdt.core.dom.ast.IASTDeclaration; -import org.eclipse.cdt.core.dom.ast.IASTDeclarator; -import org.eclipse.cdt.core.dom.ast.IASTExpression; -import org.eclipse.cdt.core.dom.ast.IASTFileLocation; -import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression; -import org.eclipse.cdt.core.dom.ast.IASTIdExpression; -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.cdt.core.dom.ast.IASTNode; -import org.eclipse.cdt.core.dom.ast.IASTPreprocessorIncludeStatement; -import org.eclipse.cdt.core.dom.ast.IASTPreprocessorMacroDefinition; -import org.eclipse.cdt.core.dom.ast.IASTPreprocessorMacroExpansion; -import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration; -import org.eclipse.cdt.core.dom.ast.IBinding; -import org.eclipse.cdt.core.dom.ast.IScope; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance; -import org.eclipse.cdt.core.index.IIndexSymbols; -import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding; -import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics; -import org.eclipse.cdt.internal.core.parser.scanner.LocationMap; -import org.eclipse.cdt.internal.qt.core.ASTUtil; -import org.eclipse.cdt.internal.qt.core.QtFunctionCall; -import org.eclipse.cdt.internal.qt.core.QtKeywords; -import org.eclipse.cdt.internal.qt.core.QtMethodReference; -import org.eclipse.cdt.internal.qt.core.QtMethodUtil; -import org.eclipse.cdt.internal.qt.core.index.IQMethod; -import org.eclipse.cdt.internal.qt.core.index.IQProperty; -import org.eclipse.cdt.internal.qt.core.index.QProperty; - -@SuppressWarnings("restriction") -public class QtASTVisitor extends ASTVisitor { - - private final IIndexSymbols symbols; - private final LocationMap locationMap; - - private static final Pattern expansionParamRegex = Pattern.compile("^(?:Q_ENUMS|Q_FLAGS)\\s*\\((.*)\\)$", //$NON-NLS-1$ - Pattern.DOTALL); - private static final Pattern qualNameRegex = Pattern.compile("\\s*((?:[^\\s:]+\\s*::\\s*)*[^\\s:]+).*"); //$NON-NLS-1$ - - private static final Pattern declareFlagsRegex = Pattern - .compile("^Q_DECLARE_FLAGS\\s*\\(\\s*([^\\s]+),\\s*([^\\s]+)\\s*\\)$", Pattern.DOTALL); //$NON-NLS-1$ - - /** - * A regular expression for scanning the Q_CLASSINFO expansion and extracting the - * expansion parameter key and value. It provides the following capture groups: - *
1 - the key - *
2 - the value - *

- * The key must not have embedded quotes. - */ - private static final Pattern classInfoRegex = Pattern - .compile("^Q_CLASSINFO\\s*\\(\\s*\"([^\"]+)\"\\s*,\\s*\"(.*)\"\\s*\\)$", Pattern.DOTALL); //$NON-NLS-1$ - - private static final Pattern leadingWhitespaceRegex = Pattern.compile("^\\s*([^\\s].*)$"); //$NON-NLS-1$ - - private static final Pattern qPropertyRegex = Pattern.compile( - "^Q_PROPERTY\\s*\\(\\s*(.+?)\\s*([a-zA-Z_][\\w]*+)(?:(?:\\s+(READ\\s+.*))|\\s*)\\s*\\)$", Pattern.DOTALL); //$NON-NLS-1$ - - /** - * A regular expression for scanning Q_PROPERTY attributes. The regular expression is built - * from the values defined in IQProperty#Attribute. It looks like: - *

-	 * (:?READ)|(?:WRITE)|(:?RESET)|...
-	 * 
- * This regular expression is used to recognize valid attributes while scanning the - * Q_PROPERTY macro expansion. - * - * @see QProperty#scanAttributes(String) - */ - private static final Pattern qPropertyAttributeRegex; - static { - StringBuilder regexBuilder = new StringBuilder(); - for (IQProperty.Attribute attr : IQProperty.Attribute.values()) { - if (attr.ordinal() > 0) - regexBuilder.append('|'); - regexBuilder.append("(:?"); //$NON-NLS-1$ - regexBuilder.append(attr.identifier); - regexBuilder.append(")"); //$NON-NLS-1$ - } - qPropertyAttributeRegex = Pattern.compile(regexBuilder.toString()); - } - - public QtASTVisitor(IIndexSymbols symbols, LocationMap locationMap) { - shouldVisitDeclSpecifiers = true; - shouldVisitExpressions = true; - - this.symbols = symbols; - this.locationMap = locationMap; - } - - @Override - public int visit(IASTDeclSpecifier declSpec) { - if (declSpec instanceof ICPPASTCompositeTypeSpecifier) { - ICPPASTCompositeTypeSpecifier spec = (ICPPASTCompositeTypeSpecifier) declSpec; - - IASTFileLocation loc = spec.getFileLocation(); - IASTPreprocessorIncludeStatement owner = loc == null ? null : loc.getContextInclusionStatement(); - - IASTPreprocessorMacroExpansion[] expansions = locationMap.getMacroExpansions(loc); - - if (isQObject(spec, expansions)) - handleQObject(owner, spec, expansions); - if (isQGadget(spec, expansions)) - handleQClass(owner, spec, new QGadgetName(spec), expansions); - } - - return super.visit(declSpec); - } - - @Override - public int visit(IASTExpression expr) { - if (expr instanceof IASTFunctionCallExpression) { - IASTFunctionCallExpression call = (IASTFunctionCallExpression) expr; - - // See if this is a QObject::connect or disconnect function call. - Collection refs = QtFunctionCall.getReferences(call); - if (refs != null) - for (IASTName ref : refs) { - IASTFileLocation nameLoc = ref.getFileLocation(); - if (nameLoc != null) { - IASTPreprocessorIncludeStatement owner = nameLoc.getContextInclusionStatement(); - symbols.add(owner, ref, null); - } - } - - // See if this is a qmlRegisterType or qmlRegisterUncreatableType function call. - ICPPTemplateInstance templateFn = ASTUtil.resolveFunctionBinding(ICPPTemplateInstance.class, call); - if (QtKeywords.is_QmlType(templateFn)) { - IASTName fnName = null; - IASTExpression fnNameExpr = call.getFunctionNameExpression(); - if (fnNameExpr instanceof IASTIdExpression) { - fnName = ((IASTIdExpression) fnNameExpr).getName(); - } - IASTFileLocation nameLoc = call.getFileLocation(); - if (nameLoc != null) { - QmlTypeRegistration qmlTypeReg = new QmlTypeRegistration(fnName, templateFn, call); - - IASTPreprocessorIncludeStatement owner = nameLoc.getContextInclusionStatement(); - symbols.add(owner, qmlTypeReg, null); - - // the Qt data references the C++ function template instance specialization - if (fnName != null) - symbols.add(owner, new ASTNameReference(fnName), qmlTypeReg); - } - } - } - - return super.visit(expr); - } - - private boolean isQObject(ICPPASTCompositeTypeSpecifier spec, IASTPreprocessorMacroExpansion[] expansions) { - - // The class definition must contain a Q_OBJECT expansion. - for (IASTPreprocessorMacroExpansion expansion : expansions) { - IASTPreprocessorMacroDefinition macro = expansion.getMacroDefinition(); - if (QtKeywords.Q_OBJECT.equals(String.valueOf(macro.getName()))) - return true; - } - - return false; - } - - private boolean isQGadget(ICPPASTCompositeTypeSpecifier spec, IASTPreprocessorMacroExpansion[] expansions) { - - // The class definition must contain a Q_GADGET expansion. - for (IASTPreprocessorMacroExpansion expansion : expansions) { - IASTPreprocessorMacroDefinition macro = expansion.getMacroDefinition(); - if (QtKeywords.Q_GADGET.equals(String.valueOf(macro.getName()))) - return true; - } - - return false; - } - - private class EnumDecl { - private final String name; - private final boolean isFlag; - private final IASTName refName; - private final QtASTImageLocation location; - - public EnumDecl(String name, boolean isFlag, IASTName refName, int offset, int length) { - this.name = name; - this.isFlag = isFlag; - this.refName = refName; - this.location = new QtASTImageLocation(refName.getFileLocation(), offset, length); - } - - public void handle(IASTPreprocessorIncludeStatement owner, ICPPASTCompositeTypeSpecifier spec, - IQtASTName qobjName, Map aliases) { - - String alias = aliases.get(name); - - IBinding[] bindings = CPPSemantics.findBindingsForQualifiedName(spec.getScope(), - alias == null ? name : alias); - for (IBinding binding : bindings) { - // Create a reference from this Qt name to the target enum's definition. - IASTName cppName = findASTName(binding); - QtEnumName astName = new QtEnumName(qobjName, refName, name, cppName, location, isFlag); - symbols.add(owner, astName, qobjName); - - if (cppName != null) - symbols.add(owner, new ASTNameReference(cppName, location), astName); - } - } - } - - private void handleQObject(IASTPreprocessorIncludeStatement owner, ICPPASTCompositeTypeSpecifier spec, - IASTPreprocessorMacroExpansion[] expansions) { - - // Put the QObject into the symbol map. - QObjectName qobjName = new QObjectName(spec); - handleQClass(owner, spec, qobjName, expansions); - - for (IASTPreprocessorMacroExpansion expansion : expansions) { - - IASTName name = expansion.getMacroReference(); - String macroName = name == null ? null : name.toString(); - if (QtKeywords.Q_OBJECT.equals(macroName)) - continue; - - if (QtKeywords.Q_CLASSINFO.equals(macroName)) { - Matcher m = classInfoRegex.matcher(expansion.getRawSignature()); - if (m.matches()) { - String key = m.group(1); - String value = m.group(2); - qobjName.addClassInfo(key, value); - } - } else if (QtKeywords.Q_PROPERTY.equals(macroName)) - handleQPropertyDefn(owner, qobjName, expansion); - } - - // Process the slot, signal, and invokable method declarations. - extractQMethods(owner, spec, qobjName); - } - - private void handleQClass(IASTPreprocessorIncludeStatement owner, ICPPASTCompositeTypeSpecifier spec, - IQtASTName qtName, IASTPreprocessorMacroExpansion[] expansions) { - - // Put the Qt name into the symbol map. - symbols.add(owner, qtName, null); - - // The QClass contains a reference to the C++ class that it annotates. - symbols.add(owner, new ASTNameReference(spec.getName()), qtName); - - // There are three macros that are significant to QEnums, Q_ENUMS, Q_FLAGS, and Q_DECLARE_FLAGS. - // All macro expansions in the QObject class definition are examined to find instances of these - // three. Two lists are created during this processing. Then those lists are uses to create - // the QEnum instances. - - List enumDecls = new ArrayList<>(); - Map flagAliases = new HashMap<>(); - - for (IASTPreprocessorMacroExpansion expansion : expansions) { - - IASTName name = expansion.getMacroReference(); - String macroName = name == null ? null : name.toString(); - if (QtKeywords.Q_OBJECT.equals(macroName)) - continue; - - if (QtKeywords.Q_ENUMS.equals(macroName)) - extractEnumDecls(expansion, false, enumDecls); - else if (QtKeywords.Q_FLAGS.equals(macroName)) - extractEnumDecls(expansion, true, enumDecls); - else if (QtKeywords.Q_DECLARE_FLAGS.equals(macroName)) { - Matcher m = declareFlagsRegex.matcher(expansion.getRawSignature()); - if (m.matches()) { - String flagName = m.group(1); - String enumName = m.group(2); - flagAliases.put(flagName, enumName); - } - } - } - - for (EnumDecl decl : enumDecls) - decl.handle(owner, spec, qtName, flagAliases); - } - - private void extractEnumDecls(IASTPreprocessorMacroExpansion expansion, boolean isFlag, List decls) { - String signature = expansion.getRawSignature(); - Matcher m = expansionParamRegex.matcher(signature); - if (!m.matches()) - return; - - IASTName refName = expansion.getMacroReference(); - String param = m.group(1); - for (int offset = m.start(1), - end = param.length(); !param.isEmpty(); offset += end, param = param.substring(end)) { - m = qualNameRegex.matcher(param); - if (!m.matches()) - break; - - int start = m.start(1); - end = m.end(1); - - String enumName = m.group(1); - decls.add(new EnumDecl(enumName, isFlag, refName, offset + start, end - start)); - } - } - - private void handleQPropertyDefn(IASTPreprocessorIncludeStatement owner, QObjectName qobjName, - IASTPreprocessorMacroExpansion expansion) { - Matcher m = qPropertyRegex.matcher(expansion.getRawSignature()); - if (!m.matches()) - return; - - String type = m.group(1); - String name = m.group(2); - - int nameStart = m.start(2); - int nameEnd = m.end(2); - - IASTName refName = expansion.getMacroReference(); - QtASTImageLocation location = new QtASTImageLocation(refName.getFileLocation(), nameStart, nameEnd - nameStart); - - QtPropertyName propertyName = new QtPropertyName(qobjName, refName, name, location); - propertyName.setType(type); - qobjName.addProperty(propertyName); - symbols.add(owner, propertyName, qobjName); - - // Create nodes for all the attributes. - AttrValue[] values = new AttrValue[IQProperty.Attribute.values().length]; - String attributes = m.group(3); - if (attributes == null) - return; - - int attrOffset = m.start(3); - - int lastEnd = 0; - IQProperty.Attribute lastAttr = null; - for (Matcher attributeMatcher = qPropertyAttributeRegex.matcher(attributes); attributeMatcher - .find(); lastEnd = attributeMatcher.end()) { - // set the value of attribute found in the previous iteration to the substring between - // the end of that attribute and the start of this one - if (lastAttr != null) { - String value = attributes.substring(lastEnd, attributeMatcher.start()); - int wsOffset = 0; - Matcher ws = leadingWhitespaceRegex.matcher(value); - if (ws.matches()) { - value = ws.group(1); - wsOffset = ws.start(1); - } - - values[lastAttr.ordinal()] = new AttrValue(attrOffset + lastEnd + wsOffset, value.trim()); - } - - // the regex is built from the definition of the enum, so none of the strings that it - // finds will throw an exception - lastAttr = IQProperty.Attribute.valueOf(IQProperty.Attribute.class, attributeMatcher.group(0)); - - // if this attribute doesn't have a value, then put it into the value map immediately - // and make sure it is not used later in this scan - if (!lastAttr.hasValue) { - values[lastAttr.ordinal()] = AttrValue.None; - lastAttr = null; - } - } - - // the value of the last attribute in the expansion is the substring between the end of - // the attribute identifier and the end of the string - if (lastAttr != null) { - String value = attributes.substring(lastEnd); - int wsOffset = 0; - Matcher ws = leadingWhitespaceRegex.matcher(value); - if (ws.matches()) { - value = ws.group(1); - wsOffset = ws.start(1); - } - - values[lastAttr.ordinal()] = new AttrValue(attrOffset + lastEnd + wsOffset, value.trim()); - } - - // Put all values into the property name. - for (int i = 0; i < values.length; ++i) { - IQProperty.Attribute attr = IQProperty.Attribute.values()[i]; - AttrValue value = values[i]; - if (value == null) - continue; - - // If the attribute is not expected to have a C++ binding as the value, then it can - // be immediately added to the Q_PROPERTY. - if (!couldHaveBinding(attr)) { - propertyName.addAttribute(attr, value.value); - continue; - } - - // Otherwise see if one or more bindings can be found for the value of the attribute. - // TODO Check whether the Qt moc allows for inherited methods. - IBinding[] bindings = null; - IASTNode specNode = qobjName.getParent(); - if (specNode instanceof IASTCompositeTypeSpecifier) { - IScope scope = ((IASTCompositeTypeSpecifier) specNode).getScope(); - bindings = CPPSemantics.findBindings(scope, value.value, false); - } - - // If no bindings are found, then the attribute can be immediately added to the Q_PROPERTY. - if (bindings == null || bindings.length <= 0) { - propertyName.addAttribute(attr, value.value); - continue; - } - - // Otherwise create a new attribute for each binding. - for (IBinding foundBinding : bindings) { - propertyName.addAttribute(attr, value.value, foundBinding); - - IASTName cppName = findASTName(foundBinding); - if (cppName != null) { - QtASTImageLocation attrLoc = new QtASTImageLocation(refName.getFileLocation(), value.offset, - value.value.length()); - symbols.add(owner, new ASTNameReference(cppName, attrLoc), propertyName); - } - } - } - } - - private static boolean couldHaveBinding(IQProperty.Attribute attr) { - switch (attr) { - case READ: - case WRITE: - case RESET: - case NOTIFY: - case DESIGNABLE: - case SCRIPTABLE: - return true; - - case REVISION: - case STORED: - case USER: - case CONSTANT: - case FINAL: - default: - return false; - } - } - - private static IASTName findASTName(IBinding binding) { - IASTNode node = null; - if (binding instanceof ICPPInternalBinding) { - node = ((ICPPInternalBinding) binding).getDefinition(); - if (node == null) - node = ((ICPPInternalBinding) binding).getDeclarations()[0]; - } - - if (node == null) - return null; - - IASTName astName = node instanceof IASTName ? (IASTName) node : null; - if (astName != null) - return astName; - - if (node instanceof IASTDeclarator) - return ((IASTDeclarator) node).getName(); - - return null; - } - - private static class AttrValue { - public final int offset; - public final String value; - - public AttrValue(int offset, String value) { - this.offset = offset; - this.value = value; - } - - public static final AttrValue None = new AttrValue(0, null); - } - - private void extractQMethods(IASTPreprocessorIncludeStatement owner, ICPPASTCompositeTypeSpecifier spec, - QObjectName qobjName) { - QtASTClass qtASTClass = QtASTClass.create(spec); - for (IASTDeclaration decl : spec.getMembers()) { - - // We only care about this node if it is within a signal/slot region or if it - // has been tagged with a Qt annotating tag. - int offset = decl.getFileLocation().getNodeOffset(); - IQMethod.Kind kind = qtASTClass.getKindFor(offset); - Long revision = qtASTClass.getRevisionFor(offset); - if (kind == IQMethod.Kind.Unspecified) - continue; - - // Only named methods are processed, so skip this node if it is not a function or - // if it does not have a name. - IASTSimpleDeclaration simpleDecl = getSimpleDecl(decl); - if (simpleDecl == null) - continue; - - ICPPASTFunctionDeclarator decltor = null; - for (IASTDeclarator d : simpleDecl.getDeclarators()) - if (d instanceof ICPPASTFunctionDeclarator) { - decltor = (ICPPASTFunctionDeclarator) d; - break; - } - if (decltor == null) - continue; - - IASTName cppName = decltor.getName(); - if (cppName == null) - continue; - - String qtEncSignatures = QtMethodUtil.getEncodedQtMethodSignatures(decltor); - symbols.add(owner, new QMethodName(qobjName, cppName, kind, qtEncSignatures, revision), qobjName); - } - } - - private static IASTSimpleDeclaration getSimpleDecl(IASTNode node) { - while (node != null && !(node instanceof IASTSimpleDeclaration)) - node = node.getParent(); - return node instanceof IASTSimpleDeclaration ? (IASTSimpleDeclaration) node : null; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtEnumName.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtEnumName.java deleted file mode 100644 index 0f6b1b16235..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtEnumName.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2013, 2014 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.core.runtime.CoreException; - -public class QtEnumName extends AbstractQObjectMemberName implements IQtASTName { - - private final IASTName cppEnumName; - private final boolean isFlag; - - public QtEnumName(IQtASTName qobjName, IASTName ast, String qtEnumName, IASTName cppEnumName, - QtASTImageLocation location, boolean isFlag) { - super(qobjName, ast, qtEnumName, location); - this.cppEnumName = cppEnumName; - this.isFlag = isFlag; - } - - public boolean isFlag() { - return isFlag; - } - - @Override - public QtPDOMBinding createPDOMBinding(QtPDOMLinkage linkage) throws CoreException { - return new QtPDOMQEnum(linkage, getOwner(linkage), this, cppEnumName); - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMASTProcessor.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMASTProcessor.java deleted file mode 100644 index 7dc290d65be..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMASTProcessor.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2013 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import org.eclipse.cdt.core.dom.ILinkage; -import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; -import org.eclipse.cdt.core.index.IIndexSymbols; -import org.eclipse.cdt.core.index.IPDOMASTProcessor; -import org.eclipse.cdt.internal.core.parser.scanner.LocationMap; -import org.eclipse.core.runtime.CoreException; - -@SuppressWarnings("restriction") -public class QtPDOMASTProcessor extends IPDOMASTProcessor.Abstract { - @Override - public int process(IASTTranslationUnit ast, IIndexSymbols symbols) throws CoreException { - ast.accept(new QtASTVisitor(symbols, ast.getAdapter(LocationMap.class))); - return ILinkage.QT_LINKAGE_ID; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMArray.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMArray.java deleted file mode 100644 index fa8ace6ae16..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMArray.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2013 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import org.eclipse.cdt.internal.core.pdom.db.Database; -import org.eclipse.core.runtime.CoreException; - -/** - * A utility class for storing a fixed-size list of fixed-size elements into the Database. - */ -@SuppressWarnings("restriction") -public class QtPDOMArray { - - private static int offsetInitializer = 0; - - protected static enum Field { - Count(Database.INT_SIZE), Data(0); // The size of the block is provided at runtime. - - public final int offset; - - private Field(int sizeof) { - this.offset = offsetInitializer; - offsetInitializer += sizeof; - } - - public long getRecord(long baseRec) { - return baseRec + offset; - } - } - - private final QtPDOMLinkage linkage; - private final IQtPDOMCodec codec; - private long record; - - public QtPDOMArray(QtPDOMLinkage linkage, IQtPDOMCodec codec, long record) { - this.linkage = linkage; - this.codec = codec; - this.record = record; - } - - public QtPDOMArray(QtPDOMLinkage linkage, IQtPDOMCodec codec, T[] array) throws CoreException { - this.linkage = linkage; - this.codec = codec; - this.record = 0; - set(array); - } - - public long getRecord() { - return record; - } - - /** - * Return array that is stored in the database. Return null if the receiver is not initialized. - */ - public T[] get() throws CoreException { - if (record == 0) - return null; - - int count = linkage.getDB().getInt(Field.Count.getRecord(record)); - - long elementRec = Field.Data.getRecord(record); - T[] array = codec.allocArray(count); - for (int i = 0; i < count; ++i, elementRec += codec.getElementSize()) - array[i] = codec.decode(linkage, elementRec); - - return array; - } - - /** - * Store the given array into the database. This may change the storage location of the - * receiver. - * @param array The array of elements that should be stored. Setting the value to null is - * equivalent to calling {@link #delete()}, which clears all storage. - */ - public long set(T[] array) throws CoreException { - if (array == null) - return delete(); - - // Initialize the receiver if needed. - if (record == 0) { - record = linkage.getDB().malloc(Field.Data.offset + (array.length * codec.getElementSize())); - linkage.getDB().putInt(Field.Count.getRecord(record), array.length); - } else { - // Check if the storage block needs to be resized. - int count = linkage.getDB().getInt(Field.Count.getRecord(record)); - if (count != array.length) { - linkage.getDB().free(record); - record = linkage.getDB().malloc(Field.Data.offset + (array.length * codec.getElementSize())); - linkage.getDB().putInt(Field.Count.getRecord(record), array.length); - } - } - - // Write the new content into the database. - long elementRec = Field.Data.getRecord(record); - for (int i = 0; i < array.length; ++i, elementRec += codec.getElementSize()) - codec.encode(linkage, elementRec, array[i]); - - return record; - } - - /** - * Release all storage used by the receiver and its elements. - */ - public long delete() throws CoreException { - // If the receiver is already empty, then there is nothing else to do. - if (record == 0) - return record; - - // Otherwise get the size of the stored array and delete each element. - int count = linkage.getDB().getInt(Field.Count.getRecord(record)); - if (count > 0) { - long elementRec = Field.Data.getRecord(record); - for (int i = 0; i < count; ++i, elementRec += codec.getElementSize()) - codec.encode(linkage, elementRec, null); - } - - // Finally, release the entire record. - linkage.getDB().free(record); - record = 0; - return record; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMBinding.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMBinding.java deleted file mode 100644 index 009b0ad581f..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMBinding.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2013, 2014 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; -import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage; -import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode; -import org.eclipse.core.runtime.CoreException; - -@SuppressWarnings("restriction") -public abstract class QtPDOMBinding extends PDOMBinding { - - // The offsetInitializer is initialized with the size of the parent. It is incremented - // during loading of the Fields enum. This value does not reliably store the size of - // the QtPDOMBinding record because the enum will not be initialized until it is needed. - // The record size is retrieved as the offset of the special terminal enumerator Last. - private static int offsetInitializer = RECORD_SIZE; - - protected static enum Field { - Last(0); - - public final int offset; - - private Field(int sizeof) { - this.offset = offsetInitializer; - offsetInitializer += sizeof; - } - } - - protected QtPDOMBinding(QtPDOMLinkage linkage, long record) { - super(linkage, record); - } - - protected QtPDOMBinding(QtPDOMLinkage linkage, PDOMNode parent, IASTName qtName) throws CoreException { - super(linkage, parent, qtName.getSimpleID()); - } - - @Override - protected int getRecordSize() { - return Field.Last.offset; - } - - protected QtPDOMLinkage getQtLinkage() { - PDOMLinkage pdomLinkage = getLinkage(); - return pdomLinkage instanceof QtPDOMLinkage ? (QtPDOMLinkage) pdomLinkage : null; - } - - // Access to the base class is restricted in the cdt.core plugin. Other classes in the qt.core - // plugin that need the qualified name get an access warning. This forwarding function moves - // those warnings to a single place (this method). - @Override - public String[] getQualifiedName() { - return super.getQualifiedName(); - } - - // Access to the base class is restricted in the cdt.core plugin. Other classes in the qt.core - // plugin that need the name get an access warning. This forwarding function moves those warnings - // to a single place (this method). - @Override - public String getName() { - return super.getName(); - } - - @Override - @SuppressWarnings({ "rawtypes", "unchecked" }) - public Object getAdapter(Class adapter) { - if (adapter.isAssignableFrom(getClass())) - return this; - - return super.getAdapter(adapter); - } - - /** - * Returns a Long from the given offset within this node's record. The permitted range of the Long - * is [Long.MIN_VALUE, Long.MAX_VALUE). Notice that Long.MAX_VALUE is excluded from the valid range. - */ - protected Long getLongOrNull(long offset) throws CoreException { - long val = getDB().getLong(record + offset); - return val == Long.MAX_VALUE ? null : Long.valueOf(val); - } - - /** - * Puts the given Long into the database at the specified offset within this node's record. The permitted - * range for val is [Long.MIN_VALUE, Long.MAX_VALUE). Notice that Long.MAX_VALUE is excluded from - * the valid range. - *

- * The val parameter is allowed to be null. A value will be stored to the database so that later calls to - * {@link #getLongOrNull(long)} will return null; - */ - protected void putLongOrNull(long offset, Long val) throws CoreException { - getDB().putLong(record + offset, val == null ? Long.MAX_VALUE : val.longValue()); - } - - /** - * Returns a String from the given offset within this node's record. This method will return null if the - * database does not contain an IString at the specified location. - */ - protected String getStringOrNull(long offset) throws CoreException { - long rec = getDB().getRecPtr(record + offset); - return rec == 0 ? null : getDB().getString(rec).getString(); - } - - /** - * Puts the given String into the database at the specified offset within this node's record. Any IString - * that happens to already exist at the specified location will be deleted before the new value is stored. - *

- * The val parameter is allowed to be null. A value will be stored to the database so that later calls to - * {@link #getStringOrNull(long)} will return null; - */ - protected void putStringOrNull(long offset, String val) throws CoreException { - long rec = getDB().getRecPtr(record + offset); - if (rec != 0) - getDB().getString(rec).delete(); - - getDB().putRecPtr(record + offset, val == null ? 0 : getDB().newString(val).getRecord()); - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMLinkage.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMLinkage.java deleted file mode 100644 index 7ddfd2afccc..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMLinkage.java +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Map; -import java.util.WeakHashMap; - -import org.eclipse.cdt.core.dom.ILinkage; -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.cdt.core.dom.ast.IBinding; -import org.eclipse.cdt.core.dom.ast.IType; -import org.eclipse.cdt.internal.core.dom.parser.ITypeMarshalBuffer; -import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation; -import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPExecution; -import org.eclipse.cdt.internal.core.pdom.PDOM; -import org.eclipse.cdt.internal.core.pdom.db.Database; -import org.eclipse.cdt.internal.core.pdom.db.IBTreeComparator; -import org.eclipse.cdt.internal.core.pdom.dom.FindBinding; -import org.eclipse.cdt.internal.core.pdom.dom.IPDOMBinding; -import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; -import org.eclipse.cdt.internal.core.pdom.dom.PDOMFile; -import org.eclipse.cdt.internal.core.pdom.dom.PDOMGlobalScope; -import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage; -import org.eclipse.cdt.internal.core.pdom.dom.PDOMName; -import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode; -import org.eclipse.cdt.internal.core.pdom.dom.cpp.PDOMCPPGlobalScope; -import org.eclipse.cdt.internal.qt.core.Activator; -import org.eclipse.core.runtime.CoreException; - -@SuppressWarnings("restriction") -public class QtPDOMLinkage extends PDOMLinkage { - - private static int offsetInitializer = PDOMLinkage.RECORD_SIZE; - - private static enum Field { - Version(Database.INT_SIZE, 0), QmlRegistrationIndex(Database.PTR_SIZE, 3), Last(0, 0); - - private final int offset; - public final int version; - - private Field(int sizeof, int version) { - this.offset = offsetInitializer; - this.version = version; - offsetInitializer += sizeof; - } - - public long getRecord(long baseRec) { - return baseRec + offset; - } - } - - // The version that has been read from/written to the persisted file. - private int version; - - private final Map cache = new WeakHashMap<>(); - - public QtPDOMLinkage(PDOM pdom, long record) throws CoreException { - super(pdom, record); - - version = pdom.getDB().getInt(Field.Version.getRecord(record)); - } - - protected QtPDOMLinkage(PDOM pdom) throws CoreException { - super(pdom, ILinkage.QT_LINKAGE_NAME, ILinkage.QT_LINKAGE_NAME.toCharArray()); - - // Initialize the version with whatever is current. - version = QtPDOMNodeType.VERSION; - pdom.getDB().putInt(Field.Version.getRecord(record), version); - - // Initialize all BTree's to 0. - if (version >= Field.QmlRegistrationIndex.version) - pdom.getDB().putRecPtr(Field.QmlRegistrationIndex.getRecord(record), 0); - } - - @Override - protected int getRecordSize() { - return Field.Last.offset; - } - - public int getVersion() { - return version; - } - - @Override - public String getLinkageName() { - return ILinkage.QT_LINKAGE_NAME; - } - - @Override - public int getLinkageID() { - return ILinkage.QT_LINKAGE_ID; - } - - @Override - public PDOMNode getNode(long record, int nodeType) throws CoreException { - return QtPDOMNodeType.load(this, nodeType, record); - } - - @Override - public IBTreeComparator getIndexComparator() { - return new FindBinding.DefaultBindingBTreeComparator(this); - } - - @Override - public PDOMGlobalScope getGlobalScope() { - return PDOMCPPGlobalScope.INSTANCE; - } - - // IBinding#getAdapter cannot create an instance of PDOMBinding because the Linkage is required. This - // utility method uses #getAdapter to see if an instance has already been created. If not then a new - // is created and stored in the AST binding. - @Override - public PDOMBinding adaptBinding(IBinding binding, boolean includeLocal) throws CoreException { - if (binding == null) - return null; - - // If a binding has already been persisted for this instance then return it now. - QtPDOMBinding pdomBinding = binding.getAdapter(QtPDOMBinding.class); - if (pdomBinding != null && pdomBinding.getLinkage() == this) - return pdomBinding; - - // If a PDOMBinding was created, then add it to the linkage before returning it. - if (pdomBinding != null) { - addChild(pdomBinding); - return pdomBinding; - } - - // Otherwise fall back to looking in the C++ linkage. - return getPDOM().getLinkage(ILinkage.CPP_LINKAGE_ID).adaptBinding(binding); - } - - public long getCPPRecord(IASTName cppName) throws CoreException { - - if (cppName == null) - return 0; - - IBinding binding = getPDOM().findBinding(cppName); - if (binding == null) - return 0; - - IPDOMBinding pdomBinding = binding.getAdapter(IPDOMBinding.class); - if (pdomBinding == null) - return 0; - - if (pdomBinding.getLinkage() == null || pdomBinding.getLinkage().getLinkageID() != ILinkage.CPP_LINKAGE_ID) - return 0; - - return pdomBinding.getRecord(); - } - - /** - * Return the PDOMBinding for the given Qt name creating a new binding if needed. The - * implementation caches the result using the name instance as the key. This ensures - * one-to-one uniqueness between AST names and PDOMBindings. - *

- * This method is not thread-safe. - */ - public PDOMBinding getBinding(IQtASTName qtAstName) throws CoreException { - // The Qt implementation ensures uniqueness by creating only a single instance of - // the IASTName for each thing that should create a single instance in the PDOM. - // This will work as long as all Qt elements are updated at once, which is currently - // the case. - // - // I don't think this needs to be thread-safe, because things are only added from - // the single indexer task. - // - // Doug: The cache is causing out of memory conditions. Commenting out for now. - // - PDOMBinding pdomBinding = null; - pdomBinding = cache.get(qtAstName); - if (pdomBinding != null) - return pdomBinding; - - // The result is cached even when null is returned. - pdomBinding = qtAstName.createPDOMBinding(this); - cache.put(qtAstName, pdomBinding); - - // Only add children that are actually created. - if (pdomBinding != null) - addChild(pdomBinding); - - return pdomBinding; - } - - @Override - public PDOMBinding addBinding(IASTName name) throws CoreException { - - // The Qt linkage is able to reference elements in other linkages. This implementation - // needs to decide if the binding associated with this name is from the Qt linkage or - // from one of those external references. - - if (name == null) - return null; - - if (name instanceof IQtASTName) - return getBinding((IQtASTName) name); - - IBinding binding = name.getBinding(); - if (binding == null) - return null; - - // Use the receiving linkage by default, and override only if the binding is found to - // have a linkage with a different id. - PDOMLinkage pdomLinkage = this; - ILinkage linkage = binding.getLinkage(); - if (linkage != null && linkage.getLinkageID() != getLinkageID()) - pdomLinkage = getPDOM().getLinkage(linkage.getLinkageID()); - - // Handle bindings in unknown linkages as though the name is to be added to this linkage. - return (pdomLinkage == null ? this : pdomLinkage).adaptBinding(binding); - } - - @Override - public void onCreateName(PDOMFile file, IASTName name, PDOMName pdomName) throws CoreException { - super.onCreateName(file, name, pdomName); - - // If the new name was created for a QmlRegistration, then put it into the index. - if (name instanceof QmlTypeRegistration) { - String qobjName = ((QmlTypeRegistration) name).getQObjectName(); - QtPDOMNameIndex index = getQmlRegistrationIndex(); - if (index != null) - index.add(qobjName, pdomName); - } - } - - @Override - public void onDeleteName(PDOMName name) throws CoreException { - // If this is a name for a QML registration, then the registration must be removed - // from the index. - PDOMBinding binding = name.getBinding(); - if (binding instanceof QtPDOMQmlRegistration) { - QtPDOMNameIndex index = getQmlRegistrationIndex(); - if (index != null) - index.remove(((QtPDOMQmlRegistration) binding).getQObjectName(), name); - } - - super.onDeleteName(name); - } - - public Collection getQmlRegistrations(String qobjName) throws CoreException { - QtPDOMNameIndex index = getQmlRegistrationIndex(); - if (index == null) - return Collections.emptyList(); - - Collection names = index.get(qobjName); - if (names.isEmpty()) - return Collections.emptyList(); - - ArrayList registrations = new ArrayList<>(); - for (PDOMName name : names) { - PDOMBinding binding = name.getBinding(); - if (binding instanceof QtPDOMQmlRegistration) - registrations.add((QtPDOMQmlRegistration) binding); - } - return registrations; - } - - private QtPDOMNameIndex getQmlRegistrationIndex() throws CoreException { - return version >= Field.QmlRegistrationIndex.version - ? new QtPDOMNameIndex(this, Field.QmlRegistrationIndex.getRecord(record)) - : null; - } - - @Override - public int getBindingType(IBinding binding) { - return binding instanceof QtPDOMBinding ? ((QtPDOMBinding) binding).getNodeType() : 0; - } - - @Override - public PDOMBinding addTypeBinding(IBinding binding) throws CoreException { - throw new CoreException(Activator.error("Qt Linkage does not manage types")); //$NON-NLS-1$ - } - - @Override - public IType unmarshalType(ITypeMarshalBuffer buffer) throws CoreException { - throw new CoreException(Activator.error("Qt Linkage does not marshal types")); //$NON-NLS-1$ - } - - @Override - public IBinding unmarshalBinding(ITypeMarshalBuffer buffer) throws CoreException { - throw new CoreException(Activator.error("Qt Linkage does not marshal bindings")); //$NON-NLS-1$ - } - - @Override - public ICPPEvaluation unmarshalEvaluation(ITypeMarshalBuffer typeMarshalBuffer) throws CoreException { - throw new CoreException(Activator.error("Qt Linkage does not marshal evaluations")); //$NON-NLS-1$ - } - - @Override - public ICPPExecution unmarshalExecution(ITypeMarshalBuffer typeMarhsalBuffer) throws CoreException { - throw new CoreException(Activator.error("Qt Linkage does not marshal executions")); //$NON-NLS-1$ - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMNameIndex.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMNameIndex.java deleted file mode 100644 index 0d5ce1e632c..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMNameIndex.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2014 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.eclipse.cdt.internal.core.pdom.db.BTree; -import org.eclipse.cdt.internal.core.pdom.db.Database; -import org.eclipse.cdt.internal.core.pdom.db.IBTreeComparator; -import org.eclipse.cdt.internal.core.pdom.db.IBTreeVisitor; -import org.eclipse.cdt.internal.core.pdom.db.IString; -import org.eclipse.cdt.internal.core.pdom.dom.PDOMName; -import org.eclipse.core.runtime.CoreException; - -/** - * A data structure for storing lists of PDOMNames that are indexed by a String key. - * This is equivalent to the java type Map>. - */ -@SuppressWarnings("restriction") -public class QtPDOMNameIndex { - private final QtPDOMLinkage qtLinkage; - private final Database db; - private final BTree btree; - - // Entries in the index look like: - // struct Entry { - // record key; - // record head; - // }; - // - // Elements in the list for each entry look like: - // struct ListNode { - // record pdomName; - // record next; - // }; - - public QtPDOMNameIndex(QtPDOMLinkage qtLinkage, long ptr) throws CoreException { - this.qtLinkage = qtLinkage; - this.db = qtLinkage.getDB(); - this.btree = new BTree(db, ptr, new StringKeyComparator()); - } - - public Collection get(String key) throws CoreException { - Finder finder = new Finder(key); - btree.accept(finder); - if (finder.headRec == 0) - return Collections.emptyList(); - - List names = new ArrayList<>(); - for (long node = db.getRecPtr(finder.headRec); node != 0; node = db.getRecPtr(node + Database.PTR_SIZE)) - names.add(new PDOMName(qtLinkage, db.getRecPtr(node))); - return names; - } - - public void add(String key, PDOMName name) throws CoreException { - - IString dbKey = db.newString(key); - - // Construct a temporary entry and try to insert it into the tree. - long tmpEntry = db.malloc(2 * Database.PTR_SIZE); - db.putRecPtr(tmpEntry, dbKey.getRecord()); - long entry = btree.insert(tmpEntry); - - // If the new entry was inserted into the tree, then we need to allocate new - // memory for the list node. If the tree already had an entry for this key, then - // we need to release the string that was provisionally allocated as the key, but - // can reuse the memory for the list node. - long node = 0; - if (entry == tmpEntry) - node = db.malloc(Database.PTR_SIZE); - else { - dbKey.delete(); - node = tmpEntry; - } - - // The registration can now be put into the new list node. - db.putRecPtr(node, name.getRecord()); - - // Finally, the new list node should be inserted before the current head. - long head = db.getRecPtr(entry + Database.PTR_SIZE); - db.putRecPtr(node + Database.PTR_SIZE, head); - db.putRecPtr(entry + Database.PTR_SIZE, node); - } - - public void remove(String key, PDOMName name) throws CoreException { - Finder finder = new Finder(key); - btree.accept(finder); - if (finder.headRec == 0) - return; - - long qmlRec = name.getRecord(); - - // Walk the list to find this record. If found then update the previous node to - // point to the one after node. - long prev = finder.headRec; - for (long node = db.getRecPtr(prev); node != 0; node = db.getRecPtr(prev)) { - long rec = db.getRecPtr(node); - if (rec == qmlRec) { - long next = db.getRecPtr(node + Database.PTR_SIZE); - db.putRecPtr(prev, next); - db.free(node); - break; - } - - prev = node + Database.PTR_SIZE; - } - - // The lifetime of the binding is managed elsewhere so don't delete it here. We - // are just maintaining the consistency of this index. - } - - private class StringKeyComparator implements IBTreeComparator { - @Override - public int compare(long record1, long record2) throws CoreException { - long lhsRec = db.getRecPtr(record1); - long rhsRec = db.getRecPtr(record2); - - IString lhs = lhsRec == 0 ? null : db.getString(lhsRec); - IString rhs = rhsRec == 0 ? null : db.getString(rhsRec); - - if (lhs == null) - return rhs == null ? 0 : -1; - return rhs == null ? 1 : lhs.compare(rhs, true); - } - } - - private class Finder implements IBTreeVisitor { - private final String key; - public Long headRec = 0L; - - public Finder(String key) { - this.key = key; - } - - @Override - public int compare(long rhsRecord) throws CoreException { - long keyRec = db.getRecPtr(rhsRecord); - return keyRec == 0 ? 1 : db.getString(keyRec).compare(key, true); - } - - @Override - public boolean visit(long record) throws CoreException { - headRec = record + Database.PTR_SIZE; - return false; - } - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMNodeType.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMNodeType.java deleted file mode 100644 index 39b7523666e..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMNodeType.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2013, 2014 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import org.eclipse.cdt.internal.core.index.IIndexBindingConstants; -import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode; -import org.eclipse.core.runtime.CoreException; - -@SuppressWarnings("restriction") -public enum QtPDOMNodeType { - - QObject, QEnum, QProperty, QMethod, QGadget, QmlTypeRegistration, QmlUncreatableRegistration; - - public final int Type = IIndexBindingConstants.LAST_CONSTANT + 1 + ordinal(); - - /** - * The current version of the QtPDOMLinkage. This can be used to make sure the persisted - * data matches what is expected by the implementation. Care should be taken to make changes - * backward compatible when possible. - *

- * The version is needed because ordinals for these enumerators are written to the file. - *

- * This version can be reset when the PDOM's version changes because older Qt linkages will - * be dropped (along with everything else in that PDOM). - */ - public static final int VERSION = 3; - - public static QtPDOMNodeType forType(int version, int type) { - // Nothing has been deleted or replaced yet, so the version is ignored. - - for (QtPDOMNodeType node : values()) - if (node.Type == type) - return node; - return null; - } - - // This needs to return PDOMNode so that it can be either QtPDOMNode or QtPDOMBinding. - public static PDOMNode load(QtPDOMLinkage linkage, int nodeType, long record) throws CoreException { - QtPDOMNodeType node = QtPDOMNodeType.forType(linkage.getVersion(), nodeType); - if (node == null) - return null; - - switch (node) { - case QObject: - return new QtPDOMQObject(linkage, record); - case QEnum: - return new QtPDOMQEnum(linkage, record); - case QProperty: - return new QtPDOMProperty(linkage, record); - case QMethod: - return new QtPDOMQMethod(linkage, record); - case QGadget: - return new QtPDOMQGadget(linkage, record); - case QmlTypeRegistration: - return new QtPDOMQmlRegistration(linkage, record); - case QmlUncreatableRegistration: - return new QtPDOMQmlUncreatable(linkage, record); - } - - return null; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMProperty.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMProperty.java deleted file mode 100644 index 05bd422b058..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMProperty.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import org.eclipse.cdt.internal.core.pdom.db.Database; -import org.eclipse.cdt.internal.core.pdom.db.IString; -import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; -import org.eclipse.cdt.internal.qt.core.Activator; -import org.eclipse.cdt.internal.qt.core.index.IQProperty; -import org.eclipse.core.runtime.CoreException; - -@SuppressWarnings("restriction") -public class QtPDOMProperty extends QtPDOMBinding { - - private static int offsetInitializer = QtPDOMBinding.Field.Last.offset; - - protected static enum Field { - Type(Database.PTR_SIZE), Attributes(Database.PTR_SIZE), Last(0); - - public final int offset; - - private Field(int sizeof) { - this.offset = offsetInitializer; - offsetInitializer += sizeof; - } - - public long getRecord(long baseRec) { - return baseRec + offset; - } - } - - public QtPDOMProperty(QtPDOMLinkage linkage, long record) { - super(linkage, record); - } - - public QtPDOMProperty(QtPDOMLinkage linkage, PDOMBinding parent, QtPropertyName qtName) throws CoreException { - super(linkage, parent, qtName); - - setType(qtName.getType()); - - if (parent instanceof QtPDOMQObject) - ((QtPDOMQObject) parent).addChild(this); - } - - @Override - protected int getRecordSize() { - return Field.Last.offset; - } - - @Override - public int getNodeType() { - return QtPDOMNodeType.QProperty.Type; - } - - public void delete() throws CoreException { - long fieldRec = getDB().getRecPtr(Field.Type.getRecord(record)); - if (fieldRec != 0) - getDB().getString(fieldRec).delete(); - getDB().putRecPtr(Field.Type.getRecord(record), 0); - } - - public void setType(String type) throws CoreException { - long rec = getDB().getRecPtr(Field.Type.getRecord(record)); - if (rec != 0) { - IString typeStr = getDB().getString(rec); - if (type == null) { - typeStr.delete(); - return; - } - - // There is nothing to do if the database already stores the same name. - if (type.equals(typeStr.getString())) - return; - } - - getDB().putRecPtr(Field.Type.getRecord(record), getDB().newString(type).getRecord()); - } - - // IType? - public String getType() throws CoreException { - long rec = getDB().getRecPtr(Field.Type.getRecord(record)); - if (rec == 0) - return null; - - return getDB().getString(rec).getString(); - } - - public void setAttributes(Attribute[] attributes) throws CoreException { - long rec = getDB().getRecPtr(Field.Attributes.getRecord(record)); - QtPDOMArray pdomArray = new QtPDOMArray<>(getQtLinkage(), Attribute.Codec, rec); - rec = pdomArray.set(attributes); - getDB().putRecPtr(Field.Attributes.getRecord(record), rec); - } - - public Attribute[] getAttributes() throws CoreException { - long rec = getDB().getRecPtr(Field.Attributes.getRecord(record)); - QtPDOMArray pdomArray = new QtPDOMArray<>(getQtLinkage(), Attribute.Codec, rec); - return pdomArray.get(); - } - - public static class Attribute { - public final IQProperty.Attribute attr; - public final String value; - public final long cppRecord; - - public Attribute(IQProperty.Attribute attr, String value) { - this.attr = attr; - this.value = value; - this.cppRecord = 0; - } - - public Attribute(IQProperty.Attribute attr, String value, PDOMBinding cppBinding) { - this.attr = attr; - this.value = value; - this.cppRecord = cppBinding == null ? 0 : cppBinding.getRecord(); - } - - private Attribute(IQProperty.Attribute attr, String value, long cppRecord) { - this.attr = attr; - this.value = value; - this.cppRecord = cppRecord; - } - - private static final IQtPDOMCodec Codec = new IQtPDOMCodec<>() { - @Override - public int getElementSize() { - return 1 + Database.PTR_SIZE + Database.PTR_SIZE; - } - - @Override - public Attribute[] allocArray(int count) { - return new Attribute[count]; - } - - @Override - public Attribute decode(QtPDOMLinkage linkage, long record) throws CoreException { - byte attrId = linkage.getDB().getByte(record); - long valRec = linkage.getDB().getRecPtr(record + 1); - long cppRec = linkage.getDB().getRecPtr(record + 1 + Database.PTR_SIZE); - - if (attrId < 0 || attrId >= IQProperty.Attribute.values().length) - throw Activator.coreException("invalid QProperty attribute id read from datbase, was " + attrId); - - IQProperty.Attribute attr = IQProperty.Attribute.values()[attrId]; - - String val = valRec == 0 ? "" : linkage.getDB().getString(valRec).getString(); //$NON-NLS-1$ - return new Attribute(attr, val, cppRec); - } - - @Override - public void encode(QtPDOMLinkage linkage, long record, Attribute element) throws CoreException { - linkage.getDB().putByte(record, (byte) element.attr.ordinal()); - - // Delete the existing strings then create and store new ones. - long rec = linkage.getDB().getRecPtr(record + 1); - if (rec != 0) - linkage.getDB().getString(rec).delete(); - - if (element == null || element.value == null) - linkage.getDB().putRecPtr(record + 1, 0); - else - linkage.getDB().putRecPtr(record + 1, linkage.getDB().newString(element.value).getRecord()); - - linkage.getDB().putRecPtr(record + 1 + Database.PTR_SIZE, element.cppRecord); - } - }; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQEnum.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQEnum.java deleted file mode 100644 index de268933a6c..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQEnum.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2013, 2014 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import org.eclipse.cdt.core.dom.ILinkage; -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.cdt.core.dom.ast.IEnumeration; -import org.eclipse.cdt.core.dom.ast.IEnumerator; -import org.eclipse.cdt.internal.core.pdom.db.Database; -import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; -import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage; -import org.eclipse.core.runtime.CoreException; - -@SuppressWarnings("restriction") -public class QtPDOMQEnum extends QtPDOMBinding { - - private static int offsetInitializer = QtPDOMBinding.Field.Last.offset; - - protected static enum Field { - Flags(1), CppRecord(Database.PTR_SIZE), Last(0); - - public final int offset; - - private Field(int sizeof) { - this.offset = offsetInitializer; - offsetInitializer += sizeof; - } - - public long getRecord(long baseRec) { - return baseRec + offset; - } - } - - private static final int IS_FLAG_MASK = 1; - - protected QtPDOMQEnum(QtPDOMLinkage linkage, long record) throws CoreException { - super(linkage, record); - } - - public QtPDOMQEnum(QtPDOMLinkage linkage, PDOMBinding parent, IASTName qtName, IASTName cppName) - throws CoreException { - super(linkage, parent, qtName); - - getDB().putRecPtr(Field.CppRecord.getRecord(record), linkage.getCPPRecord(cppName)); - - // The flags are set in several sections, and then written to the Database in one operation. - byte flags = 0; - - if (qtName instanceof QtEnumName && ((QtEnumName) qtName).isFlag()) - flags |= IS_FLAG_MASK; - - // Write the flags to the database. - getDB().putByte(Field.Flags.getRecord(record), flags); - - if (parent instanceof AbstractQtPDOMClass) - ((AbstractQtPDOMClass) parent).addChild(this); - } - - @Override - public int getRecordSize() { - return Field.Last.offset; - } - - public IEnumeration getCppEnumeration() throws CoreException { - long cppRec = getDB().getRecPtr(Field.CppRecord.getRecord(record)); - if (cppRec == 0) - return null; - - PDOMLinkage cppLinkage = getPDOM().getLinkage(ILinkage.CPP_LINKAGE_ID); - if (cppLinkage == null) - return null; - - PDOMBinding cppBinding = cppLinkage.getBinding(cppRec); - - // TODO - if (cppBinding == null) - return null; - cppBinding.getAdapter(IEnumeration.class); - - return cppBinding instanceof IEnumeration ? (IEnumeration) cppBinding : null; - } - - public boolean isFlag() throws CoreException { - byte flags = getDB().getByte(Field.Flags.getRecord(record)); - return (flags & IS_FLAG_MASK) == IS_FLAG_MASK; - } - - @Override - public int getNodeType() { - return QtPDOMNodeType.QEnum.Type; - } - - public List getEnumerators() throws CoreException { - IEnumeration cppEnum = getCppEnumeration(); - return cppEnum == null ? Collections.emptyList() : Arrays.asList(cppEnum.getEnumerators()); - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQGadget.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQGadget.java deleted file mode 100644 index a3ad1574788..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQGadget.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2014 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.core.runtime.CoreException; - -public class QtPDOMQGadget extends AbstractQtPDOMClass { - - protected QtPDOMQGadget(QtPDOMLinkage linkage, long record) throws CoreException { - super(linkage, record); - } - - public QtPDOMQGadget(QtPDOMLinkage linkage, IASTName qtName, IASTName cppName) throws CoreException { - super(linkage, qtName, cppName); - } - - @Override - public int getNodeType() { - return QtPDOMNodeType.QGadget.Type; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQMethod.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQMethod.java deleted file mode 100644 index d50c87d0e3f..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQMethod.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.cdt.internal.core.pdom.db.Database; -import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; -import org.eclipse.cdt.internal.qt.core.index.IQMethod; -import org.eclipse.core.runtime.CoreException; - -@SuppressWarnings("restriction") -public class QtPDOMQMethod extends QtPDOMBinding { - - private static int offsetInitializer = QtPDOMBinding.Field.Last.offset; - - protected static enum Field { - Signature(Database.PTR_SIZE), Revision(8), Flags(1), Last(0); - - public final int offset; - - private Field(int sizeof) { - this.offset = offsetInitializer; - offsetInitializer += sizeof; - } - - public long getRecord(long baseRec) { - return baseRec + offset; - } - } - - private static final int KIND_IS_INVOKABLE = 1; - private static final int KIND_IS_SIGNAL = 2; - private static final int KIND_IS_SLOT = 3; - private static final int KIND_MASK = 3; - private static final int HAS_REVISION = 4; - - public QtPDOMQMethod(QtPDOMLinkage linkage, long record) throws CoreException { - super(linkage, record); - } - - public QtPDOMQMethod(QtPDOMLinkage linkage, PDOMBinding parent, IASTName qtName, IASTName cppName, - IQMethod.Kind kind, String qtEncSignatures, Long revision) throws CoreException { - super(linkage, parent, qtName); - - byte flag = 0; - switch (kind) { - case Invokable: - flag |= KIND_IS_INVOKABLE; - break; - case Signal: - flag |= KIND_IS_SIGNAL; - break; - case Slot: - flag |= KIND_IS_SLOT; - break; - case Unspecified: - break; - } - - if (revision != null) { - flag |= HAS_REVISION; - getDB().putLong(Field.Revision.getRecord(record), revision.longValue()); - } - - getDB().putByte(Field.Flags.getRecord(record), flag); - - long rec = qtEncSignatures == null ? 0 : getDB().newString(qtEncSignatures).getRecord(); - getDB().putRecPtr(Field.Signature.getRecord(record), rec); - - if (parent instanceof QtPDOMQObject) - ((QtPDOMQObject) parent).addChild(this); - } - - @Override - protected int getRecordSize() { - return Field.Last.offset; - } - - public IQMethod.Kind getKind() throws CoreException { - switch (getDB().getByte(Field.Flags.getRecord(record)) & KIND_MASK) { - case KIND_IS_INVOKABLE: - return IQMethod.Kind.Invokable; - case KIND_IS_SIGNAL: - return IQMethod.Kind.Signal; - case KIND_IS_SLOT: - return IQMethod.Kind.Slot; - default: - return IQMethod.Kind.Unspecified; - } - } - - public String getQtEncodedSignatures() throws CoreException { - long rec = getDB().getRecPtr(Field.Signature.getRecord(record)); - return rec == 0 ? null : getDB().getString(rec).getString(); - } - - public Long getRevision() throws CoreException { - byte flag = getDB().getByte(Field.Flags.getRecord(record)); - if ((flag & HAS_REVISION) == 0) - return null; - - return Long.valueOf(getDB().getLong(Field.Revision.getRecord(record))); - } - - @Override - public int getNodeType() { - return QtPDOMNodeType.QMethod.Type; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQObject.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQObject.java deleted file mode 100644 index 043487b09d5..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQObject.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (c) 2013, 2014 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.cdt.core.dom.ast.IBinding; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; -import org.eclipse.cdt.internal.core.pdom.db.Database; -import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; -import org.eclipse.core.runtime.CoreException; - -@SuppressWarnings("restriction") -public class QtPDOMQObject extends AbstractQtPDOMClass { - - private static int offsetInitializer = AbstractQtPDOMClass.Field.Last.offset; - - protected static enum Field { - ClassInfos(Database.PTR_SIZE), Last(0); - - public final int offset; - - private Field(int sizeof) { - this.offset = offsetInitializer; - offsetInitializer += sizeof; - } - - public long getRecord(long baseRec) { - return baseRec + offset; - } - } - - protected QtPDOMQObject(QtPDOMLinkage linkage, long record) throws CoreException { - super(linkage, record); - } - - public QtPDOMQObject(QtPDOMLinkage linkage, IASTName qtName, IASTName cppName) throws CoreException { - super(linkage, qtName, cppName); - - if (qtName instanceof QObjectName) { - QObjectName qobjName = (QObjectName) qtName; - setClassInfos(qobjName.getClassInfos()); - } - } - - public void delete() throws CoreException { - long fieldRec = Field.ClassInfos.getRecord(record); - new QtPDOMArray<>(getQtLinkage(), ClassInfo.Codec, fieldRec).delete(); - getDB().putRecPtr(Field.ClassInfos.getRecord(record), 0); - } - - public void setClassInfos(Map classInfos) throws CoreException { - - // Create an array to be stored to the PDOM. - ClassInfo[] array = new ClassInfo[classInfos.size()]; - Iterator> iterator = classInfos.entrySet().iterator(); - for (int i = 0; i < array.length && iterator.hasNext(); ++i) { - Map.Entry entry = iterator.next(); - array[i] = new ClassInfo(entry.getKey(), entry.getValue()); - } - - // Store the array into the Database. - long arrayRec = getDB().getRecPtr(Field.ClassInfos.getRecord(record)); - QtPDOMArray pdomArray = new QtPDOMArray<>(getQtLinkage(), ClassInfo.Codec, arrayRec); - arrayRec = pdomArray.set(array); - - // Update the record that is stored in the receiver's field. - getDB().putRecPtr(Field.ClassInfos.getRecord(record), arrayRec); - } - - public Map getClassInfos() throws CoreException { - Map classInfos = new LinkedHashMap<>(); - - // Read the array from the Database and insert the elements into the Map that is to be returned. - long arrayRec = getDB().getRecPtr(Field.ClassInfos.getRecord(record)); - QtPDOMArray pdomArray = new QtPDOMArray<>(getQtLinkage(), ClassInfo.Codec, arrayRec); - - ClassInfo[] array = pdomArray.get(); - if (array == null) - return classInfos; - - for (ClassInfo classInfo : array) - classInfos.put(classInfo.key, classInfo.value); - - return classInfos; - } - - @Override - protected int getRecordSize() { - return Field.Last.offset; - } - - @Override - public int getNodeType() { - return QtPDOMNodeType.QObject.Type; - } - - // This forwarding method is to get rid of compilation warnings when clients try to call - // #getName on the non-accessible parent. - @Override - public String getName() { - return super.getName(); - } - - public List findBases() throws CoreException { - ICPPClassType cppClassType = getCppClassType(); - if (cppClassType == null) - return Collections.emptyList(); - - List bases = new ArrayList<>(); - for (ICPPBase base : cppClassType.getBases()) { - if (base.getVisibility() != ICPPBase.v_public) - continue; - - IBinding baseCls = base.getBaseClass(); - if (baseCls == null) - continue; - - PDOMBinding pdomBinding = baseCls.getAdapter(PDOMBinding.class); - QtPDOMQObject baseQObj = ASTNameReference.findFromBinding(QtPDOMQObject.class, pdomBinding); - if (baseQObj != null) - bases.add(baseQObj); - } - - return bases; - } - - private static class ClassInfo { - public final String key; - public final String value; - - public ClassInfo(String key, String value) { - this.key = key; - this.value = value; - } - - public static final IQtPDOMCodec Codec = new IQtPDOMCodec<>() { - @Override - public int getElementSize() { - return 2 * Database.PTR_SIZE; - } - - @Override - public ClassInfo[] allocArray(int count) { - return new ClassInfo[count]; - } - - @Override - public ClassInfo decode(QtPDOMLinkage linkage, long record) throws CoreException { - long keyRec = linkage.getDB().getRecPtr(record); - long valRec = linkage.getDB().getRecPtr(record + Database.PTR_SIZE); - return new ClassInfo(linkage.getDB().getString(keyRec).getString(), - linkage.getDB().getString(valRec).getString()); - } - - @Override - public void encode(QtPDOMLinkage linkage, long record, ClassInfo element) throws CoreException { - // Delete the existing strings then create and store new ones. - long rec = linkage.getDB().getRecPtr(record); - if (rec != 0) - linkage.getDB().getString(rec).delete(); - linkage.getDB().putRecPtr(record, - element == null ? 0 : linkage.getDB().newString(element.key).getRecord()); - - rec = linkage.getDB().getRecPtr(record + Database.PTR_SIZE); - if (rec != 0) - linkage.getDB().getString(rec).delete(); - linkage.getDB().putRecPtr(record + Database.PTR_SIZE, - element == null ? 0 : linkage.getDB().newString(element.value).getRecord()); - } - }; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQmlRegistration.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQmlRegistration.java deleted file mode 100644 index 88d26f7c7d2..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQmlRegistration.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2014 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import java.util.Collection; -import java.util.Collections; - -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.cdt.internal.core.pdom.db.Database; -import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage; -import org.eclipse.core.runtime.CoreException; - -@SuppressWarnings("restriction") -public class QtPDOMQmlRegistration extends QtPDOMBinding { - - private static int offsetInitializer = QtPDOMBinding.Field.Last.offset; - - protected static enum Field { - CppRecord(Database.PTR_SIZE), QObjectName(Database.PTR_SIZE), Version(8), // Database doesn't have a LONG_SIZE - Uri(Database.PTR_SIZE), Major(8), Minor(8), QmlName(Database.PTR_SIZE), Last(0); - - public final int offset; - - private Field(int sizeof) { - this.offset = offsetInitializer; - offsetInitializer += sizeof; - } - } - - public QtPDOMQmlRegistration(QtPDOMLinkage linkage, long record) { - super(linkage, record); - } - - public QtPDOMQmlRegistration(QtPDOMLinkage linkage, QmlTypeRegistration qmlTypeReg, IASTName cppName) - throws CoreException { - super(linkage, null, qmlTypeReg); - - putStringOrNull(Field.QObjectName.offset, qmlTypeReg.getQObjectName()); - putLongOrNull(Field.Version.offset, qmlTypeReg.getVersion()); - putStringOrNull(Field.Uri.offset, qmlTypeReg.getUri()); - putLongOrNull(Field.Major.offset, qmlTypeReg.getMajor()); - putLongOrNull(Field.Minor.offset, qmlTypeReg.getMinor()); - putStringOrNull(Field.QmlName.offset, qmlTypeReg.getQmlName()); - } - - public static Collection findFor(QtPDOMQObject qobj) throws CoreException { - PDOMLinkage linkage = qobj.getLinkage(); - if (linkage == null || !(linkage instanceof QtPDOMLinkage)) - return Collections.emptyList(); - - String name = qobj.getName(); - if (name == null) - return Collections.emptyList(); - - QtPDOMLinkage qtLinkage = (QtPDOMLinkage) linkage; - return qtLinkage.getQmlRegistrations(qobj.getName()); - } - - @Override - protected int getRecordSize() { - return Field.Last.offset; - } - - @Override - public int getNodeType() { - return QtPDOMNodeType.QmlTypeRegistration.Type; - } - - public String getQObjectName() throws CoreException { - return getStringOrNull(Field.QObjectName.offset); - } - - public Long getVersion() throws CoreException { - return getLongOrNull(Field.Version.offset); - } - - public Long getMajor() throws CoreException { - return getLongOrNull(Field.Major.offset); - } - - public Long getMinor() throws CoreException { - return getLongOrNull(Field.Minor.offset); - } - - public String getUri() throws CoreException { - return getStringOrNull(Field.Uri.offset); - } - - public String getQmlName() throws CoreException { - return getStringOrNull(Field.QmlName.offset); - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQmlUncreatable.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQmlUncreatable.java deleted file mode 100644 index e97b3e94e04..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMQmlUncreatable.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2014 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.cdt.internal.core.pdom.db.Database; -import org.eclipse.core.runtime.CoreException; - -@SuppressWarnings("restriction") -public class QtPDOMQmlUncreatable extends QtPDOMQmlRegistration { - - private static int offsetInitializer = QtPDOMQmlRegistration.Field.Last.offset; - - protected static enum Field { - Reason(Database.PTR_SIZE), Last(0); - - public final int offset; - - private Field(int sizeof) { - this.offset = offsetInitializer; - offsetInitializer += sizeof; - } - } - - public QtPDOMQmlUncreatable(QtPDOMLinkage linkage, long record) { - super(linkage, record); - } - - public QtPDOMQmlUncreatable(QtPDOMLinkage linkage, QmlTypeRegistration qmlTypeReg, IASTName cppName) - throws CoreException { - super(linkage, qmlTypeReg, cppName); - - putStringOrNull(Field.Reason.offset, qmlTypeReg.getReason()); - } - - @Override - protected int getRecordSize() { - return Field.Last.offset; - } - - @Override - public int getNodeType() { - return QtPDOMNodeType.QmlUncreatableRegistration.Type; - } - - public String getReason() throws CoreException { - return getStringOrNull(Field.Reason.offset); - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMVisitor.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMVisitor.java deleted file mode 100644 index e423c75d964..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPDOMVisitor.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2013 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import java.util.ArrayList; -import java.util.Arrays; - -import org.eclipse.cdt.core.dom.IPDOMNode; -import org.eclipse.cdt.core.dom.IPDOMVisitor; -import org.eclipse.cdt.internal.core.pdom.dom.PDOMNamedNode; -import org.eclipse.core.runtime.CoreException; - -/** - * A Qt-specific specialization of the generic PDOMVisitor. This class provides - * an empty implementation of {@link #leave(IPDOMNode)}, but required implementations to - * provide {@link #visit(IPDOMNode)}. The class also provides a few commonly required - * implementations. - */ -@SuppressWarnings("restriction") -public abstract class QtPDOMVisitor implements IPDOMVisitor { - - /** - * Collects all nodes that match the given type. This could be used, for example, to get - * all QtPDOMQObject's from the index. - */ - public static class All extends QtPDOMVisitor { - - private final Class cls; - public final ArrayList list = new ArrayList<>(); - - public All(Class cls) { - this.cls = cls; - } - - @Override - @SuppressWarnings("unchecked") - public boolean visit(IPDOMNode node) throws CoreException { - if (node != null && cls.isAssignableFrom(node.getClass())) - list.add((T) node); - return true; - } - } - - /** - * A simple interface that is used to select node's from the index based on specific - * criteria. - */ - public static interface IFilter { - public boolean matches(IPDOMNode node) throws CoreException; - } - - /** - * A filter that selects nodes based on their name. - */ - public static class PDOMNamedNodeFilter implements IFilter { - - private final char[] name; - - public PDOMNamedNodeFilter(String name) { - this.name = name.toCharArray(); - } - - @Override - public boolean matches(IPDOMNode node) throws CoreException { - if (node instanceof PDOMNamedNode) - return Arrays.equals(name, ((PDOMNamedNode) node).getNameCharArray()); - return false; - } - } - - /** - * A utility class that searches the index for all nodes that match the given filter. - */ - public static class Find extends QtPDOMVisitor { - - private final Class cls; - private final IFilter filter; - - public T element; - - public Find(Class cls, IFilter filter) { - this.cls = cls; - this.filter = filter; - } - - @Override - @SuppressWarnings("unchecked") - public boolean visit(IPDOMNode node) throws CoreException { - if (element != null) - return false; - - if (cls.isAssignableFrom(node.getClass()) && filter.matches(node)) - element = (T) node; - - return element == null; - } - } - - @Override - public void leave(IPDOMNode node) throws CoreException { - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPropertyAttributeName.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPropertyAttributeName.java deleted file mode 100644 index 1dfc8394bde..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPropertyAttributeName.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2013 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import org.eclipse.cdt.core.dom.ast.IASTFileLocation; -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.core.runtime.CoreException; - -public class QtPropertyAttributeName extends ASTDelegatedName implements IQtASTName { - - private final QtASTImageLocation location; - - public QtPropertyAttributeName(IASTName ast, String name, QtASTImageLocation location) { - super(ast); - this.location = location; - } - - @Override - public IASTFileLocation getFileLocation() { - return location; - } - - @Override - public QtPDOMBinding createPDOMBinding(QtPDOMLinkage linkage) throws CoreException { - return null; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPropertyName.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPropertyName.java deleted file mode 100644 index f1eee967885..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/pdom/QtPropertyName.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2013, 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.cdt.internal.qt.core.pdom; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.cdt.core.dom.ast.IBinding; -import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; -import org.eclipse.cdt.internal.qt.core.index.IQProperty; -import org.eclipse.core.runtime.CoreException; - -@SuppressWarnings("restriction") -public class QtPropertyName extends AbstractQObjectMemberName implements IQtASTName { - - private String type; - // TODO The PDOM attrs should only be created in #createPDOMBinding - private List attributes = new ArrayList<>(); - - public QtPropertyName(QObjectName qobjName, IASTName ast, String name, QtASTImageLocation location) { - super(qobjName, ast, name, location); - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - /** - * This permits storage of duplicate attributes, a Codan checker should flag this as an error, but - * while the invalid code exists, the references should continue to be properly resolved. - */ - public void addAttribute(IQProperty.Attribute attr, String value) { - attributes.add(new QtPDOMProperty.Attribute(attr, value)); - } - - /** - * This permits storage of duplicate attributes, a Codan checker should flag this as an error, but - * while the invalid code exists, the references should continue to be properly resolved. - */ - public void addAttribute(IQProperty.Attribute attr, String value, IBinding cppBinding) { - PDOMBinding pdomBinding = cppBinding == null ? null : (PDOMBinding) cppBinding.getAdapter(PDOMBinding.class); - attributes.add(new QtPDOMProperty.Attribute(attr, value, pdomBinding)); - } - - @Override - public QtPDOMBinding createPDOMBinding(QtPDOMLinkage linkage) throws CoreException { - QtPDOMProperty pdom = new QtPDOMProperty(linkage, getOwner(linkage), this); - pdom.setAttributes(attributes.toArray(new QtPDOMProperty.Attribute[attributes.size()])); - return pdom; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/project/QtProjectGenerator.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/project/QtProjectGenerator.java deleted file mode 100644 index 85bea3446c0..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/project/QtProjectGenerator.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.project; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.eclipse.cdt.core.CCProjectNature; -import org.eclipse.cdt.core.CProjectNature; -import org.eclipse.cdt.core.model.CoreModel; -import org.eclipse.cdt.core.model.IPathEntry; -import org.eclipse.cdt.internal.qt.core.Activator; -import org.eclipse.cdt.internal.qt.core.QtNature; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.tools.templates.freemarker.FMProjectGenerator; -import org.eclipse.tools.templates.freemarker.SourceRoot; -import org.osgi.framework.Bundle; - -public class QtProjectGenerator extends FMProjectGenerator { - - public QtProjectGenerator(String manifestPath) { - super(manifestPath); - } - - @Override - protected void initProjectDescription(IProjectDescription description) { - description - .setNatureIds(new String[] { CProjectNature.C_NATURE_ID, CCProjectNature.CC_NATURE_ID, QtNature.ID }); - QtNature.setupBuilder(description); - } - - @Override - public Bundle getSourceBundle() { - return Activator.getDefault().getBundle(); - } - - @Override - public void generate(Map model, IProgressMonitor monitor) throws CoreException { - super.generate(model, monitor); - - // Create the source folders - IProject project = getProject(); - List entries = new ArrayList<>(); - List srcRoots = getManifest().getSrcRoots(); - if (srcRoots != null && !srcRoots.isEmpty()) { - for (SourceRoot srcRoot : srcRoots) { - IFolder sourceFolder = project.getFolder(srcRoot.getDir()); - if (!sourceFolder.exists()) { - sourceFolder.create(true, true, monitor); - } - - entries.add(CoreModel.newSourceEntry(sourceFolder.getFullPath())); - } - } else { - entries.add(CoreModel.newSourceEntry(getProject().getFullPath())); - } - - // build directory as output folder - entries.add(CoreModel.newOutputEntry(getProject().getFolder("build").getFullPath())); //$NON-NLS-1$ - - CoreModel.getDefault().create(project).setRawPathEntries(entries.toArray(new IPathEntry[entries.size()]), - monitor); - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/provider/HomebrewQtInstallProvider.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/provider/HomebrewQtInstallProvider.java deleted file mode 100644 index 68b9376a693..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/provider/HomebrewQtInstallProvider.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.provider; - -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; - -import org.eclipse.cdt.internal.qt.core.QtInstall; -import org.eclipse.cdt.qt.core.IQtInstall; -import org.eclipse.cdt.qt.core.IQtInstallProvider; -import org.eclipse.core.runtime.Platform; - -/** - * QtInstall provider for qt out of Homebrew. Unfortunately they don't put it on the path so we have - * to look where they put it. - */ -public class HomebrewQtInstallProvider implements IQtInstallProvider { - - @Override - public Collection getInstalls() { - if (Platform.getOS().equals(Platform.OS_MACOSX)) { - Path qmakePath = Paths.get("/usr/local/opt/qt5/bin/qmake"); //$NON-NLS-1$ - if (Files.exists(qmakePath)) { - return Arrays.asList(new QtInstall(qmakePath)); - } - } - return Collections.emptyList(); - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/provider/LinuxQtInstallProvider.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/provider/LinuxQtInstallProvider.java deleted file mode 100644 index f24cd3f955d..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/provider/LinuxQtInstallProvider.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.provider; - -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; - -import org.eclipse.cdt.core.build.IToolChain; -import org.eclipse.cdt.internal.qt.core.QtInstall; -import org.eclipse.cdt.qt.core.IQtInstall; -import org.eclipse.cdt.qt.core.IQtInstallProvider; -import org.eclipse.core.runtime.Platform; - -/** - * Qt install provider that looks for qmake on /usr/bin - */ -public class LinuxQtInstallProvider implements IQtInstallProvider { - - @Override - public Collection getInstalls() { - if (Platform.getOS().equals(Platform.OS_LINUX)) { - Path qmakePath = Paths.get("/usr/bin/qmake"); //$NON-NLS-1$ - if (Files.exists(qmakePath)) { - QtInstall install = new QtInstall(qmakePath); - install.setProperty(IToolChain.ATTR_PACKAGE, "system"); //$NON-NLS-1$ - return Arrays.asList(install); - } - } - return Collections.emptyList(); - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/provider/Msys2QtInstallProvider.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/provider/Msys2QtInstallProvider.java deleted file mode 100644 index 2b17369055d..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/provider/Msys2QtInstallProvider.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.provider; - -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.eclipse.cdt.core.build.IToolChain; -import org.eclipse.cdt.internal.qt.core.QtInstall; -import org.eclipse.cdt.qt.core.IQtInstall; -import org.eclipse.cdt.qt.core.IQtInstallProvider; -import org.eclipse.cdt.utils.WindowsRegistry; -import org.eclipse.core.runtime.Platform; - -/** - * QtInstall provider for Qt in MSYS2. Use the registry to find out where MSYS2 is installed. - */ -public class Msys2QtInstallProvider implements IQtInstallProvider { - - @Override - public Collection getInstalls() { - if (Platform.getOS().equals(Platform.OS_WIN32)) { - List installs = new ArrayList<>(); - // Look in the current user Uninstall key to look for the uninstaller - WindowsRegistry registry = WindowsRegistry.getRegistry(); - String uninstallKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"; //$NON-NLS-1$ - String subkey; - for (int i = 0; (subkey = registry.getCurrentUserKeyName(uninstallKey, i)) != null; i++) { - String compKey = uninstallKey + '\\' + subkey; - String displayName = registry.getCurrentUserValue(compKey, "DisplayName"); //$NON-NLS-1$ - // On Windows, look for MSYS2, MinGW 64/32 locations - if ("MSYS2 64bit".equals(displayName)) { //$NON-NLS-1$ - String installLocation = registry.getCurrentUserValue(compKey, "InstallLocation"); //$NON-NLS-1$ - Path qmakePath = Paths.get(installLocation + "\\mingw64\\bin\\qmake.exe"); //$NON-NLS-1$ - QtInstall install = new QtInstall(qmakePath); - install.setProperty(IToolChain.ATTR_PACKAGE, "msys2"); //$NON-NLS-1$ - installs.add(install); - } - } - return installs; - } else { - return Collections.emptyList(); - } - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/provider/QtInstallProvider.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/provider/QtInstallProvider.java deleted file mode 100644 index 1f73d24e2ce..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/provider/QtInstallProvider.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.provider; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Collection; -import java.util.Collections; -import java.util.stream.Collectors; - -import org.eclipse.cdt.codan.core.cxx.Activator; -import org.eclipse.cdt.core.build.IToolChain; -import org.eclipse.cdt.internal.qt.core.QtInstall; -import org.eclipse.cdt.qt.core.IQtInstall; -import org.eclipse.cdt.qt.core.IQtInstallProvider; -import org.eclipse.cdt.utils.WindowsRegistry; -import org.eclipse.core.runtime.Platform; - -/** - * Qt Install provider that attempts to find the Qt package as installed using Qt's own installer. - */ -public class QtInstallProvider implements IQtInstallProvider { - - private static boolean isWin32 = Platform.getOS().equals(Platform.OS_WIN32); - - @Override - public Collection getInstalls() { - Path root = getQtRoot(); - Path qmake = Paths.get(isWin32 ? "bin/qmake.exe" : "bin/qmake"); //$NON-NLS-1$ //$NON-NLS-2$ - if (root != null && Files.exists(root)) { - try { - return Files.walk(root, 2).filter((path) -> Files.exists(path.resolve(qmake))).map((path) -> { - QtInstall install = new QtInstall(path.resolve(qmake)); - if (isWin32 && "win32-g++".equals(install.getSpec())) { //$NON-NLS-1$ - install.setProperty(IToolChain.ATTR_PACKAGE, "qt"); //$NON-NLS-1$ - } - return install; - }).collect(Collectors.toList()); - } catch (IOException e) { - Activator.log(e); - } - } - return Collections.emptyList(); - } - - private Path getQtRoot() { - if (isWin32) { - WindowsRegistry registry = WindowsRegistry.getRegistry(); - String uninstallKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"; //$NON-NLS-1$ - String subkey; - for (int i = 0; (subkey = registry.getCurrentUserKeyName(uninstallKey, i)) != null; i++) { - String compKey = uninstallKey + '\\' + subkey; - String displayName = registry.getCurrentUserValue(compKey, "DisplayName"); //$NON-NLS-1$ - if ("Qt".equals(displayName)) { //$NON-NLS-1$ - String installLocation = registry.getCurrentUserValue(compKey, "InstallLocation"); //$NON-NLS-1$ - return Paths.get(installLocation); - } - } - } else { - Path qtDir = Paths.get(System.getProperty("user.home"), "Qt"); //$NON-NLS-1$ //$NON-NLS-2$ - if (Files.exists(qtDir)) { - return qtDir; - } - } - return null; - } - - // gcc is in C:\Qt\Tools\mingw492_32\bin -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirAST.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirAST.java deleted file mode 100644 index c1dedc3c07e..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirAST.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.qmldir; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.cdt.qt.core.qmldir.IQDirAST; -import org.eclipse.cdt.qt.core.qmldir.IQDirCommand; - -public class QDirAST extends QDirASTNode implements IQDirAST { - private final List commands; - - public QDirAST() { - commands = new ArrayList<>(); - } - - public void addCommand(IQDirCommand command) { - commands.add(command); - } - - @Override - public List getCommands() { - return Collections.unmodifiableList(commands); - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirASTNode.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirASTNode.java deleted file mode 100644 index 6468fb807e8..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirASTNode.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.qmldir; - -import org.eclipse.cdt.internal.qt.core.location.SourceLocation; -import org.eclipse.cdt.qt.core.qmldir.IQDirASTNode; - -public class QDirASTNode implements IQDirASTNode { - - private SourceLocation location; - private int start; - private int end; - - public QDirASTNode() { - this.location = new SourceLocation(); - this.start = -1; - this.end = -1; - } - - public void setLocation(SourceLocation value) { - this.location = value; - } - - @Override - public SourceLocation getLocation() { - return location; - } - - public void setStart(int value) { - this.start = value; - } - - @Override - public int getStart() { - return start; - } - - public void setEnd(int value) { - this.end = value; - } - - @Override - public int getEnd() { - return end; - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirClassnameCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirClassnameCommand.java deleted file mode 100644 index 27e7742e67e..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirClassnameCommand.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.qmldir.IQDirClassnameCommand; - -public class QDirClassnameCommand extends QDirASTNode implements IQDirClassnameCommand { - - private QDirWord ident; - - public void setIdentifier(QDirWord value) { - this.ident = value; - } - - @Override - public QDirWord getIdentifier() { - return ident; - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirCommentCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirCommentCommand.java deleted file mode 100644 index c1db457d6e6..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirCommentCommand.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.qmldir.IQDirCommentCommand; - -public class QDirCommentCommand extends QDirASTNode implements IQDirCommentCommand { - - private String text; - - public void setText(String value) { - this.text = value; - } - - @Override - public String getText() { - return text; - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirDependsCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirDependsCommand.java deleted file mode 100644 index c4ad5e2f136..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirDependsCommand.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.qmldir.IQDirDependsCommand; - -public class QDirDependsCommand extends QDirASTNode implements IQDirDependsCommand { - - private QDirWord moduleName; - private QDirVersion version; - - public void setModuleIdentifier(QDirWord value) { - this.moduleName = value; - } - - @Override - public QDirWord getModuleIdentifier() { - return moduleName; - } - - public void setInitialVersion(QDirVersion value) { - this.version = value; - } - - @Override - public QDirVersion getInitialVersion() { - return version; - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirDesignerSupportedCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirDesignerSupportedCommand.java deleted file mode 100644 index 62d7a099d43..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirDesignerSupportedCommand.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.qmldir.IQDirDesignerSupportedCommand; - -public class QDirDesignerSupportedCommand extends QDirASTNode implements IQDirDesignerSupportedCommand { -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirInternalCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirInternalCommand.java deleted file mode 100644 index 6f785b3870d..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirInternalCommand.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.qmldir.IQDirInternalCommand; - -public class QDirInternalCommand extends QDirASTNode implements IQDirInternalCommand { - - private QDirWord typeName; - private QDirWord file; - - public void setTypeName(QDirWord value) { - this.typeName = value; - } - - @Override - public QDirWord getTypeName() { - return typeName; - } - - public void setFile(QDirWord value) { - this.file = value; - } - - @Override - public QDirWord getFile() { - return file; - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirModuleCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirModuleCommand.java deleted file mode 100644 index 98da31e464c..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirModuleCommand.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.qmldir.IQDirModuleCommand; - -public class QDirModuleCommand extends QDirASTNode implements IQDirModuleCommand { - private QDirWord identifier; - - public void setModuleIdentifier(QDirWord value) { - this.identifier = value; - } - - @Override - public QDirWord getModuleIdentifier() { - return identifier; - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirPluginCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirPluginCommand.java deleted file mode 100644 index afd1c14e320..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirPluginCommand.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.qmldir.IQDirPluginCommand; - -public class QDirPluginCommand extends QDirASTNode implements IQDirPluginCommand { - - private QDirWord qid; - private QDirWord path; - - public void setName(QDirWord value) { - this.qid = value; - } - - @Override - public QDirWord getName() { - return qid; - } - - public void setPath(QDirWord value) { - this.path = value; - } - - @Override - public QDirWord getPath() { - return path; - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirResourceCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirResourceCommand.java deleted file mode 100644 index c2c90844c82..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirResourceCommand.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.qmldir.IQDirResourceCommand; - -public class QDirResourceCommand extends QDirASTNode implements IQDirResourceCommand { - private QDirWord typeName; - private QDirVersion version; - private QDirWord file; - - public void setResourceIdentifier(QDirWord value) { - this.typeName = value; - } - - @Override - public QDirWord getResourceIdentifier() { - return typeName; - } - - public void setInitialVersion(QDirVersion value) { - this.version = value; - } - - @Override - public QDirVersion getInitialVersion() { - return version; - } - - public void setFile(QDirWord value) { - this.file = value; - } - - @Override - public QDirWord getFile() { - return file; - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirSingletonCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirSingletonCommand.java deleted file mode 100644 index d3fe5461cc3..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirSingletonCommand.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.qmldir.IQDirSingletonCommand; - -public class QDirSingletonCommand extends QDirASTNode implements IQDirSingletonCommand { - - private QDirWord typeName; - private QDirVersion version; - private QDirWord file; - - public void setTypeName(QDirWord value) { - this.typeName = value; - } - - @Override - public QDirWord getTypeName() { - return typeName; - } - - public void setInitialVersion(QDirVersion value) { - this.version = value; - } - - @Override - public QDirVersion getInitialVersion() { - return version; - } - - public void setFile(QDirWord value) { - this.file = value; - } - - @Override - public QDirWord getFile() { - return file; - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirSyntaxError.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirSyntaxError.java deleted file mode 100644 index 591c9dd5129..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirSyntaxError.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.qmldir.IQDirASTNode; -import org.eclipse.cdt.qt.core.qmldir.IQDirSyntaxError; -import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryLexer.Token; -import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryParser.SyntaxError; - -public class QDirSyntaxError extends QDirASTNode implements IQDirSyntaxError { - private SyntaxError exception; - - public QDirSyntaxError(SyntaxError exception) { - this.exception = exception; - } - - @Override - public Token getOffendingToken() { - return this.exception.getOffendingToken(); - } - - @Override - public IQDirASTNode getIncompleteNode() { - return this.exception.getIncompleteNode(); - } - - @Override - public SyntaxError getSyntaxError() { - return this.exception; - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirTypeInfoCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirTypeInfoCommand.java deleted file mode 100644 index 33424e97673..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirTypeInfoCommand.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.qmldir.IQDirTypeInfoCommand; - -public class QDirTypeInfoCommand extends QDirASTNode implements IQDirTypeInfoCommand { - - private QDirWord file; - - public void setFile(QDirWord value) { - this.file = value; - } - - @Override - public QDirWord getFile() { - return file; - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirVersion.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirVersion.java deleted file mode 100644 index 95fa819ba25..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirVersion.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.qmldir.IQDirVersion; - -public class QDirVersion extends QDirASTNode implements IQDirVersion { - - private String version; - - public void setVersionString(String value) { - this.version = value; - } - - @Override - public String getVersionString() { - return version; - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirWord.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirWord.java deleted file mode 100644 index 444e9e2fb82..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirWord.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.qmldir.IQDirWord; - -public class QDirWord extends QDirASTNode implements IQDirWord { - - private String text; - - public void setText(String value) { - this.text = value; - } - - @Override - public String getText() { - return text; - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLComponentInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLComponentInfo.java deleted file mode 100644 index de2dc363dd8..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLComponentInfo.java +++ /dev/null @@ -1,142 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.qmltypes; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectDefinition; -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectMember; -import org.eclipse.cdt.qt.core.qmljs.IQmlPropertyBinding; - -public class QMLComponentInfo { - static final String IDENTIFIER = "Component"; //$NON-NLS-1$ - - static final String PROPERTY_NAME = "name"; //$NON-NLS-1$ - static final String PROPERTY_PROTOTYPE = "prototype"; //$NON-NLS-1$ - static final String PROPERTY_DEF_PROPERTY = "defaultProperty"; //$NON-NLS-1$ - static final String PROPERTY_ATTACHED_TYPE = "attachedType"; //$NON-NLS-1$ - static final String PROPERTY_EXPORTS = "exports"; //$NON-NLS-1$ - static final String PROPERTY_EXPORT_REVISIONS = "exportMetaObjectRevisions"; //$NON-NLS-1$ - - private String name; - private String prototype; - private String defaultProperty; - private String attachedType; - private Integer[] exportMetaObjectRevisions; - private List exportList = new ArrayList<>(); - private List propertyList = new ArrayList<>(); - private List methodList = new ArrayList<>(); - private List signalList = new ArrayList<>(); - private List enumList = new ArrayList<>(); - - protected QMLComponentInfo(QMLModelBuilder builder, IQmlObjectDefinition obj) { - builder.ensureIdentifier(obj.getIdentifier(), IDENTIFIER); - for (IQmlObjectMember member : obj.getBody().getMembers()) { - if (member instanceof IQmlPropertyBinding) { - IQmlPropertyBinding prop = (IQmlPropertyBinding) member; - switch (prop.getIdentifier().getName()) { - case PROPERTY_NAME: - this.name = builder.getStringBinding(prop); - break; - case PROPERTY_PROTOTYPE: - this.prototype = builder.getStringBinding(prop); - break; - case PROPERTY_DEF_PROPERTY: - this.defaultProperty = builder.getStringBinding(prop); - break; - case PROPERTY_ATTACHED_TYPE: - this.attachedType = builder.getStringBinding(prop); - break; - case PROPERTY_EXPORTS: - String[] exports = builder.getStringArrayBinding(prop); - for (String exp : exports) { - this.exportList.add(new QMLExportInfo(builder, exp)); - } - break; - case PROPERTY_EXPORT_REVISIONS: - this.exportMetaObjectRevisions = builder.getIntegerArrayBinding(prop); - break; - default: - } - } else if (member instanceof IQmlObjectDefinition) { - IQmlObjectDefinition object = (IQmlObjectDefinition) member; - switch (object.getIdentifier().getName()) { - case QMLPropertyInfo.IDENTIFIER: - this.propertyList.add(new QMLPropertyInfo(builder, object)); - break; - case QMLMethodInfo.IDENTIFIER: - this.methodList.add(new QMLMethodInfo(builder, object)); - break; - case QMLSignalInfo.IDENTIFIER: - this.signalList.add(new QMLSignalInfo(builder, object)); - break; - case QMLEnumInfo.IDENTIFIER: - this.enumList.add(new QMLEnumInfo(builder, object)); - break; - default: - } - } else { - builder.unexpectedNode(member); - } - } - exportList = Collections.unmodifiableList(exportList); - propertyList = Collections.unmodifiableList(propertyList); - methodList = Collections.unmodifiableList(methodList); - signalList = Collections.unmodifiableList(signalList); - enumList = Collections.unmodifiableList(enumList); - } - - public String getName() { - return name; - } - - public String getPrototype() { - return prototype; - } - - public String getDefaultProperty() { - return defaultProperty; - } - - public String getAttachedType() { - return attachedType; - } - - public List getExports() { - return exportList; - } - - public Integer[] getExportMetaObjectRevisions() { - return Arrays.copyOf(exportMetaObjectRevisions, exportMetaObjectRevisions.length); - } - - public List getProperties() { - return propertyList; - } - - public List getMethods() { - return methodList; - } - - public List getSignals() { - return signalList; - } - - public List getEnums() { - return enumList; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLEnumInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLEnumInfo.java deleted file mode 100644 index 1c93f82f791..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLEnumInfo.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.qmltypes; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.cdt.qt.core.qmljs.IJSObjectExpression; -import org.eclipse.cdt.qt.core.qmljs.IJSProperty; -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectDefinition; -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectMember; -import org.eclipse.cdt.qt.core.qmljs.IQmlPropertyBinding; -import org.eclipse.cdt.qt.core.qmljs.IQmlScriptBinding; -import org.eclipse.cdt.qt.core.qmljs.QMLExpressionEvaluator; -import org.eclipse.cdt.qt.core.qmljs.QMLExpressionEvaluator.InvalidExpressionException; - -public class QMLEnumInfo { - public static class EnumConst { - private final String identifier; - private final int value; - - private EnumConst(String ident, int val) { - this.identifier = ident; - this.value = val; - } - - public String getIdentifier() { - return identifier; - } - - public int getValue() { - return value; - } - } - - static final String IDENTIFIER = "Enum"; //$NON-NLS-1$ - - static final String PROPERTY_NAME = "name"; //$NON-NLS-1$ - static final String PROPERTY_VALUE = "values"; //$NON-NLS-1$ - - private String name; - private List constantList = new ArrayList<>(); - - QMLEnumInfo(QMLModelBuilder builder, IQmlObjectDefinition obj) { - if (builder.ensureIdentifier(obj.getIdentifier(), IDENTIFIER)) { - for (IQmlObjectMember member : obj.getBody().getMembers()) { - if (builder.ensureNode(member, IQmlPropertyBinding.class)) { - IQmlPropertyBinding prop = (IQmlPropertyBinding) member; - switch (prop.getIdentifier().getName()) { - case PROPERTY_NAME: - this.name = builder.getStringBinding(prop); - break; - case PROPERTY_VALUE: - if (builder.ensureNode(prop.getBinding(), IQmlScriptBinding.class)) { - IQmlScriptBinding binding = ((IQmlScriptBinding) prop.getBinding()); - if (builder.ensureNode(binding.getScript(), IJSObjectExpression.class)) { - IJSObjectExpression objExpr = (IJSObjectExpression) binding.getScript(); - for (IJSProperty property : objExpr.getProperties()) { - Object value; - try { - value = QMLExpressionEvaluator.evaluateConstExpr(property.getValue()); - if (value instanceof Number) { - constantList.add( - new EnumConst(property.getType(), ((Number) value).intValue())); - } - } catch (InvalidExpressionException e) { - builder.handleException(e); - } - } - } - } - break; - default: - } - } - } - } - constantList = Collections.unmodifiableList(constantList); - } - - public String getName() { - return name; - } - - public List getConstants() { - return constantList; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLExportInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLExportInfo.java deleted file mode 100644 index ac2e5c008a8..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLExportInfo.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.qmltypes; - -public class QMLExportInfo { - private String type; - private String version; - - QMLExportInfo(QMLModelBuilder builder, String export) { - String[] info = export.split("\\h+"); //$NON-NLS-1$ - switch (info.length) { - case 2: - this.type = info[0]; - this.version = info[1]; - break; - case 1: - this.type = info[0]; - break; - } - } - - public String getType() { - return type; - } - - public String getVersion() { - return version; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLMethodInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLMethodInfo.java deleted file mode 100644 index 1d58e4eca18..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLMethodInfo.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.qmltypes; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectDefinition; -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectMember; -import org.eclipse.cdt.qt.core.qmljs.IQmlPropertyBinding; - -public class QMLMethodInfo { - static final String IDENTIFIER = "Method"; //$NON-NLS-1$ - - static final String PROPERTY_NAME = "name"; //$NON-NLS-1$ s - static final String PROPERTY_TYPE = "type"; //$NON-NLS-1$ - static final String PROPERTY_REVISION = "revision"; //$NON-NLS-1$ - - private String name; - private String type; - private int revision; - private List parameterList = new ArrayList<>(); - - QMLMethodInfo(QMLModelBuilder builder, IQmlObjectDefinition obj) { - if (builder.ensureIdentifier(obj.getIdentifier(), IDENTIFIER)) { - for (IQmlObjectMember member : obj.getBody().getMembers()) { - if (member instanceof IQmlPropertyBinding) { - IQmlPropertyBinding prop = (IQmlPropertyBinding) member; - switch (prop.getIdentifier().getName()) { - case PROPERTY_NAME: - this.name = builder.getStringBinding(prop); - break; - case PROPERTY_TYPE: - this.type = builder.getStringBinding(prop); - break; - case PROPERTY_REVISION: - this.revision = builder.getIntegerBinding(prop); - break; - default: - } - } else if (member instanceof IQmlObjectDefinition) { - this.parameterList.add(new QMLParameterInfo(builder, (IQmlObjectDefinition) member)); - } else { - builder.unexpectedNode(member); - } - } - } - } - - public String getName() { - return name; - } - - public String getType() { - return type; - } - - public int getRevision() { - return revision; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLModelBuilder.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLModelBuilder.java deleted file mode 100644 index 4d42811659c..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLModelBuilder.java +++ /dev/null @@ -1,195 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.qmltypes; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.cdt.internal.qt.core.Activator; -import org.eclipse.cdt.qt.core.qmljs.IJSArrayExpression; -import org.eclipse.cdt.qt.core.qmljs.IJSExpression; -import org.eclipse.cdt.qt.core.qmljs.IQmlASTNode; -import org.eclipse.cdt.qt.core.qmljs.IQmlBinding; -import org.eclipse.cdt.qt.core.qmljs.IQmlProgram; -import org.eclipse.cdt.qt.core.qmljs.IQmlPropertyBinding; -import org.eclipse.cdt.qt.core.qmljs.IQmlQualifiedID; -import org.eclipse.cdt.qt.core.qmljs.IQmlRootObject; -import org.eclipse.cdt.qt.core.qmljs.IQmlScriptBinding; -import org.eclipse.cdt.qt.core.qmljs.QMLExpressionEvaluator; -import org.eclipse.cdt.qt.core.qmljs.QMLExpressionEvaluator.InvalidExpressionException; - -public class QMLModelBuilder { - - private final Map moduleMap = new HashMap<>(); - - public QMLModelBuilder() { - } - - public QMLModuleInfo addModule(String module, IQmlASTNode ast) { - QMLModuleInfo info = moduleMap.get(module); - if (!moduleMap.containsKey(module)) { - if (ensureNode(ast, IQmlProgram.class)) { - IQmlRootObject obj = ((IQmlProgram) ast).getRootObject(); - if (ensureNode(obj, IQmlRootObject.class)) { - info = new QMLModuleInfo(this, obj); - moduleMap.put(module, info); - } - } - } - return info; - } - - public QMLModuleInfo getModule(String module) { - return moduleMap.get(module); - } - - public boolean hasModule(String module) { - return moduleMap.get(module) != null; - } - - boolean ensureIdentifier(IQmlQualifiedID actual, String expected) { - if (!actual.getName().equals(expected)) { - Activator.log("[QmlTypes] Unexpected node identifier: expected '" + expected + "', but was '" //$NON-NLS-1$ //$NON-NLS-2$ - + actual.getName() + "'"); //$NON-NLS-1$ - return false; - } - return true; - } - - boolean ensureNode(IQmlASTNode actual, Class expected) { - if (!expected.isInstance(actual)) { - Activator.log("[QmlTypes] Expected node '" + expected + "', but was '" //$NON-NLS-1$//$NON-NLS-2$ - + actual.getClass().getInterfaces()[0] + "'"); //$NON-NLS-1$ - return false; - } - return true; - } - - boolean ensureValue(Object actual, Class expected) { - if (!expected.isInstance(actual)) { - Activator.log("[QmlTypes] Unexpected value: expected '" + expected + "', but was '" //$NON-NLS-1$ //$NON-NLS-2$ - + actual.getClass().getInterfaces()[0] + "'"); //$NON-NLS-1$ - return false; - } - return true; - } - - void unexpectedNode(IQmlASTNode node) { - Activator.log("[QmlTypes] Unexpected node '" + node.getClass().getInterfaces()[0] + "'"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - String getStringBinding(IQmlPropertyBinding prop) { - IQmlBinding b = prop.getBinding(); - if (ensureNode(b, IQmlScriptBinding.class)) { - IQmlScriptBinding sb = (IQmlScriptBinding) b; - if (ensureNode(sb.getScript(), IJSExpression.class)) { - try { - Object value = QMLExpressionEvaluator.evaluateConstExpr((IJSExpression) sb.getScript()); - if (value instanceof String) { - return (String) value; - } - } catch (InvalidExpressionException e) { - handleException(e); - } - } - } - return null; - } - - String[] getStringArrayBinding(IQmlPropertyBinding prop) { - ArrayList result = new ArrayList<>(); - IQmlBinding b = prop.getBinding(); - if (ensureNode(b, IQmlScriptBinding.class)) { - IQmlScriptBinding sb = (IQmlScriptBinding) b; - if (ensureNode(sb.getScript(), IJSArrayExpression.class)) { - IJSArrayExpression arrExpr = (IJSArrayExpression) sb.getScript(); - for (IJSExpression expr : arrExpr.getElements()) { - try { - Object value = QMLExpressionEvaluator.evaluateConstExpr(expr); - if (value instanceof String) { - result.add((String) value); - } - } catch (InvalidExpressionException e) { - handleException(e); - } - } - } - } - return result.toArray(new String[result.size()]); - } - - public Integer[] getIntegerArrayBinding(IQmlPropertyBinding prop) { - ArrayList result = new ArrayList<>(); - IQmlBinding b = prop.getBinding(); - if (ensureNode(b, IQmlScriptBinding.class)) { - IQmlScriptBinding sb = (IQmlScriptBinding) b; - if (ensureNode(sb.getScript(), IJSArrayExpression.class)) { - IJSArrayExpression arrExpr = (IJSArrayExpression) sb.getScript(); - for (IJSExpression expr : arrExpr.getElements()) { - try { - Object value = QMLExpressionEvaluator.evaluateConstExpr(expr); - if (value instanceof Number) { - result.add(((Number) value).intValue()); - } - } catch (InvalidExpressionException e) { - handleException(e); - } - } - } - } - return result.toArray(new Integer[result.size()]); - } - - boolean getBooleanBinding(IQmlPropertyBinding prop) { - IQmlBinding b = prop.getBinding(); - if (ensureNode(b, IQmlScriptBinding.class)) { - IQmlScriptBinding sb = (IQmlScriptBinding) b; - if (ensureNode(sb.getScript(), IJSExpression.class)) { - try { - Object value = QMLExpressionEvaluator.evaluateConstExpr((IJSExpression) sb.getScript()); - if (value instanceof Number) { - return (Boolean) value; - } - } catch (InvalidExpressionException e) { - handleException(e); - } - } - } - return false; - } - - public Integer getIntegerBinding(IQmlPropertyBinding prop) { - IQmlBinding b = prop.getBinding(); - if (ensureNode(b, IQmlScriptBinding.class)) { - IQmlScriptBinding sb = (IQmlScriptBinding) b; - if (ensureNode(sb.getScript(), IJSExpression.class)) { - try { - Object value = QMLExpressionEvaluator.evaluateConstExpr((IJSExpression) sb.getScript()); - if (value instanceof Number) { - return ((Number) value).intValue(); - } - } catch (InvalidExpressionException e) { - handleException(e); - } - } - } - return 0; - } - - public void handleException(Throwable t) { - Activator.log("[QmlTypes] " + t.getMessage()); //$NON-NLS-1$ - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLModuleInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLModuleInfo.java deleted file mode 100644 index 12c3de6b10c..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLModuleInfo.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.qmltypes; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectDefinition; -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectMember; -import org.eclipse.cdt.qt.core.qmljs.IQmlRootObject; - -public class QMLModuleInfo { - static final String IDENTIFIER = "Module"; //$NON-NLS-1$ - - private List componentsList = new ArrayList<>(); - - QMLModuleInfo(QMLModelBuilder builder, IQmlRootObject obj) { - if (builder.ensureIdentifier(obj.getIdentifier(), IDENTIFIER)) { - for (IQmlObjectMember member : obj.getBody().getMembers()) { - if (builder.ensureNode(member, IQmlObjectDefinition.class)) { - componentsList.add(new QMLComponentInfo(builder, (IQmlObjectDefinition) member)); - } - } - } - componentsList = Collections.unmodifiableList(componentsList); - } - - public List getComponents() { - return componentsList; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLParameterInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLParameterInfo.java deleted file mode 100644 index c5aec6f5b9a..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLParameterInfo.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.qmltypes; - -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectDefinition; -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectMember; -import org.eclipse.cdt.qt.core.qmljs.IQmlPropertyBinding; - -public class QMLParameterInfo { - static final String IDENTIFIER = "Parameter"; //$NON-NLS-1$ - - static final String PROPERTY_NAME = "name"; //$NON-NLS-1$ - static final String PROPERTY_TYPE = "type"; //$NON-NLS-1$ - - private String name; - private String type; - - QMLParameterInfo(QMLModelBuilder builder, IQmlObjectDefinition obj) { - if (builder.ensureIdentifier(obj.getIdentifier(), IDENTIFIER)) { - for (IQmlObjectMember member : obj.getBody().getMembers()) { - if (builder.ensureNode(member, IQmlPropertyBinding.class)) { - IQmlPropertyBinding prop = (IQmlPropertyBinding) member; - switch (prop.getIdentifier().getName()) { - case PROPERTY_NAME: - this.name = builder.getStringBinding(prop); - break; - case PROPERTY_TYPE: - this.type = builder.getStringBinding(prop); - break; - default: - } - } - } - } - } - - public String getName() { - return name; - } - - public String getType() { - return type; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLPropertyInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLPropertyInfo.java deleted file mode 100644 index 01bf5f4f329..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLPropertyInfo.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.qmltypes; - -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectDefinition; -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectMember; -import org.eclipse.cdt.qt.core.qmljs.IQmlPropertyBinding; - -public class QMLPropertyInfo { - static final String IDENTIFIER = "Property"; //$NON-NLS-1$ - - static final String PROPERTY_NAME = "name"; //$NON-NLS-1$ - static final String PROPERTY_TYPE = "type"; //$NON-NLS-1$ - static final String PROPERTY_READONLY = "isReadonly"; //$NON-NLS-1$ - static final String PROPERTY_POINTER = "isPointer"; //$NON-NLS-1$ - static final String PROPERTY_LIST = "isList"; //$NON-NLS-1$ - static final String PROPERTY_REVISION = "revision"; //$NON-NLS-1$ - - private String name; - private String type; - private boolean readonly = false; - private boolean pointer = false; - private boolean list = false; - private int revision; - - QMLPropertyInfo(QMLModelBuilder builder, IQmlObjectDefinition obj) { - if (builder.ensureIdentifier(obj.getIdentifier(), IDENTIFIER)) { - for (IQmlObjectMember member : obj.getBody().getMembers()) { - if (builder.ensureNode(member, IQmlPropertyBinding.class)) { - IQmlPropertyBinding prop = (IQmlPropertyBinding) member; - switch (prop.getIdentifier().getName()) { - case PROPERTY_NAME: - this.name = builder.getStringBinding(prop); - break; - case PROPERTY_TYPE: - this.type = builder.getStringBinding(prop); - break; - case PROPERTY_READONLY: - this.readonly = builder.getBooleanBinding(prop); - break; - case PROPERTY_POINTER: - this.pointer = builder.getBooleanBinding(prop); - break; - case PROPERTY_LIST: - this.list = builder.getBooleanBinding(prop); - break; - case PROPERTY_REVISION: - this.revision = builder.getIntegerBinding(prop); - break; - default: - } - } - } - } - } - - public String getName() { - return name; - } - - public String getType() { - return type; - } - - public int getRevision() { - return revision; - } - - public boolean isReadonly() { - return readonly; - } - - public boolean isPointer() { - return pointer; - } - - public boolean isList() { - return list; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLSignalInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLSignalInfo.java deleted file mode 100644 index 56dd5f862f8..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLSignalInfo.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core.qmltypes; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectDefinition; -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectMember; -import org.eclipse.cdt.qt.core.qmljs.IQmlPropertyBinding; - -public class QMLSignalInfo { - static final String IDENTIFIER = "Signal"; //$NON-NLS-1$ - - static final String PROPERTY_NAME = "name"; //$NON-NLS-1$ s - static final String PROPERTY_TYPE = "type"; //$NON-NLS-1$ - static final String PROPERTY_REVISION = "revision"; //$NON-NLS-1$ - - private String name; - private String type; - private Integer revision; - private List parameterList = new ArrayList<>(); - - QMLSignalInfo(QMLModelBuilder builder, IQmlObjectDefinition obj) { - if (builder.ensureIdentifier(obj.getIdentifier(), IDENTIFIER)) { - for (IQmlObjectMember member : obj.getBody().getMembers()) { - if (member instanceof IQmlPropertyBinding) { - IQmlPropertyBinding prop = (IQmlPropertyBinding) member; - switch (prop.getIdentifier().getName()) { - case PROPERTY_NAME: - this.name = builder.getStringBinding(prop); - break; - case PROPERTY_TYPE: - this.type = builder.getStringBinding(prop); - break; - case PROPERTY_REVISION: - this.revision = builder.getIntegerBinding(prop); - break; - default: - } - } else if (member instanceof IQmlObjectDefinition) { - this.parameterList.add(new QMLParameterInfo(builder, (IQmlObjectDefinition) member)); - } else { - builder.unexpectedNode(member); - } - } - } - } - - public String getName() { - return name; - } - - public String getType() { - return type; - } - - public int getRevision() { - return revision; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQMLAnalyzer.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQMLAnalyzer.java deleted file mode 100644 index 6a4e5591731..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQMLAnalyzer.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core; - -import java.io.IOException; -import java.util.Collection; -import java.util.List; - -import javax.script.Bindings; -import javax.script.ScriptException; - -import org.eclipse.cdt.qt.core.qmljs.IQmlASTNode; - -public interface IQMLAnalyzer { - - /** - * Added in CDT 10.0.1 with no version bump. See Bug 567124. - * @since 2.3 - */ - default boolean isSupported() { - return true; - } - - void addFile(String fileName, String code) throws NoSuchMethodException, ScriptException; - - void deleteFile(String fileName) throws NoSuchMethodException, ScriptException; - - IQmlASTNode parseFile(String fileName, String text) throws NoSuchMethodException, ScriptException; - - IQmlASTNode parseString(String text) throws NoSuchMethodException, ScriptException; - - IQmlASTNode parseString(String text, String mode, boolean locations, boolean ranges) - throws NoSuchMethodException, ScriptException; - - Collection getCompletions(String fileName, String text, int pos) - throws NoSuchMethodException, ScriptException; - - Collection getCompletions(String fileName, String text, int pos, boolean includeKeywords) - throws NoSuchMethodException, ScriptException; - - List getDefinition(String identifier, String fileName, String text, int pos) - throws NoSuchMethodException, ScriptException; - - void load() throws ScriptException, IOException, NoSuchMethodException; - -} \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtBuildConfiguration.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtBuildConfiguration.java deleted file mode 100644 index a1e7d0d3bb3..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtBuildConfiguration.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.cdt.qt.core; - -import java.nio.file.Path; - -import org.eclipse.cdt.core.build.ICBuildConfiguration; -import org.eclipse.core.runtime.CoreException; - -/** - * Qt specific build configuration settings. - * - * @noimplement - */ -public interface IQtBuildConfiguration extends ICBuildConfiguration { - - Path getBuildDirectory() throws CoreException; - - Path getQmakeCommand(); - - String[] getQmakeConfig(); - - /** - * @deprecated use getBuildOutput() instead - */ - @Deprecated - Path getProgramPath() throws CoreException; - - @Override - String getLaunchMode(); - - IQtInstall getQtInstall(); - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtInstall.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtInstall.java deleted file mode 100644 index db243408c0f..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtInstall.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.cdt.qt.core; - -import java.nio.file.Path; -import java.util.Map; - -/** - * Represents an installation of the Qt SDK. Qt installs are defined by the path - * to the qmake executable. - * - * @noimplement - */ -public interface IQtInstall { - - Path getQmakePath(); - - String getSpec(); - - Path getLibPath(); - - Path getQmlPath(); - - void setProperty(String key, String value); - - Map getProperties(); - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtInstallListener.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtInstallListener.java deleted file mode 100644 index ff2f3a3c16b..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtInstallListener.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.eclipse.cdt.qt.core; - -/** - * @since 2.1 - */ -public interface IQtInstallListener { - - void installChanged(QtInstallEvent event); - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtInstallManager.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtInstallManager.java deleted file mode 100644 index d594936649b..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtInstallManager.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.cdt.qt.core; - -import java.nio.file.Path; -import java.util.Collection; - -import org.eclipse.cdt.core.build.IToolChain; - -/** - * The manager for Qt Installs. Qt Installs are Qt installation trees that are produced in a Qt - * platform build. They have a spec which selects the os and cpu architecture and are managed by an - * instance of the qmake builder. - * - * @noimplement - */ -public interface IQtInstallManager { - - /** - * Returns all the registered Qt installs. - * - * @return all Qt Installs - */ - public Collection getInstalls(); - - /** - * Register a new Qt Install - * - * @param install - * new Qt Install - */ - public void addInstall(IQtInstall install); - - /** - * Return a Qt install that is managed by the given qmake. - * - * @param qmakePath - * path to qmake - * @return QT install managed by that qmake - */ - public IQtInstall getInstall(Path qmakePath); - - /** - * Returns the Qt installs that have the matching spec. - * - * @param spec - * spec for the Qt installs, e.g. macosx-clang - * @return all Qt installs that have that spec - */ - public Collection getInstall(String spec); - - /** - * Deregister a given Qt install - * - * @param install - * Qt install to deregister - */ - public void removeInstall(IQtInstall install); - - /** - * Check whether the given toolchain supports the given Qt Install. This is done by checking the - * OS and CPU arch of the toolchain and returning whether the Qt install supports that - * combination. - * - * @param install - * Qt Install to check - * @param toolChain - * Toolchain to check against - * @return whether the Qt install supports that toolchain - */ - public boolean supports(IQtInstall install, IToolChain toolChain); - - /** - * Add a listener for Qt install changes - * - * @param listener - * listener to add - */ - public void addListener(IQtInstallListener listener); - - /** - * Remove a listener for Qt install changes - * - * @param listener - * listener to remove - */ - public void removeListener(IQtInstallListener listener); - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtInstallProvider.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtInstallProvider.java deleted file mode 100644 index e4c001522e2..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtInstallProvider.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.cdt.qt.core; - -import java.util.Collection; - -public interface IQtInstallProvider { - - Collection getInstalls(); - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtLaunchDescriptor.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtLaunchDescriptor.java deleted file mode 100644 index ef673b66410..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtLaunchDescriptor.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.cdt.qt.core; - -import org.eclipse.core.resources.IProject; -import org.eclipse.launchbar.core.ILaunchDescriptor; - -public interface IQtLaunchDescriptor extends ILaunchDescriptor { - - IProject getProject(); - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/QMLTernCompletion.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/QMLTernCompletion.java deleted file mode 100644 index c6b1bcdece1..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/QMLTernCompletion.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.cdt.qt.core; - -public class QMLTernCompletion { - - private final String name; - private final String type; - private final String origin; - - public QMLTernCompletion(String name, String type, String origin) { - this.name = name; - this.type = type; - this.origin = origin; - } - - public String getName() { - return name; - } - - public String getType() { - return type; - } - - public String getOrigin() { - return origin; - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/QtInstallEvent.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/QtInstallEvent.java deleted file mode 100644 index e3bf4488097..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/QtInstallEvent.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.eclipse.cdt.qt.core; - -/** - * Event that a Qt install change has occured. - * - * @since 2.1 - */ -public class QtInstallEvent { - - /** - * Qt Install has been removed. Called before it is actually removed. - */ - public static int REMOVED = 1; - - private final int type; - private final IQtInstall install; - - public QtInstallEvent(int type, IQtInstall install) { - this.type = type; - this.install = install; - } - - /** - * Type of the event - * - * @return type of the event - */ - public int getType() { - return type; - } - - /** - * Qt install involved in the event - * - * @return Qt install for the event - */ - public IQtInstall getInstall() { - return install; - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/QtMinGWToolChainProvider.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/QtMinGWToolChainProvider.java deleted file mode 100644 index 53bdf39eed2..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/QtMinGWToolChainProvider.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.cdt.qt.core; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; - -import org.eclipse.cdt.build.gcc.core.GCCToolChain; -import org.eclipse.cdt.core.build.IToolChain; -import org.eclipse.cdt.core.build.IToolChainManager; -import org.eclipse.cdt.core.build.IToolChainProvider; -import org.eclipse.cdt.core.envvar.EnvironmentVariable; -import org.eclipse.cdt.core.envvar.IEnvironmentVariable; -import org.eclipse.cdt.internal.qt.core.Activator; -import org.eclipse.cdt.utils.WindowsRegistry; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Platform; - -public class QtMinGWToolChainProvider implements IToolChainProvider { - - public static final String ID = "org.eclipse.cdt.qt.core.qtMinGWProvider"; //$NON-NLS-1$ - public static final String TOOLCHAIN_ID = "qt.mingw"; //$NON-NLS-1$ - - @Override - public String getId() { - return ID; - } - - @Override - public void init(IToolChainManager manager) throws CoreException { - if (Platform.getOS().equals(Platform.OS_WIN32)) { - WindowsRegistry registry = WindowsRegistry.getRegistry(); - String uninstallKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"; //$NON-NLS-1$ - String subkey; - for (int i = 0; (subkey = registry.getCurrentUserKeyName(uninstallKey, i)) != null; i++) { - String compKey = uninstallKey + '\\' + subkey; - String displayName = registry.getCurrentUserValue(compKey, "DisplayName"); //$NON-NLS-1$ - if ("Qt".equals(displayName)) { //$NON-NLS-1$ - Path installLocation = Paths.get(registry.getCurrentUserValue(compKey, "InstallLocation")); //$NON-NLS-1$ - if (Files.exists(installLocation)) { - Path gcc = Paths.get("bin\\gcc.exe"); //$NON-NLS-1$ - try { - Files.walk(installLocation.resolve("Tools"), 1) //$NON-NLS-1$ - .filter(path -> Files.exists(path.resolve(gcc))).forEach(path -> { - IEnvironmentVariable[] env = new IEnvironmentVariable[] { - new EnvironmentVariable("PATH", //$NON-NLS-1$ - path.resolve("bin").toString(), //$NON-NLS-1$ - IEnvironmentVariable.ENVVAR_PREPEND, File.pathSeparator) }; - GCCToolChain toolChain = new GCCToolChain(this, path.resolve(gcc), - Platform.ARCH_X86, env); - toolChain.setProperty(IToolChain.ATTR_OS, Platform.OS_WIN32); - toolChain.setProperty(IToolChain.ATTR_PACKAGE, "qt"); //$NON-NLS-1$ - manager.addToolChain(toolChain); - - if (Platform.getOSArch().equals(Platform.ARCH_X86_64)) { - toolChain = new GCCToolChain(this, path.resolve(gcc), Platform.ARCH_X86_64, - env); - toolChain.setProperty(IToolChain.ATTR_OS, Platform.OS_WIN32); - toolChain.setProperty(IToolChain.ATTR_PACKAGE, "qt"); //$NON-NLS-1$ - manager.addToolChain(toolChain); - } - }); - } catch (IOException e) { - Activator.log(e); - } - } - } - } - } - } - -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/location/IPosition.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/location/IPosition.java deleted file mode 100644 index ef4fc0da12a..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/location/IPosition.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.location; - -/** - * Stores a line/offset pair as integers. - */ -public interface IPosition { - /** - * Gets the one-indexed line number indicated by this IPosition - * - * @return the line number - */ - public int getLine(); - - /** - * Gets the zero-indexed column indicated by this IPosition - * - * @return the column - */ - public int getColumn(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/location/ISourceLocation.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/location/ISourceLocation.java deleted file mode 100644 index 334f3d45ff9..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/location/ISourceLocation.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.location; - -/** - * Represents a location in a source file. Uses the {@link IPosition} interface to store the start and end locations as a - * line/offset pair. - */ -public interface ISourceLocation { - /** - * Gets the String representing the source of this ISourceLocation - * - * @return the source or null if not available - */ - public String getSource(); - - /** - * Gets the zero-indexed offset indicating the start of this ISourceLocation - * - * @return the start offset - */ - public IPosition getStart(); - - /** - * Gets the zero-indexed offset indicating the end of this ISourceLocation - * - * @return the end offset - */ - public IPosition getEnd(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirAST.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirAST.java deleted file mode 100644 index f5bf1186e16..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirAST.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmldir; - -import java.util.List; - -/** - * The main entry point into the qmldir AST. This interface contains a list of Commands specified within the qmldir file that it - * represents. - */ -public interface IQDirAST extends IQDirASTNode { - /** - * Gets the list of commands in the qmldir file that this IQDirAST represents. - * - * @return the list of all commands in the qmldir file - */ - public List getCommands(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirASTNode.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirASTNode.java deleted file mode 100644 index b780f2156da..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirASTNode.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.location.ISourceLocation; - -/** - * The base type for all qmldir AST nodes. Contains methods for retrieving a node's positional information. - */ -public interface IQDirASTNode { - /** - * Gets a more detailed description of this node's location than {@link IQDirASTNode#getStart()} and - * {@link IQDirASTNode#getStart()}. This method allows the retrieval of line and column information in order to make output for - * syntax errors and the like more human-readable. - * - * @return the {@link ISourceLocation} representing this node's location in the source - */ - public ISourceLocation getLocation(); - - /** - * Gets the zero-indexed offset indicating the start of this node in the source. - * - * @return the node's start offset - */ - public int getStart(); - - /** - * Gets the zero-indexed offset indicating the end of this node in the source. - * - * @return the node's end offset - */ - public int getEnd(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirClassnameCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirClassnameCommand.java deleted file mode 100644 index 27f8384954a..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirClassnameCommand.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmldir; - -/** - * An AST Node representing a Classname Command in a qmldir file. - * - * @see Module Definition qmldir Files - */ -public interface IQDirClassnameCommand extends IQDirCommand { - /** - * Gets the IQDirWord representing the identifier for the classname. - * - * @return the identifier for the classname - */ - public IQDirWord getIdentifier(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirCommand.java deleted file mode 100644 index f6863118713..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirCommand.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmldir; - -/** - * The base interface for all qmldir AST nodes that function as commands. - * - * @see Module Definition qmldir Files - */ -public interface IQDirCommand extends IQDirASTNode { -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirCommentCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirCommentCommand.java deleted file mode 100644 index 38c447d5316..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirCommentCommand.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmldir; - -/** - * An AST Node representing a Comment Command in a qmldir file. - * - * @see Module Definition qmldir Files - */ -public interface IQDirCommentCommand extends IQDirCommand { - /** - * Gets the String representation of this comment as it appears in the qmldir file. - * - * @return the String representation of this comment - */ - public String getText(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirDependsCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirDependsCommand.java deleted file mode 100644 index 618876d4ce6..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirDependsCommand.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmldir; - -/** - * An AST Node representing a Depends Command in a qmldir file. - * - * @see Module Definition qmldir Files - */ -public interface IQDirDependsCommand extends IQDirCommand { - /** - * Gets the IQDirWord representing the module identifier that this qmldir module depends on. - * - * @return the module identifier - */ - public IQDirWord getModuleIdentifier(); - - /** - * Gets the IQDirVersion representing the initial version of the module that this qmldir module depends on. - * - * @return the initial version - */ - public IQDirVersion getInitialVersion(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirDesignerSupportedCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirDesignerSupportedCommand.java deleted file mode 100644 index 97d147a6a53..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirDesignerSupportedCommand.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmldir; - -/** - * An AST Node representing a Designer Supported Command in a qmldir file. - * - * @see Module Definition qmldir Files - */ -public interface IQDirDesignerSupportedCommand extends IQDirCommand { -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirInternalCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirInternalCommand.java deleted file mode 100644 index e18f16087af..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirInternalCommand.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmldir; - -/** - * An AST Node representing an Internal Command in a qmldir file. - * - * @see Module Definition qmldir Files - */ -public interface IQDirInternalCommand extends IQDirCommand { - /** - * Gets the IQDirWord representing the type name of the internal type. - * - * @return the type names - */ - public IQDirWord getTypeName(); - - /** - * Gets the IQDirWord representing the filename of the internal type. - * - * @return the filename - */ - public IQDirWord getFile(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirModuleCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirModuleCommand.java deleted file mode 100644 index c6ca4d41312..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirModuleCommand.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmldir; - -/** - * An AST Node representing a Module Command in a qmldir file. - * - * @see Module Definition qmldir Files - */ -public interface IQDirModuleCommand extends IQDirCommand { - /** - * Gets the IQDirWord representing the identifier for the module. - * - * @return the identifier for the module - */ - public IQDirWord getModuleIdentifier(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirPluginCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirPluginCommand.java deleted file mode 100644 index 653f775ec75..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirPluginCommand.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmldir; - -/** - * An AST Node representing a Plugin Command in a qmldir file. - * - * @see Module Definition qmldir Files - */ -public interface IQDirPluginCommand extends IQDirCommand { - /** - * Gets the IQDirWord representing the name of the plugin. - * - * @return the plugin name - */ - public IQDirWord getName(); - - /** - * Gets the IQDirWord representing the path to the plugin if it was given. - * - * @return the path to the plugin or null if not available - */ - public IQDirWord getPath(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirResourceCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirResourceCommand.java deleted file mode 100644 index 3a44d5eacf6..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirResourceCommand.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmldir; - -/** - * An AST Node representing a Resource Command in a qmldir file. - * - * @see Module Definition qmldir Files - */ -public interface IQDirResourceCommand extends IQDirCommand { - /** - * Gets the IQDirWord representing the identifier of the resource. - * - * @return the identifier of the resource - */ - public IQDirWord getResourceIdentifier(); - - /** - * Gets the IQDirVersion representing the initial version of the resource. - * - * @return the initial version - */ - public IQDirVersion getInitialVersion(); - - /** - * Gets the IQDirWord representing the filename of the resource. - * - * @return the filename - */ - public IQDirWord getFile(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirSingletonCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirSingletonCommand.java deleted file mode 100644 index 513310daf8b..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirSingletonCommand.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmldir; - -/** - * An AST Node representing a Singleton Command in a qmldir file. - * - * @see Module Definition qmldir Files - */ -public interface IQDirSingletonCommand extends IQDirCommand { - /** - * Gets the IQDirWord representing the type name of the singleton type. - * - * @return the type name - */ - public IQDirWord getTypeName(); - - /** - * Gets the IQDirVersion representing the initial version of the singleton type. - * - * @return the initial version - */ - public IQDirVersion getInitialVersion(); - - /** - * Gets the IQDirWord representing the filename of the singleton type. - * - * @return the filename - */ - public IQDirWord getFile(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirSyntaxError.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirSyntaxError.java deleted file mode 100644 index bafa30163cf..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirSyntaxError.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryLexer.Token; -import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryParser.SyntaxError; - -/** - * An AST Node representing a syntax error in a qmldir file. Due to the fact that the qmldir file is so simple, a syntax error will - * only occur at the command level while the parser jumps to the next line to recover. - */ -public interface IQDirSyntaxError extends IQDirCommand { - /** - * Gets the token that caused the parser to fail. This is a helper method equivalent to - * getSyntaxError.getOffendingToken(). - * - * @return the offending token. - */ - public Token getOffendingToken(); - - /** - * Gets the node that the parser was working on before it failed (if available). This is a helper method equivalent to - * getSyntaxError.getIncompleteNode(). - * - * @return the incomplete node or null if not available - */ - public IQDirASTNode getIncompleteNode(); - - /** - * Gets the syntax error that occurred. - * - * @return the syntax error - */ - public SyntaxError getSyntaxError(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirTypeInfoCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirTypeInfoCommand.java deleted file mode 100644 index 75434436d29..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirTypeInfoCommand.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmldir; - -/** - * An AST Node representing a Type Info Command in a qmldir file. - * - * @see Module Definition qmldir Files - */ -public interface IQDirTypeInfoCommand extends IQDirCommand { - /** - * Gets the IQDirWord representing the filename of the type info file. - * - * @return the filename of the type info file - */ - public IQDirWord getFile(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirVersion.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirVersion.java deleted file mode 100644 index 07ab30b1b20..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirVersion.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmldir; - -/** - * An AST Node representing a version String of the form <MajorVersion>.<MinorVersion> - */ -public interface IQDirVersion extends IQDirASTNode { - /** - * Gets the String value of this version. The result will always be of the form "<MajorVersion>.<MinorVersion>" - * - * @return a string value of this version - */ - public String getVersionString(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirWord.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirWord.java deleted file mode 100644 index 69aee03b036..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirWord.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmldir; - -/** - * An AST Node representing a set of characters that does not contain whitespace and does not start with a digit. This encompasses - * the syntax for Identifiers, Qualified IDs, Paths, and File Names all in one parser rule. - */ -public interface IQDirWord extends IQDirASTNode { - /** - * Gets the String representing this word as it appears in the qmldir file.
- *
- * Note: The text is not modified or validated in any way when it is parsed. It is necessary for the caller to perform - * semantic validation of the returned value to ensure it represents a valid identifier, filename, or path. - * - * @return a string representing this word - */ - public String getText(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryInfo.java deleted file mode 100644 index 4101d77be1d..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryInfo.java +++ /dev/null @@ -1,179 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmldir; - -import java.io.InputStream; -import java.nio.file.InvalidPathException; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedList; - -import org.eclipse.cdt.internal.qt.core.Activator; - -public class QMLDirectoryInfo { - public static class Module { - private final String name; - private final String initialVersion; - - public Module(String name, String ver) { - this.name = name; - this.initialVersion = ver; - } - - public String getName() { - return name; - } - - public String getInitialVersion() { - return initialVersion; - } - } - - public static class Plugin { - private final String name; - private final Path path; - - private Plugin(String name, String path) { - this.name = name; - Path p = null; - if (path != null) { - try { - p = Paths.get(path); - } catch (InvalidPathException e) { - Activator.log(e); - } - } - this.path = p; - } - - public String getName() { - return name; - } - - public Path getRelativePath() { - return path; - } - } - - public static class ResourceFile { - private final String name; - private final boolean internal; - private final boolean singleton; - private final String initialVersion; - - private ResourceFile(String name, String ver, boolean internal, boolean singleton) { - this.name = name; - this.initialVersion = ver; - this.internal = internal; - this.singleton = singleton; - } - - public String getName() { - return name; - } - - public String getInitialVersion() { - return initialVersion; - } - - public boolean isSingleton() { - return singleton; - } - - public boolean isInternal() { - return internal; - } - } - - private String moduleIdentifier; - private Plugin plugin; - private String classname; - private String typeInfo; - private final Collection depends; - private final Collection resources; - private boolean designersupported; - - public QMLDirectoryInfo(InputStream input) { - this.depends = new LinkedList<>(); - this.resources = new LinkedList<>(); - - IQDirAST ast = new QMLDirectoryParser().parse(input); - for (IQDirCommand c : ast.getCommands()) { - if (c instanceof IQDirModuleCommand) { - if (moduleIdentifier == null) { - moduleIdentifier = ((IQDirModuleCommand) c).getModuleIdentifier().getText(); - } - } else if (c instanceof IQDirPluginCommand) { - if (plugin == null) { - IQDirPluginCommand pc = (IQDirPluginCommand) c; - plugin = new Plugin(pc.getName().getText(), pc.getPath() != null ? pc.getPath().getText() : null); - } - } else if (c instanceof IQDirTypeInfoCommand) { - if (typeInfo == null) { - typeInfo = ((IQDirTypeInfoCommand) c).getFile().getText(); - } - } else if (c instanceof IQDirResourceCommand) { - IQDirResourceCommand rc = (IQDirResourceCommand) c; - resources.add(new ResourceFile(rc.getFile().getText(), rc.getInitialVersion().getVersionString(), false, - false)); - } else if (c instanceof IQDirInternalCommand) { - IQDirInternalCommand rc = (IQDirInternalCommand) c; - resources.add(new ResourceFile(rc.getFile().getText(), null, true, false)); - } else if (c instanceof IQDirSingletonCommand) { - IQDirSingletonCommand rc = (IQDirSingletonCommand) c; - resources.add(new ResourceFile(rc.getFile().getText(), rc.getInitialVersion().getVersionString(), false, - true)); - } else if (c instanceof IQDirDependsCommand) { - IQDirDependsCommand dc = (IQDirDependsCommand) c; - depends.add(new Module(dc.getModuleIdentifier().getText(), dc.getInitialVersion().getVersionString())); - } else if (c instanceof IQDirClassnameCommand) { - if (classname == null) { - classname = ((IQDirClassnameCommand) c).getIdentifier().getText(); - } - } else if (c instanceof IQDirDesignerSupportedCommand) { - designersupported = true; - } - } - } - - public String getModuleIdentifier() { - return moduleIdentifier; - } - - public Plugin getPlugin() { - return plugin; - } - - public String getClassname() { - return classname; - } - - public String getTypesFileName() { - return typeInfo; - } - - public Collection getDependentModules() { - return Collections.unmodifiableCollection(depends); - } - - public Collection getResources() { - return Collections.unmodifiableCollection(resources); - } - - public boolean isDesignersupported() { - return designersupported; - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryLexer.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryLexer.java deleted file mode 100644 index b0aef388725..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryLexer.java +++ /dev/null @@ -1,254 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmldir; - -import java.io.InputStream; -import java.util.Scanner; -import java.util.regex.MatchResult; -import java.util.regex.Pattern; - -import org.eclipse.cdt.internal.qt.core.location.Position; -import org.eclipse.cdt.internal.qt.core.location.SourceLocation; -import org.eclipse.cdt.qt.core.location.ISourceLocation; - -/** - * Converts an InputStream representing a qmldir file into a stream of tokens through successive calls to - * nextToken. This lexer uses regular expressions to match its 16 valid token types: - *

    - *
  • COMMENT: A single line comment that begins with '#' - *
  • MODULE: Keyword 'module' - *
  • TYPEINFO: The keyword 'typeinfo' - *
  • SINGLETON: The keyword 'singleton' - *
  • INTERNAL: The keyword 'internal' - *
  • PLUGIN: The keyword 'plugin' - *
  • CLASSNAME: The keyword 'classname' - *
  • DEPENDS: The keyword 'depends' - *
  • DESIGNERSUPPORTED: The keyword 'designersupported' - *
  • WORD: A group of characters that form an identifier, filename, or path - *
  • DECIMAL: A number of the form [0-9]+ '.' [0-9]+ - *
  • INTEGER: An integer of the form [0-9]+ - *
  • WHITESPACE: A group of whitespace characters (not including newlines) - *
  • COMMAND_END: A newline character - *
  • UNKNOWN: A group of characters that does not match any of the preceding tokens - *
  • EOF: End of File - *
- */ -public class QMLDirectoryLexer { - /** - * A single matched token returned by a QMLDirectoryLexer. A Token stores information on how it was - * matched including the type of token, the exact text that was matched, and its position in the InputStream . - */ - public static class Token { - private final TokenType tokType; - private final String raw; - private final ISourceLocation location; - private final int start; - private final int end; - - private Token(TokenType type, MatchResult match, int line, int lineStart) { - this(type, match.group(), match.start(), match.end(), line, lineStart); - } - - private Token(TokenType type, String raw, int start, int end, int line, int lineStart) { - this.tokType = type; - raw = raw.replaceAll("\n", "\\\\n"); //$NON-NLS-1$ //$NON-NLS-2$ - raw = raw.replaceAll("\r", "\\\\r"); //$NON-NLS-1$ //$NON-NLS-2$ - this.raw = raw; - this.start = start; - this.end = end; - this.location = new SourceLocation(null, new Position(line, start - lineStart), - new Position(line, end - lineStart)); - } - - /** - * Get the type of token that was matched. - * - * @return the type of token - */ - public TokenType getType() { - return tokType; - } - - /** - * Gets the raw text that this token was matched with. - * - * @return a String representing the matched text - */ - public String getText() { - return raw; - } - - /** - * Gets a more detailed description of this token's location in the InputStream than {@link Token#getStart()} - * and {@link Token#getEnd()}. This method allows the retrieval of line and column information in order to make output for - * syntax errors and the like more human-readable. - * - * @return the {@link ISourceLocation} representing this token's location in the InputStream - */ - public ISourceLocation getLocation() { - return location; - } - - /** - * Gets the zero-indexed offset indicating the start of this token in the InputStream. - * - * @return the token's start offset - */ - public int getStart() { - return start; - } - - /** - * Gets the zero-indexed offset indicating the end of this token in the InputStream. - * - * @return the token's end offset - */ - public int getEnd() { - return end; - } - } - - /** - * An Enumeration encompassing the 16 possible types of tokens returned by a QMLDirectoryLexer. - * - * @see org.eclipse.cdt.qt.core.qmldir.QMLDirectoryLexer - */ - public static enum TokenType { - COMMENT("#.*$"), //$NON-NLS-1$ - MODULE("module(?=\\s|$)"), //$NON-NLS-1$ - TYPEINFO("typeinfo(?=\\s|$)"), //$NON-NLS-1$ - SINGLETON("singleton(?=\\s|$)"), //$NON-NLS-1$ - INTERNAL("internal(?=\\s|$)"), //$NON-NLS-1$ - PLUGIN("plugin(?=\\s|$)"), //$NON-NLS-1$ - CLASSNAME("classname(?=\\s|$)"), //$NON-NLS-1$ - DEPENDS("depends(?=\\s|$)"), //$NON-NLS-1$ - DESIGNERSUPPORTED("designersupported(?=\\s|$)"), //$NON-NLS-1$ - WORD("[^0-9\\s][^\\s]*"), //$NON-NLS-1$ - DECIMAL("[0-9]+\\.[0-9]+"), //$NON-NLS-1$ - INTEGER("[0-9]+"), //$NON-NLS-1$ - WHITESPACE("\\h+"), //$NON-NLS-1$ - COMMAND_END("(?:\r\n)|\n"), //$NON-NLS-1$ - UNKNOWN(".+"), //$NON-NLS-1$ - EOF(null); - - private static Pattern pattern; - - private static Pattern patternForAllTerminals() { - if (pattern == null) { - String regex = ""; //$NON-NLS-1$ - TokenType[] tokens = TokenType.values(); - for (int i = 0; i < TokenType.values().length; i++) { - TokenType tok = tokens[i]; - if (tok.regex != null) { - if (i != 0) { - regex += "|"; //$NON-NLS-1$ - } - regex += "(" + tok.regex + ")"; //$NON-NLS-1$ //$NON-NLS-2$ - } - } - pattern = Pattern.compile(regex, Pattern.MULTILINE); - } - return pattern; - } - - private final String regex; - - private TokenType(String regex) { - this.regex = regex; - } - } - - private Scanner input; - private MatchResult lastMatch; - private int currentLine; - private int currentLineStart; - - /** - * Creates a new QMLDirectoryLexer without initializing any of the its internal state. A call to - * setInput is necessary to fully initialize the lexer before any calls to nextToken. - */ - public QMLDirectoryLexer() { - } - - /** - * Prepares for lexical analysis by giving the lexer an InputStream to retrieve text from. - * - * @param input - * the input to perform lexical analysis on - */ - public void setInput(InputStream input) { - this.input = new Scanner(input); - this.lastMatch = null; - this.currentLine = 1; - this.currentLineStart = 0; - } - - /** - * Retrieves the next valid token from the InputStream given by setInput. This is a helper method to - * skip whitespace that is equivalent to QMLDirectoryLexer.nextToken(true). - * - * @return the next token in the InputStream - * @throws IllegalArgumentException - * if setInput has not been called - */ - public Token nextToken() throws IllegalArgumentException { - return nextToken(true); - } - - /** - * Retrieves the next valid token from the InputStream given by setInput. This method has the ability - * to skip over whitespace tokens by setting skipWhitespace to true. - * - * @param skipWhitespace - * whether or not the lexer should skip whitespace tokens - * @return the next token in the InputStream - * @throws IllegalArgumentException - * if setInput has not been called - */ - public Token nextToken(boolean skipWhitespace) throws IllegalArgumentException { - if (input == null) { - throw new IllegalArgumentException("Input cannot be null"); //$NON-NLS-1$ - } - if (input.findWithinHorizon(TokenType.patternForAllTerminals(), 0) == null) { - if (lastMatch != null) { - return new Token(TokenType.EOF, "", lastMatch.end(), lastMatch.end(), currentLine, currentLineStart); //$NON-NLS-1$ - } else { - return new Token(TokenType.EOF, "", 0, 0, 1, 0); //$NON-NLS-1$ - } - } else { - int groupNo = 1; - for (TokenType t : TokenType.values()) { - if (t.regex != null) { - if (input.match().start(groupNo) != -1) { - lastMatch = input.match(); - Token next = null; - if (!(t.equals(TokenType.WHITESPACE) && skipWhitespace)) { - next = new Token(t, input.match(), currentLine, currentLineStart); - } else { - next = nextToken(skipWhitespace); - } - if (t.equals(TokenType.COMMAND_END)) { - // Advance the line number information - currentLine++; - currentLineStart = input.match().end(); - } - return next; - } - groupNo++; - } - } - return new Token(TokenType.UNKNOWN, input.match(), currentLine, currentLineStart); - } - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryParser.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryParser.java deleted file mode 100644 index 7ef5c267d2a..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryParser.java +++ /dev/null @@ -1,426 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmldir; - -import java.io.InputStream; -import java.util.Stack; - -import org.eclipse.cdt.internal.qt.core.location.SourceLocation; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirAST; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirASTNode; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirClassnameCommand; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirCommentCommand; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirDependsCommand; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirDesignerSupportedCommand; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirInternalCommand; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirModuleCommand; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirPluginCommand; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirResourceCommand; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirSingletonCommand; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirSyntaxError; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirTypeInfoCommand; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirVersion; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirWord; -import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryLexer.Token; -import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryLexer.TokenType; - -/** - * Converts an InputStream representing a qmldir file into an Abstract Syntax Tree. Uses the {@link QMLDirectoryLexer} - * under the hood to match tokens which it then uses to construct the AST. Also, a QMLDirectoryParser has the ability - * to skip over syntax errors and include them in its AST rather than returning upon the first error. - */ -public class QMLDirectoryParser { - /** - * An exception thrown when a QMLDirectoryParser encounters a syntax error. This class stores information on the - * offending token as well as the node the parser was working on before it failed (if available). - */ - public static class SyntaxError extends RuntimeException { - private static final long serialVersionUID = 6608815552297970623L; - - private final IQDirASTNode incompleteNode; - private final Token offendingToken; - - /** - * Creates a new SyntaxError. - * - * @param node - * the incomplete working node - * @param token - * the offending token - * @param message - * the message to display - */ - public SyntaxError(IQDirASTNode node, Token token, String message) { - super(message); - this.incompleteNode = node; - this.offendingToken = token; - } - - /** - * Gets the token that caused the parser to fail. - * - * @return the offending token - */ - public Token getOffendingToken() { - return offendingToken; - } - - /** - * Gets the last node that the parser was working on before it failed or null if that information isn't present. - * - * @return the incomplete node or null if not available - */ - public IQDirASTNode getIncompleteNode() { - return incompleteNode; - } - } - - private final QMLDirectoryLexer lexer; - private final Stack workingNodes; - private Token tok; - - /** - * Initializes a new QMLDirectoryParser capable of parsing an InputStream and returning an AST. - */ - public QMLDirectoryParser() { - this.lexer = new QMLDirectoryLexer(); - this.workingNodes = new Stack<>(); - } - - /** - * Parses the given InputStream into an Abstract Syntax Tree. This is a helper method equivalent to - * parse(input, true). That is, the parser will attempt to recover once it hits an error and include an - * {@link IQDirSyntaxError} node in the AST. - * - * @param input - * the input to parse - * @return the Abstract Syntax Tree representing the input - * @see QMLDirectoryParser#parse(InputStream, boolean) - */ - public IQDirAST parse(InputStream input) { - return parse(input, true); - } - - /** - * Parses the given InputStream into an Abstract Syntax Tree. If tolerateErrors is true, - * any syntax errors will be included in the AST as a separate {@link IQDirSyntaxErrorCommand}. The parser will then attempt to - * recover by jumping to the next line and continue parsing. A value of false tells the parser to throw a - * {@link SyntaxError} on the first problem it encounters. - * - * @param input - * the input to parse - * @param tolerateErrors - * whether or not the parser should be error tolerant - * @return the Abstract Syntax Tree representing the input - */ - public IQDirAST parse(InputStream input, boolean tolerateErrors) { - // Clear out any leftover state - this.lexer.setInput(input); - this.workingNodes.clear(); - - QDirAST ast = new QDirAST(); - nextToken(); - while (tok.getType() != TokenType.EOF) { - try { - switch (tok.getType()) { - case MODULE: - ast.addCommand(parseModuleCommand()); - break; - case SINGLETON: - ast.addCommand(parseSingletonCommand()); - break; - case INTERNAL: - ast.addCommand(parseInternalCommand()); - break; - case WORD: - ast.addCommand(parseResourceCommand()); - break; - case PLUGIN: - ast.addCommand(parsePluginCommand()); - break; - case CLASSNAME: - ast.addCommand(parseClassnameCommand()); - break; - case TYPEINFO: - ast.addCommand(parseTypeInfoCommand()); - break; - case DEPENDS: - ast.addCommand(parseDependsCommand()); - break; - case DESIGNERSUPPORTED: - ast.addCommand(parseDesignerSupportedCommand()); - break; - case COMMENT: - ast.addCommand(parseCommentCommand()); - break; - case COMMAND_END: - // This is just an empty line that should be ignored - nextToken(); - break; - default: - throw unexpectedToken(); - } - } catch (SyntaxError e) { - if (!tolerateErrors) { - throw e; - } - // Add the syntax error to the AST and jump to the next line - QDirSyntaxError errNode = new QDirSyntaxError(e); - markStart(errNode); - IQDirASTNode node = e.getIncompleteNode(); - if (node != null) { - errNode.setLocation((SourceLocation) node.getLocation()); - errNode.setStart(node.getStart()); - errNode.setEnd(node.getEnd()); - } - while (!eat(TokenType.COMMAND_END) && !eat(TokenType.EOF)) { - nextToken(); - } - markEnd(); - ast.addCommand(errNode); - } - } - return ast; - } - - private void nextToken() { - nextToken(true); - } - - private void nextToken(boolean skipWhitespace) { - tok = lexer.nextToken(skipWhitespace); - } - - private void markStart(QDirASTNode node) { - workingNodes.push(node); - node.setStart(tok.getStart()); - node.setLocation(new SourceLocation()); - node.getLocation().setStart(tok.getLocation().getStart()); - } - - private void markEnd() { - QDirASTNode node = workingNodes.pop(); - node.setEnd(tok.getEnd()); - node.getLocation().setEnd(tok.getLocation().getEnd()); - } - - private boolean eat(TokenType type) { - if (tok.getType() == type) { - nextToken(); - return true; - } - return false; - } - - private SyntaxError syntaxError(String message) { - return new SyntaxError(workingNodes.peek(), tok, message + " " + tok.getLocation().getStart().toString()); //$NON-NLS-1$ - } - - private SyntaxError unexpectedToken() { - String tokenText = tok.getText(); - if (tok.getType() == TokenType.EOF) { - tokenText = "EOF"; //$NON-NLS-1$ - } - return syntaxError("Unexpected token '" + tokenText + "'"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - private void expect(TokenType type) { - if (tok.getType() != type) { - throw unexpectedToken(); - } - nextToken(); - } - - private void expectCommandEnd() { - // Allow EOF to be substituted for COMMAND_END - if (tok.getType() == TokenType.EOF) { - nextToken(); - return; - } - if (tok.getType() != TokenType.COMMAND_END) { - throw syntaxError("Expected token '\\n' or 'EOF', but saw '" + tok.getText() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ - } - nextToken(); - } - - private QDirModuleCommand parseModuleCommand() { - QDirModuleCommand node = new QDirModuleCommand(); - markStart(node); - expect(TokenType.MODULE); - if (tok.getType() == TokenType.WORD) { - node.setModuleIdentifier(parseWord()); - expectCommandEnd(); - markEnd(); - return node; - } - throw unexpectedToken(); - } - - private QDirSingletonCommand parseSingletonCommand() { - QDirSingletonCommand node = new QDirSingletonCommand(); - markStart(node); - expect(TokenType.SINGLETON); - if (tok.getType() == TokenType.WORD) { - node.setTypeName(parseWord()); - if (tok.getType() == TokenType.DECIMAL) { - node.setInitialVersion(parseVersion()); - if (tok.getType() == TokenType.WORD) { - node.setFile(parseWord()); - expectCommandEnd(); - markEnd(); - return node; - } - } - } - throw unexpectedToken(); - } - - private QDirInternalCommand parseInternalCommand() { - QDirInternalCommand node = new QDirInternalCommand(); - markStart(node); - expect(TokenType.INTERNAL); - if (tok.getType() == TokenType.WORD) { - node.setTypeName(parseWord()); - if (tok.getType() == TokenType.WORD) { - node.setFile(parseWord()); - expectCommandEnd(); - markEnd(); - return node; - } - } - throw unexpectedToken(); - } - - private QDirResourceCommand parseResourceCommand() { - QDirResourceCommand node = new QDirResourceCommand(); - markStart(node); - if (tok.getType() == TokenType.WORD) { - node.setResourceIdentifier(parseWord()); - if (tok.getType() == TokenType.DECIMAL) { - node.setInitialVersion(parseVersion()); - if (tok.getType() == TokenType.WORD) { - node.setFile(parseWord()); - expectCommandEnd(); - markEnd(); - return node; - } - } - } - throw unexpectedToken(); - } - - private QDirPluginCommand parsePluginCommand() { - QDirPluginCommand node = new QDirPluginCommand(); - markStart(node); - expect(TokenType.PLUGIN); - if (tok.getType() == TokenType.WORD) { - node.setName(parseWord()); - if (tok.getType() == TokenType.WORD) { - node.setPath(parseWord()); - } - expectCommandEnd(); - markEnd(); - return node; - } - throw unexpectedToken(); - } - - private QDirClassnameCommand parseClassnameCommand() { - QDirClassnameCommand node = new QDirClassnameCommand(); - markStart(node); - expect(TokenType.CLASSNAME); - if (tok.getType() == TokenType.WORD) { - node.setIdentifier(parseWord()); - expectCommandEnd(); - markEnd(); - return node; - } - throw unexpectedToken(); - } - - private QDirTypeInfoCommand parseTypeInfoCommand() { - QDirTypeInfoCommand node = new QDirTypeInfoCommand(); - markStart(node); - expect(TokenType.TYPEINFO); - if (tok.getType() == TokenType.WORD) { - node.setFile(parseWord()); - expectCommandEnd(); - markEnd(); - return node; - } - throw unexpectedToken(); - } - - private QDirDependsCommand parseDependsCommand() { - QDirDependsCommand node = new QDirDependsCommand(); - markStart(node); - expect(TokenType.DEPENDS); - if (tok.getType() == TokenType.WORD) { - node.setModuleIdentifier(parseWord()); - if (tok.getType() == TokenType.DECIMAL) { - node.setInitialVersion(parseVersion()); - expectCommandEnd(); - markEnd(); - return node; - } - } - throw unexpectedToken(); - } - - private QDirDesignerSupportedCommand parseDesignerSupportedCommand() { - QDirDesignerSupportedCommand node = new QDirDesignerSupportedCommand(); - markStart(node); - expect(TokenType.DESIGNERSUPPORTED); - expectCommandEnd(); - markEnd(); - return node; - } - - private QDirCommentCommand parseCommentCommand() { - QDirCommentCommand node = new QDirCommentCommand(); - markStart(node); - if (tok.getType() == TokenType.COMMENT) { - node.setText(tok.getText()); - nextToken(); - expectCommandEnd(); - markEnd(); - return node; - } - throw unexpectedToken(); - } - - private QDirVersion parseVersion() { - QDirVersion node = new QDirVersion(); - markStart(node); - if (tok.getType() == TokenType.DECIMAL) { - node.setVersionString(tok.getText()); - nextToken(); - markEnd(); - return node; - } - throw unexpectedToken(); - } - - private QDirWord parseWord() { - QDirWord node = new QDirWord(); - markStart(node); - if (tok.getType() == TokenType.WORD) { - node.setText(tok.getText()); - nextToken(); - markEnd(); - return node; - } - throw unexpectedToken(); - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSArrayExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSArrayExpression.java deleted file mode 100644 index 4d7cfd21323..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSArrayExpression.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -import java.util.List; - -/** - * A JavaScript array expression from the ESTree - * Specification - */ -public interface IJSArrayExpression extends IJSExpression { - @Override - default String getType() { - return "ArrayExpression"; //$NON-NLS-1$ - } - - public List getElements(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSAssignmentExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSAssignmentExpression.java deleted file mode 100644 index 71b69c9fab2..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSAssignmentExpression.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript assignment expression from the - * ESTree Specification - */ -public interface IJSAssignmentExpression extends IJSExpression { - /** - * An Enumeration covering the 12 assignment operators in JavaScript - */ - enum AssignmentOperator { - Assign("="), //$NON-NLS-1$ - AssignAdd("+="), //$NON-NLS-1$ - AssignSubtract("-="), //$NON-NLS-1$ - AssignMultiply("*="), //$NON-NLS-1$ - AssignDivide("/="), //$NON-NLS-1$ - AssignModulus("%="), //$NON-NLS-1$ - AssignLeftShift("<<="), //$NON-NLS-1$ - AssignRightShift(">>="), //$NON-NLS-1$ - AssignUnsignedRightShift(">>>="), //$NON-NLS-1$ - AssignOr("|="), //$NON-NLS-1$ - AssignExclusiveOr("^"), //$NON-NLS-1$ - AssignAnd("&="); //$NON-NLS-1$ - - public static AssignmentOperator fromObject(Object obj) { - if (obj instanceof String) { - for (AssignmentOperator op : AssignmentOperator.values()) { - if (obj.equals(op.toString())) { - return op; - } - } - } - return null; - } - - private final String op; - - private AssignmentOperator(String op) { - this.op = op; - } - - @Override - public String toString() { - return this.op; - } - } - - @Override - default String getType() { - return "AssignmentExpression"; //$NON-NLS-1$ - } - - public AssignmentOperator getOperator(); - - public IJSExpression getLeft(); - - public IJSExpression getRight(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSBinaryExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSBinaryExpression.java deleted file mode 100644 index 1e067fd4f82..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSBinaryExpression.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript binary expression from the ESTree - * Specification - */ -public interface IJSBinaryExpression extends IJSExpression { - /** - * An Enumeration covering the 21 binary operators in JavaScript - */ - enum BinaryOperator { - Equality("=="), //$NON-NLS-1$ - Inequality("!="), //$NON-NLS-1$ - StrictEquality("==="), //$NON-NLS-1$ - LessThan("<"), //$NON-NLS-1$ - LessThanOrEqual("<="), //$NON-NLS-1$ - GreaterThan(">"), //$NON-NLS-1$ - GreaterThanOrEqual(">="), //$NON-NLS-1$ - LeftShift("<<"), //$NON-NLS-1$ - RightShift(">>"), //$NON-NLS-1$ - UnsignedRightShift(">>>"), //$NON-NLS-1$ - Add("+"), //$NON-NLS-1$ - Subtract("-"), //$NON-NLS-1$ - Multiply("*"), //$NON-NLS-1$ - Divide("/"), //$NON-NLS-1$ - Modulus("%"), //$NON-NLS-1$ - Or("|"), //$NON-NLS-1$ - EclusiveOr("^"), //$NON-NLS-1$ - And("&"), //$NON-NLS-1$ - In("in"), //$NON-NLS-1$ - Instanceof("instanceof"); //$NON-NLS-1$ - - public static BinaryOperator fromObject(Object obj) { - if (obj instanceof String) { - for (BinaryOperator op : BinaryOperator.values()) { - if (obj.equals(op.toString())) { - return op; - } - } - } - return null; - } - - private final String op; - - private BinaryOperator(String op) { - this.op = op; - } - - @Override - public String toString() { - return this.op; - } - } - - @Override - default String getType() { - return "BinaryExpression"; //$NON-NLS-1$ - } - - public BinaryOperator getOperator(); - - public IJSExpression getLeft(); - - public IJSExpression getRight(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSBlockStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSBlockStatement.java deleted file mode 100644 index 8b333f39b5c..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSBlockStatement.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -import java.util.List; - -/** - * A JavaScript block statement from the ESTree - * Specification - */ -public interface IJSBlockStatement extends IJSStatement { - @Override - default String getType() { - return "BlockStatement"; //$NON-NLS-1$ - } - - public List getBody(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSBreakStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSBreakStatement.java deleted file mode 100644 index fbe49cea7b7..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSBreakStatement.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript break statement from the ESTree - * Specification - */ -public interface IJSBreakStatement extends IJSStatement { - @Override - default String getType() { - return "BreakStatement"; //$NON-NLS-1$ - } - - public IJSIdentifier getLabel(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSCallExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSCallExpression.java deleted file mode 100644 index 285c7bda133..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSCallExpression.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -import java.util.List; - -/** - * A JavaScript call expression from the ESTree - * Specification - */ -public interface IJSCallExpression extends IJSExpression { - @Override - default String getType() { - return "CallExpression"; //$NON-NLS-1$ - } - - public IJSExpression getCallee(); - - public List getArguments(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSCatchClause.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSCatchClause.java deleted file mode 100644 index 5494c41a472..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSCatchClause.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript catch clause from the ESTree - * Specification - */ -public interface IJSCatchClause extends IQmlASTNode { - @Override - default String getType() { - return "CatchClause"; //$NON-NLS-1$ - } - - public IJSPattern getParam(); - - public IJSBlockStatement getBody(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSConditionalExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSConditionalExpression.java deleted file mode 100644 index 481eb572adc..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSConditionalExpression.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript conditional expression from the - * ESTree Specification - */ -public interface IJSConditionalExpression extends IJSExpression { - @Override - default String getType() { - return "ConditionalExpression"; //$NON-NLS-1$ - } - - public IJSExpression getTest(); - - public IJSExpression getAlternate(); - - public IJSExpression getConsequent(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSContinueStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSContinueStatement.java deleted file mode 100644 index f30e1d1a06e..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSContinueStatement.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript continue statement from the ESTree - * Specification - */ -public interface IJSContinueStatement extends IJSStatement { - @Override - default String getType() { - return "ContinueStatement"; //$NON-NLS-1$ - } - - public IJSIdentifier getLabel(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSDebuggerStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSDebuggerStatement.java deleted file mode 100644 index b14c6fc4090..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSDebuggerStatement.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript debugger statement from the ESTree - * Specification - */ -public interface IJSDebuggerStatement extends IJSStatement { - @Override - default String getType() { - return "DebuggerStatement"; //$NON-NLS-1$ - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSDeclaration.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSDeclaration.java deleted file mode 100644 index e851fcf0673..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSDeclaration.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript declaration from the ESTree - * Specification - */ -public interface IJSDeclaration extends IJSStatement { -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSDoWhileStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSDoWhileStatement.java deleted file mode 100644 index bb5980ad112..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSDoWhileStatement.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript do while statement from the ESTree - * Specification - */ -public interface IJSDoWhileStatement extends IJSStatement { - @Override - default String getType() { - return "DoWhileStatement"; //$NON-NLS-1$ - } - - public IJSExpression getTest(); - - public IJSStatement getBody(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSEmptyStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSEmptyStatement.java deleted file mode 100644 index 0b6a0b31938..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSEmptyStatement.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * An empty JavaScrit statement from the ESTree - * Specification - */ -public interface IJSEmptyStatement extends IJSStatement { - @Override - default String getType() { - return "EmptyStatement"; //$NON-NLS-1$ - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSExpression.java deleted file mode 100644 index 79913e6c021..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSExpression.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript expression from the ESTree - * Specification - */ -public interface IJSExpression extends IQmlASTNode { -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSExpressionStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSExpressionStatement.java deleted file mode 100644 index 37656369f40..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSExpressionStatement.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript expression statement from the - * ESTree Specification - */ -public interface IJSExpressionStatement extends IJSStatement { - @Override - default String getType() { - return "ExpressionStatement"; //$NON-NLS-1$ - } - - public IJSExpression getExpression(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSForInStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSForInStatement.java deleted file mode 100644 index df4078c679b..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSForInStatement.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript for in statement from the ESTree - * Specification - */ -public interface IJSForInStatement extends IJSStatement { - @Override - default String getType() { - return "ForInStatement"; //$NON-NLS-1$ - } - - /** - * @return {@link IJSVariableDeclaration}, or {@link IJSExpression} - */ - public IQmlASTNode getRight(); - - public IJSExpression getLeft(); - - public IJSStatement getBody(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSForStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSForStatement.java deleted file mode 100644 index 1b9e65c9c77..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSForStatement.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript for statement from the ESTree - * Specification - */ -public interface IJSForStatement extends IJSStatement { - @Override - default String getType() { - return "ForStatement"; //$NON-NLS-1$ - } - - /** - * @return {@link IJSVariableDeclaration}, {@link IJSExpression}, or null - */ - public IQmlASTNode getInit(); - - public IJSExpression getTest(); - - public IJSExpression getUpdate(); - - public IJSStatement getBody(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSFunction.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSFunction.java deleted file mode 100644 index 7024ca6070c..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSFunction.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -import java.util.List; - -/** - * A JavaScript function from the ESTree Specification - */ -public interface IJSFunction extends IQmlASTNode { - public IJSIdentifier getIdentifier(); - - public List getParams(); - - public IJSBlockStatement getBody(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSFunctionDeclaration.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSFunctionDeclaration.java deleted file mode 100644 index bdfa56a4b27..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSFunctionDeclaration.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript function declaration from the - * ESTree Specification - */ -public interface IJSFunctionDeclaration extends IJSFunction, IJSDeclaration, IQmlObjectMember { - @Override - default String getType() { - return "FunctionDeclaration"; //$NON-NLS-1$ - } - - @Override - public IJSIdentifier getIdentifier(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSFunctionExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSFunctionExpression.java deleted file mode 100644 index 7e8505c5fbf..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSFunctionExpression.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript function expression from the - * ESTree Specification - */ -public interface IJSFunctionExpression extends IJSExpression { - @Override - default String getType() { - return "FunctionExpression"; //$NON-NLS-1$ - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSIdentifier.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSIdentifier.java deleted file mode 100644 index 5d86d62d91d..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSIdentifier.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript identifier from the ESTree - * Specification - */ -public interface IJSIdentifier extends IJSExpression, IJSPattern { - @Override - default public String getType() { - return "Identifier"; //$NON-NLS-1$ - } - - public String getName(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSIfStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSIfStatement.java deleted file mode 100644 index bafc4fad4ae..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSIfStatement.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript if statement from the - * ESTree Specification - */ -public interface IJSIfStatement extends IJSStatement { - @Override - default String getType() { - return "IfStatement"; //$NON-NLS-1$ - } - - public IJSExpression getTest(); - - public IJSStatement getConsequence(); - - public IJSStatement getAlternate(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSLabeledStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSLabeledStatement.java deleted file mode 100644 index 3c2de1b5633..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSLabeledStatement.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript labeled statement from the ESTree - * Specification - */ -public interface IJSLabeledStatement extends IJSStatement { - @Override - default String getType() { - return "LabledStatement"; //$NON-NLS-1$ - } - - public IJSIdentifier getLabel(); - - public IJSStatement getBody(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSLiteral.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSLiteral.java deleted file mode 100644 index 490142836c2..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSLiteral.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript literal from the ESTree Specification - */ -public interface IJSLiteral extends IJSExpression { - @Override - default public String getType() { - return "Literal"; //$NON-NLS-1$ - } - - /** - * @return String, Boolean, Integer, Double, or Regular Expression - */ - public Object getValue(); - - public String getRaw(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSLogicalExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSLogicalExpression.java deleted file mode 100644 index bfda13a89fd..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSLogicalExpression.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript logical expression from the ESTree - * Specification - */ -public interface IJSLogicalExpression extends IJSExpression { - /** - * An Enumeration covering the two logical operators in JavaScript - */ - enum LogicalOperator { - Or("||"), //$NON-NLS-1$ - And("&&"); //$NON-NLS-1$ - - public static LogicalOperator fromObject(Object obj) { - if (obj instanceof String) { - for (LogicalOperator op : LogicalOperator.values()) { - if (obj.equals(op.toString())) { - return op; - } - } - } - return null; - } - - private final String op; - - private LogicalOperator(String op) { - this.op = op; - } - - @Override - public String toString() { - return this.op; - } - } - - @Override - default String getType() { - return "LogicalExpression"; //$NON-NLS-1$ - } - - public LogicalOperator getOperator(); - - public IJSExpression getLeft(); - - public IJSExpression getRight(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSMemberExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSMemberExpression.java deleted file mode 100644 index e5f92fa5953..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSMemberExpression.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript member expression from the ESTree - * Specification - */ -public interface IJSMemberExpression extends IJSExpression { - @Override - default String getType() { - return "MemberExpression"; //$NON-NLS-1$ - } - - public IJSExpression getOjbect(); - - public IJSExpression getProperty(); - - public boolean isComputed(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSNewExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSNewExpression.java deleted file mode 100644 index bf5514c4e7b..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSNewExpression.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript new expression from the ESTree - * Specification - */ -public interface IJSNewExpression extends IJSCallExpression { - @Override - default String getType() { - return "NewExpression"; //$NON-NLS-1$ - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSObjectExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSObjectExpression.java deleted file mode 100644 index 3846da7cd1b..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSObjectExpression.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -import java.util.List; - -/** - * A JavaScript object expression from the ESTree - * Specification - */ -public interface IJSObjectExpression extends IJSExpression { - @Override - default String getType() { - return "ObjectExpression"; //$NON-NLS-1$ - } - - public List getProperties(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSPattern.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSPattern.java deleted file mode 100644 index 76f43430441..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSPattern.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript pattern from the ESTree Specification - */ -public interface IJSPattern extends IQmlASTNode { -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSProgram.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSProgram.java deleted file mode 100644 index 77bf10c5a00..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSProgram.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -import java.util.List; - -/** - * A JavaScript program from the ESTree Specification - */ -public interface IJSProgram extends IQmlASTNode { - @Override - default String getType() { - return "Program"; //$NON-NLS-1$ - } - - public List getBody(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSProperty.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSProperty.java deleted file mode 100644 index 8e5d055b3f3..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSProperty.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript object property from the ESTree - * Specification - */ -public interface IJSProperty extends IQmlASTNode { - @Override - default String getType() { - return "Property"; //$NON-NLS-1$ - } - - /** - * @return {@link IJSLiteral}, or {@link IJSIdentifier} - */ - public IQmlASTNode getKey(); - - public IJSExpression getValue(); - - public String getKind(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSRegExpLiteral.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSRegExpLiteral.java deleted file mode 100644 index 189e60a09d1..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSRegExpLiteral.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript regular expression literal from the - * ESTree Specification - */ -public interface IJSRegExpLiteral extends IJSLiteral { - /** - * A JavaScript regular expression that holds a pattern and a set of flags. Both are represented as plain Strings. - */ - public static class JSRegExp { - private final String pattern; - private final String flags; - - public JSRegExp(String pattern, String flags) { - this.pattern = pattern; - this.flags = flags; - } - - public String getPattern() { - return pattern; - } - - public String getFlags() { - return flags; - } - } - - public JSRegExp getRegex(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSReturnStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSReturnStatement.java deleted file mode 100644 index 3245c1165af..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSReturnStatement.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript return statement from the ESTree - * Specification - */ -public interface IJSReturnStatement extends IJSStatement { - @Override - default String getType() { - return "ReturnStatement"; //$NON-NLS-1$ - } - - public IJSExpression getArgument(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSSequenceExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSSequenceExpression.java deleted file mode 100644 index a6ff43bda5b..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSSequenceExpression.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -import java.util.List; - -/** - * A JavaScript sequence expression from the - * ESTree Specification - */ -public interface IJSSequenceExpression extends IJSExpression { - @Override - default String getType() { - return "SequenceExpression"; //$NON-NLS-1$ - } - - public List getExpressions(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSStatement.java deleted file mode 100644 index 1ba28e8fc2d..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSStatement.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript statement from the ESTree - * Specification - */ -public interface IJSStatement extends IQmlASTNode { -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSSwitchCase.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSSwitchCase.java deleted file mode 100644 index 332335af6b4..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSSwitchCase.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -import java.util.List; - -/** - * A JavaScript switch case from the ESTree - * Specification - */ -public interface IJSSwitchCase extends IQmlASTNode { - @Override - default String getType() { - return "SwitchCase"; //$NON-NLS-1$ - } - - public IJSExpression getTest(); - - public List getConsequent(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSSwitchStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSSwitchStatement.java deleted file mode 100644 index 72d41e5c9b4..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSSwitchStatement.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript switch statement from the ESTree - * Specification - */ -public interface IJSSwitchStatement extends IJSStatement { - @Override - default String getType() { - return "SwitchStatement"; //$NON-NLS-1$ - } - - public IJSExpression getDiscriminant(); - - public IJSSwitchCase getCases(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSThisExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSThisExpression.java deleted file mode 100644 index d63a7440ab4..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSThisExpression.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript this expression from the ESTree - * Specification - */ -public interface IJSThisExpression extends IJSExpression { - @Override - default String getType() { - return "ThisExpression"; //$NON-NLS-1$ - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSThrowStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSThrowStatement.java deleted file mode 100644 index 7b5989f078f..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSThrowStatement.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript throw statement from the ESTree - * Specification - */ -public interface IJSThrowStatement extends IJSStatement { - @Override - default String getType() { - return "ThrowStatement"; //$NON-NLS-1$ - } - - public IJSExpression getArgument(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSTryStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSTryStatement.java deleted file mode 100644 index 7b239380211..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSTryStatement.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript try statement from the ESTree - * Specification - */ -public interface IJSTryStatement extends IJSStatement { - @Override - default String getType() { - return "TryStatement"; //$NON-NLS-1$ - } - - public IJSBlockStatement getBlock(); - - public IJSCatchClause getHandler(); - - public IJSBlockStatement getFinalizer(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSUnaryExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSUnaryExpression.java deleted file mode 100644 index 32096eb2fc8..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSUnaryExpression.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript unary expression from the ESTree - * Specification - */ -public interface IJSUnaryExpression extends IJSExpression { - /** - * An Enumeration covering the 7 unary operators in JavaScript - */ - enum UnaryOperator { - Negation("-"), //$NON-NLS-1$ - Plus("+"), //$NON-NLS-1$ - Not("!"), //$NON-NLS-1$ - BitwiseNot("~"), //$NON-NLS-1$ - Typeof("typeof"), //$NON-NLS-1$ - Void("void"), //$NON-NLS-1$ - Delete("delete"); //$NON-NLS-1$ - - public static UnaryOperator fromObject(Object obj) { - if (obj instanceof String) { - for (UnaryOperator op : UnaryOperator.values()) { - if (obj.equals(op.toString())) { - return op; - } - } - } - return null; - } - - private final String op; - - private UnaryOperator(String op) { - this.op = op; - } - - @Override - public String toString() { - return this.op; - } - } - - @Override - default String getType() { - return "UnaryExpression"; //$NON-NLS-1$ - } - - public UnaryOperator getOperator(); - - public boolean isPrefix(); - - public IJSExpression getArgument(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSUpdateExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSUpdateExpression.java deleted file mode 100644 index dde9e30b2e8..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSUpdateExpression.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript update expression from the ESTree - * Specification - */ -public interface IJSUpdateExpression extends IQmlASTNode { - /** - * An Enumeration covering the two update operators in JavaScript - */ - enum UpdateOperator { - Decrement("--"), //$NON-NLS-1$ - Increment("++"); //$NON-NLS-1$ - - public static UpdateOperator fromObject(Object obj) { - if (obj instanceof String) { - for (UpdateOperator op : UpdateOperator.values()) { - if (obj.equals(op.toString())) { - return op; - } - } - } - return null; - } - - private final String op; - - private UpdateOperator(String op) { - this.op = op; - } - - @Override - public String toString() { - return this.op; - } - } - - @Override - default String getType() { - return "UpdateExpression"; //$NON-NLS-1$ - } - - public UpdateOperator getOperator(); - - public IJSExpression getArgument(); - - public boolean isPrefix(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSVariableDeclaration.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSVariableDeclaration.java deleted file mode 100644 index 7f56b199352..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSVariableDeclaration.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -import java.util.List; - -/** - * A JavaScript variable declaration from the - * ESTree Specification - */ -public interface IJSVariableDeclaration extends IJSDeclaration { - @Override - default String getType() { - return "VariableDeclaration"; //$NON-NLS-1$ - } - - public List getDeclarations(); - - default public String getKind() { - return "var"; //$NON-NLS-1$ - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSVariableDeclarator.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSVariableDeclarator.java deleted file mode 100644 index 1220f1a3b8c..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSVariableDeclarator.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript variable declarator from the - * ESTree Specification - */ -public interface IJSVariableDeclarator extends IQmlASTNode { - @Override - default String getType() { - return "VariableDeclarator"; //$NON-NLS-1$ - } - - public IJSPattern getIdentifier(); - - public IJSExpression getInit(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSWhileStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSWhileStatement.java deleted file mode 100644 index 86e285ebcd5..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSWhileStatement.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript while statement from the ESTree - * Specification - */ -public interface IJSWhileStatement extends IJSStatement { - @Override - default String getType() { - return "WhileStatement"; //$NON-NLS-1$ - } - - public IJSExpression getTest(); - - public IJSStatement getBody(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSWithStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSWithStatement.java deleted file mode 100644 index 0689cc26c56..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSWithStatement.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -/** - * A JavaScript with statement from the ESTree - * Specification - */ -public interface IJSWithStatement extends IJSStatement { - @Override - default String getType() { - return "WithStatement"; //$NON-NLS-1$ - } - - public IJSExpression getObject(); - - public IJSStatement getBody(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlASTNode.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlASTNode.java deleted file mode 100644 index 5a805c718ca..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlASTNode.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -import org.eclipse.cdt.qt.core.location.ISourceLocation; -import org.eclipse.cdt.qt.core.qmldir.IQDirASTNode; -import org.eclipse.cdt.qt.core.tern.ITernScope; - -/** - * The base node interface for all QML and JavaScript Abstract Syntax Tree elements. Conforms to the ESTree Specification as well as - * the extra features added by Acorn. - * - * @see ESTree Node Objects - */ -public interface IQmlASTNode { - - /** - * Gets the String representation of the type of AST node that this node represents. This is a bit redundant in Java with access - * to instanceof, but is provided for the sake of conforming to the ESTree Specification for node objects. - * - * @return the String representation of this node - */ - public String getType(); - - /** - * Gets a more detailed description of this node's location than {@link IQDirASTNode#getStart()} and - * {@link IQDirASTNode#getStart()}. This method allows the retrieval of line and column information in order to make output for - * syntax errors and the like more human-readable.
- *
- * Note: It is necessary to set the 'locations' option to true when parsing with acorn in order to use this - * method. - * - * @return the {@link ISourceLocation} representing this node's location in the source or null if not available - */ - public ISourceLocation getLocation(); - - /** - * Gets the range of this node if available. A range is an array of two integers containing the start and end offset of this - * node in that order. Like {@link IQmlASTNode#getStart()} and {@link IQmlASTNode#getEnd()}, this method returns zero-indexed - * offsets relative to the beginning of the source.
- *
- * Note: It is necessary to set the 'ranges' option to true when parsing with acorn in order to use this - * method. - * - * @return the range of this node or null if not available - */ - public int[] getRange(); - - /** - * Gets the zero-indexed offset indicating the start of this node relative to the beginning of the source. - * - * @return the node's start offset - */ - public int getStart(); - - /** - * Gets the zero-indexed offset indicating the end of this node relative to the beginning of the source. - * - * @return the node's end offset - */ - public int getEnd(); - - /** - * Gets the {@link ITernScope} attached to this node if one exists. This method will only return a non-null value if the AST was - * already processed by Tern. For example, if the AST was retrieved from Tern using the 'parseFile' query, then at least one of - * the AST nodes will contain a scope object. However, if the 'parseString' query was used, no static analysis will be performed - * on the parsed AST and there will be no scope objects attached to any of its nodes. - * - * @return the Tern scope or null if not available - */ - public ITernScope getScope(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlArrayBinding.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlArrayBinding.java deleted file mode 100644 index eabaaee9cdc..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlArrayBinding.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -import java.util.List; - -public interface IQmlArrayBinding extends IQmlBinding { - @Override - default public String getType() { - return "QMLArrayBinding"; //$NON-NLS-1$ - } - - public List getElements(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlBinding.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlBinding.java deleted file mode 100644 index 7e69c0f5fb4..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlBinding.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -public interface IQmlBinding extends IQmlASTNode { -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlHeaderItem.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlHeaderItem.java deleted file mode 100644 index 32f6dddf575..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlHeaderItem.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -public interface IQmlHeaderItem extends IQmlASTNode { -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlHeaderItemList.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlHeaderItemList.java deleted file mode 100644 index 65a102adea8..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlHeaderItemList.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -import java.util.List; - -public interface IQmlHeaderItemList extends IQmlASTNode { - public List getItems(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlImport.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlImport.java deleted file mode 100644 index 6529a7765f0..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlImport.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -public interface IQmlImport extends IQmlHeaderItem { - @Override - default public String getType() { - return "QMLImport"; //$NON-NLS-1$ - } - - public IQmlModule getModule(); - - public IJSLiteral getDirectory(); - - public IQmlQualifier getQualifier(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlModule.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlModule.java deleted file mode 100644 index 8ddf4bc47de..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlModule.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -public interface IQmlModule extends IQmlASTNode { - public IQmlQualifiedID getIdentifier(); - - public IQmlVersionLiteral getVersion(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlObjectBinding.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlObjectBinding.java deleted file mode 100644 index 62601ffef23..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlObjectBinding.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -public interface IQmlObjectBinding extends IQmlBinding { - @Override - default public String getType() { - return "QMLObjectBinding"; //$NON-NLS-1$ - } - - public IQmlQualifiedID getIdentifier(); - - public IQmlObjectInitializer getBody(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlObjectDefinition.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlObjectDefinition.java deleted file mode 100644 index bfe205e3854..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlObjectDefinition.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -public interface IQmlObjectDefinition extends IQmlObjectMember { - @Override - default public String getType() { - return "QMLObjectDefinition"; //$NON-NLS-1$ - } - - public IQmlQualifiedID getIdentifier(); - - public IQmlObjectInitializer getBody(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlObjectInitializer.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlObjectInitializer.java deleted file mode 100644 index 7c642b3e6a7..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlObjectInitializer.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -import java.util.List; - -public interface IQmlObjectInitializer extends IQmlASTNode { - @Override - default public String getType() { - return "QMLObjectInitializer"; //$NON-NLS-1$ - } - - public List getMembers(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlObjectMember.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlObjectMember.java deleted file mode 100644 index 68c722d2806..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlObjectMember.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -public interface IQmlObjectMember extends IQmlASTNode { -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlParameter.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlParameter.java deleted file mode 100644 index ce0f11de4fd..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlParameter.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -public interface IQmlParameter extends IQmlASTNode { - @Override - default public String getType() { - return "QMLParameter"; //$NON-NLS-1$ - } - - public IQmlPropertyType getKind(); - - public IJSIdentifier getIdentifier(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlPragma.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlPragma.java deleted file mode 100644 index 0f78b56fb44..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlPragma.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -public interface IQmlPragma extends IQmlHeaderItem { - @Override - default public String getType() { - return "QMLPragma"; //$NON-NLS-1$ - } - - public IQmlQualifiedID getIdentifier(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlProgram.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlProgram.java deleted file mode 100644 index 2143081e33b..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlProgram.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -public interface IQmlProgram extends IQmlASTNode { - public static enum Modes { - QML("qml"), QMLTypes("qmltypes"), JavaScript("js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - - private final String ident; - - private Modes(String s) { - this.ident = s; - } - - public String getModeIdentifier() { - return this.ident; - } - } - - @Override - default public String getType() { - return "QMLProgram"; //$NON-NLS-1$ - } - - public Modes getMode(); - - public IQmlHeaderItemList getHeaderItemList(); - - public IQmlRootObject getRootObject(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlPropertyBinding.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlPropertyBinding.java deleted file mode 100644 index 6526b90e0a8..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlPropertyBinding.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -public interface IQmlPropertyBinding extends IQmlObjectMember { - @Override - default public String getType() { - return "QMLPropertyBinding"; //$NON-NLS-1$ - } - - public IQmlQualifiedID getIdentifier(); - - public IQmlBinding getBinding(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlPropertyDeclaration.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlPropertyDeclaration.java deleted file mode 100644 index 19e8a3ef04b..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlPropertyDeclaration.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -public interface IQmlPropertyDeclaration extends IQmlObjectMember { - @Override - default public String getType() { - return "QMLPropertyDeclaration"; //$NON-NLS-1$ - } - - public boolean isReadonly(); - - public boolean isDefault(); - - public IQmlPropertyType getKind(); - - public IQmlPropertyType getModifier(); - - public IJSIdentifier getIdentifier(); - - public IQmlBinding getBinding(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlPropertyType.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlPropertyType.java deleted file mode 100644 index 3f6a1942492..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlPropertyType.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -public interface IQmlPropertyType extends IQmlASTNode { - @Override - default public String getType() { - return "QMLPropertyType"; //$NON-NLS-1$ - } - - public boolean isPrimitive(); - - public IJSIdentifier getIdentifier(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlQualifiedID.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlQualifiedID.java deleted file mode 100644 index ea714e794fd..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlQualifiedID.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -import java.util.List; - -public interface IQmlQualifiedID extends IQmlASTNode { - @Override - default public String getType() { - return "QMLQualifiedID"; //$NON-NLS-1$ - } - - public List getParts(); - - public String getName(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlQualifier.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlQualifier.java deleted file mode 100644 index 690d033e2a5..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlQualifier.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -public interface IQmlQualifier extends IQmlASTNode { - @Override - default public String getType() { - return "QMLQualifier"; //$NON-NLS-1$ - } - - public IJSIdentifier getIdentifier(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlRootObject.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlRootObject.java deleted file mode 100644 index e2cde117ee4..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlRootObject.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -public interface IQmlRootObject extends IQmlObjectDefinition { -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlScriptBinding.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlScriptBinding.java deleted file mode 100644 index d4288588a49..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlScriptBinding.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -public interface IQmlScriptBinding extends IQmlBinding { - @Override - default public String getType() { - return "QMLScriptBinding"; //$NON-NLS-1$ - } - - public boolean isBlock(); - - /** - * @return {@link IJSExpression}, or {@link IQmlStatementBlock} - */ - public IQmlASTNode getScript(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlSignalDefinition.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlSignalDefinition.java deleted file mode 100644 index 27a34f2b22a..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlSignalDefinition.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -import java.util.List; - -public interface IQmlSignalDefinition extends IQmlObjectMember { - @Override - default public String getType() { - return "QMLSignalDefinition"; //$NON-NLS-1$ - } - - public IJSIdentifier getIdentifier(); - - public List getParams(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlStatementBlock.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlStatementBlock.java deleted file mode 100644 index 86ab220a22a..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlStatementBlock.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -import java.util.List; - -public interface IQmlStatementBlock extends IQmlASTNode { - @Override - default public String getType() { - return "QMLStatementBlock"; //$NON-NLS-1$ - } - - public List getBody(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlVersionLiteral.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlVersionLiteral.java deleted file mode 100644 index b6e1f0d7082..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlVersionLiteral.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -public interface IQmlVersionLiteral extends IQmlASTNode { - @Override - default public String getType() { - return "QMLVersionLiteral"; //$NON-NLS-1$ - } - - public double getValue(); - - public String getRaw(); -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/QMLExpressionEvaluator.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/QMLExpressionEvaluator.java deleted file mode 100644 index cec954d51cd..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/QMLExpressionEvaluator.java +++ /dev/null @@ -1,123 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.qmljs; - -public final class QMLExpressionEvaluator { - private QMLExpressionEvaluator() { - } - - public static class InvalidExpressionException extends Exception { - - private static final long serialVersionUID = 4803923632666457229L; - - private IJSExpression offendingExpression; - - public InvalidExpressionException(String msg, IJSExpression expr) { - super(msg); - this.offendingExpression = expr; - } - - public IJSExpression getOffendingExpression() { - return offendingExpression; - } - } - - /** - * Evaluates the given {@link IJSExpression} as a constant expression and returns the result. At the moment this only supports - * very simple expressions involving unary operators and literals alone. Support for more complex expressions will be added as - * needed. - * - * @param expr - * the expression to be evaluated - * - * @throws InvalidExpressionException - * if the given expression can't be reduced to a single constant - */ - public static Object evaluateConstExpr(IJSExpression expr) throws InvalidExpressionException { - if (expr instanceof IJSLiteral) { - return ((IJSLiteral) expr).getValue(); - } else if (expr instanceof IJSUnaryExpression) { - IJSUnaryExpression unary = (IJSUnaryExpression) expr; - Object arg = evaluateConstExpr(unary.getArgument()); - switch (unary.getOperator()) { - case Plus: - return unaryPlus(arg, unary.getArgument()); - case Negation: - return unaryNegate(arg, unary.getArgument()); - case BitwiseNot: - return unaryBitwiseNot(arg, unary.getArgument()); - case Not: - return unaryNot(arg, unary.getArgument()); - default: - } - } - throw new InvalidExpressionException("Cannot reduce '" + expr + "' to a constant", expr); //$NON-NLS-1$ //$NON-NLS-2$ - } - - private static Object unaryPlus(Object object, IJSExpression expr) throws InvalidExpressionException { - if (object instanceof Byte) { - return +((Byte) object); - } else if (object instanceof Short) { - return +((Short) object); - } else if (object instanceof Integer) { - return +((Integer) object); - } else if (object instanceof Long) { - return +((Long) object); - } else if (object instanceof Float) { - return +((Float) object); - } else if (object instanceof Double) { - return +((Double) object); - } - throw new InvalidExpressionException("Cannot perform unary plus operation on a non-number", expr); //$NON-NLS-1$ - } - - private static Object unaryNegate(Object object, IJSExpression expr) throws InvalidExpressionException { - if (object instanceof Byte) { - return -((Byte) object); - } else if (object instanceof Short) { - return -((Short) object); - } else if (object instanceof Integer) { - return -((Integer) object); - } else if (object instanceof Long) { - return -((Long) object); - } else if (object instanceof Float) { - return -((Float) object); - } else if (object instanceof Double) { - return -((Double) object); - } - throw new InvalidExpressionException("Cannot perform unary negation operation on a non-number", expr); //$NON-NLS-1$ - } - - private static Object unaryBitwiseNot(Object object, IJSExpression expr) throws InvalidExpressionException { - if (object instanceof Byte) { - return ~((Byte) object); - } else if (object instanceof Short) { - return ~((Short) object); - } else if (object instanceof Integer) { - return ~((Integer) object); - } else if (object instanceof Long) { - return ~((Long) object); - } else if (object instanceof Float || object instanceof Double) { - return ~((Number) object).longValue(); - } - throw new InvalidExpressionException("Cannot perform binary not operation on a non-number", expr); //$NON-NLS-1$ - } - - private static Object unaryNot(Object object, IJSExpression expr) throws InvalidExpressionException { - if (object instanceof Boolean) { - return !((Boolean) object); - } - throw new InvalidExpressionException("Cannot perform unary not operation on a non-boolean", expr); //$NON-NLS-1$ - } -} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/tern/ITernScope.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/tern/ITernScope.java deleted file mode 100644 index 115e48c7721..00000000000 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/tern/ITernScope.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 QNX Software Systems and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.qt.core.tern; - -public interface ITernScope { - // TODO: Determine the necessary components of a Tern Scope -} diff --git a/qt/org.eclipse.cdt.qt.core/templates/project/Qt5/DateTime.cpp b/qt/org.eclipse.cdt.qt.core/templates/project/Qt5/DateTime.cpp deleted file mode 100644 index 45e79c7c617..00000000000 --- a/qt/org.eclipse.cdt.qt.core/templates/project/Qt5/DateTime.cpp +++ /dev/null @@ -1,17 +0,0 @@ - -#include "DateTime.h" -#include - -DateTime::DateTime() -{ - startTimer( 500 ); -} - -DateTime::~DateTime() -{ -} - -void DateTime::timerEvent( QTimerEvent * ) -{ - emit changed( QDateTime::currentDateTime().toString( "yyyy-MM-dd hh:mm:ss" ) ); -} diff --git a/qt/org.eclipse.cdt.qt.core/templates/project/Qt5/DateTime.h b/qt/org.eclipse.cdt.qt.core/templates/project/Qt5/DateTime.h deleted file mode 100644 index fca23e2c785..00000000000 --- a/qt/org.eclipse.cdt.qt.core/templates/project/Qt5/DateTime.h +++ /dev/null @@ -1,22 +0,0 @@ - -#ifndef DATETIME_H -#define DATETIME_H - -#include - -class DateTime : public QObject -{ -Q_OBJECT - -public: - DateTime(); - virtual ~DateTime(); - -protected: - virtual void timerEvent( QTimerEvent * ); - -signals: - void changed( QString now ); -}; - -#endif diff --git a/qt/org.eclipse.cdt.qt.core/templates/project/Qt5/Makefile b/qt/org.eclipse.cdt.qt.core/templates/project/Qt5/Makefile deleted file mode 100644 index 37330a949ef..00000000000 --- a/qt/org.eclipse.cdt.qt.core/templates/project/Qt5/Makefile +++ /dev/null @@ -1,20 +0,0 @@ - -PRO = {{baseName}}.pro -QMAKE = {{qmake.Qt5}} - -all: QtMakefile - $(MAKE) -f QtMakefile - -clean: - rm -fr QtMakefile QtMakefile.debug QtMakefile.release debug release - -QtMakefile: - $(QMAKE) -o QtMakefile $(PRO) CONFIG+=debug_and_release - -debug: QtMakefile - $(MAKE) -f QtMakefile debug - -release: QtMakefile - $(MAKE) -f QtMakefile release - -.PHONY: all clean debug clean-debug release clean-release diff --git a/qt/org.eclipse.cdt.qt.core/templates/project/Qt5/baseName.cpp b/qt/org.eclipse.cdt.qt.core/templates/project/Qt5/baseName.cpp deleted file mode 100644 index cea282c8f7a..00000000000 --- a/qt/org.eclipse.cdt.qt.core/templates/project/Qt5/baseName.cpp +++ /dev/null @@ -1,20 +0,0 @@ - -#include "DateTime.h" -#include -#include - -int main( int argc, char * argv[] ) -{ - QGuiApplication app(argc, argv); - - DateTime datetime; - - QQuickView view; - view.rootContext()->setContextProperty( "datetimeModel", &datetime ); - view.setSource( QStringLiteral( "src/$(baseName).qml" ) ); - view.show(); - - app.connect( view.engine(), SIGNAL( quit() ), SLOT( quit() ) ); - - return app.exec(); -} diff --git a/qt/org.eclipse.cdt.qt.core/templates/project/Qt5/baseName.pro b/qt/org.eclipse.cdt.qt.core/templates/project/Qt5/baseName.pro deleted file mode 100644 index 91020460b81..00000000000 --- a/qt/org.eclipse.cdt.qt.core/templates/project/Qt5/baseName.pro +++ /dev/null @@ -1,4 +0,0 @@ -QT += qml quick -HEADERS = src/DateTime.h -SOURCES = src/DateTime.cpp src/{{baseName}}.cpp -RESOURCES = diff --git a/qt/org.eclipse.cdt.qt.core/templates/project/Qt5/baseName.qml b/qt/org.eclipse.cdt.qt.core/templates/project/Qt5/baseName.qml deleted file mode 100644 index 527072d536a..00000000000 --- a/qt/org.eclipse.cdt.qt.core/templates/project/Qt5/baseName.qml +++ /dev/null @@ -1,38 +0,0 @@ -import QtQuick 2.0 - -Rectangle { - width: 480 - height: 320 - color: "lightblue" - - MouseArea { - anchors.fill: parent - onClicked: Qt.quit() - } - - Text { - id: title - text: "Hello World from Qt5" - font.family: "Helvetica" - font.pointSize: 24 - anchors.centerIn: parent - } - - Text { - id: datetime - objectName: "datetime" - font.family: "Helvetica" - font.pointSize: 16 - anchors { - horizontalCenter: title.horizontalCenter - top: title.bottom - } - - Connections { - target: datetimeModel - onChanged: { - datetime.text = now - } - } - } -} diff --git a/qt/org.eclipse.cdt.qt.core/templates/project/Qt5/template.properties b/qt/org.eclipse.cdt.qt.core/templates/project/Qt5/template.properties deleted file mode 100644 index 0a104c2567a..00000000000 --- a/qt/org.eclipse.cdt.qt.core/templates/project/Qt5/template.properties +++ /dev/null @@ -1,17 +0,0 @@ -############################################################################### -# Copyright (c) 2013 QNX Software Systems and others. -# -# This program and the accompanying materials -# are made available under the terms of the Eclipse Public License 2.0 -# which accompanies this distribution, and is available at -# https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0" -############################################################################### - -Qt5HelloWorld.label=Qt5 Hello World Project -Qt5HelloWorld.description=A sample Qt5 QtQuick2 project -Qt5HelloWorld.basics.label=Basic Settings -Qt5HelloWorld.basics.description=Basic properties of a project -Qt5HelloWorld.qmake.label=Qt5 qmake location -Qt5HelloWorld.qmake.description=Location of the qmake executable diff --git a/qt/org.eclipse.cdt.qt.core/templates/project/Qt5/template.xml b/qt/org.eclipse.cdt.qt.core/templates/project/Qt5/template.xml deleted file mode 100644 index 6472ed232c5..00000000000 --- a/qt/org.eclipse.cdt.qt.core/templates/project/Qt5/template.xml +++ /dev/null @@ -1,102 +0,0 @@ - - diff --git a/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/main.cpp b/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/main.cpp deleted file mode 100644 index 9835fbac6ba..00000000000 --- a/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/main.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include - -int main(int argc, char *argv[]) { - QGuiApplication app(argc, argv); - - QQmlApplicationEngine engine; - engine.load(QUrl(QStringLiteral("qrc:/${projectName}.qml"))); - - return app.exec(); -} diff --git a/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/main.pro b/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/main.pro deleted file mode 100644 index 0ff331f0480..00000000000 --- a/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/main.pro +++ /dev/null @@ -1,16 +0,0 @@ -TEMPLATE = app - -QT += qml quick -CONFIG += c++11 - -RESOURCES += ${projectName}.qrc - -qml.files = ${projectName}.qml - -launch_modeall { - CONFIG(debug, debug|release) { - DESTDIR = debug - } else { - DESTDIR = release - } -} diff --git a/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/main.qml b/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/main.qml deleted file mode 100644 index ff717c4659f..00000000000 --- a/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/main.qml +++ /dev/null @@ -1,18 +0,0 @@ -import QtQuick 2.3 -import QtQuick.Window 2.2 - -Window { - visible: true - - MouseArea { - anchors.fill: parent - onClicked: { - Qt.quit(); - } - } - - Text { - text: qsTr("Hello World") - anchors.centerIn: parent - } -} diff --git a/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/main.qrc b/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/main.qrc deleted file mode 100644 index 274d26dc9bb..00000000000 --- a/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/main.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - ${projectName}.qml - - diff --git a/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/manifest.xml b/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/manifest.xml deleted file mode 100644 index 7a88c74085c..00000000000 --- a/qt/org.eclipse.cdt.qt.core/templates/project2/appProject/manifest.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/tern-qml/.gitignore b/qt/org.eclipse.cdt.qt.core/tern-qml/.gitignore deleted file mode 100644 index 2ccbe4656c6..00000000000 --- a/qt/org.eclipse.cdt.qt.core/tern-qml/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/node_modules/ diff --git a/qt/org.eclipse.cdt.qt.core/tern-qml/.npmignore b/qt/org.eclipse.cdt.qt.core/tern-qml/.npmignore deleted file mode 100644 index 5ac75016525..00000000000 --- a/qt/org.eclipse.cdt.qt.core/tern-qml/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -/test -/node_modules -/.settings -.project -.tern-project \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/tern-qml/Makefile b/qt/org.eclipse.cdt.qt.core/tern-qml/Makefile deleted file mode 100644 index 57bdb711559..00000000000 --- a/qt/org.eclipse.cdt.qt.core/tern-qml/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -DIST = \ - dist/acorn/dist/acorn.js \ - dist/acorn/dist/acorn_loose.js \ - dist/acorn/dist/walk.js \ - dist/tern/lib/signal.js \ - dist/tern/lib/tern.js \ - dist/tern/lib/def.js \ - dist/tern/lib/comment.js \ - dist/tern/lib/infer.js - -all: $(DIST) - -dist/%: node_modules/% - @mkdir -p $(dir $@) - cp $^ $@ - -clean: - rm -fr dist diff --git a/qt/org.eclipse.cdt.qt.core/tern-qml/demo/defs/ecma5.json.js b/qt/org.eclipse.cdt.qt.core/tern-qml/demo/defs/ecma5.json.js deleted file mode 100644 index 41391c6ebcf..00000000000 --- a/qt/org.eclipse.cdt.qt.core/tern-qml/demo/defs/ecma5.json.js +++ /dev/null @@ -1,966 +0,0 @@ -var ecma5 = { - "!name": "ecma5", - "!define": {"Error.prototype": "Error.prototype"}, - "Infinity": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Infinity", - "!doc": "A numeric value representing infinity." - }, - "undefined": { - "!type": "?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/undefined", - "!doc": "The value undefined." - }, - "NaN": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/NaN", - "!doc": "A value representing Not-A-Number." - }, - "Object": { - "!type": "fn()", - "getPrototypeOf": { - "!type": "fn(obj: ?) -> ?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getPrototypeOf", - "!doc": "Returns the prototype (i.e. the internal prototype) of the specified object." - }, - "create": { - "!type": "fn(proto: ?) -> !custom:Object_create", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/create", - "!doc": "Creates a new object with the specified prototype object and properties." - }, - "defineProperty": { - "!type": "fn(obj: ?, prop: string, desc: ?) -> !custom:Object_defineProperty", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperty", - "!doc": "Defines a new property directly on an object, or modifies an existing property on an object, and returns the object. If you want to see how to use the Object.defineProperty method with a binary-flags-like syntax, see this article." - }, - "defineProperties": { - "!type": "fn(obj: ?, props: ?) -> !custom:Object_defineProperties", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperty", - "!doc": "Defines a new property directly on an object, or modifies an existing property on an object, and returns the object. If you want to see how to use the Object.defineProperty method with a binary-flags-like syntax, see this article." - }, - "getOwnPropertyDescriptor": { - "!type": "fn(obj: ?, prop: string) -> ?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor", - "!doc": "Returns a property descriptor for an own property (that is, one directly present on an object, not present by dint of being along an object's prototype chain) of a given object." - }, - "keys": { - "!type": "fn(obj: ?) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/keys", - "!doc": "Returns an array of a given object's own enumerable properties, in the same order as that provided by a for-in loop (the difference being that a for-in loop enumerates properties in the prototype chain as well)." - }, - "getOwnPropertyNames": { - "!type": "fn(obj: ?) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames", - "!doc": "Returns an array of all properties (enumerable or not) found directly upon a given object." - }, - "seal": { - "!type": "fn(obj: ?)", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/seal", - "!doc": "Seals an object, preventing new properties from being added to it and marking all existing properties as non-configurable. Values of present properties can still be changed as long as they are writable." - }, - "isSealed": { - "!type": "fn(obj: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/isSealed", - "!doc": "Determine if an object is sealed." - }, - "freeze": { - "!type": "fn(obj: ?) -> !0", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/freeze", - "!doc": "Freezes an object: that is, prevents new properties from being added to it; prevents existing properties from being removed; and prevents existing properties, or their enumerability, configurability, or writability, from being changed. In essence the object is made effectively immutable. The method returns the object being frozen." - }, - "isFrozen": { - "!type": "fn(obj: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/isFrozen", - "!doc": "Determine if an object is frozen." - }, - "preventExtensions": { - "!type": "fn(obj: ?)", - "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/preventExtensions", - "!doc": "Prevents new properties from ever being added to an object." - }, - "isExtensible": { - "!type": "fn(obj: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible", - "!doc": "The Object.isExtensible() method determines if an object is extensible (whether it can have new properties added to it)." - }, - "prototype": { - "!stdProto": "Object", - "toString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/toString", - "!doc": "Returns a string representing the object." - }, - "toLocaleString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/toLocaleString", - "!doc": "Returns a string representing the object. This method is meant to be overriden by derived objects for locale-specific purposes." - }, - "valueOf": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/valueOf", - "!doc": "Returns the primitive value of the specified object" - }, - "hasOwnProperty": { - "!type": "fn(prop: string) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/hasOwnProperty", - "!doc": "Returns a boolean indicating whether the object has the specified property." - }, - "propertyIsEnumerable": { - "!type": "fn(prop: string) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable", - "!doc": "Returns a Boolean indicating whether the specified property is enumerable." - }, - "isPrototypeOf": { - "!type": "fn(obj: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isPrototypeOf", - "!doc": "Tests for an object in another object's prototype chain." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object", - "!doc": "Creates an object wrapper." - }, - "Function": { - "!type": "fn(body: string) -> fn()", - "prototype": { - "!stdProto": "Function", - "apply": { - "!type": "fn(this: ?, args: [?])", - "!effects": [ - "call and return !this this=!0 !1. !1. !1." - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/apply", - "!doc": "Calls a function with a given this value and arguments provided as an array (or an array like object)." - }, - "call": { - "!type": "fn(this: ?, args?: ?) -> !this.!ret", - "!effects": [ - "call and return !this this=!0 !1 !2 !3 !4" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/call", - "!doc": "Calls a function with a given this value and arguments provided individually." - }, - "bind": { - "!type": "fn(this: ?, args?: ?) -> !custom:Function_bind", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/bind", - "!doc": "Creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function was called." - }, - "prototype": "?" - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function", - "!doc": "Every function in JavaScript is actually a Function object." - }, - "Array": { - "!type": "fn(size: number) -> !custom:Array_ctor", - "isArray": { - "!type": "fn(value: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/isArray", - "!doc": "Returns true if an object is an array, false if it is not." - }, - "prototype": { - "!stdProto": "Array", - "length": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/length", - "!doc": "An unsigned, 32-bit integer that specifies the number of elements in an array." - }, - "concat": { - "!type": "fn(other: [?]) -> !this", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/concat", - "!doc": "Returns a new array comprised of this array joined with other array(s) and/or value(s)." - }, - "join": { - "!type": "fn(separator?: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/join", - "!doc": "Joins all elements of an array into a string." - }, - "splice": { - "!type": "fn(pos: number, amount: number)", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/splice", - "!doc": "Changes the content of an array, adding new elements while removing old elements." - }, - "pop": { - "!type": "fn() -> !this.", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/pop", - "!doc": "Removes the last element from an array and returns that element." - }, - "push": { - "!type": "fn(newelt: ?) -> number", - "!effects": [ - "propagate !0 !this." - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/push", - "!doc": "Mutates an array by appending the given elements and returning the new length of the array." - }, - "shift": { - "!type": "fn() -> !this.", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/shift", - "!doc": "Removes the first element from an array and returns that element. This method changes the length of the array." - }, - "unshift": { - "!type": "fn(newelt: ?) -> number", - "!effects": [ - "propagate !0 !this." - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/unshift", - "!doc": "Adds one or more elements to the beginning of an array and returns the new length of the array." - }, - "slice": { - "!type": "fn(from: number, to?: number) -> !this", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/slice", - "!doc": "Returns a shallow copy of a portion of an array." - }, - "reverse": { - "!type": "fn()", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/reverse", - "!doc": "Reverses an array in place. The first array element becomes the last and the last becomes the first." - }, - "sort": { - "!type": "fn(compare?: fn(a: ?, b: ?) -> number)", - "!effects": [ - "call !0 !this. !this." - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/sort", - "!doc": "Sorts the elements of an array in place and returns the array." - }, - "indexOf": { - "!type": "fn(elt: ?, from?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/indexOf", - "!doc": "Returns the first index at which a given element can be found in the array, or -1 if it is not present." - }, - "lastIndexOf": { - "!type": "fn(elt: ?, from?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/lastIndexOf", - "!doc": "Returns the last index at which a given element can be found in the array, or -1 if it is not present. The array is searched backwards, starting at fromIndex." - }, - "every": { - "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> bool", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/every", - "!doc": "Tests whether all elements in the array pass the test implemented by the provided function." - }, - "some": { - "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> bool", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/some", - "!doc": "Tests whether some element in the array passes the test implemented by the provided function." - }, - "filter": { - "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> !this", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/filter", - "!doc": "Creates a new array with all elements that pass the test implemented by the provided function." - }, - "forEach": { - "!type": "fn(f: fn(elt: ?, i: number), context?: ?)", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach", - "!doc": "Executes a provided function once per array element." - }, - "map": { - "!type": "fn(f: fn(elt: ?, i: number) -> ?, context?: ?) -> [!0.!ret]", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/map", - "!doc": "Creates a new array with the results of calling a provided function on every element in this array." - }, - "reduce": { - "!type": "fn(combine: fn(sum: ?, elt: ?, i: number) -> ?, init?: ?) -> !0.!ret", - "!effects": [ - "call !0 !1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/Reduce", - "!doc": "Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value." - }, - "reduceRight": { - "!type": "fn(combine: fn(sum: ?, elt: ?, i: number) -> ?, init?: ?) -> !0.!ret", - "!effects": [ - "call !0 !1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/ReduceRight", - "!doc": "Apply a function simultaneously against two values of the array (from right-to-left) as to reduce it to a single value." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array", - "!doc": "The JavaScript Array global object is a constructor for arrays, which are high-level, list-like objects." - }, - "String": { - "!type": "fn(value: ?) -> string", - "fromCharCode": { - "!type": "fn(code: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/fromCharCode", - "!doc": "Returns a string created by using the specified sequence of Unicode values." - }, - "prototype": { - "!stdProto": "String", - "length": { - "!type": "number", - "!url": "https://developer.mozilla.org/en/docs/JavaScript/Reference/Global_Objects/String/length", - "!doc": "Represents the length of a string." - }, - "": "string", - "charAt": { - "!type": "fn(i: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/charAt", - "!doc": "Returns the specified character from a string." - }, - "charCodeAt": { - "!type": "fn(i: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/charCodeAt", - "!doc": "Returns the numeric Unicode value of the character at the given index (except for unicode codepoints > 0x10000)." - }, - "indexOf": { - "!type": "fn(char: string, from?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/indexOf", - "!doc": "Returns the index within the calling String object of the first occurrence of the specified value, starting the search at fromIndex,\nreturns -1 if the value is not found." - }, - "lastIndexOf": { - "!type": "fn(char: string, from?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/lastIndexOf", - "!doc": "Returns the index within the calling String object of the last occurrence of the specified value, or -1 if not found. The calling string is searched backward, starting at fromIndex." - }, - "substring": { - "!type": "fn(from: number, to?: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/substring", - "!doc": "Returns a subset of a string between one index and another, or through the end of the string." - }, - "substr": { - "!type": "fn(from: number, length?: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/substr", - "!doc": "Returns the characters in a string beginning at the specified location through the specified number of characters." - }, - "slice": { - "!type": "fn(from: number, to?: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/slice", - "!doc": "Extracts a section of a string and returns a new string." - }, - "trim": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/Trim", - "!doc": "Removes whitespace from both ends of the string." - }, - "toUpperCase": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toUpperCase", - "!doc": "Returns the calling string value converted to uppercase." - }, - "toLowerCase": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLowerCase", - "!doc": "Returns the calling string value converted to lowercase." - }, - "toLocaleUpperCase": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase", - "!doc": "Returns the calling string value converted to upper case, according to any locale-specific case mappings." - }, - "toLocaleLowerCase": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase", - "!doc": "Returns the calling string value converted to lower case, according to any locale-specific case mappings." - }, - "split": { - "!type": "fn(pattern: string) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/split", - "!doc": "Splits a String object into an array of strings by separating the string into substrings." - }, - "concat": { - "!type": "fn(other: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/concat", - "!doc": "Combines the text of two or more strings and returns a new string." - }, - "localeCompare": { - "!type": "fn(other: string) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/localeCompare", - "!doc": "Returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order." - }, - "match": { - "!type": "fn(pattern: +RegExp) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/match", - "!doc": "Used to retrieve the matches when matching a string against a regular expression." - }, - "replace": { - "!type": "fn(pattern: string|+RegExp, replacement: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/replace", - "!doc": "Returns a new string with some or all matches of a pattern replaced by a replacement. The pattern can be a string or a RegExp, and the replacement can be a string or a function to be called for each match." - }, - "search": { - "!type": "fn(pattern: +RegExp) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/search", - "!doc": "Executes the search for a match between a regular expression and this String object." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String", - "!doc": "The String global object is a constructor for strings, or a sequence of characters." - }, - "Number": { - "!type": "fn(value: ?) -> number", - "MAX_VALUE": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/MAX_VALUE", - "!doc": "The maximum numeric value representable in JavaScript." - }, - "MIN_VALUE": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/MIN_VALUE", - "!doc": "The smallest positive numeric value representable in JavaScript." - }, - "POSITIVE_INFINITY": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/POSITIVE_INFINITY", - "!doc": "A value representing the positive Infinity value." - }, - "NEGATIVE_INFINITY": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/NEGATIVE_INFINITY", - "!doc": "A value representing the negative Infinity value." - }, - "prototype": { - "!stdProto": "Number", - "toString": { - "!type": "fn(radix?: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toString", - "!doc": "Returns a string representing the specified Number object" - }, - "toFixed": { - "!type": "fn(digits: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toFixed", - "!doc": "Formats a number using fixed-point notation" - }, - "toExponential": { - "!type": "fn(digits: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toExponential", - "!doc": "Returns a string representing the Number object in exponential notation" - }, - "toPrecision": { - "!type": "fn(digits: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toPrecision", - "!doc": "The toPrecision() method returns a string representing the number to the specified precision." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number", - "!doc": "The Number JavaScript object is a wrapper object allowing you to work with numerical values. A Number object is created using the Number() constructor." - }, - "Boolean": { - "!type": "fn(value: ?) -> bool", - "prototype": { - "!stdProto": "Boolean" - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean", - "!doc": "The Boolean object is an object wrapper for a boolean value." - }, - "RegExp": { - "!type": "fn(source: string, flags?: string)", - "prototype": { - "!stdProto": "RegExp", - "exec": { - "!type": "fn(input: string) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/exec", - "!doc": "Executes a search for a match in a specified string. Returns a result array, or null." - }, - "test": { - "!type": "fn(input: string) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/test", - "!doc": "Executes the search for a match between a regular expression and a specified string. Returns true or false." - }, - "global": { - "!type": "bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", - "!doc": "Creates a regular expression object for matching text with a pattern." - }, - "ignoreCase": { - "!type": "bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", - "!doc": "Creates a regular expression object for matching text with a pattern." - }, - "multiline": { - "!type": "bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/multiline", - "!doc": "Reflects whether or not to search in strings across multiple lines.\n" - }, - "source": { - "!type": "string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/source", - "!doc": "A read-only property that contains the text of the pattern, excluding the forward slashes.\n" - }, - "lastIndex": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/lastIndex", - "!doc": "A read/write integer property that specifies the index at which to start the next match." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", - "!doc": "Creates a regular expression object for matching text with a pattern." - }, - "Date": { - "!type": "fn(ms: number)", - "parse": { - "!type": "fn(source: string) -> +Date", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/parse", - "!doc": "Parses a string representation of a date, and returns the number of milliseconds since January 1, 1970, 00:00:00 UTC." - }, - "UTC": { - "!type": "fn(year: number, month: number, date: number, hour?: number, min?: number, sec?: number, ms?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/UTC", - "!doc": "Accepts the same parameters as the longest form of the constructor, and returns the number of milliseconds in a Date object since January 1, 1970, 00:00:00, universal time." - }, - "now": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/now", - "!doc": "Returns the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC." - }, - "prototype": { - "toUTCString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toUTCString", - "!doc": "Converts a date to a string, using the universal time convention." - }, - "toISOString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toISOString", - "!doc": "JavaScript provides a direct way to convert a date object into a string in ISO format, the ISO 8601 Extended Format." - }, - "toDateString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toDateString", - "!doc": "Returns the date portion of a Date object in human readable form in American English." - }, - "toTimeString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toTimeString", - "!doc": "Returns the time portion of a Date object in human readable form in American English." - }, - "toLocaleDateString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toLocaleDateString", - "!doc": "Converts a date to a string, returning the \"date\" portion using the operating system's locale's conventions.\n" - }, - "toLocaleTimeString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toLocaleTimeString", - "!doc": "Converts a date to a string, returning the \"time\" portion using the current locale's conventions." - }, - "getTime": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getTime", - "!doc": "Returns the numeric value corresponding to the time for the specified date according to universal time." - }, - "getFullYear": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getFullYear", - "!doc": "Returns the year of the specified date according to local time." - }, - "getYear": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getYear", - "!doc": "Returns the year in the specified date according to local time." - }, - "getMonth": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMonth", - "!doc": "Returns the month in the specified date according to local time." - }, - "getUTCMonth": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCMonth", - "!doc": "Returns the month of the specified date according to universal time.\n" - }, - "getDate": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getDate", - "!doc": "Returns the day of the month for the specified date according to local time." - }, - "getUTCDate": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCDate", - "!doc": "Returns the day (date) of the month in the specified date according to universal time.\n" - }, - "getDay": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getDay", - "!doc": "Returns the day of the week for the specified date according to local time." - }, - "getUTCDay": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCDay", - "!doc": "Returns the day of the week in the specified date according to universal time.\n" - }, - "getHours": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getHours", - "!doc": "Returns the hour for the specified date according to local time." - }, - "getUTCHours": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCHours", - "!doc": "Returns the hours in the specified date according to universal time.\n" - }, - "getMinutes": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMinutes", - "!doc": "Returns the minutes in the specified date according to local time." - }, - "getUTCMinutes": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date", - "!doc": "Creates JavaScript Date instances which let you work with dates and times." - }, - "getSeconds": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getSeconds", - "!doc": "Returns the seconds in the specified date according to local time." - }, - "getUTCSeconds": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCSeconds", - "!doc": "Returns the seconds in the specified date according to universal time.\n" - }, - "getMilliseconds": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMilliseconds", - "!doc": "Returns the milliseconds in the specified date according to local time." - }, - "getUTCMilliseconds": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCMilliseconds", - "!doc": "Returns the milliseconds in the specified date according to universal time.\n" - }, - "getTimezoneOffset": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset", - "!doc": "Returns the time-zone offset from UTC, in minutes, for the current locale." - }, - "setTime": { - "!type": "fn(date: +Date) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setTime", - "!doc": "Sets the Date object to the time represented by a number of milliseconds since January 1, 1970, 00:00:00 UTC.\n" - }, - "setFullYear": { - "!type": "fn(year: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setFullYear", - "!doc": "Sets the full year for a specified date according to local time.\n" - }, - "setUTCFullYear": { - "!type": "fn(year: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCFullYear", - "!doc": "Sets the full year for a specified date according to universal time.\n" - }, - "setMonth": { - "!type": "fn(month: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMonth", - "!doc": "Set the month for a specified date according to local time." - }, - "setUTCMonth": { - "!type": "fn(month: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMonth", - "!doc": "Sets the month for a specified date according to universal time.\n" - }, - "setDate": { - "!type": "fn(day: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setDate", - "!doc": "Sets the day of the month for a specified date according to local time." - }, - "setUTCDate": { - "!type": "fn(day: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCDate", - "!doc": "Sets the day of the month for a specified date according to universal time.\n" - }, - "setHours": { - "!type": "fn(hour: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setHours", - "!doc": "Sets the hours for a specified date according to local time, and returns the number of milliseconds since 1 January 1970 00:00:00 UTC until the time represented by the updated Date instance." - }, - "setUTCHours": { - "!type": "fn(hour: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCHours", - "!doc": "Sets the hour for a specified date according to universal time.\n" - }, - "setMinutes": { - "!type": "fn(min: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMinutes", - "!doc": "Sets the minutes for a specified date according to local time." - }, - "setUTCMinutes": { - "!type": "fn(min: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMinutes", - "!doc": "Sets the minutes for a specified date according to universal time.\n" - }, - "setSeconds": { - "!type": "fn(sec: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setSeconds", - "!doc": "Sets the seconds for a specified date according to local time." - }, - "setUTCSeconds": { - "!type": "fn(sec: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCSeconds", - "!doc": "Sets the seconds for a specified date according to universal time.\n" - }, - "setMilliseconds": { - "!type": "fn(ms: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMilliseconds", - "!doc": "Sets the milliseconds for a specified date according to local time.\n" - }, - "setUTCMilliseconds": { - "!type": "fn(ms: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMilliseconds", - "!doc": "Sets the milliseconds for a specified date according to universal time.\n" - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date", - "!doc": "Creates JavaScript Date instances which let you work with dates and times." - }, - "Error": { - "!type": "fn(message: string)", - "prototype": { - "name": { - "!type": "string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error/name", - "!doc": "A name for the type of error." - }, - "message": { - "!type": "string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error/message", - "!doc": "A human-readable description of the error." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error", - "!doc": "Creates an error object." - }, - "SyntaxError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/SyntaxError", - "!doc": "Represents an error when trying to interpret syntactically invalid code." - }, - "ReferenceError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/ReferenceError", - "!doc": "Represents an error when a non-existent variable is referenced." - }, - "URIError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/URIError", - "!doc": "Represents an error when a malformed URI is encountered." - }, - "EvalError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/EvalError", - "!doc": "Represents an error regarding the eval function." - }, - "RangeError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RangeError", - "!doc": "Represents an error when a number is not within the correct range allowed." - }, - "TypeError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/TypeError", - "!doc": "Represents an error an error when a value is not of the expected type." - }, - "parseInt": { - "!type": "fn(string: string, radix?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/parseInt", - "!doc": "Parses a string argument and returns an integer of the specified radix or base." - }, - "parseFloat": { - "!type": "fn(string: string) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/parseFloat", - "!doc": "Parses a string argument and returns a floating point number." - }, - "isNaN": { - "!type": "fn(value: number) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/isNaN", - "!doc": "Determines whether a value is NaN or not. Be careful, this function is broken. You may be interested in ECMAScript 6 Number.isNaN." - }, - "isFinite": { - "!type": "fn(value: number) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/isFinite", - "!doc": "Determines whether the passed value is a finite number." - }, - "eval": { - "!type": "fn(code: string) -> ?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/eval", - "!doc": "Evaluates JavaScript code represented as a string." - }, - "encodeURI": { - "!type": "fn(uri: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURI", - "!doc": "Encodes a Uniform Resource Identifier (URI) by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two \"surrogate\" characters)." - }, - "encodeURIComponent": { - "!type": "fn(uri: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent", - "!doc": "Encodes a Uniform Resource Identifier (URI) component by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two \"surrogate\" characters)." - }, - "decodeURI": { - "!type": "fn(uri: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/decodeURI", - "!doc": "Decodes a Uniform Resource Identifier (URI) previously created by encodeURI or by a similar routine." - }, - "decodeURIComponent": { - "!type": "fn(uri: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/decodeURIComponent", - "!doc": "Decodes a Uniform Resource Identifier (URI) component previously created by encodeURIComponent or by a similar routine." - }, - "Math": { - "E": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/E", - "!doc": "The base of natural logarithms, e, approximately 2.718." - }, - "LN2": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LN2", - "!doc": "The natural logarithm of 2, approximately 0.693." - }, - "LN10": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LN10", - "!doc": "The natural logarithm of 10, approximately 2.302." - }, - "LOG2E": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LOG2E", - "!doc": "The base 2 logarithm of E (approximately 1.442)." - }, - "LOG10E": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LOG10E", - "!doc": "The base 10 logarithm of E (approximately 0.434)." - }, - "SQRT1_2": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/SQRT1_2", - "!doc": "The square root of 1/2; equivalently, 1 over the square root of 2, approximately 0.707." - }, - "SQRT2": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/SQRT2", - "!doc": "The square root of 2, approximately 1.414." - }, - "PI": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/PI", - "!doc": "The ratio of the circumference of a circle to its diameter, approximately 3.14159." - }, - "abs": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/abs", - "!doc": "Returns the absolute value of a number." - }, - "cos": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/cos", - "!doc": "Returns the cosine of a number." - }, - "sin": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/sin", - "!doc": "Returns the sine of a number." - }, - "tan": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/tan", - "!doc": "Returns the tangent of a number." - }, - "acos": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/acos", - "!doc": "Returns the arccosine (in radians) of a number." - }, - "asin": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/asin", - "!doc": "Returns the arcsine (in radians) of a number." - }, - "atan": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/atan", - "!doc": "Returns the arctangent (in radians) of a number." - }, - "atan2": { - "!type": "fn(y: number, x: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/atan2", - "!doc": "Returns the arctangent of the quotient of its arguments." - }, - "ceil": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/ceil", - "!doc": "Returns the smallest integer greater than or equal to a number." - }, - "floor": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/floor", - "!doc": "Returns the largest integer less than or equal to a number." - }, - "round": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/round", - "!doc": "Returns the value of a number rounded to the nearest integer." - }, - "exp": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/exp", - "!doc": "Returns Ex, where x is the argument, and E is Euler's constant, the base of the natural logarithms." - }, - "log": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/log", - "!doc": "Returns the natural logarithm (base E) of a number." - }, - "sqrt": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/sqrt", - "!doc": "Returns the square root of a number." - }, - "pow": { - "!type": "fn(number, number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/pow", - "!doc": "Returns base to the exponent power, that is, baseexponent." - }, - "max": { - "!type": "fn(number, number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/max", - "!doc": "Returns the largest of zero or more numbers." - }, - "min": { - "!type": "fn(number, number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/min", - "!doc": "Returns the smallest of zero or more numbers." - }, - "random": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/random", - "!doc": "Returns a floating-point, pseudo-random number in the range [0, 1) that is, from 0 (inclusive) up to but not including 1 (exclusive), which you can then scale to your desired range." - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math", - "!doc": "A built-in object that has properties and methods for mathematical constants and functions." - }, - "JSON": { - "parse": { - "!type": "fn(json: string) -> ?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/parse", - "!doc": "Parse a string as JSON, optionally transforming the value produced by parsing." - }, - "stringify": { - "!type": "fn(value: ?) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/stringify", - "!doc": "Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified." - }, - "!url": "https://developer.mozilla.org/en-US/docs/JSON", - "!doc": "JSON (JavaScript Object Notation) is a data-interchange format. It closely resembles a subset of JavaScript syntax, although it is not a strict subset. (See JSON in the JavaScript Reference for full details.) It is useful when writing any kind of JavaScript-based application, including websites and browser extensions. For example, you might store user information in JSON format in a cookie, or you might store extension preferences in JSON in a string-valued browser preference." - } -} \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/tern-qml/demo/demo.css b/qt/org.eclipse.cdt.qt.core/tern-qml/demo/demo.css deleted file mode 100644 index 4ee93e66992..00000000000 --- a/qt/org.eclipse.cdt.qt.core/tern-qml/demo/demo.css +++ /dev/null @@ -1,91 +0,0 @@ -.CodeMirror { - border: 1px solid silver; - height: 400px; - line-height: 1.3; - font-size: 13pt; - font-family: "Ubuntu Mono", monospace; - z-index: 2; -} -.CodeMirror pre { - padding: 0 9px; -} -.CodeMirror-linenumber { - font-size: 80%; - padding-top: 2px; -} - -ul.tabs { - list-style: none; - margin: 0 0 -1px 0; - padding: 0 0 0 37px; - font-family: "Ubuntu Mono", monospace; - overflow: hidden; -} -ul.tabs li { - font-size: 11pt; - color: #777; - cursor: pointer; - margin: 0 2px 0 0; - padding: 2px 10px 5px; - border: 1px solid silver; - border-bottom-width: 0px; - background: #f3f3f3; - display: inline-block; - z-index: 1; - border-top-left-radius: 6px; - border-top-right-radius: 6px; - position: relative; -} -ul.tabs li:hover { - color: #444; -} -ul.tabs li.selected { - background: white; - color: #222; - z-index: 3; - cursor: default; -} -ul.tabs li:before, -ul.tabs li:after { - position: absolute; - bottom: 0; - width: 6px; - height: 6px; - content: " "; - border: 1px solid silver; -} -ul.tabs li:before { - left: -7px; - border-bottom-right-radius: 6px; - border-width: 0 1px 1px 0; - box-shadow: 2px 2px 0 #f3f3f3; -} -ul.tabs li:after { - right: -7px; - border-bottom-left-radius: 6px; - border-width: 0 0 1px 1px; - box-shadow: -2px 2px 0 #f3f3f3; -} -ul.tabs li.selected:before { - box-shadow: 2px 2px 0 white; -} -ul.tabs li.selected:after { - box-shadow: -2px 2px 0 white; -} - -#menus { - position: absolute; - right: 0; - top: 0; -} -#menus select { - font-family: "Ubuntu Mono", monospace; - font-size: 11pt; - width: 8em; -} - -.CodeMirror div.CodeMirror-cursor { - border-left: 2px solid #444; -} - -.CodeMirror-hint { font-size: 12pt; } diff --git a/qt/org.eclipse.cdt.qt.core/tern-qml/demo/demo.js b/qt/org.eclipse.cdt.qt.core/tern-qml/demo/demo.js deleted file mode 100644 index 9b04c093709..00000000000 --- a/qt/org.eclipse.cdt.qt.core/tern-qml/demo/demo.js +++ /dev/null @@ -1,232 +0,0 @@ -var project; - -function Project(name, place, config, docs) { - this.name = name; - this.docs = Object.create(null); - this.tabs = place.appendChild(document.createElement("ul")); - this.tabs.className = "tabs"; - var self = this; - CodeMirror.on(this.tabs, "click", function (e) { - var target = e.target || e.srcElement; - if (target.nodeName.toLowerCase() != "li") return; - var doc = self.findDoc(target.textContent); - if (doc) self.selectDoc(doc); - }); - - var myConf = { - switchToDoc: function (name) { - self.selectDoc(self.findDoc(name)); - }, - useWorker: false - }; - for (var prop in config) myConf[prop] = config[prop]; - var server = this.server = new CodeMirror.TernServer(myConf); - - var firstDoc; - for (name in docs) { - var data = this.registerDoc(name, new CodeMirror.Doc(docs[name], "javascript")); - if (!firstDoc) firstDoc = data; - } - this.curDoc = firstDoc; - this.setSelectedTab(firstDoc); - - var keyMap = { - "Ctrl-I": function (cm) { - server.showType(cm); - }, - "Ctrl-O": function (cm) { - server.showDocs(cm); - }, - "Ctrl-Space": function (cm) { - server.complete(cm); - }, - "Ctrl-J": function (cm) { - server.jumpToDef(cm); - }, - "Ctrl-,": function (cm) { - server.jumpBack(cm); - }, - "Ctrl-Q": function (cm) { - server.rename(cm); - } - }; - this.editor = new CodeMirror(place, { - mode: 'text/javascript', - theme: "eclipse", - styleActiveLine: true, - lineNumbers: true, - lineWrapping: true, - autoCloseBrackets: true, - matchBrackets: true, - indentWithTabs: true, - indentUnit: 4, - tabSize: 4, - extraKeys: keyMap, - value: firstDoc.doc - }); - this.editor.on("cursorActivity", function (cm) { - server.updateArgHints(cm); - }); -} - -Project.prototype = { - findDoc: function (name) { - return this.docs[name]; - }, - - registerDoc: function (name, doc) { - this.server.addDoc(name, doc); - var data = this.docs[name] = { - name: name, - doc: doc, - tab: this.tabs.appendChild(document.createElement("li")) - }; - data.tab.textContent = name; - return data; - }, - - unregisterDoc: function (doc) { - this.server.delDoc(doc.name); - delete this.docs[doc.name]; - this.tabs.removeChild(doc.tab); - if (this.curDoc == doc) - for (var n in this.docs) return this.selectDoc(this.docs[n]); - }, - - setSelectedTab: function (doc) { - for (var n = this.tabs.firstChild; n; n = n.nextSibling) - n.className = n.textContent == doc.name ? "selected" : ""; - }, - - selectDoc: function (doc) { - if (doc == this.curDoc) return; - this.server.hideDoc(this.curDoc); - this.setSelectedTab(doc); - this.curDoc = doc; - this.editor.swapDoc(doc.doc); - } -}; - -// Initialization - -CodeMirror.on(window, "load", function () { - var cmds = document.getElementById("commands"); - CodeMirror.on(cmds, "change", function () { - if (!project || cmds.selectedIndex === 0) return; - var found = commands[cmds.value]; - cmds.selectedIndex = 0; - project.editor.focus(); - if (found) found(); - }); - - var projects = document.getElementById("projects"); - var projectNames = []; - var projectTags = document.querySelectorAll("project"); - for (var i = 0; i < projectTags.length; i++) { - var opt = projects.appendChild(document.createElement("option")); - projectNames.push(opt.textContent = projectTags[i].id); - } - CodeMirror.on(projects, "change", function () { - initProject(projects.value, function () { - projects.selectedIndex = 0; - project.editor.focus(); - }); - }); - - function updateFromHash() { - var name = location.hash.slice(1); - if (projectNames.indexOf(name) > -1 && - (!project || project.name != name)) { - initProject(name); - return true; - } - } - CodeMirror.on(window, "hashchange", updateFromHash); - - updateFromHash() || initProject("simple"); -}); - -function loadFiles(project, c) { - var found = {}; - - function inner(node) { - while (node && node.nodeName != "PRE") node = node.nextSibling; - if (!node) return c(found); - if (node.hasAttribute("file")) { - load(node.getAttribute("file"), function (data) { - found[node.id] = data; - inner(node.nextSibling); - }); - } else { - found[node.id] = node.textContent; - inner(node.nextSibling); - } - } - inner(project.firstChild); -} - -function words(str) { - return str ? str.split(" ") : []; -} - -function initProject(name, c) { - var node = document.getElementById(name); - var plugins = {}; - words(node.getAttribute("data-plugins")).forEach(function (name) { - plugins[name] = true; - }); - - if (plugins.requirejs) plugins.requirejs = { - override: { - "jquery": "=$" - } - }; - - loadFiles(node, function (files) { - var place = document.getElementById("place"); - place.textContent = ""; - - if (project) project.server.destroy(); - - project = new Project(name, place, { - defs: [ecma5], - plugins: plugins - }, files); - location.hash = "#" + name; - c && c(); - }); -} - -var commands = { - complete: function () { - project.server.complete(project.editor); - }, - jumptodef: function () { - project.server.jumpToDef(project.editor); - }, - finddocs: function () { - project.server.showDocs(project.editor); - }, - findtype: function () { - project.server.showType(project.editor); - }, - rename: function () { - project.server.rename(project.editor); - }, - addfile: function () { - var name = prompt("Name of the new buffer", ""); - if (name == null) return; - if (!name) name = "test"; - var i = 0; - while (project.findDoc(name + (i || ""))) ++i; - project.selectDoc(project.registerDoc(name + (i || ""), new CodeMirror.Doc("", "javascript"))); - }, - delfile: function () { - var hasDoc = false; - for (var _ in project.docs) { - hasDoc = true; - break; - } - if (hasDoc) project.unregisterDoc(project.curDoc); - } -}; \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/tern-qml/demo/docs.css b/qt/org.eclipse.cdt.qt.core/tern-qml/demo/docs.css deleted file mode 100644 index 82b8650fa39..00000000000 --- a/qt/org.eclipse.cdt.qt.core/tern-qml/demo/docs.css +++ /dev/null @@ -1,142 +0,0 @@ -@font-face { - font-family: 'Signika'; - font-style: normal; - font-weight: 700; - src: local('Signika-Bold'), url(http://themes.googleusercontent.com/static/fonts/signika/v3/7M5kxD4eGxuhgFaIk95pBRsxEYwM7FgeyaSgU71cLG0.woff) format('woff'); -} - -@font-face { - font-family: 'Ubuntu Mono'; - font-style: normal; - font-weight: 500; - src: local('Ubuntu Mono'), local('UbuntuMono-Regular'), url('http://themes.googleusercontent.com/static/fonts/ubuntumono/v3/ViZhet7Ak-LRXZMXzuAfkYbN6UDyHWBl620a-IRfuBk.woff') format('woff'); -} - -body { - font-family: "Helvetica Neue", "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, sans-serif; - color: #222; - font-size: 11pt; - max-width: 700px; - margin: 0 0 0 60px; - padding: 60px 0 4em; -} - -#top { - position: fixed; - top: 0; - background: white; - padding-top: 15px; - left: 20px; right: 20px; - z-index: 5; -} - -#head { - border-radius: 5px; - background: #1c5b64; - box-shadow: 0px 3px 3px rgba(0, 0, 0, .5); - position: relative; - font-family: "Signika", sans-serif; - font-weight: 700; -} - -#head > a { - border-right: 1px solid #276c81; - display: inline-block; - height: 25px; - padding: 5px 20px; - color: white; - text-decoration: none; - line-height: 25px; - font-size: 17px; -} - -#head > a.title { - font-size: 20px; - line-height: 24px; - padding-left: 80px; - background: url(logo.png); - background-position: 40px center; - background-size: auto 80%; - background-repeat: no-repeat; - border-bottom-left-radius: 5px; - border-top-left-radius: 5px; -} - -#head > a:hover { - background-color: #276c81 !important; -} - -.title span { - font-size: 13px; -} - -code, pre { font-family: "Ubuntu Mono", monospace; } -code { color: #124f55; font-size: 110%; } -pre { - border-left: 3px solid #def; - padding: 2px 0 2px 10px; -} - -h1, h2, h3, h4 { - font-family: "Signika", sans-serif; - font-weight: 700; - color: #124f55; -} -h1 { font-size: 20pt; } -h2 { font-size: 17pt; } -h3 { font-size: 13pt; } -h4 { font-size: 11pt; } - -a, a:visited, a code { color: #df4c11; text-decoration: none; } -a:hover { text-decoration: underline; } - -ul, ol { - margin: 0; - padding: 0; -} -li { - margin-left: 1.5em; - padding: 0; -} - -li p { margin: 0; } -dd p:first-child { margin-top: 1px; } -dd { margin-left: 20px; } -dt { text-indent: -1em; padding-left: 1em; } - -a[id] { - position: relative; - display: inline-block; - vertical-align: top; - top: -60px; -} - -.release-note { - margin-left: 1em; -} - -/* CodeMirror default theme for highlighting */ - -.cm-s-default .cm-keyword {color: #708;} -.cm-s-default .cm-atom {color: #219;} -.cm-s-default .cm-number {color: #164;} -.cm-s-default .cm-def {color: #00f;} -.cm-s-default .cm-variable {color: black;} -.cm-s-default .cm-variable-2 {color: #05a;} -.cm-s-default .cm-variable-3 {color: #085;} -.cm-s-default .cm-property {color: black;} -.cm-s-default .cm-operator {color: black;} -.cm-s-default .cm-comment {color: #a50;} -.cm-s-default .cm-string {color: #a11;} -.cm-s-default .cm-string-2 {color: #f50;} -.cm-s-default .cm-meta {color: #555;} -.cm-s-default .cm-error {color: #f00;} -.cm-s-default .cm-qualifier {color: #555;} -.cm-s-default .cm-builtin {color: #30a;} -.cm-s-default .cm-bracket {color: #997;} -.cm-s-default .cm-tag {color: #170;} -.cm-s-default .cm-attribute {color: #00c;} -.cm-s-default .cm-header {color: blue;} -.cm-s-default .cm-quote {color: #090;} -.cm-s-default .cm-hr {color: #999;} -.cm-s-default .cm-link {color: #00c;} diff --git a/qt/org.eclipse.cdt.qt.core/tern-qml/demo/qml-demo.html b/qt/org.eclipse.cdt.qt.core/tern-qml/demo/qml-demo.html deleted file mode 100644 index 91c778754b0..00000000000 --- a/qt/org.eclipse.cdt.qt.core/tern-qml/demo/qml-demo.html +++ /dev/null @@ -1,254 +0,0 @@ - - - - - - Tern QML Demo - - - - - - - - - - - - - - - - - - - - - -

Demo with QML Tern plugin

- QML Tern Demo - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
-
    -
  • test
  • -
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
x -
-
-
-
-
 
-
-
-
-
-
1
-
// Use ctrl-space to complete something
-
-
-
2
-
co
-
-
-
3
-
document.body.a
-
-
-
4
-
-
-
-
5
-
// Put the cursor in or after an expression, press ctrl-i to
-
-
-
6
-
// find its type
-
-
-
7
-
-
-
-
8
-
var foo = ["array", "of", "strings"]
-
-
-
9
-
var bar = foo.slice(0, 2).join("").split("a")[0]
-
-
-
10
-
-
-
-
11
-
// Works for locally defined types too.
-
-
-
12
-
-
-
-
13
-
function CTor() { this.size = 10 }
-
-
-
14
-
CTor.prototype.hallo = "hallo"
-
-
-
15
-
-
-
-
16
-
var baz = new CTor
-
-
-
17
-
baz.
-
-
-
18
-
-
-
-
19
-
// You can press ctrl-q when the cursor is on a variable
-
-
-
20
-
// name to rename it. Try it with CTor...
-
-
-
21
-
-
-
-
22
-
// When the cursor is in an argument list, the arguments
-
-
-
23
-
// are shown below the editor.
-
-
-
24
-
-
-
-
25
-
[1].reduce(  )
-
-
-
26
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - - - - \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/tern-qml/dist/acorn/dist/acorn.js b/qt/org.eclipse.cdt.qt.core/tern-qml/dist/acorn/dist/acorn.js deleted file mode 100644 index 9419f862ae7..00000000000 --- a/qt/org.eclipse.cdt.qt.core/tern-qml/dist/acorn/dist/acorn.js +++ /dev/null @@ -1,3340 +0,0 @@ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.acorn = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= 6 && (prop.computed || prop.method || prop.shorthand)) return; - var key = prop.key;var name = undefined; - switch (key.type) { - case "Identifier": - name = key.name;break; - case "Literal": - name = String(key.value);break; - default: - return; - } - var kind = prop.kind; - - if (this.options.ecmaVersion >= 6) { - if (name === "__proto__" && kind === "init") { - if (propHash.proto) this.raise(key.start, "Redefinition of __proto__ property"); - propHash.proto = true; - } - return; - } - name = "$" + name; - var other = propHash[name]; - if (other) { - var isGetSet = kind !== "init"; - if ((this.strict || isGetSet) && other[kind] || !(isGetSet ^ other.init)) this.raise(key.start, "Redefinition of property"); - } else { - other = propHash[name] = { - init: false, - get: false, - set: false - }; - } - other[kind] = true; -}; - -// ### Expression parsing - -// These nest, from the most general expression type at the top to -// 'atomic', nondivisible expression types at the bottom. Most of -// the functions will simply let the function(s) below them parse, -// and, *if* the syntactic construct they handle is present, wrap -// the AST node that the inner parser gave them in another node. - -// Parse a full expression. The optional arguments are used to -// forbid the `in` operator (in for loops initalization expressions) -// and provide reference for storing '=' operator inside shorthand -// property assignment in contexts where both object expression -// and object pattern might appear (so it's possible to raise -// delayed syntax error at correct position). - -pp.parseExpression = function (noIn, refDestructuringErrors) { - var startPos = this.start, - startLoc = this.startLoc; - var expr = this.parseMaybeAssign(noIn, refDestructuringErrors); - if (this.type === _tokentype.types.comma) { - var node = this.startNodeAt(startPos, startLoc); - node.expressions = [expr]; - while (this.eat(_tokentype.types.comma)) node.expressions.push(this.parseMaybeAssign(noIn, refDestructuringErrors)); - return this.finishNode(node, "SequenceExpression"); - } - return expr; -}; - -// Parse an assignment expression. This includes applications of -// operators like `+=`. - -pp.parseMaybeAssign = function (noIn, refDestructuringErrors, afterLeftParse) { - if (this.type == _tokentype.types._yield && this.inGenerator) return this.parseYield(); - - var validateDestructuring = false; - if (!refDestructuringErrors) { - refDestructuringErrors = { shorthandAssign: 0, trailingComma: 0 }; - validateDestructuring = true; - } - var startPos = this.start, - startLoc = this.startLoc; - if (this.type == _tokentype.types.parenL || this.type == _tokentype.types.name) this.potentialArrowAt = this.start; - var left = this.parseMaybeConditional(noIn, refDestructuringErrors); - if (afterLeftParse) left = afterLeftParse.call(this, left, startPos, startLoc); - if (this.type.isAssign) { - if (validateDestructuring) this.checkPatternErrors(refDestructuringErrors, true); - var node = this.startNodeAt(startPos, startLoc); - node.operator = this.value; - node.left = this.type === _tokentype.types.eq ? this.toAssignable(left) : left; - refDestructuringErrors.shorthandAssign = 0; // reset because shorthand default was used correctly - this.checkLVal(left); - this.next(); - node.right = this.parseMaybeAssign(noIn); - return this.finishNode(node, "AssignmentExpression"); - } else { - if (validateDestructuring) this.checkExpressionErrors(refDestructuringErrors, true); - } - return left; -}; - -// Parse a ternary conditional (`?:`) operator. - -pp.parseMaybeConditional = function (noIn, refDestructuringErrors) { - var startPos = this.start, - startLoc = this.startLoc; - var expr = this.parseExprOps(noIn, refDestructuringErrors); - if (this.checkExpressionErrors(refDestructuringErrors)) return expr; - if (this.eat(_tokentype.types.question)) { - var node = this.startNodeAt(startPos, startLoc); - node.test = expr; - node.consequent = this.parseMaybeAssign(); - this.expect(_tokentype.types.colon); - node.alternate = this.parseMaybeAssign(noIn); - return this.finishNode(node, "ConditionalExpression"); - } - return expr; -}; - -// Start the precedence parser. - -pp.parseExprOps = function (noIn, refDestructuringErrors) { - var startPos = this.start, - startLoc = this.startLoc; - var expr = this.parseMaybeUnary(refDestructuringErrors); - if (this.checkExpressionErrors(refDestructuringErrors)) return expr; - return this.parseExprOp(expr, startPos, startLoc, -1, noIn); -}; - -// Parse binary operators with the operator precedence parsing -// algorithm. `left` is the left-hand side of the operator. -// `minPrec` provides context that allows the function to stop and -// defer further parser to one of its callers when it encounters an -// operator that has a lower precedence than the set it is parsing. - -pp.parseExprOp = function (left, leftStartPos, leftStartLoc, minPrec, noIn) { - var prec = this.type.binop; - if (prec != null && (!noIn || this.type !== _tokentype.types._in)) { - if (prec > minPrec) { - var node = this.startNodeAt(leftStartPos, leftStartLoc); - node.left = left; - node.operator = this.value; - var op = this.type; - this.next(); - var startPos = this.start, - startLoc = this.startLoc; - node.right = this.parseExprOp(this.parseMaybeUnary(), startPos, startLoc, prec, noIn); - this.finishNode(node, op === _tokentype.types.logicalOR || op === _tokentype.types.logicalAND ? "LogicalExpression" : "BinaryExpression"); - return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn); - } - } - return left; -}; - -// Parse unary operators, both prefix and postfix. - -pp.parseMaybeUnary = function (refDestructuringErrors) { - if (this.type.prefix) { - var node = this.startNode(), - update = this.type === _tokentype.types.incDec; - node.operator = this.value; - node.prefix = true; - this.next(); - node.argument = this.parseMaybeUnary(); - this.checkExpressionErrors(refDestructuringErrors, true); - if (update) this.checkLVal(node.argument);else if (this.strict && node.operator === "delete" && node.argument.type === "Identifier") this.raise(node.start, "Deleting local variable in strict mode"); - return this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression"); - } - var startPos = this.start, - startLoc = this.startLoc; - var expr = this.parseExprSubscripts(refDestructuringErrors); - if (this.checkExpressionErrors(refDestructuringErrors)) return expr; - while (this.type.postfix && !this.canInsertSemicolon()) { - var node = this.startNodeAt(startPos, startLoc); - node.operator = this.value; - node.prefix = false; - node.argument = expr; - this.checkLVal(expr); - this.next(); - expr = this.finishNode(node, "UpdateExpression"); - } - return expr; -}; - -// Parse call, dot, and `[]`-subscript expressions. - -pp.parseExprSubscripts = function (refDestructuringErrors) { - var startPos = this.start, - startLoc = this.startLoc; - var expr = this.parseExprAtom(refDestructuringErrors); - var skipArrowSubscripts = expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")"; - if (this.checkExpressionErrors(refDestructuringErrors) || skipArrowSubscripts) return expr; - return this.parseSubscripts(expr, startPos, startLoc); -}; - -pp.parseSubscripts = function (base, startPos, startLoc, noCalls) { - for (;;) { - if (this.eat(_tokentype.types.dot)) { - var node = this.startNodeAt(startPos, startLoc); - node.object = base; - node.property = this.parseIdent(true); - node.computed = false; - base = this.finishNode(node, "MemberExpression"); - } else if (this.eat(_tokentype.types.bracketL)) { - var node = this.startNodeAt(startPos, startLoc); - node.object = base; - node.property = this.parseExpression(); - node.computed = true; - this.expect(_tokentype.types.bracketR); - base = this.finishNode(node, "MemberExpression"); - } else if (!noCalls && this.eat(_tokentype.types.parenL)) { - var node = this.startNodeAt(startPos, startLoc); - node.callee = base; - node.arguments = this.parseExprList(_tokentype.types.parenR, false); - base = this.finishNode(node, "CallExpression"); - } else if (this.type === _tokentype.types.backQuote) { - var node = this.startNodeAt(startPos, startLoc); - node.tag = base; - node.quasi = this.parseTemplate(); - base = this.finishNode(node, "TaggedTemplateExpression"); - } else { - return base; - } - } -}; - -// Parse an atomic expression — either a single token that is an -// expression, an expression started by a keyword like `function` or -// `new`, or an expression wrapped in punctuation like `()`, `[]`, -// or `{}`. - -pp.parseExprAtom = function (refDestructuringErrors) { - var node = undefined, - canBeArrow = this.potentialArrowAt == this.start; - switch (this.type) { - case _tokentype.types._super: - if (!this.inFunction) this.raise(this.start, "'super' outside of function or class"); - case _tokentype.types._this: - var type = this.type === _tokentype.types._this ? "ThisExpression" : "Super"; - node = this.startNode(); - this.next(); - return this.finishNode(node, type); - - case _tokentype.types._yield: - if (this.inGenerator) this.unexpected(); - - case _tokentype.types.name: - var startPos = this.start, - startLoc = this.startLoc; - var id = this.parseIdent(this.type !== _tokentype.types.name); - if (canBeArrow && !this.canInsertSemicolon() && this.eat(_tokentype.types.arrow)) return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id]); - return id; - - case _tokentype.types.regexp: - var value = this.value; - node = this.parseLiteral(value.value); - node.regex = { pattern: value.pattern, flags: value.flags }; - return node; - - case _tokentype.types.num:case _tokentype.types.string: - return this.parseLiteral(this.value); - - case _tokentype.types._null:case _tokentype.types._true:case _tokentype.types._false: - node = this.startNode(); - node.value = this.type === _tokentype.types._null ? null : this.type === _tokentype.types._true; - node.raw = this.type.keyword; - this.next(); - return this.finishNode(node, "Literal"); - - case _tokentype.types.parenL: - return this.parseParenAndDistinguishExpression(canBeArrow); - - case _tokentype.types.bracketL: - node = this.startNode(); - this.next(); - // check whether this is array comprehension or regular array - if (this.options.ecmaVersion >= 7 && this.type === _tokentype.types._for) { - return this.parseComprehension(node, false); - } - node.elements = this.parseExprList(_tokentype.types.bracketR, true, true, refDestructuringErrors); - return this.finishNode(node, "ArrayExpression"); - - case _tokentype.types.braceL: - return this.parseObj(false, refDestructuringErrors); - - case _tokentype.types._function: - node = this.startNode(); - this.next(); - return this.parseFunction(node, false); - - case _tokentype.types._class: - return this.parseClass(this.startNode(), false); - - case _tokentype.types._new: - return this.parseNew(); - - case _tokentype.types.backQuote: - return this.parseTemplate(); - - default: - this.unexpected(); - } -}; - -pp.parseLiteral = function (value) { - var node = this.startNode(); - node.value = value; - node.raw = this.input.slice(this.start, this.end); - this.next(); - return this.finishNode(node, "Literal"); -}; - -pp.parseParenExpression = function () { - this.expect(_tokentype.types.parenL); - var val = this.parseExpression(); - this.expect(_tokentype.types.parenR); - return val; -}; - -pp.parseParenAndDistinguishExpression = function (canBeArrow) { - var startPos = this.start, - startLoc = this.startLoc, - val = undefined; - if (this.options.ecmaVersion >= 6) { - this.next(); - - if (this.options.ecmaVersion >= 7 && this.type === _tokentype.types._for) { - return this.parseComprehension(this.startNodeAt(startPos, startLoc), true); - } - - var innerStartPos = this.start, - innerStartLoc = this.startLoc; - var exprList = [], - first = true; - var refDestructuringErrors = { shorthandAssign: 0, trailingComma: 0 }, - spreadStart = undefined, - innerParenStart = undefined; - while (this.type !== _tokentype.types.parenR) { - first ? first = false : this.expect(_tokentype.types.comma); - if (this.type === _tokentype.types.ellipsis) { - spreadStart = this.start; - exprList.push(this.parseParenItem(this.parseRest())); - break; - } else { - if (this.type === _tokentype.types.parenL && !innerParenStart) { - innerParenStart = this.start; - } - exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem)); - } - } - var innerEndPos = this.start, - innerEndLoc = this.startLoc; - this.expect(_tokentype.types.parenR); - - if (canBeArrow && !this.canInsertSemicolon() && this.eat(_tokentype.types.arrow)) { - this.checkPatternErrors(refDestructuringErrors, true); - if (innerParenStart) this.unexpected(innerParenStart); - return this.parseParenArrowList(startPos, startLoc, exprList); - } - - if (!exprList.length) this.unexpected(this.lastTokStart); - if (spreadStart) this.unexpected(spreadStart); - this.checkExpressionErrors(refDestructuringErrors, true); - - if (exprList.length > 1) { - val = this.startNodeAt(innerStartPos, innerStartLoc); - val.expressions = exprList; - this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc); - } else { - val = exprList[0]; - } - } else { - val = this.parseParenExpression(); - } - - if (this.options.preserveParens) { - var par = this.startNodeAt(startPos, startLoc); - par.expression = val; - return this.finishNode(par, "ParenthesizedExpression"); - } else { - return val; - } -}; - -pp.parseParenItem = function (item) { - return item; -}; - -pp.parseParenArrowList = function (startPos, startLoc, exprList) { - return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList); -}; - -// New's precedence is slightly tricky. It must allow its argument to -// be a `[]` or dot subscript expression, but not a call — at least, -// not without wrapping it in parentheses. Thus, it uses the noCalls -// argument to parseSubscripts to prevent it from consuming the -// argument list. - -var empty = []; - -pp.parseNew = function () { - var node = this.startNode(); - var meta = this.parseIdent(true); - if (this.options.ecmaVersion >= 6 && this.eat(_tokentype.types.dot)) { - node.meta = meta; - node.property = this.parseIdent(true); - if (node.property.name !== "target") this.raise(node.property.start, "The only valid meta property for new is new.target"); - if (!this.inFunction) this.raise(node.start, "new.target can only be used in functions"); - return this.finishNode(node, "MetaProperty"); - } - var startPos = this.start, - startLoc = this.startLoc; - node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true); - if (this.eat(_tokentype.types.parenL)) node.arguments = this.parseExprList(_tokentype.types.parenR, false);else node.arguments = empty; - return this.finishNode(node, "NewExpression"); -}; - -// Parse template expression. - -pp.parseTemplateElement = function () { - var elem = this.startNode(); - elem.value = { - raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, '\n'), - cooked: this.value - }; - this.next(); - elem.tail = this.type === _tokentype.types.backQuote; - return this.finishNode(elem, "TemplateElement"); -}; - -pp.parseTemplate = function () { - var node = this.startNode(); - this.next(); - node.expressions = []; - var curElt = this.parseTemplateElement(); - node.quasis = [curElt]; - while (!curElt.tail) { - this.expect(_tokentype.types.dollarBraceL); - node.expressions.push(this.parseExpression()); - this.expect(_tokentype.types.braceR); - node.quasis.push(curElt = this.parseTemplateElement()); - } - this.next(); - return this.finishNode(node, "TemplateLiteral"); -}; - -// Parse an object literal or binding pattern. - -pp.parseObj = function (isPattern, refDestructuringErrors) { - var node = this.startNode(), - first = true, - propHash = {}; - node.properties = []; - this.next(); - while (!this.eat(_tokentype.types.braceR)) { - if (!first) { - this.expect(_tokentype.types.comma); - if (this.afterTrailingComma(_tokentype.types.braceR)) break; - } else first = false; - - var prop = this.startNode(), - isGenerator = undefined, - startPos = undefined, - startLoc = undefined; - if (this.options.ecmaVersion >= 6) { - prop.method = false; - prop.shorthand = false; - if (isPattern || refDestructuringErrors) { - startPos = this.start; - startLoc = this.startLoc; - } - if (!isPattern) isGenerator = this.eat(_tokentype.types.star); - } - this.parsePropertyName(prop); - this.parsePropertyValue(prop, isPattern, isGenerator, startPos, startLoc, refDestructuringErrors); - this.checkPropClash(prop, propHash); - node.properties.push(this.finishNode(prop, "Property")); - } - return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression"); -}; - -pp.parsePropertyValue = function (prop, isPattern, isGenerator, startPos, startLoc, refDestructuringErrors) { - if (this.eat(_tokentype.types.colon)) { - prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors); - prop.kind = "init"; - } else if (this.options.ecmaVersion >= 6 && this.type === _tokentype.types.parenL) { - if (isPattern) this.unexpected(); - prop.kind = "init"; - prop.method = true; - prop.value = this.parseMethod(isGenerator); - } else if (this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && (this.type != _tokentype.types.comma && this.type != _tokentype.types.braceR)) { - if (isGenerator || isPattern) this.unexpected(); - prop.kind = prop.key.name; - this.parsePropertyName(prop); - prop.value = this.parseMethod(false); - var paramCount = prop.kind === "get" ? 0 : 1; - if (prop.value.params.length !== paramCount) { - var start = prop.value.start; - if (prop.kind === "get") this.raise(start, "getter should have no params");else this.raise(start, "setter should have exactly one param"); - } - if (prop.kind === "set" && prop.value.params[0].type === "RestElement") this.raise(prop.value.params[0].start, "Setter cannot use rest params"); - } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") { - prop.kind = "init"; - if (isPattern) { - if (this.keywords.test(prop.key.name) || (this.strict ? this.reservedWordsStrictBind : this.reservedWords).test(prop.key.name)) this.raise(prop.key.start, "Binding " + prop.key.name); - prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key); - } else if (this.type === _tokentype.types.eq && refDestructuringErrors) { - if (!refDestructuringErrors.shorthandAssign) refDestructuringErrors.shorthandAssign = this.start; - prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key); - } else { - prop.value = prop.key; - } - prop.shorthand = true; - } else this.unexpected(); -}; - -pp.parsePropertyName = function (prop) { - if (this.options.ecmaVersion >= 6) { - if (this.eat(_tokentype.types.bracketL)) { - prop.computed = true; - prop.key = this.parseMaybeAssign(); - this.expect(_tokentype.types.bracketR); - return prop.key; - } else { - prop.computed = false; - } - } - return prop.key = this.type === _tokentype.types.num || this.type === _tokentype.types.string ? this.parseExprAtom() : this.parseIdent(true); -}; - -// Initialize empty function node. - -pp.initFunction = function (node) { - node.id = null; - if (this.options.ecmaVersion >= 6) { - node.generator = false; - node.expression = false; - } -}; - -// Parse object or class method. - -pp.parseMethod = function (isGenerator) { - var node = this.startNode(); - this.initFunction(node); - this.expect(_tokentype.types.parenL); - node.params = this.parseBindingList(_tokentype.types.parenR, false, false); - if (this.options.ecmaVersion >= 6) node.generator = isGenerator; - this.parseFunctionBody(node, false); - return this.finishNode(node, "FunctionExpression"); -}; - -// Parse arrow function expression with given parameters. - -pp.parseArrowExpression = function (node, params) { - this.initFunction(node); - node.params = this.toAssignableList(params, true); - this.parseFunctionBody(node, true); - return this.finishNode(node, "ArrowFunctionExpression"); -}; - -// Parse function body and check parameters. - -pp.parseFunctionBody = function (node, isArrowFunction) { - var isExpression = isArrowFunction && this.type !== _tokentype.types.braceL; - - if (isExpression) { - node.body = this.parseMaybeAssign(); - node.expression = true; - } else { - // Start a new scope with regard to labels and the `inFunction` - // flag (restore them to their old value afterwards). - var oldInFunc = this.inFunction, - oldInGen = this.inGenerator, - oldLabels = this.labels; - this.inFunction = true;this.inGenerator = node.generator;this.labels = []; - node.body = this.parseBlock(true); - node.expression = false; - this.inFunction = oldInFunc;this.inGenerator = oldInGen;this.labels = oldLabels; - } - - // If this is a strict mode function, verify that argument names - // are not repeated, and it does not try to bind the words `eval` - // or `arguments`. - if (this.strict || !isExpression && node.body.body.length && this.isUseStrict(node.body.body[0])) { - var oldStrict = this.strict; - this.strict = true; - if (node.id) this.checkLVal(node.id, true); - this.checkParams(node); - this.strict = oldStrict; - } else if (isArrowFunction) { - this.checkParams(node); - } -}; - -// Checks function params for various disallowed patterns such as using "eval" -// or "arguments" and duplicate parameters. - -pp.checkParams = function (node) { - var nameHash = {}; - for (var i = 0; i < node.params.length; i++) { - this.checkLVal(node.params[i], true, nameHash); - } -}; - -// Parses a comma-separated list of expressions, and returns them as -// an array. `close` is the token type that ends the list, and -// `allowEmpty` can be turned on to allow subsequent commas with -// nothing in between them to be parsed as `null` (which is needed -// for array literals). - -pp.parseExprList = function (close, allowTrailingComma, allowEmpty, refDestructuringErrors) { - var elts = [], - first = true; - while (!this.eat(close)) { - if (!first) { - this.expect(_tokentype.types.comma); - if (this.type === close && refDestructuringErrors && !refDestructuringErrors.trailingComma) { - refDestructuringErrors.trailingComma = this.lastTokStart; - } - if (allowTrailingComma && this.afterTrailingComma(close)) break; - } else first = false; - - var elt = undefined; - if (allowEmpty && this.type === _tokentype.types.comma) elt = null;else if (this.type === _tokentype.types.ellipsis) elt = this.parseSpread(refDestructuringErrors);else elt = this.parseMaybeAssign(false, refDestructuringErrors); - elts.push(elt); - } - return elts; -}; - -// Parse the next token as an identifier. If `liberal` is true (used -// when parsing properties), it will also convert keywords into -// identifiers. - -pp.parseIdent = function (liberal) { - var node = this.startNode(); - if (liberal && this.options.allowReserved == "never") liberal = false; - if (this.type === _tokentype.types.name) { - if (!liberal && (this.strict ? this.reservedWordsStrict : this.reservedWords).test(this.value) && (this.options.ecmaVersion >= 6 || this.input.slice(this.start, this.end).indexOf("\\") == -1)) this.raise(this.start, "The keyword '" + this.value + "' is reserved"); - node.name = this.value; - } else if (liberal && this.type.keyword) { - node.name = this.type.keyword; - } else { - this.unexpected(); - } - this.next(); - return this.finishNode(node, "Identifier"); -}; - -// Parses yield expression inside generator. - -pp.parseYield = function () { - var node = this.startNode(); - this.next(); - if (this.type == _tokentype.types.semi || this.canInsertSemicolon() || this.type != _tokentype.types.star && !this.type.startsExpr) { - node.delegate = false; - node.argument = null; - } else { - node.delegate = this.eat(_tokentype.types.star); - node.argument = this.parseMaybeAssign(); - } - return this.finishNode(node, "YieldExpression"); -}; - -// Parses array and generator comprehensions. - -pp.parseComprehension = function (node, isGenerator) { - node.blocks = []; - while (this.type === _tokentype.types._for) { - var block = this.startNode(); - this.next(); - this.expect(_tokentype.types.parenL); - block.left = this.parseBindingAtom(); - this.checkLVal(block.left, true); - this.expectContextual("of"); - block.right = this.parseExpression(); - this.expect(_tokentype.types.parenR); - node.blocks.push(this.finishNode(block, "ComprehensionBlock")); - } - node.filter = this.eat(_tokentype.types._if) ? this.parseParenExpression() : null; - node.body = this.parseExpression(); - this.expect(isGenerator ? _tokentype.types.parenR : _tokentype.types.bracketR); - node.generator = isGenerator; - return this.finishNode(node, "ComprehensionExpression"); -}; - -},{"./state":10,"./tokentype":14}],2:[function(_dereq_,module,exports){ -// This is a trick taken from Esprima. It turns out that, on -// non-Chrome browsers, to check whether a string is in a set, a -// predicate containing a big ugly `switch` statement is faster than -// a regular expression, and on Chrome the two are about on par. -// This function uses `eval` (non-lexical) to produce such a -// predicate from a space-separated string of words. -// -// It starts by sorting the words by length. - -// Reserved word lists for various dialects of the language - -"use strict"; - -exports.__esModule = true; -exports.isIdentifierStart = isIdentifierStart; -exports.isIdentifierChar = isIdentifierChar; -var reservedWords = { - 3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile", - 5: "class enum extends super const export import", - 6: "enum", - strict: "implements interface let package private protected public static yield", - strictBind: "eval arguments" -}; - -exports.reservedWords = reservedWords; -// And the keywords - -var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this"; - -var keywords = { - 5: ecma5AndLessKeywords, - 6: ecma5AndLessKeywords + " let const class extends export import yield super" -}; - -exports.keywords = keywords; -// ## Character categories - -// Big ugly regular expressions that match characters in the -// whitespace, identifier, and identifier-start categories. These -// are only applied when a character is found to actually have a -// code point above 128. -// Generated by `bin/generate-identifier-regex.js`. - -var nonASCIIidentifierStartChars = "ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢲऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ"; -var nonASCIIidentifierChars = "‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏ᦰ-ᧀᧈᧉ᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷼-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-꣄꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︭︳︴﹍-﹏0-9_"; - -var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]"); -var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]"); - -nonASCIIidentifierStartChars = nonASCIIidentifierChars = null; - -// These are a run-length and offset encoded representation of the -// >0xffff code points that are a valid part of identifiers. The -// offset starts at 0x10000, and each pair of numbers represents an -// offset to the next range, and then a size of the range. They were -// generated by tools/generate-identifier-regex.js -var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 17, 26, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 99, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 98, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 26, 45, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 955, 52, 76, 44, 33, 24, 27, 35, 42, 34, 4, 0, 13, 47, 15, 3, 22, 0, 38, 17, 2, 24, 133, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 32, 4, 287, 47, 21, 1, 2, 0, 185, 46, 82, 47, 21, 0, 60, 42, 502, 63, 32, 0, 449, 56, 1288, 920, 104, 110, 2962, 1070, 13266, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 881, 68, 12, 0, 67, 12, 16481, 1, 3071, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 4149, 196, 1340, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42710, 42, 4148, 12, 221, 16355, 541]; -var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 1306, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 52, 0, 13, 2, 49, 13, 16, 9, 83, 11, 168, 11, 6, 9, 8, 2, 57, 0, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 316, 19, 13, 9, 214, 6, 3, 8, 112, 16, 16, 9, 82, 12, 9, 9, 535, 9, 20855, 9, 135, 4, 60, 6, 26, 9, 1016, 45, 17, 3, 19723, 1, 5319, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 4305, 6, 792618, 239]; - -// This has a complexity linear to the value of the code. The -// assumption is that looking up astral identifier characters is -// rare. -function isInAstralSet(code, set) { - var pos = 0x10000; - for (var i = 0; i < set.length; i += 2) { - pos += set[i]; - if (pos > code) return false; - pos += set[i + 1]; - if (pos >= code) return true; - } -} - -// Test whether a given character code starts an identifier. - -function isIdentifierStart(code, astral) { - if (code < 65) return code === 36; - if (code < 91) return true; - if (code < 97) return code === 95; - if (code < 123) return true; - if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)); - if (astral === false) return false; - return isInAstralSet(code, astralIdentifierStartCodes); -} - -// Test whether a given character is part of an identifier. - -function isIdentifierChar(code, astral) { - if (code < 48) return code === 36; - if (code < 58) return true; - if (code < 65) return false; - if (code < 91) return true; - if (code < 97) return code === 95; - if (code < 123) return true; - if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)); - if (astral === false) return false; - return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes); -} - -},{}],3:[function(_dereq_,module,exports){ -// Acorn is a tiny, fast JavaScript parser written in JavaScript. -// -// Acorn was written by Marijn Haverbeke, Ingvar Stepanyan, and -// various contributors and released under an MIT license. -// -// Git repositories for Acorn are available at -// -// http://marijnhaverbeke.nl/git/acorn -// https://github.com/ternjs/acorn.git -// -// Please use the [github bug tracker][ghbt] to report issues. -// -// [ghbt]: https://github.com/ternjs/acorn/issues -// -// This file defines the main parser interface. The library also comes -// with a [error-tolerant parser][dammit] and an -// [abstract syntax tree walker][walk], defined in other files. -// -// [dammit]: acorn_loose.js -// [walk]: util/walk.js - -"use strict"; - -exports.__esModule = true; -exports.parse = parse; -exports.parseExpressionAt = parseExpressionAt; -exports.tokenizer = tokenizer; - -var _state = _dereq_("./state"); - -_dereq_("./parseutil"); - -_dereq_("./statement"); - -_dereq_("./lval"); - -_dereq_("./expression"); - -_dereq_("./location"); - -exports.Parser = _state.Parser; -exports.plugins = _state.plugins; - -var _options = _dereq_("./options"); - -exports.defaultOptions = _options.defaultOptions; - -var _locutil = _dereq_("./locutil"); - -exports.Position = _locutil.Position; -exports.SourceLocation = _locutil.SourceLocation; -exports.getLineInfo = _locutil.getLineInfo; - -var _node = _dereq_("./node"); - -exports.Node = _node.Node; - -var _tokentype = _dereq_("./tokentype"); - -exports.TokenType = _tokentype.TokenType; -exports.tokTypes = _tokentype.types; - -var _tokencontext = _dereq_("./tokencontext"); - -exports.TokContext = _tokencontext.TokContext; -exports.tokContexts = _tokencontext.types; - -var _identifier = _dereq_("./identifier"); - -exports.isIdentifierChar = _identifier.isIdentifierChar; -exports.isIdentifierStart = _identifier.isIdentifierStart; - -var _tokenize = _dereq_("./tokenize"); - -exports.Token = _tokenize.Token; - -var _whitespace = _dereq_("./whitespace"); - -exports.isNewLine = _whitespace.isNewLine; -exports.lineBreak = _whitespace.lineBreak; -exports.lineBreakG = _whitespace.lineBreakG; -var version = "2.7.0"; - -exports.version = version; -// The main exported interface (under `self.acorn` when in the -// browser) is a `parse` function that takes a code string and -// returns an abstract syntax tree as specified by [Mozilla parser -// API][api]. -// -// [api]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API - -function parse(input, options) { - return new _state.Parser(options, input).parse(); -} - -// This function tries to parse a single expression at a given -// offset in a string. Useful for parsing mixed-language formats -// that embed JavaScript expressions. - -function parseExpressionAt(input, pos, options) { - var p = new _state.Parser(options, input, pos); - p.nextToken(); - return p.parseExpression(); -} - -// Acorn is organized as a tokenizer and a recursive-descent parser. -// The `tokenizer` export provides an interface to the tokenizer. - -function tokenizer(input, options) { - return new _state.Parser(options, input); -} - -},{"./expression":1,"./identifier":2,"./location":4,"./locutil":5,"./lval":6,"./node":7,"./options":8,"./parseutil":9,"./state":10,"./statement":11,"./tokencontext":12,"./tokenize":13,"./tokentype":14,"./whitespace":16}],4:[function(_dereq_,module,exports){ -"use strict"; - -var _state = _dereq_("./state"); - -var _locutil = _dereq_("./locutil"); - -var pp = _state.Parser.prototype; - -// This function is used to raise exceptions on parse errors. It -// takes an offset integer (into the current `input`) to indicate -// the location of the error, attaches the position to the end -// of the error message, and then raises a `SyntaxError` with that -// message. - -pp.raise = function (pos, message) { - var loc = _locutil.getLineInfo(this.input, pos); - message += " (" + loc.line + ":" + loc.column + ")"; - var err = new SyntaxError(message); - err.pos = pos;err.loc = loc;err.raisedAt = this.pos; - throw err; -}; - -pp.curPosition = function () { - if (this.options.locations) { - return new _locutil.Position(this.curLine, this.pos - this.lineStart); - } -}; - -},{"./locutil":5,"./state":10}],5:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.getLineInfo = getLineInfo; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _whitespace = _dereq_("./whitespace"); - -// These are used when `options.locations` is on, for the -// `startLoc` and `endLoc` properties. - -var Position = (function () { - function Position(line, col) { - _classCallCheck(this, Position); - - this.line = line; - this.column = col; - } - - Position.prototype.offset = function offset(n) { - return new Position(this.line, this.column + n); - }; - - return Position; -})(); - -exports.Position = Position; - -var SourceLocation = function SourceLocation(p, start, end) { - _classCallCheck(this, SourceLocation); - - this.start = start; - this.end = end; - if (p.sourceFile !== null) this.source = p.sourceFile; -} - -// The `getLineInfo` function is mostly useful when the -// `locations` option is off (for performance reasons) and you -// want to find the line/column position for a given character -// offset. `input` should be the code string that the offset refers -// into. - -; - -exports.SourceLocation = SourceLocation; - -function getLineInfo(input, offset) { - for (var line = 1, cur = 0;;) { - _whitespace.lineBreakG.lastIndex = cur; - var match = _whitespace.lineBreakG.exec(input); - if (match && match.index < offset) { - ++line; - cur = match.index + match[0].length; - } else { - return new Position(line, offset - cur); - } - } -} - -},{"./whitespace":16}],6:[function(_dereq_,module,exports){ -"use strict"; - -var _tokentype = _dereq_("./tokentype"); - -var _state = _dereq_("./state"); - -var _util = _dereq_("./util"); - -var pp = _state.Parser.prototype; - -// Convert existing expression atom to assignable pattern -// if possible. - -pp.toAssignable = function (node, isBinding) { - if (this.options.ecmaVersion >= 6 && node) { - switch (node.type) { - case "Identifier": - case "ObjectPattern": - case "ArrayPattern": - break; - - case "ObjectExpression": - node.type = "ObjectPattern"; - for (var i = 0; i < node.properties.length; i++) { - var prop = node.properties[i]; - if (prop.kind !== "init") this.raise(prop.key.start, "Object pattern can't contain getter or setter"); - this.toAssignable(prop.value, isBinding); - } - break; - - case "ArrayExpression": - node.type = "ArrayPattern"; - this.toAssignableList(node.elements, isBinding); - break; - - case "AssignmentExpression": - if (node.operator === "=") { - node.type = "AssignmentPattern"; - delete node.operator; - // falls through to AssignmentPattern - } else { - this.raise(node.left.end, "Only '=' operator can be used for specifying default value."); - break; - } - - case "AssignmentPattern": - if (node.right.type === "YieldExpression") this.raise(node.right.start, "Yield expression cannot be a default value"); - break; - - case "ParenthesizedExpression": - node.expression = this.toAssignable(node.expression, isBinding); - break; - - case "MemberExpression": - if (!isBinding) break; - - default: - this.raise(node.start, "Assigning to rvalue"); - } - } - return node; -}; - -// Convert list of expression atoms to binding list. - -pp.toAssignableList = function (exprList, isBinding) { - var end = exprList.length; - if (end) { - var last = exprList[end - 1]; - if (last && last.type == "RestElement") { - --end; - } else if (last && last.type == "SpreadElement") { - last.type = "RestElement"; - var arg = last.argument; - this.toAssignable(arg, isBinding); - if (arg.type !== "Identifier" && arg.type !== "MemberExpression" && arg.type !== "ArrayPattern") this.unexpected(arg.start); - --end; - } - - if (isBinding && last.type === "RestElement" && last.argument.type !== "Identifier") this.unexpected(last.argument.start); - } - for (var i = 0; i < end; i++) { - var elt = exprList[i]; - if (elt) this.toAssignable(elt, isBinding); - } - return exprList; -}; - -// Parses spread element. - -pp.parseSpread = function (refDestructuringErrors) { - var node = this.startNode(); - this.next(); - node.argument = this.parseMaybeAssign(refDestructuringErrors); - return this.finishNode(node, "SpreadElement"); -}; - -pp.parseRest = function (allowNonIdent) { - var node = this.startNode(); - this.next(); - - // RestElement inside of a function parameter must be an identifier - if (allowNonIdent) node.argument = this.type === _tokentype.types.name ? this.parseIdent() : this.unexpected();else node.argument = this.type === _tokentype.types.name || this.type === _tokentype.types.bracketL ? this.parseBindingAtom() : this.unexpected(); - - return this.finishNode(node, "RestElement"); -}; - -// Parses lvalue (assignable) atom. - -pp.parseBindingAtom = function () { - if (this.options.ecmaVersion < 6) return this.parseIdent(); - switch (this.type) { - case _tokentype.types.name: - return this.parseIdent(); - - case _tokentype.types.bracketL: - var node = this.startNode(); - this.next(); - node.elements = this.parseBindingList(_tokentype.types.bracketR, true, true); - return this.finishNode(node, "ArrayPattern"); - - case _tokentype.types.braceL: - return this.parseObj(true); - - default: - this.unexpected(); - } -}; - -pp.parseBindingList = function (close, allowEmpty, allowTrailingComma, allowNonIdent) { - var elts = [], - first = true; - while (!this.eat(close)) { - if (first) first = false;else this.expect(_tokentype.types.comma); - if (allowEmpty && this.type === _tokentype.types.comma) { - elts.push(null); - } else if (allowTrailingComma && this.afterTrailingComma(close)) { - break; - } else if (this.type === _tokentype.types.ellipsis) { - var rest = this.parseRest(allowNonIdent); - this.parseBindingListItem(rest); - elts.push(rest); - this.expect(close); - break; - } else { - var elem = this.parseMaybeDefault(this.start, this.startLoc); - this.parseBindingListItem(elem); - elts.push(elem); - } - } - return elts; -}; - -pp.parseBindingListItem = function (param) { - return param; -}; - -// Parses assignment pattern around given atom if possible. - -pp.parseMaybeDefault = function (startPos, startLoc, left) { - left = left || this.parseBindingAtom(); - if (this.options.ecmaVersion < 6 || !this.eat(_tokentype.types.eq)) return left; - var node = this.startNodeAt(startPos, startLoc); - node.left = left; - node.right = this.parseMaybeAssign(); - return this.finishNode(node, "AssignmentPattern"); -}; - -// Verify that a node is an lval — something that can be assigned -// to. - -pp.checkLVal = function (expr, isBinding, checkClashes) { - switch (expr.type) { - case "Identifier": - if (this.strict && this.reservedWordsStrictBind.test(expr.name)) this.raise(expr.start, (isBinding ? "Binding " : "Assigning to ") + expr.name + " in strict mode"); - if (checkClashes) { - if (_util.has(checkClashes, expr.name)) this.raise(expr.start, "Argument name clash"); - checkClashes[expr.name] = true; - } - break; - - case "MemberExpression": - if (isBinding) this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " member expression"); - break; - - case "ObjectPattern": - for (var i = 0; i < expr.properties.length; i++) { - this.checkLVal(expr.properties[i].value, isBinding, checkClashes); - }break; - - case "ArrayPattern": - for (var i = 0; i < expr.elements.length; i++) { - var elem = expr.elements[i]; - if (elem) this.checkLVal(elem, isBinding, checkClashes); - } - break; - - case "AssignmentPattern": - this.checkLVal(expr.left, isBinding, checkClashes); - break; - - case "RestElement": - this.checkLVal(expr.argument, isBinding, checkClashes); - break; - - case "ParenthesizedExpression": - this.checkLVal(expr.expression, isBinding, checkClashes); - break; - - default: - this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " rvalue"); - } -}; - -},{"./state":10,"./tokentype":14,"./util":15}],7:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _state = _dereq_("./state"); - -var _locutil = _dereq_("./locutil"); - -var Node = function Node(parser, pos, loc) { - _classCallCheck(this, Node); - - this.type = ""; - this.start = pos; - this.end = 0; - if (parser.options.locations) this.loc = new _locutil.SourceLocation(parser, loc); - if (parser.options.directSourceFile) this.sourceFile = parser.options.directSourceFile; - if (parser.options.ranges) this.range = [pos, 0]; -} - -// Start an AST node, attaching a start offset. - -; - -exports.Node = Node; -var pp = _state.Parser.prototype; - -pp.startNode = function () { - return new Node(this, this.start, this.startLoc); -}; - -pp.startNodeAt = function (pos, loc) { - return new Node(this, pos, loc); -}; - -// Finish an AST node, adding `type` and `end` properties. - -function finishNodeAt(node, type, pos, loc) { - node.type = type; - node.end = pos; - if (this.options.locations) node.loc.end = loc; - if (this.options.ranges) node.range[1] = pos; - return node; -} - -pp.finishNode = function (node, type) { - return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc); -}; - -// Finish node at given position - -pp.finishNodeAt = function (node, type, pos, loc) { - return finishNodeAt.call(this, node, type, pos, loc); -}; - -},{"./locutil":5,"./state":10}],8:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; -exports.getOptions = getOptions; - -var _util = _dereq_("./util"); - -var _locutil = _dereq_("./locutil"); - -// A second optional argument can be given to further configure -// the parser process. These options are recognized: - -var defaultOptions = { - // `ecmaVersion` indicates the ECMAScript version to parse. Must - // be either 3, or 5, or 6. This influences support for strict - // mode, the set of reserved words, support for getters and - // setters and other features. - ecmaVersion: 5, - // Source type ("script" or "module") for different semantics - sourceType: "script", - // `onInsertedSemicolon` can be a callback that will be called - // when a semicolon is automatically inserted. It will be passed - // th position of the comma as an offset, and if `locations` is - // enabled, it is given the location as a `{line, column}` object - // as second argument. - onInsertedSemicolon: null, - // `onTrailingComma` is similar to `onInsertedSemicolon`, but for - // trailing commas. - onTrailingComma: null, - // By default, reserved words are only enforced if ecmaVersion >= 5. - // Set `allowReserved` to a boolean value to explicitly turn this on - // an off. When this option has the value "never", reserved words - // and keywords can also not be used as property names. - allowReserved: null, - // When enabled, a return at the top level is not considered an - // error. - allowReturnOutsideFunction: false, - // When enabled, import/export statements are not constrained to - // appearing at the top of the program. - allowImportExportEverywhere: false, - // When enabled, hashbang directive in the beginning of file - // is allowed and treated as a line comment. - allowHashBang: false, - // When `locations` is on, `loc` properties holding objects with - // `start` and `end` properties in `{line, column}` form (with - // line being 1-based and column 0-based) will be attached to the - // nodes. - locations: false, - // A function can be passed as `onToken` option, which will - // cause Acorn to call that function with object in the same - // format as tokens returned from `tokenizer().getToken()`. Note - // that you are not allowed to call the parser from the - // callback—that will corrupt its internal state. - onToken: null, - // A function can be passed as `onComment` option, which will - // cause Acorn to call that function with `(block, text, start, - // end)` parameters whenever a comment is skipped. `block` is a - // boolean indicating whether this is a block (`/* */`) comment, - // `text` is the content of the comment, and `start` and `end` are - // character offsets that denote the start and end of the comment. - // When the `locations` option is on, two more parameters are - // passed, the full `{line, column}` locations of the start and - // end of the comments. Note that you are not allowed to call the - // parser from the callback—that will corrupt its internal state. - onComment: null, - // Nodes have their start and end characters offsets recorded in - // `start` and `end` properties (directly on the node, rather than - // the `loc` object, which holds line/column data. To also add a - // [semi-standardized][range] `range` property holding a `[start, - // end]` array with the same numbers, set the `ranges` option to - // `true`. - // - // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678 - ranges: false, - // It is possible to parse multiple files into a single AST by - // passing the tree produced by parsing the first file as - // `program` option in subsequent parses. This will add the - // toplevel forms of the parsed file to the `Program` (top) node - // of an existing parse tree. - program: null, - // When `locations` is on, you can pass this to record the source - // file in every node's `loc` object. - sourceFile: null, - // This value, if given, is stored in every node, whether - // `locations` is on or off. - directSourceFile: null, - // When enabled, parenthesized expressions are represented by - // (non-standard) ParenthesizedExpression nodes - preserveParens: false, - plugins: {} -}; - -exports.defaultOptions = defaultOptions; -// Interpret and default an options object - -function getOptions(opts) { - var options = {}; - for (var opt in defaultOptions) { - options[opt] = opts && _util.has(opts, opt) ? opts[opt] : defaultOptions[opt]; - }if (options.allowReserved == null) options.allowReserved = options.ecmaVersion < 5; - - if (_util.isArray(options.onToken)) { - (function () { - var tokens = options.onToken; - options.onToken = function (token) { - return tokens.push(token); - }; - })(); - } - if (_util.isArray(options.onComment)) options.onComment = pushComment(options, options.onComment); - - return options; -} - -function pushComment(options, array) { - return function (block, text, start, end, startLoc, endLoc) { - var comment = { - type: block ? 'Block' : 'Line', - value: text, - start: start, - end: end - }; - if (options.locations) comment.loc = new _locutil.SourceLocation(this, startLoc, endLoc); - if (options.ranges) comment.range = [start, end]; - array.push(comment); - }; -} - -},{"./locutil":5,"./util":15}],9:[function(_dereq_,module,exports){ -"use strict"; - -var _tokentype = _dereq_("./tokentype"); - -var _state = _dereq_("./state"); - -var _whitespace = _dereq_("./whitespace"); - -var pp = _state.Parser.prototype; - -// ## Parser utilities - -// Test whether a statement node is the string literal `"use strict"`. - -pp.isUseStrict = function (stmt) { - return this.options.ecmaVersion >= 5 && stmt.type === "ExpressionStatement" && stmt.expression.type === "Literal" && stmt.expression.raw.slice(1, -1) === "use strict"; -}; - -// Predicate that tests whether the next token is of the given -// type, and if yes, consumes it as a side effect. - -pp.eat = function (type) { - if (this.type === type) { - this.next(); - return true; - } else { - return false; - } -}; - -// Tests whether parsed token is a contextual keyword. - -pp.isContextual = function (name) { - return this.type === _tokentype.types.name && this.value === name; -}; - -// Consumes contextual keyword if possible. - -pp.eatContextual = function (name) { - return this.value === name && this.eat(_tokentype.types.name); -}; - -// Asserts that following token is given contextual keyword. - -pp.expectContextual = function (name) { - if (!this.eatContextual(name)) this.unexpected(); -}; - -// Test whether a semicolon can be inserted at the current position. - -pp.canInsertSemicolon = function () { - return this.type === _tokentype.types.eof || this.type === _tokentype.types.braceR || _whitespace.lineBreak.test(this.input.slice(this.lastTokEnd, this.start)); -}; - -pp.insertSemicolon = function () { - if (this.canInsertSemicolon()) { - if (this.options.onInsertedSemicolon) this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); - return true; - } -}; - -// Consume a semicolon, or, failing that, see if we are allowed to -// pretend that there is a semicolon at this position. - -pp.semicolon = function () { - if (!this.eat(_tokentype.types.semi) && !this.insertSemicolon()) this.unexpected(); -}; - -pp.afterTrailingComma = function (tokType) { - if (this.type == tokType) { - if (this.options.onTrailingComma) this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); - this.next(); - return true; - } -}; - -// Expect a token of a given type. If found, consume it, otherwise, -// raise an unexpected token error. - -pp.expect = function (type) { - this.eat(type) || this.unexpected(); -}; - -// Raise an unexpected token error. - -pp.unexpected = function (pos) { - this.raise(pos != null ? pos : this.start, "Unexpected token"); -}; - -pp.checkPatternErrors = function (refDestructuringErrors, andThrow) { - var pos = refDestructuringErrors && refDestructuringErrors.trailingComma; - if (!andThrow) return !!pos; - if (pos) this.raise(pos, "Trailing comma is not permitted in destructuring patterns"); -}; - -pp.checkExpressionErrors = function (refDestructuringErrors, andThrow) { - var pos = refDestructuringErrors && refDestructuringErrors.shorthandAssign; - if (!andThrow) return !!pos; - if (pos) this.raise(pos, "Shorthand property assignments are valid only in destructuring patterns"); -}; - -},{"./state":10,"./tokentype":14,"./whitespace":16}],10:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _identifier = _dereq_("./identifier"); - -var _tokentype = _dereq_("./tokentype"); - -var _whitespace = _dereq_("./whitespace"); - -var _options = _dereq_("./options"); - -// Registered plugins -var plugins = {}; - -exports.plugins = plugins; -function keywordRegexp(words) { - return new RegExp("^(" + words.replace(/ /g, "|") + ")$"); -} - -var Parser = (function () { - function Parser(options, input, startPos) { - _classCallCheck(this, Parser); - - this.options = options = _options.getOptions(options); - this.sourceFile = options.sourceFile; - this.keywords = keywordRegexp(_identifier.keywords[options.ecmaVersion >= 6 ? 6 : 5]); - var reserved = options.allowReserved ? "" : _identifier.reservedWords[options.ecmaVersion] + (options.sourceType == "module" ? " await" : ""); - this.reservedWords = keywordRegexp(reserved); - var reservedStrict = (reserved ? reserved + " " : "") + _identifier.reservedWords.strict; - this.reservedWordsStrict = keywordRegexp(reservedStrict); - this.reservedWordsStrictBind = keywordRegexp(reservedStrict + " " + _identifier.reservedWords.strictBind); - this.input = String(input); - - // Used to signal to callers of `readWord1` whether the word - // contained any escape sequences. This is needed because words with - // escape sequences must not be interpreted as keywords. - this.containsEsc = false; - - // Load plugins - this.loadPlugins(options.plugins); - - // Set up token state - - // The current position of the tokenizer in the input. - if (startPos) { - this.pos = startPos; - this.lineStart = Math.max(0, this.input.lastIndexOf("\n", startPos)); - this.curLine = this.input.slice(0, this.lineStart).split(_whitespace.lineBreak).length; - } else { - this.pos = this.lineStart = 0; - this.curLine = 1; - } - - // Properties of the current token: - // Its type - this.type = _tokentype.types.eof; - // For tokens that include more information than their type, the value - this.value = null; - // Its start and end offset - this.start = this.end = this.pos; - // And, if locations are used, the {line, column} object - // corresponding to those offsets - this.startLoc = this.endLoc = this.curPosition(); - - // Position information for the previous token - this.lastTokEndLoc = this.lastTokStartLoc = null; - this.lastTokStart = this.lastTokEnd = this.pos; - - // The context stack is used to superficially track syntactic - // context to predict whether a regular expression is allowed in a - // given position. - this.context = this.initialContext(); - this.exprAllowed = true; - - // Figure out if it's a module code. - this.strict = this.inModule = options.sourceType === "module"; - - // Used to signify the start of a potential arrow function - this.potentialArrowAt = -1; - - // Flags to track whether we are in a function, a generator. - this.inFunction = this.inGenerator = false; - // Labels in scope. - this.labels = []; - - // If enabled, skip leading hashbang line. - if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === '#!') this.skipLineComment(2); - } - - // DEPRECATED Kept for backwards compatibility until 3.0 in case a plugin uses them - - Parser.prototype.isKeyword = function isKeyword(word) { - return this.keywords.test(word); - }; - - Parser.prototype.isReservedWord = function isReservedWord(word) { - return this.reservedWords.test(word); - }; - - Parser.prototype.extend = function extend(name, f) { - this[name] = f(this[name]); - }; - - Parser.prototype.loadPlugins = function loadPlugins(pluginConfigs) { - for (var _name in pluginConfigs) { - var plugin = plugins[_name]; - if (!plugin) throw new Error("Plugin '" + _name + "' not found"); - plugin(this, pluginConfigs[_name]); - } - }; - - Parser.prototype.parse = function parse() { - var node = this.options.program || this.startNode(); - this.nextToken(); - return this.parseTopLevel(node); - }; - - return Parser; -})(); - -exports.Parser = Parser; - -},{"./identifier":2,"./options":8,"./tokentype":14,"./whitespace":16}],11:[function(_dereq_,module,exports){ -"use strict"; - -var _tokentype = _dereq_("./tokentype"); - -var _state = _dereq_("./state"); - -var _whitespace = _dereq_("./whitespace"); - -var pp = _state.Parser.prototype; - -// ### Statement parsing - -// Parse a program. Initializes the parser, reads any number of -// statements, and wraps them in a Program node. Optionally takes a -// `program` argument. If present, the statements will be appended -// to its body instead of creating a new node. - -pp.parseTopLevel = function (node) { - var first = true; - if (!node.body) node.body = []; - while (this.type !== _tokentype.types.eof) { - var stmt = this.parseStatement(true, true); - node.body.push(stmt); - if (first) { - if (this.isUseStrict(stmt)) this.setStrict(true); - first = false; - } - } - this.next(); - if (this.options.ecmaVersion >= 6) { - node.sourceType = this.options.sourceType; - } - return this.finishNode(node, "Program"); -}; - -var loopLabel = { kind: "loop" }, - switchLabel = { kind: "switch" }; - -// Parse a single statement. -// -// If expecting a statement and finding a slash operator, parse a -// regular expression literal. This is to handle cases like -// `if (foo) /blah/.exec(foo)`, where looking at the previous token -// does not help. - -pp.parseStatement = function (declaration, topLevel) { - var starttype = this.type, - node = this.startNode(); - - // Most types of statements are recognized by the keyword they - // start with. Many are trivial to parse, some require a bit of - // complexity. - - switch (starttype) { - case _tokentype.types._break:case _tokentype.types._continue: - return this.parseBreakContinueStatement(node, starttype.keyword); - case _tokentype.types._debugger: - return this.parseDebuggerStatement(node); - case _tokentype.types._do: - return this.parseDoStatement(node); - case _tokentype.types._for: - return this.parseForStatement(node); - case _tokentype.types._function: - if (!declaration && this.options.ecmaVersion >= 6) this.unexpected(); - return this.parseFunctionStatement(node); - case _tokentype.types._class: - if (!declaration) this.unexpected(); - return this.parseClass(node, true); - case _tokentype.types._if: - return this.parseIfStatement(node); - case _tokentype.types._return: - return this.parseReturnStatement(node); - case _tokentype.types._switch: - return this.parseSwitchStatement(node); - case _tokentype.types._throw: - return this.parseThrowStatement(node); - case _tokentype.types._try: - return this.parseTryStatement(node); - case _tokentype.types._let:case _tokentype.types._const: - if (!declaration) this.unexpected(); // NOTE: falls through to _var - case _tokentype.types._var: - return this.parseVarStatement(node, starttype); - case _tokentype.types._while: - return this.parseWhileStatement(node); - case _tokentype.types._with: - return this.parseWithStatement(node); - case _tokentype.types.braceL: - return this.parseBlock(); - case _tokentype.types.semi: - return this.parseEmptyStatement(node); - case _tokentype.types._export: - case _tokentype.types._import: - if (!this.options.allowImportExportEverywhere) { - if (!topLevel) this.raise(this.start, "'import' and 'export' may only appear at the top level"); - if (!this.inModule) this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); - } - return starttype === _tokentype.types._import ? this.parseImport(node) : this.parseExport(node); - - // If the statement does not start with a statement keyword or a - // brace, it's an ExpressionStatement or LabeledStatement. We - // simply start parsing an expression, and afterwards, if the - // next token is a colon and the expression was a simple - // Identifier node, we switch to interpreting it as a label. - default: - var maybeName = this.value, - expr = this.parseExpression(); - if (starttype === _tokentype.types.name && expr.type === "Identifier" && this.eat(_tokentype.types.colon)) return this.parseLabeledStatement(node, maybeName, expr);else return this.parseExpressionStatement(node, expr); - } -}; - -pp.parseBreakContinueStatement = function (node, keyword) { - var isBreak = keyword == "break"; - this.next(); - if (this.eat(_tokentype.types.semi) || this.insertSemicolon()) node.label = null;else if (this.type !== _tokentype.types.name) this.unexpected();else { - node.label = this.parseIdent(); - this.semicolon(); - } - - // Verify that there is an actual destination to break or - // continue to. - for (var i = 0; i < this.labels.length; ++i) { - var lab = this.labels[i]; - if (node.label == null || lab.name === node.label.name) { - if (lab.kind != null && (isBreak || lab.kind === "loop")) break; - if (node.label && isBreak) break; - } - } - if (i === this.labels.length) this.raise(node.start, "Unsyntactic " + keyword); - return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement"); -}; - -pp.parseDebuggerStatement = function (node) { - this.next(); - this.semicolon(); - return this.finishNode(node, "DebuggerStatement"); -}; - -pp.parseDoStatement = function (node) { - this.next(); - this.labels.push(loopLabel); - node.body = this.parseStatement(false); - this.labels.pop(); - this.expect(_tokentype.types._while); - node.test = this.parseParenExpression(); - if (this.options.ecmaVersion >= 6) this.eat(_tokentype.types.semi);else this.semicolon(); - return this.finishNode(node, "DoWhileStatement"); -}; - -// Disambiguating between a `for` and a `for`/`in` or `for`/`of` -// loop is non-trivial. Basically, we have to parse the init `var` -// statement or expression, disallowing the `in` operator (see -// the second parameter to `parseExpression`), and then check -// whether the next token is `in` or `of`. When there is no init -// part (semicolon immediately after the opening parenthesis), it -// is a regular `for` loop. - -pp.parseForStatement = function (node) { - this.next(); - this.labels.push(loopLabel); - this.expect(_tokentype.types.parenL); - if (this.type === _tokentype.types.semi) return this.parseFor(node, null); - if (this.type === _tokentype.types._var || this.type === _tokentype.types._let || this.type === _tokentype.types._const) { - var _init = this.startNode(), - varKind = this.type; - this.next(); - this.parseVar(_init, true, varKind); - this.finishNode(_init, "VariableDeclaration"); - if ((this.type === _tokentype.types._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) && _init.declarations.length === 1 && !(varKind !== _tokentype.types._var && _init.declarations[0].init)) return this.parseForIn(node, _init); - return this.parseFor(node, _init); - } - var refDestructuringErrors = { shorthandAssign: 0, trailingComma: 0 }; - var init = this.parseExpression(true, refDestructuringErrors); - if (this.type === _tokentype.types._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) { - this.checkPatternErrors(refDestructuringErrors, true); - this.toAssignable(init); - this.checkLVal(init); - return this.parseForIn(node, init); - } else { - this.checkExpressionErrors(refDestructuringErrors, true); - } - return this.parseFor(node, init); -}; - -pp.parseFunctionStatement = function (node) { - this.next(); - return this.parseFunction(node, true); -}; - -pp.parseIfStatement = function (node) { - this.next(); - node.test = this.parseParenExpression(); - node.consequent = this.parseStatement(false); - node.alternate = this.eat(_tokentype.types._else) ? this.parseStatement(false) : null; - return this.finishNode(node, "IfStatement"); -}; - -pp.parseReturnStatement = function (node) { - if (!this.inFunction && !this.options.allowReturnOutsideFunction) this.raise(this.start, "'return' outside of function"); - this.next(); - - // In `return` (and `break`/`continue`), the keywords with - // optional arguments, we eagerly look for a semicolon or the - // possibility to insert one. - - if (this.eat(_tokentype.types.semi) || this.insertSemicolon()) node.argument = null;else { - node.argument = this.parseExpression();this.semicolon(); - } - return this.finishNode(node, "ReturnStatement"); -}; - -pp.parseSwitchStatement = function (node) { - this.next(); - node.discriminant = this.parseParenExpression(); - node.cases = []; - this.expect(_tokentype.types.braceL); - this.labels.push(switchLabel); - - // Statements under must be grouped (by label) in SwitchCase - // nodes. `cur` is used to keep the node that we are currently - // adding statements to. - - for (var cur, sawDefault = false; this.type != _tokentype.types.braceR;) { - if (this.type === _tokentype.types._case || this.type === _tokentype.types._default) { - var isCase = this.type === _tokentype.types._case; - if (cur) this.finishNode(cur, "SwitchCase"); - node.cases.push(cur = this.startNode()); - cur.consequent = []; - this.next(); - if (isCase) { - cur.test = this.parseExpression(); - } else { - if (sawDefault) this.raise(this.lastTokStart, "Multiple default clauses"); - sawDefault = true; - cur.test = null; - } - this.expect(_tokentype.types.colon); - } else { - if (!cur) this.unexpected(); - cur.consequent.push(this.parseStatement(true)); - } - } - if (cur) this.finishNode(cur, "SwitchCase"); - this.next(); // Closing brace - this.labels.pop(); - return this.finishNode(node, "SwitchStatement"); -}; - -pp.parseThrowStatement = function (node) { - this.next(); - if (_whitespace.lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) this.raise(this.lastTokEnd, "Illegal newline after throw"); - node.argument = this.parseExpression(); - this.semicolon(); - return this.finishNode(node, "ThrowStatement"); -}; - -// Reused empty array added for node fields that are always empty. - -var empty = []; - -pp.parseTryStatement = function (node) { - this.next(); - node.block = this.parseBlock(); - node.handler = null; - if (this.type === _tokentype.types._catch) { - var clause = this.startNode(); - this.next(); - this.expect(_tokentype.types.parenL); - clause.param = this.parseBindingAtom(); - this.checkLVal(clause.param, true); - this.expect(_tokentype.types.parenR); - clause.body = this.parseBlock(); - node.handler = this.finishNode(clause, "CatchClause"); - } - node.finalizer = this.eat(_tokentype.types._finally) ? this.parseBlock() : null; - if (!node.handler && !node.finalizer) this.raise(node.start, "Missing catch or finally clause"); - return this.finishNode(node, "TryStatement"); -}; - -pp.parseVarStatement = function (node, kind) { - this.next(); - this.parseVar(node, false, kind); - this.semicolon(); - return this.finishNode(node, "VariableDeclaration"); -}; - -pp.parseWhileStatement = function (node) { - this.next(); - node.test = this.parseParenExpression(); - this.labels.push(loopLabel); - node.body = this.parseStatement(false); - this.labels.pop(); - return this.finishNode(node, "WhileStatement"); -}; - -pp.parseWithStatement = function (node) { - if (this.strict) this.raise(this.start, "'with' in strict mode"); - this.next(); - node.object = this.parseParenExpression(); - node.body = this.parseStatement(false); - return this.finishNode(node, "WithStatement"); -}; - -pp.parseEmptyStatement = function (node) { - this.next(); - return this.finishNode(node, "EmptyStatement"); -}; - -pp.parseLabeledStatement = function (node, maybeName, expr) { - for (var i = 0; i < this.labels.length; ++i) { - if (this.labels[i].name === maybeName) this.raise(expr.start, "Label '" + maybeName + "' is already declared"); - }var kind = this.type.isLoop ? "loop" : this.type === _tokentype.types._switch ? "switch" : null; - for (var i = this.labels.length - 1; i >= 0; i--) { - var label = this.labels[i]; - if (label.statementStart == node.start) { - label.statementStart = this.start; - label.kind = kind; - } else break; - } - this.labels.push({ name: maybeName, kind: kind, statementStart: this.start }); - node.body = this.parseStatement(true); - this.labels.pop(); - node.label = expr; - return this.finishNode(node, "LabeledStatement"); -}; - -pp.parseExpressionStatement = function (node, expr) { - node.expression = expr; - this.semicolon(); - return this.finishNode(node, "ExpressionStatement"); -}; - -// Parse a semicolon-enclosed block of statements, handling `"use -// strict"` declarations when `allowStrict` is true (used for -// function bodies). - -pp.parseBlock = function (allowStrict) { - var node = this.startNode(), - first = true, - oldStrict = undefined; - node.body = []; - this.expect(_tokentype.types.braceL); - while (!this.eat(_tokentype.types.braceR)) { - var stmt = this.parseStatement(true); - node.body.push(stmt); - if (first && allowStrict && this.isUseStrict(stmt)) { - oldStrict = this.strict; - this.setStrict(this.strict = true); - } - first = false; - } - if (oldStrict === false) this.setStrict(false); - return this.finishNode(node, "BlockStatement"); -}; - -// Parse a regular `for` loop. The disambiguation code in -// `parseStatement` will already have parsed the init statement or -// expression. - -pp.parseFor = function (node, init) { - node.init = init; - this.expect(_tokentype.types.semi); - node.test = this.type === _tokentype.types.semi ? null : this.parseExpression(); - this.expect(_tokentype.types.semi); - node.update = this.type === _tokentype.types.parenR ? null : this.parseExpression(); - this.expect(_tokentype.types.parenR); - node.body = this.parseStatement(false); - this.labels.pop(); - return this.finishNode(node, "ForStatement"); -}; - -// Parse a `for`/`in` and `for`/`of` loop, which are almost -// same from parser's perspective. - -pp.parseForIn = function (node, init) { - var type = this.type === _tokentype.types._in ? "ForInStatement" : "ForOfStatement"; - this.next(); - node.left = init; - node.right = this.parseExpression(); - this.expect(_tokentype.types.parenR); - node.body = this.parseStatement(false); - this.labels.pop(); - return this.finishNode(node, type); -}; - -// Parse a list of variable declarations. - -pp.parseVar = function (node, isFor, kind) { - node.declarations = []; - node.kind = kind.keyword; - for (;;) { - var decl = this.startNode(); - this.parseVarId(decl); - if (this.eat(_tokentype.types.eq)) { - decl.init = this.parseMaybeAssign(isFor); - } else if (kind === _tokentype.types._const && !(this.type === _tokentype.types._in || this.options.ecmaVersion >= 6 && this.isContextual("of"))) { - this.unexpected(); - } else if (decl.id.type != "Identifier" && !(isFor && (this.type === _tokentype.types._in || this.isContextual("of")))) { - this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value"); - } else { - decl.init = null; - } - node.declarations.push(this.finishNode(decl, "VariableDeclarator")); - if (!this.eat(_tokentype.types.comma)) break; - } - return node; -}; - -pp.parseVarId = function (decl) { - decl.id = this.parseBindingAtom(); - this.checkLVal(decl.id, true); -}; - -// Parse a function declaration or literal (depending on the -// `isStatement` parameter). - -pp.parseFunction = function (node, isStatement, allowExpressionBody) { - this.initFunction(node); - if (this.options.ecmaVersion >= 6) node.generator = this.eat(_tokentype.types.star); - if (isStatement || this.type === _tokentype.types.name) node.id = this.parseIdent(); - this.parseFunctionParams(node); - this.parseFunctionBody(node, allowExpressionBody); - return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression"); -}; - -pp.parseFunctionParams = function (node) { - this.expect(_tokentype.types.parenL); - node.params = this.parseBindingList(_tokentype.types.parenR, false, false, true); -}; - -// Parse a class declaration or literal (depending on the -// `isStatement` parameter). - -pp.parseClass = function (node, isStatement) { - this.next(); - this.parseClassId(node, isStatement); - this.parseClassSuper(node); - var classBody = this.startNode(); - var hadConstructor = false; - classBody.body = []; - this.expect(_tokentype.types.braceL); - while (!this.eat(_tokentype.types.braceR)) { - if (this.eat(_tokentype.types.semi)) continue; - var method = this.startNode(); - var isGenerator = this.eat(_tokentype.types.star); - var isMaybeStatic = this.type === _tokentype.types.name && this.value === "static"; - this.parsePropertyName(method); - method["static"] = isMaybeStatic && this.type !== _tokentype.types.parenL; - if (method["static"]) { - if (isGenerator) this.unexpected(); - isGenerator = this.eat(_tokentype.types.star); - this.parsePropertyName(method); - } - method.kind = "method"; - var isGetSet = false; - if (!method.computed) { - var key = method.key; - - if (!isGenerator && key.type === "Identifier" && this.type !== _tokentype.types.parenL && (key.name === "get" || key.name === "set")) { - isGetSet = true; - method.kind = key.name; - key = this.parsePropertyName(method); - } - if (!method["static"] && (key.type === "Identifier" && key.name === "constructor" || key.type === "Literal" && key.value === "constructor")) { - if (hadConstructor) this.raise(key.start, "Duplicate constructor in the same class"); - if (isGetSet) this.raise(key.start, "Constructor can't have get/set modifier"); - if (isGenerator) this.raise(key.start, "Constructor can't be a generator"); - method.kind = "constructor"; - hadConstructor = true; - } - } - this.parseClassMethod(classBody, method, isGenerator); - if (isGetSet) { - var paramCount = method.kind === "get" ? 0 : 1; - if (method.value.params.length !== paramCount) { - var start = method.value.start; - if (method.kind === "get") this.raise(start, "getter should have no params");else this.raise(start, "setter should have exactly one param"); - } - if (method.kind === "set" && method.value.params[0].type === "RestElement") this.raise(method.value.params[0].start, "Setter cannot use rest params"); - } - } - node.body = this.finishNode(classBody, "ClassBody"); - return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression"); -}; - -pp.parseClassMethod = function (classBody, method, isGenerator) { - method.value = this.parseMethod(isGenerator); - classBody.body.push(this.finishNode(method, "MethodDefinition")); -}; - -pp.parseClassId = function (node, isStatement) { - node.id = this.type === _tokentype.types.name ? this.parseIdent() : isStatement ? this.unexpected() : null; -}; - -pp.parseClassSuper = function (node) { - node.superClass = this.eat(_tokentype.types._extends) ? this.parseExprSubscripts() : null; -}; - -// Parses module export declaration. - -pp.parseExport = function (node) { - this.next(); - // export * from '...' - if (this.eat(_tokentype.types.star)) { - this.expectContextual("from"); - node.source = this.type === _tokentype.types.string ? this.parseExprAtom() : this.unexpected(); - this.semicolon(); - return this.finishNode(node, "ExportAllDeclaration"); - } - if (this.eat(_tokentype.types._default)) { - // export default ... - var expr = this.parseMaybeAssign(); - var needsSemi = true; - if (expr.type == "FunctionExpression" || expr.type == "ClassExpression") { - needsSemi = false; - if (expr.id) { - expr.type = expr.type == "FunctionExpression" ? "FunctionDeclaration" : "ClassDeclaration"; - } - } - node.declaration = expr; - if (needsSemi) this.semicolon(); - return this.finishNode(node, "ExportDefaultDeclaration"); - } - // export var|const|let|function|class ... - if (this.shouldParseExportStatement()) { - node.declaration = this.parseStatement(true); - node.specifiers = []; - node.source = null; - } else { - // export { x, y as z } [from '...'] - node.declaration = null; - node.specifiers = this.parseExportSpecifiers(); - if (this.eatContextual("from")) { - node.source = this.type === _tokentype.types.string ? this.parseExprAtom() : this.unexpected(); - } else { - // check for keywords used as local names - for (var i = 0; i < node.specifiers.length; i++) { - if (this.keywords.test(node.specifiers[i].local.name) || this.reservedWords.test(node.specifiers[i].local.name)) { - this.unexpected(node.specifiers[i].local.start); - } - } - - node.source = null; - } - this.semicolon(); - } - return this.finishNode(node, "ExportNamedDeclaration"); -}; - -pp.shouldParseExportStatement = function () { - return this.type.keyword; -}; - -// Parses a comma-separated list of module exports. - -pp.parseExportSpecifiers = function () { - var nodes = [], - first = true; - // export { x, y as z } [from '...'] - this.expect(_tokentype.types.braceL); - while (!this.eat(_tokentype.types.braceR)) { - if (!first) { - this.expect(_tokentype.types.comma); - if (this.afterTrailingComma(_tokentype.types.braceR)) break; - } else first = false; - - var node = this.startNode(); - node.local = this.parseIdent(this.type === _tokentype.types._default); - node.exported = this.eatContextual("as") ? this.parseIdent(true) : node.local; - nodes.push(this.finishNode(node, "ExportSpecifier")); - } - return nodes; -}; - -// Parses import declaration. - -pp.parseImport = function (node) { - this.next(); - // import '...' - if (this.type === _tokentype.types.string) { - node.specifiers = empty; - node.source = this.parseExprAtom(); - } else { - node.specifiers = this.parseImportSpecifiers(); - this.expectContextual("from"); - node.source = this.type === _tokentype.types.string ? this.parseExprAtom() : this.unexpected(); - } - this.semicolon(); - return this.finishNode(node, "ImportDeclaration"); -}; - -// Parses a comma-separated list of module imports. - -pp.parseImportSpecifiers = function () { - var nodes = [], - first = true; - if (this.type === _tokentype.types.name) { - // import defaultObj, { x, y as z } from '...' - var node = this.startNode(); - node.local = this.parseIdent(); - this.checkLVal(node.local, true); - nodes.push(this.finishNode(node, "ImportDefaultSpecifier")); - if (!this.eat(_tokentype.types.comma)) return nodes; - } - if (this.type === _tokentype.types.star) { - var node = this.startNode(); - this.next(); - this.expectContextual("as"); - node.local = this.parseIdent(); - this.checkLVal(node.local, true); - nodes.push(this.finishNode(node, "ImportNamespaceSpecifier")); - return nodes; - } - this.expect(_tokentype.types.braceL); - while (!this.eat(_tokentype.types.braceR)) { - if (!first) { - this.expect(_tokentype.types.comma); - if (this.afterTrailingComma(_tokentype.types.braceR)) break; - } else first = false; - - var node = this.startNode(); - node.imported = this.parseIdent(true); - if (this.eatContextual("as")) { - node.local = this.parseIdent(); - } else { - node.local = node.imported; - if (this.isKeyword(node.local.name)) this.unexpected(node.local.start); - if (this.reservedWordsStrict.test(node.local.name)) this.raise(node.local.start, "The keyword '" + node.local.name + "' is reserved"); - } - this.checkLVal(node.local, true); - nodes.push(this.finishNode(node, "ImportSpecifier")); - } - return nodes; -}; - -},{"./state":10,"./tokentype":14,"./whitespace":16}],12:[function(_dereq_,module,exports){ -// The algorithm used to determine whether a regexp can appear at a -// given point in the program is loosely based on sweet.js' approach. -// See https://github.com/mozilla/sweet.js/wiki/design - -"use strict"; - -exports.__esModule = true; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _state = _dereq_("./state"); - -var _tokentype = _dereq_("./tokentype"); - -var _whitespace = _dereq_("./whitespace"); - -var TokContext = function TokContext(token, isExpr, preserveSpace, override) { - _classCallCheck(this, TokContext); - - this.token = token; - this.isExpr = !!isExpr; - this.preserveSpace = !!preserveSpace; - this.override = override; -}; - -exports.TokContext = TokContext; -var types = { - b_stat: new TokContext("{", false), - b_expr: new TokContext("{", true), - b_tmpl: new TokContext("${", true), - p_stat: new TokContext("(", false), - p_expr: new TokContext("(", true), - q_tmpl: new TokContext("`", true, true, function (p) { - return p.readTmplToken(); - }), - f_expr: new TokContext("function", true) -}; - -exports.types = types; -var pp = _state.Parser.prototype; - -pp.initialContext = function () { - return [types.b_stat]; -}; - -pp.braceIsBlock = function (prevType) { - if (prevType === _tokentype.types.colon) { - var _parent = this.curContext(); - if (_parent === types.b_stat || _parent === types.b_expr) return !_parent.isExpr; - } - if (prevType === _tokentype.types._return) return _whitespace.lineBreak.test(this.input.slice(this.lastTokEnd, this.start)); - if (prevType === _tokentype.types._else || prevType === _tokentype.types.semi || prevType === _tokentype.types.eof || prevType === _tokentype.types.parenR) return true; - if (prevType == _tokentype.types.braceL) return this.curContext() === types.b_stat; - return !this.exprAllowed; -}; - -pp.updateContext = function (prevType) { - var update = undefined, - type = this.type; - if (type.keyword && prevType == _tokentype.types.dot) this.exprAllowed = false;else if (update = type.updateContext) update.call(this, prevType);else this.exprAllowed = type.beforeExpr; -}; - -// Token-specific context update code - -_tokentype.types.parenR.updateContext = _tokentype.types.braceR.updateContext = function () { - if (this.context.length == 1) { - this.exprAllowed = true; - return; - } - var out = this.context.pop(); - if (out === types.b_stat && this.curContext() === types.f_expr) { - this.context.pop(); - this.exprAllowed = false; - } else if (out === types.b_tmpl) { - this.exprAllowed = true; - } else { - this.exprAllowed = !out.isExpr; - } -}; - -_tokentype.types.braceL.updateContext = function (prevType) { - this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr); - this.exprAllowed = true; -}; - -_tokentype.types.dollarBraceL.updateContext = function () { - this.context.push(types.b_tmpl); - this.exprAllowed = true; -}; - -_tokentype.types.parenL.updateContext = function (prevType) { - var statementParens = prevType === _tokentype.types._if || prevType === _tokentype.types._for || prevType === _tokentype.types._with || prevType === _tokentype.types._while; - this.context.push(statementParens ? types.p_stat : types.p_expr); - this.exprAllowed = true; -}; - -_tokentype.types.incDec.updateContext = function () { - // tokExprAllowed stays unchanged -}; - -_tokentype.types._function.updateContext = function () { - if (this.curContext() !== types.b_stat) this.context.push(types.f_expr); - this.exprAllowed = false; -}; - -_tokentype.types.backQuote.updateContext = function () { - if (this.curContext() === types.q_tmpl) this.context.pop();else this.context.push(types.q_tmpl); - this.exprAllowed = false; -}; - -},{"./state":10,"./tokentype":14,"./whitespace":16}],13:[function(_dereq_,module,exports){ -"use strict"; - -exports.__esModule = true; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _identifier = _dereq_("./identifier"); - -var _tokentype = _dereq_("./tokentype"); - -var _state = _dereq_("./state"); - -var _locutil = _dereq_("./locutil"); - -var _whitespace = _dereq_("./whitespace"); - -// Object type used to represent tokens. Note that normally, tokens -// simply exist as properties on the parser object. This is only -// used for the onToken callback and the external tokenizer. - -var Token = function Token(p) { - _classCallCheck(this, Token); - - this.type = p.type; - this.value = p.value; - this.start = p.start; - this.end = p.end; - if (p.options.locations) this.loc = new _locutil.SourceLocation(p, p.startLoc, p.endLoc); - if (p.options.ranges) this.range = [p.start, p.end]; -} - -// ## Tokenizer - -; - -exports.Token = Token; -var pp = _state.Parser.prototype; - -// Are we running under Rhino? -var isRhino = typeof Packages == "object" && Object.prototype.toString.call(Packages) == "[object JavaPackage]"; - -// Move to the next token - -pp.next = function () { - if (this.options.onToken) this.options.onToken(new Token(this)); - - this.lastTokEnd = this.end; - this.lastTokStart = this.start; - this.lastTokEndLoc = this.endLoc; - this.lastTokStartLoc = this.startLoc; - this.nextToken(); -}; - -pp.getToken = function () { - this.next(); - return new Token(this); -}; - -// If we're in an ES6 environment, make parsers iterable -if (typeof Symbol !== "undefined") pp[Symbol.iterator] = function () { - var self = this; - return { next: function next() { - var token = self.getToken(); - return { - done: token.type === _tokentype.types.eof, - value: token - }; - } }; -}; - -// Toggle strict mode. Re-reads the next number or string to please -// pedantic tests (`"use strict"; 010;` should fail). - -pp.setStrict = function (strict) { - this.strict = strict; - if (this.type !== _tokentype.types.num && this.type !== _tokentype.types.string) return; - this.pos = this.start; - if (this.options.locations) { - while (this.pos < this.lineStart) { - this.lineStart = this.input.lastIndexOf("\n", this.lineStart - 2) + 1; - --this.curLine; - } - } - this.nextToken(); -}; - -pp.curContext = function () { - return this.context[this.context.length - 1]; -}; - -// Read a single token, updating the parser object's token-related -// properties. - -pp.nextToken = function () { - var curContext = this.curContext(); - if (!curContext || !curContext.preserveSpace) this.skipSpace(); - - this.start = this.pos; - if (this.options.locations) this.startLoc = this.curPosition(); - if (this.pos >= this.input.length) return this.finishToken(_tokentype.types.eof); - - if (curContext.override) return curContext.override(this);else this.readToken(this.fullCharCodeAtPos()); -}; - -pp.readToken = function (code) { - // Identifier or keyword. '\uXXXX' sequences are allowed in - // identifiers, so '\' also dispatches to that. - if (_identifier.isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */) return this.readWord(); - - return this.getTokenFromCode(code); -}; - -pp.fullCharCodeAtPos = function () { - var code = this.input.charCodeAt(this.pos); - if (code <= 0xd7ff || code >= 0xe000) return code; - var next = this.input.charCodeAt(this.pos + 1); - return (code << 10) + next - 0x35fdc00; -}; - -pp.skipBlockComment = function () { - var startLoc = this.options.onComment && this.curPosition(); - var start = this.pos, - end = this.input.indexOf("*/", this.pos += 2); - if (end === -1) this.raise(this.pos - 2, "Unterminated comment"); - this.pos = end + 2; - if (this.options.locations) { - _whitespace.lineBreakG.lastIndex = start; - var match = undefined; - while ((match = _whitespace.lineBreakG.exec(this.input)) && match.index < this.pos) { - ++this.curLine; - this.lineStart = match.index + match[0].length; - } - } - if (this.options.onComment) this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos, startLoc, this.curPosition()); -}; - -pp.skipLineComment = function (startSkip) { - var start = this.pos; - var startLoc = this.options.onComment && this.curPosition(); - var ch = this.input.charCodeAt(this.pos += startSkip); - while (this.pos < this.input.length && ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8233) { - ++this.pos; - ch = this.input.charCodeAt(this.pos); - } - if (this.options.onComment) this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos, startLoc, this.curPosition()); -}; - -// Called at the start of the parse and after every token. Skips -// whitespace and comments, and. - -pp.skipSpace = function () { - loop: while (this.pos < this.input.length) { - var ch = this.input.charCodeAt(this.pos); - switch (ch) { - case 32:case 160: - // ' ' - ++this.pos; - break; - case 13: - if (this.input.charCodeAt(this.pos + 1) === 10) { - ++this.pos; - } - case 10:case 8232:case 8233: - ++this.pos; - if (this.options.locations) { - ++this.curLine; - this.lineStart = this.pos; - } - break; - case 47: - // '/' - switch (this.input.charCodeAt(this.pos + 1)) { - case 42: - // '*' - this.skipBlockComment(); - break; - case 47: - this.skipLineComment(2); - break; - default: - break loop; - } - break; - default: - if (ch > 8 && ch < 14 || ch >= 5760 && _whitespace.nonASCIIwhitespace.test(String.fromCharCode(ch))) { - ++this.pos; - } else { - break loop; - } - } - } -}; - -// Called at the end of every token. Sets `end`, `val`, and -// maintains `context` and `exprAllowed`, and skips the space after -// the token, so that the next one's `start` will point at the -// right position. - -pp.finishToken = function (type, val) { - this.end = this.pos; - if (this.options.locations) this.endLoc = this.curPosition(); - var prevType = this.type; - this.type = type; - this.value = val; - - this.updateContext(prevType); -}; - -// ### Token reading - -// This is the function that is called to fetch the next token. It -// is somewhat obscure, because it works in character codes rather -// than characters, and because operator parsing has been inlined -// into it. -// -// All in the name of speed. -// -pp.readToken_dot = function () { - var next = this.input.charCodeAt(this.pos + 1); - if (next >= 48 && next <= 57) return this.readNumber(true); - var next2 = this.input.charCodeAt(this.pos + 2); - if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { - // 46 = dot '.' - this.pos += 3; - return this.finishToken(_tokentype.types.ellipsis); - } else { - ++this.pos; - return this.finishToken(_tokentype.types.dot); - } -}; - -pp.readToken_slash = function () { - // '/' - var next = this.input.charCodeAt(this.pos + 1); - if (this.exprAllowed) { - ++this.pos;return this.readRegexp(); - } - if (next === 61) return this.finishOp(_tokentype.types.assign, 2); - return this.finishOp(_tokentype.types.slash, 1); -}; - -pp.readToken_mult_modulo = function (code) { - // '%*' - var next = this.input.charCodeAt(this.pos + 1); - if (next === 61) return this.finishOp(_tokentype.types.assign, 2); - return this.finishOp(code === 42 ? _tokentype.types.star : _tokentype.types.modulo, 1); -}; - -pp.readToken_pipe_amp = function (code) { - // '|&' - var next = this.input.charCodeAt(this.pos + 1); - if (next === code) return this.finishOp(code === 124 ? _tokentype.types.logicalOR : _tokentype.types.logicalAND, 2); - if (next === 61) return this.finishOp(_tokentype.types.assign, 2); - return this.finishOp(code === 124 ? _tokentype.types.bitwiseOR : _tokentype.types.bitwiseAND, 1); -}; - -pp.readToken_caret = function () { - // '^' - var next = this.input.charCodeAt(this.pos + 1); - if (next === 61) return this.finishOp(_tokentype.types.assign, 2); - return this.finishOp(_tokentype.types.bitwiseXOR, 1); -}; - -pp.readToken_plus_min = function (code) { - // '+-' - var next = this.input.charCodeAt(this.pos + 1); - if (next === code) { - if (next == 45 && this.input.charCodeAt(this.pos + 2) == 62 && _whitespace.lineBreak.test(this.input.slice(this.lastTokEnd, this.pos))) { - // A `-->` line comment - this.skipLineComment(3); - this.skipSpace(); - return this.nextToken(); - } - return this.finishOp(_tokentype.types.incDec, 2); - } - if (next === 61) return this.finishOp(_tokentype.types.assign, 2); - return this.finishOp(_tokentype.types.plusMin, 1); -}; - -pp.readToken_lt_gt = function (code) { - // '<>' - var next = this.input.charCodeAt(this.pos + 1); - var size = 1; - if (next === code) { - size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2; - if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(_tokentype.types.assign, size + 1); - return this.finishOp(_tokentype.types.bitShift, size); - } - if (next == 33 && code == 60 && this.input.charCodeAt(this.pos + 2) == 45 && this.input.charCodeAt(this.pos + 3) == 45) { - if (this.inModule) this.unexpected(); - // ` - - 4.0.0 - - - org.eclipse.cdt - cdt-parent - 11.0.0-SNAPSHOT - - - org.eclipse.cdt.qt-parent - pom - diff --git a/releng/CDT.setup b/releng/CDT.setup index 8e5260480a1..6205708cf5f 100644 --- a/releng/CDT.setup +++ b/releng/CDT.setup @@ -135,8 +135,6 @@ name="org.eclipse.cdt.meson.feature.group"/> - + excludedWorkingSet="//'cdt.workingsets'/@workingSets[name='CDT%20Json%20CDB'] //'cdt.workingsets'/@workingSets[name='CDT%20JTag'] //'cdt.workingsets'/@workingSets[name='CDT%20Launch'] //'cdt.workingsets'/@workingSets[name='CDT%20Launchbar'] //'cdt.workingsets'/@workingSets[name='CDT%20Releng'] //'cdt.workingsets'/@workingSets[name='CDT%20Remote'] //'cdt.workingsets'/@workingSets[name='CDT%20Terminal'] //'cdt.workingsets'/@workingSets[name='CDT%20Build'] //'cdt.workingsets'/@workingSets[name='CDT%20CMake'] //'cdt.workingsets'/@workingSets[name='CDT%20Codan'] //'cdt.workingsets'/@workingSets[name='CDT%20Core'] //'cdt.workingsets'/@workingSets[name='CDT%20Cross'] //'cdt.workingsets'/@workingSets[name='CDT%20Debug'] //'cdt.workingsets'/@workingSets[name='CDT%20DSF'] //'cdt.workingsets'/@workingSets[name='CDT%20DSF%20GDB'] //'cdt.workingsets'/@workingSets[name='CDT%20Doc'] //'cdt.workingsets'/@workingSets[name='CDT%20LLVM'] //'cdt.workingsets'/@workingSets[name='CDT%20LSP'] //'cdt.workingsets'/@workingSets[name='CDT%20Memory'] //'cdt.workingsets'/@workingSets[name='CDT%20Native'] //'cdt.workingsets'/@workingSets[name='CDT%20Tests%20Runner'] //'cdt.workingsets'/@workingSets[name='CDT%20Tools%20Templates'] //'cdt.workingsets'/@workingSets[name='CDT%20Unit%20Test'] //'cdt.workingsets'/@workingSets[name='CDT%20Util'] //'cdt.workingsets'/@workingSets[name='CDT%20Visualizer'] //'cdt.workingsets'/@workingSets[name='CDT%20Windows']"/> - - - - - - - - - diff --git a/releng/org.eclipse.cdt.target/cdt-baseline.target b/releng/org.eclipse.cdt.target/cdt-baseline.target index 7758bbb2b1a..1cbf65ef7f1 100644 --- a/releng/org.eclipse.cdt.target/cdt-baseline.target +++ b/releng/org.eclipse.cdt.target/cdt-baseline.target @@ -28,7 +28,6 @@ -