diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 00000000000..cd0c4869e30 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,11 @@ +coverage: + precision: 0 + status: + project: + default: + # basic + target: auto + threshold: 1% # we accept a bit fluctuation, as we run random tests + base: auto + paths: + - "src" diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 00000000000..933e3bb46e1 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,12 @@ +# List of commits that shouldn't be included in `git blame`. +# Github and other tools already support it if it's this exact filename +# But you have to teach your own git about this by running this command (in this repo) +# git config blame.ignoreRevsFile .git-blame-ignore-revs + +# indent fix for JSON +31b1031ade5d84f9c60e30d17da3b55e78d291fb + +# fixing tabs & spaces mixed +0d048e15683740b5c944be5333ec0680df825e47 +23ec4b622bbe503ef013be5a458e45ae6fd89b97 +200b0352084be9435c64aa60c550edd24a59131b diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000000..2ce24899f27 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.dot diff=-astextplain diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000000..cbe6e7d3fb7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,37 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +**Describe the bug** + +A clear and concise description of what the bug is. + +**To Reproduce** + +Steps to reproduce the behavior: +1. Modules to define (attach files or inline code quotes) +2. REPL commands to type +3. AND/OR: Eclipse IDE actions to trigger +4. See error in? REPL, Error Log, Console log? + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Stack traces** + +Literally copy stacktraces from the console, or from the Eclipse Error log here. + +**Desktop (please complete the following information):** + - Context: Eclipse plugin, Commandline REPL + - Rascal Version [e.g. 0.17.0], stable or unstable release? + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000000..bbcbbe7d615 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/stable-release-manual-testing-template.md b/.github/ISSUE_TEMPLATE/stable-release-manual-testing-template.md new file mode 100644 index 00000000000..882269c7121 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/stable-release-manual-testing-template.md @@ -0,0 +1,90 @@ +--- +name: Stable release manual testing template +about: This is a list of things to do and to check at the time of a stable release +title: "[RELEASE] version 0.x.x" +labels: release testing +assignees: '' + +--- + +# Preliminaries + +* Every time this document says "release X" ; we mean to execute the instructions of this Wiki page: https://github.com/usethesource/rascal/wiki/How-to-make-a-release-of-a-Rascal-implemenation-project +* The current release instructions are focused on the Rascal commandline tools and the Eclipse IDE plugin +* If you edit this template, then please push relevant improvements to the template itself for future reference. + +# Pre-releasing dependent tools in unstable + +First a "pre-release" of the supporting compiler/typechecker tools must be done, so we know we are releasing a consistently compiled standard library. + +- [ ] typepal and rascal-core compile in the continuous integration environment and no tests fail +- [ ] release typepal +- [ ] release rascal-core +- [ ] bump typepal and rascal-core versions in rascal-maven-plugin to latest releases +- [ ] bump typepal and rascal-core versions in rascal-eclipse to latests SNAPSHOT releases +- [ ] release rascal-maven-plugin +- [ ] bump rascal-maven-plugin dependency in rascal and rascal-eclipse project +- [ ] fix new errors and warnings in rascal and rascal-eclipse project + +# Manual version checks + +- [ ] Continuous Integration runs all unit and integration tests and fails no test +- [ ] Maximum number of compiler warnings are resolved +- [ ] Version numbers are verified manually + +# Manual feature tests + +- [ ] Eclipse download and install latest unstable release from update site https://releases.usethesource.io/maven/org/rascalmpl/rascal-update-site/ +- [ ] Open a Rascal REPL using the toolbar button +- [ ] Can create new Rascal project using the wizard +- [ ] Can create new Rascal module using the wizard +- [ ] Can edit Rascal file in Rascal project +- [ ] Save on Rascal file triggers type-checker +- [ ] Rascal outline works +- [ ] Rascal navigator works +- [ ] Rascal navigator displays working sets +- [ ] Rascal navigator displays interpreter's search path +- [ ] Clicking links in REPL opens editors and websites +- [ ] `rascal>1 + 1` on the REPL +- [ ] `import IO; println("Hello Rascal!");` +- [ ] in editor, click on use of name jumps to definition +- [ ] jump-to-definition also works to library modules and inside library modules +- [ ] clicking in outline jumps to editor to right position +- [ ] syntax highlighting in editor works +- [ ] add dependency on another project by editing `pom.xml` ` tag, import a module and test the type-checker as well as the interpreter for correct resolution +- [ ] `import demo::lang::Pico::Plugin; registerPico();` and test the editor of the example pico files (syntax highlighting, menu options) +- [ ] `import demo::lang::Pico::Plugin; rascal>:edit demo::lang::Pico::Plugin` +- [ ] use util::IDEServices: + - [ ] registerDiagnostics with more than one file + - [ ] test edit function (for example with vis::Graph examples that use it) + - [ ] test showInteractiveContent function (for example with vis::Chart examples) + +# Actual release + +- [ ] release rascal project (when resolving SNAPSHOT dependencies choose the right versions of vallang etc, and make sure to bump the new rascal SNAPSHOT release one minor version) +- [ ] bootstrap documentation site + - [ ] bump rascal version in rascal-maven-project, mvn install + - [ ] bump rascal version in rascal-website project + - [ ] set rascal-maven-project snapshot dependency in rascal-website project + - [ ] run `mvn clean package` in rascal-website project + - [ ] fix errors, possibly release rascal project patch versions, and repeat the above. + - [ ] release rascal-maven-project + - [ ] bump rascal-maven-project dependency in rascal-website project + - [ ] run `mvn clean package` in rascal-website project and `git push` to publish new docs +- [ ] release rascal-eclipse project (take care to choose the right release versions of typepal and rascal-core you release earlier and choose their new SNAPSHOT dependencies to the latest) +- [ ] change the configuration of the stable version in `update-site-nexus-link-script/refresh-nexus-data` to the released version +- [ ] test the stable update site at https://update.rascal-mpl.org/stable +- [ ] write release notes and publish on the usethesource.io blog + +# Downstream implications + +The following items can be executed asynchronously, but are nevertheless not to be forgotten: + +- [ ] change dependencies on rascal-eclipse and rascal in rascal-eclipse-libraries and the projects it depends on +- [ ] change dependencies of typepal to latest rascal and rascal-eclipse +- [ ] change dependency of rascal-core to latest stable rascal +- [ ] change dependency in all projects on new rascal-maven-project +- [ ] change dependency of rascal-maven-project and rascal in rascal-tutor +- [ ] release rascal-tutor +- [ ] bump dependency of rascal-tutor in rascal-maven-project +- [ ] release rascal-maven-project again diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 00000000000..1fb8ea3326c --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,233 @@ +name: Build and Deploy +on: + push: + branches: + - main + tags: + - 'v[0-9]+.*' + pull_request: + branches: + - main + - 'feat/*' +env: + MAVEN_OPTS: "-Xmx4G -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true" + IS_OWN_PR: "${{ secrets.MAVEN_MIRROR_URL }}" + +jobs: + test-linux: + if: ${{ !(github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, '[maven-release-plugin]')) }} + runs-on: ubicloud-standard-4 + steps: + - uses: actions/checkout@v4 + + - uses: s4u/maven-settings-action@v3.1.0 + if: ${{ env.IS_OWN_PR != '' }} + with: + servers: '[{"id": "usethesource-gh", "username":"github", "password": "${{ secrets.MAVEN_MIRROR_PASSWORD }}"}]' + mirrors: '[{"id": "usethesource-gh", "name": "uts mirror", "mirrorOf": "usethesource", "url": "${{ secrets.MAVEN_MIRROR_URL }}"}]' + - uses: actions/setup-java@v4 + with: + java-version: 11 + distribution: 'temurin' + cache: 'maven' + overwrite-settings: false + - name: Run Tests + run: mvn -B -Drascal.compile.skip -Drascal.tutor.skip -Drascal.test.memory=14 test + + - uses: codecov/codecov-action@v4 + continue-on-error: true # sometimes this one fails, that shouldn't stop a build + with: + fail_ci_if_error: false + verbose: true + token: ${{ secrets.CODECOV_TOKEN }} + + - name: Publish Test Report on github action + if: ${{ always() && github.event_name != 'pull_request' }} # to bad this doesn't work nicely with external pull requests + continue-on-error: true # sometimes this one fails, that shouldn't stop a build + uses: scacap/action-surefire-report@v1 + with: + check_name: "Test Report - ${{ runner.os }}" + + builds: + if: ${{ !(github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, '[maven-release-plugin]')) }} + needs: [test-linux] + permissions: + contents: write + runs-on: ubicloud-standard-4 + environment: ${{ startsWith(github.ref, 'refs/tags/v') && 'deployment' || '' }} + steps: + - uses: browser-actions/setup-chrome@latest + with: + chrome-version: 1047731 # v107 + - run: which chrome + - uses: nanasess/setup-chromedriver@v2 + with: + chromedriver-version: '107.0.5304.62' + - run: which chromedriver + + - uses: s4u/maven-settings-action@v3.1.0 + if: ${{ env.IS_OWN_PR != '' }} + with: + servers: '[{"id": "usethesource-gh", "username":"github", "password": "${{ secrets.MAVEN_MIRROR_PASSWORD }}"}]' + mirrors: '[{"id": "usethesource-gh", "name": "uts mirror", "mirrorOf": "usethesource", "url": "${{ secrets.MAVEN_MIRROR_URL }}"}]' + + - uses: actions/checkout@v4 + + - uses: actions/setup-java@v4 + with: + java-version: 11 + distribution: 'temurin' + cache: 'maven' + overwrite-settings: false + + + - name: Compile & Bootstrap + run: mvn -B compile -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver -Dwebdriver.chrome.browser=`which chrome` + env: + MAVEN_OPTS: "-Xmx14G -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true" + + - name: Test if release # just to be extra sure for a release + if: startsWith(github.ref, 'refs/tags/v') + run: mvn -Drascal.test.memory=14 -Drascal.compile.skip -Drascal.tutor.skip test + + - name: Attach artifact + id: build-artifact + uses: SWAT-engineering/maven-full-artifacts-action@v1 + with: + maven-options: | + -Drascal.compile.skip + -Drascal.tutor.skip + -DskipTests + -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn + + - name: Making sure test have succeeded in the parallel jobs + if: startsWith(github.ref, 'refs/tags/') + uses: yogeshlonkar/wait-for-jobs@v0 + with: + gh-token: ${{ secrets.GITHUB_TOKEN }} + jobs: | + tests (macos-latest) + tests (windows-latest) + ttl: 15 + + - name: Deploy + if: startsWith(github.ref, 'refs/tags/v') + uses: usethesource/releases-maven-action@v1 + with: + maven-username: ${{ secrets.RELEASE_MAVEN_USERNAME }} + maven-password: ${{ secrets.RELEASE_MAVEN_PASSWORD }} + maven-local-port: ${{ secrets.RELEASE_MAVEN_LOCAL_PORT }} + ssh-hostname: ${{ secrets.RELEASE_SSH_SERVER }} + ssh-known-host: ${{ secrets.RELEASE_SSH_KNOWN_HOSTS }} + ssh-username: ${{ secrets.RELEASE_SSH_USERNAME }} + ssh-private-key: ${{ secrets.RELEASE_SSH_PRIVATE_KEY }} + + - name: Prepare Draft Release + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') + with: + draft: true + files: ${{ steps.build-artifact.outputs.artifact-root-dir}}/**/* + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +# - name: prepare-unshaded +# if: startsWith(github.ref, 'refs/tags/') +# run: sed -i 's#rascal#rascal-unshaded#' pom.xml +# +# - name: Deploy unshaded jar +# if: startsWith(github.ref, 'refs/tags/v') +# uses: usethesource/releases-maven-action@v1 +# with: +# maven-username: ${{ secrets.RELEASE_MAVEN_USERNAME }} +# maven-password: ${{ secrets.RELEASE_MAVEN_PASSWORD }} +# maven-local-port: ${{ secrets.RELEASE_MAVEN_LOCAL_PORT }} +# ssh-hostname: ${{ secrets.RELEASE_SSH_SERVER }} +# ssh-known-host: ${{ secrets.RELEASE_SSH_KNOWN_HOSTS }} +# ssh-username: ${{ secrets.RELEASE_SSH_USERNAME }} +# ssh-private-key: ${{ secrets.RELEASE_SSH_PRIVATE_KEY }} +# maven-options: -Punshaded -Drascal.compile.skip -Drascal.tutor.skip -DskipTests +# + tests: + if: ${{ !(github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, '[maven-release-plugin]')) }} + needs: [test-linux] + runs-on: ${{matrix.os}} + strategy: + matrix: + os: [windows-latest, macos-latest] + env: + MAVEN_OPTS: "-Xmx512M -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true" + steps: + - uses: actions/checkout@v4 + + - uses: s4u/maven-settings-action@v3.1.0 + if: ${{ env.IS_OWN_PR != '' }} + with: + servers: '[{"id": "usethesource-gh", "username":"github", "password": "${{ secrets.MAVEN_MIRROR_PASSWORD }}"}]' + mirrors: '[{"id": "usethesource-gh", "name": "uts mirror", "mirrorOf": "usethesource", "url": "${{ secrets.MAVEN_MIRROR_URL }}"}]' + - uses: actions/setup-java@v4 + with: + java-version: 11 + distribution: 'temurin' + cache: 'maven' + overwrite-settings: false + + - name: Run Tests + # single quotes to help windows deal with argument splitting + run: mvn -B '-Drascal.compile.skip' '-Drascal.tutor.skip' '-Drascal.test.memory=2' test + + - uses: codecov/codecov-action@v4 + continue-on-error: true # sometimes this one fails, that shouldn't stop a build + with: + token: e8b4481a-d178-4148-a4ff-502906390512 + + - name: Publish Test Report on github action + if: ${{ always() && github.event_name != 'pull_request' }} # to bad this doesn't work nicely with external pull requests + continue-on-error: true # sometimes this one fails, that shouldn't stop a build + uses: scacap/action-surefire-report@v1 + with: + check_name: "Test Report - ${{ runner.os }}" + + compiler-tests: + if: ${{ !(github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, '[maven-release-plugin]')) }} + needs: [test-linux] + runs-on: ubicloud-standard-4 + env: + MAVEN_OPTS: "-Xmx512M -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true" + steps: + - uses: actions/checkout@v4 + + - uses: s4u/maven-settings-action@v3.1.0 + if: ${{ env.IS_OWN_PR != '' }} + with: + servers: '[{"id": "usethesource-gh", "username":"github", "password": "${{ secrets.MAVEN_MIRROR_PASSWORD }}"}]' + mirrors: '[{"id": "usethesource-gh", "name": "uts mirror", "mirrorOf": "usethesource", "url": "${{ secrets.MAVEN_MIRROR_URL }}"}]' + - uses: actions/setup-java@v4 + with: + java-version: 11 + distribution: 'temurin' + cache: 'maven' + overwrite-settings: false + + - name: Retrieve dependencies for integration tests + run: bash src/org/rascalmpl/compiler/lang/rascalcore/check/tests/download-test-jars.sh + + - name: Run Tests + run: mvn -B -Pcompiler-tests -Drascal.compile.skip -Drascal.tutor.skip -Drascal.test.memory=10 test + + - uses: codecov/codecov-action@v4 + continue-on-error: true # sometimes this one fails, that shouldn't stop a build + with: + fail_ci_if_error: false + verbose: true + token: ${{ secrets.CODECOV_TOKEN }} + + - name: Publish Test Report on github action + if: ${{ always() && github.event_name != 'pull_request' }} # to bad this doesn't work nicely with external pull requests + continue-on-error: true # sometimes this one fails, that shouldn't stop a build + uses: scacap/action-surefire-report@v1 + with: + check_name: "Compiler Test Report" + + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000000..932f9c86198 --- /dev/null +++ b/.gitignore @@ -0,0 +1,35 @@ +# eclipse stuff +.project +.metadata +.settings +.classpath +bin/** +tmp/** +tmp/**/* +**/*.rvm +*.tmp +*.bak +*.swp +*~.nib +local.properties +.loadpath + +# maven stuff +target/ +bin/ +bootstrap/ +pom.xml.releaseBackup +release.properties +pom.xml.versionsBackup +rascal-DEPENDENCIES.txt + +.DS_Store +/.apt_generated/ + +dependency-reduced-pom.xml +.ipynb_checkpoints +__pycache__ +.vscode/settings.json + +*.iml +.idea/ diff --git a/.project b/.project new file mode 100644 index 00000000000..d15a1c02d98 --- /dev/null +++ b/.project @@ -0,0 +1,46 @@ + + + rascal + + + + + + org.eclipse.jdt.core.javabuilder + + + + + rascal_eclipse.rascal_builder + + + + + rascal_eclipse.tutor_builder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + rascal_eclipse.rascal_nature + rascal_eclipse.tutor_nature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + + + 1666611214669 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000000..c4fecf63d6a --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,12 @@ +eclipse.preferences.version=1 +encoding//src/org/rascalmpl/library=UTF-8 +encoding//src/org/rascalmpl/library/experiments/vis2/lib/MarkdownConverter.js=UTF-8 +encoding//src/org/rascalmpl/library/experiments/vis2/lib/nv.d3.css=UTF-8 +encoding//src/org/rascalmpl/library/experiments/vis2/lib/nv.d3.js=UTF-8 +encoding//src/org/rascalmpl/library/experiments/vis2/lib/reset.css=UTF-8 +encoding//src/org/rascalmpl/library/lang/rascal/tests/functionality/DataType.rsc=UTF-8 +encoding//test/org/rascalmpl/test/data=UTF-8 +encoding/=UTF-8 +encoding/src=UTF-8 +encoding/test=UTF-8 +org.eclipse.jdt.core.compiler.processAnnotations=enabled diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..8d92d59ecbc --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,576 @@ +eclipse.preferences.version=1 +enableParallelJavaIndexSearch=true +org.eclipse.jdt.core.builder.annotationPath.allLocations=disabled +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= +org.eclipse.jdt.core.circularClasspath=warning +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.camelCaseMatch=enabled +org.eclipse.jdt.core.codeComplete.deprecationCheck=disabled +org.eclipse.jdt.core.codeComplete.discouragedReferenceCheck=disabled +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.forbiddenReferenceCheck=enabled +org.eclipse.jdt.core.codeComplete.forceImplicitQualification=disabled +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.codeComplete.subwordMatch=disabled +org.eclipse.jdt.core.codeComplete.suggestStaticImports=enabled +org.eclipse.jdt.core.codeComplete.visibilityCheck=enabled +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.lambda.genericSignature=do not generate +org.eclipse.jdt.core.compiler.codegen.methodParameters=generate +org.eclipse.jdt.core.compiler.codegen.shareCommonFinallyBlocks=disabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=11 +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.emulateJavacBug8031744=enabled +org.eclipse.jdt.core.compiler.generateClassFiles=enabled +org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 +org.eclipse.jdt.core.compiler.problem.APILeak=warning +org.eclipse.jdt.core.compiler.problem.annotatedTypeArgumentToUnannotated=info +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.deadCodeInTrivialIfStatement=disabled +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=warning +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=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +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=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=ignore +org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +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=public +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +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=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingMethodWithoutSuperInvocation=ignore +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=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +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=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +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.suppressWarningsNotFullyAnalysed=info +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.tasks=warning +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.uninternedIdentityComparison=disabled +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=ignore +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.unusedTypeArgumentsForMethodInvocation=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.processAnnotations=disabled +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 +org.eclipse.jdt.core.compiler.storeAnnotations=disabled +org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled +org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL +org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX +org.eclipse.jdt.core.computeJavaBuildOrder=ignore +org.eclipse.jdt.core.encoding=utf8 +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_selector_in_method_invocation_on_expression_first_line=false +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_annotations_on_enum_constant=49 +org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field=0 +org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable=49 +org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method=49 +org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package=49 +org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter=0 +org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type=49 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=16 +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_assertion_message=0 +org.eclipse.jdt.core.formatter.alignment_for_assignment=16 +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_conditional_expression_chain=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +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_expressions_in_switch_case_with_arrow=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_colon=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_record_components=16 +org.eclipse.jdt.core.formatter.alignment_for_relational_operator=0 +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_shift_operator=0 +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_record_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_switch_case_with_arrow=0 +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_annotations=0 +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_last_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method=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=0 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=0 +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_statement_group_in_switch=0 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=2 +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_record_constructor=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_record_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=false +org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true +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=true +org.eclipse.jdt.core.formatter.comment.format_header=true +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +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=true +org.eclipse.jdt.core.formatter.comment.indent_tag_description=false +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags=do not insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=100 +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=1 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=1 +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=true +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_record_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=true +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=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=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=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=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_arrow_in_switch_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=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_permitted_types=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions=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_not_operator=do not 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=do not 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_record_declaration=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_arrow_in_switch_case=insert +org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=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=do not 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_record_declaration=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_permitted_types=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components=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_switch_case_expressions=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_record_constructor=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_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_record_declaration=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_annotation_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.keep_code_block_on_one_line=one_line_if_empty +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_enum_constant_declaration_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.keep_method_body_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line=one_line_never +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_getter_setter_on_one_line=false +org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_switch_body_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_switch_case_with_arrow_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never +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_after_code_block=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=3 +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_record_declaration=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=false +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.text_block_indentation=0 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +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_assertion_message_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_relational_operator=true +org.eclipse.jdt.core.formatter.wrap_before_shift_operator=true +org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true +org.eclipse.jdt.core.formatter.wrap_before_switch_case_arrow_operator=false +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 +org.eclipse.jdt.core.timeoutForParameterNameFromAttachedJavadoc=50 diff --git a/.settings/org.eclipse.jdt.ui.prefs b/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000000..40998fa0ee7 --- /dev/null +++ b/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +formatter_profile=_GoogleStyle +formatter_settings_version=12 +org.eclipse.jdt.ui.javadoc=false +org.eclipse.jdt.ui.text.custom_code_templates= diff --git a/.settings/org.eclipse.pde.prefs b/.settings/org.eclipse.pde.prefs new file mode 100644 index 00000000000..62cfa90dee9 --- /dev/null +++ b/.settings/org.eclipse.pde.prefs @@ -0,0 +1,32 @@ +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.not-externalized-att=2 +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 +eclipse.preferences.version=1 diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000000..fa9529bef36 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,97 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "java", + "name": "RascalCheck", + "request": "launch", + "mainClass": "org.rascalmpl.shell.RascalCheck", + "projectName": "rascal" + }, + { + "type": "java", + "name": "Launch DocRunner", + "request": "launch", + "mainClass": "org.rascalmpl.shell.DocRunner", + "projectName": "rascal" + }, + { + "type": "java", + "name": "Launch DoubleRightNullableWithPrefixSharing", + "request": "launch", + "mainClass": "org.rascalmpl.test.parser.DoubleRightNullableWithPrefixSharing", + "projectName": "rascal" + }, + { + "type": "java", + "name": "Launch Current File", + "request": "launch", + "mainClass": "${file}" + }, + { + "type": "java", + "name": "Launch RascalShell", + "request": "launch", + "mainClass": "org.rascalmpl.shell.RascalShell", + "projectName": "rascal", + "vmArgs": "-Xss80m -Xmx2g -ea", + "console": "integratedTerminal" + }, + { + "type": "java", + "name": "Launch RascalShell Tutor", + "request": "launch", + "mainClass": "org.rascalmpl.shell.RascalShell", + "projectName": "rascal", + "cwd": "${workspaceFolder}/../rascal-tutor", + "vmArgs": "-Xss80m -Xmx2g -ea" + }, + { + "type": "java", + "name": "Attach RascalShell", + "request": "attach", + "projectName": "rascal", + "hostName": "localhost", + "port": 9001 + }, + { + "type": "java", + "name": "Attach Mvn Rascal", + "request": "attach", + "projectName": "rascal-maven-plugin", + "hostName": "localhost", + "port": 8000 + }, + { + "type": "java", + "name": "Attach Rascal LSP Terminal", + "request": "attach", + "projectName": "rascal-lsp", + "hostName": "localhost", + "port": 9871 + }, + { + "type": "java", + "name": "Attach RascalNotebook", + "request": "attach", + "hostName": "localhost", + "port": 8000, + "projectName": "rascal-notebook" + }, + { + "type": "java", + "name": "Launch RascalShell in rascal-core", + "request": "launch", + "mainClass": "org.rascalmpl.shell.RascalShell", + "vmArgs": "-ea", + "classPaths": [ + "/Users/jurgenv/.m2/repository/junit/junit/4.12/junit-4.12.jar:/Users/jurgenv/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:/Users/jurgenv/.m2/repository/org/rascalmpl/rascal/0.19.3-SNAPSHOT/rascal-0.19.3-SNAPSHOT.jar:/Users/jurgenv/.m2/repository/org/rascalmpl/typepal/0.4.11-SNAPSHOT/typepal-0.4.11-SNAPSHOT.jar:/Users/jurgenv/.m2/repository/io/usethesource/vallang/0.13.0/vallang-0.13.0.jar:/Users/jurgenv/.m2/repository/io/usethesource/capsule/0.6.3/capsule-0.6.3.jar:/Users/jurgenv/.m2/repository/org/apache/commons/commons-compress/1.19/commons-compress-1.19.jar:/Users/jurgenv/.m2/repository/org/tukaani/xz/1.8/xz-1.8.jar:/Users/jurgenv/.m2/repository/com/github/luben/zstd-jni/1.4.5-2/zstd-jni-1.4.5-2.jar:/Users/jurgenv/.m2/repository/com/github/ben-manes/caffeine/caffeine/2.8.8/caffeine-2.8.8.jar:/Users/jurgenv/.m2/repository/com/google/errorprone/error_prone_annotations/2.4.0/error_prone_annotations-2.4.0.jar:/Users/jurgenv/.m2/repository/org/checkerframework/checker-qual/2.9.0/checker-qual-2.9.0.jar" + ], + "projectName": "rascal", + "cwd": "${workspaceFolder}/../rascal-core" + } + ] +} diff --git a/AUTHORS.md b/AUTHORS.md new file mode 100644 index 00000000000..d938637046f --- /dev/null +++ b/AUTHORS.md @@ -0,0 +1,67 @@ +The main authors of the Rascal project are: +* Jurgen J. Vinju +* Paul Klint +* Tijs van der Storm +* Davy Landman +* Arnold Lankamp + +And this is a complete list of contributors ordered by the amount of commits: +* Anastasia Izmaylova +* Pieter Olivier +* Mark Hills +* Tijs van der Storm +* Atze van der Ploeg +* Rodin Aarssen +* Bert Lisser +* Ashim Shahi +* Michael Steindorfer +* Ali Afroozeh +* Ferry Rietveld +* Emilie Balland +* Bert Lisser +* Anya Helene Bagge +* Mauricio Verano Merino +* Jouke Stoel +* Lina Maria Ochoa Venegas +* Jasper Timmer +* Bas Basten +* Riemer van Rozen +* Sung-Shik Jongmans +* Wietse Venema +* Vadim Zaytsev +* Jeroen van den Bos +* Pieter Olivier +* Linus Wagner +* Joppe Kroon +* Pablo Inostroza Valdera +* Thomas Degueule +* Aiko Yamashita +* Toine Hartman +* Cindy Berghuizen +* Michael Godfrey +* Jeroen Peeters +* Athanasios Anastasiou +* Davy Meers +* Kevin van der Vlist +* Yoan-Alexander Grigorov +* Romain Briand +* Cleverton Hentz +* Magiel Bruntink +* Mike Bierlee +* Pieter Hijma +* Simon Baars +* Tim Soethout +* Waruzjan Shahbazian +* Yi Dai +* Arjo Bruijnes +* Auke Roorda +* Diego Marcílio +* Jimi van der Woning +* Jonathan Leitschuh +* Markus Klinik +* Mary Gouseti +* Mathijs Schuts +* Mats Stijlaart +* Nick Lodewijks +* Rodrigo Bonifácio +* Todd Hooper diff --git a/CITATION.md b/CITATION.md new file mode 100644 index 00000000000..c7b558878e6 --- /dev/null +++ b/CITATION.md @@ -0,0 +1,50 @@ + + +# General Language Reference + +You {c,sh,w}ould cite this if: + * you extended Rascal itself and publish about this + * you used Rascal as a component of your research method + * you used Rascal to implement an industrial software project and you wish to credit it + + +``` +@inproceedings{RascalGTTSE, + title = {EASY Meta-Programming with Rascal. Leveraging the Extract-Analyze-SYnthesize Paradigm for Meta-Programming}, + author = {Paul Klint and Tijs van der Storm and Jurgen J. Vinju}, + year = {2010}, + booktitle = {Proceedings of the 3rd International Summer School on Generative and Transformational Techniques in Software Engineering (GTTSE'09)}, + location = {Braga, Portugal}, + series = {LNCS}, + publisher = {Springer}, +} +``` + +# Software Analysis and Transformation (Refactoring) + +You {c,sh,w}ould cite this if: + * you are working on related work want to position w.r.t. Rascal's features + * you used Rascal as a component of your own tool + +``` +@inproceedings{rascal, + Author = {Paul Klint and Tijs van der Storm and Jurgen J. Vinju}, + Title = {RASCAL: A Domain Specific Language for Source Code Analysis and Manipulation}, + Booktitle = {Ninth IEEE International Working Conference on Source Code Analysis and Manipulation (SCAM)}, + Doi = {http://doi.ieeecomputersociety.org/10.1109/SCAM.2009.28}, + Pages = {168-177}, + Publisher = {IEEE Computer Society}, + Year = {2009}, +} +``` + +# Specific Releases + +Here some citable zenodo snapshots, which you could cite instead of the above papers. The difference is you credit more the implementation of +the work than the conceptual contribution of Rascal. It's up to you. The author lists are different necessarily. So if you depend on a particular +piece of work inside Rascal authored by somebody who is not an author of the above papers, then this might have your preference. + +* https://zenodo.org/record/7595297 + + + diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 00000000000..7f265584171 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1 @@ +/.github/ @DavyLandman diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000000..8650a62895b --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,46 @@ + +Please refer to http://usethesource.io/about/values.html for the origin of this text. This text +includes our Code of Conduct, which offers our basic social values, but first it lists a number of community values specific to meta programming and open-source software development. + +## Main Principles + +These are principles that we strive to uphold in the UseTheSource community. + +* Metaprogramming, software language engineering and generic programming are cool +* "real world" application (not just toy languages and toy examples) +* Striving for good design + * design code for readability: clear and simple code + * design for all programmers/users: clear and simple languages, API and UX + * avoid over-design, gold-plating and premature optimization +* Proper attribution + * open copyright licenses + * clear authorship/ownership trace + * clear funding/sponsorship trace + * due diligence with reuse of open-source +* Excellence + * generic & simple + * efficient & scalable + * accurate & correct + * continuously tested & delivered +* Social + * patience with both users and contributors + * open to feedback + * responsive + * visibly active + +## Contributor Code of Conduct + +As Contributors of the UseTheSource community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. + +We are committed to making participation in this community a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion. + +Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct. + +[Project Owners](http://www.usethesource.io/about/processes.html) have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Contributors who do not follow the Code of Conduct may be removed from the project team. + +This code of conduct applies both within project spaces and in public spaces when an individual is representing the UseTheSource community or one of its projects. + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by [opening an issue](https://github.com/usethesource/usethesource.github.io/issues) or contacting one or more of the [Project Owners](http://www.usethesource.io/projects/). + +This Code of Conduct is adapted from the Contributor Covenant, version 1.1.0, available from + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000000..4d1e158d384 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,38 @@ +Thanks for your interest in the Rascal MPL project! + +Rascal is a (meta) programming language with the following features: + +1. type-checker, +2. interpreter that type-checks, +3. compiler +4. standard library +4. parser generator +4. top-down context-free general parsing algorithm +4. hash-trie based implementation of relational calculus (via [capsule](https://github.com/usethesource/capsule)) +4. immutable values (sets, lists, numbers, maps, algebraic data-types), via [vallang](https://github.com/usethesource/vallang) +5. REPL +6. Eclipse IDE with IDE generator based on Eclipse IMP (see https://github.com/usethesource/rascal-eclipse) +7. VScode IDE with IDE generator based on LSP (see https://github.com/cwi-swat/rascal-vscode) +8. Interactive documentation (tutor) compiler +8. Interactive documentation content +8. Libraries for + * Java analysis + * C++ analysis + * PHP analysis + * Python analysis + * Javascript analysis + * HTML5-based UI implementations (salix library) + * Git analysis + * etc. + + +Contributing to libraries or the standard library is preferred over contributions to the core implementation features since +features in the core are tangled and therefore complex. We do have a lot of tests, so if you plan to contribute a bug-fix or +a new feature don't forget to run `mvn test`. If you are a parser, type-checking, or functional programming/term-rewriting expert, +please do not hesitate to give us feedback or suggestions, we love those topics and it's always good to talk to a fellow +enthusiast and learn something new. + +If you'd like to contribute a new library or library function do not hesitate to contact us: open an enhancement or bug issue +[here](https://github.com/usethesource/rascal/issues) and we can start discussing the ins and outs of your idea! Also +we'd be able to help out; you don't have to do it all alone. + diff --git a/FUNDING b/FUNDING new file mode 100644 index 00000000000..81220d2268d --- /dev/null +++ b/FUNDING @@ -0,0 +1,17 @@ +### Current funding + +* Centrum Wiskunde & Informatica, SWAT group (2009-...) +* Swat.engineering BV (2017..) +* GitHub donations (including anonymous donors) + +### Past funding + +* Universiteit van Amsterdam, Vrije Universiteit en Hogeschool van Amsterdam "Master Software Engineering", for courses in Sofware Construction and Software Evolution (2009-2013) +* EU FP7 OSSMETER Project Number **318736** (2012-2015) +* EU H2020 CROSSMINER Project Number **REP-732223-2** (2016-2019) +* NWO Big Software "MERITS" **NWO.628.008.002** (2016-2020) +* NWO TOPGO "Domain-Specific Languages: A Big Future for Small Programs" **NWO.612.001.011** (2011-2016) +* OU (Open Universiteit) support for courses in Software Quality Assurance (2012-2017) +* SIA RAAK-PRO "EQuA: Early Quality Assurance for Software Production" (2011-2015) +* SIA RAAK-MKB "Automated Game Design" (2014-2016) +* SIA RAAK-MKB "Live Game Design" (2016-2019) diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000000..411ebf6a590 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +This whole project is released under the BSD-2 simplified clause, with the noted exception that a number of older files still have an Eclipse license. + +----BSD license---- +Copyright (c) 2022, NWO-I Centrum Wiskunde & Informatica (CWI) +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +----Eclipse v1 license---- + +Copyright (c) 2012-2022 CWI +All rights reserved. This program and the accompanying materials +are made available under the terms of the Eclipse Public License v1.0 +which accompanies this distribution, and is available at +http://www.eclipse.org/legal/epl-v10.html diff --git a/META-INF/RASCAL.MF b/META-INF/RASCAL.MF new file mode 100644 index 00000000000..875f75774d6 --- /dev/null +++ b/META-INF/RASCAL.MF @@ -0,0 +1,2 @@ +Project-Name: rascal +Source: src/org/rascalmpl/library,src/org/rascalmpl/compiler,src/org/rascalmpl/library,src/org/rascalmpl/tutor,test/org/rascalmpl/benchmark,test/org/rascalmpl/test/data diff --git a/README.md b/README.md new file mode 100644 index 00000000000..928d471d171 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# Rascal - Metaprogramming Language +[![Build and Deploy](https://github.com/usethesource/rascal/actions/workflows/build.yaml/badge.svg)](https://github.com/usethesource/rascal/actions/workflows/build.yaml) + +This is the core implementation of the Rascal meta-programming language. It contains the interpreter, the parser generator, the parser run-time, +the (documented) standard library, the type checker, the compiler, and the documentation compiler ("tutor"). + +Other relevant repositories: + +* https://github.com/usethesource/rascal-language-servers - for the Rascal's IDE features +* https://github.com/usethesource/rascal-maven-plugin - for Rascal via Maven commands +* https://github.com/usethesource/rascal-website - for the online documentation +* https://github.com/usethesource/vallang - for the core of the Rascal runtime values, types and IO. + +Please visit http://www.rascal-mpl.org for all information regarding Rascal. + +For questions use the [rascal tag on StackOverflow](http://stackoverflow.com/questions/tagged/rascal). diff --git a/pom.xml b/pom.xml new file mode 100644 index 00000000000..168af40e93f --- /dev/null +++ b/pom.xml @@ -0,0 +1,665 @@ + + 4.0.0 + + org.rascalmpl + rascal + 0.42.3-SNAPSHOT + jar + + + scm:git:ssh://git@github.com/usethesource/rascal.git + v0.42.0-RC1-BOOT + + + + + + usethesource + https://releases.usethesource.io/maven/ + + + + + usethesource + https://releases.usethesource.io/maven/ + + + + + + UTF-8 + 3.9.12 + org.rascalmpl.shell.RascalShell + 3 + 11 + 0.30.7 + 3.29.0 + + + + + BSD-2-Clause + https://opensource.org/license/BSD-2-Clause + repo + + Note, some older files are still licensed under Eclipse v1 + + + + + + src + + + src + + **/*.java + **/*.class + + + + . + false + + META-INF/RASCAL.MF + rascal-DEPENDENCIES.txt + + + + ${project.build.directory}/generated-resources + + + test + + + test + + **/*.java + **/*.class + + + + test/org/rascalmpl/test/data/ + + + src/org/rascalmpl/library/ + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.1 + + + attach-sources + + jar + + + + + + org.codehaus.mojo + buildnumber-maven-plugin + 3.2.1 + + + validate + + create + + + + + + org.apache.maven.plugins + maven-resources-plugin + 3.3.1 + + + org.apache.maven.plugins + maven-compiler-plugin + 3.13.0 + + -parameters + + + + org.rascalmpl + rascal-maven-plugin + ${rascal-maven.version} + + 0.42.0 + true + +
${project.basedir}/src/org/rascalmpl/library/Prelude.rsc
+
+
+ + + default-compile + compile + + compile + + + true + +
${project.basedir}/src/org/rascalmpl/library/Prelude.rsc
+
+ false + ${project.build.outputDirectory} + + ${project.basedir}/src/org/rascalmpl/library + + + + + ${project.basedir}/src/org/rascalmpl/library/experiments + ${project.basedir}/src/org/rascalmpl/library/resource + ${project.basedir}/src/org/rascalmpl/library/lang/rascal/tests + ${project.basedir}/src/org/rascalmpl/library/lang/rascal/grammar/tests + ${project.basedir}/src/org/rascalmpl/library/lang/rascal/syntax/tests + +
+
+ + default-resources + compile + + tutor + + + false + false + ${project.build.outputDirectory} + ${project.basedir}/FUNDING + ${project.basedir}/CITATION.md + ${project.basedir}/LICENSE + ${project.basedir}/AUTHORS.md + |http://github.com/usethesource/rascal/blob/main| + |http://github.com/usethesource/rascal/issues| + ${project.version} + + ${project.basedir}/src/org/rascalmpl/library + + + ${project.basedir}/src/org/rascalmpl/library/lang/rascal + ${project.basedir}/src/org/rascalmpl/library/experiments + ${project.basedir}/src/org/rascalmpl/library/lang/rascal/tests + ${project.basedir}/src/org/rascalmpl/library/lang/rascal/grammar/tests + ${project.basedir}/src/org/rascalmpl/library/lang/rascal/syntax/tests + + + + + default-package + prepare-package + + package + + + + ${project.basedir}/src/org/rascalmpl/library + + |std:///| + + +
+
+ + maven-clean-plugin + 3.4.0 + + + + ${project.basedir}/bin + + **/*.* + + false + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.5.2 + + + default-test + test + + test + + + + + + -ea + -Xmx${rascal.test.memory}G + -Dfile.encoding=UTF-8 + ${argLine} + + + **/org/rascalmpl/test/AllSuiteParallel.java + **/org/rascalmpl/test/library/LibraryLangPaths.java + **/org/rascalmpl/test/value/AllTests.java + **/org/rascalmpl/test/repl/*Test.java + **/org/rascalmpl/test/rpc/*Tests.java + **/org/rascalmpl/util/**/*Test.java + **/org/rascalmpl/util/**/*Tests.java + **/org/rascalmpl/uri/**/*Test.java + **/org/rascalmpl/*Test.java + + + + + org.jacoco + jacoco-maven-plugin + 0.8.12 + + + + prepare-agent + + + + report + test + + report + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.8.1 + + + + tree + + package + + rascal-DEPENDENCIES.txt + + + + + + org.apache.maven.plugins + maven-release-plugin + 3.1.1 + + v@{project.version} + -Drascal.compile.skip -Drascal.tutor.skip -DskipTests + + + + org.codehaus.mojo + license-maven-plugin + 2.5.0 + + + download-licenses + + download-licenses + + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.6.0 + + + org.apache.logging.log4j + log4j-transform-maven-shade-plugin-extensions + 0.2.0 + + + + + package + + shade + + + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + plugin.xml + + + + org.rascalmpl:typepal + + META-INF/* + examples/** + src/examples/** + src/analysis/typepal/** + docs/Packages/Typepal/** + docs/** + rascal/analysis/typepal/** + **/*.tpl + + + + + + analysis/typepal + org/rascalmpl/typepal/analysis/typepal + + + + + + + + rascal + true + org.rascalmpl.shell.RascalShell + ${project.version} + http://www.usethesource.io + + + + org/rascalmpl/uri/resolvers.config + + + io/usethesource/vallang/type/types.config + + + META-INF/sisu/javax.inject.Named + + + + + false + + + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-maven + + enforce + + + + + (3.8,) + + + + + + +
+ + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + + org.codehaus.mojo + + + exec-maven-plugin + + + [1.4.0,) + + + exec + + + + + + + + + + + + +
+ + + + + org.rascalmpl + typepal + 0.16.7 + + compile + + + + + junit + junit + 4.13.2 + + + io.usethesource + vallang + 1.0.1-RC1 + + + org.apache.commons + commons-math + 2.2 + + + org.apache.commons + commons-compress + 1.28.0 + + + com.github.luben + zstd-jni + 1.5.7-6 + + + org.tukaani + xz + 1.11 + + + commons-codec + commons-codec + 1.20.0 + + + com.google.code.gson + gson + 2.13.2 + + + org.jline + jline-reader + ${jline.version} + + + org.jline + jline-terminal + ${jline.version} + + + org.jline + jline-terminal-jni + ${jline.version} + + + org.jline + jline-style + ${jline.version} + + + org.jline + jline-console + ${jline.version} + + + org.jline + jansi-core + ${jline.version} + + + org.yaml + snakeyaml + 2.5 + + + org.jsoup + jsoup + 1.21.2 + + + org.jdom + jdom2 + 2.0.6.1 + + + org.nanohttpd + nanohttpd + 2.3.1 + + + com.ibm.icu + icu4j + 78.1 + + + org.apache.maven + maven-model + ${maven-version} + + + org.apache.maven + maven-model-builder + ${maven-version} + + + org.eclipse.sisu + org.eclipse.sisu.inject + + + + + org.apache.maven + maven-repository-metadata + ${maven-version} + + + org.apache.maven + maven-settings + ${maven-version} + + + engineering.swat + java-watch + 0.9.6 + + + org.eclipse.lsp4j + org.eclipse.lsp4j.debug + 0.24.0 + + + + + + compiler-tests + + + + org.apache.maven.plugins + maven-surefire-plugin + + default-testnone + + test-compiler-tests + test + + test + + + + + + -Xmx${rascal.test.memory}G + -Dfile.encoding=UTF-8 + + + + **/org/rascalmpl/compiler/**/*Tests.java + **/org/rascalmpl/compiler/**/*Test.java + + + + + + + +
diff --git a/src/io/usethesource/vallang/type/types.config b/src/io/usethesource/vallang/type/types.config new file mode 100644 index 00000000000..456d7c9b25e --- /dev/null +++ b/src/io/usethesource/vallang/type/types.config @@ -0,0 +1,2 @@ +org.rascalmpl.types.NonTerminalType$Reifier +org.rascalmpl.types.ReifiedType$Reifier diff --git a/src/org/rascalmpl/ast/AbstractAST.java b/src/org/rascalmpl/ast/AbstractAST.java new file mode 100644 index 00000000000..b5955ecf515 --- /dev/null +++ b/src/org/rascalmpl/ast/AbstractAST.java @@ -0,0 +1,235 @@ +/******************************************************************************* + * Copyright (c) 2009-2013 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI +*******************************************************************************/ +package org.rascalmpl.ast; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.stream.Collectors; + +import org.rascalmpl.exceptions.ImplementationError; +import org.rascalmpl.exceptions.Throw; +import org.rascalmpl.interpreter.AssignableEvaluator; +import org.rascalmpl.interpreter.IEvaluator; +import org.rascalmpl.interpreter.IEvaluatorContext; +import org.rascalmpl.interpreter.asserts.NotYetImplemented; +import org.rascalmpl.interpreter.env.Environment; +import org.rascalmpl.interpreter.matching.IBooleanResult; +import org.rascalmpl.interpreter.matching.IMatchingResult; +import org.rascalmpl.interpreter.result.Result; +import org.rascalmpl.interpreter.result.ResultFactory; +import org.rascalmpl.interpreter.staticErrors.UnsupportedPattern; +import org.rascalmpl.types.RascalTypeFactory; +import org.rascalmpl.values.IRascalValueFactory; + +import io.usethesource.vallang.IBool; +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; +import io.usethesource.vallang.IValue; +import io.usethesource.vallang.type.Type; +import io.usethesource.vallang.type.TypeFactory; + +public abstract class AbstractAST implements IVisitable, Cloneable { + protected static final TypeFactory TF = TypeFactory.getInstance(); + protected static final RascalTypeFactory RTF = RascalTypeFactory.getInstance(); + protected static final IRascalValueFactory VF = IRascalValueFactory.getInstance(); + protected ISourceLocation src; + + AbstractAST(ISourceLocation src) { + this.src = src; + } + + /** + * @return a non-terminal type for ASTs which represent concrete syntax patterns or null otherwise + */ + public Type getConcreteSyntaxType() { + return null; + } + + @Override + public abstract Object clone(); + + @SuppressWarnings("unchecked") + /** + * Used in generated clone methods to avoid case distinctions in the code generator + */ + protected T clone(T in) { + if (in == null) { + return null; + } + return (T) in.clone(); + } + + @SuppressWarnings("unchecked") + /** + * Used in generated clone methods to avoid regenerating the same code; + */ + public java.util.List clone(java.util.List in) { + java.util.List tmp = new ArrayList(in.size()); + for (T elem : in) { + tmp.add((T) elem.clone()); + } + return tmp; + } + + /** + * Used in clone and AST Builder + */ + @SuppressWarnings("unchecked") + public static T newInstance(java.lang.Class clazz, Object... args) { + try { + Constructor cons = clazz.getConstructors()[0]; + cons.setAccessible(true); + return (T) cons.newInstance(args); + } + catch (ClassCastException | ArrayIndexOutOfBoundsException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + throw new ImplementationError("Can not instantiate AST object for " + clazz.getName(), e); + } + } + + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset + && offset < src.getOffset() + src.getLength()) { + return this; + } + + return null; + } + + public static Result makeResult(Type declaredType, IValue value, IEvaluatorContext ctx) { + return ResultFactory.makeResult(declaredType, value, ctx); + } + + public static Result nothing() { + return org.rascalmpl.interpreter.result.ResultFactory.nothing(); + } + + public T accept(IASTVisitor v) { + return null; + } + + public ISourceLocation getLocation() { + return src; + } + + @Override + public boolean equals(Object obj) { + throw new ImplementationError("Missing generated hashCode/equals methods"); + } + + @Deprecated + public IConstructor getTree() { + throw new NotYetImplemented(this); + } + + @Override + public int hashCode() { + throw new ImplementationError("Missing generated concrete hashCode/equals methods"); + } + + @Override + @Deprecated + /** + * @deprecated YOU SHOULD NOT USE THIS METHOD for user information. Use {@link Names}. + */ + public String toString() { + return "AST debug info: " + getClass().getName() + " at " + src; + } + + public Result interpret(IEvaluator> eval) { + throw new NotYetImplemented(this); + } + + public Result assignment(AssignableEvaluator eval) { + throw new NotYetImplemented(this); + } + + /** + * Computes internal type representations for type literals and patterns. + * @param instantiateTypeParameters TODO + */ + public Type typeOf(Environment env, IEvaluator> eval, boolean instantiateTypeParameters) { + throw new NotYetImplemented(this); + } + + public Type __evaluate(org.rascalmpl.interpreter.BasicTypeEvaluator eval) { + throw new NotYetImplemented(this); + } + + /** + * Recursively build a matching data-structure, use getMatcher if you are just a client of IMatchingResult. + * @param bindTypeParameters TODO + */ + public IMatchingResult buildMatcher(IEvaluatorContext eval, boolean bindTypeParameters) { + throw new UnsupportedPattern(toString(), this); + } + + public IMatchingResult getMatcher(IEvaluatorContext eval, boolean bindTypeParameters) { + return buildMatcher(eval, bindTypeParameters); + } + + protected void addForLineNumber(int line, java.util.List result) { + return; + } + + public List breakpoints(int line) { + List candidates = new LinkedList<>(); + addForLineNumber(line, candidates); + return candidates.stream().filter(p -> p.isBreakable()).collect(Collectors.toList()); + } + + /** + * Recursively build a back-tracking data-structure, use getBacktracker if you are just a client of IBooleanResult + */ + public IBooleanResult buildBacktracker(IEvaluatorContext eval) { + throw new NotYetImplemented(this); + } + + public IBooleanResult getBacktracker(IEvaluatorContext ctx) { + return buildBacktracker(ctx); + } + + /** + * If the debugger can suspend (i.e. break) before interpretation. + * @return true if suspension is supported, otherwise false + */ + public boolean isBreakable() { + return false; + } + + /** + * The debugger uses this to decide where to continue when you do "step-over". + * By default this is beyond the current statement, but for block statements + * we really want to go into the block (for example). + */ + public ISourceLocation getDebugStepScope() { + return getLocation(); + } + + public Result isDefined(IEvaluator> __eval) { + __eval.warning("INTERNAL WARNING: generic implementation of isDefined triggered", getLocation()); + try { + interpret(__eval); + return ResultFactory.makeResult(TF.boolType(), VF.bool(true), __eval); + } + catch (Throw e) { + return ResultFactory.makeResult(TF.boolType(), VF.bool(false), __eval); + } + } +} diff --git a/src/org/rascalmpl/ast/Assignable.java b/src/org/rascalmpl/ast/Assignable.java new file mode 100644 index 00000000000..4920dfa5ce3 --- /dev/null +++ b/src/org/rascalmpl/ast/Assignable.java @@ -0,0 +1,1058 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Assignable extends AbstractAST { + public Assignable(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasArguments() { + return false; + } + + public java.util.List getArguments() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasElements() { + return false; + } + + public java.util.List getElements() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasArg() { + return false; + } + + public org.rascalmpl.ast.Assignable getArg() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasReceiver() { + return false; + } + + public org.rascalmpl.ast.Assignable getReceiver() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasDefaultExpression() { + return false; + } + + public org.rascalmpl.ast.Expression getDefaultExpression() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasSecond() { + return false; + } + + public org.rascalmpl.ast.Expression getSecond() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasSubscript() { + return false; + } + + public org.rascalmpl.ast.Expression getSubscript() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasAnnotation() { + return false; + } + + public org.rascalmpl.ast.Name getAnnotation() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasField() { + return false; + } + + public org.rascalmpl.ast.Name getField() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasName() { + return false; + } + + public org.rascalmpl.ast.Name getName() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasOptFirst() { + return false; + } + + public org.rascalmpl.ast.OptionalExpression getOptFirst() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasOptLast() { + return false; + } + + public org.rascalmpl.ast.OptionalExpression getOptLast() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasQualifiedName() { + return false; + } + + public org.rascalmpl.ast.QualifiedName getQualifiedName() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isAnnotation() { + return false; + } + + static public class Annotation extends Assignable { + // Production: sig("Annotation",[arg("org.rascalmpl.ast.Assignable","receiver"),arg("org.rascalmpl.ast.Name","annotation")],breakable=false) + + + private final org.rascalmpl.ast.Assignable receiver; + private final org.rascalmpl.ast.Name annotation; + + public Annotation(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Assignable receiver, org.rascalmpl.ast.Name annotation) { + super(src, node); + + this.receiver = receiver; + this.annotation = annotation; + } + + @Override + public boolean isAnnotation() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitAssignableAnnotation(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = receiver.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + receiver.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = annotation.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + annotation.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Annotation)) { + return false; + } + Annotation tmp = (Annotation) o; + return true && tmp.receiver.equals(this.receiver) && tmp.annotation.equals(this.annotation) ; + } + + @Override + public int hashCode() { + return 233 + 383 * receiver.hashCode() + 227 * annotation.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Assignable getReceiver() { + return this.receiver; + } + + @Override + public boolean hasReceiver() { + return true; + } + @Override + public org.rascalmpl.ast.Name getAnnotation() { + return this.annotation; + } + + @Override + public boolean hasAnnotation() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(receiver), clone(annotation)); + } + + } + public boolean isBracket() { + return false; + } + + static public class Bracket extends Assignable { + // Production: sig("Bracket",[arg("org.rascalmpl.ast.Assignable","arg")],breakable=false) + + + private final org.rascalmpl.ast.Assignable arg; + + public Bracket(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Assignable arg) { + super(src, node); + + this.arg = arg; + } + + @Override + public boolean isBracket() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitAssignableBracket(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = arg.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + arg.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Bracket)) { + return false; + } + Bracket tmp = (Bracket) o; + return true && tmp.arg.equals(this.arg) ; + } + + @Override + public int hashCode() { + return 977 + 797 * arg.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Assignable getArg() { + return this.arg; + } + + @Override + public boolean hasArg() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(arg)); + } + + } + public boolean isConstructor() { + return false; + } + + static public class Constructor extends Assignable { + // Production: sig("Constructor",[arg("org.rascalmpl.ast.Name","name"),arg("java.util.List\","arguments")],breakable=false) + + + private final org.rascalmpl.ast.Name name; + private final java.util.List arguments; + + public Constructor(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Name name, java.util.List arguments) { + super(src, node); + + this.name = name; + this.arguments = arguments; + } + + @Override + public boolean isConstructor() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitAssignableConstructor(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : arguments) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Constructor)) { + return false; + } + Constructor tmp = (Constructor) o; + return true && tmp.name.equals(this.name) && tmp.arguments.equals(this.arguments) ; + } + + @Override + public int hashCode() { + return 601 + 619 * name.hashCode() + 167 * arguments.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Name getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + @Override + public java.util.List getArguments() { + return this.arguments; + } + + @Override + public boolean hasArguments() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(name), clone(arguments)); + } + + } + public boolean isFieldAccess() { + return false; + } + + static public class FieldAccess extends Assignable { + // Production: sig("FieldAccess",[arg("org.rascalmpl.ast.Assignable","receiver"),arg("org.rascalmpl.ast.Name","field")],breakable=false) + + + private final org.rascalmpl.ast.Assignable receiver; + private final org.rascalmpl.ast.Name field; + + public FieldAccess(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Assignable receiver, org.rascalmpl.ast.Name field) { + super(src, node); + + this.receiver = receiver; + this.field = field; + } + + @Override + public boolean isFieldAccess() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitAssignableFieldAccess(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = receiver.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + receiver.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = field.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + field.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof FieldAccess)) { + return false; + } + FieldAccess tmp = (FieldAccess) o; + return true && tmp.receiver.equals(this.receiver) && tmp.field.equals(this.field) ; + } + + @Override + public int hashCode() { + return 263 + 557 * receiver.hashCode() + 167 * field.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Assignable getReceiver() { + return this.receiver; + } + + @Override + public boolean hasReceiver() { + return true; + } + @Override + public org.rascalmpl.ast.Name getField() { + return this.field; + } + + @Override + public boolean hasField() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(receiver), clone(field)); + } + + } + public boolean isIfDefinedOrDefault() { + return false; + } + + static public class IfDefinedOrDefault extends Assignable { + // Production: sig("IfDefinedOrDefault",[arg("org.rascalmpl.ast.Assignable","receiver"),arg("org.rascalmpl.ast.Expression","defaultExpression")],breakable=false) + + + private final org.rascalmpl.ast.Assignable receiver; + private final org.rascalmpl.ast.Expression defaultExpression; + + public IfDefinedOrDefault(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Assignable receiver, org.rascalmpl.ast.Expression defaultExpression) { + super(src, node); + + this.receiver = receiver; + this.defaultExpression = defaultExpression; + } + + @Override + public boolean isIfDefinedOrDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitAssignableIfDefinedOrDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = receiver.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + receiver.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = defaultExpression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + defaultExpression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof IfDefinedOrDefault)) { + return false; + } + IfDefinedOrDefault tmp = (IfDefinedOrDefault) o; + return true && tmp.receiver.equals(this.receiver) && tmp.defaultExpression.equals(this.defaultExpression) ; + } + + @Override + public int hashCode() { + return 937 + 439 * receiver.hashCode() + 439 * defaultExpression.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Assignable getReceiver() { + return this.receiver; + } + + @Override + public boolean hasReceiver() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getDefaultExpression() { + return this.defaultExpression; + } + + @Override + public boolean hasDefaultExpression() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(receiver), clone(defaultExpression)); + } + + } + public boolean isSlice() { + return false; + } + + static public class Slice extends Assignable { + // Production: sig("Slice",[arg("org.rascalmpl.ast.Assignable","receiver"),arg("org.rascalmpl.ast.OptionalExpression","optFirst"),arg("org.rascalmpl.ast.OptionalExpression","optLast")],breakable=false) + + + private final org.rascalmpl.ast.Assignable receiver; + private final org.rascalmpl.ast.OptionalExpression optFirst; + private final org.rascalmpl.ast.OptionalExpression optLast; + + public Slice(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Assignable receiver, org.rascalmpl.ast.OptionalExpression optFirst, org.rascalmpl.ast.OptionalExpression optLast) { + super(src, node); + + this.receiver = receiver; + this.optFirst = optFirst; + this.optLast = optLast; + } + + @Override + public boolean isSlice() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitAssignableSlice(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = receiver.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + receiver.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = optFirst.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + optFirst.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = optLast.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + optLast.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Slice)) { + return false; + } + Slice tmp = (Slice) o; + return true && tmp.receiver.equals(this.receiver) && tmp.optFirst.equals(this.optFirst) && tmp.optLast.equals(this.optLast) ; + } + + @Override + public int hashCode() { + return 487 + 419 * receiver.hashCode() + 2 * optFirst.hashCode() + 797 * optLast.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Assignable getReceiver() { + return this.receiver; + } + + @Override + public boolean hasReceiver() { + return true; + } + @Override + public org.rascalmpl.ast.OptionalExpression getOptFirst() { + return this.optFirst; + } + + @Override + public boolean hasOptFirst() { + return true; + } + @Override + public org.rascalmpl.ast.OptionalExpression getOptLast() { + return this.optLast; + } + + @Override + public boolean hasOptLast() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(receiver), clone(optFirst), clone(optLast)); + } + + } + public boolean isSliceStep() { + return false; + } + + static public class SliceStep extends Assignable { + // Production: sig("SliceStep",[arg("org.rascalmpl.ast.Assignable","receiver"),arg("org.rascalmpl.ast.OptionalExpression","optFirst"),arg("org.rascalmpl.ast.Expression","second"),arg("org.rascalmpl.ast.OptionalExpression","optLast")],breakable=false) + + + private final org.rascalmpl.ast.Assignable receiver; + private final org.rascalmpl.ast.OptionalExpression optFirst; + private final org.rascalmpl.ast.Expression second; + private final org.rascalmpl.ast.OptionalExpression optLast; + + public SliceStep(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Assignable receiver, org.rascalmpl.ast.OptionalExpression optFirst, org.rascalmpl.ast.Expression second, org.rascalmpl.ast.OptionalExpression optLast) { + super(src, node); + + this.receiver = receiver; + this.optFirst = optFirst; + this.second = second; + this.optLast = optLast; + } + + @Override + public boolean isSliceStep() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitAssignableSliceStep(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = receiver.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + receiver.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = optFirst.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + optFirst.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = second.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + second.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = optLast.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + optLast.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof SliceStep)) { + return false; + } + SliceStep tmp = (SliceStep) o; + return true && tmp.receiver.equals(this.receiver) && tmp.optFirst.equals(this.optFirst) && tmp.second.equals(this.second) && tmp.optLast.equals(this.optLast) ; + } + + @Override + public int hashCode() { + return 19 + 317 * receiver.hashCode() + 883 * optFirst.hashCode() + 719 * second.hashCode() + 233 * optLast.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Assignable getReceiver() { + return this.receiver; + } + + @Override + public boolean hasReceiver() { + return true; + } + @Override + public org.rascalmpl.ast.OptionalExpression getOptFirst() { + return this.optFirst; + } + + @Override + public boolean hasOptFirst() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getSecond() { + return this.second; + } + + @Override + public boolean hasSecond() { + return true; + } + @Override + public org.rascalmpl.ast.OptionalExpression getOptLast() { + return this.optLast; + } + + @Override + public boolean hasOptLast() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(receiver), clone(optFirst), clone(second), clone(optLast)); + } + + } + public boolean isSubscript() { + return false; + } + + static public class Subscript extends Assignable { + // Production: sig("Subscript",[arg("org.rascalmpl.ast.Assignable","receiver"),arg("org.rascalmpl.ast.Expression","subscript")],breakable=false) + + + private final org.rascalmpl.ast.Assignable receiver; + private final org.rascalmpl.ast.Expression subscript; + + public Subscript(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Assignable receiver, org.rascalmpl.ast.Expression subscript) { + super(src, node); + + this.receiver = receiver; + this.subscript = subscript; + } + + @Override + public boolean isSubscript() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitAssignableSubscript(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = receiver.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + receiver.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = subscript.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + subscript.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Subscript)) { + return false; + } + Subscript tmp = (Subscript) o; + return true && tmp.receiver.equals(this.receiver) && tmp.subscript.equals(this.subscript) ; + } + + @Override + public int hashCode() { + return 29 + 151 * receiver.hashCode() + 29 * subscript.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Assignable getReceiver() { + return this.receiver; + } + + @Override + public boolean hasReceiver() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getSubscript() { + return this.subscript; + } + + @Override + public boolean hasSubscript() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(receiver), clone(subscript)); + } + + } + public boolean isTuple() { + return false; + } + + static public class Tuple extends Assignable { + // Production: sig("Tuple",[arg("java.util.List\","elements")],breakable=false) + + + private final java.util.List elements; + + public Tuple(ISourceLocation src, IConstructor node , java.util.List elements) { + super(src, node); + + this.elements = elements; + } + + @Override + public boolean isTuple() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitAssignableTuple(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : elements) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Tuple)) { + return false; + } + Tuple tmp = (Tuple) o; + return true && tmp.elements.equals(this.elements) ; + } + + @Override + public int hashCode() { + return 353 + 31 * elements.hashCode() ; + } + + + @Override + public java.util.List getElements() { + return this.elements; + } + + @Override + public boolean hasElements() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(elements)); + } + + } + public boolean isVariable() { + return false; + } + + static public class Variable extends Assignable { + // Production: sig("Variable",[arg("org.rascalmpl.ast.QualifiedName","qualifiedName")],breakable=false) + + + private final org.rascalmpl.ast.QualifiedName qualifiedName; + + public Variable(ISourceLocation src, IConstructor node , org.rascalmpl.ast.QualifiedName qualifiedName) { + super(src, node); + + this.qualifiedName = qualifiedName; + } + + @Override + public boolean isVariable() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitAssignableVariable(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = qualifiedName.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + qualifiedName.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Variable)) { + return false; + } + Variable tmp = (Variable) o; + return true && tmp.qualifiedName.equals(this.qualifiedName) ; + } + + @Override + public int hashCode() { + return 337 + 257 * qualifiedName.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.QualifiedName getQualifiedName() { + return this.qualifiedName; + } + + @Override + public boolean hasQualifiedName() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(qualifiedName)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Assignment.java b/src/org/rascalmpl/ast/Assignment.java new file mode 100644 index 00000000000..7e0e90af453 --- /dev/null +++ b/src/org/rascalmpl/ast/Assignment.java @@ -0,0 +1,473 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Assignment extends AbstractAST { + public Assignment(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + + + + public boolean isAddition() { + return false; + } + + static public class Addition extends Assignment { + // Production: sig("Addition",[],breakable=false) + + + + public Addition(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isAddition() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitAssignmentAddition(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Addition)) { + return false; + } + Addition tmp = (Addition) o; + return true ; + } + + @Override + public int hashCode() { + return 431 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isAppend() { + return false; + } + + static public class Append extends Assignment { + // Production: sig("Append",[],breakable=false) + + + + public Append(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isAppend() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitAssignmentAppend(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Append)) { + return false; + } + Append tmp = (Append) o; + return true ; + } + + @Override + public int hashCode() { + return 751 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isDefault() { + return false; + } + + static public class Default extends Assignment { + // Production: sig("Default",[],breakable=false) + + + + public Default(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitAssignmentDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true ; + } + + @Override + public int hashCode() { + return 449 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isDivision() { + return false; + } + + static public class Division extends Assignment { + // Production: sig("Division",[],breakable=false) + + + + public Division(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isDivision() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitAssignmentDivision(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Division)) { + return false; + } + Division tmp = (Division) o; + return true ; + } + + @Override + public int hashCode() { + return 557 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isIfDefined() { + return false; + } + + static public class IfDefined extends Assignment { + // Production: sig("IfDefined",[],breakable=false) + + + + public IfDefined(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isIfDefined() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitAssignmentIfDefined(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof IfDefined)) { + return false; + } + IfDefined tmp = (IfDefined) o; + return true ; + } + + @Override + public int hashCode() { + return 61 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isIntersection() { + return false; + } + + static public class Intersection extends Assignment { + // Production: sig("Intersection",[],breakable=false) + + + + public Intersection(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isIntersection() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitAssignmentIntersection(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Intersection)) { + return false; + } + Intersection tmp = (Intersection) o; + return true ; + } + + @Override + public int hashCode() { + return 503 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isProduct() { + return false; + } + + static public class Product extends Assignment { + // Production: sig("Product",[],breakable=false) + + + + public Product(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isProduct() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitAssignmentProduct(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Product)) { + return false; + } + Product tmp = (Product) o; + return true ; + } + + @Override + public int hashCode() { + return 41 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isSubtraction() { + return false; + } + + static public class Subtraction extends Assignment { + // Production: sig("Subtraction",[],breakable=false) + + + + public Subtraction(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isSubtraction() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitAssignmentSubtraction(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Subtraction)) { + return false; + } + Subtraction tmp = (Subtraction) o; + return true ; + } + + @Override + public int hashCode() { + return 293 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Assoc.java b/src/org/rascalmpl/ast/Assoc.java new file mode 100644 index 00000000000..7d88c11bbdb --- /dev/null +++ b/src/org/rascalmpl/ast/Assoc.java @@ -0,0 +1,253 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Assoc extends AbstractAST { + public Assoc(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + + + + public boolean isAssociative() { + return false; + } + + static public class Associative extends Assoc { + // Production: sig("Associative",[],breakable=false) + + + + public Associative(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isAssociative() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitAssocAssociative(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Associative)) { + return false; + } + Associative tmp = (Associative) o; + return true ; + } + + @Override + public int hashCode() { + return 229 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isLeft() { + return false; + } + + static public class Left extends Assoc { + // Production: sig("Left",[],breakable=false) + + + + public Left(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isLeft() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitAssocLeft(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Left)) { + return false; + } + Left tmp = (Left) o; + return true ; + } + + @Override + public int hashCode() { + return 751 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isNonAssociative() { + return false; + } + + static public class NonAssociative extends Assoc { + // Production: sig("NonAssociative",[],breakable=false) + + + + public NonAssociative(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isNonAssociative() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitAssocNonAssociative(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof NonAssociative)) { + return false; + } + NonAssociative tmp = (NonAssociative) o; + return true ; + } + + @Override + public int hashCode() { + return 433 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isRight() { + return false; + } + + static public class Right extends Assoc { + // Production: sig("Right",[],breakable=false) + + + + public Right(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isRight() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitAssocRight(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Right)) { + return false; + } + Right tmp = (Right) o; + return true ; + } + + @Override + public int hashCode() { + return 839 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Backslash.java b/src/org/rascalmpl/ast/Backslash.java new file mode 100644 index 00000000000..7e1505d1ab5 --- /dev/null +++ b/src/org/rascalmpl/ast/Backslash.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Backslash extends AbstractAST { + public Backslash(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends Backslash { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitBackslashLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/BasicType.java b/src/org/rascalmpl/ast/BasicType.java new file mode 100644 index 00000000000..e5eca14ed6b --- /dev/null +++ b/src/org/rascalmpl/ast/BasicType.java @@ -0,0 +1,1078 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class BasicType extends AbstractAST { + public BasicType(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + + + + public boolean isBag() { + return false; + } + + static public class Bag extends BasicType { + // Production: sig("Bag",[],breakable=false) + + + + public Bag(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isBag() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitBasicTypeBag(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Bag)) { + return false; + } + Bag tmp = (Bag) o; + return true ; + } + + @Override + public int hashCode() { + return 659 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isBool() { + return false; + } + + static public class Bool extends BasicType { + // Production: sig("Bool",[],breakable=false) + + + + public Bool(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isBool() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitBasicTypeBool(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Bool)) { + return false; + } + Bool tmp = (Bool) o; + return true ; + } + + @Override + public int hashCode() { + return 229 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isDateTime() { + return false; + } + + static public class DateTime extends BasicType { + // Production: sig("DateTime",[],breakable=false) + + + + public DateTime(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isDateTime() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitBasicTypeDateTime(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof DateTime)) { + return false; + } + DateTime tmp = (DateTime) o; + return true ; + } + + @Override + public int hashCode() { + return 827 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isInt() { + return false; + } + + static public class Int extends BasicType { + // Production: sig("Int",[],breakable=false) + + + + public Int(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isInt() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitBasicTypeInt(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Int)) { + return false; + } + Int tmp = (Int) o; + return true ; + } + + @Override + public int hashCode() { + return 709 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isList() { + return false; + } + + static public class List extends BasicType { + // Production: sig("List",[],breakable=false) + + + + public List(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isList() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitBasicTypeList(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof List)) { + return false; + } + List tmp = (List) o; + return true ; + } + + @Override + public int hashCode() { + return 263 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isListRelation() { + return false; + } + + static public class ListRelation extends BasicType { + // Production: sig("ListRelation",[],breakable=false) + + + + public ListRelation(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isListRelation() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitBasicTypeListRelation(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof ListRelation)) { + return false; + } + ListRelation tmp = (ListRelation) o; + return true ; + } + + @Override + public int hashCode() { + return 89 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isLoc() { + return false; + } + + static public class Loc extends BasicType { + // Production: sig("Loc",[],breakable=false) + + + + public Loc(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isLoc() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitBasicTypeLoc(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Loc)) { + return false; + } + Loc tmp = (Loc) o; + return true ; + } + + @Override + public int hashCode() { + return 43 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isMap() { + return false; + } + + static public class Map extends BasicType { + // Production: sig("Map",[],breakable=false) + + + + public Map(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isMap() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitBasicTypeMap(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Map)) { + return false; + } + Map tmp = (Map) o; + return true ; + } + + @Override + public int hashCode() { + return 641 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isNode() { + return false; + } + + static public class Node extends BasicType { + // Production: sig("Node",[],breakable=false) + + + + public Node(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isNode() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitBasicTypeNode(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Node)) { + return false; + } + Node tmp = (Node) o; + return true ; + } + + @Override + public int hashCode() { + return 839 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isNum() { + return false; + } + + static public class Num extends BasicType { + // Production: sig("Num",[],breakable=false) + + + + public Num(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isNum() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitBasicTypeNum(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Num)) { + return false; + } + Num tmp = (Num) o; + return true ; + } + + @Override + public int hashCode() { + return 269 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isRational() { + return false; + } + + static public class Rational extends BasicType { + // Production: sig("Rational",[],breakable=false) + + + + public Rational(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isRational() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitBasicTypeRational(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Rational)) { + return false; + } + Rational tmp = (Rational) o; + return true ; + } + + @Override + public int hashCode() { + return 449 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isReal() { + return false; + } + + static public class Real extends BasicType { + // Production: sig("Real",[],breakable=false) + + + + public Real(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isReal() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitBasicTypeReal(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Real)) { + return false; + } + Real tmp = (Real) o; + return true ; + } + + @Override + public int hashCode() { + return 859 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isRelation() { + return false; + } + + static public class Relation extends BasicType { + // Production: sig("Relation",[],breakable=false) + + + + public Relation(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isRelation() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitBasicTypeRelation(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Relation)) { + return false; + } + Relation tmp = (Relation) o; + return true ; + } + + @Override + public int hashCode() { + return 727 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isSet() { + return false; + } + + static public class Set extends BasicType { + // Production: sig("Set",[],breakable=false) + + + + public Set(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isSet() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitBasicTypeSet(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Set)) { + return false; + } + Set tmp = (Set) o; + return true ; + } + + @Override + public int hashCode() { + return 907 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isString() { + return false; + } + + static public class String extends BasicType { + // Production: sig("String",[],breakable=false) + + + + public String(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isString() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitBasicTypeString(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof String)) { + return false; + } + String tmp = (String) o; + return true ; + } + + @Override + public int hashCode() { + return 229 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isTuple() { + return false; + } + + static public class Tuple extends BasicType { + // Production: sig("Tuple",[],breakable=false) + + + + public Tuple(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isTuple() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitBasicTypeTuple(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Tuple)) { + return false; + } + Tuple tmp = (Tuple) o; + return true ; + } + + @Override + public int hashCode() { + return 479 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isType() { + return false; + } + + static public class Type extends BasicType { + // Production: sig("Type",[],breakable=false) + + + + public Type(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isType() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitBasicTypeType(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Type)) { + return false; + } + Type tmp = (Type) o; + return true ; + } + + @Override + public int hashCode() { + return 821 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isValue() { + return false; + } + + static public class Value extends BasicType { + // Production: sig("Value",[],breakable=false) + + + + public Value(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isValue() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitBasicTypeValue(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Value)) { + return false; + } + Value tmp = (Value) o; + return true ; + } + + @Override + public int hashCode() { + return 7 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isVoid() { + return false; + } + + static public class Void extends BasicType { + // Production: sig("Void",[],breakable=false) + + + + public Void(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isVoid() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitBasicTypeVoid(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Void)) { + return false; + } + Void tmp = (Void) o; + return true ; + } + + @Override + public int hashCode() { + return 229 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Body.java b/src/org/rascalmpl/ast/Body.java new file mode 100644 index 00000000000..9f0e55f5621 --- /dev/null +++ b/src/org/rascalmpl/ast/Body.java @@ -0,0 +1,116 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Body extends AbstractAST { + public Body(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasToplevels() { + return false; + } + + public java.util.List getToplevels() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isToplevels() { + return false; + } + + static public class Toplevels extends Body { + // Production: sig("Toplevels",[arg("java.util.List\","toplevels")],breakable=false) + + + private final java.util.List toplevels; + + public Toplevels(ISourceLocation src, IConstructor node , java.util.List toplevels) { + super(src, node); + + this.toplevels = toplevels; + } + + @Override + public boolean isToplevels() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitBodyToplevels(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : toplevels) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Toplevels)) { + return false; + } + Toplevels tmp = (Toplevels) o; + return true && tmp.toplevels.equals(this.toplevels) ; + } + + @Override + public int hashCode() { + return 743 + 137 * toplevels.hashCode() ; + } + + + @Override + public java.util.List getToplevels() { + return this.toplevels; + } + + @Override + public boolean hasToplevels() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(toplevels)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/BooleanLiteral.java b/src/org/rascalmpl/ast/BooleanLiteral.java new file mode 100644 index 00000000000..f1528b1bc94 --- /dev/null +++ b/src/org/rascalmpl/ast/BooleanLiteral.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class BooleanLiteral extends AbstractAST { + public BooleanLiteral(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends BooleanLiteral { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitBooleanLiteralLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Bound.java b/src/org/rascalmpl/ast/Bound.java new file mode 100644 index 00000000000..35e36d89471 --- /dev/null +++ b/src/org/rascalmpl/ast/Bound.java @@ -0,0 +1,169 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Bound extends AbstractAST { + public Bound(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasExpression() { + return false; + } + + public org.rascalmpl.ast.Expression getExpression() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDefault() { + return false; + } + + static public class Default extends Bound { + // Production: sig("Default",[arg("org.rascalmpl.ast.Expression","expression")],breakable=false) + + + private final org.rascalmpl.ast.Expression expression; + + public Default(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression expression) { + super(src, node); + + this.expression = expression; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitBoundDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.expression.equals(this.expression) ; + } + + @Override + public int hashCode() { + return 673 + 761 * expression.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(expression)); + } + + } + public boolean isEmpty() { + return false; + } + + static public class Empty extends Bound { + // Production: sig("Empty",[],breakable=false) + + + + public Empty(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isEmpty() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitBoundEmpty(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Empty)) { + return false; + } + Empty tmp = (Empty) o; + return true ; + } + + @Override + public int hashCode() { + return 5 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Case.java b/src/org/rascalmpl/ast/Case.java new file mode 100644 index 00000000000..f55856dcdc2 --- /dev/null +++ b/src/org/rascalmpl/ast/Case.java @@ -0,0 +1,195 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Case extends AbstractAST { + public Case(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasPatternWithAction() { + return false; + } + + public org.rascalmpl.ast.PatternWithAction getPatternWithAction() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasStatement() { + return false; + } + + public org.rascalmpl.ast.Statement getStatement() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDefault() { + return false; + } + + static public class Default extends Case { + // Production: sig("Default",[arg("org.rascalmpl.ast.Statement","statement")],breakable=false) + + + private final org.rascalmpl.ast.Statement statement; + + public Default(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Statement statement) { + super(src, node); + + this.statement = statement; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitCaseDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = statement.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + statement.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.statement.equals(this.statement) ; + } + + @Override + public int hashCode() { + return 307 + 881 * statement.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Statement getStatement() { + return this.statement; + } + + @Override + public boolean hasStatement() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(statement)); + } + + } + public boolean isPatternWithAction() { + return false; + } + + static public class PatternWithAction extends Case { + // Production: sig("PatternWithAction",[arg("org.rascalmpl.ast.PatternWithAction","patternWithAction")],breakable=false) + + + private final org.rascalmpl.ast.PatternWithAction patternWithAction; + + public PatternWithAction(ISourceLocation src, IConstructor node , org.rascalmpl.ast.PatternWithAction patternWithAction) { + super(src, node); + + this.patternWithAction = patternWithAction; + } + + @Override + public boolean isPatternWithAction() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitCasePatternWithAction(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = patternWithAction.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + patternWithAction.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof PatternWithAction)) { + return false; + } + PatternWithAction tmp = (PatternWithAction) o; + return true && tmp.patternWithAction.equals(this.patternWithAction) ; + } + + @Override + public int hashCode() { + return 613 + 383 * patternWithAction.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.PatternWithAction getPatternWithAction() { + return this.patternWithAction; + } + + @Override + public boolean hasPatternWithAction() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(patternWithAction)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/CaseInsensitiveStringConstant.java b/src/org/rascalmpl/ast/CaseInsensitiveStringConstant.java new file mode 100644 index 00000000000..8006993d3f9 --- /dev/null +++ b/src/org/rascalmpl/ast/CaseInsensitiveStringConstant.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class CaseInsensitiveStringConstant extends AbstractAST { + public CaseInsensitiveStringConstant(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends CaseInsensitiveStringConstant { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitCaseInsensitiveStringConstantLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Catch.java b/src/org/rascalmpl/ast/Catch.java new file mode 100644 index 00000000000..e836b1c7c82 --- /dev/null +++ b/src/org/rascalmpl/ast/Catch.java @@ -0,0 +1,214 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Catch extends AbstractAST { + public Catch(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasPattern() { + return false; + } + + public org.rascalmpl.ast.Expression getPattern() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasBody() { + return false; + } + + public org.rascalmpl.ast.Statement getBody() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isBinding() { + return false; + } + + static public class Binding extends Catch { + // Production: sig("Binding",[arg("org.rascalmpl.ast.Expression","pattern"),arg("org.rascalmpl.ast.Statement","body")],breakable=false) + + + private final org.rascalmpl.ast.Expression pattern; + private final org.rascalmpl.ast.Statement body; + + public Binding(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression pattern, org.rascalmpl.ast.Statement body) { + super(src, node); + + this.pattern = pattern; + this.body = body; + } + + @Override + public boolean isBinding() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitCatchBinding(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = pattern.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + pattern.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = body.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + body.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Binding)) { + return false; + } + Binding tmp = (Binding) o; + return true && tmp.pattern.equals(this.pattern) && tmp.body.equals(this.body) ; + } + + @Override + public int hashCode() { + return 499 + 113 * pattern.hashCode() + 601 * body.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getPattern() { + return this.pattern; + } + + @Override + public boolean hasPattern() { + return true; + } + @Override + public org.rascalmpl.ast.Statement getBody() { + return this.body; + } + + @Override + public boolean hasBody() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(pattern), clone(body)); + } + + } + public boolean isDefault() { + return false; + } + + static public class Default extends Catch { + // Production: sig("Default",[arg("org.rascalmpl.ast.Statement","body")],breakable=false) + + + private final org.rascalmpl.ast.Statement body; + + public Default(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Statement body) { + super(src, node); + + this.body = body; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitCatchDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = body.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + body.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.body.equals(this.body) ; + } + + @Override + public int hashCode() { + return 757 + 443 * body.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Statement getBody() { + return this.body; + } + + @Override + public boolean hasBody() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(body)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Char.java b/src/org/rascalmpl/ast/Char.java new file mode 100644 index 00000000000..c89bfe3c285 --- /dev/null +++ b/src/org/rascalmpl/ast/Char.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Char extends AbstractAST { + public Char(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends Char { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitCharLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Class.java b/src/org/rascalmpl/ast/Class.java new file mode 100644 index 00000000000..d55800fdc4d --- /dev/null +++ b/src/org/rascalmpl/ast/Class.java @@ -0,0 +1,564 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Class extends AbstractAST { + public Class(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasRanges() { + return false; + } + + public java.util.List getRanges() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasCharClass() { + return false; + } + + public org.rascalmpl.ast.Class getCharClass() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasLhs() { + return false; + } + + public org.rascalmpl.ast.Class getLhs() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasRhs() { + return false; + } + + public org.rascalmpl.ast.Class getRhs() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isBracket() { + return false; + } + + static public class Bracket extends Class { + // Production: sig("Bracket",[arg("org.rascalmpl.ast.Class","charClass")],breakable=false) + + + private final org.rascalmpl.ast.Class charClass; + + public Bracket(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Class charClass) { + super(src, node); + + this.charClass = charClass; + } + + @Override + public boolean isBracket() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitClassBracket(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = charClass.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + charClass.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Bracket)) { + return false; + } + Bracket tmp = (Bracket) o; + return true && tmp.charClass.equals(this.charClass) ; + } + + @Override + public int hashCode() { + return 13 + 103 * charClass.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Class getCharClass() { + return this.charClass; + } + + @Override + public boolean hasCharClass() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(charClass)); + } + + } + public boolean isComplement() { + return false; + } + + static public class Complement extends Class { + // Production: sig("Complement",[arg("org.rascalmpl.ast.Class","charClass")],breakable=false) + + + private final org.rascalmpl.ast.Class charClass; + + public Complement(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Class charClass) { + super(src, node); + + this.charClass = charClass; + } + + @Override + public boolean isComplement() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitClassComplement(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = charClass.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + charClass.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Complement)) { + return false; + } + Complement tmp = (Complement) o; + return true && tmp.charClass.equals(this.charClass) ; + } + + @Override + public int hashCode() { + return 109 + 61 * charClass.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Class getCharClass() { + return this.charClass; + } + + @Override + public boolean hasCharClass() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(charClass)); + } + + } + public boolean isDifference() { + return false; + } + + static public class Difference extends Class { + // Production: sig("Difference",[arg("org.rascalmpl.ast.Class","lhs"),arg("org.rascalmpl.ast.Class","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Class lhs; + private final org.rascalmpl.ast.Class rhs; + + public Difference(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Class lhs, org.rascalmpl.ast.Class rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isDifference() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitClassDifference(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Difference)) { + return false; + } + Difference tmp = (Difference) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 79 + 367 * lhs.hashCode() + 587 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Class getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Class getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } + public boolean isIntersection() { + return false; + } + + static public class Intersection extends Class { + // Production: sig("Intersection",[arg("org.rascalmpl.ast.Class","lhs"),arg("org.rascalmpl.ast.Class","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Class lhs; + private final org.rascalmpl.ast.Class rhs; + + public Intersection(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Class lhs, org.rascalmpl.ast.Class rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isIntersection() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitClassIntersection(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Intersection)) { + return false; + } + Intersection tmp = (Intersection) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 433 + 47 * lhs.hashCode() + 131 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Class getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Class getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } + public boolean isSimpleCharclass() { + return false; + } + + static public class SimpleCharclass extends Class { + // Production: sig("SimpleCharclass",[arg("java.util.List\","ranges")],breakable=false) + + + private final java.util.List ranges; + + public SimpleCharclass(ISourceLocation src, IConstructor node , java.util.List ranges) { + super(src, node); + + this.ranges = ranges; + } + + @Override + public boolean isSimpleCharclass() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitClassSimpleCharclass(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : ranges) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof SimpleCharclass)) { + return false; + } + SimpleCharclass tmp = (SimpleCharclass) o; + return true && tmp.ranges.equals(this.ranges) ; + } + + @Override + public int hashCode() { + return 733 + 491 * ranges.hashCode() ; + } + + + @Override + public java.util.List getRanges() { + return this.ranges; + } + + @Override + public boolean hasRanges() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(ranges)); + } + + } + public boolean isUnion() { + return false; + } + + static public class Union extends Class { + // Production: sig("Union",[arg("org.rascalmpl.ast.Class","lhs"),arg("org.rascalmpl.ast.Class","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Class lhs; + private final org.rascalmpl.ast.Class rhs; + + public Union(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Class lhs, org.rascalmpl.ast.Class rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isUnion() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitClassUnion(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Union)) { + return false; + } + Union tmp = (Union) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 829 + 937 * lhs.hashCode() + 409 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Class getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Class getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Command.java b/src/org/rascalmpl/ast/Command.java new file mode 100644 index 00000000000..927ae5d2402 --- /dev/null +++ b/src/org/rascalmpl/ast/Command.java @@ -0,0 +1,438 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Command extends AbstractAST { + public Command(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasDeclaration() { + return false; + } + + public org.rascalmpl.ast.Declaration getDeclaration() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasExpression() { + return false; + } + + public org.rascalmpl.ast.Expression getExpression() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasImported() { + return false; + } + + public org.rascalmpl.ast.Import getImported() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasCommand() { + return false; + } + + public org.rascalmpl.ast.ShellCommand getCommand() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasStatement() { + return false; + } + + public org.rascalmpl.ast.Statement getStatement() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDeclaration() { + return false; + } + + static public class Declaration extends Command { + // Production: sig("Declaration",[arg("org.rascalmpl.ast.Declaration","declaration")],breakable=false) + + + private final org.rascalmpl.ast.Declaration declaration; + + public Declaration(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Declaration declaration) { + super(src, node); + + this.declaration = declaration; + } + + @Override + public boolean isDeclaration() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitCommandDeclaration(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = declaration.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + declaration.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Declaration)) { + return false; + } + Declaration tmp = (Declaration) o; + return true && tmp.declaration.equals(this.declaration) ; + } + + @Override + public int hashCode() { + return 857 + 509 * declaration.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Declaration getDeclaration() { + return this.declaration; + } + + @Override + public boolean hasDeclaration() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(declaration)); + } + + } + public boolean isExpression() { + return false; + } + + static public class Expression extends Command { + // Production: sig("Expression",[arg("org.rascalmpl.ast.Expression","expression")],breakable=false) + + + private final org.rascalmpl.ast.Expression expression; + + public Expression(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression expression) { + super(src, node); + + this.expression = expression; + } + + @Override + public boolean isExpression() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitCommandExpression(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Expression)) { + return false; + } + Expression tmp = (Expression) o; + return true && tmp.expression.equals(this.expression) ; + } + + @Override + public int hashCode() { + return 7 + 173 * expression.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(expression)); + } + + } + public boolean isImport() { + return false; + } + + static public class Import extends Command { + // Production: sig("Import",[arg("org.rascalmpl.ast.Import","imported")],breakable=false) + + + private final org.rascalmpl.ast.Import imported; + + public Import(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Import imported) { + super(src, node); + + this.imported = imported; + } + + @Override + public boolean isImport() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitCommandImport(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = imported.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + imported.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Import)) { + return false; + } + Import tmp = (Import) o; + return true && tmp.imported.equals(this.imported) ; + } + + @Override + public int hashCode() { + return 827 + 941 * imported.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Import getImported() { + return this.imported; + } + + @Override + public boolean hasImported() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(imported)); + } + + } + public boolean isShell() { + return false; + } + + static public class Shell extends Command { + // Production: sig("Shell",[arg("org.rascalmpl.ast.ShellCommand","command")],breakable=false) + + + private final org.rascalmpl.ast.ShellCommand command; + + public Shell(ISourceLocation src, IConstructor node , org.rascalmpl.ast.ShellCommand command) { + super(src, node); + + this.command = command; + } + + @Override + public boolean isShell() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitCommandShell(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = command.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + command.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Shell)) { + return false; + } + Shell tmp = (Shell) o; + return true && tmp.command.equals(this.command) ; + } + + @Override + public int hashCode() { + return 199 + 661 * command.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.ShellCommand getCommand() { + return this.command; + } + + @Override + public boolean hasCommand() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(command)); + } + + } + public boolean isStatement() { + return false; + } + + static public class Statement extends Command { + // Production: sig("Statement",[arg("org.rascalmpl.ast.Statement","statement")],breakable=false) + + + private final org.rascalmpl.ast.Statement statement; + + public Statement(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Statement statement) { + super(src, node); + + this.statement = statement; + } + + @Override + public boolean isStatement() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitCommandStatement(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = statement.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + statement.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Statement)) { + return false; + } + Statement tmp = (Statement) o; + return true && tmp.statement.equals(this.statement) ; + } + + @Override + public int hashCode() { + return 487 + 59 * statement.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Statement getStatement() { + return this.statement; + } + + @Override + public boolean hasStatement() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(statement)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Commands.java b/src/org/rascalmpl/ast/Commands.java new file mode 100644 index 00000000000..8d33b0e1ab2 --- /dev/null +++ b/src/org/rascalmpl/ast/Commands.java @@ -0,0 +1,116 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Commands extends AbstractAST { + public Commands(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasCommands() { + return false; + } + + public java.util.List getCommands() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isCommandlist() { + return false; + } + + static public class Commandlist extends Commands { + // Production: sig("Commandlist",[arg("java.util.List\","commands")],breakable=false) + + + private final java.util.List commands; + + public Commandlist(ISourceLocation src, IConstructor node , java.util.List commands) { + super(src, node); + + this.commands = commands; + } + + @Override + public boolean isCommandlist() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitCommandsCommandlist(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : commands) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Commandlist)) { + return false; + } + Commandlist tmp = (Commandlist) o; + return true && tmp.commands.equals(this.commands) ; + } + + @Override + public int hashCode() { + return 127 + 389 * commands.hashCode() ; + } + + + @Override + public java.util.List getCommands() { + return this.commands; + } + + @Override + public boolean hasCommands() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(commands)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Comment.java b/src/org/rascalmpl/ast/Comment.java new file mode 100644 index 00000000000..fba5214745b --- /dev/null +++ b/src/org/rascalmpl/ast/Comment.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Comment extends AbstractAST { + public Comment(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends Comment { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitCommentLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/CommonKeywordParameters.java b/src/org/rascalmpl/ast/CommonKeywordParameters.java new file mode 100644 index 00000000000..e9bd9f3c92b --- /dev/null +++ b/src/org/rascalmpl/ast/CommonKeywordParameters.java @@ -0,0 +1,171 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class CommonKeywordParameters extends AbstractAST { + public CommonKeywordParameters(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasKeywordFormalList() { + return false; + } + + public java.util.List getKeywordFormalList() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isAbsent() { + return false; + } + + static public class Absent extends CommonKeywordParameters { + // Production: sig("Absent",[],breakable=false) + + + + public Absent(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isAbsent() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitCommonKeywordParametersAbsent(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Absent)) { + return false; + } + Absent tmp = (Absent) o; + return true ; + } + + @Override + public int hashCode() { + return 157 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isPresent() { + return false; + } + + static public class Present extends CommonKeywordParameters { + // Production: sig("Present",[arg("java.util.List\","keywordFormalList")],breakable=false) + + + private final java.util.List keywordFormalList; + + public Present(ISourceLocation src, IConstructor node , java.util.List keywordFormalList) { + super(src, node); + + this.keywordFormalList = keywordFormalList; + } + + @Override + public boolean isPresent() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitCommonKeywordParametersPresent(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : keywordFormalList) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Present)) { + return false; + } + Present tmp = (Present) o; + return true && tmp.keywordFormalList.equals(this.keywordFormalList) ; + } + + @Override + public int hashCode() { + return 443 + 503 * keywordFormalList.hashCode() ; + } + + + @Override + public java.util.List getKeywordFormalList() { + return this.keywordFormalList; + } + + @Override + public boolean hasKeywordFormalList() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(keywordFormalList)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Comprehension.java b/src/org/rascalmpl/ast/Comprehension.java new file mode 100644 index 00000000000..15892f22da4 --- /dev/null +++ b/src/org/rascalmpl/ast/Comprehension.java @@ -0,0 +1,369 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Comprehension extends AbstractAST { + public Comprehension(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasGenerators() { + return false; + } + + public java.util.List getGenerators() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasResults() { + return false; + } + + public java.util.List getResults() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasFrom() { + return false; + } + + public org.rascalmpl.ast.Expression getFrom() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasTo() { + return false; + } + + public org.rascalmpl.ast.Expression getTo() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isList() { + return false; + } + + static public class List extends Comprehension { + // Production: sig("List",[arg("java.util.List\","results"),arg("java.util.List\","generators")],breakable=false) + + + private final java.util.List results; + private final java.util.List generators; + + public List(ISourceLocation src, IConstructor node , java.util.List results, java.util.List generators) { + super(src, node); + + this.results = results; + this.generators = generators; + } + + @Override + public boolean isList() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitComprehensionList(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : results) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + for (AbstractAST $elem : generators) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof List)) { + return false; + } + List tmp = (List) o; + return true && tmp.results.equals(this.results) && tmp.generators.equals(this.generators) ; + } + + @Override + public int hashCode() { + return 881 + 349 * results.hashCode() + 449 * generators.hashCode() ; + } + + + @Override + public java.util.List getResults() { + return this.results; + } + + @Override + public boolean hasResults() { + return true; + } + @Override + public java.util.List getGenerators() { + return this.generators; + } + + @Override + public boolean hasGenerators() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(results), clone(generators)); + } + + } + public boolean isMap() { + return false; + } + + static public class Map extends Comprehension { + // Production: sig("Map",[arg("org.rascalmpl.ast.Expression","from"),arg("org.rascalmpl.ast.Expression","to"),arg("java.util.List\","generators")],breakable=false) + + + private final org.rascalmpl.ast.Expression from; + private final org.rascalmpl.ast.Expression to; + private final java.util.List generators; + + public Map(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression from, org.rascalmpl.ast.Expression to, java.util.List generators) { + super(src, node); + + this.from = from; + this.to = to; + this.generators = generators; + } + + @Override + public boolean isMap() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitComprehensionMap(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = from.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + from.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = to.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + to.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : generators) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Map)) { + return false; + } + Map tmp = (Map) o; + return true && tmp.from.equals(this.from) && tmp.to.equals(this.to) && tmp.generators.equals(this.generators) ; + } + + @Override + public int hashCode() { + return 71 + 523 * from.hashCode() + 937 * to.hashCode() + 617 * generators.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getFrom() { + return this.from; + } + + @Override + public boolean hasFrom() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getTo() { + return this.to; + } + + @Override + public boolean hasTo() { + return true; + } + @Override + public java.util.List getGenerators() { + return this.generators; + } + + @Override + public boolean hasGenerators() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(from), clone(to), clone(generators)); + } + + } + public boolean isSet() { + return false; + } + + static public class Set extends Comprehension { + // Production: sig("Set",[arg("java.util.List\","results"),arg("java.util.List\","generators")],breakable=false) + + + private final java.util.List results; + private final java.util.List generators; + + public Set(ISourceLocation src, IConstructor node , java.util.List results, java.util.List generators) { + super(src, node); + + this.results = results; + this.generators = generators; + } + + @Override + public boolean isSet() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitComprehensionSet(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : results) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + for (AbstractAST $elem : generators) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Set)) { + return false; + } + Set tmp = (Set) o; + return true && tmp.results.equals(this.results) && tmp.generators.equals(this.generators) ; + } + + @Override + public int hashCode() { + return 821 + 971 * results.hashCode() + 173 * generators.hashCode() ; + } + + + @Override + public java.util.List getResults() { + return this.results; + } + + @Override + public boolean hasResults() { + return true; + } + @Override + public java.util.List getGenerators() { + return this.generators; + } + + @Override + public boolean hasGenerators() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(results), clone(generators)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Concrete.java b/src/org/rascalmpl/ast/Concrete.java new file mode 100644 index 00000000000..74ee3ea1569 --- /dev/null +++ b/src/org/rascalmpl/ast/Concrete.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Concrete extends AbstractAST { + public Concrete(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends Concrete { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitConcreteLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/ConcreteHole.java b/src/org/rascalmpl/ast/ConcreteHole.java new file mode 100644 index 00000000000..063f1fe5470 --- /dev/null +++ b/src/org/rascalmpl/ast/ConcreteHole.java @@ -0,0 +1,140 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class ConcreteHole extends AbstractAST { + public ConcreteHole(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasName() { + return false; + } + + public org.rascalmpl.ast.Name getName() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasSymbol() { + return false; + } + + public org.rascalmpl.ast.Sym getSymbol() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isOne() { + return false; + } + + static public class One extends ConcreteHole { + // Production: sig("One",[arg("org.rascalmpl.ast.Sym","symbol"),arg("org.rascalmpl.ast.Name","name")],breakable=false) + + + private final org.rascalmpl.ast.Sym symbol; + private final org.rascalmpl.ast.Name name; + + public One(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Sym symbol, org.rascalmpl.ast.Name name) { + super(src, node); + + this.symbol = symbol; + this.name = name; + } + + @Override + public boolean isOne() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitConcreteHoleOne(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = symbol.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + symbol.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof One)) { + return false; + } + One tmp = (One) o; + return true && tmp.symbol.equals(this.symbol) && tmp.name.equals(this.name) ; + } + + @Override + public int hashCode() { + return 257 + 83 * symbol.hashCode() + 71 * name.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Sym getSymbol() { + return this.symbol; + } + + @Override + public boolean hasSymbol() { + return true; + } + @Override + public org.rascalmpl.ast.Name getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(symbol), clone(name)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/ConcretePart.java b/src/org/rascalmpl/ast/ConcretePart.java new file mode 100644 index 00000000000..1565ed34c37 --- /dev/null +++ b/src/org/rascalmpl/ast/ConcretePart.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class ConcretePart extends AbstractAST { + public ConcretePart(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends ConcretePart { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitConcretePartLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/DataTarget.java b/src/org/rascalmpl/ast/DataTarget.java new file mode 100644 index 00000000000..a151a5d46ce --- /dev/null +++ b/src/org/rascalmpl/ast/DataTarget.java @@ -0,0 +1,169 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class DataTarget extends AbstractAST { + public DataTarget(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasLabel() { + return false; + } + + public org.rascalmpl.ast.Name getLabel() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isEmpty() { + return false; + } + + static public class Empty extends DataTarget { + // Production: sig("Empty",[],breakable=false) + + + + public Empty(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isEmpty() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitDataTargetEmpty(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Empty)) { + return false; + } + Empty tmp = (Empty) o; + return true ; + } + + @Override + public int hashCode() { + return 167 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isLabeled() { + return false; + } + + static public class Labeled extends DataTarget { + // Production: sig("Labeled",[arg("org.rascalmpl.ast.Name","label")],breakable=false) + + + private final org.rascalmpl.ast.Name label; + + public Labeled(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Name label) { + super(src, node); + + this.label = label; + } + + @Override + public boolean isLabeled() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitDataTargetLabeled(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = label.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + label.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Labeled)) { + return false; + } + Labeled tmp = (Labeled) o; + return true && tmp.label.equals(this.label) ; + } + + @Override + public int hashCode() { + return 769 + 17 * label.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Name getLabel() { + return this.label; + } + + @Override + public boolean hasLabel() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(label)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/DataTypeSelector.java b/src/org/rascalmpl/ast/DataTypeSelector.java new file mode 100644 index 00000000000..514daa9a9a6 --- /dev/null +++ b/src/org/rascalmpl/ast/DataTypeSelector.java @@ -0,0 +1,140 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class DataTypeSelector extends AbstractAST { + public DataTypeSelector(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasProduction() { + return false; + } + + public org.rascalmpl.ast.Name getProduction() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasSort() { + return false; + } + + public org.rascalmpl.ast.QualifiedName getSort() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isSelector() { + return false; + } + + static public class Selector extends DataTypeSelector { + // Production: sig("Selector",[arg("org.rascalmpl.ast.QualifiedName","sort"),arg("org.rascalmpl.ast.Name","production")],breakable=false) + + + private final org.rascalmpl.ast.QualifiedName sort; + private final org.rascalmpl.ast.Name production; + + public Selector(ISourceLocation src, IConstructor node , org.rascalmpl.ast.QualifiedName sort, org.rascalmpl.ast.Name production) { + super(src, node); + + this.sort = sort; + this.production = production; + } + + @Override + public boolean isSelector() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitDataTypeSelectorSelector(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = sort.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + sort.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = production.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + production.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Selector)) { + return false; + } + Selector tmp = (Selector) o; + return true && tmp.sort.equals(this.sort) && tmp.production.equals(this.production) ; + } + + @Override + public int hashCode() { + return 41 + 761 * sort.hashCode() + 971 * production.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.QualifiedName getSort() { + return this.sort; + } + + @Override + public boolean hasSort() { + return true; + } + @Override + public org.rascalmpl.ast.Name getProduction() { + return this.production; + } + + @Override + public boolean hasProduction() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(sort), clone(production)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/DateAndTime.java b/src/org/rascalmpl/ast/DateAndTime.java new file mode 100644 index 00000000000..1edc5392933 --- /dev/null +++ b/src/org/rascalmpl/ast/DateAndTime.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class DateAndTime extends AbstractAST { + public DateAndTime(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends DateAndTime { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitDateAndTimeLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/DatePart.java b/src/org/rascalmpl/ast/DatePart.java new file mode 100644 index 00000000000..271f84a1602 --- /dev/null +++ b/src/org/rascalmpl/ast/DatePart.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class DatePart extends AbstractAST { + public DatePart(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends DatePart { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitDatePartLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/DateTimeLiteral.java b/src/org/rascalmpl/ast/DateTimeLiteral.java new file mode 100644 index 00000000000..1e6c37406a0 --- /dev/null +++ b/src/org/rascalmpl/ast/DateTimeLiteral.java @@ -0,0 +1,276 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class DateTimeLiteral extends AbstractAST { + public DateTimeLiteral(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasDateAndTime() { + return false; + } + + public org.rascalmpl.ast.DateAndTime getDateAndTime() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasDate() { + return false; + } + + public org.rascalmpl.ast.JustDate getDate() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasTime() { + return false; + } + + public org.rascalmpl.ast.JustTime getTime() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDateAndTimeLiteral() { + return false; + } + + static public class DateAndTimeLiteral extends DateTimeLiteral { + // Production: sig("DateAndTimeLiteral",[arg("org.rascalmpl.ast.DateAndTime","dateAndTime")],breakable=false) + + + private final org.rascalmpl.ast.DateAndTime dateAndTime; + + public DateAndTimeLiteral(ISourceLocation src, IConstructor node , org.rascalmpl.ast.DateAndTime dateAndTime) { + super(src, node); + + this.dateAndTime = dateAndTime; + } + + @Override + public boolean isDateAndTimeLiteral() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitDateTimeLiteralDateAndTimeLiteral(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = dateAndTime.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + dateAndTime.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof DateAndTimeLiteral)) { + return false; + } + DateAndTimeLiteral tmp = (DateAndTimeLiteral) o; + return true && tmp.dateAndTime.equals(this.dateAndTime) ; + } + + @Override + public int hashCode() { + return 643 + 751 * dateAndTime.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.DateAndTime getDateAndTime() { + return this.dateAndTime; + } + + @Override + public boolean hasDateAndTime() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(dateAndTime)); + } + + } + public boolean isDateLiteral() { + return false; + } + + static public class DateLiteral extends DateTimeLiteral { + // Production: sig("DateLiteral",[arg("org.rascalmpl.ast.JustDate","date")],breakable=false) + + + private final org.rascalmpl.ast.JustDate date; + + public DateLiteral(ISourceLocation src, IConstructor node , org.rascalmpl.ast.JustDate date) { + super(src, node); + + this.date = date; + } + + @Override + public boolean isDateLiteral() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitDateTimeLiteralDateLiteral(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = date.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + date.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof DateLiteral)) { + return false; + } + DateLiteral tmp = (DateLiteral) o; + return true && tmp.date.equals(this.date) ; + } + + @Override + public int hashCode() { + return 907 + 857 * date.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.JustDate getDate() { + return this.date; + } + + @Override + public boolean hasDate() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(date)); + } + + } + public boolean isTimeLiteral() { + return false; + } + + static public class TimeLiteral extends DateTimeLiteral { + // Production: sig("TimeLiteral",[arg("org.rascalmpl.ast.JustTime","time")],breakable=false) + + + private final org.rascalmpl.ast.JustTime time; + + public TimeLiteral(ISourceLocation src, IConstructor node , org.rascalmpl.ast.JustTime time) { + super(src, node); + + this.time = time; + } + + @Override + public boolean isTimeLiteral() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitDateTimeLiteralTimeLiteral(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = time.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + time.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof TimeLiteral)) { + return false; + } + TimeLiteral tmp = (TimeLiteral) o; + return true && tmp.time.equals(this.time) ; + } + + @Override + public int hashCode() { + return 373 + 149 * time.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.JustTime getTime() { + return this.time; + } + + @Override + public boolean hasTime() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(time)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/DecimalIntegerLiteral.java b/src/org/rascalmpl/ast/DecimalIntegerLiteral.java new file mode 100644 index 00000000000..87b314c8228 --- /dev/null +++ b/src/org/rascalmpl/ast/DecimalIntegerLiteral.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class DecimalIntegerLiteral extends AbstractAST { + public DecimalIntegerLiteral(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends DecimalIntegerLiteral { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitDecimalIntegerLiteralLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Declaration.java b/src/org/rascalmpl/ast/Declaration.java new file mode 100644 index 00000000000..7665fa5a38d --- /dev/null +++ b/src/org/rascalmpl/ast/Declaration.java @@ -0,0 +1,1054 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Declaration extends AbstractAST { + public Declaration(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasTypes() { + return false; + } + + public java.util.List getTypes() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasVariables() { + return false; + } + + public java.util.List getVariables() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasVariants() { + return false; + } + + public java.util.List getVariants() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasCommonKeywordParameters() { + return false; + } + + public org.rascalmpl.ast.CommonKeywordParameters getCommonKeywordParameters() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasFunctionDeclaration() { + return false; + } + + public org.rascalmpl.ast.FunctionDeclaration getFunctionDeclaration() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasKind() { + return false; + } + + public org.rascalmpl.ast.Kind getKind() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasName() { + return false; + } + + public org.rascalmpl.ast.Name getName() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasTags() { + return false; + } + + public org.rascalmpl.ast.Tags getTags() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasAnnoType() { + return false; + } + + public org.rascalmpl.ast.Type getAnnoType() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasBase() { + return false; + } + + public org.rascalmpl.ast.Type getBase() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasOnType() { + return false; + } + + public org.rascalmpl.ast.Type getOnType() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasType() { + return false; + } + + public org.rascalmpl.ast.Type getType() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasUser() { + return false; + } + + public org.rascalmpl.ast.UserType getUser() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasVisibility() { + return false; + } + + public org.rascalmpl.ast.Visibility getVisibility() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isAlias() { + return false; + } + + static public class Alias extends Declaration { + // Production: sig("Alias",[arg("org.rascalmpl.ast.Tags","tags"),arg("org.rascalmpl.ast.Visibility","visibility"),arg("org.rascalmpl.ast.UserType","user"),arg("org.rascalmpl.ast.Type","base")],breakable=false) + + + private final org.rascalmpl.ast.Tags tags; + private final org.rascalmpl.ast.Visibility visibility; + private final org.rascalmpl.ast.UserType user; + private final org.rascalmpl.ast.Type base; + + public Alias(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Tags tags, org.rascalmpl.ast.Visibility visibility, org.rascalmpl.ast.UserType user, org.rascalmpl.ast.Type base) { + super(src, node); + + this.tags = tags; + this.visibility = visibility; + this.user = user; + this.base = base; + } + + @Override + public boolean isAlias() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitDeclarationAlias(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = tags.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + tags.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = visibility.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + visibility.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = user.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + user.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = base.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + base.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Alias)) { + return false; + } + Alias tmp = (Alias) o; + return true && tmp.tags.equals(this.tags) && tmp.visibility.equals(this.visibility) && tmp.user.equals(this.user) && tmp.base.equals(this.base) ; + } + + @Override + public int hashCode() { + return 313 + 73 * tags.hashCode() + 499 * visibility.hashCode() + 691 * user.hashCode() + 227 * base.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Tags getTags() { + return this.tags; + } + + @Override + public boolean hasTags() { + return true; + } + @Override + public org.rascalmpl.ast.Visibility getVisibility() { + return this.visibility; + } + + @Override + public boolean hasVisibility() { + return true; + } + @Override + public org.rascalmpl.ast.UserType getUser() { + return this.user; + } + + @Override + public boolean hasUser() { + return true; + } + @Override + public org.rascalmpl.ast.Type getBase() { + return this.base; + } + + @Override + public boolean hasBase() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(tags), clone(visibility), clone(user), clone(base)); + } + + } + public boolean isAnnotation() { + return false; + } + + static public class Annotation extends Declaration { + // Production: sig("Annotation",[arg("org.rascalmpl.ast.Tags","tags"),arg("org.rascalmpl.ast.Visibility","visibility"),arg("org.rascalmpl.ast.Type","annoType"),arg("org.rascalmpl.ast.Type","onType"),arg("org.rascalmpl.ast.Name","name")],breakable=false) + + + private final org.rascalmpl.ast.Tags tags; + private final org.rascalmpl.ast.Visibility visibility; + private final org.rascalmpl.ast.Type annoType; + private final org.rascalmpl.ast.Type onType; + private final org.rascalmpl.ast.Name name; + + public Annotation(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Tags tags, org.rascalmpl.ast.Visibility visibility, org.rascalmpl.ast.Type annoType, org.rascalmpl.ast.Type onType, org.rascalmpl.ast.Name name) { + super(src, node); + + this.tags = tags; + this.visibility = visibility; + this.annoType = annoType; + this.onType = onType; + this.name = name; + } + + @Override + public boolean isAnnotation() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitDeclarationAnnotation(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = tags.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + tags.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = visibility.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + visibility.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = annoType.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + annoType.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = onType.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + onType.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Annotation)) { + return false; + } + Annotation tmp = (Annotation) o; + return true && tmp.tags.equals(this.tags) && tmp.visibility.equals(this.visibility) && tmp.annoType.equals(this.annoType) && tmp.onType.equals(this.onType) && tmp.name.equals(this.name) ; + } + + @Override + public int hashCode() { + return 137 + 983 * tags.hashCode() + 677 * visibility.hashCode() + 433 * annoType.hashCode() + 673 * onType.hashCode() + 13 * name.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Tags getTags() { + return this.tags; + } + + @Override + public boolean hasTags() { + return true; + } + @Override + public org.rascalmpl.ast.Visibility getVisibility() { + return this.visibility; + } + + @Override + public boolean hasVisibility() { + return true; + } + @Override + public org.rascalmpl.ast.Type getAnnoType() { + return this.annoType; + } + + @Override + public boolean hasAnnoType() { + return true; + } + @Override + public org.rascalmpl.ast.Type getOnType() { + return this.onType; + } + + @Override + public boolean hasOnType() { + return true; + } + @Override + public org.rascalmpl.ast.Name getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(tags), clone(visibility), clone(annoType), clone(onType), clone(name)); + } + + } + public boolean isData() { + return false; + } + + static public class Data extends Declaration { + // Production: sig("Data",[arg("org.rascalmpl.ast.Tags","tags"),arg("org.rascalmpl.ast.Visibility","visibility"),arg("org.rascalmpl.ast.UserType","user"),arg("org.rascalmpl.ast.CommonKeywordParameters","commonKeywordParameters"),arg("java.util.List\","variants")],breakable=false) + + + private final org.rascalmpl.ast.Tags tags; + private final org.rascalmpl.ast.Visibility visibility; + private final org.rascalmpl.ast.UserType user; + private final org.rascalmpl.ast.CommonKeywordParameters commonKeywordParameters; + private final java.util.List variants; + + public Data(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Tags tags, org.rascalmpl.ast.Visibility visibility, org.rascalmpl.ast.UserType user, org.rascalmpl.ast.CommonKeywordParameters commonKeywordParameters, java.util.List variants) { + super(src, node); + + this.tags = tags; + this.visibility = visibility; + this.user = user; + this.commonKeywordParameters = commonKeywordParameters; + this.variants = variants; + } + + @Override + public boolean isData() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitDeclarationData(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = tags.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + tags.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = visibility.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + visibility.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = user.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + user.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = commonKeywordParameters.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + commonKeywordParameters.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : variants) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Data)) { + return false; + } + Data tmp = (Data) o; + return true && tmp.tags.equals(this.tags) && tmp.visibility.equals(this.visibility) && tmp.user.equals(this.user) && tmp.commonKeywordParameters.equals(this.commonKeywordParameters) && tmp.variants.equals(this.variants) ; + } + + @Override + public int hashCode() { + return 281 + 101 * tags.hashCode() + 433 * visibility.hashCode() + 419 * user.hashCode() + 911 * commonKeywordParameters.hashCode() + 191 * variants.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Tags getTags() { + return this.tags; + } + + @Override + public boolean hasTags() { + return true; + } + @Override + public org.rascalmpl.ast.Visibility getVisibility() { + return this.visibility; + } + + @Override + public boolean hasVisibility() { + return true; + } + @Override + public org.rascalmpl.ast.UserType getUser() { + return this.user; + } + + @Override + public boolean hasUser() { + return true; + } + @Override + public org.rascalmpl.ast.CommonKeywordParameters getCommonKeywordParameters() { + return this.commonKeywordParameters; + } + + @Override + public boolean hasCommonKeywordParameters() { + return true; + } + @Override + public java.util.List getVariants() { + return this.variants; + } + + @Override + public boolean hasVariants() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(tags), clone(visibility), clone(user), clone(commonKeywordParameters), clone(variants)); + } + + } + public boolean isDataAbstract() { + return false; + } + + static public class DataAbstract extends Declaration { + // Production: sig("DataAbstract",[arg("org.rascalmpl.ast.Tags","tags"),arg("org.rascalmpl.ast.Visibility","visibility"),arg("org.rascalmpl.ast.UserType","user"),arg("org.rascalmpl.ast.CommonKeywordParameters","commonKeywordParameters")],breakable=false) + + + private final org.rascalmpl.ast.Tags tags; + private final org.rascalmpl.ast.Visibility visibility; + private final org.rascalmpl.ast.UserType user; + private final org.rascalmpl.ast.CommonKeywordParameters commonKeywordParameters; + + public DataAbstract(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Tags tags, org.rascalmpl.ast.Visibility visibility, org.rascalmpl.ast.UserType user, org.rascalmpl.ast.CommonKeywordParameters commonKeywordParameters) { + super(src, node); + + this.tags = tags; + this.visibility = visibility; + this.user = user; + this.commonKeywordParameters = commonKeywordParameters; + } + + @Override + public boolean isDataAbstract() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitDeclarationDataAbstract(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = tags.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + tags.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = visibility.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + visibility.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = user.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + user.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = commonKeywordParameters.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + commonKeywordParameters.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof DataAbstract)) { + return false; + } + DataAbstract tmp = (DataAbstract) o; + return true && tmp.tags.equals(this.tags) && tmp.visibility.equals(this.visibility) && tmp.user.equals(this.user) && tmp.commonKeywordParameters.equals(this.commonKeywordParameters) ; + } + + @Override + public int hashCode() { + return 397 + 131 * tags.hashCode() + 863 * visibility.hashCode() + 211 * user.hashCode() + 593 * commonKeywordParameters.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Tags getTags() { + return this.tags; + } + + @Override + public boolean hasTags() { + return true; + } + @Override + public org.rascalmpl.ast.Visibility getVisibility() { + return this.visibility; + } + + @Override + public boolean hasVisibility() { + return true; + } + @Override + public org.rascalmpl.ast.UserType getUser() { + return this.user; + } + + @Override + public boolean hasUser() { + return true; + } + @Override + public org.rascalmpl.ast.CommonKeywordParameters getCommonKeywordParameters() { + return this.commonKeywordParameters; + } + + @Override + public boolean hasCommonKeywordParameters() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(tags), clone(visibility), clone(user), clone(commonKeywordParameters)); + } + + } + public boolean isFunction() { + return false; + } + + static public class Function extends Declaration { + // Production: sig("Function",[arg("org.rascalmpl.ast.FunctionDeclaration","functionDeclaration")],breakable=false) + + + private final org.rascalmpl.ast.FunctionDeclaration functionDeclaration; + + public Function(ISourceLocation src, IConstructor node , org.rascalmpl.ast.FunctionDeclaration functionDeclaration) { + super(src, node); + + this.functionDeclaration = functionDeclaration; + } + + @Override + public boolean isFunction() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitDeclarationFunction(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = functionDeclaration.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + functionDeclaration.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Function)) { + return false; + } + Function tmp = (Function) o; + return true && tmp.functionDeclaration.equals(this.functionDeclaration) ; + } + + @Override + public int hashCode() { + return 13 + 7 * functionDeclaration.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.FunctionDeclaration getFunctionDeclaration() { + return this.functionDeclaration; + } + + @Override + public boolean hasFunctionDeclaration() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(functionDeclaration)); + } + + } + public boolean isTag() { + return false; + } + + static public class Tag extends Declaration { + // Production: sig("Tag",[arg("org.rascalmpl.ast.Tags","tags"),arg("org.rascalmpl.ast.Visibility","visibility"),arg("org.rascalmpl.ast.Kind","kind"),arg("org.rascalmpl.ast.Name","name"),arg("java.util.List\","types")],breakable=false) + + + private final org.rascalmpl.ast.Tags tags; + private final org.rascalmpl.ast.Visibility visibility; + private final org.rascalmpl.ast.Kind kind; + private final org.rascalmpl.ast.Name name; + private final java.util.List types; + + public Tag(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Tags tags, org.rascalmpl.ast.Visibility visibility, org.rascalmpl.ast.Kind kind, org.rascalmpl.ast.Name name, java.util.List types) { + super(src, node); + + this.tags = tags; + this.visibility = visibility; + this.kind = kind; + this.name = name; + this.types = types; + } + + @Override + public boolean isTag() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitDeclarationTag(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = tags.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + tags.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = visibility.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + visibility.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = kind.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + kind.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : types) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Tag)) { + return false; + } + Tag tmp = (Tag) o; + return true && tmp.tags.equals(this.tags) && tmp.visibility.equals(this.visibility) && tmp.kind.equals(this.kind) && tmp.name.equals(this.name) && tmp.types.equals(this.types) ; + } + + @Override + public int hashCode() { + return 101 + 479 * tags.hashCode() + 137 * visibility.hashCode() + 223 * kind.hashCode() + 307 * name.hashCode() + 733 * types.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Tags getTags() { + return this.tags; + } + + @Override + public boolean hasTags() { + return true; + } + @Override + public org.rascalmpl.ast.Visibility getVisibility() { + return this.visibility; + } + + @Override + public boolean hasVisibility() { + return true; + } + @Override + public org.rascalmpl.ast.Kind getKind() { + return this.kind; + } + + @Override + public boolean hasKind() { + return true; + } + @Override + public org.rascalmpl.ast.Name getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + @Override + public java.util.List getTypes() { + return this.types; + } + + @Override + public boolean hasTypes() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(tags), clone(visibility), clone(kind), clone(name), clone(types)); + } + + } + public boolean isVariable() { + return false; + } + + static public class Variable extends Declaration { + // Production: sig("Variable",[arg("org.rascalmpl.ast.Tags","tags"),arg("org.rascalmpl.ast.Visibility","visibility"),arg("org.rascalmpl.ast.Type","type"),arg("java.util.List\","variables")],breakable=false) + + + private final org.rascalmpl.ast.Tags tags; + private final org.rascalmpl.ast.Visibility visibility; + private final org.rascalmpl.ast.Type type; + private final java.util.List variables; + + public Variable(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Tags tags, org.rascalmpl.ast.Visibility visibility, org.rascalmpl.ast.Type type, java.util.List variables) { + super(src, node); + + this.tags = tags; + this.visibility = visibility; + this.type = type; + this.variables = variables; + } + + @Override + public boolean isVariable() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitDeclarationVariable(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = tags.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + tags.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = visibility.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + visibility.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = type.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + type.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : variables) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Variable)) { + return false; + } + Variable tmp = (Variable) o; + return true && tmp.tags.equals(this.tags) && tmp.visibility.equals(this.visibility) && tmp.type.equals(this.type) && tmp.variables.equals(this.variables) ; + } + + @Override + public int hashCode() { + return 859 + 599 * tags.hashCode() + 643 * visibility.hashCode() + 853 * type.hashCode() + 3 * variables.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Tags getTags() { + return this.tags; + } + + @Override + public boolean hasTags() { + return true; + } + @Override + public org.rascalmpl.ast.Visibility getVisibility() { + return this.visibility; + } + + @Override + public boolean hasVisibility() { + return true; + } + @Override + public org.rascalmpl.ast.Type getType() { + return this.type; + } + + @Override + public boolean hasType() { + return true; + } + @Override + public java.util.List getVariables() { + return this.variables; + } + + @Override + public boolean hasVariables() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(tags), clone(visibility), clone(type), clone(variables)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Declarator.java b/src/org/rascalmpl/ast/Declarator.java new file mode 100644 index 00000000000..0b4347e45ba --- /dev/null +++ b/src/org/rascalmpl/ast/Declarator.java @@ -0,0 +1,142 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Declarator extends AbstractAST { + public Declarator(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasVariables() { + return false; + } + + public java.util.List getVariables() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasType() { + return false; + } + + public org.rascalmpl.ast.Type getType() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDefault() { + return false; + } + + static public class Default extends Declarator { + // Production: sig("Default",[arg("org.rascalmpl.ast.Type","type"),arg("java.util.List\","variables")],breakable=false) + + + private final org.rascalmpl.ast.Type type; + private final java.util.List variables; + + public Default(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Type type, java.util.List variables) { + super(src, node); + + this.type = type; + this.variables = variables; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitDeclaratorDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = type.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + type.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : variables) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.type.equals(this.type) && tmp.variables.equals(this.variables) ; + } + + @Override + public int hashCode() { + return 257 + 307 * type.hashCode() + 577 * variables.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Type getType() { + return this.type; + } + + @Override + public boolean hasType() { + return true; + } + @Override + public java.util.List getVariables() { + return this.variables; + } + + @Override + public boolean hasVariables() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(type), clone(variables)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/EvalCommand.java b/src/org/rascalmpl/ast/EvalCommand.java new file mode 100644 index 00000000000..03e72fe0f86 --- /dev/null +++ b/src/org/rascalmpl/ast/EvalCommand.java @@ -0,0 +1,331 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class EvalCommand extends AbstractAST { + public EvalCommand(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasDeclaration() { + return false; + } + + public org.rascalmpl.ast.Declaration getDeclaration() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasImported() { + return false; + } + + public org.rascalmpl.ast.Import getImported() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasStatement() { + return false; + } + + public org.rascalmpl.ast.Statement getStatement() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDeclaration() { + return false; + } + + static public class Declaration extends EvalCommand { + // Production: sig("Declaration",[arg("org.rascalmpl.ast.Declaration","declaration")],breakable=false) + + + private final org.rascalmpl.ast.Declaration declaration; + + public Declaration(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Declaration declaration) { + super(src, node); + + this.declaration = declaration; + } + + @Override + public boolean isDeclaration() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitEvalCommandDeclaration(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = declaration.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + declaration.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Declaration)) { + return false; + } + Declaration tmp = (Declaration) o; + return true && tmp.declaration.equals(this.declaration) ; + } + + @Override + public int hashCode() { + return 397 + 641 * declaration.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Declaration getDeclaration() { + return this.declaration; + } + + @Override + public boolean hasDeclaration() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(declaration)); + } + + } + public boolean isImport() { + return false; + } + + static public class Import extends EvalCommand { + // Production: sig("Import",[arg("org.rascalmpl.ast.Import","imported")],breakable=false) + + + private final org.rascalmpl.ast.Import imported; + + public Import(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Import imported) { + super(src, node); + + this.imported = imported; + } + + @Override + public boolean isImport() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitEvalCommandImport(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = imported.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + imported.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Import)) { + return false; + } + Import tmp = (Import) o; + return true && tmp.imported.equals(this.imported) ; + } + + @Override + public int hashCode() { + return 197 + 233 * imported.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Import getImported() { + return this.imported; + } + + @Override + public boolean hasImported() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(imported)); + } + + } + public boolean isOutput() { + return false; + } + + static public class Output extends EvalCommand { + // Production: sig("Output",[],breakable=false) + + + + public Output(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isOutput() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitEvalCommandOutput(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Output)) { + return false; + } + Output tmp = (Output) o; + return true ; + } + + @Override + public int hashCode() { + return 647 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isStatement() { + return false; + } + + static public class Statement extends EvalCommand { + // Production: sig("Statement",[arg("org.rascalmpl.ast.Statement","statement")],breakable=false) + + + private final org.rascalmpl.ast.Statement statement; + + public Statement(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Statement statement) { + super(src, node); + + this.statement = statement; + } + + @Override + public boolean isStatement() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitEvalCommandStatement(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = statement.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + statement.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Statement)) { + return false; + } + Statement tmp = (Statement) o; + return true && tmp.statement.equals(this.statement) ; + } + + @Override + public int hashCode() { + return 157 + 83 * statement.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Statement getStatement() { + return this.statement; + } + + @Override + public boolean hasStatement() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(statement)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Expression.java b/src/org/rascalmpl/ast/Expression.java new file mode 100644 index 00000000000..e90368d27fb --- /dev/null +++ b/src/org/rascalmpl/ast/Expression.java @@ -0,0 +1,6960 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Expression extends AbstractAST { + public Expression(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasArguments() { + return false; + } + + public java.util.List getArguments() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasElements() { + return false; + } + + public java.util.List getElements() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasElements0() { + return false; + } + + public java.util.List getElements0() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasGenerators() { + return false; + } + + public java.util.List getGenerators() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasSubscripts() { + return false; + } + + public java.util.List getSubscripts() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasFields() { + return false; + } + + public java.util.List getFields() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasMappings() { + return false; + } + + public java.util.List getMappings() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasStatements() { + return false; + } + + public java.util.List getStatements() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasStatements0() { + return false; + } + + public java.util.List getStatements0() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasComprehension() { + return false; + } + + public org.rascalmpl.ast.Comprehension getComprehension() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasConcrete() { + return false; + } + + public org.rascalmpl.ast.Concrete getConcrete() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasArgument() { + return false; + } + + public org.rascalmpl.ast.Expression getArgument() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasCondition() { + return false; + } + + public org.rascalmpl.ast.Expression getCondition() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasDefinitions() { + return false; + } + + public org.rascalmpl.ast.Expression getDefinitions() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasElseExp() { + return false; + } + + public org.rascalmpl.ast.Expression getElseExp() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasExpression() { + return false; + } + + public org.rascalmpl.ast.Expression getExpression() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasFirst() { + return false; + } + + public org.rascalmpl.ast.Expression getFirst() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasInit() { + return false; + } + + public org.rascalmpl.ast.Expression getInit() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasLast() { + return false; + } + + public org.rascalmpl.ast.Expression getLast() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasLhs() { + return false; + } + + public org.rascalmpl.ast.Expression getLhs() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasPattern() { + return false; + } + + public org.rascalmpl.ast.Expression getPattern() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasReplacement() { + return false; + } + + public org.rascalmpl.ast.Expression getReplacement() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasResult() { + return false; + } + + public org.rascalmpl.ast.Expression getResult() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasRhs() { + return false; + } + + public org.rascalmpl.ast.Expression getRhs() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasSecond() { + return false; + } + + public org.rascalmpl.ast.Expression getSecond() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasSymbol() { + return false; + } + + public org.rascalmpl.ast.Expression getSymbol() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasThenExp() { + return false; + } + + public org.rascalmpl.ast.Expression getThenExp() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasValue() { + return false; + } + + public org.rascalmpl.ast.Expression getValue() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasKeywordArguments() { + return false; + } + + public org.rascalmpl.ast.KeywordArguments_Expression getKeywordArguments() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasLabel() { + return false; + } + + public org.rascalmpl.ast.Label getLabel() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasLiteral() { + return false; + } + + public org.rascalmpl.ast.Literal getLiteral() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasField() { + return false; + } + + public org.rascalmpl.ast.Name getField() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasKey() { + return false; + } + + public org.rascalmpl.ast.Name getKey() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasName() { + return false; + } + + public org.rascalmpl.ast.Name getName() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasOptFirst() { + return false; + } + + public org.rascalmpl.ast.OptionalExpression getOptFirst() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasOptLast() { + return false; + } + + public org.rascalmpl.ast.OptionalExpression getOptLast() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasParameters() { + return false; + } + + public org.rascalmpl.ast.Parameters getParameters() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasQualifiedName() { + return false; + } + + public org.rascalmpl.ast.QualifiedName getQualifiedName() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasType() { + return false; + } + + public org.rascalmpl.ast.Type getType() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasVisit() { + return false; + } + + public org.rascalmpl.ast.Visit getVisit() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isAddition() { + return false; + } + + static public class Addition extends Expression { + // Production: sig("Addition",[arg("org.rascalmpl.ast.Expression","lhs"),arg("org.rascalmpl.ast.Expression","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Expression lhs; + private final org.rascalmpl.ast.Expression rhs; + + public Addition(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression lhs, org.rascalmpl.ast.Expression rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isAddition() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionAddition(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Addition)) { + return false; + } + Addition tmp = (Addition) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 271 + 41 * lhs.hashCode() + 919 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } + public boolean isAll() { + return false; + } + + static public class All extends Expression { + // Production: sig("All",[arg("java.util.List\","generators")],breakable=false) + + + private final java.util.List generators; + + public All(ISourceLocation src, IConstructor node , java.util.List generators) { + super(src, node); + + this.generators = generators; + } + + @Override + public boolean isAll() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionAll(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : generators) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof All)) { + return false; + } + All tmp = (All) o; + return true && tmp.generators.equals(this.generators) ; + } + + @Override + public int hashCode() { + return 673 + 499 * generators.hashCode() ; + } + + + @Override + public java.util.List getGenerators() { + return this.generators; + } + + @Override + public boolean hasGenerators() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(generators)); + } + + } + public boolean isAnd() { + return false; + } + + static public class And extends Expression { + // Production: sig("And",[arg("org.rascalmpl.ast.Expression","lhs"),arg("org.rascalmpl.ast.Expression","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Expression lhs; + private final org.rascalmpl.ast.Expression rhs; + + public And(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression lhs, org.rascalmpl.ast.Expression rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isAnd() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionAnd(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof And)) { + return false; + } + And tmp = (And) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 937 + 443 * lhs.hashCode() + 523 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } + public boolean isAnti() { + return false; + } + + static public class Anti extends Expression { + // Production: sig("Anti",[arg("org.rascalmpl.ast.Expression","pattern")],breakable=false) + + + private final org.rascalmpl.ast.Expression pattern; + + public Anti(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression pattern) { + super(src, node); + + this.pattern = pattern; + } + + @Override + public boolean isAnti() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionAnti(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = pattern.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + pattern.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Anti)) { + return false; + } + Anti tmp = (Anti) o; + return true && tmp.pattern.equals(this.pattern) ; + } + + @Override + public int hashCode() { + return 881 + 401 * pattern.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getPattern() { + return this.pattern; + } + + @Override + public boolean hasPattern() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(pattern)); + } + + } + public boolean isAny() { + return false; + } + + static public class Any extends Expression { + // Production: sig("Any",[arg("java.util.List\","generators")],breakable=false) + + + private final java.util.List generators; + + public Any(ISourceLocation src, IConstructor node , java.util.List generators) { + super(src, node); + + this.generators = generators; + } + + @Override + public boolean isAny() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionAny(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : generators) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Any)) { + return false; + } + Any tmp = (Any) o; + return true && tmp.generators.equals(this.generators) ; + } + + @Override + public int hashCode() { + return 953 + 2 * generators.hashCode() ; + } + + + @Override + public java.util.List getGenerators() { + return this.generators; + } + + @Override + public boolean hasGenerators() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(generators)); + } + + } + public boolean isAppendAfter() { + return false; + } + + static public class AppendAfter extends Expression { + // Production: sig("AppendAfter",[arg("org.rascalmpl.ast.Expression","lhs"),arg("org.rascalmpl.ast.Expression","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Expression lhs; + private final org.rascalmpl.ast.Expression rhs; + + public AppendAfter(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression lhs, org.rascalmpl.ast.Expression rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isAppendAfter() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionAppendAfter(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof AppendAfter)) { + return false; + } + AppendAfter tmp = (AppendAfter) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 271 + 599 * lhs.hashCode() + 383 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } + public boolean isAsType() { + return false; + } + + static public class AsType extends Expression { + // Production: sig("AsType",[arg("org.rascalmpl.ast.Type","type"),arg("org.rascalmpl.ast.Expression","argument")],breakable=false) + + + private final org.rascalmpl.ast.Type type; + private final org.rascalmpl.ast.Expression argument; + + public AsType(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Type type, org.rascalmpl.ast.Expression argument) { + super(src, node); + + this.type = type; + this.argument = argument; + } + + @Override + public boolean isAsType() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionAsType(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = type.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + type.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = argument.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + argument.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof AsType)) { + return false; + } + AsType tmp = (AsType) o; + return true && tmp.type.equals(this.type) && tmp.argument.equals(this.argument) ; + } + + @Override + public int hashCode() { + return 167 + 199 * type.hashCode() + 103 * argument.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Type getType() { + return this.type; + } + + @Override + public boolean hasType() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getArgument() { + return this.argument; + } + + @Override + public boolean hasArgument() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(type), clone(argument)); + } + + } + public boolean isBracket() { + return false; + } + + static public class Bracket extends Expression { + // Production: sig("Bracket",[arg("org.rascalmpl.ast.Expression","expression")],breakable=false) + + + private final org.rascalmpl.ast.Expression expression; + + public Bracket(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression expression) { + super(src, node); + + this.expression = expression; + } + + @Override + public boolean isBracket() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionBracket(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Bracket)) { + return false; + } + Bracket tmp = (Bracket) o; + return true && tmp.expression.equals(this.expression) ; + } + + @Override + public int hashCode() { + return 149 + 709 * expression.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(expression)); + } + + } + public boolean isCallOrTree() { + return false; + } + + static public class CallOrTree extends Expression { + // Production: sig("CallOrTree",[arg("org.rascalmpl.ast.Expression","expression"),arg("java.util.List\","arguments"),arg("org.rascalmpl.ast.KeywordArguments_Expression","keywordArguments")],breakable=false) + + + private final org.rascalmpl.ast.Expression expression; + private final java.util.List arguments; + private final org.rascalmpl.ast.KeywordArguments_Expression keywordArguments; + + public CallOrTree(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression expression, java.util.List arguments, org.rascalmpl.ast.KeywordArguments_Expression keywordArguments) { + super(src, node); + + this.expression = expression; + this.arguments = arguments; + this.keywordArguments = keywordArguments; + } + + @Override + public boolean isCallOrTree() { + return true; + } + + @Override + public boolean isBreakable() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionCallOrTree(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : arguments) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + $l = keywordArguments.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + keywordArguments.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof CallOrTree)) { + return false; + } + CallOrTree tmp = (CallOrTree) o; + return true && tmp.expression.equals(this.expression) && tmp.arguments.equals(this.arguments) && tmp.keywordArguments.equals(this.keywordArguments) ; + } + + @Override + public int hashCode() { + return 151 + 13 * expression.hashCode() + 997 * arguments.hashCode() + 373 * keywordArguments.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + @Override + public java.util.List getArguments() { + return this.arguments; + } + + @Override + public boolean hasArguments() { + return true; + } + @Override + public org.rascalmpl.ast.KeywordArguments_Expression getKeywordArguments() { + return this.keywordArguments; + } + + @Override + public boolean hasKeywordArguments() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(expression), clone(arguments), clone(keywordArguments)); + } + + } + public boolean isClosure() { + return false; + } + + static public class Closure extends Expression { + // Production: sig("Closure",[arg("org.rascalmpl.ast.Type","type"),arg("org.rascalmpl.ast.Parameters","parameters"),arg("java.util.List\","statements")],breakable=false) + + + private final org.rascalmpl.ast.Type type; + private final org.rascalmpl.ast.Parameters parameters; + private final java.util.List statements; + + public Closure(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Type type, org.rascalmpl.ast.Parameters parameters, java.util.List statements) { + super(src, node); + + this.type = type; + this.parameters = parameters; + this.statements = statements; + } + + @Override + public boolean isClosure() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionClosure(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = type.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + type.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = parameters.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + parameters.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : statements) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Closure)) { + return false; + } + Closure tmp = (Closure) o; + return true && tmp.type.equals(this.type) && tmp.parameters.equals(this.parameters) && tmp.statements.equals(this.statements) ; + } + + @Override + public int hashCode() { + return 257 + 271 * type.hashCode() + 811 * parameters.hashCode() + 67 * statements.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Type getType() { + return this.type; + } + + @Override + public boolean hasType() { + return true; + } + @Override + public org.rascalmpl.ast.Parameters getParameters() { + return this.parameters; + } + + @Override + public boolean hasParameters() { + return true; + } + @Override + public java.util.List getStatements() { + return this.statements; + } + + @Override + public boolean hasStatements() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(type), clone(parameters), clone(statements)); + } + + } + public boolean isComposition() { + return false; + } + + static public class Composition extends Expression { + // Production: sig("Composition",[arg("org.rascalmpl.ast.Expression","lhs"),arg("org.rascalmpl.ast.Expression","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Expression lhs; + private final org.rascalmpl.ast.Expression rhs; + + public Composition(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression lhs, org.rascalmpl.ast.Expression rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isComposition() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionComposition(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Composition)) { + return false; + } + Composition tmp = (Composition) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 643 + 251 * lhs.hashCode() + 521 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } + public boolean isComprehension() { + return false; + } + + static public class Comprehension extends Expression { + // Production: sig("Comprehension",[arg("org.rascalmpl.ast.Comprehension","comprehension")],breakable=false) + + + private final org.rascalmpl.ast.Comprehension comprehension; + + public Comprehension(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Comprehension comprehension) { + super(src, node); + + this.comprehension = comprehension; + } + + @Override + public boolean isComprehension() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionComprehension(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = comprehension.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + comprehension.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Comprehension)) { + return false; + } + Comprehension tmp = (Comprehension) o; + return true && tmp.comprehension.equals(this.comprehension) ; + } + + @Override + public int hashCode() { + return 797 + 131 * comprehension.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Comprehension getComprehension() { + return this.comprehension; + } + + @Override + public boolean hasComprehension() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(comprehension)); + } + + } + public boolean isConcrete() { + return false; + } + + static public class Concrete extends Expression { + // Production: sig("Concrete",[arg("org.rascalmpl.ast.Concrete","concrete")],breakable=false) + + + private final org.rascalmpl.ast.Concrete concrete; + + public Concrete(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Concrete concrete) { + super(src, node); + + this.concrete = concrete; + } + + @Override + public boolean isConcrete() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionConcrete(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = concrete.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + concrete.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Concrete)) { + return false; + } + Concrete tmp = (Concrete) o; + return true && tmp.concrete.equals(this.concrete) ; + } + + @Override + public int hashCode() { + return 499 + 73 * concrete.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Concrete getConcrete() { + return this.concrete; + } + + @Override + public boolean hasConcrete() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(concrete)); + } + + } + public boolean isDescendant() { + return false; + } + + static public class Descendant extends Expression { + // Production: sig("Descendant",[arg("org.rascalmpl.ast.Expression","pattern")],breakable=false) + + + private final org.rascalmpl.ast.Expression pattern; + + public Descendant(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression pattern) { + super(src, node); + + this.pattern = pattern; + } + + @Override + public boolean isDescendant() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionDescendant(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = pattern.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + pattern.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Descendant)) { + return false; + } + Descendant tmp = (Descendant) o; + return true && tmp.pattern.equals(this.pattern) ; + } + + @Override + public int hashCode() { + return 877 + 757 * pattern.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getPattern() { + return this.pattern; + } + + @Override + public boolean hasPattern() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(pattern)); + } + + } + public boolean isDivision() { + return false; + } + + static public class Division extends Expression { + // Production: sig("Division",[arg("org.rascalmpl.ast.Expression","lhs"),arg("org.rascalmpl.ast.Expression","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Expression lhs; + private final org.rascalmpl.ast.Expression rhs; + + public Division(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression lhs, org.rascalmpl.ast.Expression rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isDivision() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionDivision(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Division)) { + return false; + } + Division tmp = (Division) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 269 + 241 * lhs.hashCode() + 353 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } + public boolean isEnumerator() { + return false; + } + + static public class Enumerator extends Expression { + // Production: sig("Enumerator",[arg("org.rascalmpl.ast.Expression","pattern"),arg("org.rascalmpl.ast.Expression","expression")],breakable=false) + + + private final org.rascalmpl.ast.Expression pattern; + private final org.rascalmpl.ast.Expression expression; + + public Enumerator(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression pattern, org.rascalmpl.ast.Expression expression) { + super(src, node); + + this.pattern = pattern; + this.expression = expression; + } + + @Override + public boolean isEnumerator() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionEnumerator(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = pattern.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + pattern.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Enumerator)) { + return false; + } + Enumerator tmp = (Enumerator) o; + return true && tmp.pattern.equals(this.pattern) && tmp.expression.equals(this.expression) ; + } + + @Override + public int hashCode() { + return 229 + 659 * pattern.hashCode() + 743 * expression.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getPattern() { + return this.pattern; + } + + @Override + public boolean hasPattern() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(pattern), clone(expression)); + } + + } + public boolean isEquals() { + return false; + } + + static public class Equals extends Expression { + // Production: sig("Equals",[arg("org.rascalmpl.ast.Expression","lhs"),arg("org.rascalmpl.ast.Expression","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Expression lhs; + private final org.rascalmpl.ast.Expression rhs; + + public Equals(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression lhs, org.rascalmpl.ast.Expression rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isEquals() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionEquals(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Equals)) { + return false; + } + Equals tmp = (Equals) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 223 + 193 * lhs.hashCode() + 743 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } + public boolean isEquivalence() { + return false; + } + + static public class Equivalence extends Expression { + // Production: sig("Equivalence",[arg("org.rascalmpl.ast.Expression","lhs"),arg("org.rascalmpl.ast.Expression","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Expression lhs; + private final org.rascalmpl.ast.Expression rhs; + + public Equivalence(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression lhs, org.rascalmpl.ast.Expression rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isEquivalence() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionEquivalence(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Equivalence)) { + return false; + } + Equivalence tmp = (Equivalence) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 863 + 263 * lhs.hashCode() + 151 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } + public boolean isFieldAccess() { + return false; + } + + static public class FieldAccess extends Expression { + // Production: sig("FieldAccess",[arg("org.rascalmpl.ast.Expression","expression"),arg("org.rascalmpl.ast.Name","field")],breakable=false) + + + private final org.rascalmpl.ast.Expression expression; + private final org.rascalmpl.ast.Name field; + + public FieldAccess(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression expression, org.rascalmpl.ast.Name field) { + super(src, node); + + this.expression = expression; + this.field = field; + } + + @Override + public boolean isFieldAccess() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionFieldAccess(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = field.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + field.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof FieldAccess)) { + return false; + } + FieldAccess tmp = (FieldAccess) o; + return true && tmp.expression.equals(this.expression) && tmp.field.equals(this.field) ; + } + + @Override + public int hashCode() { + return 421 + 619 * expression.hashCode() + 179 * field.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + @Override + public org.rascalmpl.ast.Name getField() { + return this.field; + } + + @Override + public boolean hasField() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(expression), clone(field)); + } + + } + public boolean isFieldProject() { + return false; + } + + static public class FieldProject extends Expression { + // Production: sig("FieldProject",[arg("org.rascalmpl.ast.Expression","expression"),arg("java.util.List\","fields")],breakable=false) + + + private final org.rascalmpl.ast.Expression expression; + private final java.util.List fields; + + public FieldProject(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression expression, java.util.List fields) { + super(src, node); + + this.expression = expression; + this.fields = fields; + } + + @Override + public boolean isFieldProject() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionFieldProject(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : fields) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof FieldProject)) { + return false; + } + FieldProject tmp = (FieldProject) o; + return true && tmp.expression.equals(this.expression) && tmp.fields.equals(this.fields) ; + } + + @Override + public int hashCode() { + return 757 + 991 * expression.hashCode() + 71 * fields.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + @Override + public java.util.List getFields() { + return this.fields; + } + + @Override + public boolean hasFields() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(expression), clone(fields)); + } + + } + public boolean isFieldUpdate() { + return false; + } + + static public class FieldUpdate extends Expression { + // Production: sig("FieldUpdate",[arg("org.rascalmpl.ast.Expression","expression"),arg("org.rascalmpl.ast.Name","key"),arg("org.rascalmpl.ast.Expression","replacement")],breakable=false) + + + private final org.rascalmpl.ast.Expression expression; + private final org.rascalmpl.ast.Name key; + private final org.rascalmpl.ast.Expression replacement; + + public FieldUpdate(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression expression, org.rascalmpl.ast.Name key, org.rascalmpl.ast.Expression replacement) { + super(src, node); + + this.expression = expression; + this.key = key; + this.replacement = replacement; + } + + @Override + public boolean isFieldUpdate() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionFieldUpdate(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = key.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + key.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = replacement.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + replacement.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof FieldUpdate)) { + return false; + } + FieldUpdate tmp = (FieldUpdate) o; + return true && tmp.expression.equals(this.expression) && tmp.key.equals(this.key) && tmp.replacement.equals(this.replacement) ; + } + + @Override + public int hashCode() { + return 199 + 3 * expression.hashCode() + 991 * key.hashCode() + 541 * replacement.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + @Override + public org.rascalmpl.ast.Name getKey() { + return this.key; + } + + @Override + public boolean hasKey() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getReplacement() { + return this.replacement; + } + + @Override + public boolean hasReplacement() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(expression), clone(key), clone(replacement)); + } + + } + public boolean isGetAnnotation() { + return false; + } + + static public class GetAnnotation extends Expression { + // Production: sig("GetAnnotation",[arg("org.rascalmpl.ast.Expression","expression"),arg("org.rascalmpl.ast.Name","name")],breakable=false) + + + private final org.rascalmpl.ast.Expression expression; + private final org.rascalmpl.ast.Name name; + + public GetAnnotation(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression expression, org.rascalmpl.ast.Name name) { + super(src, node); + + this.expression = expression; + this.name = name; + } + + @Override + public boolean isGetAnnotation() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionGetAnnotation(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof GetAnnotation)) { + return false; + } + GetAnnotation tmp = (GetAnnotation) o; + return true && tmp.expression.equals(this.expression) && tmp.name.equals(this.name) ; + } + + @Override + public int hashCode() { + return 467 + 7 * expression.hashCode() + 809 * name.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + @Override + public org.rascalmpl.ast.Name getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(expression), clone(name)); + } + + } + public boolean isGreaterThan() { + return false; + } + + static public class GreaterThan extends Expression { + // Production: sig("GreaterThan",[arg("org.rascalmpl.ast.Expression","lhs"),arg("org.rascalmpl.ast.Expression","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Expression lhs; + private final org.rascalmpl.ast.Expression rhs; + + public GreaterThan(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression lhs, org.rascalmpl.ast.Expression rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isGreaterThan() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionGreaterThan(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof GreaterThan)) { + return false; + } + GreaterThan tmp = (GreaterThan) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 401 + 953 * lhs.hashCode() + 967 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } + public boolean isGreaterThanOrEq() { + return false; + } + + static public class GreaterThanOrEq extends Expression { + // Production: sig("GreaterThanOrEq",[arg("org.rascalmpl.ast.Expression","lhs"),arg("org.rascalmpl.ast.Expression","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Expression lhs; + private final org.rascalmpl.ast.Expression rhs; + + public GreaterThanOrEq(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression lhs, org.rascalmpl.ast.Expression rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isGreaterThanOrEq() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionGreaterThanOrEq(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof GreaterThanOrEq)) { + return false; + } + GreaterThanOrEq tmp = (GreaterThanOrEq) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 797 + 709 * lhs.hashCode() + 223 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } + public boolean isHas() { + return false; + } + + static public class Has extends Expression { + // Production: sig("Has",[arg("org.rascalmpl.ast.Expression","expression"),arg("org.rascalmpl.ast.Name","name")],breakable=false) + + + private final org.rascalmpl.ast.Expression expression; + private final org.rascalmpl.ast.Name name; + + public Has(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression expression, org.rascalmpl.ast.Name name) { + super(src, node); + + this.expression = expression; + this.name = name; + } + + @Override + public boolean isHas() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionHas(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Has)) { + return false; + } + Has tmp = (Has) o; + return true && tmp.expression.equals(this.expression) && tmp.name.equals(this.name) ; + } + + @Override + public int hashCode() { + return 499 + 227 * expression.hashCode() + 577 * name.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + @Override + public org.rascalmpl.ast.Name getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(expression), clone(name)); + } + + } + public boolean isIfDefinedOtherwise() { + return false; + } + + static public class IfDefinedOtherwise extends Expression { + // Production: sig("IfDefinedOtherwise",[arg("org.rascalmpl.ast.Expression","lhs"),arg("org.rascalmpl.ast.Expression","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Expression lhs; + private final org.rascalmpl.ast.Expression rhs; + + public IfDefinedOtherwise(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression lhs, org.rascalmpl.ast.Expression rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isIfDefinedOtherwise() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionIfDefinedOtherwise(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof IfDefinedOtherwise)) { + return false; + } + IfDefinedOtherwise tmp = (IfDefinedOtherwise) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 163 + 151 * lhs.hashCode() + 467 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } + public boolean isIfThenElse() { + return false; + } + + static public class IfThenElse extends Expression { + // Production: sig("IfThenElse",[arg("org.rascalmpl.ast.Expression","condition"),arg("org.rascalmpl.ast.Expression","thenExp"),arg("org.rascalmpl.ast.Expression","elseExp")],breakable=false) + + + private final org.rascalmpl.ast.Expression condition; + private final org.rascalmpl.ast.Expression thenExp; + private final org.rascalmpl.ast.Expression elseExp; + + public IfThenElse(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression condition, org.rascalmpl.ast.Expression thenExp, org.rascalmpl.ast.Expression elseExp) { + super(src, node); + + this.condition = condition; + this.thenExp = thenExp; + this.elseExp = elseExp; + } + + @Override + public boolean isIfThenElse() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionIfThenElse(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = condition.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + condition.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = thenExp.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + thenExp.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = elseExp.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + elseExp.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof IfThenElse)) { + return false; + } + IfThenElse tmp = (IfThenElse) o; + return true && tmp.condition.equals(this.condition) && tmp.thenExp.equals(this.thenExp) && tmp.elseExp.equals(this.elseExp) ; + } + + @Override + public int hashCode() { + return 641 + 887 * condition.hashCode() + 491 * thenExp.hashCode() + 619 * elseExp.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getCondition() { + return this.condition; + } + + @Override + public boolean hasCondition() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getThenExp() { + return this.thenExp; + } + + @Override + public boolean hasThenExp() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getElseExp() { + return this.elseExp; + } + + @Override + public boolean hasElseExp() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(condition), clone(thenExp), clone(elseExp)); + } + + } + public boolean isImplication() { + return false; + } + + static public class Implication extends Expression { + // Production: sig("Implication",[arg("org.rascalmpl.ast.Expression","lhs"),arg("org.rascalmpl.ast.Expression","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Expression lhs; + private final org.rascalmpl.ast.Expression rhs; + + public Implication(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression lhs, org.rascalmpl.ast.Expression rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isImplication() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionImplication(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Implication)) { + return false; + } + Implication tmp = (Implication) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 421 + 79 * lhs.hashCode() + 173 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } + public boolean isIn() { + return false; + } + + static public class In extends Expression { + // Production: sig("In",[arg("org.rascalmpl.ast.Expression","lhs"),arg("org.rascalmpl.ast.Expression","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Expression lhs; + private final org.rascalmpl.ast.Expression rhs; + + public In(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression lhs, org.rascalmpl.ast.Expression rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isIn() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionIn(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof In)) { + return false; + } + In tmp = (In) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 911 + 239 * lhs.hashCode() + 613 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } + public boolean isInsertBefore() { + return false; + } + + static public class InsertBefore extends Expression { + // Production: sig("InsertBefore",[arg("org.rascalmpl.ast.Expression","lhs"),arg("org.rascalmpl.ast.Expression","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Expression lhs; + private final org.rascalmpl.ast.Expression rhs; + + public InsertBefore(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression lhs, org.rascalmpl.ast.Expression rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isInsertBefore() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionInsertBefore(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof InsertBefore)) { + return false; + } + InsertBefore tmp = (InsertBefore) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 71 + 167 * lhs.hashCode() + 491 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } + public boolean isIntersection() { + return false; + } + + static public class Intersection extends Expression { + // Production: sig("Intersection",[arg("org.rascalmpl.ast.Expression","lhs"),arg("org.rascalmpl.ast.Expression","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Expression lhs; + private final org.rascalmpl.ast.Expression rhs; + + public Intersection(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression lhs, org.rascalmpl.ast.Expression rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isIntersection() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionIntersection(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Intersection)) { + return false; + } + Intersection tmp = (Intersection) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 509 + 179 * lhs.hashCode() + 773 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } + public boolean isIs() { + return false; + } + + static public class Is extends Expression { + // Production: sig("Is",[arg("org.rascalmpl.ast.Expression","expression"),arg("org.rascalmpl.ast.Name","name")],breakable=false) + + + private final org.rascalmpl.ast.Expression expression; + private final org.rascalmpl.ast.Name name; + + public Is(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression expression, org.rascalmpl.ast.Name name) { + super(src, node); + + this.expression = expression; + this.name = name; + } + + @Override + public boolean isIs() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionIs(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Is)) { + return false; + } + Is tmp = (Is) o; + return true && tmp.expression.equals(this.expression) && tmp.name.equals(this.name) ; + } + + @Override + public int hashCode() { + return 337 + 181 * expression.hashCode() + 911 * name.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + @Override + public org.rascalmpl.ast.Name getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(expression), clone(name)); + } + + } + public boolean isIsDefined() { + return false; + } + + static public class IsDefined extends Expression { + // Production: sig("IsDefined",[arg("org.rascalmpl.ast.Expression","argument")],breakable=false) + + + private final org.rascalmpl.ast.Expression argument; + + public IsDefined(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression argument) { + super(src, node); + + this.argument = argument; + } + + @Override + public boolean isIsDefined() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionIsDefined(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = argument.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + argument.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof IsDefined)) { + return false; + } + IsDefined tmp = (IsDefined) o; + return true && tmp.argument.equals(this.argument) ; + } + + @Override + public int hashCode() { + return 239 + 401 * argument.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getArgument() { + return this.argument; + } + + @Override + public boolean hasArgument() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(argument)); + } + + } + public boolean isIt() { + return false; + } + + static public class It extends Expression { + // Production: sig("It",[],breakable=false) + + + + public It(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isIt() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionIt(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof It)) { + return false; + } + It tmp = (It) o; + return true ; + } + + @Override + public int hashCode() { + return 607 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isJoin() { + return false; + } + + static public class Join extends Expression { + // Production: sig("Join",[arg("org.rascalmpl.ast.Expression","lhs"),arg("org.rascalmpl.ast.Expression","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Expression lhs; + private final org.rascalmpl.ast.Expression rhs; + + public Join(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression lhs, org.rascalmpl.ast.Expression rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isJoin() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionJoin(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Join)) { + return false; + } + Join tmp = (Join) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 599 + 283 * lhs.hashCode() + 881 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } + public boolean isLessThan() { + return false; + } + + static public class LessThan extends Expression { + // Production: sig("LessThan",[arg("org.rascalmpl.ast.Expression","lhs"),arg("org.rascalmpl.ast.Expression","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Expression lhs; + private final org.rascalmpl.ast.Expression rhs; + + public LessThan(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression lhs, org.rascalmpl.ast.Expression rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isLessThan() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionLessThan(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof LessThan)) { + return false; + } + LessThan tmp = (LessThan) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 449 + 457 * lhs.hashCode() + 967 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } + public boolean isLessThanOrEq() { + return false; + } + + static public class LessThanOrEq extends Expression { + // Production: sig("LessThanOrEq",[arg("org.rascalmpl.ast.Expression","lhs"),arg("org.rascalmpl.ast.Expression","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Expression lhs; + private final org.rascalmpl.ast.Expression rhs; + + public LessThanOrEq(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression lhs, org.rascalmpl.ast.Expression rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isLessThanOrEq() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionLessThanOrEq(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof LessThanOrEq)) { + return false; + } + LessThanOrEq tmp = (LessThanOrEq) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 991 + 683 * lhs.hashCode() + 31 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } + public boolean isList() { + return false; + } + + static public class List extends Expression { + // Production: sig("List",[arg("java.util.List\","elements0")],breakable=false) + + + private final java.util.List elements0; + + public List(ISourceLocation src, IConstructor node , java.util.List elements0) { + super(src, node); + + this.elements0 = elements0; + } + + @Override + public boolean isList() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionList(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : elements0) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof List)) { + return false; + } + List tmp = (List) o; + return true && tmp.elements0.equals(this.elements0) ; + } + + @Override + public int hashCode() { + return 71 + 223 * elements0.hashCode() ; + } + + + @Override + public java.util.List getElements0() { + return this.elements0; + } + + @Override + public boolean hasElements0() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(elements0)); + } + + } + public boolean isLiteral() { + return false; + } + + static public class Literal extends Expression { + // Production: sig("Literal",[arg("org.rascalmpl.ast.Literal","literal")],breakable=false) + + + private final org.rascalmpl.ast.Literal literal; + + public Literal(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Literal literal) { + super(src, node); + + this.literal = literal; + } + + @Override + public boolean isLiteral() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionLiteral(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = literal.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + literal.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Literal)) { + return false; + } + Literal tmp = (Literal) o; + return true && tmp.literal.equals(this.literal) ; + } + + @Override + public int hashCode() { + return 919 + 139 * literal.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Literal getLiteral() { + return this.literal; + } + + @Override + public boolean hasLiteral() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(literal)); + } + + } + public boolean isMap() { + return false; + } + + static public class Map extends Expression { + // Production: sig("Map",[arg("java.util.List\","mappings")],breakable=false) + + + private final java.util.List mappings; + + public Map(ISourceLocation src, IConstructor node , java.util.List mappings) { + super(src, node); + + this.mappings = mappings; + } + + @Override + public boolean isMap() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionMap(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : mappings) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Map)) { + return false; + } + Map tmp = (Map) o; + return true && tmp.mappings.equals(this.mappings) ; + } + + @Override + public int hashCode() { + return 907 + 467 * mappings.hashCode() ; + } + + + @Override + public java.util.List getMappings() { + return this.mappings; + } + + @Override + public boolean hasMappings() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(mappings)); + } + + } + public boolean isMatch() { + return false; + } + + static public class Match extends Expression { + // Production: sig("Match",[arg("org.rascalmpl.ast.Expression","pattern"),arg("org.rascalmpl.ast.Expression","expression")],breakable=false) + + + private final org.rascalmpl.ast.Expression pattern; + private final org.rascalmpl.ast.Expression expression; + + public Match(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression pattern, org.rascalmpl.ast.Expression expression) { + super(src, node); + + this.pattern = pattern; + this.expression = expression; + } + + @Override + public boolean isMatch() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionMatch(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = pattern.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + pattern.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Match)) { + return false; + } + Match tmp = (Match) o; + return true && tmp.pattern.equals(this.pattern) && tmp.expression.equals(this.expression) ; + } + + @Override + public int hashCode() { + return 971 + 811 * pattern.hashCode() + 199 * expression.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getPattern() { + return this.pattern; + } + + @Override + public boolean hasPattern() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(pattern), clone(expression)); + } + + } + public boolean isModulo() { + return false; + } + + static public class Modulo extends Expression { + // Production: sig("Modulo",[arg("org.rascalmpl.ast.Expression","lhs"),arg("org.rascalmpl.ast.Expression","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Expression lhs; + private final org.rascalmpl.ast.Expression rhs; + + public Modulo(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression lhs, org.rascalmpl.ast.Expression rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isModulo() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionModulo(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Modulo)) { + return false; + } + Modulo tmp = (Modulo) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 307 + 2 * lhs.hashCode() + 67 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } + public boolean isMultiVariable() { + return false; + } + + static public class MultiVariable extends Expression { + // Production: sig("MultiVariable",[arg("org.rascalmpl.ast.QualifiedName","qualifiedName")],breakable=false) + + + private final org.rascalmpl.ast.QualifiedName qualifiedName; + + public MultiVariable(ISourceLocation src, IConstructor node , org.rascalmpl.ast.QualifiedName qualifiedName) { + super(src, node); + + this.qualifiedName = qualifiedName; + } + + @Override + public boolean isMultiVariable() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionMultiVariable(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = qualifiedName.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + qualifiedName.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof MultiVariable)) { + return false; + } + MultiVariable tmp = (MultiVariable) o; + return true && tmp.qualifiedName.equals(this.qualifiedName) ; + } + + @Override + public int hashCode() { + return 641 + 233 * qualifiedName.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.QualifiedName getQualifiedName() { + return this.qualifiedName; + } + + @Override + public boolean hasQualifiedName() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(qualifiedName)); + } + + } + public boolean isNegation() { + return false; + } + + static public class Negation extends Expression { + // Production: sig("Negation",[arg("org.rascalmpl.ast.Expression","argument")],breakable=false) + + + private final org.rascalmpl.ast.Expression argument; + + public Negation(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression argument) { + super(src, node); + + this.argument = argument; + } + + @Override + public boolean isNegation() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionNegation(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = argument.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + argument.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Negation)) { + return false; + } + Negation tmp = (Negation) o; + return true && tmp.argument.equals(this.argument) ; + } + + @Override + public int hashCode() { + return 37 + 251 * argument.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getArgument() { + return this.argument; + } + + @Override + public boolean hasArgument() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(argument)); + } + + } + public boolean isNegative() { + return false; + } + + static public class Negative extends Expression { + // Production: sig("Negative",[arg("org.rascalmpl.ast.Expression","argument")],breakable=false) + + + private final org.rascalmpl.ast.Expression argument; + + public Negative(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression argument) { + super(src, node); + + this.argument = argument; + } + + @Override + public boolean isNegative() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionNegative(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = argument.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + argument.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Negative)) { + return false; + } + Negative tmp = (Negative) o; + return true && tmp.argument.equals(this.argument) ; + } + + @Override + public int hashCode() { + return 239 + 569 * argument.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getArgument() { + return this.argument; + } + + @Override + public boolean hasArgument() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(argument)); + } + + } + public boolean isNoMatch() { + return false; + } + + static public class NoMatch extends Expression { + // Production: sig("NoMatch",[arg("org.rascalmpl.ast.Expression","pattern"),arg("org.rascalmpl.ast.Expression","expression")],breakable=false) + + + private final org.rascalmpl.ast.Expression pattern; + private final org.rascalmpl.ast.Expression expression; + + public NoMatch(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression pattern, org.rascalmpl.ast.Expression expression) { + super(src, node); + + this.pattern = pattern; + this.expression = expression; + } + + @Override + public boolean isNoMatch() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionNoMatch(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = pattern.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + pattern.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof NoMatch)) { + return false; + } + NoMatch tmp = (NoMatch) o; + return true && tmp.pattern.equals(this.pattern) && tmp.expression.equals(this.expression) ; + } + + @Override + public int hashCode() { + return 61 + 3 * pattern.hashCode() + 503 * expression.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getPattern() { + return this.pattern; + } + + @Override + public boolean hasPattern() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(pattern), clone(expression)); + } + + } + public boolean isNonEmptyBlock() { + return false; + } + + static public class NonEmptyBlock extends Expression { + // Production: sig("NonEmptyBlock",[arg("java.util.List\","statements")],breakable=false) + + + private final java.util.List statements; + + public NonEmptyBlock(ISourceLocation src, IConstructor node , java.util.List statements) { + super(src, node); + + this.statements = statements; + } + + @Override + public boolean isNonEmptyBlock() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionNonEmptyBlock(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : statements) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof NonEmptyBlock)) { + return false; + } + NonEmptyBlock tmp = (NonEmptyBlock) o; + return true && tmp.statements.equals(this.statements) ; + } + + @Override + public int hashCode() { + return 757 + 877 * statements.hashCode() ; + } + + + @Override + public java.util.List getStatements() { + return this.statements; + } + + @Override + public boolean hasStatements() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(statements)); + } + + } + public boolean isNonEquals() { + return false; + } + + static public class NonEquals extends Expression { + // Production: sig("NonEquals",[arg("org.rascalmpl.ast.Expression","lhs"),arg("org.rascalmpl.ast.Expression","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Expression lhs; + private final org.rascalmpl.ast.Expression rhs; + + public NonEquals(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression lhs, org.rascalmpl.ast.Expression rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isNonEquals() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionNonEquals(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof NonEquals)) { + return false; + } + NonEquals tmp = (NonEquals) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 331 + 2 * lhs.hashCode() + 577 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } + public boolean isNotIn() { + return false; + } + + static public class NotIn extends Expression { + // Production: sig("NotIn",[arg("org.rascalmpl.ast.Expression","lhs"),arg("org.rascalmpl.ast.Expression","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Expression lhs; + private final org.rascalmpl.ast.Expression rhs; + + public NotIn(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression lhs, org.rascalmpl.ast.Expression rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isNotIn() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionNotIn(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof NotIn)) { + return false; + } + NotIn tmp = (NotIn) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 3 + 521 * lhs.hashCode() + 31 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } + public boolean isOr() { + return false; + } + + static public class Or extends Expression { + // Production: sig("Or",[arg("org.rascalmpl.ast.Expression","lhs"),arg("org.rascalmpl.ast.Expression","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Expression lhs; + private final org.rascalmpl.ast.Expression rhs; + + public Or(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression lhs, org.rascalmpl.ast.Expression rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isOr() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionOr(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Or)) { + return false; + } + Or tmp = (Or) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 23 + 863 * lhs.hashCode() + 5 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } + public boolean isProduct() { + return false; + } + + static public class Product extends Expression { + // Production: sig("Product",[arg("org.rascalmpl.ast.Expression","lhs"),arg("org.rascalmpl.ast.Expression","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Expression lhs; + private final org.rascalmpl.ast.Expression rhs; + + public Product(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression lhs, org.rascalmpl.ast.Expression rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isProduct() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionProduct(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Product)) { + return false; + } + Product tmp = (Product) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 313 + 853 * lhs.hashCode() + 151 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } + public boolean isQualifiedName() { + return false; + } + + static public class QualifiedName extends Expression { + // Production: sig("QualifiedName",[arg("org.rascalmpl.ast.QualifiedName","qualifiedName")],breakable=false) + + + private final org.rascalmpl.ast.QualifiedName qualifiedName; + + public QualifiedName(ISourceLocation src, IConstructor node , org.rascalmpl.ast.QualifiedName qualifiedName) { + super(src, node); + + this.qualifiedName = qualifiedName; + } + + @Override + public boolean isQualifiedName() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionQualifiedName(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = qualifiedName.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + qualifiedName.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof QualifiedName)) { + return false; + } + QualifiedName tmp = (QualifiedName) o; + return true && tmp.qualifiedName.equals(this.qualifiedName) ; + } + + @Override + public int hashCode() { + return 761 + 641 * qualifiedName.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.QualifiedName getQualifiedName() { + return this.qualifiedName; + } + + @Override + public boolean hasQualifiedName() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(qualifiedName)); + } + + } + public boolean isRange() { + return false; + } + + static public class Range extends Expression { + // Production: sig("Range",[arg("org.rascalmpl.ast.Expression","first"),arg("org.rascalmpl.ast.Expression","last")],breakable=false) + + + private final org.rascalmpl.ast.Expression first; + private final org.rascalmpl.ast.Expression last; + + public Range(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression first, org.rascalmpl.ast.Expression last) { + super(src, node); + + this.first = first; + this.last = last; + } + + @Override + public boolean isRange() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionRange(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = first.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + first.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = last.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + last.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Range)) { + return false; + } + Range tmp = (Range) o; + return true && tmp.first.equals(this.first) && tmp.last.equals(this.last) ; + } + + @Override + public int hashCode() { + return 163 + 647 * first.hashCode() + 269 * last.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getFirst() { + return this.first; + } + + @Override + public boolean hasFirst() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getLast() { + return this.last; + } + + @Override + public boolean hasLast() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(first), clone(last)); + } + + } + public boolean isReducer() { + return false; + } + + static public class Reducer extends Expression { + // Production: sig("Reducer",[arg("org.rascalmpl.ast.Expression","init"),arg("org.rascalmpl.ast.Expression","result"),arg("java.util.List\","generators")],breakable=false) + + + private final org.rascalmpl.ast.Expression init; + private final org.rascalmpl.ast.Expression result; + private final java.util.List generators; + + public Reducer(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression init, org.rascalmpl.ast.Expression result, java.util.List generators) { + super(src, node); + + this.init = init; + this.result = result; + this.generators = generators; + } + + @Override + public boolean isReducer() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionReducer(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = init.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + init.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = result.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + result.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : generators) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Reducer)) { + return false; + } + Reducer tmp = (Reducer) o; + return true && tmp.init.equals(this.init) && tmp.result.equals(this.result) && tmp.generators.equals(this.generators) ; + } + + @Override + public int hashCode() { + return 107 + 163 * init.hashCode() + 17 * result.hashCode() + 443 * generators.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getInit() { + return this.init; + } + + @Override + public boolean hasInit() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getResult() { + return this.result; + } + + @Override + public boolean hasResult() { + return true; + } + @Override + public java.util.List getGenerators() { + return this.generators; + } + + @Override + public boolean hasGenerators() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(init), clone(result), clone(generators)); + } + + } + public boolean isReifiedType() { + return false; + } + + static public class ReifiedType extends Expression { + // Production: sig("ReifiedType",[arg("org.rascalmpl.ast.Expression","symbol"),arg("org.rascalmpl.ast.Expression","definitions")],breakable=false) + + + private final org.rascalmpl.ast.Expression symbol; + private final org.rascalmpl.ast.Expression definitions; + + public ReifiedType(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression symbol, org.rascalmpl.ast.Expression definitions) { + super(src, node); + + this.symbol = symbol; + this.definitions = definitions; + } + + @Override + public boolean isReifiedType() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionReifiedType(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = symbol.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + symbol.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = definitions.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + definitions.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof ReifiedType)) { + return false; + } + ReifiedType tmp = (ReifiedType) o; + return true && tmp.symbol.equals(this.symbol) && tmp.definitions.equals(this.definitions) ; + } + + @Override + public int hashCode() { + return 23 + 17 * symbol.hashCode() + 557 * definitions.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getSymbol() { + return this.symbol; + } + + @Override + public boolean hasSymbol() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getDefinitions() { + return this.definitions; + } + + @Override + public boolean hasDefinitions() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(symbol), clone(definitions)); + } + + } + public boolean isReifyType() { + return false; + } + + static public class ReifyType extends Expression { + // Production: sig("ReifyType",[arg("org.rascalmpl.ast.Type","type")],breakable=false) + + + private final org.rascalmpl.ast.Type type; + + public ReifyType(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Type type) { + super(src, node); + + this.type = type; + } + + @Override + public boolean isReifyType() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionReifyType(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = type.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + type.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof ReifyType)) { + return false; + } + ReifyType tmp = (ReifyType) o; + return true && tmp.type.equals(this.type) ; + } + + @Override + public int hashCode() { + return 251 + 191 * type.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Type getType() { + return this.type; + } + + @Override + public boolean hasType() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(type)); + } + + } + public boolean isRemainder() { + return false; + } + + static public class Remainder extends Expression { + // Production: sig("Remainder",[arg("org.rascalmpl.ast.Expression","lhs"),arg("org.rascalmpl.ast.Expression","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Expression lhs; + private final org.rascalmpl.ast.Expression rhs; + + public Remainder(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression lhs, org.rascalmpl.ast.Expression rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isRemainder() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionRemainder(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Remainder)) { + return false; + } + Remainder tmp = (Remainder) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 563 + 23 * lhs.hashCode() + 953 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } + public boolean isSet() { + return false; + } + + static public class Set extends Expression { + // Production: sig("Set",[arg("java.util.List\","elements0")],breakable=false) + + + private final java.util.List elements0; + + public Set(ISourceLocation src, IConstructor node , java.util.List elements0) { + super(src, node); + + this.elements0 = elements0; + } + + @Override + public boolean isSet() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionSet(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : elements0) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Set)) { + return false; + } + Set tmp = (Set) o; + return true && tmp.elements0.equals(this.elements0) ; + } + + @Override + public int hashCode() { + return 863 + 521 * elements0.hashCode() ; + } + + + @Override + public java.util.List getElements0() { + return this.elements0; + } + + @Override + public boolean hasElements0() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(elements0)); + } + + } + public boolean isSetAnnotation() { + return false; + } + + static public class SetAnnotation extends Expression { + // Production: sig("SetAnnotation",[arg("org.rascalmpl.ast.Expression","expression"),arg("org.rascalmpl.ast.Name","name"),arg("org.rascalmpl.ast.Expression","value")],breakable=false) + + + private final org.rascalmpl.ast.Expression expression; + private final org.rascalmpl.ast.Name name; + private final org.rascalmpl.ast.Expression value; + + public SetAnnotation(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression expression, org.rascalmpl.ast.Name name, org.rascalmpl.ast.Expression value) { + super(src, node); + + this.expression = expression; + this.name = name; + this.value = value; + } + + @Override + public boolean isSetAnnotation() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionSetAnnotation(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = value.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + value.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof SetAnnotation)) { + return false; + } + SetAnnotation tmp = (SetAnnotation) o; + return true && tmp.expression.equals(this.expression) && tmp.name.equals(this.name) && tmp.value.equals(this.value) ; + } + + @Override + public int hashCode() { + return 977 + 269 * expression.hashCode() + 373 * name.hashCode() + 373 * value.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + @Override + public org.rascalmpl.ast.Name getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getValue() { + return this.value; + } + + @Override + public boolean hasValue() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(expression), clone(name), clone(value)); + } + + } + public boolean isSlice() { + return false; + } + + static public class Slice extends Expression { + // Production: sig("Slice",[arg("org.rascalmpl.ast.Expression","expression"),arg("org.rascalmpl.ast.OptionalExpression","optFirst"),arg("org.rascalmpl.ast.OptionalExpression","optLast")],breakable=false) + + + private final org.rascalmpl.ast.Expression expression; + private final org.rascalmpl.ast.OptionalExpression optFirst; + private final org.rascalmpl.ast.OptionalExpression optLast; + + public Slice(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression expression, org.rascalmpl.ast.OptionalExpression optFirst, org.rascalmpl.ast.OptionalExpression optLast) { + super(src, node); + + this.expression = expression; + this.optFirst = optFirst; + this.optLast = optLast; + } + + @Override + public boolean isSlice() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionSlice(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = optFirst.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + optFirst.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = optLast.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + optLast.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Slice)) { + return false; + } + Slice tmp = (Slice) o; + return true && tmp.expression.equals(this.expression) && tmp.optFirst.equals(this.optFirst) && tmp.optLast.equals(this.optLast) ; + } + + @Override + public int hashCode() { + return 809 + 103 * expression.hashCode() + 79 * optFirst.hashCode() + 67 * optLast.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + @Override + public org.rascalmpl.ast.OptionalExpression getOptFirst() { + return this.optFirst; + } + + @Override + public boolean hasOptFirst() { + return true; + } + @Override + public org.rascalmpl.ast.OptionalExpression getOptLast() { + return this.optLast; + } + + @Override + public boolean hasOptLast() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(expression), clone(optFirst), clone(optLast)); + } + + } + public boolean isSliceStep() { + return false; + } + + static public class SliceStep extends Expression { + // Production: sig("SliceStep",[arg("org.rascalmpl.ast.Expression","expression"),arg("org.rascalmpl.ast.OptionalExpression","optFirst"),arg("org.rascalmpl.ast.Expression","second"),arg("org.rascalmpl.ast.OptionalExpression","optLast")],breakable=false) + + + private final org.rascalmpl.ast.Expression expression; + private final org.rascalmpl.ast.OptionalExpression optFirst; + private final org.rascalmpl.ast.Expression second; + private final org.rascalmpl.ast.OptionalExpression optLast; + + public SliceStep(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression expression, org.rascalmpl.ast.OptionalExpression optFirst, org.rascalmpl.ast.Expression second, org.rascalmpl.ast.OptionalExpression optLast) { + super(src, node); + + this.expression = expression; + this.optFirst = optFirst; + this.second = second; + this.optLast = optLast; + } + + @Override + public boolean isSliceStep() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionSliceStep(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = optFirst.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + optFirst.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = second.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + second.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = optLast.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + optLast.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof SliceStep)) { + return false; + } + SliceStep tmp = (SliceStep) o; + return true && tmp.expression.equals(this.expression) && tmp.optFirst.equals(this.optFirst) && tmp.second.equals(this.second) && tmp.optLast.equals(this.optLast) ; + } + + @Override + public int hashCode() { + return 457 + 509 * expression.hashCode() + 337 * optFirst.hashCode() + 269 * second.hashCode() + 277 * optLast.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + @Override + public org.rascalmpl.ast.OptionalExpression getOptFirst() { + return this.optFirst; + } + + @Override + public boolean hasOptFirst() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getSecond() { + return this.second; + } + + @Override + public boolean hasSecond() { + return true; + } + @Override + public org.rascalmpl.ast.OptionalExpression getOptLast() { + return this.optLast; + } + + @Override + public boolean hasOptLast() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(expression), clone(optFirst), clone(second), clone(optLast)); + } + + } + public boolean isSplice() { + return false; + } + + static public class Splice extends Expression { + // Production: sig("Splice",[arg("org.rascalmpl.ast.Expression","argument")],breakable=false) + + + private final org.rascalmpl.ast.Expression argument; + + public Splice(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression argument) { + super(src, node); + + this.argument = argument; + } + + @Override + public boolean isSplice() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionSplice(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = argument.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + argument.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Splice)) { + return false; + } + Splice tmp = (Splice) o; + return true && tmp.argument.equals(this.argument) ; + } + + @Override + public int hashCode() { + return 983 + 613 * argument.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getArgument() { + return this.argument; + } + + @Override + public boolean hasArgument() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(argument)); + } + + } + public boolean isSplicePlus() { + return false; + } + + static public class SplicePlus extends Expression { + // Production: sig("SplicePlus",[arg("org.rascalmpl.ast.Expression","argument")],breakable=false) + + + private final org.rascalmpl.ast.Expression argument; + + public SplicePlus(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression argument) { + super(src, node); + + this.argument = argument; + } + + @Override + public boolean isSplicePlus() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionSplicePlus(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = argument.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + argument.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof SplicePlus)) { + return false; + } + SplicePlus tmp = (SplicePlus) o; + return true && tmp.argument.equals(this.argument) ; + } + + @Override + public int hashCode() { + return 449 + 227 * argument.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getArgument() { + return this.argument; + } + + @Override + public boolean hasArgument() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(argument)); + } + + } + public boolean isStepRange() { + return false; + } + + static public class StepRange extends Expression { + // Production: sig("StepRange",[arg("org.rascalmpl.ast.Expression","first"),arg("org.rascalmpl.ast.Expression","second"),arg("org.rascalmpl.ast.Expression","last")],breakable=false) + + + private final org.rascalmpl.ast.Expression first; + private final org.rascalmpl.ast.Expression second; + private final org.rascalmpl.ast.Expression last; + + public StepRange(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression first, org.rascalmpl.ast.Expression second, org.rascalmpl.ast.Expression last) { + super(src, node); + + this.first = first; + this.second = second; + this.last = last; + } + + @Override + public boolean isStepRange() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionStepRange(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = first.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + first.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = second.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + second.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = last.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + last.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof StepRange)) { + return false; + } + StepRange tmp = (StepRange) o; + return true && tmp.first.equals(this.first) && tmp.second.equals(this.second) && tmp.last.equals(this.last) ; + } + + @Override + public int hashCode() { + return 601 + 29 * first.hashCode() + 283 * second.hashCode() + 751 * last.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getFirst() { + return this.first; + } + + @Override + public boolean hasFirst() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getSecond() { + return this.second; + } + + @Override + public boolean hasSecond() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getLast() { + return this.last; + } + + @Override + public boolean hasLast() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(first), clone(second), clone(last)); + } + + } + public boolean isSubscript() { + return false; + } + + static public class Subscript extends Expression { + // Production: sig("Subscript",[arg("org.rascalmpl.ast.Expression","expression"),arg("java.util.List\","subscripts")],breakable=false) + + + private final org.rascalmpl.ast.Expression expression; + private final java.util.List subscripts; + + public Subscript(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression expression, java.util.List subscripts) { + super(src, node); + + this.expression = expression; + this.subscripts = subscripts; + } + + @Override + public boolean isSubscript() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionSubscript(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : subscripts) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Subscript)) { + return false; + } + Subscript tmp = (Subscript) o; + return true && tmp.expression.equals(this.expression) && tmp.subscripts.equals(this.subscripts) ; + } + + @Override + public int hashCode() { + return 839 + 739 * expression.hashCode() + 347 * subscripts.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + @Override + public java.util.List getSubscripts() { + return this.subscripts; + } + + @Override + public boolean hasSubscripts() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(expression), clone(subscripts)); + } + + } + public boolean isSubtraction() { + return false; + } + + static public class Subtraction extends Expression { + // Production: sig("Subtraction",[arg("org.rascalmpl.ast.Expression","lhs"),arg("org.rascalmpl.ast.Expression","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Expression lhs; + private final org.rascalmpl.ast.Expression rhs; + + public Subtraction(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression lhs, org.rascalmpl.ast.Expression rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isSubtraction() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionSubtraction(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Subtraction)) { + return false; + } + Subtraction tmp = (Subtraction) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 719 + 691 * lhs.hashCode() + 433 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } + public boolean isTransitiveClosure() { + return false; + } + + static public class TransitiveClosure extends Expression { + // Production: sig("TransitiveClosure",[arg("org.rascalmpl.ast.Expression","argument")],breakable=false) + + + private final org.rascalmpl.ast.Expression argument; + + public TransitiveClosure(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression argument) { + super(src, node); + + this.argument = argument; + } + + @Override + public boolean isTransitiveClosure() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionTransitiveClosure(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = argument.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + argument.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof TransitiveClosure)) { + return false; + } + TransitiveClosure tmp = (TransitiveClosure) o; + return true && tmp.argument.equals(this.argument) ; + } + + @Override + public int hashCode() { + return 953 + 367 * argument.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getArgument() { + return this.argument; + } + + @Override + public boolean hasArgument() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(argument)); + } + + } + public boolean isTransitiveReflexiveClosure() { + return false; + } + + static public class TransitiveReflexiveClosure extends Expression { + // Production: sig("TransitiveReflexiveClosure",[arg("org.rascalmpl.ast.Expression","argument")],breakable=false) + + + private final org.rascalmpl.ast.Expression argument; + + public TransitiveReflexiveClosure(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression argument) { + super(src, node); + + this.argument = argument; + } + + @Override + public boolean isTransitiveReflexiveClosure() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionTransitiveReflexiveClosure(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = argument.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + argument.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof TransitiveReflexiveClosure)) { + return false; + } + TransitiveReflexiveClosure tmp = (TransitiveReflexiveClosure) o; + return true && tmp.argument.equals(this.argument) ; + } + + @Override + public int hashCode() { + return 991 + 461 * argument.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getArgument() { + return this.argument; + } + + @Override + public boolean hasArgument() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(argument)); + } + + } + public boolean isTuple() { + return false; + } + + static public class Tuple extends Expression { + // Production: sig("Tuple",[arg("java.util.List\","elements")],breakable=false) + + + private final java.util.List elements; + + public Tuple(ISourceLocation src, IConstructor node , java.util.List elements) { + super(src, node); + + this.elements = elements; + } + + @Override + public boolean isTuple() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionTuple(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : elements) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Tuple)) { + return false; + } + Tuple tmp = (Tuple) o; + return true && tmp.elements.equals(this.elements) ; + } + + @Override + public int hashCode() { + return 599 + 863 * elements.hashCode() ; + } + + + @Override + public java.util.List getElements() { + return this.elements; + } + + @Override + public boolean hasElements() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(elements)); + } + + } + public boolean isTypedVariable() { + return false; + } + + static public class TypedVariable extends Expression { + // Production: sig("TypedVariable",[arg("org.rascalmpl.ast.Type","type"),arg("org.rascalmpl.ast.Name","name")],breakable=false) + + + private final org.rascalmpl.ast.Type type; + private final org.rascalmpl.ast.Name name; + + public TypedVariable(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Type type, org.rascalmpl.ast.Name name) { + super(src, node); + + this.type = type; + this.name = name; + } + + @Override + public boolean isTypedVariable() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionTypedVariable(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = type.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + type.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof TypedVariable)) { + return false; + } + TypedVariable tmp = (TypedVariable) o; + return true && tmp.type.equals(this.type) && tmp.name.equals(this.name) ; + } + + @Override + public int hashCode() { + return 331 + 347 * type.hashCode() + 487 * name.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Type getType() { + return this.type; + } + + @Override + public boolean hasType() { + return true; + } + @Override + public org.rascalmpl.ast.Name getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(type), clone(name)); + } + + } + public boolean isTypedVariableBecomes() { + return false; + } + + static public class TypedVariableBecomes extends Expression { + // Production: sig("TypedVariableBecomes",[arg("org.rascalmpl.ast.Type","type"),arg("org.rascalmpl.ast.Name","name"),arg("org.rascalmpl.ast.Expression","pattern")],breakable=false) + + + private final org.rascalmpl.ast.Type type; + private final org.rascalmpl.ast.Name name; + private final org.rascalmpl.ast.Expression pattern; + + public TypedVariableBecomes(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Type type, org.rascalmpl.ast.Name name, org.rascalmpl.ast.Expression pattern) { + super(src, node); + + this.type = type; + this.name = name; + this.pattern = pattern; + } + + @Override + public boolean isTypedVariableBecomes() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionTypedVariableBecomes(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = type.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + type.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = pattern.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + pattern.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof TypedVariableBecomes)) { + return false; + } + TypedVariableBecomes tmp = (TypedVariableBecomes) o; + return true && tmp.type.equals(this.type) && tmp.name.equals(this.name) && tmp.pattern.equals(this.pattern) ; + } + + @Override + public int hashCode() { + return 53 + 983 * type.hashCode() + 653 * name.hashCode() + 29 * pattern.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Type getType() { + return this.type; + } + + @Override + public boolean hasType() { + return true; + } + @Override + public org.rascalmpl.ast.Name getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getPattern() { + return this.pattern; + } + + @Override + public boolean hasPattern() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(type), clone(name), clone(pattern)); + } + + } + public boolean isVariableBecomes() { + return false; + } + + static public class VariableBecomes extends Expression { + // Production: sig("VariableBecomes",[arg("org.rascalmpl.ast.Name","name"),arg("org.rascalmpl.ast.Expression","pattern")],breakable=false) + + + private final org.rascalmpl.ast.Name name; + private final org.rascalmpl.ast.Expression pattern; + + public VariableBecomes(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Name name, org.rascalmpl.ast.Expression pattern) { + super(src, node); + + this.name = name; + this.pattern = pattern; + } + + @Override + public boolean isVariableBecomes() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionVariableBecomes(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = pattern.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + pattern.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof VariableBecomes)) { + return false; + } + VariableBecomes tmp = (VariableBecomes) o; + return true && tmp.name.equals(this.name) && tmp.pattern.equals(this.pattern) ; + } + + @Override + public int hashCode() { + return 487 + 653 * name.hashCode() + 373 * pattern.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Name getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getPattern() { + return this.pattern; + } + + @Override + public boolean hasPattern() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(name), clone(pattern)); + } + + } + public boolean isVisit() { + return false; + } + + static public class Visit extends Expression { + // Production: sig("Visit",[arg("org.rascalmpl.ast.Label","label"),arg("org.rascalmpl.ast.Visit","visit")],breakable=false) + + + private final org.rascalmpl.ast.Label label; + private final org.rascalmpl.ast.Visit visit; + + public Visit(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Label label, org.rascalmpl.ast.Visit visit) { + super(src, node); + + this.label = label; + this.visit = visit; + } + + @Override + public boolean isVisit() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionVisit(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = label.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + label.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = visit.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + visit.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Visit)) { + return false; + } + Visit tmp = (Visit) o; + return true && tmp.label.equals(this.label) && tmp.visit.equals(this.visit) ; + } + + @Override + public int hashCode() { + return 449 + 251 * label.hashCode() + 109 * visit.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Label getLabel() { + return this.label; + } + + @Override + public boolean hasLabel() { + return true; + } + @Override + public org.rascalmpl.ast.Visit getVisit() { + return this.visit; + } + + @Override + public boolean hasVisit() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(label), clone(visit)); + } + + } + public boolean isVoidClosure() { + return false; + } + + static public class VoidClosure extends Expression { + // Production: sig("VoidClosure",[arg("org.rascalmpl.ast.Parameters","parameters"),arg("java.util.List\","statements0")],breakable=false) + + + private final org.rascalmpl.ast.Parameters parameters; + private final java.util.List statements0; + + public VoidClosure(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Parameters parameters, java.util.List statements0) { + super(src, node); + + this.parameters = parameters; + this.statements0 = statements0; + } + + @Override + public boolean isVoidClosure() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitExpressionVoidClosure(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = parameters.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + parameters.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : statements0) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof VoidClosure)) { + return false; + } + VoidClosure tmp = (VoidClosure) o; + return true && tmp.parameters.equals(this.parameters) && tmp.statements0.equals(this.statements0) ; + } + + @Override + public int hashCode() { + return 967 + 269 * parameters.hashCode() + 97 * statements0.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Parameters getParameters() { + return this.parameters; + } + + @Override + public boolean hasParameters() { + return true; + } + @Override + public java.util.List getStatements0() { + return this.statements0; + } + + @Override + public boolean hasStatements0() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(parameters), clone(statements0)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Field.java b/src/org/rascalmpl/ast/Field.java new file mode 100644 index 00000000000..bf68c41a5f8 --- /dev/null +++ b/src/org/rascalmpl/ast/Field.java @@ -0,0 +1,195 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Field extends AbstractAST { + public Field(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasFieldIndex() { + return false; + } + + public org.rascalmpl.ast.IntegerLiteral getFieldIndex() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasFieldName() { + return false; + } + + public org.rascalmpl.ast.Name getFieldName() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isIndex() { + return false; + } + + static public class Index extends Field { + // Production: sig("Index",[arg("org.rascalmpl.ast.IntegerLiteral","fieldIndex")],breakable=false) + + + private final org.rascalmpl.ast.IntegerLiteral fieldIndex; + + public Index(ISourceLocation src, IConstructor node , org.rascalmpl.ast.IntegerLiteral fieldIndex) { + super(src, node); + + this.fieldIndex = fieldIndex; + } + + @Override + public boolean isIndex() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitFieldIndex(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = fieldIndex.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + fieldIndex.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Index)) { + return false; + } + Index tmp = (Index) o; + return true && tmp.fieldIndex.equals(this.fieldIndex) ; + } + + @Override + public int hashCode() { + return 101 + 467 * fieldIndex.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.IntegerLiteral getFieldIndex() { + return this.fieldIndex; + } + + @Override + public boolean hasFieldIndex() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(fieldIndex)); + } + + } + public boolean isName() { + return false; + } + + static public class Name extends Field { + // Production: sig("Name",[arg("org.rascalmpl.ast.Name","fieldName")],breakable=false) + + + private final org.rascalmpl.ast.Name fieldName; + + public Name(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Name fieldName) { + super(src, node); + + this.fieldName = fieldName; + } + + @Override + public boolean isName() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitFieldName(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = fieldName.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + fieldName.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Name)) { + return false; + } + Name tmp = (Name) o; + return true && tmp.fieldName.equals(this.fieldName) ; + } + + @Override + public int hashCode() { + return 89 + 727 * fieldName.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Name getFieldName() { + return this.fieldName; + } + + @Override + public boolean hasFieldName() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(fieldName)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Formals.java b/src/org/rascalmpl/ast/Formals.java new file mode 100644 index 00000000000..debccfce33f --- /dev/null +++ b/src/org/rascalmpl/ast/Formals.java @@ -0,0 +1,116 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Formals extends AbstractAST { + public Formals(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasFormals() { + return false; + } + + public java.util.List getFormals() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDefault() { + return false; + } + + static public class Default extends Formals { + // Production: sig("Default",[arg("java.util.List\","formals")],breakable=false) + + + private final java.util.List formals; + + public Default(ISourceLocation src, IConstructor node , java.util.List formals) { + super(src, node); + + this.formals = formals; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitFormalsDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : formals) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.formals.equals(this.formals) ; + } + + @Override + public int hashCode() { + return 673 + 743 * formals.hashCode() ; + } + + + @Override + public java.util.List getFormals() { + return this.formals; + } + + @Override + public boolean hasFormals() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(formals)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/FunctionBody.java b/src/org/rascalmpl/ast/FunctionBody.java new file mode 100644 index 00000000000..c997e848acd --- /dev/null +++ b/src/org/rascalmpl/ast/FunctionBody.java @@ -0,0 +1,116 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class FunctionBody extends AbstractAST { + public FunctionBody(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasStatements() { + return false; + } + + public java.util.List getStatements() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDefault() { + return false; + } + + static public class Default extends FunctionBody { + // Production: sig("Default",[arg("java.util.List\","statements")],breakable=false) + + + private final java.util.List statements; + + public Default(ISourceLocation src, IConstructor node , java.util.List statements) { + super(src, node); + + this.statements = statements; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitFunctionBodyDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : statements) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.statements.equals(this.statements) ; + } + + @Override + public int hashCode() { + return 29 + 571 * statements.hashCode() ; + } + + + @Override + public java.util.List getStatements() { + return this.statements; + } + + @Override + public boolean hasStatements() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(statements)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/FunctionDeclaration.java b/src/org/rascalmpl/ast/FunctionDeclaration.java new file mode 100644 index 00000000000..b216215840c --- /dev/null +++ b/src/org/rascalmpl/ast/FunctionDeclaration.java @@ -0,0 +1,601 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class FunctionDeclaration extends AbstractAST { + public FunctionDeclaration(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasConditions() { + return false; + } + + public java.util.List getConditions() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasExpression() { + return false; + } + + public org.rascalmpl.ast.Expression getExpression() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasBody() { + return false; + } + + public org.rascalmpl.ast.FunctionBody getBody() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasSignature() { + return false; + } + + public org.rascalmpl.ast.Signature getSignature() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasTags() { + return false; + } + + public org.rascalmpl.ast.Tags getTags() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasVisibility() { + return false; + } + + public org.rascalmpl.ast.Visibility getVisibility() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isAbstract() { + return false; + } + + static public class Abstract extends FunctionDeclaration { + // Production: sig("Abstract",[arg("org.rascalmpl.ast.Tags","tags"),arg("org.rascalmpl.ast.Visibility","visibility"),arg("org.rascalmpl.ast.Signature","signature")],breakable=false) + + + private final org.rascalmpl.ast.Tags tags; + private final org.rascalmpl.ast.Visibility visibility; + private final org.rascalmpl.ast.Signature signature; + + public Abstract(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Tags tags, org.rascalmpl.ast.Visibility visibility, org.rascalmpl.ast.Signature signature) { + super(src, node); + + this.tags = tags; + this.visibility = visibility; + this.signature = signature; + } + + @Override + public boolean isAbstract() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitFunctionDeclarationAbstract(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = tags.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + tags.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = visibility.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + visibility.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = signature.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + signature.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Abstract)) { + return false; + } + Abstract tmp = (Abstract) o; + return true && tmp.tags.equals(this.tags) && tmp.visibility.equals(this.visibility) && tmp.signature.equals(this.signature) ; + } + + @Override + public int hashCode() { + return 211 + 727 * tags.hashCode() + 251 * visibility.hashCode() + 131 * signature.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Tags getTags() { + return this.tags; + } + + @Override + public boolean hasTags() { + return true; + } + @Override + public org.rascalmpl.ast.Visibility getVisibility() { + return this.visibility; + } + + @Override + public boolean hasVisibility() { + return true; + } + @Override + public org.rascalmpl.ast.Signature getSignature() { + return this.signature; + } + + @Override + public boolean hasSignature() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(tags), clone(visibility), clone(signature)); + } + + } + public boolean isConditional() { + return false; + } + + static public class Conditional extends FunctionDeclaration { + // Production: sig("Conditional",[arg("org.rascalmpl.ast.Tags","tags"),arg("org.rascalmpl.ast.Visibility","visibility"),arg("org.rascalmpl.ast.Signature","signature"),arg("org.rascalmpl.ast.Expression","expression"),arg("java.util.List\","conditions")],breakable=false) + + + private final org.rascalmpl.ast.Tags tags; + private final org.rascalmpl.ast.Visibility visibility; + private final org.rascalmpl.ast.Signature signature; + private final org.rascalmpl.ast.Expression expression; + private final java.util.List conditions; + + public Conditional(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Tags tags, org.rascalmpl.ast.Visibility visibility, org.rascalmpl.ast.Signature signature, org.rascalmpl.ast.Expression expression, java.util.List conditions) { + super(src, node); + + this.tags = tags; + this.visibility = visibility; + this.signature = signature; + this.expression = expression; + this.conditions = conditions; + } + + @Override + public boolean isConditional() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitFunctionDeclarationConditional(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = tags.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + tags.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = visibility.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + visibility.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = signature.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + signature.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : conditions) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Conditional)) { + return false; + } + Conditional tmp = (Conditional) o; + return true && tmp.tags.equals(this.tags) && tmp.visibility.equals(this.visibility) && tmp.signature.equals(this.signature) && tmp.expression.equals(this.expression) && tmp.conditions.equals(this.conditions) ; + } + + @Override + public int hashCode() { + return 811 + 199 * tags.hashCode() + 5 * visibility.hashCode() + 157 * signature.hashCode() + 389 * expression.hashCode() + 163 * conditions.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Tags getTags() { + return this.tags; + } + + @Override + public boolean hasTags() { + return true; + } + @Override + public org.rascalmpl.ast.Visibility getVisibility() { + return this.visibility; + } + + @Override + public boolean hasVisibility() { + return true; + } + @Override + public org.rascalmpl.ast.Signature getSignature() { + return this.signature; + } + + @Override + public boolean hasSignature() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + @Override + public java.util.List getConditions() { + return this.conditions; + } + + @Override + public boolean hasConditions() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(tags), clone(visibility), clone(signature), clone(expression), clone(conditions)); + } + + } + public boolean isDefault() { + return false; + } + + static public class Default extends FunctionDeclaration { + // Production: sig("Default",[arg("org.rascalmpl.ast.Tags","tags"),arg("org.rascalmpl.ast.Visibility","visibility"),arg("org.rascalmpl.ast.Signature","signature"),arg("org.rascalmpl.ast.FunctionBody","body")],breakable=false) + + + private final org.rascalmpl.ast.Tags tags; + private final org.rascalmpl.ast.Visibility visibility; + private final org.rascalmpl.ast.Signature signature; + private final org.rascalmpl.ast.FunctionBody body; + + public Default(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Tags tags, org.rascalmpl.ast.Visibility visibility, org.rascalmpl.ast.Signature signature, org.rascalmpl.ast.FunctionBody body) { + super(src, node); + + this.tags = tags; + this.visibility = visibility; + this.signature = signature; + this.body = body; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitFunctionDeclarationDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = tags.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + tags.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = visibility.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + visibility.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = signature.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + signature.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = body.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + body.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.tags.equals(this.tags) && tmp.visibility.equals(this.visibility) && tmp.signature.equals(this.signature) && tmp.body.equals(this.body) ; + } + + @Override + public int hashCode() { + return 163 + 71 * tags.hashCode() + 503 * visibility.hashCode() + 31 * signature.hashCode() + 181 * body.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Tags getTags() { + return this.tags; + } + + @Override + public boolean hasTags() { + return true; + } + @Override + public org.rascalmpl.ast.Visibility getVisibility() { + return this.visibility; + } + + @Override + public boolean hasVisibility() { + return true; + } + @Override + public org.rascalmpl.ast.Signature getSignature() { + return this.signature; + } + + @Override + public boolean hasSignature() { + return true; + } + @Override + public org.rascalmpl.ast.FunctionBody getBody() { + return this.body; + } + + @Override + public boolean hasBody() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(tags), clone(visibility), clone(signature), clone(body)); + } + + } + public boolean isExpression() { + return false; + } + + static public class Expression extends FunctionDeclaration { + // Production: sig("Expression",[arg("org.rascalmpl.ast.Tags","tags"),arg("org.rascalmpl.ast.Visibility","visibility"),arg("org.rascalmpl.ast.Signature","signature"),arg("org.rascalmpl.ast.Expression","expression")],breakable=false) + + + private final org.rascalmpl.ast.Tags tags; + private final org.rascalmpl.ast.Visibility visibility; + private final org.rascalmpl.ast.Signature signature; + private final org.rascalmpl.ast.Expression expression; + + public Expression(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Tags tags, org.rascalmpl.ast.Visibility visibility, org.rascalmpl.ast.Signature signature, org.rascalmpl.ast.Expression expression) { + super(src, node); + + this.tags = tags; + this.visibility = visibility; + this.signature = signature; + this.expression = expression; + } + + @Override + public boolean isExpression() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitFunctionDeclarationExpression(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = tags.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + tags.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = visibility.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + visibility.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = signature.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + signature.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Expression)) { + return false; + } + Expression tmp = (Expression) o; + return true && tmp.tags.equals(this.tags) && tmp.visibility.equals(this.visibility) && tmp.signature.equals(this.signature) && tmp.expression.equals(this.expression) ; + } + + @Override + public int hashCode() { + return 313 + 463 * tags.hashCode() + 257 * visibility.hashCode() + 211 * signature.hashCode() + 179 * expression.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Tags getTags() { + return this.tags; + } + + @Override + public boolean hasTags() { + return true; + } + @Override + public org.rascalmpl.ast.Visibility getVisibility() { + return this.visibility; + } + + @Override + public boolean hasVisibility() { + return true; + } + @Override + public org.rascalmpl.ast.Signature getSignature() { + return this.signature; + } + + @Override + public boolean hasSignature() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(tags), clone(visibility), clone(signature), clone(expression)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/FunctionModifier.java b/src/org/rascalmpl/ast/FunctionModifier.java new file mode 100644 index 00000000000..165fe167584 --- /dev/null +++ b/src/org/rascalmpl/ast/FunctionModifier.java @@ -0,0 +1,198 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class FunctionModifier extends AbstractAST { + public FunctionModifier(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + + + + public boolean isDefault() { + return false; + } + + static public class Default extends FunctionModifier { + // Production: sig("Default",[],breakable=false) + + + + public Default(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitFunctionModifierDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true ; + } + + @Override + public int hashCode() { + return 457 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isJava() { + return false; + } + + static public class Java extends FunctionModifier { + // Production: sig("Java",[],breakable=false) + + + + public Java(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isJava() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitFunctionModifierJava(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Java)) { + return false; + } + Java tmp = (Java) o; + return true ; + } + + @Override + public int hashCode() { + return 839 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isTest() { + return false; + } + + static public class Test extends FunctionModifier { + // Production: sig("Test",[],breakable=false) + + + + public Test(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isTest() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitFunctionModifierTest(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Test)) { + return false; + } + Test tmp = (Test) o; + return true ; + } + + @Override + public int hashCode() { + return 2 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/FunctionModifiers.java b/src/org/rascalmpl/ast/FunctionModifiers.java new file mode 100644 index 00000000000..d6095642881 --- /dev/null +++ b/src/org/rascalmpl/ast/FunctionModifiers.java @@ -0,0 +1,116 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class FunctionModifiers extends AbstractAST { + public FunctionModifiers(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasModifiers() { + return false; + } + + public java.util.List getModifiers() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isModifierlist() { + return false; + } + + static public class Modifierlist extends FunctionModifiers { + // Production: sig("Modifierlist",[arg("java.util.List\","modifiers")],breakable=false) + + + private final java.util.List modifiers; + + public Modifierlist(ISourceLocation src, IConstructor node , java.util.List modifiers) { + super(src, node); + + this.modifiers = modifiers; + } + + @Override + public boolean isModifierlist() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitFunctionModifiersModifierlist(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : modifiers) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Modifierlist)) { + return false; + } + Modifierlist tmp = (Modifierlist) o; + return true && tmp.modifiers.equals(this.modifiers) ; + } + + @Override + public int hashCode() { + return 461 + 877 * modifiers.hashCode() ; + } + + + @Override + public java.util.List getModifiers() { + return this.modifiers; + } + + @Override + public boolean hasModifiers() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(modifiers)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/FunctionType.java b/src/org/rascalmpl/ast/FunctionType.java new file mode 100644 index 00000000000..a11f806d066 --- /dev/null +++ b/src/org/rascalmpl/ast/FunctionType.java @@ -0,0 +1,142 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class FunctionType extends AbstractAST { + public FunctionType(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasArguments() { + return false; + } + + public java.util.List getArguments() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasType() { + return false; + } + + public org.rascalmpl.ast.Type getType() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isTypeArguments() { + return false; + } + + static public class TypeArguments extends FunctionType { + // Production: sig("TypeArguments",[arg("org.rascalmpl.ast.Type","type"),arg("java.util.List\","arguments")],breakable=false) + + + private final org.rascalmpl.ast.Type type; + private final java.util.List arguments; + + public TypeArguments(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Type type, java.util.List arguments) { + super(src, node); + + this.type = type; + this.arguments = arguments; + } + + @Override + public boolean isTypeArguments() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitFunctionTypeTypeArguments(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = type.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + type.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : arguments) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof TypeArguments)) { + return false; + } + TypeArguments tmp = (TypeArguments) o; + return true && tmp.type.equals(this.type) && tmp.arguments.equals(this.arguments) ; + } + + @Override + public int hashCode() { + return 599 + 281 * type.hashCode() + 43 * arguments.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Type getType() { + return this.type; + } + + @Override + public boolean hasType() { + return true; + } + @Override + public java.util.List getArguments() { + return this.arguments; + } + + @Override + public boolean hasArguments() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(type), clone(arguments)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Header.java b/src/org/rascalmpl/ast/Header.java new file mode 100644 index 00000000000..8afe64a16ce --- /dev/null +++ b/src/org/rascalmpl/ast/Header.java @@ -0,0 +1,308 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Header extends AbstractAST { + public Header(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasImports() { + return false; + } + + public java.util.List getImports() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasParams() { + return false; + } + + public org.rascalmpl.ast.ModuleParameters getParams() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasName() { + return false; + } + + public org.rascalmpl.ast.QualifiedName getName() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasTags() { + return false; + } + + public org.rascalmpl.ast.Tags getTags() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDefault() { + return false; + } + + static public class Default extends Header { + // Production: sig("Default",[arg("org.rascalmpl.ast.Tags","tags"),arg("org.rascalmpl.ast.QualifiedName","name"),arg("java.util.List\","imports")],breakable=false) + + + private final org.rascalmpl.ast.Tags tags; + private final org.rascalmpl.ast.QualifiedName name; + private final java.util.List imports; + + public Default(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Tags tags, org.rascalmpl.ast.QualifiedName name, java.util.List imports) { + super(src, node); + + this.tags = tags; + this.name = name; + this.imports = imports; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitHeaderDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = tags.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + tags.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : imports) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.tags.equals(this.tags) && tmp.name.equals(this.name) && tmp.imports.equals(this.imports) ; + } + + @Override + public int hashCode() { + return 103 + 673 * tags.hashCode() + 509 * name.hashCode() + 61 * imports.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Tags getTags() { + return this.tags; + } + + @Override + public boolean hasTags() { + return true; + } + @Override + public org.rascalmpl.ast.QualifiedName getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + @Override + public java.util.List getImports() { + return this.imports; + } + + @Override + public boolean hasImports() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(tags), clone(name), clone(imports)); + } + + } + public boolean isParameters() { + return false; + } + + static public class Parameters extends Header { + // Production: sig("Parameters",[arg("org.rascalmpl.ast.Tags","tags"),arg("org.rascalmpl.ast.QualifiedName","name"),arg("org.rascalmpl.ast.ModuleParameters","params"),arg("java.util.List\","imports")],breakable=false) + + + private final org.rascalmpl.ast.Tags tags; + private final org.rascalmpl.ast.QualifiedName name; + private final org.rascalmpl.ast.ModuleParameters params; + private final java.util.List imports; + + public Parameters(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Tags tags, org.rascalmpl.ast.QualifiedName name, org.rascalmpl.ast.ModuleParameters params, java.util.List imports) { + super(src, node); + + this.tags = tags; + this.name = name; + this.params = params; + this.imports = imports; + } + + @Override + public boolean isParameters() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitHeaderParameters(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = tags.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + tags.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = params.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + params.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : imports) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Parameters)) { + return false; + } + Parameters tmp = (Parameters) o; + return true && tmp.tags.equals(this.tags) && tmp.name.equals(this.name) && tmp.params.equals(this.params) && tmp.imports.equals(this.imports) ; + } + + @Override + public int hashCode() { + return 173 + 761 * tags.hashCode() + 409 * name.hashCode() + 997 * params.hashCode() + 367 * imports.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Tags getTags() { + return this.tags; + } + + @Override + public boolean hasTags() { + return true; + } + @Override + public org.rascalmpl.ast.QualifiedName getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + @Override + public org.rascalmpl.ast.ModuleParameters getParams() { + return this.params; + } + + @Override + public boolean hasParams() { + return true; + } + @Override + public java.util.List getImports() { + return this.imports; + } + + @Override + public boolean hasImports() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(tags), clone(name), clone(params), clone(imports)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/HexIntegerLiteral.java b/src/org/rascalmpl/ast/HexIntegerLiteral.java new file mode 100644 index 00000000000..e7f248973df --- /dev/null +++ b/src/org/rascalmpl/ast/HexIntegerLiteral.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class HexIntegerLiteral extends AbstractAST { + public HexIntegerLiteral(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends HexIntegerLiteral { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitHexIntegerLiteralLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/IASTVisitor.java b/src/org/rascalmpl/ast/IASTVisitor.java new file mode 100644 index 00000000000..97542a0e7de --- /dev/null +++ b/src/org/rascalmpl/ast/IASTVisitor.java @@ -0,0 +1,855 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + +public interface IASTVisitor { + + public T visitAssignableAnnotation(Assignable.Annotation x); + + public T visitAssignableBracket(Assignable.Bracket x); + + public T visitAssignableConstructor(Assignable.Constructor x); + + public T visitAssignableFieldAccess(Assignable.FieldAccess x); + + public T visitAssignableIfDefinedOrDefault(Assignable.IfDefinedOrDefault x); + + public T visitAssignableSlice(Assignable.Slice x); + + public T visitAssignableSliceStep(Assignable.SliceStep x); + + public T visitAssignableSubscript(Assignable.Subscript x); + + public T visitAssignableTuple(Assignable.Tuple x); + + public T visitAssignableVariable(Assignable.Variable x); + + public T visitAssignmentAddition(Assignment.Addition x); + + public T visitAssignmentAppend(Assignment.Append x); + + public T visitAssignmentDefault(Assignment.Default x); + + public T visitAssignmentDivision(Assignment.Division x); + + public T visitAssignmentIfDefined(Assignment.IfDefined x); + + public T visitAssignmentIntersection(Assignment.Intersection x); + + public T visitAssignmentProduct(Assignment.Product x); + + public T visitAssignmentSubtraction(Assignment.Subtraction x); + + public T visitAssocAssociative(Assoc.Associative x); + + public T visitAssocLeft(Assoc.Left x); + + public T visitAssocNonAssociative(Assoc.NonAssociative x); + + public T visitAssocRight(Assoc.Right x); + + public T visitBasicTypeBag(BasicType.Bag x); + + public T visitBasicTypeBool(BasicType.Bool x); + + public T visitBasicTypeDateTime(BasicType.DateTime x); + + public T visitBasicTypeInt(BasicType.Int x); + + public T visitBasicTypeList(BasicType.List x); + + public T visitBasicTypeListRelation(BasicType.ListRelation x); + + public T visitBasicTypeLoc(BasicType.Loc x); + + public T visitBasicTypeMap(BasicType.Map x); + + public T visitBasicTypeNode(BasicType.Node x); + + public T visitBasicTypeNum(BasicType.Num x); + + public T visitBasicTypeRational(BasicType.Rational x); + + public T visitBasicTypeReal(BasicType.Real x); + + public T visitBasicTypeRelation(BasicType.Relation x); + + public T visitBasicTypeSet(BasicType.Set x); + + public T visitBasicTypeString(BasicType.String x); + + public T visitBasicTypeTuple(BasicType.Tuple x); + + public T visitBasicTypeType(BasicType.Type x); + + public T visitBasicTypeValue(BasicType.Value x); + + public T visitBasicTypeVoid(BasicType.Void x); + + public T visitBodyToplevels(Body.Toplevels x); + + public T visitBoundDefault(Bound.Default x); + + public T visitBoundEmpty(Bound.Empty x); + + public T visitCaseDefault(Case.Default x); + + public T visitCasePatternWithAction(Case.PatternWithAction x); + + public T visitCatchBinding(Catch.Binding x); + + public T visitCatchDefault(Catch.Default x); + + public T visitClassBracket(Class.Bracket x); + + public T visitClassComplement(Class.Complement x); + + public T visitClassDifference(Class.Difference x); + + public T visitClassIntersection(Class.Intersection x); + + public T visitClassSimpleCharclass(Class.SimpleCharclass x); + + public T visitClassUnion(Class.Union x); + + public T visitCommandDeclaration(Command.Declaration x); + + public T visitCommandExpression(Command.Expression x); + + public T visitCommandImport(Command.Import x); + + public T visitCommandShell(Command.Shell x); + + public T visitCommandStatement(Command.Statement x); + + public T visitCommandsCommandlist(Commands.Commandlist x); + + public T visitCommonKeywordParametersAbsent(CommonKeywordParameters.Absent x); + + public T visitCommonKeywordParametersPresent(CommonKeywordParameters.Present x); + + public T visitComprehensionList(Comprehension.List x); + + public T visitComprehensionMap(Comprehension.Map x); + + public T visitComprehensionSet(Comprehension.Set x); + + public T visitConcreteHoleOne(ConcreteHole.One x); + + public T visitDataTargetEmpty(DataTarget.Empty x); + + public T visitDataTargetLabeled(DataTarget.Labeled x); + + public T visitDataTypeSelectorSelector(DataTypeSelector.Selector x); + + public T visitDateTimeLiteralDateAndTimeLiteral(DateTimeLiteral.DateAndTimeLiteral x); + + public T visitDateTimeLiteralDateLiteral(DateTimeLiteral.DateLiteral x); + + public T visitDateTimeLiteralTimeLiteral(DateTimeLiteral.TimeLiteral x); + + public T visitDeclarationAlias(Declaration.Alias x); + + public T visitDeclarationAnnotation(Declaration.Annotation x); + + public T visitDeclarationData(Declaration.Data x); + + public T visitDeclarationDataAbstract(Declaration.DataAbstract x); + + public T visitDeclarationFunction(Declaration.Function x); + + public T visitDeclarationTag(Declaration.Tag x); + + public T visitDeclarationVariable(Declaration.Variable x); + + public T visitDeclaratorDefault(Declarator.Default x); + + public T visitEvalCommandDeclaration(EvalCommand.Declaration x); + + public T visitEvalCommandImport(EvalCommand.Import x); + + public T visitEvalCommandOutput(EvalCommand.Output x); + + public T visitEvalCommandStatement(EvalCommand.Statement x); + + public T visitExpressionAddition(Expression.Addition x); + + public T visitExpressionAll(Expression.All x); + + public T visitExpressionAnd(Expression.And x); + + public T visitExpressionAnti(Expression.Anti x); + + public T visitExpressionAny(Expression.Any x); + + public T visitExpressionAppendAfter(Expression.AppendAfter x); + + public T visitExpressionAsType(Expression.AsType x); + + public T visitExpressionBracket(Expression.Bracket x); + + public T visitExpressionCallOrTree(Expression.CallOrTree x); + + public T visitExpressionClosure(Expression.Closure x); + + public T visitExpressionComposition(Expression.Composition x); + + public T visitExpressionComprehension(Expression.Comprehension x); + + public T visitExpressionConcrete(Expression.Concrete x); + + public T visitExpressionDescendant(Expression.Descendant x); + + public T visitExpressionDivision(Expression.Division x); + + public T visitExpressionEnumerator(Expression.Enumerator x); + + public T visitExpressionEquals(Expression.Equals x); + + public T visitExpressionEquivalence(Expression.Equivalence x); + + public T visitExpressionFieldAccess(Expression.FieldAccess x); + + public T visitExpressionFieldProject(Expression.FieldProject x); + + public T visitExpressionFieldUpdate(Expression.FieldUpdate x); + + public T visitExpressionGetAnnotation(Expression.GetAnnotation x); + + public T visitExpressionGreaterThan(Expression.GreaterThan x); + + public T visitExpressionGreaterThanOrEq(Expression.GreaterThanOrEq x); + + public T visitExpressionHas(Expression.Has x); + + public T visitExpressionIfDefinedOtherwise(Expression.IfDefinedOtherwise x); + + public T visitExpressionIfThenElse(Expression.IfThenElse x); + + public T visitExpressionImplication(Expression.Implication x); + + public T visitExpressionIn(Expression.In x); + + public T visitExpressionInsertBefore(Expression.InsertBefore x); + + public T visitExpressionIntersection(Expression.Intersection x); + + public T visitExpressionIs(Expression.Is x); + + public T visitExpressionIsDefined(Expression.IsDefined x); + + public T visitExpressionIt(Expression.It x); + + public T visitExpressionJoin(Expression.Join x); + + public T visitExpressionLessThan(Expression.LessThan x); + + public T visitExpressionLessThanOrEq(Expression.LessThanOrEq x); + + public T visitExpressionList(Expression.List x); + + public T visitExpressionLiteral(Expression.Literal x); + + public T visitExpressionMap(Expression.Map x); + + public T visitExpressionMatch(Expression.Match x); + + public T visitExpressionModulo(Expression.Modulo x); + + public T visitExpressionMultiVariable(Expression.MultiVariable x); + + public T visitExpressionNegation(Expression.Negation x); + + public T visitExpressionNegative(Expression.Negative x); + + public T visitExpressionNoMatch(Expression.NoMatch x); + + public T visitExpressionNonEmptyBlock(Expression.NonEmptyBlock x); + + public T visitExpressionNonEquals(Expression.NonEquals x); + + public T visitExpressionNotIn(Expression.NotIn x); + + public T visitExpressionOr(Expression.Or x); + + public T visitExpressionProduct(Expression.Product x); + + public T visitExpressionQualifiedName(Expression.QualifiedName x); + + public T visitExpressionRange(Expression.Range x); + + public T visitExpressionReducer(Expression.Reducer x); + + public T visitExpressionReifiedType(Expression.ReifiedType x); + + public T visitExpressionReifyType(Expression.ReifyType x); + + public T visitExpressionRemainder(Expression.Remainder x); + + public T visitExpressionSet(Expression.Set x); + + public T visitExpressionSetAnnotation(Expression.SetAnnotation x); + + public T visitExpressionSlice(Expression.Slice x); + + public T visitExpressionSliceStep(Expression.SliceStep x); + + public T visitExpressionSplice(Expression.Splice x); + + public T visitExpressionSplicePlus(Expression.SplicePlus x); + + public T visitExpressionStepRange(Expression.StepRange x); + + public T visitExpressionSubscript(Expression.Subscript x); + + public T visitExpressionSubtraction(Expression.Subtraction x); + + public T visitExpressionTransitiveClosure(Expression.TransitiveClosure x); + + public T visitExpressionTransitiveReflexiveClosure(Expression.TransitiveReflexiveClosure x); + + public T visitExpressionTuple(Expression.Tuple x); + + public T visitExpressionTypedVariable(Expression.TypedVariable x); + + public T visitExpressionTypedVariableBecomes(Expression.TypedVariableBecomes x); + + public T visitExpressionVariableBecomes(Expression.VariableBecomes x); + + public T visitExpressionVisit(Expression.Visit x); + + public T visitExpressionVoidClosure(Expression.VoidClosure x); + + public T visitFieldIndex(Field.Index x); + + public T visitFieldName(Field.Name x); + + public T visitFormalsDefault(Formals.Default x); + + public T visitFunctionBodyDefault(FunctionBody.Default x); + + public T visitFunctionDeclarationAbstract(FunctionDeclaration.Abstract x); + + public T visitFunctionDeclarationConditional(FunctionDeclaration.Conditional x); + + public T visitFunctionDeclarationDefault(FunctionDeclaration.Default x); + + public T visitFunctionDeclarationExpression(FunctionDeclaration.Expression x); + + public T visitFunctionModifierDefault(FunctionModifier.Default x); + + public T visitFunctionModifierJava(FunctionModifier.Java x); + + public T visitFunctionModifierTest(FunctionModifier.Test x); + + public T visitFunctionModifiersModifierlist(FunctionModifiers.Modifierlist x); + + public T visitFunctionTypeTypeArguments(FunctionType.TypeArguments x); + + public T visitHeaderDefault(Header.Default x); + + public T visitHeaderParameters(Header.Parameters x); + + public T visitImportDefault(Import.Default x); + + public T visitImportExtend(Import.Extend x); + + public T visitImportExternal(Import.External x); + + public T visitImportSyntax(Import.Syntax x); + + public T visitImportedModuleActuals(ImportedModule.Actuals x); + + public T visitImportedModuleActualsRenaming(ImportedModule.ActualsRenaming x); + + public T visitImportedModuleDefault(ImportedModule.Default x); + + public T visitImportedModuleRenamings(ImportedModule.Renamings x); + + public T visitIntegerLiteralDecimalIntegerLiteral(IntegerLiteral.DecimalIntegerLiteral x); + + public T visitIntegerLiteralHexIntegerLiteral(IntegerLiteral.HexIntegerLiteral x); + + public T visitIntegerLiteralOctalIntegerLiteral(IntegerLiteral.OctalIntegerLiteral x); + + public T visitKeywordArgument_ExpressionDefault(KeywordArgument_Expression.Default x); + + public T visitKeywordArguments_ExpressionDefault(KeywordArguments_Expression.Default x); + + public T visitKeywordArguments_ExpressionNone(KeywordArguments_Expression.None x); + + public T visitKeywordFormalDefault(KeywordFormal.Default x); + + public T visitKeywordFormalsDefault(KeywordFormals.Default x); + + public T visitKeywordFormalsNone(KeywordFormals.None x); + + public T visitKindAlias(Kind.Alias x); + + public T visitKindAll(Kind.All x); + + public T visitKindAnno(Kind.Anno x); + + public T visitKindData(Kind.Data x); + + public T visitKindFunction(Kind.Function x); + + public T visitKindModule(Kind.Module x); + + public T visitKindTag(Kind.Tag x); + + public T visitKindVariable(Kind.Variable x); + + public T visitKindView(Kind.View x); + + public T visitLabelDefault(Label.Default x); + + public T visitLabelEmpty(Label.Empty x); + + public T visitLiteralBoolean(Literal.Boolean x); + + public T visitLiteralDateTime(Literal.DateTime x); + + public T visitLiteralInteger(Literal.Integer x); + + public T visitLiteralLocation(Literal.Location x); + + public T visitLiteralRational(Literal.Rational x); + + public T visitLiteralReal(Literal.Real x); + + public T visitLiteralRegExp(Literal.RegExp x); + + public T visitLiteralString(Literal.String x); + + public T visitLocalVariableDeclarationDefault(LocalVariableDeclaration.Default x); + + public T visitLocalVariableDeclarationDynamic(LocalVariableDeclaration.Dynamic x); + + public T visitLocationLiteralDefault(LocationLiteral.Default x); + + public T visitMapping_ExpressionDefault(Mapping_Expression.Default x); + + public T visitModuleDefault(Module.Default x); + + public T visitModuleActualsDefault(ModuleActuals.Default x); + + public T visitModuleParametersDefault(ModuleParameters.Default x); + + public T visitOptionalExpressionExpression(OptionalExpression.Expression x); + + public T visitOptionalExpressionNoExpression(OptionalExpression.NoExpression x); + + public T visitParametersDefault(Parameters.Default x); + + public T visitParametersVarArgs(Parameters.VarArgs x); + + public T visitPathPartInterpolated(PathPart.Interpolated x); + + public T visitPathPartNonInterpolated(PathPart.NonInterpolated x); + + public T visitPathTailMid(PathTail.Mid x); + + public T visitPathTailPost(PathTail.Post x); + + public T visitPatternWithActionArbitrary(PatternWithAction.Arbitrary x); + + public T visitPatternWithActionReplacing(PatternWithAction.Replacing x); + + public T visitProdAll(Prod.All x); + + public T visitProdAssociativityGroup(Prod.AssociativityGroup x); + + public T visitProdFirst(Prod.First x); + + public T visitProdLabeled(Prod.Labeled x); + + public T visitProdReference(Prod.Reference x); + + public T visitProdUnlabeled(Prod.Unlabeled x); + + public T visitProdModifierAssociativity(ProdModifier.Associativity x); + + public T visitProdModifierBracket(ProdModifier.Bracket x); + + public T visitProdModifierTag(ProdModifier.Tag x); + + public T visitProtocolPartInterpolated(ProtocolPart.Interpolated x); + + public T visitProtocolPartNonInterpolated(ProtocolPart.NonInterpolated x); + + public T visitProtocolTailMid(ProtocolTail.Mid x); + + public T visitProtocolTailPost(ProtocolTail.Post x); + + public T visitQualifiedNameDefault(QualifiedName.Default x); + + public T visitRangeCharacter(Range.Character x); + + public T visitRangeFromTo(Range.FromTo x); + + public T visitRenamingDefault(Renaming.Default x); + + public T visitRenamingsDefault(Renamings.Default x); + + public T visitReplacementConditional(Replacement.Conditional x); + + public T visitReplacementUnconditional(Replacement.Unconditional x); + + public T visitShellCommandClear(ShellCommand.Clear x); + + public T visitShellCommandEdit(ShellCommand.Edit x); + + public T visitShellCommandHelp(ShellCommand.Help x); + + public T visitShellCommandHistory(ShellCommand.History x); + + public T visitShellCommandListDeclarations(ShellCommand.ListDeclarations x); + + public T visitShellCommandListModules(ShellCommand.ListModules x); + + public T visitShellCommandQuit(ShellCommand.Quit x); + + public T visitShellCommandSetOption(ShellCommand.SetOption x); + + public T visitShellCommandSetOptionTrue(ShellCommand.SetOptionTrue x); + + public T visitShellCommandTest(ShellCommand.Test x); + + public T visitShellCommandUndeclare(ShellCommand.Undeclare x); + + public T visitShellCommandUnextend(ShellCommand.Unextend x); + + public T visitShellCommandUnimport(ShellCommand.Unimport x); + + public T visitShellCommandUnsetOption(ShellCommand.UnsetOption x); + + public T visitSignatureNoThrows(Signature.NoThrows x); + + public T visitSignatureWithThrows(Signature.WithThrows x); + + public T visitStartAbsent(Start.Absent x); + + public T visitStartPresent(Start.Present x); + + public T visitStatementAppend(Statement.Append x); + + public T visitStatementAssert(Statement.Assert x); + + public T visitStatementAssertWithMessage(Statement.AssertWithMessage x); + + public T visitStatementAssignment(Statement.Assignment x); + + public T visitStatementBreak(Statement.Break x); + + public T visitStatementContinue(Statement.Continue x); + + public T visitStatementDoWhile(Statement.DoWhile x); + + public T visitStatementEmptyStatement(Statement.EmptyStatement x); + + public T visitStatementExpression(Statement.Expression x); + + public T visitStatementFail(Statement.Fail x); + + public T visitStatementFilter(Statement.Filter x); + + public T visitStatementFor(Statement.For x); + + public T visitStatementFunctionDeclaration(Statement.FunctionDeclaration x); + + public T visitStatementGlobalDirective(Statement.GlobalDirective x); + + public T visitStatementIfThen(Statement.IfThen x); + + public T visitStatementIfThenElse(Statement.IfThenElse x); + + public T visitStatementInsert(Statement.Insert x); + + public T visitStatementNonEmptyBlock(Statement.NonEmptyBlock x); + + public T visitStatementReturn(Statement.Return x); + + public T visitStatementSolve(Statement.Solve x); + + public T visitStatementSwitch(Statement.Switch x); + + public T visitStatementThrow(Statement.Throw x); + + public T visitStatementTry(Statement.Try x); + + public T visitStatementTryFinally(Statement.TryFinally x); + + public T visitStatementVariableDeclaration(Statement.VariableDeclaration x); + + public T visitStatementVisit(Statement.Visit x); + + public T visitStatementWhile(Statement.While x); + + public T visitStrategyBottomUp(Strategy.BottomUp x); + + public T visitStrategyBottomUpBreak(Strategy.BottomUpBreak x); + + public T visitStrategyInnermost(Strategy.Innermost x); + + public T visitStrategyOutermost(Strategy.Outermost x); + + public T visitStrategyTopDown(Strategy.TopDown x); + + public T visitStrategyTopDownBreak(Strategy.TopDownBreak x); + + public T visitStringLiteralInterpolated(StringLiteral.Interpolated x); + + public T visitStringLiteralNonInterpolated(StringLiteral.NonInterpolated x); + + public T visitStringLiteralTemplate(StringLiteral.Template x); + + public T visitStringMiddleInterpolated(StringMiddle.Interpolated x); + + public T visitStringMiddleMid(StringMiddle.Mid x); + + public T visitStringMiddleTemplate(StringMiddle.Template x); + + public T visitStringTailMidInterpolated(StringTail.MidInterpolated x); + + public T visitStringTailMidTemplate(StringTail.MidTemplate x); + + public T visitStringTailPost(StringTail.Post x); + + public T visitStringTemplateDoWhile(StringTemplate.DoWhile x); + + public T visitStringTemplateFor(StringTemplate.For x); + + public T visitStringTemplateIfThen(StringTemplate.IfThen x); + + public T visitStringTemplateIfThenElse(StringTemplate.IfThenElse x); + + public T visitStringTemplateWhile(StringTemplate.While x); + + public T visitStructuredTypeDefault(StructuredType.Default x); + + public T visitSymAlternative(Sym.Alternative x); + + public T visitSymCaseInsensitiveLiteral(Sym.CaseInsensitiveLiteral x); + + public T visitSymCharacterClass(Sym.CharacterClass x); + + public T visitSymColumn(Sym.Column x); + + public T visitSymEmpty(Sym.Empty x); + + public T visitSymEndOfLine(Sym.EndOfLine x); + + public T visitSymExcept(Sym.Except x); + + public T visitSymFollow(Sym.Follow x); + + public T visitSymIter(Sym.Iter x); + + public T visitSymIterSep(Sym.IterSep x); + + public T visitSymIterStar(Sym.IterStar x); + + public T visitSymIterStarSep(Sym.IterStarSep x); + + public T visitSymLabeled(Sym.Labeled x); + + public T visitSymLiteral(Sym.Literal x); + + public T visitSymNonterminal(Sym.Nonterminal x); + + public T visitSymNotFollow(Sym.NotFollow x); + + public T visitSymNotPrecede(Sym.NotPrecede x); + + public T visitSymOptional(Sym.Optional x); + + public T visitSymParameter(Sym.Parameter x); + + public T visitSymParametrized(Sym.Parametrized x); + + public T visitSymPrecede(Sym.Precede x); + + public T visitSymSequence(Sym.Sequence x); + + public T visitSymStart(Sym.Start x); + + public T visitSymStartOfLine(Sym.StartOfLine x); + + public T visitSymUnequal(Sym.Unequal x); + + public T visitSyntaxDefinitionKeyword(SyntaxDefinition.Keyword x); + + public T visitSyntaxDefinitionLanguage(SyntaxDefinition.Language x); + + public T visitSyntaxDefinitionLayout(SyntaxDefinition.Layout x); + + public T visitSyntaxDefinitionLexical(SyntaxDefinition.Lexical x); + + public T visitTagDefault(Tag.Default x); + + public T visitTagEmpty(Tag.Empty x); + + public T visitTagExpression(Tag.Expression x); + + public T visitTagsDefault(Tags.Default x); + + public T visitTargetEmpty(Target.Empty x); + + public T visitTargetLabeled(Target.Labeled x); + + public T visitToplevelGivenVisibility(Toplevel.GivenVisibility x); + + public T visitTypeBasic(Type.Basic x); + + public T visitTypeBracket(Type.Bracket x); + + public T visitTypeFunction(Type.Function x); + + public T visitTypeSelector(Type.Selector x); + + public T visitTypeStructured(Type.Structured x); + + public T visitTypeSymbol(Type.Symbol x); + + public T visitTypeUser(Type.User x); + + public T visitTypeVariable(Type.Variable x); + + public T visitTypeArgDefault(TypeArg.Default x); + + public T visitTypeArgNamed(TypeArg.Named x); + + public T visitTypeVarBounded(TypeVar.Bounded x); + + public T visitTypeVarFree(TypeVar.Free x); + + public T visitUserTypeName(UserType.Name x); + + public T visitUserTypeParametric(UserType.Parametric x); + + public T visitVariableInitialized(Variable.Initialized x); + + public T visitVariableUnInitialized(Variable.UnInitialized x); + + public T visitVariantNAryConstructor(Variant.NAryConstructor x); + + public T visitVisibilityDefault(Visibility.Default x); + + public T visitVisibilityPrivate(Visibility.Private x); + + public T visitVisibilityPublic(Visibility.Public x); + + public T visitVisitDefaultStrategy(Visit.DefaultStrategy x); + + public T visitVisitGivenStrategy(Visit.GivenStrategy x); + + + public T visitBackslashLexical(Backslash.Lexical x); + + public T visitBooleanLiteralLexical(BooleanLiteral.Lexical x); + + public T visitCaseInsensitiveStringConstantLexical(CaseInsensitiveStringConstant.Lexical x); + + public T visitCharLexical(Char.Lexical x); + + public T visitCommentLexical(Comment.Lexical x); + + public T visitConcreteLexical(Concrete.Lexical x); + + public T visitConcretePartLexical(ConcretePart.Lexical x); + + public T visitDateAndTimeLexical(DateAndTime.Lexical x); + + public T visitDatePartLexical(DatePart.Lexical x); + + public T visitDecimalIntegerLiteralLexical(DecimalIntegerLiteral.Lexical x); + + public T visitHexIntegerLiteralLexical(HexIntegerLiteral.Lexical x); + + public T visitJustDateLexical(JustDate.Lexical x); + + public T visitJustTimeLexical(JustTime.Lexical x); + + public T visitLAYOUTLexical(LAYOUT.Lexical x); + + public T visitMidPathCharsLexical(MidPathChars.Lexical x); + + public T visitMidProtocolCharsLexical(MidProtocolChars.Lexical x); + + public T visitMidStringCharsLexical(MidStringChars.Lexical x); + + public T visitNameLexical(Name.Lexical x); + + public T visitNamedBackslashLexical(NamedBackslash.Lexical x); + + public T visitNamedRegExpLexical(NamedRegExp.Lexical x); + + public T visitNonterminalLexical(Nonterminal.Lexical x); + + public T visitNonterminalLabelLexical(NonterminalLabel.Lexical x); + + public T visitOctalIntegerLiteralLexical(OctalIntegerLiteral.Lexical x); + + public T visitOptionalCommaLexical(OptionalComma.Lexical x); + + public T visitOptionalEqualSignLexical(OptionalEqualSign.Lexical x); + + public T visitOptionalTerminatorLexical(OptionalTerminator.Lexical x); + + public T visitOutputLexical(Output.Lexical x); + + public T visitPathCharsLexical(PathChars.Lexical x); + + public T visitPostPathCharsLexical(PostPathChars.Lexical x); + + public T visitPostProtocolCharsLexical(PostProtocolChars.Lexical x); + + public T visitPostStringCharsLexical(PostStringChars.Lexical x); + + public T visitPrePathCharsLexical(PrePathChars.Lexical x); + + public T visitPreProtocolCharsLexical(PreProtocolChars.Lexical x); + + public T visitPreStringCharsLexical(PreStringChars.Lexical x); + + public T visitProtocolCharsLexical(ProtocolChars.Lexical x); + + public T visitRationalLiteralLexical(RationalLiteral.Lexical x); + + public T visitRealLiteralLexical(RealLiteral.Lexical x); + + public T visitRegExpLexical(RegExp.Lexical x); + + public T visitRegExpLiteralLexical(RegExpLiteral.Lexical x); + + public T visitRegExpModifierLexical(RegExpModifier.Lexical x); + + public T visitStringCharacterLexical(StringCharacter.Lexical x); + + public T visitStringConstantLexical(StringConstant.Lexical x); + + public T visitTagStringLexical(TagString.Lexical x); + + public T visitTimePartNoTZLexical(TimePartNoTZ.Lexical x); + + public T visitTimeZonePartLexical(TimeZonePart.Lexical x); + + public T visitURLCharsLexical(URLChars.Lexical x); + + public T visitUnicodeEscapeLexical(UnicodeEscape.Lexical x); + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/IVisitable.java b/src/org/rascalmpl/ast/IVisitable.java new file mode 100644 index 00000000000..4ea18ecc1ea --- /dev/null +++ b/src/org/rascalmpl/ast/IVisitable.java @@ -0,0 +1,17 @@ +/******************************************************************************* + * Copyright (c) 2009-2013 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl +*******************************************************************************/ +package org.rascalmpl.ast; + +public interface IVisitable { + +} diff --git a/src/org/rascalmpl/ast/Import.java b/src/org/rascalmpl/ast/Import.java new file mode 100644 index 00000000000..83a46cf551b --- /dev/null +++ b/src/org/rascalmpl/ast/Import.java @@ -0,0 +1,376 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Import extends AbstractAST { + public Import(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasModule() { + return false; + } + + public org.rascalmpl.ast.ImportedModule getModule() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasAt() { + return false; + } + + public org.rascalmpl.ast.LocationLiteral getAt() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasName() { + return false; + } + + public org.rascalmpl.ast.QualifiedName getName() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasSyntax() { + return false; + } + + public org.rascalmpl.ast.SyntaxDefinition getSyntax() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDefault() { + return false; + } + + static public class Default extends Import { + // Production: sig("Default",[arg("org.rascalmpl.ast.ImportedModule","module")],breakable=false) + + + private final org.rascalmpl.ast.ImportedModule module; + + public Default(ISourceLocation src, IConstructor node , org.rascalmpl.ast.ImportedModule module) { + super(src, node); + + this.module = module; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitImportDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = module.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + module.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.module.equals(this.module) ; + } + + @Override + public int hashCode() { + return 401 + 139 * module.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.ImportedModule getModule() { + return this.module; + } + + @Override + public boolean hasModule() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(module)); + } + + } + public boolean isExtend() { + return false; + } + + static public class Extend extends Import { + // Production: sig("Extend",[arg("org.rascalmpl.ast.ImportedModule","module")],breakable=false) + + + private final org.rascalmpl.ast.ImportedModule module; + + public Extend(ISourceLocation src, IConstructor node , org.rascalmpl.ast.ImportedModule module) { + super(src, node); + + this.module = module; + } + + @Override + public boolean isExtend() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitImportExtend(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = module.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + module.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Extend)) { + return false; + } + Extend tmp = (Extend) o; + return true && tmp.module.equals(this.module) ; + } + + @Override + public int hashCode() { + return 937 + 521 * module.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.ImportedModule getModule() { + return this.module; + } + + @Override + public boolean hasModule() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(module)); + } + + } + public boolean isExternal() { + return false; + } + + static public class External extends Import { + // Production: sig("External",[arg("org.rascalmpl.ast.QualifiedName","name"),arg("org.rascalmpl.ast.LocationLiteral","at")],breakable=false) + + + private final org.rascalmpl.ast.QualifiedName name; + private final org.rascalmpl.ast.LocationLiteral at; + + public External(ISourceLocation src, IConstructor node , org.rascalmpl.ast.QualifiedName name, org.rascalmpl.ast.LocationLiteral at) { + super(src, node); + + this.name = name; + this.at = at; + } + + @Override + public boolean isExternal() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitImportExternal(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = at.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + at.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof External)) { + return false; + } + External tmp = (External) o; + return true && tmp.name.equals(this.name) && tmp.at.equals(this.at) ; + } + + @Override + public int hashCode() { + return 719 + 773 * name.hashCode() + 277 * at.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.QualifiedName getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + @Override + public org.rascalmpl.ast.LocationLiteral getAt() { + return this.at; + } + + @Override + public boolean hasAt() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(name), clone(at)); + } + + } + public boolean isSyntax() { + return false; + } + + static public class Syntax extends Import { + // Production: sig("Syntax",[arg("org.rascalmpl.ast.SyntaxDefinition","syntax")],breakable=false) + + + private final org.rascalmpl.ast.SyntaxDefinition syntax; + + public Syntax(ISourceLocation src, IConstructor node , org.rascalmpl.ast.SyntaxDefinition syntax) { + super(src, node); + + this.syntax = syntax; + } + + @Override + public boolean isSyntax() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitImportSyntax(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = syntax.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + syntax.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Syntax)) { + return false; + } + Syntax tmp = (Syntax) o; + return true && tmp.syntax.equals(this.syntax) ; + } + + @Override + public int hashCode() { + return 239 + 151 * syntax.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.SyntaxDefinition getSyntax() { + return this.syntax; + } + + @Override + public boolean hasSyntax() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(syntax)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/ImportedModule.java b/src/org/rascalmpl/ast/ImportedModule.java new file mode 100644 index 00000000000..1f6849398b7 --- /dev/null +++ b/src/org/rascalmpl/ast/ImportedModule.java @@ -0,0 +1,426 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class ImportedModule extends AbstractAST { + public ImportedModule(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasActuals() { + return false; + } + + public org.rascalmpl.ast.ModuleActuals getActuals() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasName() { + return false; + } + + public org.rascalmpl.ast.QualifiedName getName() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasRenamings() { + return false; + } + + public org.rascalmpl.ast.Renamings getRenamings() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isActuals() { + return false; + } + + static public class Actuals extends ImportedModule { + // Production: sig("Actuals",[arg("org.rascalmpl.ast.QualifiedName","name"),arg("org.rascalmpl.ast.ModuleActuals","actuals")],breakable=false) + + + private final org.rascalmpl.ast.QualifiedName name; + private final org.rascalmpl.ast.ModuleActuals actuals; + + public Actuals(ISourceLocation src, IConstructor node , org.rascalmpl.ast.QualifiedName name, org.rascalmpl.ast.ModuleActuals actuals) { + super(src, node); + + this.name = name; + this.actuals = actuals; + } + + @Override + public boolean isActuals() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitImportedModuleActuals(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = actuals.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + actuals.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Actuals)) { + return false; + } + Actuals tmp = (Actuals) o; + return true && tmp.name.equals(this.name) && tmp.actuals.equals(this.actuals) ; + } + + @Override + public int hashCode() { + return 397 + 137 * name.hashCode() + 811 * actuals.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.QualifiedName getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + @Override + public org.rascalmpl.ast.ModuleActuals getActuals() { + return this.actuals; + } + + @Override + public boolean hasActuals() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(name), clone(actuals)); + } + + } + public boolean isActualsRenaming() { + return false; + } + + static public class ActualsRenaming extends ImportedModule { + // Production: sig("ActualsRenaming",[arg("org.rascalmpl.ast.QualifiedName","name"),arg("org.rascalmpl.ast.ModuleActuals","actuals"),arg("org.rascalmpl.ast.Renamings","renamings")],breakable=false) + + + private final org.rascalmpl.ast.QualifiedName name; + private final org.rascalmpl.ast.ModuleActuals actuals; + private final org.rascalmpl.ast.Renamings renamings; + + public ActualsRenaming(ISourceLocation src, IConstructor node , org.rascalmpl.ast.QualifiedName name, org.rascalmpl.ast.ModuleActuals actuals, org.rascalmpl.ast.Renamings renamings) { + super(src, node); + + this.name = name; + this.actuals = actuals; + this.renamings = renamings; + } + + @Override + public boolean isActualsRenaming() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitImportedModuleActualsRenaming(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = actuals.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + actuals.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = renamings.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + renamings.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof ActualsRenaming)) { + return false; + } + ActualsRenaming tmp = (ActualsRenaming) o; + return true && tmp.name.equals(this.name) && tmp.actuals.equals(this.actuals) && tmp.renamings.equals(this.renamings) ; + } + + @Override + public int hashCode() { + return 709 + 167 * name.hashCode() + 53 * actuals.hashCode() + 463 * renamings.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.QualifiedName getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + @Override + public org.rascalmpl.ast.ModuleActuals getActuals() { + return this.actuals; + } + + @Override + public boolean hasActuals() { + return true; + } + @Override + public org.rascalmpl.ast.Renamings getRenamings() { + return this.renamings; + } + + @Override + public boolean hasRenamings() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(name), clone(actuals), clone(renamings)); + } + + } + public boolean isDefault() { + return false; + } + + static public class Default extends ImportedModule { + // Production: sig("Default",[arg("org.rascalmpl.ast.QualifiedName","name")],breakable=false) + + + private final org.rascalmpl.ast.QualifiedName name; + + public Default(ISourceLocation src, IConstructor node , org.rascalmpl.ast.QualifiedName name) { + super(src, node); + + this.name = name; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitImportedModuleDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.name.equals(this.name) ; + } + + @Override + public int hashCode() { + return 127 + 67 * name.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.QualifiedName getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(name)); + } + + } + public boolean isRenamings() { + return false; + } + + static public class Renamings extends ImportedModule { + // Production: sig("Renamings",[arg("org.rascalmpl.ast.QualifiedName","name"),arg("org.rascalmpl.ast.Renamings","renamings")],breakable=false) + + + private final org.rascalmpl.ast.QualifiedName name; + private final org.rascalmpl.ast.Renamings renamings; + + public Renamings(ISourceLocation src, IConstructor node , org.rascalmpl.ast.QualifiedName name, org.rascalmpl.ast.Renamings renamings) { + super(src, node); + + this.name = name; + this.renamings = renamings; + } + + @Override + public boolean isRenamings() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitImportedModuleRenamings(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = renamings.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + renamings.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Renamings)) { + return false; + } + Renamings tmp = (Renamings) o; + return true && tmp.name.equals(this.name) && tmp.renamings.equals(this.renamings) ; + } + + @Override + public int hashCode() { + return 643 + 229 * name.hashCode() + 271 * renamings.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.QualifiedName getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + @Override + public org.rascalmpl.ast.Renamings getRenamings() { + return this.renamings; + } + + @Override + public boolean hasRenamings() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(name), clone(renamings)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/IntegerLiteral.java b/src/org/rascalmpl/ast/IntegerLiteral.java new file mode 100644 index 00000000000..6d62374dee4 --- /dev/null +++ b/src/org/rascalmpl/ast/IntegerLiteral.java @@ -0,0 +1,276 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class IntegerLiteral extends AbstractAST { + public IntegerLiteral(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasDecimal() { + return false; + } + + public org.rascalmpl.ast.DecimalIntegerLiteral getDecimal() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasHex() { + return false; + } + + public org.rascalmpl.ast.HexIntegerLiteral getHex() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasOctal() { + return false; + } + + public org.rascalmpl.ast.OctalIntegerLiteral getOctal() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDecimalIntegerLiteral() { + return false; + } + + static public class DecimalIntegerLiteral extends IntegerLiteral { + // Production: sig("DecimalIntegerLiteral",[arg("org.rascalmpl.ast.DecimalIntegerLiteral","decimal")],breakable=false) + + + private final org.rascalmpl.ast.DecimalIntegerLiteral decimal; + + public DecimalIntegerLiteral(ISourceLocation src, IConstructor node , org.rascalmpl.ast.DecimalIntegerLiteral decimal) { + super(src, node); + + this.decimal = decimal; + } + + @Override + public boolean isDecimalIntegerLiteral() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitIntegerLiteralDecimalIntegerLiteral(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = decimal.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + decimal.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof DecimalIntegerLiteral)) { + return false; + } + DecimalIntegerLiteral tmp = (DecimalIntegerLiteral) o; + return true && tmp.decimal.equals(this.decimal) ; + } + + @Override + public int hashCode() { + return 331 + 17 * decimal.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.DecimalIntegerLiteral getDecimal() { + return this.decimal; + } + + @Override + public boolean hasDecimal() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(decimal)); + } + + } + public boolean isHexIntegerLiteral() { + return false; + } + + static public class HexIntegerLiteral extends IntegerLiteral { + // Production: sig("HexIntegerLiteral",[arg("org.rascalmpl.ast.HexIntegerLiteral","hex")],breakable=false) + + + private final org.rascalmpl.ast.HexIntegerLiteral hex; + + public HexIntegerLiteral(ISourceLocation src, IConstructor node , org.rascalmpl.ast.HexIntegerLiteral hex) { + super(src, node); + + this.hex = hex; + } + + @Override + public boolean isHexIntegerLiteral() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitIntegerLiteralHexIntegerLiteral(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = hex.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + hex.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof HexIntegerLiteral)) { + return false; + } + HexIntegerLiteral tmp = (HexIntegerLiteral) o; + return true && tmp.hex.equals(this.hex) ; + } + + @Override + public int hashCode() { + return 401 + 313 * hex.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.HexIntegerLiteral getHex() { + return this.hex; + } + + @Override + public boolean hasHex() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(hex)); + } + + } + public boolean isOctalIntegerLiteral() { + return false; + } + + static public class OctalIntegerLiteral extends IntegerLiteral { + // Production: sig("OctalIntegerLiteral",[arg("org.rascalmpl.ast.OctalIntegerLiteral","octal")],breakable=false) + + + private final org.rascalmpl.ast.OctalIntegerLiteral octal; + + public OctalIntegerLiteral(ISourceLocation src, IConstructor node , org.rascalmpl.ast.OctalIntegerLiteral octal) { + super(src, node); + + this.octal = octal; + } + + @Override + public boolean isOctalIntegerLiteral() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitIntegerLiteralOctalIntegerLiteral(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = octal.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + octal.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof OctalIntegerLiteral)) { + return false; + } + OctalIntegerLiteral tmp = (OctalIntegerLiteral) o; + return true && tmp.octal.equals(this.octal) ; + } + + @Override + public int hashCode() { + return 449 + 463 * octal.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.OctalIntegerLiteral getOctal() { + return this.octal; + } + + @Override + public boolean hasOctal() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(octal)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/JustDate.java b/src/org/rascalmpl/ast/JustDate.java new file mode 100644 index 00000000000..fda759a189b --- /dev/null +++ b/src/org/rascalmpl/ast/JustDate.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class JustDate extends AbstractAST { + public JustDate(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends JustDate { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitJustDateLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/JustTime.java b/src/org/rascalmpl/ast/JustTime.java new file mode 100644 index 00000000000..1f8d3d9510d --- /dev/null +++ b/src/org/rascalmpl/ast/JustTime.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class JustTime extends AbstractAST { + public JustTime(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends JustTime { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitJustTimeLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/KeywordArgument_Expression.java b/src/org/rascalmpl/ast/KeywordArgument_Expression.java new file mode 100644 index 00000000000..a3d36aa445a --- /dev/null +++ b/src/org/rascalmpl/ast/KeywordArgument_Expression.java @@ -0,0 +1,140 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class KeywordArgument_Expression extends AbstractAST { + public KeywordArgument_Expression(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasExpression() { + return false; + } + + public org.rascalmpl.ast.Expression getExpression() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasName() { + return false; + } + + public org.rascalmpl.ast.Name getName() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDefault() { + return false; + } + + static public class Default extends KeywordArgument_Expression { + // Production: sig("Default",[arg("org.rascalmpl.ast.Name","name"),arg("org.rascalmpl.ast.Expression","expression")],breakable=false) + + + private final org.rascalmpl.ast.Name name; + private final org.rascalmpl.ast.Expression expression; + + public Default(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Name name, org.rascalmpl.ast.Expression expression) { + super(src, node); + + this.name = name; + this.expression = expression; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitKeywordArgument_ExpressionDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.name.equals(this.name) && tmp.expression.equals(this.expression) ; + } + + @Override + public int hashCode() { + return 971 + 179 * name.hashCode() + 229 * expression.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Name getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(name), clone(expression)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/KeywordArguments_Expression.java b/src/org/rascalmpl/ast/KeywordArguments_Expression.java new file mode 100644 index 00000000000..7a19baa2a8b --- /dev/null +++ b/src/org/rascalmpl/ast/KeywordArguments_Expression.java @@ -0,0 +1,197 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class KeywordArguments_Expression extends AbstractAST { + public KeywordArguments_Expression(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasKeywordArgumentList() { + return false; + } + + public java.util.List getKeywordArgumentList() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasOptionalComma() { + return false; + } + + public org.rascalmpl.ast.OptionalComma getOptionalComma() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDefault() { + return false; + } + + static public class Default extends KeywordArguments_Expression { + // Production: sig("Default",[arg("org.rascalmpl.ast.OptionalComma","optionalComma"),arg("java.util.List\","keywordArgumentList")],breakable=false) + + + private final org.rascalmpl.ast.OptionalComma optionalComma; + private final java.util.List keywordArgumentList; + + public Default(ISourceLocation src, IConstructor node , org.rascalmpl.ast.OptionalComma optionalComma, java.util.List keywordArgumentList) { + super(src, node); + + this.optionalComma = optionalComma; + this.keywordArgumentList = keywordArgumentList; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitKeywordArguments_ExpressionDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = optionalComma.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + optionalComma.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : keywordArgumentList) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.optionalComma.equals(this.optionalComma) && tmp.keywordArgumentList.equals(this.keywordArgumentList) ; + } + + @Override + public int hashCode() { + return 823 + 43 * optionalComma.hashCode() + 733 * keywordArgumentList.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.OptionalComma getOptionalComma() { + return this.optionalComma; + } + + @Override + public boolean hasOptionalComma() { + return true; + } + @Override + public java.util.List getKeywordArgumentList() { + return this.keywordArgumentList; + } + + @Override + public boolean hasKeywordArgumentList() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(optionalComma), clone(keywordArgumentList)); + } + + } + public boolean isNone() { + return false; + } + + static public class None extends KeywordArguments_Expression { + // Production: sig("None",[],breakable=false) + + + + public None(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isNone() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitKeywordArguments_ExpressionNone(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof None)) { + return false; + } + None tmp = (None) o; + return true ; + } + + @Override + public int hashCode() { + return 239 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/KeywordFormal.java b/src/org/rascalmpl/ast/KeywordFormal.java new file mode 100644 index 00000000000..5f62914613f --- /dev/null +++ b/src/org/rascalmpl/ast/KeywordFormal.java @@ -0,0 +1,166 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class KeywordFormal extends AbstractAST { + public KeywordFormal(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasExpression() { + return false; + } + + public org.rascalmpl.ast.Expression getExpression() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasName() { + return false; + } + + public org.rascalmpl.ast.Name getName() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasType() { + return false; + } + + public org.rascalmpl.ast.Type getType() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDefault() { + return false; + } + + static public class Default extends KeywordFormal { + // Production: sig("Default",[arg("org.rascalmpl.ast.Type","type"),arg("org.rascalmpl.ast.Name","name"),arg("org.rascalmpl.ast.Expression","expression")],breakable=false) + + + private final org.rascalmpl.ast.Type type; + private final org.rascalmpl.ast.Name name; + private final org.rascalmpl.ast.Expression expression; + + public Default(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Type type, org.rascalmpl.ast.Name name, org.rascalmpl.ast.Expression expression) { + super(src, node); + + this.type = type; + this.name = name; + this.expression = expression; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitKeywordFormalDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = type.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + type.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.type.equals(this.type) && tmp.name.equals(this.name) && tmp.expression.equals(this.expression) ; + } + + @Override + public int hashCode() { + return 941 + 941 * type.hashCode() + 2 * name.hashCode() + 421 * expression.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Type getType() { + return this.type; + } + + @Override + public boolean hasType() { + return true; + } + @Override + public org.rascalmpl.ast.Name getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(type), clone(name), clone(expression)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/KeywordFormals.java b/src/org/rascalmpl/ast/KeywordFormals.java new file mode 100644 index 00000000000..39da173f4d0 --- /dev/null +++ b/src/org/rascalmpl/ast/KeywordFormals.java @@ -0,0 +1,197 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class KeywordFormals extends AbstractAST { + public KeywordFormals(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasKeywordFormalList() { + return false; + } + + public java.util.List getKeywordFormalList() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasOptionalComma() { + return false; + } + + public org.rascalmpl.ast.OptionalComma getOptionalComma() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDefault() { + return false; + } + + static public class Default extends KeywordFormals { + // Production: sig("Default",[arg("org.rascalmpl.ast.OptionalComma","optionalComma"),arg("java.util.List\","keywordFormalList")],breakable=false) + + + private final org.rascalmpl.ast.OptionalComma optionalComma; + private final java.util.List keywordFormalList; + + public Default(ISourceLocation src, IConstructor node , org.rascalmpl.ast.OptionalComma optionalComma, java.util.List keywordFormalList) { + super(src, node); + + this.optionalComma = optionalComma; + this.keywordFormalList = keywordFormalList; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitKeywordFormalsDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = optionalComma.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + optionalComma.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : keywordFormalList) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.optionalComma.equals(this.optionalComma) && tmp.keywordFormalList.equals(this.keywordFormalList) ; + } + + @Override + public int hashCode() { + return 941 + 307 * optionalComma.hashCode() + 941 * keywordFormalList.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.OptionalComma getOptionalComma() { + return this.optionalComma; + } + + @Override + public boolean hasOptionalComma() { + return true; + } + @Override + public java.util.List getKeywordFormalList() { + return this.keywordFormalList; + } + + @Override + public boolean hasKeywordFormalList() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(optionalComma), clone(keywordFormalList)); + } + + } + public boolean isNone() { + return false; + } + + static public class None extends KeywordFormals { + // Production: sig("None",[],breakable=false) + + + + public None(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isNone() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitKeywordFormalsNone(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof None)) { + return false; + } + None tmp = (None) o; + return true ; + } + + @Override + public int hashCode() { + return 631 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Kind.java b/src/org/rascalmpl/ast/Kind.java new file mode 100644 index 00000000000..07e5f1f9550 --- /dev/null +++ b/src/org/rascalmpl/ast/Kind.java @@ -0,0 +1,528 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Kind extends AbstractAST { + public Kind(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + + + + public boolean isAlias() { + return false; + } + + static public class Alias extends Kind { + // Production: sig("Alias",[],breakable=false) + + + + public Alias(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isAlias() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitKindAlias(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Alias)) { + return false; + } + Alias tmp = (Alias) o; + return true ; + } + + @Override + public int hashCode() { + return 269 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isAll() { + return false; + } + + static public class All extends Kind { + // Production: sig("All",[],breakable=false) + + + + public All(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isAll() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitKindAll(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof All)) { + return false; + } + All tmp = (All) o; + return true ; + } + + @Override + public int hashCode() { + return 293 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isAnno() { + return false; + } + + static public class Anno extends Kind { + // Production: sig("Anno",[],breakable=false) + + + + public Anno(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isAnno() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitKindAnno(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Anno)) { + return false; + } + Anno tmp = (Anno) o; + return true ; + } + + @Override + public int hashCode() { + return 757 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isData() { + return false; + } + + static public class Data extends Kind { + // Production: sig("Data",[],breakable=false) + + + + public Data(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isData() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitKindData(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Data)) { + return false; + } + Data tmp = (Data) o; + return true ; + } + + @Override + public int hashCode() { + return 829 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isFunction() { + return false; + } + + static public class Function extends Kind { + // Production: sig("Function",[],breakable=false) + + + + public Function(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isFunction() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitKindFunction(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Function)) { + return false; + } + Function tmp = (Function) o; + return true ; + } + + @Override + public int hashCode() { + return 47 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isModule() { + return false; + } + + static public class Module extends Kind { + // Production: sig("Module",[],breakable=false) + + + + public Module(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isModule() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitKindModule(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Module)) { + return false; + } + Module tmp = (Module) o; + return true ; + } + + @Override + public int hashCode() { + return 257 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isTag() { + return false; + } + + static public class Tag extends Kind { + // Production: sig("Tag",[],breakable=false) + + + + public Tag(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isTag() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitKindTag(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Tag)) { + return false; + } + Tag tmp = (Tag) o; + return true ; + } + + @Override + public int hashCode() { + return 367 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isVariable() { + return false; + } + + static public class Variable extends Kind { + // Production: sig("Variable",[],breakable=false) + + + + public Variable(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isVariable() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitKindVariable(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Variable)) { + return false; + } + Variable tmp = (Variable) o; + return true ; + } + + @Override + public int hashCode() { + return 421 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isView() { + return false; + } + + static public class View extends Kind { + // Production: sig("View",[],breakable=false) + + + + public View(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isView() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitKindView(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof View)) { + return false; + } + View tmp = (View) o; + return true ; + } + + @Override + public int hashCode() { + return 577 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/LAYOUT.java b/src/org/rascalmpl/ast/LAYOUT.java new file mode 100644 index 00000000000..8b17a784034 --- /dev/null +++ b/src/org/rascalmpl/ast/LAYOUT.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class LAYOUT extends AbstractAST { + public LAYOUT(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends LAYOUT { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitLAYOUTLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Label.java b/src/org/rascalmpl/ast/Label.java new file mode 100644 index 00000000000..af148f82145 --- /dev/null +++ b/src/org/rascalmpl/ast/Label.java @@ -0,0 +1,169 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Label extends AbstractAST { + public Label(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasName() { + return false; + } + + public org.rascalmpl.ast.Name getName() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDefault() { + return false; + } + + static public class Default extends Label { + // Production: sig("Default",[arg("org.rascalmpl.ast.Name","name")],breakable=false) + + + private final org.rascalmpl.ast.Name name; + + public Default(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Name name) { + super(src, node); + + this.name = name; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitLabelDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.name.equals(this.name) ; + } + + @Override + public int hashCode() { + return 653 + 701 * name.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Name getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(name)); + } + + } + public boolean isEmpty() { + return false; + } + + static public class Empty extends Label { + // Production: sig("Empty",[],breakable=false) + + + + public Empty(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isEmpty() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitLabelEmpty(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Empty)) { + return false; + } + Empty tmp = (Empty) o; + return true ; + } + + @Override + public int hashCode() { + return 233 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Literal.java b/src/org/rascalmpl/ast/Literal.java new file mode 100644 index 00000000000..5d716036b07 --- /dev/null +++ b/src/org/rascalmpl/ast/Literal.java @@ -0,0 +1,681 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Literal extends AbstractAST { + public Literal(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasBooleanLiteral() { + return false; + } + + public org.rascalmpl.ast.BooleanLiteral getBooleanLiteral() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasDateTimeLiteral() { + return false; + } + + public org.rascalmpl.ast.DateTimeLiteral getDateTimeLiteral() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasIntegerLiteral() { + return false; + } + + public org.rascalmpl.ast.IntegerLiteral getIntegerLiteral() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasLocationLiteral() { + return false; + } + + public org.rascalmpl.ast.LocationLiteral getLocationLiteral() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasRationalLiteral() { + return false; + } + + public org.rascalmpl.ast.RationalLiteral getRationalLiteral() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasRealLiteral() { + return false; + } + + public org.rascalmpl.ast.RealLiteral getRealLiteral() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasRegExpLiteral() { + return false; + } + + public org.rascalmpl.ast.RegExpLiteral getRegExpLiteral() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasStringLiteral() { + return false; + } + + public org.rascalmpl.ast.StringLiteral getStringLiteral() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isBoolean() { + return false; + } + + static public class Boolean extends Literal { + // Production: sig("Boolean",[arg("org.rascalmpl.ast.BooleanLiteral","booleanLiteral")],breakable=false) + + + private final org.rascalmpl.ast.BooleanLiteral booleanLiteral; + + public Boolean(ISourceLocation src, IConstructor node , org.rascalmpl.ast.BooleanLiteral booleanLiteral) { + super(src, node); + + this.booleanLiteral = booleanLiteral; + } + + @Override + public boolean isBoolean() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitLiteralBoolean(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = booleanLiteral.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + booleanLiteral.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Boolean)) { + return false; + } + Boolean tmp = (Boolean) o; + return true && tmp.booleanLiteral.equals(this.booleanLiteral) ; + } + + @Override + public int hashCode() { + return 577 + 643 * booleanLiteral.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.BooleanLiteral getBooleanLiteral() { + return this.booleanLiteral; + } + + @Override + public boolean hasBooleanLiteral() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(booleanLiteral)); + } + + } + public boolean isDateTime() { + return false; + } + + static public class DateTime extends Literal { + // Production: sig("DateTime",[arg("org.rascalmpl.ast.DateTimeLiteral","dateTimeLiteral")],breakable=false) + + + private final org.rascalmpl.ast.DateTimeLiteral dateTimeLiteral; + + public DateTime(ISourceLocation src, IConstructor node , org.rascalmpl.ast.DateTimeLiteral dateTimeLiteral) { + super(src, node); + + this.dateTimeLiteral = dateTimeLiteral; + } + + @Override + public boolean isDateTime() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitLiteralDateTime(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = dateTimeLiteral.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + dateTimeLiteral.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof DateTime)) { + return false; + } + DateTime tmp = (DateTime) o; + return true && tmp.dateTimeLiteral.equals(this.dateTimeLiteral) ; + } + + @Override + public int hashCode() { + return 631 + 173 * dateTimeLiteral.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.DateTimeLiteral getDateTimeLiteral() { + return this.dateTimeLiteral; + } + + @Override + public boolean hasDateTimeLiteral() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(dateTimeLiteral)); + } + + } + public boolean isInteger() { + return false; + } + + static public class Integer extends Literal { + // Production: sig("Integer",[arg("org.rascalmpl.ast.IntegerLiteral","integerLiteral")],breakable=false) + + + private final org.rascalmpl.ast.IntegerLiteral integerLiteral; + + public Integer(ISourceLocation src, IConstructor node , org.rascalmpl.ast.IntegerLiteral integerLiteral) { + super(src, node); + + this.integerLiteral = integerLiteral; + } + + @Override + public boolean isInteger() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitLiteralInteger(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = integerLiteral.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + integerLiteral.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Integer)) { + return false; + } + Integer tmp = (Integer) o; + return true && tmp.integerLiteral.equals(this.integerLiteral) ; + } + + @Override + public int hashCode() { + return 103 + 257 * integerLiteral.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.IntegerLiteral getIntegerLiteral() { + return this.integerLiteral; + } + + @Override + public boolean hasIntegerLiteral() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(integerLiteral)); + } + + } + public boolean isLocation() { + return false; + } + + static public class Location extends Literal { + // Production: sig("Location",[arg("org.rascalmpl.ast.LocationLiteral","locationLiteral")],breakable=false) + + + private final org.rascalmpl.ast.LocationLiteral locationLiteral; + + public Location(ISourceLocation src, IConstructor node , org.rascalmpl.ast.LocationLiteral locationLiteral) { + super(src, node); + + this.locationLiteral = locationLiteral; + } + + @Override + public boolean isLocation() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitLiteralLocation(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = locationLiteral.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + locationLiteral.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Location)) { + return false; + } + Location tmp = (Location) o; + return true && tmp.locationLiteral.equals(this.locationLiteral) ; + } + + @Override + public int hashCode() { + return 283 + 521 * locationLiteral.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.LocationLiteral getLocationLiteral() { + return this.locationLiteral; + } + + @Override + public boolean hasLocationLiteral() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(locationLiteral)); + } + + } + public boolean isRational() { + return false; + } + + static public class Rational extends Literal { + // Production: sig("Rational",[arg("org.rascalmpl.ast.RationalLiteral","rationalLiteral")],breakable=false) + + + private final org.rascalmpl.ast.RationalLiteral rationalLiteral; + + public Rational(ISourceLocation src, IConstructor node , org.rascalmpl.ast.RationalLiteral rationalLiteral) { + super(src, node); + + this.rationalLiteral = rationalLiteral; + } + + @Override + public boolean isRational() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitLiteralRational(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = rationalLiteral.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rationalLiteral.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Rational)) { + return false; + } + Rational tmp = (Rational) o; + return true && tmp.rationalLiteral.equals(this.rationalLiteral) ; + } + + @Override + public int hashCode() { + return 127 + 89 * rationalLiteral.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.RationalLiteral getRationalLiteral() { + return this.rationalLiteral; + } + + @Override + public boolean hasRationalLiteral() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(rationalLiteral)); + } + + } + public boolean isReal() { + return false; + } + + static public class Real extends Literal { + // Production: sig("Real",[arg("org.rascalmpl.ast.RealLiteral","realLiteral")],breakable=false) + + + private final org.rascalmpl.ast.RealLiteral realLiteral; + + public Real(ISourceLocation src, IConstructor node , org.rascalmpl.ast.RealLiteral realLiteral) { + super(src, node); + + this.realLiteral = realLiteral; + } + + @Override + public boolean isReal() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitLiteralReal(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = realLiteral.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + realLiteral.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Real)) { + return false; + } + Real tmp = (Real) o; + return true && tmp.realLiteral.equals(this.realLiteral) ; + } + + @Override + public int hashCode() { + return 739 + 547 * realLiteral.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.RealLiteral getRealLiteral() { + return this.realLiteral; + } + + @Override + public boolean hasRealLiteral() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(realLiteral)); + } + + } + public boolean isRegExp() { + return false; + } + + static public class RegExp extends Literal { + // Production: sig("RegExp",[arg("org.rascalmpl.ast.RegExpLiteral","regExpLiteral")],breakable=false) + + + private final org.rascalmpl.ast.RegExpLiteral regExpLiteral; + + public RegExp(ISourceLocation src, IConstructor node , org.rascalmpl.ast.RegExpLiteral regExpLiteral) { + super(src, node); + + this.regExpLiteral = regExpLiteral; + } + + @Override + public boolean isRegExp() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitLiteralRegExp(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = regExpLiteral.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + regExpLiteral.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof RegExp)) { + return false; + } + RegExp tmp = (RegExp) o; + return true && tmp.regExpLiteral.equals(this.regExpLiteral) ; + } + + @Override + public int hashCode() { + return 3 + 373 * regExpLiteral.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.RegExpLiteral getRegExpLiteral() { + return this.regExpLiteral; + } + + @Override + public boolean hasRegExpLiteral() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(regExpLiteral)); + } + + } + public boolean isString() { + return false; + } + + static public class String extends Literal { + // Production: sig("String",[arg("org.rascalmpl.ast.StringLiteral","stringLiteral")],breakable=false) + + + private final org.rascalmpl.ast.StringLiteral stringLiteral; + + public String(ISourceLocation src, IConstructor node , org.rascalmpl.ast.StringLiteral stringLiteral) { + super(src, node); + + this.stringLiteral = stringLiteral; + } + + @Override + public boolean isString() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitLiteralString(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = stringLiteral.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + stringLiteral.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof String)) { + return false; + } + String tmp = (String) o; + return true && tmp.stringLiteral.equals(this.stringLiteral) ; + } + + @Override + public int hashCode() { + return 31 + 283 * stringLiteral.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.StringLiteral getStringLiteral() { + return this.stringLiteral; + } + + @Override + public boolean hasStringLiteral() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(stringLiteral)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/LocalVariableDeclaration.java b/src/org/rascalmpl/ast/LocalVariableDeclaration.java new file mode 100644 index 00000000000..8c6a80c9af7 --- /dev/null +++ b/src/org/rascalmpl/ast/LocalVariableDeclaration.java @@ -0,0 +1,188 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class LocalVariableDeclaration extends AbstractAST { + public LocalVariableDeclaration(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasDeclarator() { + return false; + } + + public org.rascalmpl.ast.Declarator getDeclarator() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDefault() { + return false; + } + + static public class Default extends LocalVariableDeclaration { + // Production: sig("Default",[arg("org.rascalmpl.ast.Declarator","declarator")],breakable=false) + + + private final org.rascalmpl.ast.Declarator declarator; + + public Default(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Declarator declarator) { + super(src, node); + + this.declarator = declarator; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitLocalVariableDeclarationDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = declarator.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + declarator.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.declarator.equals(this.declarator) ; + } + + @Override + public int hashCode() { + return 461 + 7 * declarator.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Declarator getDeclarator() { + return this.declarator; + } + + @Override + public boolean hasDeclarator() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(declarator)); + } + + } + public boolean isDynamic() { + return false; + } + + static public class Dynamic extends LocalVariableDeclaration { + // Production: sig("Dynamic",[arg("org.rascalmpl.ast.Declarator","declarator")],breakable=false) + + + private final org.rascalmpl.ast.Declarator declarator; + + public Dynamic(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Declarator declarator) { + super(src, node); + + this.declarator = declarator; + } + + @Override + public boolean isDynamic() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitLocalVariableDeclarationDynamic(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = declarator.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + declarator.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Dynamic)) { + return false; + } + Dynamic tmp = (Dynamic) o; + return true && tmp.declarator.equals(this.declarator) ; + } + + @Override + public int hashCode() { + return 463 + 691 * declarator.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Declarator getDeclarator() { + return this.declarator; + } + + @Override + public boolean hasDeclarator() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(declarator)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/LocationLiteral.java b/src/org/rascalmpl/ast/LocationLiteral.java new file mode 100644 index 00000000000..b45792e0f24 --- /dev/null +++ b/src/org/rascalmpl/ast/LocationLiteral.java @@ -0,0 +1,140 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class LocationLiteral extends AbstractAST { + public LocationLiteral(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasPathPart() { + return false; + } + + public org.rascalmpl.ast.PathPart getPathPart() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasProtocolPart() { + return false; + } + + public org.rascalmpl.ast.ProtocolPart getProtocolPart() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDefault() { + return false; + } + + static public class Default extends LocationLiteral { + // Production: sig("Default",[arg("org.rascalmpl.ast.ProtocolPart","protocolPart"),arg("org.rascalmpl.ast.PathPart","pathPart")],breakable=false) + + + private final org.rascalmpl.ast.ProtocolPart protocolPart; + private final org.rascalmpl.ast.PathPart pathPart; + + public Default(ISourceLocation src, IConstructor node , org.rascalmpl.ast.ProtocolPart protocolPart, org.rascalmpl.ast.PathPart pathPart) { + super(src, node); + + this.protocolPart = protocolPart; + this.pathPart = pathPart; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitLocationLiteralDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = protocolPart.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + protocolPart.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = pathPart.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + pathPart.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.protocolPart.equals(this.protocolPart) && tmp.pathPart.equals(this.pathPart) ; + } + + @Override + public int hashCode() { + return 479 + 89 * protocolPart.hashCode() + 937 * pathPart.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.ProtocolPart getProtocolPart() { + return this.protocolPart; + } + + @Override + public boolean hasProtocolPart() { + return true; + } + @Override + public org.rascalmpl.ast.PathPart getPathPart() { + return this.pathPart; + } + + @Override + public boolean hasPathPart() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(protocolPart), clone(pathPart)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Mapping_Expression.java b/src/org/rascalmpl/ast/Mapping_Expression.java new file mode 100644 index 00000000000..2a7f8a9e4ef --- /dev/null +++ b/src/org/rascalmpl/ast/Mapping_Expression.java @@ -0,0 +1,140 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Mapping_Expression extends AbstractAST { + public Mapping_Expression(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasFrom() { + return false; + } + + public org.rascalmpl.ast.Expression getFrom() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasTo() { + return false; + } + + public org.rascalmpl.ast.Expression getTo() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDefault() { + return false; + } + + static public class Default extends Mapping_Expression { + // Production: sig("Default",[arg("org.rascalmpl.ast.Expression","from"),arg("org.rascalmpl.ast.Expression","to")],breakable=false) + + + private final org.rascalmpl.ast.Expression from; + private final org.rascalmpl.ast.Expression to; + + public Default(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression from, org.rascalmpl.ast.Expression to) { + super(src, node); + + this.from = from; + this.to = to; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitMapping_ExpressionDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = from.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + from.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = to.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + to.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.from.equals(this.from) && tmp.to.equals(this.to) ; + } + + @Override + public int hashCode() { + return 631 + 797 * from.hashCode() + 239 * to.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getFrom() { + return this.from; + } + + @Override + public boolean hasFrom() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getTo() { + return this.to; + } + + @Override + public boolean hasTo() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(from), clone(to)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/MidPathChars.java b/src/org/rascalmpl/ast/MidPathChars.java new file mode 100644 index 00000000000..4145eac9a3f --- /dev/null +++ b/src/org/rascalmpl/ast/MidPathChars.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class MidPathChars extends AbstractAST { + public MidPathChars(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends MidPathChars { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitMidPathCharsLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/MidProtocolChars.java b/src/org/rascalmpl/ast/MidProtocolChars.java new file mode 100644 index 00000000000..a3180b84691 --- /dev/null +++ b/src/org/rascalmpl/ast/MidProtocolChars.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class MidProtocolChars extends AbstractAST { + public MidProtocolChars(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends MidProtocolChars { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitMidProtocolCharsLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/MidStringChars.java b/src/org/rascalmpl/ast/MidStringChars.java new file mode 100644 index 00000000000..74c3f6c55be --- /dev/null +++ b/src/org/rascalmpl/ast/MidStringChars.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class MidStringChars extends AbstractAST { + public MidStringChars(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends MidStringChars { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitMidStringCharsLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Module.java b/src/org/rascalmpl/ast/Module.java new file mode 100644 index 00000000000..8a52876d2cd --- /dev/null +++ b/src/org/rascalmpl/ast/Module.java @@ -0,0 +1,140 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Module extends AbstractAST { + public Module(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasBody() { + return false; + } + + public org.rascalmpl.ast.Body getBody() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasHeader() { + return false; + } + + public org.rascalmpl.ast.Header getHeader() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDefault() { + return false; + } + + static public class Default extends Module { + // Production: sig("Default",[arg("org.rascalmpl.ast.Header","header"),arg("org.rascalmpl.ast.Body","body")],breakable=false) + + + private final org.rascalmpl.ast.Header header; + private final org.rascalmpl.ast.Body body; + + public Default(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Header header, org.rascalmpl.ast.Body body) { + super(src, node); + + this.header = header; + this.body = body; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitModuleDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = header.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + header.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = body.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + body.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.header.equals(this.header) && tmp.body.equals(this.body) ; + } + + @Override + public int hashCode() { + return 137 + 277 * header.hashCode() + 281 * body.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Header getHeader() { + return this.header; + } + + @Override + public boolean hasHeader() { + return true; + } + @Override + public org.rascalmpl.ast.Body getBody() { + return this.body; + } + + @Override + public boolean hasBody() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(header), clone(body)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/ModuleActuals.java b/src/org/rascalmpl/ast/ModuleActuals.java new file mode 100644 index 00000000000..3307eccd1a6 --- /dev/null +++ b/src/org/rascalmpl/ast/ModuleActuals.java @@ -0,0 +1,116 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class ModuleActuals extends AbstractAST { + public ModuleActuals(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasTypes() { + return false; + } + + public java.util.List getTypes() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDefault() { + return false; + } + + static public class Default extends ModuleActuals { + // Production: sig("Default",[arg("java.util.List\","types")],breakable=false) + + + private final java.util.List types; + + public Default(ISourceLocation src, IConstructor node , java.util.List types) { + super(src, node); + + this.types = types; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitModuleActualsDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : types) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.types.equals(this.types) ; + } + + @Override + public int hashCode() { + return 229 + 211 * types.hashCode() ; + } + + + @Override + public java.util.List getTypes() { + return this.types; + } + + @Override + public boolean hasTypes() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(types)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/ModuleParameters.java b/src/org/rascalmpl/ast/ModuleParameters.java new file mode 100644 index 00000000000..49377290241 --- /dev/null +++ b/src/org/rascalmpl/ast/ModuleParameters.java @@ -0,0 +1,116 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class ModuleParameters extends AbstractAST { + public ModuleParameters(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasParameters() { + return false; + } + + public java.util.List getParameters() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDefault() { + return false; + } + + static public class Default extends ModuleParameters { + // Production: sig("Default",[arg("java.util.List\","parameters")],breakable=false) + + + private final java.util.List parameters; + + public Default(ISourceLocation src, IConstructor node , java.util.List parameters) { + super(src, node); + + this.parameters = parameters; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitModuleParametersDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : parameters) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.parameters.equals(this.parameters) ; + } + + @Override + public int hashCode() { + return 83 + 673 * parameters.hashCode() ; + } + + + @Override + public java.util.List getParameters() { + return this.parameters; + } + + @Override + public boolean hasParameters() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(parameters)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Name.java b/src/org/rascalmpl/ast/Name.java new file mode 100644 index 00000000000..0a4afd5622e --- /dev/null +++ b/src/org/rascalmpl/ast/Name.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Name extends AbstractAST { + public Name(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends Name { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitNameLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/NamedBackslash.java b/src/org/rascalmpl/ast/NamedBackslash.java new file mode 100644 index 00000000000..2c7c8486b2c --- /dev/null +++ b/src/org/rascalmpl/ast/NamedBackslash.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class NamedBackslash extends AbstractAST { + public NamedBackslash(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends NamedBackslash { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitNamedBackslashLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/NamedRegExp.java b/src/org/rascalmpl/ast/NamedRegExp.java new file mode 100644 index 00000000000..8a881ec2f37 --- /dev/null +++ b/src/org/rascalmpl/ast/NamedRegExp.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class NamedRegExp extends AbstractAST { + public NamedRegExp(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends NamedRegExp { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitNamedRegExpLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Nonterminal.java b/src/org/rascalmpl/ast/Nonterminal.java new file mode 100644 index 00000000000..a11370447bc --- /dev/null +++ b/src/org/rascalmpl/ast/Nonterminal.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Nonterminal extends AbstractAST { + public Nonterminal(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends Nonterminal { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitNonterminalLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/NonterminalLabel.java b/src/org/rascalmpl/ast/NonterminalLabel.java new file mode 100644 index 00000000000..e5ebcd267f8 --- /dev/null +++ b/src/org/rascalmpl/ast/NonterminalLabel.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class NonterminalLabel extends AbstractAST { + public NonterminalLabel(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends NonterminalLabel { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitNonterminalLabelLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/NullASTVisitor.java b/src/org/rascalmpl/ast/NullASTVisitor.java new file mode 100644 index 00000000000..aca2b779cb3 --- /dev/null +++ b/src/org/rascalmpl/ast/NullASTVisitor.java @@ -0,0 +1,1689 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + +public class NullASTVisitor implements IASTVisitor { + + public T visitAssignableAnnotation(Assignable.Annotation x) { + return null; + } + + public T visitAssignableBracket(Assignable.Bracket x) { + return null; + } + + public T visitAssignableConstructor(Assignable.Constructor x) { + return null; + } + + public T visitAssignableFieldAccess(Assignable.FieldAccess x) { + return null; + } + + public T visitAssignableIfDefinedOrDefault(Assignable.IfDefinedOrDefault x) { + return null; + } + + public T visitAssignableSlice(Assignable.Slice x) { + return null; + } + + public T visitAssignableSliceStep(Assignable.SliceStep x) { + return null; + } + + public T visitAssignableSubscript(Assignable.Subscript x) { + return null; + } + + public T visitAssignableTuple(Assignable.Tuple x) { + return null; + } + + public T visitAssignableVariable(Assignable.Variable x) { + return null; + } + + public T visitAssignmentAddition(Assignment.Addition x) { + return null; + } + + public T visitAssignmentAppend(Assignment.Append x) { + return null; + } + + public T visitAssignmentDefault(Assignment.Default x) { + return null; + } + + public T visitAssignmentDivision(Assignment.Division x) { + return null; + } + + public T visitAssignmentIfDefined(Assignment.IfDefined x) { + return null; + } + + public T visitAssignmentIntersection(Assignment.Intersection x) { + return null; + } + + public T visitAssignmentProduct(Assignment.Product x) { + return null; + } + + public T visitAssignmentSubtraction(Assignment.Subtraction x) { + return null; + } + + public T visitAssocAssociative(Assoc.Associative x) { + return null; + } + + public T visitAssocLeft(Assoc.Left x) { + return null; + } + + public T visitAssocNonAssociative(Assoc.NonAssociative x) { + return null; + } + + public T visitAssocRight(Assoc.Right x) { + return null; + } + + public T visitBasicTypeBag(BasicType.Bag x) { + return null; + } + + public T visitBasicTypeBool(BasicType.Bool x) { + return null; + } + + public T visitBasicTypeDateTime(BasicType.DateTime x) { + return null; + } + + public T visitBasicTypeInt(BasicType.Int x) { + return null; + } + + public T visitBasicTypeList(BasicType.List x) { + return null; + } + + public T visitBasicTypeListRelation(BasicType.ListRelation x) { + return null; + } + + public T visitBasicTypeLoc(BasicType.Loc x) { + return null; + } + + public T visitBasicTypeMap(BasicType.Map x) { + return null; + } + + public T visitBasicTypeNode(BasicType.Node x) { + return null; + } + + public T visitBasicTypeNum(BasicType.Num x) { + return null; + } + + public T visitBasicTypeRational(BasicType.Rational x) { + return null; + } + + public T visitBasicTypeReal(BasicType.Real x) { + return null; + } + + public T visitBasicTypeRelation(BasicType.Relation x) { + return null; + } + + public T visitBasicTypeSet(BasicType.Set x) { + return null; + } + + public T visitBasicTypeString(BasicType.String x) { + return null; + } + + public T visitBasicTypeTuple(BasicType.Tuple x) { + return null; + } + + public T visitBasicTypeType(BasicType.Type x) { + return null; + } + + public T visitBasicTypeValue(BasicType.Value x) { + return null; + } + + public T visitBasicTypeVoid(BasicType.Void x) { + return null; + } + + public T visitBodyToplevels(Body.Toplevels x) { + return null; + } + + public T visitBoundDefault(Bound.Default x) { + return null; + } + + public T visitBoundEmpty(Bound.Empty x) { + return null; + } + + public T visitCaseDefault(Case.Default x) { + return null; + } + + public T visitCasePatternWithAction(Case.PatternWithAction x) { + return null; + } + + public T visitCatchBinding(Catch.Binding x) { + return null; + } + + public T visitCatchDefault(Catch.Default x) { + return null; + } + + public T visitClassBracket(Class.Bracket x) { + return null; + } + + public T visitClassComplement(Class.Complement x) { + return null; + } + + public T visitClassDifference(Class.Difference x) { + return null; + } + + public T visitClassIntersection(Class.Intersection x) { + return null; + } + + public T visitClassSimpleCharclass(Class.SimpleCharclass x) { + return null; + } + + public T visitClassUnion(Class.Union x) { + return null; + } + + public T visitCommandDeclaration(Command.Declaration x) { + return null; + } + + public T visitCommandExpression(Command.Expression x) { + return null; + } + + public T visitCommandImport(Command.Import x) { + return null; + } + + public T visitCommandShell(Command.Shell x) { + return null; + } + + public T visitCommandStatement(Command.Statement x) { + return null; + } + + public T visitCommandsCommandlist(Commands.Commandlist x) { + return null; + } + + public T visitCommonKeywordParametersAbsent(CommonKeywordParameters.Absent x) { + return null; + } + + public T visitCommonKeywordParametersPresent(CommonKeywordParameters.Present x) { + return null; + } + + public T visitComprehensionList(Comprehension.List x) { + return null; + } + + public T visitComprehensionMap(Comprehension.Map x) { + return null; + } + + public T visitComprehensionSet(Comprehension.Set x) { + return null; + } + + public T visitConcreteHoleOne(ConcreteHole.One x) { + return null; + } + + public T visitDataTargetEmpty(DataTarget.Empty x) { + return null; + } + + public T visitDataTargetLabeled(DataTarget.Labeled x) { + return null; + } + + public T visitDataTypeSelectorSelector(DataTypeSelector.Selector x) { + return null; + } + + public T visitDateTimeLiteralDateAndTimeLiteral(DateTimeLiteral.DateAndTimeLiteral x) { + return null; + } + + public T visitDateTimeLiteralDateLiteral(DateTimeLiteral.DateLiteral x) { + return null; + } + + public T visitDateTimeLiteralTimeLiteral(DateTimeLiteral.TimeLiteral x) { + return null; + } + + public T visitDeclarationAlias(Declaration.Alias x) { + return null; + } + + public T visitDeclarationAnnotation(Declaration.Annotation x) { + return null; + } + + public T visitDeclarationData(Declaration.Data x) { + return null; + } + + public T visitDeclarationDataAbstract(Declaration.DataAbstract x) { + return null; + } + + public T visitDeclarationFunction(Declaration.Function x) { + return null; + } + + public T visitDeclarationTag(Declaration.Tag x) { + return null; + } + + public T visitDeclarationVariable(Declaration.Variable x) { + return null; + } + + public T visitDeclaratorDefault(Declarator.Default x) { + return null; + } + + public T visitEvalCommandDeclaration(EvalCommand.Declaration x) { + return null; + } + + public T visitEvalCommandImport(EvalCommand.Import x) { + return null; + } + + public T visitEvalCommandOutput(EvalCommand.Output x) { + return null; + } + + public T visitEvalCommandStatement(EvalCommand.Statement x) { + return null; + } + + public T visitExpressionAddition(Expression.Addition x) { + return null; + } + + public T visitExpressionAll(Expression.All x) { + return null; + } + + public T visitExpressionAnd(Expression.And x) { + return null; + } + + public T visitExpressionAnti(Expression.Anti x) { + return null; + } + + public T visitExpressionAny(Expression.Any x) { + return null; + } + + public T visitExpressionAppendAfter(Expression.AppendAfter x) { + return null; + } + + public T visitExpressionAsType(Expression.AsType x) { + return null; + } + + public T visitExpressionBracket(Expression.Bracket x) { + return null; + } + + public T visitExpressionCallOrTree(Expression.CallOrTree x) { + return null; + } + + public T visitExpressionClosure(Expression.Closure x) { + return null; + } + + public T visitExpressionComposition(Expression.Composition x) { + return null; + } + + public T visitExpressionComprehension(Expression.Comprehension x) { + return null; + } + + public T visitExpressionConcrete(Expression.Concrete x) { + return null; + } + + public T visitExpressionDescendant(Expression.Descendant x) { + return null; + } + + public T visitExpressionDivision(Expression.Division x) { + return null; + } + + public T visitExpressionEnumerator(Expression.Enumerator x) { + return null; + } + + public T visitExpressionEquals(Expression.Equals x) { + return null; + } + + public T visitExpressionEquivalence(Expression.Equivalence x) { + return null; + } + + public T visitExpressionFieldAccess(Expression.FieldAccess x) { + return null; + } + + public T visitExpressionFieldProject(Expression.FieldProject x) { + return null; + } + + public T visitExpressionFieldUpdate(Expression.FieldUpdate x) { + return null; + } + + public T visitExpressionGetAnnotation(Expression.GetAnnotation x) { + return null; + } + + public T visitExpressionGreaterThan(Expression.GreaterThan x) { + return null; + } + + public T visitExpressionGreaterThanOrEq(Expression.GreaterThanOrEq x) { + return null; + } + + public T visitExpressionHas(Expression.Has x) { + return null; + } + + public T visitExpressionIfDefinedOtherwise(Expression.IfDefinedOtherwise x) { + return null; + } + + public T visitExpressionIfThenElse(Expression.IfThenElse x) { + return null; + } + + public T visitExpressionImplication(Expression.Implication x) { + return null; + } + + public T visitExpressionIn(Expression.In x) { + return null; + } + + public T visitExpressionInsertBefore(Expression.InsertBefore x) { + return null; + } + + public T visitExpressionIntersection(Expression.Intersection x) { + return null; + } + + public T visitExpressionIs(Expression.Is x) { + return null; + } + + public T visitExpressionIsDefined(Expression.IsDefined x) { + return null; + } + + public T visitExpressionIt(Expression.It x) { + return null; + } + + public T visitExpressionJoin(Expression.Join x) { + return null; + } + + public T visitExpressionLessThan(Expression.LessThan x) { + return null; + } + + public T visitExpressionLessThanOrEq(Expression.LessThanOrEq x) { + return null; + } + + public T visitExpressionList(Expression.List x) { + return null; + } + + public T visitExpressionLiteral(Expression.Literal x) { + return null; + } + + public T visitExpressionMap(Expression.Map x) { + return null; + } + + public T visitExpressionMatch(Expression.Match x) { + return null; + } + + public T visitExpressionModulo(Expression.Modulo x) { + return null; + } + + public T visitExpressionMultiVariable(Expression.MultiVariable x) { + return null; + } + + public T visitExpressionNegation(Expression.Negation x) { + return null; + } + + public T visitExpressionNegative(Expression.Negative x) { + return null; + } + + public T visitExpressionNoMatch(Expression.NoMatch x) { + return null; + } + + public T visitExpressionNonEmptyBlock(Expression.NonEmptyBlock x) { + return null; + } + + public T visitExpressionNonEquals(Expression.NonEquals x) { + return null; + } + + public T visitExpressionNotIn(Expression.NotIn x) { + return null; + } + + public T visitExpressionOr(Expression.Or x) { + return null; + } + + public T visitExpressionProduct(Expression.Product x) { + return null; + } + + public T visitExpressionQualifiedName(Expression.QualifiedName x) { + return null; + } + + public T visitExpressionRange(Expression.Range x) { + return null; + } + + public T visitExpressionReducer(Expression.Reducer x) { + return null; + } + + public T visitExpressionReifiedType(Expression.ReifiedType x) { + return null; + } + + public T visitExpressionReifyType(Expression.ReifyType x) { + return null; + } + + public T visitExpressionRemainder(Expression.Remainder x) { + return null; + } + + public T visitExpressionSet(Expression.Set x) { + return null; + } + + public T visitExpressionSetAnnotation(Expression.SetAnnotation x) { + return null; + } + + public T visitExpressionSlice(Expression.Slice x) { + return null; + } + + public T visitExpressionSliceStep(Expression.SliceStep x) { + return null; + } + + public T visitExpressionSplice(Expression.Splice x) { + return null; + } + + public T visitExpressionSplicePlus(Expression.SplicePlus x) { + return null; + } + + public T visitExpressionStepRange(Expression.StepRange x) { + return null; + } + + public T visitExpressionSubscript(Expression.Subscript x) { + return null; + } + + public T visitExpressionSubtraction(Expression.Subtraction x) { + return null; + } + + public T visitExpressionTransitiveClosure(Expression.TransitiveClosure x) { + return null; + } + + public T visitExpressionTransitiveReflexiveClosure(Expression.TransitiveReflexiveClosure x) { + return null; + } + + public T visitExpressionTuple(Expression.Tuple x) { + return null; + } + + public T visitExpressionTypedVariable(Expression.TypedVariable x) { + return null; + } + + public T visitExpressionTypedVariableBecomes(Expression.TypedVariableBecomes x) { + return null; + } + + public T visitExpressionVariableBecomes(Expression.VariableBecomes x) { + return null; + } + + public T visitExpressionVisit(Expression.Visit x) { + return null; + } + + public T visitExpressionVoidClosure(Expression.VoidClosure x) { + return null; + } + + public T visitFieldIndex(Field.Index x) { + return null; + } + + public T visitFieldName(Field.Name x) { + return null; + } + + public T visitFormalsDefault(Formals.Default x) { + return null; + } + + public T visitFunctionBodyDefault(FunctionBody.Default x) { + return null; + } + + public T visitFunctionDeclarationAbstract(FunctionDeclaration.Abstract x) { + return null; + } + + public T visitFunctionDeclarationConditional(FunctionDeclaration.Conditional x) { + return null; + } + + public T visitFunctionDeclarationDefault(FunctionDeclaration.Default x) { + return null; + } + + public T visitFunctionDeclarationExpression(FunctionDeclaration.Expression x) { + return null; + } + + public T visitFunctionModifierDefault(FunctionModifier.Default x) { + return null; + } + + public T visitFunctionModifierJava(FunctionModifier.Java x) { + return null; + } + + public T visitFunctionModifierTest(FunctionModifier.Test x) { + return null; + } + + public T visitFunctionModifiersModifierlist(FunctionModifiers.Modifierlist x) { + return null; + } + + public T visitFunctionTypeTypeArguments(FunctionType.TypeArguments x) { + return null; + } + + public T visitHeaderDefault(Header.Default x) { + return null; + } + + public T visitHeaderParameters(Header.Parameters x) { + return null; + } + + public T visitImportDefault(Import.Default x) { + return null; + } + + public T visitImportExtend(Import.Extend x) { + return null; + } + + public T visitImportExternal(Import.External x) { + return null; + } + + public T visitImportSyntax(Import.Syntax x) { + return null; + } + + public T visitImportedModuleActuals(ImportedModule.Actuals x) { + return null; + } + + public T visitImportedModuleActualsRenaming(ImportedModule.ActualsRenaming x) { + return null; + } + + public T visitImportedModuleDefault(ImportedModule.Default x) { + return null; + } + + public T visitImportedModuleRenamings(ImportedModule.Renamings x) { + return null; + } + + public T visitIntegerLiteralDecimalIntegerLiteral(IntegerLiteral.DecimalIntegerLiteral x) { + return null; + } + + public T visitIntegerLiteralHexIntegerLiteral(IntegerLiteral.HexIntegerLiteral x) { + return null; + } + + public T visitIntegerLiteralOctalIntegerLiteral(IntegerLiteral.OctalIntegerLiteral x) { + return null; + } + + public T visitKeywordArgument_ExpressionDefault(KeywordArgument_Expression.Default x) { + return null; + } + + public T visitKeywordArguments_ExpressionDefault(KeywordArguments_Expression.Default x) { + return null; + } + + public T visitKeywordArguments_ExpressionNone(KeywordArguments_Expression.None x) { + return null; + } + + public T visitKeywordFormalDefault(KeywordFormal.Default x) { + return null; + } + + public T visitKeywordFormalsDefault(KeywordFormals.Default x) { + return null; + } + + public T visitKeywordFormalsNone(KeywordFormals.None x) { + return null; + } + + public T visitKindAlias(Kind.Alias x) { + return null; + } + + public T visitKindAll(Kind.All x) { + return null; + } + + public T visitKindAnno(Kind.Anno x) { + return null; + } + + public T visitKindData(Kind.Data x) { + return null; + } + + public T visitKindFunction(Kind.Function x) { + return null; + } + + public T visitKindModule(Kind.Module x) { + return null; + } + + public T visitKindTag(Kind.Tag x) { + return null; + } + + public T visitKindVariable(Kind.Variable x) { + return null; + } + + public T visitKindView(Kind.View x) { + return null; + } + + public T visitLabelDefault(Label.Default x) { + return null; + } + + public T visitLabelEmpty(Label.Empty x) { + return null; + } + + public T visitLiteralBoolean(Literal.Boolean x) { + return null; + } + + public T visitLiteralDateTime(Literal.DateTime x) { + return null; + } + + public T visitLiteralInteger(Literal.Integer x) { + return null; + } + + public T visitLiteralLocation(Literal.Location x) { + return null; + } + + public T visitLiteralRational(Literal.Rational x) { + return null; + } + + public T visitLiteralReal(Literal.Real x) { + return null; + } + + public T visitLiteralRegExp(Literal.RegExp x) { + return null; + } + + public T visitLiteralString(Literal.String x) { + return null; + } + + public T visitLocalVariableDeclarationDefault(LocalVariableDeclaration.Default x) { + return null; + } + + public T visitLocalVariableDeclarationDynamic(LocalVariableDeclaration.Dynamic x) { + return null; + } + + public T visitLocationLiteralDefault(LocationLiteral.Default x) { + return null; + } + + public T visitMapping_ExpressionDefault(Mapping_Expression.Default x) { + return null; + } + + public T visitModuleDefault(Module.Default x) { + return null; + } + + public T visitModuleActualsDefault(ModuleActuals.Default x) { + return null; + } + + public T visitModuleParametersDefault(ModuleParameters.Default x) { + return null; + } + + public T visitOptionalExpressionExpression(OptionalExpression.Expression x) { + return null; + } + + public T visitOptionalExpressionNoExpression(OptionalExpression.NoExpression x) { + return null; + } + + public T visitParametersDefault(Parameters.Default x) { + return null; + } + + public T visitParametersVarArgs(Parameters.VarArgs x) { + return null; + } + + public T visitPathPartInterpolated(PathPart.Interpolated x) { + return null; + } + + public T visitPathPartNonInterpolated(PathPart.NonInterpolated x) { + return null; + } + + public T visitPathTailMid(PathTail.Mid x) { + return null; + } + + public T visitPathTailPost(PathTail.Post x) { + return null; + } + + public T visitPatternWithActionArbitrary(PatternWithAction.Arbitrary x) { + return null; + } + + public T visitPatternWithActionReplacing(PatternWithAction.Replacing x) { + return null; + } + + public T visitProdAll(Prod.All x) { + return null; + } + + public T visitProdAssociativityGroup(Prod.AssociativityGroup x) { + return null; + } + + public T visitProdFirst(Prod.First x) { + return null; + } + + public T visitProdLabeled(Prod.Labeled x) { + return null; + } + + public T visitProdReference(Prod.Reference x) { + return null; + } + + public T visitProdUnlabeled(Prod.Unlabeled x) { + return null; + } + + public T visitProdModifierAssociativity(ProdModifier.Associativity x) { + return null; + } + + public T visitProdModifierBracket(ProdModifier.Bracket x) { + return null; + } + + public T visitProdModifierTag(ProdModifier.Tag x) { + return null; + } + + public T visitProtocolPartInterpolated(ProtocolPart.Interpolated x) { + return null; + } + + public T visitProtocolPartNonInterpolated(ProtocolPart.NonInterpolated x) { + return null; + } + + public T visitProtocolTailMid(ProtocolTail.Mid x) { + return null; + } + + public T visitProtocolTailPost(ProtocolTail.Post x) { + return null; + } + + public T visitQualifiedNameDefault(QualifiedName.Default x) { + return null; + } + + public T visitRangeCharacter(Range.Character x) { + return null; + } + + public T visitRangeFromTo(Range.FromTo x) { + return null; + } + + public T visitRenamingDefault(Renaming.Default x) { + return null; + } + + public T visitRenamingsDefault(Renamings.Default x) { + return null; + } + + public T visitReplacementConditional(Replacement.Conditional x) { + return null; + } + + public T visitReplacementUnconditional(Replacement.Unconditional x) { + return null; + } + + public T visitShellCommandClear(ShellCommand.Clear x) { + return null; + } + + public T visitShellCommandEdit(ShellCommand.Edit x) { + return null; + } + + public T visitShellCommandHelp(ShellCommand.Help x) { + return null; + } + + public T visitShellCommandHistory(ShellCommand.History x) { + return null; + } + + public T visitShellCommandListDeclarations(ShellCommand.ListDeclarations x) { + return null; + } + + public T visitShellCommandListModules(ShellCommand.ListModules x) { + return null; + } + + public T visitShellCommandQuit(ShellCommand.Quit x) { + return null; + } + + public T visitShellCommandSetOption(ShellCommand.SetOption x) { + return null; + } + + public T visitShellCommandSetOptionTrue(ShellCommand.SetOptionTrue x) { + return null; + } + + public T visitShellCommandTest(ShellCommand.Test x) { + return null; + } + + public T visitShellCommandUndeclare(ShellCommand.Undeclare x) { + return null; + } + + public T visitShellCommandUnextend(ShellCommand.Unextend x) { + return null; + } + + public T visitShellCommandUnimport(ShellCommand.Unimport x) { + return null; + } + + public T visitShellCommandUnsetOption(ShellCommand.UnsetOption x) { + return null; + } + + public T visitSignatureNoThrows(Signature.NoThrows x) { + return null; + } + + public T visitSignatureWithThrows(Signature.WithThrows x) { + return null; + } + + public T visitStartAbsent(Start.Absent x) { + return null; + } + + public T visitStartPresent(Start.Present x) { + return null; + } + + public T visitStatementAppend(Statement.Append x) { + return null; + } + + public T visitStatementAssert(Statement.Assert x) { + return null; + } + + public T visitStatementAssertWithMessage(Statement.AssertWithMessage x) { + return null; + } + + public T visitStatementAssignment(Statement.Assignment x) { + return null; + } + + public T visitStatementBreak(Statement.Break x) { + return null; + } + + public T visitStatementContinue(Statement.Continue x) { + return null; + } + + public T visitStatementDoWhile(Statement.DoWhile x) { + return null; + } + + public T visitStatementEmptyStatement(Statement.EmptyStatement x) { + return null; + } + + public T visitStatementExpression(Statement.Expression x) { + return null; + } + + public T visitStatementFail(Statement.Fail x) { + return null; + } + + public T visitStatementFilter(Statement.Filter x) { + return null; + } + + public T visitStatementFor(Statement.For x) { + return null; + } + + public T visitStatementFunctionDeclaration(Statement.FunctionDeclaration x) { + return null; + } + + public T visitStatementGlobalDirective(Statement.GlobalDirective x) { + return null; + } + + public T visitStatementIfThen(Statement.IfThen x) { + return null; + } + + public T visitStatementIfThenElse(Statement.IfThenElse x) { + return null; + } + + public T visitStatementInsert(Statement.Insert x) { + return null; + } + + public T visitStatementNonEmptyBlock(Statement.NonEmptyBlock x) { + return null; + } + + public T visitStatementReturn(Statement.Return x) { + return null; + } + + public T visitStatementSolve(Statement.Solve x) { + return null; + } + + public T visitStatementSwitch(Statement.Switch x) { + return null; + } + + public T visitStatementThrow(Statement.Throw x) { + return null; + } + + public T visitStatementTry(Statement.Try x) { + return null; + } + + public T visitStatementTryFinally(Statement.TryFinally x) { + return null; + } + + public T visitStatementVariableDeclaration(Statement.VariableDeclaration x) { + return null; + } + + public T visitStatementVisit(Statement.Visit x) { + return null; + } + + public T visitStatementWhile(Statement.While x) { + return null; + } + + public T visitStrategyBottomUp(Strategy.BottomUp x) { + return null; + } + + public T visitStrategyBottomUpBreak(Strategy.BottomUpBreak x) { + return null; + } + + public T visitStrategyInnermost(Strategy.Innermost x) { + return null; + } + + public T visitStrategyOutermost(Strategy.Outermost x) { + return null; + } + + public T visitStrategyTopDown(Strategy.TopDown x) { + return null; + } + + public T visitStrategyTopDownBreak(Strategy.TopDownBreak x) { + return null; + } + + public T visitStringLiteralInterpolated(StringLiteral.Interpolated x) { + return null; + } + + public T visitStringLiteralNonInterpolated(StringLiteral.NonInterpolated x) { + return null; + } + + public T visitStringLiteralTemplate(StringLiteral.Template x) { + return null; + } + + public T visitStringMiddleInterpolated(StringMiddle.Interpolated x) { + return null; + } + + public T visitStringMiddleMid(StringMiddle.Mid x) { + return null; + } + + public T visitStringMiddleTemplate(StringMiddle.Template x) { + return null; + } + + public T visitStringTailMidInterpolated(StringTail.MidInterpolated x) { + return null; + } + + public T visitStringTailMidTemplate(StringTail.MidTemplate x) { + return null; + } + + public T visitStringTailPost(StringTail.Post x) { + return null; + } + + public T visitStringTemplateDoWhile(StringTemplate.DoWhile x) { + return null; + } + + public T visitStringTemplateFor(StringTemplate.For x) { + return null; + } + + public T visitStringTemplateIfThen(StringTemplate.IfThen x) { + return null; + } + + public T visitStringTemplateIfThenElse(StringTemplate.IfThenElse x) { + return null; + } + + public T visitStringTemplateWhile(StringTemplate.While x) { + return null; + } + + public T visitStructuredTypeDefault(StructuredType.Default x) { + return null; + } + + public T visitSymAlternative(Sym.Alternative x) { + return null; + } + + public T visitSymCaseInsensitiveLiteral(Sym.CaseInsensitiveLiteral x) { + return null; + } + + public T visitSymCharacterClass(Sym.CharacterClass x) { + return null; + } + + public T visitSymColumn(Sym.Column x) { + return null; + } + + public T visitSymEmpty(Sym.Empty x) { + return null; + } + + public T visitSymEndOfLine(Sym.EndOfLine x) { + return null; + } + + public T visitSymExcept(Sym.Except x) { + return null; + } + + public T visitSymFollow(Sym.Follow x) { + return null; + } + + public T visitSymIter(Sym.Iter x) { + return null; + } + + public T visitSymIterSep(Sym.IterSep x) { + return null; + } + + public T visitSymIterStar(Sym.IterStar x) { + return null; + } + + public T visitSymIterStarSep(Sym.IterStarSep x) { + return null; + } + + public T visitSymLabeled(Sym.Labeled x) { + return null; + } + + public T visitSymLiteral(Sym.Literal x) { + return null; + } + + public T visitSymNonterminal(Sym.Nonterminal x) { + return null; + } + + public T visitSymNotFollow(Sym.NotFollow x) { + return null; + } + + public T visitSymNotPrecede(Sym.NotPrecede x) { + return null; + } + + public T visitSymOptional(Sym.Optional x) { + return null; + } + + public T visitSymParameter(Sym.Parameter x) { + return null; + } + + public T visitSymParametrized(Sym.Parametrized x) { + return null; + } + + public T visitSymPrecede(Sym.Precede x) { + return null; + } + + public T visitSymSequence(Sym.Sequence x) { + return null; + } + + public T visitSymStart(Sym.Start x) { + return null; + } + + public T visitSymStartOfLine(Sym.StartOfLine x) { + return null; + } + + public T visitSymUnequal(Sym.Unequal x) { + return null; + } + + public T visitSyntaxDefinitionKeyword(SyntaxDefinition.Keyword x) { + return null; + } + + public T visitSyntaxDefinitionLanguage(SyntaxDefinition.Language x) { + return null; + } + + public T visitSyntaxDefinitionLayout(SyntaxDefinition.Layout x) { + return null; + } + + public T visitSyntaxDefinitionLexical(SyntaxDefinition.Lexical x) { + return null; + } + + public T visitTagDefault(Tag.Default x) { + return null; + } + + public T visitTagEmpty(Tag.Empty x) { + return null; + } + + public T visitTagExpression(Tag.Expression x) { + return null; + } + + public T visitTagsDefault(Tags.Default x) { + return null; + } + + public T visitTargetEmpty(Target.Empty x) { + return null; + } + + public T visitTargetLabeled(Target.Labeled x) { + return null; + } + + public T visitToplevelGivenVisibility(Toplevel.GivenVisibility x) { + return null; + } + + public T visitTypeBasic(Type.Basic x) { + return null; + } + + public T visitTypeBracket(Type.Bracket x) { + return null; + } + + public T visitTypeFunction(Type.Function x) { + return null; + } + + public T visitTypeSelector(Type.Selector x) { + return null; + } + + public T visitTypeStructured(Type.Structured x) { + return null; + } + + public T visitTypeSymbol(Type.Symbol x) { + return null; + } + + public T visitTypeUser(Type.User x) { + return null; + } + + public T visitTypeVariable(Type.Variable x) { + return null; + } + + public T visitTypeArgDefault(TypeArg.Default x) { + return null; + } + + public T visitTypeArgNamed(TypeArg.Named x) { + return null; + } + + public T visitTypeVarBounded(TypeVar.Bounded x) { + return null; + } + + public T visitTypeVarFree(TypeVar.Free x) { + return null; + } + + public T visitUserTypeName(UserType.Name x) { + return null; + } + + public T visitUserTypeParametric(UserType.Parametric x) { + return null; + } + + public T visitVariableInitialized(Variable.Initialized x) { + return null; + } + + public T visitVariableUnInitialized(Variable.UnInitialized x) { + return null; + } + + public T visitVariantNAryConstructor(Variant.NAryConstructor x) { + return null; + } + + public T visitVisibilityDefault(Visibility.Default x) { + return null; + } + + public T visitVisibilityPrivate(Visibility.Private x) { + return null; + } + + public T visitVisibilityPublic(Visibility.Public x) { + return null; + } + + public T visitVisitDefaultStrategy(Visit.DefaultStrategy x) { + return null; + } + + public T visitVisitGivenStrategy(Visit.GivenStrategy x) { + return null; + } + + + public T visitBackslashLexical(Backslash.Lexical x) { + return null; + } + + public T visitBooleanLiteralLexical(BooleanLiteral.Lexical x) { + return null; + } + + public T visitCaseInsensitiveStringConstantLexical(CaseInsensitiveStringConstant.Lexical x) { + return null; + } + + public T visitCharLexical(Char.Lexical x) { + return null; + } + + public T visitCommentLexical(Comment.Lexical x) { + return null; + } + + public T visitConcreteLexical(Concrete.Lexical x) { + return null; + } + + public T visitConcretePartLexical(ConcretePart.Lexical x) { + return null; + } + + public T visitDateAndTimeLexical(DateAndTime.Lexical x) { + return null; + } + + public T visitDatePartLexical(DatePart.Lexical x) { + return null; + } + + public T visitDecimalIntegerLiteralLexical(DecimalIntegerLiteral.Lexical x) { + return null; + } + + public T visitHexIntegerLiteralLexical(HexIntegerLiteral.Lexical x) { + return null; + } + + public T visitJustDateLexical(JustDate.Lexical x) { + return null; + } + + public T visitJustTimeLexical(JustTime.Lexical x) { + return null; + } + + public T visitLAYOUTLexical(LAYOUT.Lexical x) { + return null; + } + + public T visitMidPathCharsLexical(MidPathChars.Lexical x) { + return null; + } + + public T visitMidProtocolCharsLexical(MidProtocolChars.Lexical x) { + return null; + } + + public T visitMidStringCharsLexical(MidStringChars.Lexical x) { + return null; + } + + public T visitNameLexical(Name.Lexical x) { + return null; + } + + public T visitNamedBackslashLexical(NamedBackslash.Lexical x) { + return null; + } + + public T visitNamedRegExpLexical(NamedRegExp.Lexical x) { + return null; + } + + public T visitNonterminalLexical(Nonterminal.Lexical x) { + return null; + } + + public T visitNonterminalLabelLexical(NonterminalLabel.Lexical x) { + return null; + } + + public T visitOctalIntegerLiteralLexical(OctalIntegerLiteral.Lexical x) { + return null; + } + + public T visitOptionalCommaLexical(OptionalComma.Lexical x) { + return null; + } + + public T visitOptionalEqualSignLexical(OptionalEqualSign.Lexical x) { + return null; + } + + public T visitOptionalTerminatorLexical(OptionalTerminator.Lexical x) { + return null; + } + + public T visitOutputLexical(Output.Lexical x) { + return null; + } + + public T visitPathCharsLexical(PathChars.Lexical x) { + return null; + } + + public T visitPostPathCharsLexical(PostPathChars.Lexical x) { + return null; + } + + public T visitPostProtocolCharsLexical(PostProtocolChars.Lexical x) { + return null; + } + + public T visitPostStringCharsLexical(PostStringChars.Lexical x) { + return null; + } + + public T visitPrePathCharsLexical(PrePathChars.Lexical x) { + return null; + } + + public T visitPreProtocolCharsLexical(PreProtocolChars.Lexical x) { + return null; + } + + public T visitPreStringCharsLexical(PreStringChars.Lexical x) { + return null; + } + + public T visitProtocolCharsLexical(ProtocolChars.Lexical x) { + return null; + } + + public T visitRationalLiteralLexical(RationalLiteral.Lexical x) { + return null; + } + + public T visitRealLiteralLexical(RealLiteral.Lexical x) { + return null; + } + + public T visitRegExpLexical(RegExp.Lexical x) { + return null; + } + + public T visitRegExpLiteralLexical(RegExpLiteral.Lexical x) { + return null; + } + + public T visitRegExpModifierLexical(RegExpModifier.Lexical x) { + return null; + } + + public T visitStringCharacterLexical(StringCharacter.Lexical x) { + return null; + } + + public T visitStringConstantLexical(StringConstant.Lexical x) { + return null; + } + + public T visitTagStringLexical(TagString.Lexical x) { + return null; + } + + public T visitTimePartNoTZLexical(TimePartNoTZ.Lexical x) { + return null; + } + + public T visitTimeZonePartLexical(TimeZonePart.Lexical x) { + return null; + } + + public T visitURLCharsLexical(URLChars.Lexical x) { + return null; + } + + public T visitUnicodeEscapeLexical(UnicodeEscape.Lexical x) { + return null; + } + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/OctalIntegerLiteral.java b/src/org/rascalmpl/ast/OctalIntegerLiteral.java new file mode 100644 index 00000000000..a7051419a85 --- /dev/null +++ b/src/org/rascalmpl/ast/OctalIntegerLiteral.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class OctalIntegerLiteral extends AbstractAST { + public OctalIntegerLiteral(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends OctalIntegerLiteral { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitOctalIntegerLiteralLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/OptionalComma.java b/src/org/rascalmpl/ast/OptionalComma.java new file mode 100644 index 00000000000..46e968d4f88 --- /dev/null +++ b/src/org/rascalmpl/ast/OptionalComma.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class OptionalComma extends AbstractAST { + public OptionalComma(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends OptionalComma { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitOptionalCommaLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/OptionalEqualSign.java b/src/org/rascalmpl/ast/OptionalEqualSign.java new file mode 100644 index 00000000000..b7175286826 --- /dev/null +++ b/src/org/rascalmpl/ast/OptionalEqualSign.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class OptionalEqualSign extends AbstractAST { + public OptionalEqualSign(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends OptionalEqualSign { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitOptionalEqualSignLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/OptionalExpression.java b/src/org/rascalmpl/ast/OptionalExpression.java new file mode 100644 index 00000000000..56334aac335 --- /dev/null +++ b/src/org/rascalmpl/ast/OptionalExpression.java @@ -0,0 +1,169 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class OptionalExpression extends AbstractAST { + public OptionalExpression(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasExpression() { + return false; + } + + public org.rascalmpl.ast.Expression getExpression() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isExpression() { + return false; + } + + static public class Expression extends OptionalExpression { + // Production: sig("Expression",[arg("org.rascalmpl.ast.Expression","expression")],breakable=false) + + + private final org.rascalmpl.ast.Expression expression; + + public Expression(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression expression) { + super(src, node); + + this.expression = expression; + } + + @Override + public boolean isExpression() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitOptionalExpressionExpression(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Expression)) { + return false; + } + Expression tmp = (Expression) o; + return true && tmp.expression.equals(this.expression) ; + } + + @Override + public int hashCode() { + return 557 + 601 * expression.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(expression)); + } + + } + public boolean isNoExpression() { + return false; + } + + static public class NoExpression extends OptionalExpression { + // Production: sig("NoExpression",[],breakable=false) + + + + public NoExpression(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isNoExpression() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitOptionalExpressionNoExpression(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof NoExpression)) { + return false; + } + NoExpression tmp = (NoExpression) o; + return true ; + } + + @Override + public int hashCode() { + return 19 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/OptionalTerminator.java b/src/org/rascalmpl/ast/OptionalTerminator.java new file mode 100644 index 00000000000..1090bd1ecd6 --- /dev/null +++ b/src/org/rascalmpl/ast/OptionalTerminator.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class OptionalTerminator extends AbstractAST { + public OptionalTerminator(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends OptionalTerminator { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitOptionalTerminatorLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Output.java b/src/org/rascalmpl/ast/Output.java new file mode 100644 index 00000000000..201c007470c --- /dev/null +++ b/src/org/rascalmpl/ast/Output.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Output extends AbstractAST { + public Output(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends Output { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitOutputLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Parameters.java b/src/org/rascalmpl/ast/Parameters.java new file mode 100644 index 00000000000..6b8eee10372 --- /dev/null +++ b/src/org/rascalmpl/ast/Parameters.java @@ -0,0 +1,233 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Parameters extends AbstractAST { + public Parameters(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasFormals() { + return false; + } + + public org.rascalmpl.ast.Formals getFormals() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasKeywordFormals() { + return false; + } + + public org.rascalmpl.ast.KeywordFormals getKeywordFormals() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDefault() { + return false; + } + + static public class Default extends Parameters { + // Production: sig("Default",[arg("org.rascalmpl.ast.Formals","formals"),arg("org.rascalmpl.ast.KeywordFormals","keywordFormals")],breakable=false) + + + private final org.rascalmpl.ast.Formals formals; + private final org.rascalmpl.ast.KeywordFormals keywordFormals; + + public Default(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Formals formals, org.rascalmpl.ast.KeywordFormals keywordFormals) { + super(src, node); + + this.formals = formals; + this.keywordFormals = keywordFormals; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitParametersDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = formals.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + formals.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = keywordFormals.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + keywordFormals.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.formals.equals(this.formals) && tmp.keywordFormals.equals(this.keywordFormals) ; + } + + @Override + public int hashCode() { + return 829 + 809 * formals.hashCode() + 157 * keywordFormals.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Formals getFormals() { + return this.formals; + } + + @Override + public boolean hasFormals() { + return true; + } + @Override + public org.rascalmpl.ast.KeywordFormals getKeywordFormals() { + return this.keywordFormals; + } + + @Override + public boolean hasKeywordFormals() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(formals), clone(keywordFormals)); + } + + } + public boolean isVarArgs() { + return false; + } + + static public class VarArgs extends Parameters { + // Production: sig("VarArgs",[arg("org.rascalmpl.ast.Formals","formals"),arg("org.rascalmpl.ast.KeywordFormals","keywordFormals")],breakable=false) + + + private final org.rascalmpl.ast.Formals formals; + private final org.rascalmpl.ast.KeywordFormals keywordFormals; + + public VarArgs(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Formals formals, org.rascalmpl.ast.KeywordFormals keywordFormals) { + super(src, node); + + this.formals = formals; + this.keywordFormals = keywordFormals; + } + + @Override + public boolean isVarArgs() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitParametersVarArgs(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = formals.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + formals.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = keywordFormals.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + keywordFormals.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof VarArgs)) { + return false; + } + VarArgs tmp = (VarArgs) o; + return true && tmp.formals.equals(this.formals) && tmp.keywordFormals.equals(this.keywordFormals) ; + } + + @Override + public int hashCode() { + return 31 + 13 * formals.hashCode() + 857 * keywordFormals.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Formals getFormals() { + return this.formals; + } + + @Override + public boolean hasFormals() { + return true; + } + @Override + public org.rascalmpl.ast.KeywordFormals getKeywordFormals() { + return this.keywordFormals; + } + + @Override + public boolean hasKeywordFormals() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(formals), clone(keywordFormals)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/PathChars.java b/src/org/rascalmpl/ast/PathChars.java new file mode 100644 index 00000000000..7326fa172a5 --- /dev/null +++ b/src/org/rascalmpl/ast/PathChars.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class PathChars extends AbstractAST { + public PathChars(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends PathChars { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitPathCharsLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/PathPart.java b/src/org/rascalmpl/ast/PathPart.java new file mode 100644 index 00000000000..8e4fb96bcf4 --- /dev/null +++ b/src/org/rascalmpl/ast/PathPart.java @@ -0,0 +1,247 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class PathPart extends AbstractAST { + public PathPart(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasExpression() { + return false; + } + + public org.rascalmpl.ast.Expression getExpression() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasPathChars() { + return false; + } + + public org.rascalmpl.ast.PathChars getPathChars() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasTail() { + return false; + } + + public org.rascalmpl.ast.PathTail getTail() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasPre() { + return false; + } + + public org.rascalmpl.ast.PrePathChars getPre() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isInterpolated() { + return false; + } + + static public class Interpolated extends PathPart { + // Production: sig("Interpolated",[arg("org.rascalmpl.ast.PrePathChars","pre"),arg("org.rascalmpl.ast.Expression","expression"),arg("org.rascalmpl.ast.PathTail","tail")],breakable=false) + + + private final org.rascalmpl.ast.PrePathChars pre; + private final org.rascalmpl.ast.Expression expression; + private final org.rascalmpl.ast.PathTail tail; + + public Interpolated(ISourceLocation src, IConstructor node , org.rascalmpl.ast.PrePathChars pre, org.rascalmpl.ast.Expression expression, org.rascalmpl.ast.PathTail tail) { + super(src, node); + + this.pre = pre; + this.expression = expression; + this.tail = tail; + } + + @Override + public boolean isInterpolated() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitPathPartInterpolated(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = pre.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + pre.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = tail.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + tail.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Interpolated)) { + return false; + } + Interpolated tmp = (Interpolated) o; + return true && tmp.pre.equals(this.pre) && tmp.expression.equals(this.expression) && tmp.tail.equals(this.tail) ; + } + + @Override + public int hashCode() { + return 383 + 853 * pre.hashCode() + 743 * expression.hashCode() + 331 * tail.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.PrePathChars getPre() { + return this.pre; + } + + @Override + public boolean hasPre() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + @Override + public org.rascalmpl.ast.PathTail getTail() { + return this.tail; + } + + @Override + public boolean hasTail() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(pre), clone(expression), clone(tail)); + } + + } + public boolean isNonInterpolated() { + return false; + } + + static public class NonInterpolated extends PathPart { + // Production: sig("NonInterpolated",[arg("org.rascalmpl.ast.PathChars","pathChars")],breakable=false) + + + private final org.rascalmpl.ast.PathChars pathChars; + + public NonInterpolated(ISourceLocation src, IConstructor node , org.rascalmpl.ast.PathChars pathChars) { + super(src, node); + + this.pathChars = pathChars; + } + + @Override + public boolean isNonInterpolated() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitPathPartNonInterpolated(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = pathChars.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + pathChars.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof NonInterpolated)) { + return false; + } + NonInterpolated tmp = (NonInterpolated) o; + return true && tmp.pathChars.equals(this.pathChars) ; + } + + @Override + public int hashCode() { + return 967 + 257 * pathChars.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.PathChars getPathChars() { + return this.pathChars; + } + + @Override + public boolean hasPathChars() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(pathChars)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/PathTail.java b/src/org/rascalmpl/ast/PathTail.java new file mode 100644 index 00000000000..9c16cd565ba --- /dev/null +++ b/src/org/rascalmpl/ast/PathTail.java @@ -0,0 +1,247 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class PathTail extends AbstractAST { + public PathTail(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasExpression() { + return false; + } + + public org.rascalmpl.ast.Expression getExpression() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasMid() { + return false; + } + + public org.rascalmpl.ast.MidPathChars getMid() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasTail() { + return false; + } + + public org.rascalmpl.ast.PathTail getTail() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasPost() { + return false; + } + + public org.rascalmpl.ast.PostPathChars getPost() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isMid() { + return false; + } + + static public class Mid extends PathTail { + // Production: sig("Mid",[arg("org.rascalmpl.ast.MidPathChars","mid"),arg("org.rascalmpl.ast.Expression","expression"),arg("org.rascalmpl.ast.PathTail","tail")],breakable=false) + + + private final org.rascalmpl.ast.MidPathChars mid; + private final org.rascalmpl.ast.Expression expression; + private final org.rascalmpl.ast.PathTail tail; + + public Mid(ISourceLocation src, IConstructor node , org.rascalmpl.ast.MidPathChars mid, org.rascalmpl.ast.Expression expression, org.rascalmpl.ast.PathTail tail) { + super(src, node); + + this.mid = mid; + this.expression = expression; + this.tail = tail; + } + + @Override + public boolean isMid() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitPathTailMid(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = mid.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + mid.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = tail.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + tail.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Mid)) { + return false; + } + Mid tmp = (Mid) o; + return true && tmp.mid.equals(this.mid) && tmp.expression.equals(this.expression) && tmp.tail.equals(this.tail) ; + } + + @Override + public int hashCode() { + return 2 + 709 * mid.hashCode() + 499 * expression.hashCode() + 991 * tail.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.MidPathChars getMid() { + return this.mid; + } + + @Override + public boolean hasMid() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + @Override + public org.rascalmpl.ast.PathTail getTail() { + return this.tail; + } + + @Override + public boolean hasTail() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(mid), clone(expression), clone(tail)); + } + + } + public boolean isPost() { + return false; + } + + static public class Post extends PathTail { + // Production: sig("Post",[arg("org.rascalmpl.ast.PostPathChars","post")],breakable=false) + + + private final org.rascalmpl.ast.PostPathChars post; + + public Post(ISourceLocation src, IConstructor node , org.rascalmpl.ast.PostPathChars post) { + super(src, node); + + this.post = post; + } + + @Override + public boolean isPost() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitPathTailPost(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = post.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + post.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Post)) { + return false; + } + Post tmp = (Post) o; + return true && tmp.post.equals(this.post) ; + } + + @Override + public int hashCode() { + return 653 + 557 * post.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.PostPathChars getPost() { + return this.post; + } + + @Override + public boolean hasPost() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(post)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/PatternWithAction.java b/src/org/rascalmpl/ast/PatternWithAction.java new file mode 100644 index 00000000000..3d5d2b4b3de --- /dev/null +++ b/src/org/rascalmpl/ast/PatternWithAction.java @@ -0,0 +1,240 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class PatternWithAction extends AbstractAST { + public PatternWithAction(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasPattern() { + return false; + } + + public org.rascalmpl.ast.Expression getPattern() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasReplacement() { + return false; + } + + public org.rascalmpl.ast.Replacement getReplacement() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasStatement() { + return false; + } + + public org.rascalmpl.ast.Statement getStatement() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isArbitrary() { + return false; + } + + static public class Arbitrary extends PatternWithAction { + // Production: sig("Arbitrary",[arg("org.rascalmpl.ast.Expression","pattern"),arg("org.rascalmpl.ast.Statement","statement")],breakable=false) + + + private final org.rascalmpl.ast.Expression pattern; + private final org.rascalmpl.ast.Statement statement; + + public Arbitrary(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression pattern, org.rascalmpl.ast.Statement statement) { + super(src, node); + + this.pattern = pattern; + this.statement = statement; + } + + @Override + public boolean isArbitrary() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitPatternWithActionArbitrary(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = pattern.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + pattern.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = statement.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + statement.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Arbitrary)) { + return false; + } + Arbitrary tmp = (Arbitrary) o; + return true && tmp.pattern.equals(this.pattern) && tmp.statement.equals(this.statement) ; + } + + @Override + public int hashCode() { + return 257 + 941 * pattern.hashCode() + 601 * statement.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getPattern() { + return this.pattern; + } + + @Override + public boolean hasPattern() { + return true; + } + @Override + public org.rascalmpl.ast.Statement getStatement() { + return this.statement; + } + + @Override + public boolean hasStatement() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(pattern), clone(statement)); + } + + } + public boolean isReplacing() { + return false; + } + + static public class Replacing extends PatternWithAction { + // Production: sig("Replacing",[arg("org.rascalmpl.ast.Expression","pattern"),arg("org.rascalmpl.ast.Replacement","replacement")],breakable=false) + + + private final org.rascalmpl.ast.Expression pattern; + private final org.rascalmpl.ast.Replacement replacement; + + public Replacing(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression pattern, org.rascalmpl.ast.Replacement replacement) { + super(src, node); + + this.pattern = pattern; + this.replacement = replacement; + } + + @Override + public boolean isReplacing() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitPatternWithActionReplacing(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = pattern.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + pattern.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = replacement.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + replacement.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Replacing)) { + return false; + } + Replacing tmp = (Replacing) o; + return true && tmp.pattern.equals(this.pattern) && tmp.replacement.equals(this.replacement) ; + } + + @Override + public int hashCode() { + return 239 + 241 * pattern.hashCode() + 673 * replacement.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getPattern() { + return this.pattern; + } + + @Override + public boolean hasPattern() { + return true; + } + @Override + public org.rascalmpl.ast.Replacement getReplacement() { + return this.replacement; + } + + @Override + public boolean hasReplacement() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(pattern), clone(replacement)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/PostPathChars.java b/src/org/rascalmpl/ast/PostPathChars.java new file mode 100644 index 00000000000..31f23639b5e --- /dev/null +++ b/src/org/rascalmpl/ast/PostPathChars.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class PostPathChars extends AbstractAST { + public PostPathChars(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends PostPathChars { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitPostPathCharsLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/PostProtocolChars.java b/src/org/rascalmpl/ast/PostProtocolChars.java new file mode 100644 index 00000000000..ce3bf9d31e0 --- /dev/null +++ b/src/org/rascalmpl/ast/PostProtocolChars.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class PostProtocolChars extends AbstractAST { + public PostProtocolChars(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends PostProtocolChars { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitPostProtocolCharsLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/PostStringChars.java b/src/org/rascalmpl/ast/PostStringChars.java new file mode 100644 index 00000000000..6301a7d4d4d --- /dev/null +++ b/src/org/rascalmpl/ast/PostStringChars.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class PostStringChars extends AbstractAST { + public PostStringChars(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends PostStringChars { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitPostStringCharsLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/PrePathChars.java b/src/org/rascalmpl/ast/PrePathChars.java new file mode 100644 index 00000000000..6cf11cc5c64 --- /dev/null +++ b/src/org/rascalmpl/ast/PrePathChars.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class PrePathChars extends AbstractAST { + public PrePathChars(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends PrePathChars { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitPrePathCharsLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/PreProtocolChars.java b/src/org/rascalmpl/ast/PreProtocolChars.java new file mode 100644 index 00000000000..f9843b4daf5 --- /dev/null +++ b/src/org/rascalmpl/ast/PreProtocolChars.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class PreProtocolChars extends AbstractAST { + public PreProtocolChars(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends PreProtocolChars { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitPreProtocolCharsLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/PreStringChars.java b/src/org/rascalmpl/ast/PreStringChars.java new file mode 100644 index 00000000000..830c72df34c --- /dev/null +++ b/src/org/rascalmpl/ast/PreStringChars.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class PreStringChars extends AbstractAST { + public PreStringChars(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends PreStringChars { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitPreStringCharsLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Prod.java b/src/org/rascalmpl/ast/Prod.java new file mode 100644 index 00000000000..ee5ca4c90db --- /dev/null +++ b/src/org/rascalmpl/ast/Prod.java @@ -0,0 +1,655 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Prod extends AbstractAST { + public Prod(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasModifiers() { + return false; + } + + public java.util.List getModifiers() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasSyms() { + return false; + } + + public java.util.List getSyms() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasAssociativity() { + return false; + } + + public org.rascalmpl.ast.Assoc getAssociativity() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasName() { + return false; + } + + public org.rascalmpl.ast.Name getName() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasReferenced() { + return false; + } + + public org.rascalmpl.ast.Name getReferenced() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasGroup() { + return false; + } + + public org.rascalmpl.ast.Prod getGroup() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasLhs() { + return false; + } + + public org.rascalmpl.ast.Prod getLhs() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasRhs() { + return false; + } + + public org.rascalmpl.ast.Prod getRhs() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isAll() { + return false; + } + + static public class All extends Prod { + // Production: sig("All",[arg("org.rascalmpl.ast.Prod","lhs"),arg("org.rascalmpl.ast.Prod","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Prod lhs; + private final org.rascalmpl.ast.Prod rhs; + + public All(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Prod lhs, org.rascalmpl.ast.Prod rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isAll() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitProdAll(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof All)) { + return false; + } + All tmp = (All) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 757 + 449 * lhs.hashCode() + 167 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Prod getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Prod getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } + public boolean isAssociativityGroup() { + return false; + } + + static public class AssociativityGroup extends Prod { + // Production: sig("AssociativityGroup",[arg("org.rascalmpl.ast.Assoc","associativity"),arg("org.rascalmpl.ast.Prod","group")],breakable=false) + + + private final org.rascalmpl.ast.Assoc associativity; + private final org.rascalmpl.ast.Prod group; + + public AssociativityGroup(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Assoc associativity, org.rascalmpl.ast.Prod group) { + super(src, node); + + this.associativity = associativity; + this.group = group; + } + + @Override + public boolean isAssociativityGroup() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitProdAssociativityGroup(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = associativity.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + associativity.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = group.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + group.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof AssociativityGroup)) { + return false; + } + AssociativityGroup tmp = (AssociativityGroup) o; + return true && tmp.associativity.equals(this.associativity) && tmp.group.equals(this.group) ; + } + + @Override + public int hashCode() { + return 191 + 191 * associativity.hashCode() + 409 * group.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Assoc getAssociativity() { + return this.associativity; + } + + @Override + public boolean hasAssociativity() { + return true; + } + @Override + public org.rascalmpl.ast.Prod getGroup() { + return this.group; + } + + @Override + public boolean hasGroup() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(associativity), clone(group)); + } + + } + public boolean isFirst() { + return false; + } + + static public class First extends Prod { + // Production: sig("First",[arg("org.rascalmpl.ast.Prod","lhs"),arg("org.rascalmpl.ast.Prod","rhs")],breakable=false) + + + private final org.rascalmpl.ast.Prod lhs; + private final org.rascalmpl.ast.Prod rhs; + + public First(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Prod lhs, org.rascalmpl.ast.Prod rhs) { + super(src, node); + + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public boolean isFirst() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitProdFirst(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = lhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + lhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = rhs.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + rhs.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof First)) { + return false; + } + First tmp = (First) o; + return true && tmp.lhs.equals(this.lhs) && tmp.rhs.equals(this.rhs) ; + } + + @Override + public int hashCode() { + return 487 + 29 * lhs.hashCode() + 23 * rhs.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Prod getLhs() { + return this.lhs; + } + + @Override + public boolean hasLhs() { + return true; + } + @Override + public org.rascalmpl.ast.Prod getRhs() { + return this.rhs; + } + + @Override + public boolean hasRhs() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(lhs), clone(rhs)); + } + + } + public boolean isLabeled() { + return false; + } + + static public class Labeled extends Prod { + // Production: sig("Labeled",[arg("java.util.List\","modifiers"),arg("org.rascalmpl.ast.Name","name"),arg("java.util.List\","syms")],breakable=false) + + + private final java.util.List modifiers; + private final org.rascalmpl.ast.Name name; + private final java.util.List syms; + + public Labeled(ISourceLocation src, IConstructor node , java.util.List modifiers, org.rascalmpl.ast.Name name, java.util.List syms) { + super(src, node); + + this.modifiers = modifiers; + this.name = name; + this.syms = syms; + } + + @Override + public boolean isLabeled() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitProdLabeled(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : modifiers) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : syms) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Labeled)) { + return false; + } + Labeled tmp = (Labeled) o; + return true && tmp.modifiers.equals(this.modifiers) && tmp.name.equals(this.name) && tmp.syms.equals(this.syms) ; + } + + @Override + public int hashCode() { + return 23 + 491 * modifiers.hashCode() + 617 * name.hashCode() + 761 * syms.hashCode() ; + } + + + @Override + public java.util.List getModifiers() { + return this.modifiers; + } + + @Override + public boolean hasModifiers() { + return true; + } + @Override + public org.rascalmpl.ast.Name getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + @Override + public java.util.List getSyms() { + return this.syms; + } + + @Override + public boolean hasSyms() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(modifiers), clone(name), clone(syms)); + } + + } + public boolean isReference() { + return false; + } + + static public class Reference extends Prod { + // Production: sig("Reference",[arg("org.rascalmpl.ast.Name","referenced")],breakable=false) + + + private final org.rascalmpl.ast.Name referenced; + + public Reference(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Name referenced) { + super(src, node); + + this.referenced = referenced; + } + + @Override + public boolean isReference() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitProdReference(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = referenced.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + referenced.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Reference)) { + return false; + } + Reference tmp = (Reference) o; + return true && tmp.referenced.equals(this.referenced) ; + } + + @Override + public int hashCode() { + return 197 + 5 * referenced.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Name getReferenced() { + return this.referenced; + } + + @Override + public boolean hasReferenced() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(referenced)); + } + + } + public boolean isUnlabeled() { + return false; + } + + static public class Unlabeled extends Prod { + // Production: sig("Unlabeled",[arg("java.util.List\","modifiers"),arg("java.util.List\","syms")],breakable=false) + + + private final java.util.List modifiers; + private final java.util.List syms; + + public Unlabeled(ISourceLocation src, IConstructor node , java.util.List modifiers, java.util.List syms) { + super(src, node); + + this.modifiers = modifiers; + this.syms = syms; + } + + @Override + public boolean isUnlabeled() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitProdUnlabeled(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : modifiers) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + for (AbstractAST $elem : syms) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Unlabeled)) { + return false; + } + Unlabeled tmp = (Unlabeled) o; + return true && tmp.modifiers.equals(this.modifiers) && tmp.syms.equals(this.syms) ; + } + + @Override + public int hashCode() { + return 19 + 19 * modifiers.hashCode() + 19 * syms.hashCode() ; + } + + + @Override + public java.util.List getModifiers() { + return this.modifiers; + } + + @Override + public boolean hasModifiers() { + return true; + } + @Override + public java.util.List getSyms() { + return this.syms; + } + + @Override + public boolean hasSyms() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(modifiers), clone(syms)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/ProdModifier.java b/src/org/rascalmpl/ast/ProdModifier.java new file mode 100644 index 00000000000..26d4fc9d296 --- /dev/null +++ b/src/org/rascalmpl/ast/ProdModifier.java @@ -0,0 +1,250 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class ProdModifier extends AbstractAST { + public ProdModifier(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasAssociativity() { + return false; + } + + public org.rascalmpl.ast.Assoc getAssociativity() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasTag() { + return false; + } + + public org.rascalmpl.ast.Tag getTag() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isAssociativity() { + return false; + } + + static public class Associativity extends ProdModifier { + // Production: sig("Associativity",[arg("org.rascalmpl.ast.Assoc","associativity")],breakable=false) + + + private final org.rascalmpl.ast.Assoc associativity; + + public Associativity(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Assoc associativity) { + super(src, node); + + this.associativity = associativity; + } + + @Override + public boolean isAssociativity() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitProdModifierAssociativity(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = associativity.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + associativity.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Associativity)) { + return false; + } + Associativity tmp = (Associativity) o; + return true && tmp.associativity.equals(this.associativity) ; + } + + @Override + public int hashCode() { + return 157 + 139 * associativity.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Assoc getAssociativity() { + return this.associativity; + } + + @Override + public boolean hasAssociativity() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(associativity)); + } + + } + public boolean isBracket() { + return false; + } + + static public class Bracket extends ProdModifier { + // Production: sig("Bracket",[],breakable=false) + + + + public Bracket(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isBracket() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitProdModifierBracket(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Bracket)) { + return false; + } + Bracket tmp = (Bracket) o; + return true ; + } + + @Override + public int hashCode() { + return 193 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isTag() { + return false; + } + + static public class Tag extends ProdModifier { + // Production: sig("Tag",[arg("org.rascalmpl.ast.Tag","tag")],breakable=false) + + + private final org.rascalmpl.ast.Tag tag; + + public Tag(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Tag tag) { + super(src, node); + + this.tag = tag; + } + + @Override + public boolean isTag() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitProdModifierTag(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = tag.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + tag.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Tag)) { + return false; + } + Tag tmp = (Tag) o; + return true && tmp.tag.equals(this.tag) ; + } + + @Override + public int hashCode() { + return 859 + 3 * tag.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Tag getTag() { + return this.tag; + } + + @Override + public boolean hasTag() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(tag)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/ProtocolChars.java b/src/org/rascalmpl/ast/ProtocolChars.java new file mode 100644 index 00000000000..07f05a1da01 --- /dev/null +++ b/src/org/rascalmpl/ast/ProtocolChars.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class ProtocolChars extends AbstractAST { + public ProtocolChars(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends ProtocolChars { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitProtocolCharsLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/ProtocolPart.java b/src/org/rascalmpl/ast/ProtocolPart.java new file mode 100644 index 00000000000..da59e66c377 --- /dev/null +++ b/src/org/rascalmpl/ast/ProtocolPart.java @@ -0,0 +1,247 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class ProtocolPart extends AbstractAST { + public ProtocolPart(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasExpression() { + return false; + } + + public org.rascalmpl.ast.Expression getExpression() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasPre() { + return false; + } + + public org.rascalmpl.ast.PreProtocolChars getPre() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasProtocolChars() { + return false; + } + + public org.rascalmpl.ast.ProtocolChars getProtocolChars() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasTail() { + return false; + } + + public org.rascalmpl.ast.ProtocolTail getTail() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isInterpolated() { + return false; + } + + static public class Interpolated extends ProtocolPart { + // Production: sig("Interpolated",[arg("org.rascalmpl.ast.PreProtocolChars","pre"),arg("org.rascalmpl.ast.Expression","expression"),arg("org.rascalmpl.ast.ProtocolTail","tail")],breakable=false) + + + private final org.rascalmpl.ast.PreProtocolChars pre; + private final org.rascalmpl.ast.Expression expression; + private final org.rascalmpl.ast.ProtocolTail tail; + + public Interpolated(ISourceLocation src, IConstructor node , org.rascalmpl.ast.PreProtocolChars pre, org.rascalmpl.ast.Expression expression, org.rascalmpl.ast.ProtocolTail tail) { + super(src, node); + + this.pre = pre; + this.expression = expression; + this.tail = tail; + } + + @Override + public boolean isInterpolated() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitProtocolPartInterpolated(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = pre.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + pre.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = tail.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + tail.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Interpolated)) { + return false; + } + Interpolated tmp = (Interpolated) o; + return true && tmp.pre.equals(this.pre) && tmp.expression.equals(this.expression) && tmp.tail.equals(this.tail) ; + } + + @Override + public int hashCode() { + return 701 + 283 * pre.hashCode() + 349 * expression.hashCode() + 139 * tail.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.PreProtocolChars getPre() { + return this.pre; + } + + @Override + public boolean hasPre() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + @Override + public org.rascalmpl.ast.ProtocolTail getTail() { + return this.tail; + } + + @Override + public boolean hasTail() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(pre), clone(expression), clone(tail)); + } + + } + public boolean isNonInterpolated() { + return false; + } + + static public class NonInterpolated extends ProtocolPart { + // Production: sig("NonInterpolated",[arg("org.rascalmpl.ast.ProtocolChars","protocolChars")],breakable=false) + + + private final org.rascalmpl.ast.ProtocolChars protocolChars; + + public NonInterpolated(ISourceLocation src, IConstructor node , org.rascalmpl.ast.ProtocolChars protocolChars) { + super(src, node); + + this.protocolChars = protocolChars; + } + + @Override + public boolean isNonInterpolated() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitProtocolPartNonInterpolated(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = protocolChars.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + protocolChars.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof NonInterpolated)) { + return false; + } + NonInterpolated tmp = (NonInterpolated) o; + return true && tmp.protocolChars.equals(this.protocolChars) ; + } + + @Override + public int hashCode() { + return 73 + 439 * protocolChars.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.ProtocolChars getProtocolChars() { + return this.protocolChars; + } + + @Override + public boolean hasProtocolChars() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(protocolChars)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/ProtocolTail.java b/src/org/rascalmpl/ast/ProtocolTail.java new file mode 100644 index 00000000000..bd141b43e5a --- /dev/null +++ b/src/org/rascalmpl/ast/ProtocolTail.java @@ -0,0 +1,247 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class ProtocolTail extends AbstractAST { + public ProtocolTail(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasExpression() { + return false; + } + + public org.rascalmpl.ast.Expression getExpression() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasMid() { + return false; + } + + public org.rascalmpl.ast.MidProtocolChars getMid() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasPost() { + return false; + } + + public org.rascalmpl.ast.PostProtocolChars getPost() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasTail() { + return false; + } + + public org.rascalmpl.ast.ProtocolTail getTail() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isMid() { + return false; + } + + static public class Mid extends ProtocolTail { + // Production: sig("Mid",[arg("org.rascalmpl.ast.MidProtocolChars","mid"),arg("org.rascalmpl.ast.Expression","expression"),arg("org.rascalmpl.ast.ProtocolTail","tail")],breakable=false) + + + private final org.rascalmpl.ast.MidProtocolChars mid; + private final org.rascalmpl.ast.Expression expression; + private final org.rascalmpl.ast.ProtocolTail tail; + + public Mid(ISourceLocation src, IConstructor node , org.rascalmpl.ast.MidProtocolChars mid, org.rascalmpl.ast.Expression expression, org.rascalmpl.ast.ProtocolTail tail) { + super(src, node); + + this.mid = mid; + this.expression = expression; + this.tail = tail; + } + + @Override + public boolean isMid() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitProtocolTailMid(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = mid.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + mid.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = tail.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + tail.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Mid)) { + return false; + } + Mid tmp = (Mid) o; + return true && tmp.mid.equals(this.mid) && tmp.expression.equals(this.expression) && tmp.tail.equals(this.tail) ; + } + + @Override + public int hashCode() { + return 191 + 89 * mid.hashCode() + 787 * expression.hashCode() + 73 * tail.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.MidProtocolChars getMid() { + return this.mid; + } + + @Override + public boolean hasMid() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + @Override + public org.rascalmpl.ast.ProtocolTail getTail() { + return this.tail; + } + + @Override + public boolean hasTail() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(mid), clone(expression), clone(tail)); + } + + } + public boolean isPost() { + return false; + } + + static public class Post extends ProtocolTail { + // Production: sig("Post",[arg("org.rascalmpl.ast.PostProtocolChars","post")],breakable=false) + + + private final org.rascalmpl.ast.PostProtocolChars post; + + public Post(ISourceLocation src, IConstructor node , org.rascalmpl.ast.PostProtocolChars post) { + super(src, node); + + this.post = post; + } + + @Override + public boolean isPost() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitProtocolTailPost(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = post.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + post.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Post)) { + return false; + } + Post tmp = (Post) o; + return true && tmp.post.equals(this.post) ; + } + + @Override + public int hashCode() { + return 673 + 233 * post.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.PostProtocolChars getPost() { + return this.post; + } + + @Override + public boolean hasPost() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(post)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/QualifiedName.java b/src/org/rascalmpl/ast/QualifiedName.java new file mode 100644 index 00000000000..f35e0825f1d --- /dev/null +++ b/src/org/rascalmpl/ast/QualifiedName.java @@ -0,0 +1,116 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class QualifiedName extends AbstractAST { + public QualifiedName(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasNames() { + return false; + } + + public java.util.List getNames() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDefault() { + return false; + } + + static public class Default extends QualifiedName { + // Production: sig("Default",[arg("java.util.List\","names")],breakable=false) + + + private final java.util.List names; + + public Default(ISourceLocation src, IConstructor node , java.util.List names) { + super(src, node); + + this.names = names; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitQualifiedNameDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : names) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.names.equals(this.names) ; + } + + @Override + public int hashCode() { + return 331 + 223 * names.hashCode() ; + } + + + @Override + public java.util.List getNames() { + return this.names; + } + + @Override + public boolean hasNames() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(names)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Range.java b/src/org/rascalmpl/ast/Range.java new file mode 100644 index 00000000000..b84e406aa8c --- /dev/null +++ b/src/org/rascalmpl/ast/Range.java @@ -0,0 +1,221 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Range extends AbstractAST { + public Range(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasCharacter() { + return false; + } + + public org.rascalmpl.ast.Char getCharacter() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasEnd() { + return false; + } + + public org.rascalmpl.ast.Char getEnd() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasStart() { + return false; + } + + public org.rascalmpl.ast.Char getStart() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isCharacter() { + return false; + } + + static public class Character extends Range { + // Production: sig("Character",[arg("org.rascalmpl.ast.Char","character")],breakable=false) + + + private final org.rascalmpl.ast.Char character; + + public Character(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Char character) { + super(src, node); + + this.character = character; + } + + @Override + public boolean isCharacter() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitRangeCharacter(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = character.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + character.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Character)) { + return false; + } + Character tmp = (Character) o; + return true && tmp.character.equals(this.character) ; + } + + @Override + public int hashCode() { + return 499 + 919 * character.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Char getCharacter() { + return this.character; + } + + @Override + public boolean hasCharacter() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(character)); + } + + } + public boolean isFromTo() { + return false; + } + + static public class FromTo extends Range { + // Production: sig("FromTo",[arg("org.rascalmpl.ast.Char","start"),arg("org.rascalmpl.ast.Char","end")],breakable=false) + + + private final org.rascalmpl.ast.Char start; + private final org.rascalmpl.ast.Char end; + + public FromTo(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Char start, org.rascalmpl.ast.Char end) { + super(src, node); + + this.start = start; + this.end = end; + } + + @Override + public boolean isFromTo() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitRangeFromTo(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = start.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + start.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = end.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + end.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof FromTo)) { + return false; + } + FromTo tmp = (FromTo) o; + return true && tmp.start.equals(this.start) && tmp.end.equals(this.end) ; + } + + @Override + public int hashCode() { + return 233 + 709 * start.hashCode() + 503 * end.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Char getStart() { + return this.start; + } + + @Override + public boolean hasStart() { + return true; + } + @Override + public org.rascalmpl.ast.Char getEnd() { + return this.end; + } + + @Override + public boolean hasEnd() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(start), clone(end)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/RationalLiteral.java b/src/org/rascalmpl/ast/RationalLiteral.java new file mode 100644 index 00000000000..3a61a3f5f33 --- /dev/null +++ b/src/org/rascalmpl/ast/RationalLiteral.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class RationalLiteral extends AbstractAST { + public RationalLiteral(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends RationalLiteral { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitRationalLiteralLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/RealLiteral.java b/src/org/rascalmpl/ast/RealLiteral.java new file mode 100644 index 00000000000..45c66e80dfe --- /dev/null +++ b/src/org/rascalmpl/ast/RealLiteral.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class RealLiteral extends AbstractAST { + public RealLiteral(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends RealLiteral { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitRealLiteralLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/RegExp.java b/src/org/rascalmpl/ast/RegExp.java new file mode 100644 index 00000000000..eedd0e4f523 --- /dev/null +++ b/src/org/rascalmpl/ast/RegExp.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class RegExp extends AbstractAST { + public RegExp(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends RegExp { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitRegExpLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/RegExpLiteral.java b/src/org/rascalmpl/ast/RegExpLiteral.java new file mode 100644 index 00000000000..ba16b72ae1c --- /dev/null +++ b/src/org/rascalmpl/ast/RegExpLiteral.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class RegExpLiteral extends AbstractAST { + public RegExpLiteral(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends RegExpLiteral { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitRegExpLiteralLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/RegExpModifier.java b/src/org/rascalmpl/ast/RegExpModifier.java new file mode 100644 index 00000000000..99d86aa434e --- /dev/null +++ b/src/org/rascalmpl/ast/RegExpModifier.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class RegExpModifier extends AbstractAST { + public RegExpModifier(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends RegExpModifier { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitRegExpModifierLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Renaming.java b/src/org/rascalmpl/ast/Renaming.java new file mode 100644 index 00000000000..a2e6bbe8927 --- /dev/null +++ b/src/org/rascalmpl/ast/Renaming.java @@ -0,0 +1,140 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Renaming extends AbstractAST { + public Renaming(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasFrom() { + return false; + } + + public org.rascalmpl.ast.Name getFrom() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasTo() { + return false; + } + + public org.rascalmpl.ast.Name getTo() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDefault() { + return false; + } + + static public class Default extends Renaming { + // Production: sig("Default",[arg("org.rascalmpl.ast.Name","from"),arg("org.rascalmpl.ast.Name","to")],breakable=false) + + + private final org.rascalmpl.ast.Name from; + private final org.rascalmpl.ast.Name to; + + public Default(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Name from, org.rascalmpl.ast.Name to) { + super(src, node); + + this.from = from; + this.to = to; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitRenamingDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = from.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + from.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = to.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + to.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.from.equals(this.from) && tmp.to.equals(this.to) ; + } + + @Override + public int hashCode() { + return 233 + 419 * from.hashCode() + 599 * to.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Name getFrom() { + return this.from; + } + + @Override + public boolean hasFrom() { + return true; + } + @Override + public org.rascalmpl.ast.Name getTo() { + return this.to; + } + + @Override + public boolean hasTo() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(from), clone(to)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Renamings.java b/src/org/rascalmpl/ast/Renamings.java new file mode 100644 index 00000000000..52b87f250d1 --- /dev/null +++ b/src/org/rascalmpl/ast/Renamings.java @@ -0,0 +1,116 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Renamings extends AbstractAST { + public Renamings(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasRenamings() { + return false; + } + + public java.util.List getRenamings() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDefault() { + return false; + } + + static public class Default extends Renamings { + // Production: sig("Default",[arg("java.util.List\","renamings")],breakable=false) + + + private final java.util.List renamings; + + public Default(ISourceLocation src, IConstructor node , java.util.List renamings) { + super(src, node); + + this.renamings = renamings; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitRenamingsDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : renamings) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.renamings.equals(this.renamings) ; + } + + @Override + public int hashCode() { + return 881 + 739 * renamings.hashCode() ; + } + + + @Override + public java.util.List getRenamings() { + return this.renamings; + } + + @Override + public boolean hasRenamings() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(renamings)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Replacement.java b/src/org/rascalmpl/ast/Replacement.java new file mode 100644 index 00000000000..8c459d57785 --- /dev/null +++ b/src/org/rascalmpl/ast/Replacement.java @@ -0,0 +1,216 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Replacement extends AbstractAST { + public Replacement(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasConditions() { + return false; + } + + public java.util.List getConditions() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasReplacementExpression() { + return false; + } + + public org.rascalmpl.ast.Expression getReplacementExpression() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isConditional() { + return false; + } + + static public class Conditional extends Replacement { + // Production: sig("Conditional",[arg("org.rascalmpl.ast.Expression","replacementExpression"),arg("java.util.List\","conditions")],breakable=false) + + + private final org.rascalmpl.ast.Expression replacementExpression; + private final java.util.List conditions; + + public Conditional(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression replacementExpression, java.util.List conditions) { + super(src, node); + + this.replacementExpression = replacementExpression; + this.conditions = conditions; + } + + @Override + public boolean isConditional() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitReplacementConditional(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = replacementExpression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + replacementExpression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : conditions) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Conditional)) { + return false; + } + Conditional tmp = (Conditional) o; + return true && tmp.replacementExpression.equals(this.replacementExpression) && tmp.conditions.equals(this.conditions) ; + } + + @Override + public int hashCode() { + return 881 + 3 * replacementExpression.hashCode() + 293 * conditions.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getReplacementExpression() { + return this.replacementExpression; + } + + @Override + public boolean hasReplacementExpression() { + return true; + } + @Override + public java.util.List getConditions() { + return this.conditions; + } + + @Override + public boolean hasConditions() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(replacementExpression), clone(conditions)); + } + + } + public boolean isUnconditional() { + return false; + } + + static public class Unconditional extends Replacement { + // Production: sig("Unconditional",[arg("org.rascalmpl.ast.Expression","replacementExpression")],breakable=false) + + + private final org.rascalmpl.ast.Expression replacementExpression; + + public Unconditional(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression replacementExpression) { + super(src, node); + + this.replacementExpression = replacementExpression; + } + + @Override + public boolean isUnconditional() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitReplacementUnconditional(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = replacementExpression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + replacementExpression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Unconditional)) { + return false; + } + Unconditional tmp = (Unconditional) o; + return true && tmp.replacementExpression.equals(this.replacementExpression) ; + } + + @Override + public int hashCode() { + return 281 + 433 * replacementExpression.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getReplacementExpression() { + return this.replacementExpression; + } + + @Override + public boolean hasReplacementExpression() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(replacementExpression)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/ShellCommand.java b/src/org/rascalmpl/ast/ShellCommand.java new file mode 100644 index 00000000000..4b54d0135d3 --- /dev/null +++ b/src/org/rascalmpl/ast/ShellCommand.java @@ -0,0 +1,1294 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class ShellCommand extends AbstractAST { + public ShellCommand(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasOptName() { + return false; + } + + public org.rascalmpl.ast.@org.checkerframework.checker.nullness.qual.MonotonicNonNull QualifiedName getOptName() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasExpression() { + return false; + } + + public org.rascalmpl.ast.Expression getExpression() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasSign() { + return false; + } + + public org.rascalmpl.ast.OptionalEqualSign getSign() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasTerminator() { + return false; + } + + public org.rascalmpl.ast.OptionalTerminator getTerminator() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasName() { + return false; + } + + public org.rascalmpl.ast.QualifiedName getName() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isClear() { + return false; + } + + static public class Clear extends ShellCommand { + // Production: sig("Clear",[arg("org.rascalmpl.ast.OptionalTerminator","terminator")],breakable=false) + + + private final org.rascalmpl.ast.OptionalTerminator terminator; + + public Clear(ISourceLocation src, IConstructor node , org.rascalmpl.ast.OptionalTerminator terminator) { + super(src, node); + + this.terminator = terminator; + } + + @Override + public boolean isClear() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitShellCommandClear(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = terminator.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + terminator.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Clear)) { + return false; + } + Clear tmp = (Clear) o; + return true && tmp.terminator.equals(this.terminator) ; + } + + @Override + public int hashCode() { + return 283 + 727 * terminator.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.OptionalTerminator getTerminator() { + return this.terminator; + } + + @Override + public boolean hasTerminator() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(terminator)); + } + + } + public boolean isEdit() { + return false; + } + + static public class Edit extends ShellCommand { + // Production: sig("Edit",[arg("org.rascalmpl.ast.QualifiedName","name"),arg("org.rascalmpl.ast.OptionalTerminator","terminator")],breakable=false) + + + private final org.rascalmpl.ast.QualifiedName name; + private final org.rascalmpl.ast.OptionalTerminator terminator; + + public Edit(ISourceLocation src, IConstructor node , org.rascalmpl.ast.QualifiedName name, org.rascalmpl.ast.OptionalTerminator terminator) { + super(src, node); + + this.name = name; + this.terminator = terminator; + } + + @Override + public boolean isEdit() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitShellCommandEdit(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = terminator.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + terminator.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Edit)) { + return false; + } + Edit tmp = (Edit) o; + return true && tmp.name.equals(this.name) && tmp.terminator.equals(this.terminator) ; + } + + @Override + public int hashCode() { + return 449 + 983 * name.hashCode() + 523 * terminator.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.QualifiedName getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + @Override + public org.rascalmpl.ast.OptionalTerminator getTerminator() { + return this.terminator; + } + + @Override + public boolean hasTerminator() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(name), clone(terminator)); + } + + } + public boolean isHelp() { + return false; + } + + static public class Help extends ShellCommand { + // Production: sig("Help",[arg("org.rascalmpl.ast.OptionalTerminator","terminator")],breakable=false) + + + private final org.rascalmpl.ast.OptionalTerminator terminator; + + public Help(ISourceLocation src, IConstructor node , org.rascalmpl.ast.OptionalTerminator terminator) { + super(src, node); + + this.terminator = terminator; + } + + @Override + public boolean isHelp() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitShellCommandHelp(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = terminator.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + terminator.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Help)) { + return false; + } + Help tmp = (Help) o; + return true && tmp.terminator.equals(this.terminator) ; + } + + @Override + public int hashCode() { + return 271 + 907 * terminator.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.OptionalTerminator getTerminator() { + return this.terminator; + } + + @Override + public boolean hasTerminator() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(terminator)); + } + + } + public boolean isHistory() { + return false; + } + + static public class History extends ShellCommand { + // Production: sig("History",[arg("org.rascalmpl.ast.OptionalTerminator","terminator")],breakable=false) + + + private final org.rascalmpl.ast.OptionalTerminator terminator; + + public History(ISourceLocation src, IConstructor node , org.rascalmpl.ast.OptionalTerminator terminator) { + super(src, node); + + this.terminator = terminator; + } + + @Override + public boolean isHistory() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitShellCommandHistory(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = terminator.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + terminator.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof History)) { + return false; + } + History tmp = (History) o; + return true && tmp.terminator.equals(this.terminator) ; + } + + @Override + public int hashCode() { + return 479 + 383 * terminator.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.OptionalTerminator getTerminator() { + return this.terminator; + } + + @Override + public boolean hasTerminator() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(terminator)); + } + + } + public boolean isListDeclarations() { + return false; + } + + static public class ListDeclarations extends ShellCommand { + // Production: sig("ListDeclarations",[arg("org.rascalmpl.ast.OptionalTerminator","terminator")],breakable=false) + + + private final org.rascalmpl.ast.OptionalTerminator terminator; + + public ListDeclarations(ISourceLocation src, IConstructor node , org.rascalmpl.ast.OptionalTerminator terminator) { + super(src, node); + + this.terminator = terminator; + } + + @Override + public boolean isListDeclarations() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitShellCommandListDeclarations(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = terminator.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + terminator.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof ListDeclarations)) { + return false; + } + ListDeclarations tmp = (ListDeclarations) o; + return true && tmp.terminator.equals(this.terminator) ; + } + + @Override + public int hashCode() { + return 397 + 929 * terminator.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.OptionalTerminator getTerminator() { + return this.terminator; + } + + @Override + public boolean hasTerminator() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(terminator)); + } + + } + public boolean isListModules() { + return false; + } + + static public class ListModules extends ShellCommand { + // Production: sig("ListModules",[arg("org.rascalmpl.ast.OptionalTerminator","terminator")],breakable=false) + + + private final org.rascalmpl.ast.OptionalTerminator terminator; + + public ListModules(ISourceLocation src, IConstructor node , org.rascalmpl.ast.OptionalTerminator terminator) { + super(src, node); + + this.terminator = terminator; + } + + @Override + public boolean isListModules() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitShellCommandListModules(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = terminator.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + terminator.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof ListModules)) { + return false; + } + ListModules tmp = (ListModules) o; + return true && tmp.terminator.equals(this.terminator) ; + } + + @Override + public int hashCode() { + return 997 + 857 * terminator.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.OptionalTerminator getTerminator() { + return this.terminator; + } + + @Override + public boolean hasTerminator() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(terminator)); + } + + } + public boolean isQuit() { + return false; + } + + static public class Quit extends ShellCommand { + // Production: sig("Quit",[arg("org.rascalmpl.ast.OptionalTerminator","terminator")],breakable=false) + + + private final org.rascalmpl.ast.OptionalTerminator terminator; + + public Quit(ISourceLocation src, IConstructor node , org.rascalmpl.ast.OptionalTerminator terminator) { + super(src, node); + + this.terminator = terminator; + } + + @Override + public boolean isQuit() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitShellCommandQuit(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = terminator.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + terminator.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Quit)) { + return false; + } + Quit tmp = (Quit) o; + return true && tmp.terminator.equals(this.terminator) ; + } + + @Override + public int hashCode() { + return 127 + 607 * terminator.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.OptionalTerminator getTerminator() { + return this.terminator; + } + + @Override + public boolean hasTerminator() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(terminator)); + } + + } + public boolean isSetOption() { + return false; + } + + static public class SetOption extends ShellCommand { + // Production: sig("SetOption",[arg("org.rascalmpl.ast.QualifiedName","name"),arg("org.rascalmpl.ast.OptionalEqualSign","sign"),arg("org.rascalmpl.ast.Expression","expression"),arg("org.rascalmpl.ast.OptionalTerminator","terminator")],breakable=false) + + + private final org.rascalmpl.ast.QualifiedName name; + private final org.rascalmpl.ast.OptionalEqualSign sign; + private final org.rascalmpl.ast.Expression expression; + private final org.rascalmpl.ast.OptionalTerminator terminator; + + public SetOption(ISourceLocation src, IConstructor node , org.rascalmpl.ast.QualifiedName name, org.rascalmpl.ast.OptionalEqualSign sign, org.rascalmpl.ast.Expression expression, org.rascalmpl.ast.OptionalTerminator terminator) { + super(src, node); + + this.name = name; + this.sign = sign; + this.expression = expression; + this.terminator = terminator; + } + + @Override + public boolean isSetOption() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitShellCommandSetOption(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = sign.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + sign.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = terminator.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + terminator.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof SetOption)) { + return false; + } + SetOption tmp = (SetOption) o; + return true && tmp.name.equals(this.name) && tmp.sign.equals(this.sign) && tmp.expression.equals(this.expression) && tmp.terminator.equals(this.terminator) ; + } + + @Override + public int hashCode() { + return 631 + 449 * name.hashCode() + 113 * sign.hashCode() + 659 * expression.hashCode() + 113 * terminator.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.QualifiedName getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + @Override + public org.rascalmpl.ast.OptionalEqualSign getSign() { + return this.sign; + } + + @Override + public boolean hasSign() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + @Override + public org.rascalmpl.ast.OptionalTerminator getTerminator() { + return this.terminator; + } + + @Override + public boolean hasTerminator() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(name), clone(sign), clone(expression), clone(terminator)); + } + + } + public boolean isSetOptionTrue() { + return false; + } + + static public class SetOptionTrue extends ShellCommand { + // Production: sig("SetOptionTrue",[arg("org.rascalmpl.ast.QualifiedName","name"),arg("org.rascalmpl.ast.OptionalTerminator","terminator")],breakable=false) + + + private final org.rascalmpl.ast.QualifiedName name; + private final org.rascalmpl.ast.OptionalTerminator terminator; + + public SetOptionTrue(ISourceLocation src, IConstructor node , org.rascalmpl.ast.QualifiedName name, org.rascalmpl.ast.OptionalTerminator terminator) { + super(src, node); + + this.name = name; + this.terminator = terminator; + } + + @Override + public boolean isSetOptionTrue() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitShellCommandSetOptionTrue(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = terminator.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + terminator.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof SetOptionTrue)) { + return false; + } + SetOptionTrue tmp = (SetOptionTrue) o; + return true && tmp.name.equals(this.name) && tmp.terminator.equals(this.terminator) ; + } + + @Override + public int hashCode() { + return 163 + 491 * name.hashCode() + 887 * terminator.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.QualifiedName getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + @Override + public org.rascalmpl.ast.OptionalTerminator getTerminator() { + return this.terminator; + } + + @Override + public boolean hasTerminator() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(name), clone(terminator)); + } + + } + public boolean isTest() { + return false; + } + + static public class Test extends ShellCommand { + // Production: sig("Test",[arg("org.rascalmpl.ast.@org.checkerframework.checker.nullness.qual.Nullable QualifiedName","optName",isOptional=true),arg("org.rascalmpl.ast.OptionalTerminator","terminator")],breakable=false) + + + private final org.rascalmpl.ast.@org.checkerframework.checker.nullness.qual.Nullable QualifiedName optName; + private final org.rascalmpl.ast.OptionalTerminator terminator; + + public Test(ISourceLocation src, IConstructor node , org.rascalmpl.ast.@org.checkerframework.checker.nullness.qual.Nullable QualifiedName optName, org.rascalmpl.ast.OptionalTerminator terminator) { + super(src, node); + + this.optName = optName; + this.terminator = terminator; + } + + @Override + public boolean isTest() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitShellCommandTest(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = (optName == null) ? null : optName.getLocation(); + if ($l != null && $l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + optName.addForLineNumber($line, $result); + } + if ($l != null && $l.getBeginLine() > $line) { + return; + } + + $l = terminator.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + terminator.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Test)) { + return false; + } + Test tmp = (Test) o; + return true && java.util.Objects.equals(tmp.optName, this.optName) && tmp.terminator.equals(this.terminator) ; + } + + @Override + public int hashCode() { + return 547 + 293 * java.util.Objects.hashCode(optName) + 997 * terminator.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.@org.checkerframework.checker.nullness.qual.MonotonicNonNull QualifiedName getOptName() { + return this.optName; + } + + @Override @org.checkerframework.checker.nullness.qual.EnsuresNonNullIf(expression="getOptName()", result=true) + public boolean hasOptName() { + return this.optName != null; + } + @Override + public org.rascalmpl.ast.OptionalTerminator getTerminator() { + return this.terminator; + } + + @Override + public boolean hasTerminator() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(optName), clone(terminator)); + } + + } + public boolean isUndeclare() { + return false; + } + + static public class Undeclare extends ShellCommand { + // Production: sig("Undeclare",[arg("org.rascalmpl.ast.@org.checkerframework.checker.nullness.qual.Nullable QualifiedName","optName",isOptional=true),arg("org.rascalmpl.ast.OptionalTerminator","terminator")],breakable=false) + + + private final org.rascalmpl.ast.@org.checkerframework.checker.nullness.qual.Nullable QualifiedName optName; + private final org.rascalmpl.ast.OptionalTerminator terminator; + + public Undeclare(ISourceLocation src, IConstructor node , org.rascalmpl.ast.@org.checkerframework.checker.nullness.qual.Nullable QualifiedName optName, org.rascalmpl.ast.OptionalTerminator terminator) { + super(src, node); + + this.optName = optName; + this.terminator = terminator; + } + + @Override + public boolean isUndeclare() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitShellCommandUndeclare(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = (optName == null) ? null : optName.getLocation(); + if ($l != null && $l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + optName.addForLineNumber($line, $result); + } + if ($l != null && $l.getBeginLine() > $line) { + return; + } + + $l = terminator.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + terminator.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Undeclare)) { + return false; + } + Undeclare tmp = (Undeclare) o; + return true && java.util.Objects.equals(tmp.optName, this.optName) && tmp.terminator.equals(this.terminator) ; + } + + @Override + public int hashCode() { + return 881 + 313 * java.util.Objects.hashCode(optName) + 127 * terminator.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.@org.checkerframework.checker.nullness.qual.MonotonicNonNull QualifiedName getOptName() { + return this.optName; + } + + @Override @org.checkerframework.checker.nullness.qual.EnsuresNonNullIf(expression="getOptName()", result=true) + public boolean hasOptName() { + return this.optName != null; + } + @Override + public org.rascalmpl.ast.OptionalTerminator getTerminator() { + return this.terminator; + } + + @Override + public boolean hasTerminator() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(optName), clone(terminator)); + } + + } + public boolean isUnextend() { + return false; + } + + static public class Unextend extends ShellCommand { + // Production: sig("Unextend",[arg("org.rascalmpl.ast.QualifiedName","name"),arg("org.rascalmpl.ast.OptionalTerminator","terminator")],breakable=false) + + + private final org.rascalmpl.ast.QualifiedName name; + private final org.rascalmpl.ast.OptionalTerminator terminator; + + public Unextend(ISourceLocation src, IConstructor node , org.rascalmpl.ast.QualifiedName name, org.rascalmpl.ast.OptionalTerminator terminator) { + super(src, node); + + this.name = name; + this.terminator = terminator; + } + + @Override + public boolean isUnextend() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitShellCommandUnextend(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = terminator.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + terminator.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Unextend)) { + return false; + } + Unextend tmp = (Unextend) o; + return true && tmp.name.equals(this.name) && tmp.terminator.equals(this.terminator) ; + } + + @Override + public int hashCode() { + return 823 + 757 * name.hashCode() + 89 * terminator.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.QualifiedName getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + @Override + public org.rascalmpl.ast.OptionalTerminator getTerminator() { + return this.terminator; + } + + @Override + public boolean hasTerminator() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(name), clone(terminator)); + } + + } + public boolean isUnimport() { + return false; + } + + static public class Unimport extends ShellCommand { + // Production: sig("Unimport",[arg("org.rascalmpl.ast.QualifiedName","name"),arg("org.rascalmpl.ast.OptionalTerminator","terminator")],breakable=false) + + + private final org.rascalmpl.ast.QualifiedName name; + private final org.rascalmpl.ast.OptionalTerminator terminator; + + public Unimport(ISourceLocation src, IConstructor node , org.rascalmpl.ast.QualifiedName name, org.rascalmpl.ast.OptionalTerminator terminator) { + super(src, node); + + this.name = name; + this.terminator = terminator; + } + + @Override + public boolean isUnimport() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitShellCommandUnimport(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = terminator.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + terminator.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Unimport)) { + return false; + } + Unimport tmp = (Unimport) o; + return true && tmp.name.equals(this.name) && tmp.terminator.equals(this.terminator) ; + } + + @Override + public int hashCode() { + return 619 + 401 * name.hashCode() + 463 * terminator.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.QualifiedName getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + @Override + public org.rascalmpl.ast.OptionalTerminator getTerminator() { + return this.terminator; + } + + @Override + public boolean hasTerminator() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(name), clone(terminator)); + } + + } + public boolean isUnsetOption() { + return false; + } + + static public class UnsetOption extends ShellCommand { + // Production: sig("UnsetOption",[arg("org.rascalmpl.ast.QualifiedName","name"),arg("org.rascalmpl.ast.OptionalTerminator","terminator")],breakable=false) + + + private final org.rascalmpl.ast.QualifiedName name; + private final org.rascalmpl.ast.OptionalTerminator terminator; + + public UnsetOption(ISourceLocation src, IConstructor node , org.rascalmpl.ast.QualifiedName name, org.rascalmpl.ast.OptionalTerminator terminator) { + super(src, node); + + this.name = name; + this.terminator = terminator; + } + + @Override + public boolean isUnsetOption() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitShellCommandUnsetOption(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = terminator.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + terminator.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof UnsetOption)) { + return false; + } + UnsetOption tmp = (UnsetOption) o; + return true && tmp.name.equals(this.name) && tmp.terminator.equals(this.terminator) ; + } + + @Override + public int hashCode() { + return 317 + 857 * name.hashCode() + 353 * terminator.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.QualifiedName getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + @Override + public org.rascalmpl.ast.OptionalTerminator getTerminator() { + return this.terminator; + } + + @Override + public boolean hasTerminator() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(name), clone(terminator)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Signature.java b/src/org/rascalmpl/ast/Signature.java new file mode 100644 index 00000000000..b1b05dc0b70 --- /dev/null +++ b/src/org/rascalmpl/ast/Signature.java @@ -0,0 +1,351 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Signature extends AbstractAST { + public Signature(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasExceptions() { + return false; + } + + public java.util.List getExceptions() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasModifiers() { + return false; + } + + public org.rascalmpl.ast.FunctionModifiers getModifiers() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasName() { + return false; + } + + public org.rascalmpl.ast.Name getName() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasParameters() { + return false; + } + + public org.rascalmpl.ast.Parameters getParameters() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasType() { + return false; + } + + public org.rascalmpl.ast.Type getType() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isNoThrows() { + return false; + } + + static public class NoThrows extends Signature { + // Production: sig("NoThrows",[arg("org.rascalmpl.ast.FunctionModifiers","modifiers"),arg("org.rascalmpl.ast.Type","type"),arg("org.rascalmpl.ast.Name","name"),arg("org.rascalmpl.ast.Parameters","parameters")],breakable=false) + + + private final org.rascalmpl.ast.FunctionModifiers modifiers; + private final org.rascalmpl.ast.Type type; + private final org.rascalmpl.ast.Name name; + private final org.rascalmpl.ast.Parameters parameters; + + public NoThrows(ISourceLocation src, IConstructor node , org.rascalmpl.ast.FunctionModifiers modifiers, org.rascalmpl.ast.Type type, org.rascalmpl.ast.Name name, org.rascalmpl.ast.Parameters parameters) { + super(src, node); + + this.modifiers = modifiers; + this.type = type; + this.name = name; + this.parameters = parameters; + } + + @Override + public boolean isNoThrows() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSignatureNoThrows(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = modifiers.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + modifiers.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = type.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + type.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = parameters.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + parameters.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof NoThrows)) { + return false; + } + NoThrows tmp = (NoThrows) o; + return true && tmp.modifiers.equals(this.modifiers) && tmp.type.equals(this.type) && tmp.name.equals(this.name) && tmp.parameters.equals(this.parameters) ; + } + + @Override + public int hashCode() { + return 53 + 149 * modifiers.hashCode() + 127 * type.hashCode() + 827 * name.hashCode() + 431 * parameters.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.FunctionModifiers getModifiers() { + return this.modifiers; + } + + @Override + public boolean hasModifiers() { + return true; + } + @Override + public org.rascalmpl.ast.Type getType() { + return this.type; + } + + @Override + public boolean hasType() { + return true; + } + @Override + public org.rascalmpl.ast.Name getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + @Override + public org.rascalmpl.ast.Parameters getParameters() { + return this.parameters; + } + + @Override + public boolean hasParameters() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(modifiers), clone(type), clone(name), clone(parameters)); + } + + } + public boolean isWithThrows() { + return false; + } + + static public class WithThrows extends Signature { + // Production: sig("WithThrows",[arg("org.rascalmpl.ast.FunctionModifiers","modifiers"),arg("org.rascalmpl.ast.Type","type"),arg("org.rascalmpl.ast.Name","name"),arg("org.rascalmpl.ast.Parameters","parameters"),arg("java.util.List\","exceptions")],breakable=false) + + + private final org.rascalmpl.ast.FunctionModifiers modifiers; + private final org.rascalmpl.ast.Type type; + private final org.rascalmpl.ast.Name name; + private final org.rascalmpl.ast.Parameters parameters; + private final java.util.List exceptions; + + public WithThrows(ISourceLocation src, IConstructor node , org.rascalmpl.ast.FunctionModifiers modifiers, org.rascalmpl.ast.Type type, org.rascalmpl.ast.Name name, org.rascalmpl.ast.Parameters parameters, java.util.List exceptions) { + super(src, node); + + this.modifiers = modifiers; + this.type = type; + this.name = name; + this.parameters = parameters; + this.exceptions = exceptions; + } + + @Override + public boolean isWithThrows() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSignatureWithThrows(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = modifiers.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + modifiers.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = type.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + type.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = parameters.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + parameters.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : exceptions) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof WithThrows)) { + return false; + } + WithThrows tmp = (WithThrows) o; + return true && tmp.modifiers.equals(this.modifiers) && tmp.type.equals(this.type) && tmp.name.equals(this.name) && tmp.parameters.equals(this.parameters) && tmp.exceptions.equals(this.exceptions) ; + } + + @Override + public int hashCode() { + return 131 + 827 * modifiers.hashCode() + 2 * type.hashCode() + 449 * name.hashCode() + 89 * parameters.hashCode() + 233 * exceptions.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.FunctionModifiers getModifiers() { + return this.modifiers; + } + + @Override + public boolean hasModifiers() { + return true; + } + @Override + public org.rascalmpl.ast.Type getType() { + return this.type; + } + + @Override + public boolean hasType() { + return true; + } + @Override + public org.rascalmpl.ast.Name getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + @Override + public org.rascalmpl.ast.Parameters getParameters() { + return this.parameters; + } + + @Override + public boolean hasParameters() { + return true; + } + @Override + public java.util.List getExceptions() { + return this.exceptions; + } + + @Override + public boolean hasExceptions() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(modifiers), clone(type), clone(name), clone(parameters), clone(exceptions)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Start.java b/src/org/rascalmpl/ast/Start.java new file mode 100644 index 00000000000..936b0286f55 --- /dev/null +++ b/src/org/rascalmpl/ast/Start.java @@ -0,0 +1,143 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Start extends AbstractAST { + public Start(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + + + + public boolean isAbsent() { + return false; + } + + static public class Absent extends Start { + // Production: sig("Absent",[],breakable=false) + + + + public Absent(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isAbsent() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStartAbsent(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Absent)) { + return false; + } + Absent tmp = (Absent) o; + return true ; + } + + @Override + public int hashCode() { + return 617 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isPresent() { + return false; + } + + static public class Present extends Start { + // Production: sig("Present",[],breakable=false) + + + + public Present(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isPresent() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStartPresent(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Present)) { + return false; + } + Present tmp = (Present) o; + return true ; + } + + @Override + public int hashCode() { + return 151 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Statement.java b/src/org/rascalmpl/ast/Statement.java new file mode 100644 index 00000000000..a75fc9480d8 --- /dev/null +++ b/src/org/rascalmpl/ast/Statement.java @@ -0,0 +1,2757 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Statement extends AbstractAST { + public Statement(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasCases() { + return false; + } + + public java.util.List getCases() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasHandlers() { + return false; + } + + public java.util.List getHandlers() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasConditions() { + return false; + } + + public java.util.List getConditions() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasGenerators() { + return false; + } + + public java.util.List getGenerators() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasNames() { + return false; + } + + public java.util.List getNames() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasVariables() { + return false; + } + + public java.util.List getVariables() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasStatements() { + return false; + } + + public java.util.List getStatements() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasAssignable() { + return false; + } + + public org.rascalmpl.ast.Assignable getAssignable() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasOperator() { + return false; + } + + public org.rascalmpl.ast.Assignment getOperator() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasBound() { + return false; + } + + public org.rascalmpl.ast.Bound getBound() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasDataTarget() { + return false; + } + + public org.rascalmpl.ast.DataTarget getDataTarget() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasCondition() { + return false; + } + + public org.rascalmpl.ast.Expression getCondition() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasExpression() { + return false; + } + + public org.rascalmpl.ast.Expression getExpression() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasMessage() { + return false; + } + + public org.rascalmpl.ast.Expression getMessage() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasFunctionDeclaration() { + return false; + } + + public org.rascalmpl.ast.FunctionDeclaration getFunctionDeclaration() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasLabel() { + return false; + } + + public org.rascalmpl.ast.Label getLabel() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasDeclaration() { + return false; + } + + public org.rascalmpl.ast.LocalVariableDeclaration getDeclaration() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasBody() { + return false; + } + + public org.rascalmpl.ast.Statement getBody() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasElseStatement() { + return false; + } + + public org.rascalmpl.ast.Statement getElseStatement() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasFinallyBody() { + return false; + } + + public org.rascalmpl.ast.Statement getFinallyBody() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasStatement() { + return false; + } + + public org.rascalmpl.ast.Statement getStatement() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasThenStatement() { + return false; + } + + public org.rascalmpl.ast.Statement getThenStatement() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasTarget() { + return false; + } + + public org.rascalmpl.ast.Target getTarget() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasType() { + return false; + } + + public org.rascalmpl.ast.Type getType() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasVisit() { + return false; + } + + public org.rascalmpl.ast.Visit getVisit() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isAppend() { + return false; + } + + static public class Append extends Statement { + // Production: sig("Append",[arg("org.rascalmpl.ast.DataTarget","dataTarget"),arg("org.rascalmpl.ast.Statement","statement")],breakable=true) + + + private final org.rascalmpl.ast.DataTarget dataTarget; + private final org.rascalmpl.ast.Statement statement; + + public Append(ISourceLocation src, IConstructor node , org.rascalmpl.ast.DataTarget dataTarget, org.rascalmpl.ast.Statement statement) { + super(src, node); + + this.dataTarget = dataTarget; + this.statement = statement; + } + + @Override + public boolean isAppend() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStatementAppend(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = dataTarget.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + dataTarget.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = statement.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + statement.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Append)) { + return false; + } + Append tmp = (Append) o; + return true && tmp.dataTarget.equals(this.dataTarget) && tmp.statement.equals(this.statement) ; + } + + @Override + public int hashCode() { + return 19 + 787 * dataTarget.hashCode() + 457 * statement.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.DataTarget getDataTarget() { + return this.dataTarget; + } + + @Override + public boolean hasDataTarget() { + return true; + } + @Override + public org.rascalmpl.ast.Statement getStatement() { + return this.statement; + } + + @Override + public boolean hasStatement() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(dataTarget), clone(statement)); + } + @Override + public boolean isBreakable() { + return true; + } + } + public boolean isAssert() { + return false; + } + + static public class Assert extends Statement { + // Production: sig("Assert",[arg("org.rascalmpl.ast.Expression","expression")],breakable=true) + + + private final org.rascalmpl.ast.Expression expression; + + public Assert(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression expression) { + super(src, node); + + this.expression = expression; + } + + @Override + public boolean isAssert() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStatementAssert(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Assert)) { + return false; + } + Assert tmp = (Assert) o; + return true && tmp.expression.equals(this.expression) ; + } + + @Override + public int hashCode() { + return 283 + 739 * expression.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(expression)); + } + @Override + public boolean isBreakable() { + return true; + } + } + public boolean isAssertWithMessage() { + return false; + } + + static public class AssertWithMessage extends Statement { + // Production: sig("AssertWithMessage",[arg("org.rascalmpl.ast.Expression","expression"),arg("org.rascalmpl.ast.Expression","message")],breakable=true) + + + private final org.rascalmpl.ast.Expression expression; + private final org.rascalmpl.ast.Expression message; + + public AssertWithMessage(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression expression, org.rascalmpl.ast.Expression message) { + super(src, node); + + this.expression = expression; + this.message = message; + } + + @Override + public boolean isAssertWithMessage() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStatementAssertWithMessage(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = message.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + message.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof AssertWithMessage)) { + return false; + } + AssertWithMessage tmp = (AssertWithMessage) o; + return true && tmp.expression.equals(this.expression) && tmp.message.equals(this.message) ; + } + + @Override + public int hashCode() { + return 547 + 97 * expression.hashCode() + 607 * message.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getMessage() { + return this.message; + } + + @Override + public boolean hasMessage() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(expression), clone(message)); + } + @Override + public boolean isBreakable() { + return true; + } + } + public boolean isAssignment() { + return false; + } + + static public class Assignment extends Statement { + // Production: sig("Assignment",[arg("org.rascalmpl.ast.Assignable","assignable"),arg("org.rascalmpl.ast.Assignment","operator"),arg("org.rascalmpl.ast.Statement","statement")],breakable=true) + + + private final org.rascalmpl.ast.Assignable assignable; + private final org.rascalmpl.ast.Assignment operator; + private final org.rascalmpl.ast.Statement statement; + + public Assignment(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Assignable assignable, org.rascalmpl.ast.Assignment operator, org.rascalmpl.ast.Statement statement) { + super(src, node); + + this.assignable = assignable; + this.operator = operator; + this.statement = statement; + } + + @Override + public boolean isAssignment() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStatementAssignment(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = assignable.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + assignable.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = operator.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + operator.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = statement.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + statement.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Assignment)) { + return false; + } + Assignment tmp = (Assignment) o; + return true && tmp.assignable.equals(this.assignable) && tmp.operator.equals(this.operator) && tmp.statement.equals(this.statement) ; + } + + @Override + public int hashCode() { + return 73 + 677 * assignable.hashCode() + 89 * operator.hashCode() + 599 * statement.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Assignable getAssignable() { + return this.assignable; + } + + @Override + public boolean hasAssignable() { + return true; + } + @Override + public org.rascalmpl.ast.Assignment getOperator() { + return this.operator; + } + + @Override + public boolean hasOperator() { + return true; + } + @Override + public org.rascalmpl.ast.Statement getStatement() { + return this.statement; + } + + @Override + public boolean hasStatement() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(assignable), clone(operator), clone(statement)); + } + @Override + public boolean isBreakable() { + return true; + } + } + public boolean isBreak() { + return false; + } + + static public class Break extends Statement { + // Production: sig("Break",[arg("org.rascalmpl.ast.Target","target")],breakable=true) + + + private final org.rascalmpl.ast.Target target; + + public Break(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Target target) { + super(src, node); + + this.target = target; + } + + @Override + public boolean isBreak() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStatementBreak(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = target.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + target.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Break)) { + return false; + } + Break tmp = (Break) o; + return true && tmp.target.equals(this.target) ; + } + + @Override + public int hashCode() { + return 3 + 757 * target.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Target getTarget() { + return this.target; + } + + @Override + public boolean hasTarget() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(target)); + } + @Override + public boolean isBreakable() { + return true; + } + } + public boolean isContinue() { + return false; + } + + static public class Continue extends Statement { + // Production: sig("Continue",[arg("org.rascalmpl.ast.Target","target")],breakable=true) + + + private final org.rascalmpl.ast.Target target; + + public Continue(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Target target) { + super(src, node); + + this.target = target; + } + + @Override + public boolean isContinue() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStatementContinue(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = target.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + target.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Continue)) { + return false; + } + Continue tmp = (Continue) o; + return true && tmp.target.equals(this.target) ; + } + + @Override + public int hashCode() { + return 193 + 881 * target.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Target getTarget() { + return this.target; + } + + @Override + public boolean hasTarget() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(target)); + } + @Override + public boolean isBreakable() { + return true; + } + } + public boolean isDoWhile() { + return false; + } + + static public class DoWhile extends Statement { + // Production: sig("DoWhile",[arg("org.rascalmpl.ast.Label","label"),arg("org.rascalmpl.ast.Statement","body"),arg("org.rascalmpl.ast.Expression","condition")],breakable=true) + + + private final org.rascalmpl.ast.Label label; + private final org.rascalmpl.ast.Statement body; + private final org.rascalmpl.ast.Expression condition; + + public DoWhile(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Label label, org.rascalmpl.ast.Statement body, org.rascalmpl.ast.Expression condition) { + super(src, node); + + this.label = label; + this.body = body; + this.condition = condition; + } + + @Override + public boolean isDoWhile() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStatementDoWhile(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = label.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + label.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = body.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + body.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = condition.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + condition.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof DoWhile)) { + return false; + } + DoWhile tmp = (DoWhile) o; + return true && tmp.label.equals(this.label) && tmp.body.equals(this.body) && tmp.condition.equals(this.condition) ; + } + + @Override + public int hashCode() { + return 823 + 859 * label.hashCode() + 181 * body.hashCode() + 677 * condition.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Label getLabel() { + return this.label; + } + + @Override + public boolean hasLabel() { + return true; + } + @Override + public org.rascalmpl.ast.Statement getBody() { + return this.body; + } + + @Override + public boolean hasBody() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getCondition() { + return this.condition; + } + + @Override + public boolean hasCondition() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(label), clone(body), clone(condition)); + } + @Override + public boolean isBreakable() { + return true; + } + } + public boolean isEmptyStatement() { + return false; + } + + static public class EmptyStatement extends Statement { + // Production: sig("EmptyStatement",[],breakable=false) + + + + public EmptyStatement(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isEmptyStatement() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStatementEmptyStatement(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof EmptyStatement)) { + return false; + } + EmptyStatement tmp = (EmptyStatement) o; + return true ; + } + + @Override + public int hashCode() { + return 433 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isExpression() { + return false; + } + + static public class Expression extends Statement { + // Production: sig("Expression",[arg("org.rascalmpl.ast.Expression","expression")],breakable=true) + + + private final org.rascalmpl.ast.Expression expression; + + public Expression(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression expression) { + super(src, node); + + this.expression = expression; + } + + @Override + public boolean isExpression() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStatementExpression(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Expression)) { + return false; + } + Expression tmp = (Expression) o; + return true && tmp.expression.equals(this.expression) ; + } + + @Override + public int hashCode() { + return 67 + 757 * expression.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(expression)); + } + @Override + public boolean isBreakable() { + return !this.expression.isCallOrTree(); + } + } + public boolean isFail() { + return false; + } + + static public class Fail extends Statement { + // Production: sig("Fail",[arg("org.rascalmpl.ast.Target","target")],breakable=true) + + + private final org.rascalmpl.ast.Target target; + + public Fail(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Target target) { + super(src, node); + + this.target = target; + } + + @Override + public boolean isFail() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStatementFail(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = target.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + target.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Fail)) { + return false; + } + Fail tmp = (Fail) o; + return true && tmp.target.equals(this.target) ; + } + + @Override + public int hashCode() { + return 479 + 691 * target.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Target getTarget() { + return this.target; + } + + @Override + public boolean hasTarget() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(target)); + } + @Override + public boolean isBreakable() { + return true; + } + } + public boolean isFilter() { + return false; + } + + static public class Filter extends Statement { + // Production: sig("Filter",[],breakable=true) + + + + public Filter(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isFilter() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStatementFilter(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Filter)) { + return false; + } + Filter tmp = (Filter) o; + return true ; + } + + @Override + public int hashCode() { + return 193 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + @Override + public boolean isBreakable() { + return true; + } + } + public boolean isFor() { + return false; + } + + static public class For extends Statement { + // Production: sig("For",[arg("org.rascalmpl.ast.Label","label"),arg("java.util.List\","generators"),arg("org.rascalmpl.ast.Statement","body")],breakable=true) + + + private final org.rascalmpl.ast.Label label; + private final java.util.List generators; + private final org.rascalmpl.ast.Statement body; + + public For(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Label label, java.util.List generators, org.rascalmpl.ast.Statement body) { + super(src, node); + + this.label = label; + this.generators = generators; + this.body = body; + } + + @Override + public boolean isFor() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStatementFor(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = label.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + label.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : generators) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + $l = body.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + body.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof For)) { + return false; + } + For tmp = (For) o; + return true && tmp.label.equals(this.label) && tmp.generators.equals(this.generators) && tmp.body.equals(this.body) ; + } + + @Override + public int hashCode() { + return 113 + 607 * label.hashCode() + 151 * generators.hashCode() + 409 * body.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Label getLabel() { + return this.label; + } + + @Override + public boolean hasLabel() { + return true; + } + @Override + public java.util.List getGenerators() { + return this.generators; + } + + @Override + public boolean hasGenerators() { + return true; + } + @Override + public org.rascalmpl.ast.Statement getBody() { + return this.body; + } + + @Override + public boolean hasBody() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(label), clone(generators), clone(body)); + } + @Override + public boolean isBreakable() { + return true; + } + } + public boolean isFunctionDeclaration() { + return false; + } + + static public class FunctionDeclaration extends Statement { + // Production: sig("FunctionDeclaration",[arg("org.rascalmpl.ast.FunctionDeclaration","functionDeclaration")],breakable=true) + + + private final org.rascalmpl.ast.FunctionDeclaration functionDeclaration; + + public FunctionDeclaration(ISourceLocation src, IConstructor node , org.rascalmpl.ast.FunctionDeclaration functionDeclaration) { + super(src, node); + + this.functionDeclaration = functionDeclaration; + } + + @Override + public boolean isFunctionDeclaration() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStatementFunctionDeclaration(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = functionDeclaration.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + functionDeclaration.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof FunctionDeclaration)) { + return false; + } + FunctionDeclaration tmp = (FunctionDeclaration) o; + return true && tmp.functionDeclaration.equals(this.functionDeclaration) ; + } + + @Override + public int hashCode() { + return 691 + 691 * functionDeclaration.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.FunctionDeclaration getFunctionDeclaration() { + return this.functionDeclaration; + } + + @Override + public boolean hasFunctionDeclaration() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(functionDeclaration)); + } + @Override + public boolean isBreakable() { + return true; + } + } + public boolean isGlobalDirective() { + return false; + } + + static public class GlobalDirective extends Statement { + // Production: sig("GlobalDirective",[arg("org.rascalmpl.ast.Type","type"),arg("java.util.List\","names")],breakable=true) + + + private final org.rascalmpl.ast.Type type; + private final java.util.List names; + + public GlobalDirective(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Type type, java.util.List names) { + super(src, node); + + this.type = type; + this.names = names; + } + + @Override + public boolean isGlobalDirective() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStatementGlobalDirective(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = type.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + type.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : names) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof GlobalDirective)) { + return false; + } + GlobalDirective tmp = (GlobalDirective) o; + return true && tmp.type.equals(this.type) && tmp.names.equals(this.names) ; + } + + @Override + public int hashCode() { + return 73 + 457 * type.hashCode() + 719 * names.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Type getType() { + return this.type; + } + + @Override + public boolean hasType() { + return true; + } + @Override + public java.util.List getNames() { + return this.names; + } + + @Override + public boolean hasNames() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(type), clone(names)); + } + @Override + public boolean isBreakable() { + return true; + } + } + public boolean isIfThen() { + return false; + } + + static public class IfThen extends Statement { + // Production: sig("IfThen",[arg("org.rascalmpl.ast.Label","label"),arg("java.util.List\","conditions"),arg("org.rascalmpl.ast.Statement","thenStatement")],breakable=true) + + + private final org.rascalmpl.ast.Label label; + private final java.util.List conditions; + private final org.rascalmpl.ast.Statement thenStatement; + + public IfThen(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Label label, java.util.List conditions, org.rascalmpl.ast.Statement thenStatement) { + super(src, node); + + this.label = label; + this.conditions = conditions; + this.thenStatement = thenStatement; + } + + @Override + public boolean isIfThen() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStatementIfThen(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = label.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + label.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : conditions) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + $l = thenStatement.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + thenStatement.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof IfThen)) { + return false; + } + IfThen tmp = (IfThen) o; + return true && tmp.label.equals(this.label) && tmp.conditions.equals(this.conditions) && tmp.thenStatement.equals(this.thenStatement) ; + } + + @Override + public int hashCode() { + return 461 + 929 * label.hashCode() + 199 * conditions.hashCode() + 569 * thenStatement.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Label getLabel() { + return this.label; + } + + @Override + public boolean hasLabel() { + return true; + } + @Override + public java.util.List getConditions() { + return this.conditions; + } + + @Override + public boolean hasConditions() { + return true; + } + @Override + public org.rascalmpl.ast.Statement getThenStatement() { + return this.thenStatement; + } + + @Override + public boolean hasThenStatement() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(label), clone(conditions), clone(thenStatement)); + } + @Override + public boolean isBreakable() { + return true; + } + } + public boolean isIfThenElse() { + return false; + } + + static public class IfThenElse extends Statement { + // Production: sig("IfThenElse",[arg("org.rascalmpl.ast.Label","label"),arg("java.util.List\","conditions"),arg("org.rascalmpl.ast.Statement","thenStatement"),arg("org.rascalmpl.ast.Statement","elseStatement")],breakable=true) + + + private final org.rascalmpl.ast.Label label; + private final java.util.List conditions; + private final org.rascalmpl.ast.Statement thenStatement; + private final org.rascalmpl.ast.Statement elseStatement; + + public IfThenElse(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Label label, java.util.List conditions, org.rascalmpl.ast.Statement thenStatement, org.rascalmpl.ast.Statement elseStatement) { + super(src, node); + + this.label = label; + this.conditions = conditions; + this.thenStatement = thenStatement; + this.elseStatement = elseStatement; + } + + @Override + public boolean isIfThenElse() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStatementIfThenElse(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = label.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + label.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : conditions) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + $l = thenStatement.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + thenStatement.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = elseStatement.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + elseStatement.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof IfThenElse)) { + return false; + } + IfThenElse tmp = (IfThenElse) o; + return true && tmp.label.equals(this.label) && tmp.conditions.equals(this.conditions) && tmp.thenStatement.equals(this.thenStatement) && tmp.elseStatement.equals(this.elseStatement) ; + } + + @Override + public int hashCode() { + return 149 + 569 * label.hashCode() + 617 * conditions.hashCode() + 389 * thenStatement.hashCode() + 757 * elseStatement.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Label getLabel() { + return this.label; + } + + @Override + public boolean hasLabel() { + return true; + } + @Override + public java.util.List getConditions() { + return this.conditions; + } + + @Override + public boolean hasConditions() { + return true; + } + @Override + public org.rascalmpl.ast.Statement getThenStatement() { + return this.thenStatement; + } + + @Override + public boolean hasThenStatement() { + return true; + } + @Override + public org.rascalmpl.ast.Statement getElseStatement() { + return this.elseStatement; + } + + @Override + public boolean hasElseStatement() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(label), clone(conditions), clone(thenStatement), clone(elseStatement)); + } + @Override + public boolean isBreakable() { + return true; + } + } + public boolean isInsert() { + return false; + } + + static public class Insert extends Statement { + // Production: sig("Insert",[arg("org.rascalmpl.ast.DataTarget","dataTarget"),arg("org.rascalmpl.ast.Statement","statement")],breakable=true) + + + private final org.rascalmpl.ast.DataTarget dataTarget; + private final org.rascalmpl.ast.Statement statement; + + public Insert(ISourceLocation src, IConstructor node , org.rascalmpl.ast.DataTarget dataTarget, org.rascalmpl.ast.Statement statement) { + super(src, node); + + this.dataTarget = dataTarget; + this.statement = statement; + } + + @Override + public boolean isInsert() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStatementInsert(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = dataTarget.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + dataTarget.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = statement.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + statement.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Insert)) { + return false; + } + Insert tmp = (Insert) o; + return true && tmp.dataTarget.equals(this.dataTarget) && tmp.statement.equals(this.statement) ; + } + + @Override + public int hashCode() { + return 757 + 439 * dataTarget.hashCode() + 239 * statement.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.DataTarget getDataTarget() { + return this.dataTarget; + } + + @Override + public boolean hasDataTarget() { + return true; + } + @Override + public org.rascalmpl.ast.Statement getStatement() { + return this.statement; + } + + @Override + public boolean hasStatement() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(dataTarget), clone(statement)); + } + @Override + public boolean isBreakable() { + return true; + } + } + public boolean isNonEmptyBlock() { + return false; + } + + static public class NonEmptyBlock extends Statement { + // Production: sig("NonEmptyBlock",[arg("org.rascalmpl.ast.Label","label"),arg("java.util.List\","statements")],breakable=false) + + + private final org.rascalmpl.ast.Label label; + private final java.util.List statements; + + public NonEmptyBlock(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Label label, java.util.List statements) { + super(src, node); + + this.label = label; + this.statements = statements; + } + + @Override + public boolean isNonEmptyBlock() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStatementNonEmptyBlock(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = label.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + label.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : statements) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof NonEmptyBlock)) { + return false; + } + NonEmptyBlock tmp = (NonEmptyBlock) o; + return true && tmp.label.equals(this.label) && tmp.statements.equals(this.statements) ; + } + + @Override + public int hashCode() { + return 641 + 227 * label.hashCode() + 269 * statements.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Label getLabel() { + return this.label; + } + + @Override + public boolean hasLabel() { + return true; + } + @Override + public java.util.List getStatements() { + return this.statements; + } + + @Override + public boolean hasStatements() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(label), clone(statements)); + } + + } + public boolean isReturn() { + return false; + } + + static public class Return extends Statement { + // Production: sig("Return",[arg("org.rascalmpl.ast.Statement","statement")],breakable=true) + + + private final org.rascalmpl.ast.Statement statement; + + public Return(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Statement statement) { + super(src, node); + + this.statement = statement; + } + + @Override + public boolean isReturn() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStatementReturn(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = statement.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + statement.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Return)) { + return false; + } + Return tmp = (Return) o; + return true && tmp.statement.equals(this.statement) ; + } + + @Override + public int hashCode() { + return 389 + 367 * statement.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Statement getStatement() { + return this.statement; + } + + @Override + public boolean hasStatement() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(statement)); + } + @Override + public boolean isBreakable() { + return true; + } + } + public boolean isSolve() { + return false; + } + + static public class Solve extends Statement { + // Production: sig("Solve",[arg("java.util.List\","variables"),arg("org.rascalmpl.ast.Bound","bound"),arg("org.rascalmpl.ast.Statement","body")],breakable=true) + + + private final java.util.List variables; + private final org.rascalmpl.ast.Bound bound; + private final org.rascalmpl.ast.Statement body; + + public Solve(ISourceLocation src, IConstructor node , java.util.List variables, org.rascalmpl.ast.Bound bound, org.rascalmpl.ast.Statement body) { + super(src, node); + + this.variables = variables; + this.bound = bound; + this.body = body; + } + + @Override + public boolean isSolve() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStatementSolve(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : variables) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + $l = bound.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + bound.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = body.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + body.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Solve)) { + return false; + } + Solve tmp = (Solve) o; + return true && tmp.variables.equals(this.variables) && tmp.bound.equals(this.bound) && tmp.body.equals(this.body) ; + } + + @Override + public int hashCode() { + return 643 + 619 * variables.hashCode() + 631 * bound.hashCode() + 151 * body.hashCode() ; + } + + + @Override + public java.util.List getVariables() { + return this.variables; + } + + @Override + public boolean hasVariables() { + return true; + } + @Override + public org.rascalmpl.ast.Bound getBound() { + return this.bound; + } + + @Override + public boolean hasBound() { + return true; + } + @Override + public org.rascalmpl.ast.Statement getBody() { + return this.body; + } + + @Override + public boolean hasBody() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(variables), clone(bound), clone(body)); + } + @Override + public boolean isBreakable() { + return true; + } + } + public boolean isSwitch() { + return false; + } + + static public class Switch extends Statement { + // Production: sig("Switch",[arg("org.rascalmpl.ast.Label","label"),arg("org.rascalmpl.ast.Expression","expression"),arg("java.util.List\","cases")],breakable=true) + + + private final org.rascalmpl.ast.Label label; + private final org.rascalmpl.ast.Expression expression; + private final java.util.List cases; + + public Switch(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Label label, org.rascalmpl.ast.Expression expression, java.util.List cases) { + super(src, node); + + this.label = label; + this.expression = expression; + this.cases = cases; + } + + @Override + public boolean isSwitch() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStatementSwitch(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = label.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + label.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : cases) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Switch)) { + return false; + } + Switch tmp = (Switch) o; + return true && tmp.label.equals(this.label) && tmp.expression.equals(this.expression) && tmp.cases.equals(this.cases) ; + } + + @Override + public int hashCode() { + return 593 + 109 * label.hashCode() + 53 * expression.hashCode() + 839 * cases.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Label getLabel() { + return this.label; + } + + @Override + public boolean hasLabel() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + @Override + public java.util.List getCases() { + return this.cases; + } + + @Override + public boolean hasCases() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(label), clone(expression), clone(cases)); + } + @Override + public boolean isBreakable() { + return true; + } + } + public boolean isThrow() { + return false; + } + + static public class Throw extends Statement { + // Production: sig("Throw",[arg("org.rascalmpl.ast.Statement","statement")],breakable=true) + + + private final org.rascalmpl.ast.Statement statement; + + public Throw(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Statement statement) { + super(src, node); + + this.statement = statement; + } + + @Override + public boolean isThrow() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStatementThrow(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = statement.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + statement.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Throw)) { + return false; + } + Throw tmp = (Throw) o; + return true && tmp.statement.equals(this.statement) ; + } + + @Override + public int hashCode() { + return 389 + 229 * statement.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Statement getStatement() { + return this.statement; + } + + @Override + public boolean hasStatement() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(statement)); + } + @Override + public boolean isBreakable() { + return true; + } + } + public boolean isTry() { + return false; + } + + static public class Try extends Statement { + // Production: sig("Try",[arg("org.rascalmpl.ast.Statement","body"),arg("java.util.List\","handlers")],breakable=true) + + + private final org.rascalmpl.ast.Statement body; + private final java.util.List handlers; + + public Try(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Statement body, java.util.List handlers) { + super(src, node); + + this.body = body; + this.handlers = handlers; + } + + @Override + public boolean isTry() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStatementTry(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = body.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + body.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : handlers) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Try)) { + return false; + } + Try tmp = (Try) o; + return true && tmp.body.equals(this.body) && tmp.handlers.equals(this.handlers) ; + } + + @Override + public int hashCode() { + return 157 + 283 * body.hashCode() + 947 * handlers.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Statement getBody() { + return this.body; + } + + @Override + public boolean hasBody() { + return true; + } + @Override + public java.util.List getHandlers() { + return this.handlers; + } + + @Override + public boolean hasHandlers() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(body), clone(handlers)); + } + @Override + public boolean isBreakable() { + return true; + } + } + public boolean isTryFinally() { + return false; + } + + static public class TryFinally extends Statement { + // Production: sig("TryFinally",[arg("org.rascalmpl.ast.Statement","body"),arg("java.util.List\","handlers"),arg("org.rascalmpl.ast.Statement","finallyBody")],breakable=true) + + + private final org.rascalmpl.ast.Statement body; + private final java.util.List handlers; + private final org.rascalmpl.ast.Statement finallyBody; + + public TryFinally(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Statement body, java.util.List handlers, org.rascalmpl.ast.Statement finallyBody) { + super(src, node); + + this.body = body; + this.handlers = handlers; + this.finallyBody = finallyBody; + } + + @Override + public boolean isTryFinally() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStatementTryFinally(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = body.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + body.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : handlers) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + $l = finallyBody.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + finallyBody.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof TryFinally)) { + return false; + } + TryFinally tmp = (TryFinally) o; + return true && tmp.body.equals(this.body) && tmp.handlers.equals(this.handlers) && tmp.finallyBody.equals(this.finallyBody) ; + } + + @Override + public int hashCode() { + return 541 + 103 * body.hashCode() + 619 * handlers.hashCode() + 421 * finallyBody.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Statement getBody() { + return this.body; + } + + @Override + public boolean hasBody() { + return true; + } + @Override + public java.util.List getHandlers() { + return this.handlers; + } + + @Override + public boolean hasHandlers() { + return true; + } + @Override + public org.rascalmpl.ast.Statement getFinallyBody() { + return this.finallyBody; + } + + @Override + public boolean hasFinallyBody() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(body), clone(handlers), clone(finallyBody)); + } + @Override + public boolean isBreakable() { + return true; + } + } + public boolean isVariableDeclaration() { + return false; + } + + static public class VariableDeclaration extends Statement { + // Production: sig("VariableDeclaration",[arg("org.rascalmpl.ast.LocalVariableDeclaration","declaration")],breakable=true) + + + private final org.rascalmpl.ast.LocalVariableDeclaration declaration; + + public VariableDeclaration(ISourceLocation src, IConstructor node , org.rascalmpl.ast.LocalVariableDeclaration declaration) { + super(src, node); + + this.declaration = declaration; + } + + @Override + public boolean isVariableDeclaration() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStatementVariableDeclaration(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = declaration.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + declaration.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof VariableDeclaration)) { + return false; + } + VariableDeclaration tmp = (VariableDeclaration) o; + return true && tmp.declaration.equals(this.declaration) ; + } + + @Override + public int hashCode() { + return 541 + 509 * declaration.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.LocalVariableDeclaration getDeclaration() { + return this.declaration; + } + + @Override + public boolean hasDeclaration() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(declaration)); + } + @Override + public boolean isBreakable() { + return true; + } + } + public boolean isVisit() { + return false; + } + + static public class Visit extends Statement { + // Production: sig("Visit",[arg("org.rascalmpl.ast.Label","label"),arg("org.rascalmpl.ast.Visit","visit")],breakable=true) + + + private final org.rascalmpl.ast.Label label; + private final org.rascalmpl.ast.Visit visit; + + public Visit(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Label label, org.rascalmpl.ast.Visit visit) { + super(src, node); + + this.label = label; + this.visit = visit; + } + + @Override + public boolean isVisit() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStatementVisit(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = label.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + label.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = visit.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + visit.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Visit)) { + return false; + } + Visit tmp = (Visit) o; + return true && tmp.label.equals(this.label) && tmp.visit.equals(this.visit) ; + } + + @Override + public int hashCode() { + return 941 + 653 * label.hashCode() + 13 * visit.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Label getLabel() { + return this.label; + } + + @Override + public boolean hasLabel() { + return true; + } + @Override + public org.rascalmpl.ast.Visit getVisit() { + return this.visit; + } + + @Override + public boolean hasVisit() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(label), clone(visit)); + } + @Override + public boolean isBreakable() { + return true; + } + } + public boolean isWhile() { + return false; + } + + static public class While extends Statement { + // Production: sig("While",[arg("org.rascalmpl.ast.Label","label"),arg("java.util.List\","conditions"),arg("org.rascalmpl.ast.Statement","body")],breakable=true) + + + private final org.rascalmpl.ast.Label label; + private final java.util.List conditions; + private final org.rascalmpl.ast.Statement body; + + public While(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Label label, java.util.List conditions, org.rascalmpl.ast.Statement body) { + super(src, node); + + this.label = label; + this.conditions = conditions; + this.body = body; + } + + @Override + public boolean isWhile() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStatementWhile(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = label.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + label.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : conditions) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + $l = body.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + body.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof While)) { + return false; + } + While tmp = (While) o; + return true && tmp.label.equals(this.label) && tmp.conditions.equals(this.conditions) && tmp.body.equals(this.body) ; + } + + @Override + public int hashCode() { + return 787 + 37 * label.hashCode() + 131 * conditions.hashCode() + 331 * body.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Label getLabel() { + return this.label; + } + + @Override + public boolean hasLabel() { + return true; + } + @Override + public java.util.List getConditions() { + return this.conditions; + } + + @Override + public boolean hasConditions() { + return true; + } + @Override + public org.rascalmpl.ast.Statement getBody() { + return this.body; + } + + @Override + public boolean hasBody() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(label), clone(conditions), clone(body)); + } + @Override + public boolean isBreakable() { + return true; + } + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Strategy.java b/src/org/rascalmpl/ast/Strategy.java new file mode 100644 index 00000000000..dfacf4f726b --- /dev/null +++ b/src/org/rascalmpl/ast/Strategy.java @@ -0,0 +1,363 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Strategy extends AbstractAST { + public Strategy(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + + + + public boolean isBottomUp() { + return false; + } + + static public class BottomUp extends Strategy { + // Production: sig("BottomUp",[],breakable=false) + + + + public BottomUp(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isBottomUp() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStrategyBottomUp(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof BottomUp)) { + return false; + } + BottomUp tmp = (BottomUp) o; + return true ; + } + + @Override + public int hashCode() { + return 521 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isBottomUpBreak() { + return false; + } + + static public class BottomUpBreak extends Strategy { + // Production: sig("BottomUpBreak",[],breakable=false) + + + + public BottomUpBreak(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isBottomUpBreak() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStrategyBottomUpBreak(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof BottomUpBreak)) { + return false; + } + BottomUpBreak tmp = (BottomUpBreak) o; + return true ; + } + + @Override + public int hashCode() { + return 839 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isInnermost() { + return false; + } + + static public class Innermost extends Strategy { + // Production: sig("Innermost",[],breakable=false) + + + + public Innermost(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isInnermost() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStrategyInnermost(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Innermost)) { + return false; + } + Innermost tmp = (Innermost) o; + return true ; + } + + @Override + public int hashCode() { + return 191 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isOutermost() { + return false; + } + + static public class Outermost extends Strategy { + // Production: sig("Outermost",[],breakable=false) + + + + public Outermost(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isOutermost() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStrategyOutermost(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Outermost)) { + return false; + } + Outermost tmp = (Outermost) o; + return true ; + } + + @Override + public int hashCode() { + return 599 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isTopDown() { + return false; + } + + static public class TopDown extends Strategy { + // Production: sig("TopDown",[],breakable=false) + + + + public TopDown(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isTopDown() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStrategyTopDown(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof TopDown)) { + return false; + } + TopDown tmp = (TopDown) o; + return true ; + } + + @Override + public int hashCode() { + return 109 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isTopDownBreak() { + return false; + } + + static public class TopDownBreak extends Strategy { + // Production: sig("TopDownBreak",[],breakable=false) + + + + public TopDownBreak(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isTopDownBreak() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStrategyTopDownBreak(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof TopDownBreak)) { + return false; + } + TopDownBreak tmp = (TopDownBreak) o; + return true ; + } + + @Override + public int hashCode() { + return 977 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/StringCharacter.java b/src/org/rascalmpl/ast/StringCharacter.java new file mode 100644 index 00000000000..710fa8f7501 --- /dev/null +++ b/src/org/rascalmpl/ast/StringCharacter.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class StringCharacter extends AbstractAST { + public StringCharacter(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends StringCharacter { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitStringCharacterLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/StringConstant.java b/src/org/rascalmpl/ast/StringConstant.java new file mode 100644 index 00000000000..d4ac3288e17 --- /dev/null +++ b/src/org/rascalmpl/ast/StringConstant.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class StringConstant extends AbstractAST { + public StringConstant(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends StringConstant { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitStringConstantLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/StringLiteral.java b/src/org/rascalmpl/ast/StringLiteral.java new file mode 100644 index 00000000000..f03b46e78fc --- /dev/null +++ b/src/org/rascalmpl/ast/StringLiteral.java @@ -0,0 +1,366 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class StringLiteral extends AbstractAST { + public StringLiteral(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasExpression() { + return false; + } + + public org.rascalmpl.ast.Expression getExpression() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasPre() { + return false; + } + + public org.rascalmpl.ast.PreStringChars getPre() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasConstant() { + return false; + } + + public org.rascalmpl.ast.StringConstant getConstant() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasTail() { + return false; + } + + public org.rascalmpl.ast.StringTail getTail() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasTemplate() { + return false; + } + + public org.rascalmpl.ast.StringTemplate getTemplate() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isInterpolated() { + return false; + } + + static public class Interpolated extends StringLiteral { + // Production: sig("Interpolated",[arg("org.rascalmpl.ast.PreStringChars","pre"),arg("org.rascalmpl.ast.Expression","expression"),arg("org.rascalmpl.ast.StringTail","tail")],breakable=false) + + + private final org.rascalmpl.ast.PreStringChars pre; + private final org.rascalmpl.ast.Expression expression; + private final org.rascalmpl.ast.StringTail tail; + + public Interpolated(ISourceLocation src, IConstructor node , org.rascalmpl.ast.PreStringChars pre, org.rascalmpl.ast.Expression expression, org.rascalmpl.ast.StringTail tail) { + super(src, node); + + this.pre = pre; + this.expression = expression; + this.tail = tail; + } + + @Override + public boolean isInterpolated() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStringLiteralInterpolated(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = pre.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + pre.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = tail.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + tail.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Interpolated)) { + return false; + } + Interpolated tmp = (Interpolated) o; + return true && tmp.pre.equals(this.pre) && tmp.expression.equals(this.expression) && tmp.tail.equals(this.tail) ; + } + + @Override + public int hashCode() { + return 2 + 947 * pre.hashCode() + 281 * expression.hashCode() + 409 * tail.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.PreStringChars getPre() { + return this.pre; + } + + @Override + public boolean hasPre() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + @Override + public org.rascalmpl.ast.StringTail getTail() { + return this.tail; + } + + @Override + public boolean hasTail() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(pre), clone(expression), clone(tail)); + } + + } + public boolean isNonInterpolated() { + return false; + } + + static public class NonInterpolated extends StringLiteral { + // Production: sig("NonInterpolated",[arg("org.rascalmpl.ast.StringConstant","constant")],breakable=false) + + + private final org.rascalmpl.ast.StringConstant constant; + + public NonInterpolated(ISourceLocation src, IConstructor node , org.rascalmpl.ast.StringConstant constant) { + super(src, node); + + this.constant = constant; + } + + @Override + public boolean isNonInterpolated() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStringLiteralNonInterpolated(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = constant.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + constant.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof NonInterpolated)) { + return false; + } + NonInterpolated tmp = (NonInterpolated) o; + return true && tmp.constant.equals(this.constant) ; + } + + @Override + public int hashCode() { + return 97 + 607 * constant.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.StringConstant getConstant() { + return this.constant; + } + + @Override + public boolean hasConstant() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(constant)); + } + + } + public boolean isTemplate() { + return false; + } + + static public class Template extends StringLiteral { + // Production: sig("Template",[arg("org.rascalmpl.ast.PreStringChars","pre"),arg("org.rascalmpl.ast.StringTemplate","template"),arg("org.rascalmpl.ast.StringTail","tail")],breakable=false) + + + private final org.rascalmpl.ast.PreStringChars pre; + private final org.rascalmpl.ast.StringTemplate template; + private final org.rascalmpl.ast.StringTail tail; + + public Template(ISourceLocation src, IConstructor node , org.rascalmpl.ast.PreStringChars pre, org.rascalmpl.ast.StringTemplate template, org.rascalmpl.ast.StringTail tail) { + super(src, node); + + this.pre = pre; + this.template = template; + this.tail = tail; + } + + @Override + public boolean isTemplate() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStringLiteralTemplate(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = pre.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + pre.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = template.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + template.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = tail.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + tail.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Template)) { + return false; + } + Template tmp = (Template) o; + return true && tmp.pre.equals(this.pre) && tmp.template.equals(this.template) && tmp.tail.equals(this.tail) ; + } + + @Override + public int hashCode() { + return 547 + 283 * pre.hashCode() + 757 * template.hashCode() + 347 * tail.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.PreStringChars getPre() { + return this.pre; + } + + @Override + public boolean hasPre() { + return true; + } + @Override + public org.rascalmpl.ast.StringTemplate getTemplate() { + return this.template; + } + + @Override + public boolean hasTemplate() { + return true; + } + @Override + public org.rascalmpl.ast.StringTail getTail() { + return this.tail; + } + + @Override + public boolean hasTail() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(pre), clone(template), clone(tail)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/StringMiddle.java b/src/org/rascalmpl/ast/StringMiddle.java new file mode 100644 index 00000000000..1044fd29bff --- /dev/null +++ b/src/org/rascalmpl/ast/StringMiddle.java @@ -0,0 +1,359 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class StringMiddle extends AbstractAST { + public StringMiddle(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasExpression() { + return false; + } + + public org.rascalmpl.ast.Expression getExpression() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasMid() { + return false; + } + + public org.rascalmpl.ast.MidStringChars getMid() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasTail() { + return false; + } + + public org.rascalmpl.ast.StringMiddle getTail() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasTemplate() { + return false; + } + + public org.rascalmpl.ast.StringTemplate getTemplate() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isInterpolated() { + return false; + } + + static public class Interpolated extends StringMiddle { + // Production: sig("Interpolated",[arg("org.rascalmpl.ast.MidStringChars","mid"),arg("org.rascalmpl.ast.Expression","expression"),arg("org.rascalmpl.ast.StringMiddle","tail")],breakable=false) + + + private final org.rascalmpl.ast.MidStringChars mid; + private final org.rascalmpl.ast.Expression expression; + private final org.rascalmpl.ast.StringMiddle tail; + + public Interpolated(ISourceLocation src, IConstructor node , org.rascalmpl.ast.MidStringChars mid, org.rascalmpl.ast.Expression expression, org.rascalmpl.ast.StringMiddle tail) { + super(src, node); + + this.mid = mid; + this.expression = expression; + this.tail = tail; + } + + @Override + public boolean isInterpolated() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStringMiddleInterpolated(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = mid.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + mid.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = tail.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + tail.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Interpolated)) { + return false; + } + Interpolated tmp = (Interpolated) o; + return true && tmp.mid.equals(this.mid) && tmp.expression.equals(this.expression) && tmp.tail.equals(this.tail) ; + } + + @Override + public int hashCode() { + return 73 + 181 * mid.hashCode() + 499 * expression.hashCode() + 227 * tail.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.MidStringChars getMid() { + return this.mid; + } + + @Override + public boolean hasMid() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + @Override + public org.rascalmpl.ast.StringMiddle getTail() { + return this.tail; + } + + @Override + public boolean hasTail() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(mid), clone(expression), clone(tail)); + } + + } + public boolean isMid() { + return false; + } + + static public class Mid extends StringMiddle { + // Production: sig("Mid",[arg("org.rascalmpl.ast.MidStringChars","mid")],breakable=false) + + + private final org.rascalmpl.ast.MidStringChars mid; + + public Mid(ISourceLocation src, IConstructor node , org.rascalmpl.ast.MidStringChars mid) { + super(src, node); + + this.mid = mid; + } + + @Override + public boolean isMid() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStringMiddleMid(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = mid.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + mid.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Mid)) { + return false; + } + Mid tmp = (Mid) o; + return true && tmp.mid.equals(this.mid) ; + } + + @Override + public int hashCode() { + return 389 + 479 * mid.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.MidStringChars getMid() { + return this.mid; + } + + @Override + public boolean hasMid() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(mid)); + } + + } + public boolean isTemplate() { + return false; + } + + static public class Template extends StringMiddle { + // Production: sig("Template",[arg("org.rascalmpl.ast.MidStringChars","mid"),arg("org.rascalmpl.ast.StringTemplate","template"),arg("org.rascalmpl.ast.StringMiddle","tail")],breakable=false) + + + private final org.rascalmpl.ast.MidStringChars mid; + private final org.rascalmpl.ast.StringTemplate template; + private final org.rascalmpl.ast.StringMiddle tail; + + public Template(ISourceLocation src, IConstructor node , org.rascalmpl.ast.MidStringChars mid, org.rascalmpl.ast.StringTemplate template, org.rascalmpl.ast.StringMiddle tail) { + super(src, node); + + this.mid = mid; + this.template = template; + this.tail = tail; + } + + @Override + public boolean isTemplate() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStringMiddleTemplate(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = mid.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + mid.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = template.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + template.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = tail.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + tail.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Template)) { + return false; + } + Template tmp = (Template) o; + return true && tmp.mid.equals(this.mid) && tmp.template.equals(this.template) && tmp.tail.equals(this.tail) ; + } + + @Override + public int hashCode() { + return 103 + 859 * mid.hashCode() + 163 * template.hashCode() + 739 * tail.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.MidStringChars getMid() { + return this.mid; + } + + @Override + public boolean hasMid() { + return true; + } + @Override + public org.rascalmpl.ast.StringTemplate getTemplate() { + return this.template; + } + + @Override + public boolean hasTemplate() { + return true; + } + @Override + public org.rascalmpl.ast.StringMiddle getTail() { + return this.tail; + } + + @Override + public boolean hasTail() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(mid), clone(template), clone(tail)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/StringTail.java b/src/org/rascalmpl/ast/StringTail.java new file mode 100644 index 00000000000..66e660ca0c5 --- /dev/null +++ b/src/org/rascalmpl/ast/StringTail.java @@ -0,0 +1,366 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class StringTail extends AbstractAST { + public StringTail(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasExpression() { + return false; + } + + public org.rascalmpl.ast.Expression getExpression() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasMid() { + return false; + } + + public org.rascalmpl.ast.MidStringChars getMid() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasPost() { + return false; + } + + public org.rascalmpl.ast.PostStringChars getPost() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasTail() { + return false; + } + + public org.rascalmpl.ast.StringTail getTail() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasTemplate() { + return false; + } + + public org.rascalmpl.ast.StringTemplate getTemplate() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isMidInterpolated() { + return false; + } + + static public class MidInterpolated extends StringTail { + // Production: sig("MidInterpolated",[arg("org.rascalmpl.ast.MidStringChars","mid"),arg("org.rascalmpl.ast.Expression","expression"),arg("org.rascalmpl.ast.StringTail","tail")],breakable=false) + + + private final org.rascalmpl.ast.MidStringChars mid; + private final org.rascalmpl.ast.Expression expression; + private final org.rascalmpl.ast.StringTail tail; + + public MidInterpolated(ISourceLocation src, IConstructor node , org.rascalmpl.ast.MidStringChars mid, org.rascalmpl.ast.Expression expression, org.rascalmpl.ast.StringTail tail) { + super(src, node); + + this.mid = mid; + this.expression = expression; + this.tail = tail; + } + + @Override + public boolean isMidInterpolated() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStringTailMidInterpolated(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = mid.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + mid.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = tail.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + tail.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof MidInterpolated)) { + return false; + } + MidInterpolated tmp = (MidInterpolated) o; + return true && tmp.mid.equals(this.mid) && tmp.expression.equals(this.expression) && tmp.tail.equals(this.tail) ; + } + + @Override + public int hashCode() { + return 821 + 977 * mid.hashCode() + 677 * expression.hashCode() + 11 * tail.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.MidStringChars getMid() { + return this.mid; + } + + @Override + public boolean hasMid() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + @Override + public org.rascalmpl.ast.StringTail getTail() { + return this.tail; + } + + @Override + public boolean hasTail() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(mid), clone(expression), clone(tail)); + } + + } + public boolean isMidTemplate() { + return false; + } + + static public class MidTemplate extends StringTail { + // Production: sig("MidTemplate",[arg("org.rascalmpl.ast.MidStringChars","mid"),arg("org.rascalmpl.ast.StringTemplate","template"),arg("org.rascalmpl.ast.StringTail","tail")],breakable=false) + + + private final org.rascalmpl.ast.MidStringChars mid; + private final org.rascalmpl.ast.StringTemplate template; + private final org.rascalmpl.ast.StringTail tail; + + public MidTemplate(ISourceLocation src, IConstructor node , org.rascalmpl.ast.MidStringChars mid, org.rascalmpl.ast.StringTemplate template, org.rascalmpl.ast.StringTail tail) { + super(src, node); + + this.mid = mid; + this.template = template; + this.tail = tail; + } + + @Override + public boolean isMidTemplate() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStringTailMidTemplate(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = mid.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + mid.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = template.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + template.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = tail.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + tail.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof MidTemplate)) { + return false; + } + MidTemplate tmp = (MidTemplate) o; + return true && tmp.mid.equals(this.mid) && tmp.template.equals(this.template) && tmp.tail.equals(this.tail) ; + } + + @Override + public int hashCode() { + return 691 + 71 * mid.hashCode() + 181 * template.hashCode() + 199 * tail.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.MidStringChars getMid() { + return this.mid; + } + + @Override + public boolean hasMid() { + return true; + } + @Override + public org.rascalmpl.ast.StringTemplate getTemplate() { + return this.template; + } + + @Override + public boolean hasTemplate() { + return true; + } + @Override + public org.rascalmpl.ast.StringTail getTail() { + return this.tail; + } + + @Override + public boolean hasTail() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(mid), clone(template), clone(tail)); + } + + } + public boolean isPost() { + return false; + } + + static public class Post extends StringTail { + // Production: sig("Post",[arg("org.rascalmpl.ast.PostStringChars","post")],breakable=false) + + + private final org.rascalmpl.ast.PostStringChars post; + + public Post(ISourceLocation src, IConstructor node , org.rascalmpl.ast.PostStringChars post) { + super(src, node); + + this.post = post; + } + + @Override + public boolean isPost() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStringTailPost(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = post.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + post.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Post)) { + return false; + } + Post tmp = (Post) o; + return true && tmp.post.equals(this.post) ; + } + + @Override + public int hashCode() { + return 787 + 193 * post.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.PostStringChars getPost() { + return this.post; + } + + @Override + public boolean hasPost() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(post)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/StringTemplate.java b/src/org/rascalmpl/ast/StringTemplate.java new file mode 100644 index 00000000000..fc0dfaf0606 --- /dev/null +++ b/src/org/rascalmpl/ast/StringTemplate.java @@ -0,0 +1,859 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class StringTemplate extends AbstractAST { + public StringTemplate(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasConditions() { + return false; + } + + public java.util.List getConditions() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasGenerators() { + return false; + } + + public java.util.List getGenerators() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasPostStats() { + return false; + } + + public java.util.List getPostStats() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasPostStatsElse() { + return false; + } + + public java.util.List getPostStatsElse() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasPostStatsThen() { + return false; + } + + public java.util.List getPostStatsThen() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasPreStats() { + return false; + } + + public java.util.List getPreStats() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasPreStatsElse() { + return false; + } + + public java.util.List getPreStatsElse() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasPreStatsThen() { + return false; + } + + public java.util.List getPreStatsThen() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasCondition() { + return false; + } + + public org.rascalmpl.ast.Expression getCondition() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasBody() { + return false; + } + + public org.rascalmpl.ast.StringMiddle getBody() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasElseString() { + return false; + } + + public org.rascalmpl.ast.StringMiddle getElseString() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasThenString() { + return false; + } + + public org.rascalmpl.ast.StringMiddle getThenString() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDoWhile() { + return false; + } + + static public class DoWhile extends StringTemplate { + // Production: sig("DoWhile",[arg("java.util.List\","preStats"),arg("org.rascalmpl.ast.StringMiddle","body"),arg("java.util.List\","postStats"),arg("org.rascalmpl.ast.Expression","condition")],breakable=false) + + + private final java.util.List preStats; + private final org.rascalmpl.ast.StringMiddle body; + private final java.util.List postStats; + private final org.rascalmpl.ast.Expression condition; + + public DoWhile(ISourceLocation src, IConstructor node , java.util.List preStats, org.rascalmpl.ast.StringMiddle body, java.util.List postStats, org.rascalmpl.ast.Expression condition) { + super(src, node); + + this.preStats = preStats; + this.body = body; + this.postStats = postStats; + this.condition = condition; + } + + @Override + public boolean isDoWhile() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStringTemplateDoWhile(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : preStats) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + $l = body.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + body.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : postStats) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + $l = condition.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + condition.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof DoWhile)) { + return false; + } + DoWhile tmp = (DoWhile) o; + return true && tmp.preStats.equals(this.preStats) && tmp.body.equals(this.body) && tmp.postStats.equals(this.postStats) && tmp.condition.equals(this.condition) ; + } + + @Override + public int hashCode() { + return 199 + 389 * preStats.hashCode() + 281 * body.hashCode() + 389 * postStats.hashCode() + 683 * condition.hashCode() ; + } + + + @Override + public java.util.List getPreStats() { + return this.preStats; + } + + @Override + public boolean hasPreStats() { + return true; + } + @Override + public org.rascalmpl.ast.StringMiddle getBody() { + return this.body; + } + + @Override + public boolean hasBody() { + return true; + } + @Override + public java.util.List getPostStats() { + return this.postStats; + } + + @Override + public boolean hasPostStats() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getCondition() { + return this.condition; + } + + @Override + public boolean hasCondition() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(preStats), clone(body), clone(postStats), clone(condition)); + } + + } + public boolean isFor() { + return false; + } + + static public class For extends StringTemplate { + // Production: sig("For",[arg("java.util.List\","generators"),arg("java.util.List\","preStats"),arg("org.rascalmpl.ast.StringMiddle","body"),arg("java.util.List\","postStats")],breakable=false) + + + private final java.util.List generators; + private final java.util.List preStats; + private final org.rascalmpl.ast.StringMiddle body; + private final java.util.List postStats; + + public For(ISourceLocation src, IConstructor node , java.util.List generators, java.util.List preStats, org.rascalmpl.ast.StringMiddle body, java.util.List postStats) { + super(src, node); + + this.generators = generators; + this.preStats = preStats; + this.body = body; + this.postStats = postStats; + } + + @Override + public boolean isFor() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStringTemplateFor(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : generators) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + for (AbstractAST $elem : preStats) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + $l = body.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + body.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : postStats) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof For)) { + return false; + } + For tmp = (For) o; + return true && tmp.generators.equals(this.generators) && tmp.preStats.equals(this.preStats) && tmp.body.equals(this.body) && tmp.postStats.equals(this.postStats) ; + } + + @Override + public int hashCode() { + return 577 + 653 * generators.hashCode() + 73 * preStats.hashCode() + 991 * body.hashCode() + 911 * postStats.hashCode() ; + } + + + @Override + public java.util.List getGenerators() { + return this.generators; + } + + @Override + public boolean hasGenerators() { + return true; + } + @Override + public java.util.List getPreStats() { + return this.preStats; + } + + @Override + public boolean hasPreStats() { + return true; + } + @Override + public org.rascalmpl.ast.StringMiddle getBody() { + return this.body; + } + + @Override + public boolean hasBody() { + return true; + } + @Override + public java.util.List getPostStats() { + return this.postStats; + } + + @Override + public boolean hasPostStats() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(generators), clone(preStats), clone(body), clone(postStats)); + } + + } + public boolean isIfThen() { + return false; + } + + static public class IfThen extends StringTemplate { + // Production: sig("IfThen",[arg("java.util.List\","conditions"),arg("java.util.List\","preStats"),arg("org.rascalmpl.ast.StringMiddle","body"),arg("java.util.List\","postStats")],breakable=false) + + + private final java.util.List conditions; + private final java.util.List preStats; + private final org.rascalmpl.ast.StringMiddle body; + private final java.util.List postStats; + + public IfThen(ISourceLocation src, IConstructor node , java.util.List conditions, java.util.List preStats, org.rascalmpl.ast.StringMiddle body, java.util.List postStats) { + super(src, node); + + this.conditions = conditions; + this.preStats = preStats; + this.body = body; + this.postStats = postStats; + } + + @Override + public boolean isIfThen() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStringTemplateIfThen(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : conditions) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + for (AbstractAST $elem : preStats) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + $l = body.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + body.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : postStats) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof IfThen)) { + return false; + } + IfThen tmp = (IfThen) o; + return true && tmp.conditions.equals(this.conditions) && tmp.preStats.equals(this.preStats) && tmp.body.equals(this.body) && tmp.postStats.equals(this.postStats) ; + } + + @Override + public int hashCode() { + return 379 + 811 * conditions.hashCode() + 373 * preStats.hashCode() + 83 * body.hashCode() + 71 * postStats.hashCode() ; + } + + + @Override + public java.util.List getConditions() { + return this.conditions; + } + + @Override + public boolean hasConditions() { + return true; + } + @Override + public java.util.List getPreStats() { + return this.preStats; + } + + @Override + public boolean hasPreStats() { + return true; + } + @Override + public org.rascalmpl.ast.StringMiddle getBody() { + return this.body; + } + + @Override + public boolean hasBody() { + return true; + } + @Override + public java.util.List getPostStats() { + return this.postStats; + } + + @Override + public boolean hasPostStats() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(conditions), clone(preStats), clone(body), clone(postStats)); + } + + } + public boolean isIfThenElse() { + return false; + } + + static public class IfThenElse extends StringTemplate { + // Production: sig("IfThenElse",[arg("java.util.List\","conditions"),arg("java.util.List\","preStatsThen"),arg("org.rascalmpl.ast.StringMiddle","thenString"),arg("java.util.List\","postStatsThen"),arg("java.util.List\","preStatsElse"),arg("org.rascalmpl.ast.StringMiddle","elseString"),arg("java.util.List\","postStatsElse")],breakable=false) + + + private final java.util.List conditions; + private final java.util.List preStatsThen; + private final org.rascalmpl.ast.StringMiddle thenString; + private final java.util.List postStatsThen; + private final java.util.List preStatsElse; + private final org.rascalmpl.ast.StringMiddle elseString; + private final java.util.List postStatsElse; + + public IfThenElse(ISourceLocation src, IConstructor node , java.util.List conditions, java.util.List preStatsThen, org.rascalmpl.ast.StringMiddle thenString, java.util.List postStatsThen, java.util.List preStatsElse, org.rascalmpl.ast.StringMiddle elseString, java.util.List postStatsElse) { + super(src, node); + + this.conditions = conditions; + this.preStatsThen = preStatsThen; + this.thenString = thenString; + this.postStatsThen = postStatsThen; + this.preStatsElse = preStatsElse; + this.elseString = elseString; + this.postStatsElse = postStatsElse; + } + + @Override + public boolean isIfThenElse() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStringTemplateIfThenElse(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : conditions) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + for (AbstractAST $elem : preStatsThen) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + $l = thenString.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + thenString.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : postStatsThen) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + for (AbstractAST $elem : preStatsElse) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + $l = elseString.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + elseString.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : postStatsElse) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof IfThenElse)) { + return false; + } + IfThenElse tmp = (IfThenElse) o; + return true && tmp.conditions.equals(this.conditions) && tmp.preStatsThen.equals(this.preStatsThen) && tmp.thenString.equals(this.thenString) && tmp.postStatsThen.equals(this.postStatsThen) && tmp.preStatsElse.equals(this.preStatsElse) && tmp.elseString.equals(this.elseString) && tmp.postStatsElse.equals(this.postStatsElse) ; + } + + @Override + public int hashCode() { + return 683 + 839 * conditions.hashCode() + 577 * preStatsThen.hashCode() + 41 * thenString.hashCode() + 809 * postStatsThen.hashCode() + 821 * preStatsElse.hashCode() + 821 * elseString.hashCode() + 59 * postStatsElse.hashCode() ; + } + + + @Override + public java.util.List getConditions() { + return this.conditions; + } + + @Override + public boolean hasConditions() { + return true; + } + @Override + public java.util.List getPreStatsThen() { + return this.preStatsThen; + } + + @Override + public boolean hasPreStatsThen() { + return true; + } + @Override + public org.rascalmpl.ast.StringMiddle getThenString() { + return this.thenString; + } + + @Override + public boolean hasThenString() { + return true; + } + @Override + public java.util.List getPostStatsThen() { + return this.postStatsThen; + } + + @Override + public boolean hasPostStatsThen() { + return true; + } + @Override + public java.util.List getPreStatsElse() { + return this.preStatsElse; + } + + @Override + public boolean hasPreStatsElse() { + return true; + } + @Override + public org.rascalmpl.ast.StringMiddle getElseString() { + return this.elseString; + } + + @Override + public boolean hasElseString() { + return true; + } + @Override + public java.util.List getPostStatsElse() { + return this.postStatsElse; + } + + @Override + public boolean hasPostStatsElse() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(conditions), clone(preStatsThen), clone(thenString), clone(postStatsThen), clone(preStatsElse), clone(elseString), clone(postStatsElse)); + } + + } + public boolean isWhile() { + return false; + } + + static public class While extends StringTemplate { + // Production: sig("While",[arg("org.rascalmpl.ast.Expression","condition"),arg("java.util.List\","preStats"),arg("org.rascalmpl.ast.StringMiddle","body"),arg("java.util.List\","postStats")],breakable=false) + + + private final org.rascalmpl.ast.Expression condition; + private final java.util.List preStats; + private final org.rascalmpl.ast.StringMiddle body; + private final java.util.List postStats; + + public While(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression condition, java.util.List preStats, org.rascalmpl.ast.StringMiddle body, java.util.List postStats) { + super(src, node); + + this.condition = condition; + this.preStats = preStats; + this.body = body; + this.postStats = postStats; + } + + @Override + public boolean isWhile() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStringTemplateWhile(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = condition.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + condition.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : preStats) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + $l = body.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + body.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : postStats) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof While)) { + return false; + } + While tmp = (While) o; + return true && tmp.condition.equals(this.condition) && tmp.preStats.equals(this.preStats) && tmp.body.equals(this.body) && tmp.postStats.equals(this.postStats) ; + } + + @Override + public int hashCode() { + return 139 + 233 * condition.hashCode() + 331 * preStats.hashCode() + 359 * body.hashCode() + 151 * postStats.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getCondition() { + return this.condition; + } + + @Override + public boolean hasCondition() { + return true; + } + @Override + public java.util.List getPreStats() { + return this.preStats; + } + + @Override + public boolean hasPreStats() { + return true; + } + @Override + public org.rascalmpl.ast.StringMiddle getBody() { + return this.body; + } + + @Override + public boolean hasBody() { + return true; + } + @Override + public java.util.List getPostStats() { + return this.postStats; + } + + @Override + public boolean hasPostStats() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(condition), clone(preStats), clone(body), clone(postStats)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/StructuredType.java b/src/org/rascalmpl/ast/StructuredType.java new file mode 100644 index 00000000000..b2c20b4df88 --- /dev/null +++ b/src/org/rascalmpl/ast/StructuredType.java @@ -0,0 +1,142 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class StructuredType extends AbstractAST { + public StructuredType(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasArguments() { + return false; + } + + public java.util.List getArguments() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasBasicType() { + return false; + } + + public org.rascalmpl.ast.BasicType getBasicType() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDefault() { + return false; + } + + static public class Default extends StructuredType { + // Production: sig("Default",[arg("org.rascalmpl.ast.BasicType","basicType"),arg("java.util.List\","arguments")],breakable=false) + + + private final org.rascalmpl.ast.BasicType basicType; + private final java.util.List arguments; + + public Default(ISourceLocation src, IConstructor node , org.rascalmpl.ast.BasicType basicType, java.util.List arguments) { + super(src, node); + + this.basicType = basicType; + this.arguments = arguments; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitStructuredTypeDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = basicType.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + basicType.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : arguments) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.basicType.equals(this.basicType) && tmp.arguments.equals(this.arguments) ; + } + + @Override + public int hashCode() { + return 311 + 73 * basicType.hashCode() + 619 * arguments.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.BasicType getBasicType() { + return this.basicType; + } + + @Override + public boolean hasBasicType() { + return true; + } + @Override + public java.util.List getArguments() { + return this.arguments; + } + + @Override + public boolean hasArguments() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(basicType), clone(arguments)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Sym.java b/src/org/rascalmpl/ast/Sym.java new file mode 100644 index 00000000000..255873930b7 --- /dev/null +++ b/src/org/rascalmpl/ast/Sym.java @@ -0,0 +1,2208 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Sym extends AbstractAST { + public Sym(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasAlternatives() { + return false; + } + + public java.util.List getAlternatives() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasParameters() { + return false; + } + + public java.util.List getParameters() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasSequence() { + return false; + } + + public java.util.List getSequence() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasCistring() { + return false; + } + + public org.rascalmpl.ast.CaseInsensitiveStringConstant getCistring() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasCharClass() { + return false; + } + + public org.rascalmpl.ast.Class getCharClass() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasColumn() { + return false; + } + + public org.rascalmpl.ast.IntegerLiteral getColumn() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasNonterminal() { + return false; + } + + public org.rascalmpl.ast.Nonterminal getNonterminal() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasLabel() { + return false; + } + + public org.rascalmpl.ast.NonterminalLabel getLabel() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasString() { + return false; + } + + public org.rascalmpl.ast.StringConstant getString() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasFirst() { + return false; + } + + public org.rascalmpl.ast.Sym getFirst() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasMatch() { + return false; + } + + public org.rascalmpl.ast.Sym getMatch() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasSep() { + return false; + } + + public org.rascalmpl.ast.Sym getSep() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasSymbol() { + return false; + } + + public org.rascalmpl.ast.Sym getSymbol() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isAlternative() { + return false; + } + + static public class Alternative extends Sym { + // Production: sig("Alternative",[arg("org.rascalmpl.ast.Sym","first"),arg("java.util.List\","alternatives")],breakable=false) + + + private final org.rascalmpl.ast.Sym first; + private final java.util.List alternatives; + + public Alternative(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Sym first, java.util.List alternatives) { + super(src, node); + + this.first = first; + this.alternatives = alternatives; + } + + @Override + public boolean isAlternative() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSymAlternative(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = first.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + first.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : alternatives) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Alternative)) { + return false; + } + Alternative tmp = (Alternative) o; + return true && tmp.first.equals(this.first) && tmp.alternatives.equals(this.alternatives) ; + } + + @Override + public int hashCode() { + return 5 + 191 * first.hashCode() + 467 * alternatives.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Sym getFirst() { + return this.first; + } + + @Override + public boolean hasFirst() { + return true; + } + @Override + public java.util.List getAlternatives() { + return this.alternatives; + } + + @Override + public boolean hasAlternatives() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(first), clone(alternatives)); + } + + } + public boolean isCaseInsensitiveLiteral() { + return false; + } + + static public class CaseInsensitiveLiteral extends Sym { + // Production: sig("CaseInsensitiveLiteral",[arg("org.rascalmpl.ast.CaseInsensitiveStringConstant","cistring")],breakable=false) + + + private final org.rascalmpl.ast.CaseInsensitiveStringConstant cistring; + + public CaseInsensitiveLiteral(ISourceLocation src, IConstructor node , org.rascalmpl.ast.CaseInsensitiveStringConstant cistring) { + super(src, node); + + this.cistring = cistring; + } + + @Override + public boolean isCaseInsensitiveLiteral() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSymCaseInsensitiveLiteral(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = cistring.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + cistring.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof CaseInsensitiveLiteral)) { + return false; + } + CaseInsensitiveLiteral tmp = (CaseInsensitiveLiteral) o; + return true && tmp.cistring.equals(this.cistring) ; + } + + @Override + public int hashCode() { + return 149 + 19 * cistring.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.CaseInsensitiveStringConstant getCistring() { + return this.cistring; + } + + @Override + public boolean hasCistring() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(cistring)); + } + + } + public boolean isCharacterClass() { + return false; + } + + static public class CharacterClass extends Sym { + // Production: sig("CharacterClass",[arg("org.rascalmpl.ast.Class","charClass")],breakable=false) + + + private final org.rascalmpl.ast.Class charClass; + + public CharacterClass(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Class charClass) { + super(src, node); + + this.charClass = charClass; + } + + @Override + public boolean isCharacterClass() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSymCharacterClass(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = charClass.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + charClass.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof CharacterClass)) { + return false; + } + CharacterClass tmp = (CharacterClass) o; + return true && tmp.charClass.equals(this.charClass) ; + } + + @Override + public int hashCode() { + return 761 + 89 * charClass.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Class getCharClass() { + return this.charClass; + } + + @Override + public boolean hasCharClass() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(charClass)); + } + + } + public boolean isColumn() { + return false; + } + + static public class Column extends Sym { + // Production: sig("Column",[arg("org.rascalmpl.ast.Sym","symbol"),arg("org.rascalmpl.ast.IntegerLiteral","column")],breakable=false) + + + private final org.rascalmpl.ast.Sym symbol; + private final org.rascalmpl.ast.IntegerLiteral column; + + public Column(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Sym symbol, org.rascalmpl.ast.IntegerLiteral column) { + super(src, node); + + this.symbol = symbol; + this.column = column; + } + + @Override + public boolean isColumn() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSymColumn(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = symbol.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + symbol.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = column.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + column.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Column)) { + return false; + } + Column tmp = (Column) o; + return true && tmp.symbol.equals(this.symbol) && tmp.column.equals(this.column) ; + } + + @Override + public int hashCode() { + return 587 + 67 * symbol.hashCode() + 191 * column.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Sym getSymbol() { + return this.symbol; + } + + @Override + public boolean hasSymbol() { + return true; + } + @Override + public org.rascalmpl.ast.IntegerLiteral getColumn() { + return this.column; + } + + @Override + public boolean hasColumn() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(symbol), clone(column)); + } + + } + public boolean isEmpty() { + return false; + } + + static public class Empty extends Sym { + // Production: sig("Empty",[],breakable=false) + + + + public Empty(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isEmpty() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSymEmpty(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Empty)) { + return false; + } + Empty tmp = (Empty) o; + return true ; + } + + @Override + public int hashCode() { + return 577 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isEndOfLine() { + return false; + } + + static public class EndOfLine extends Sym { + // Production: sig("EndOfLine",[arg("org.rascalmpl.ast.Sym","symbol")],breakable=false) + + + private final org.rascalmpl.ast.Sym symbol; + + public EndOfLine(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Sym symbol) { + super(src, node); + + this.symbol = symbol; + } + + @Override + public boolean isEndOfLine() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSymEndOfLine(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = symbol.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + symbol.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof EndOfLine)) { + return false; + } + EndOfLine tmp = (EndOfLine) o; + return true && tmp.symbol.equals(this.symbol) ; + } + + @Override + public int hashCode() { + return 263 + 647 * symbol.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Sym getSymbol() { + return this.symbol; + } + + @Override + public boolean hasSymbol() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(symbol)); + } + + } + public boolean isExcept() { + return false; + } + + static public class Except extends Sym { + // Production: sig("Except",[arg("org.rascalmpl.ast.Sym","symbol"),arg("org.rascalmpl.ast.NonterminalLabel","label")],breakable=false) + + + private final org.rascalmpl.ast.Sym symbol; + private final org.rascalmpl.ast.NonterminalLabel label; + + public Except(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Sym symbol, org.rascalmpl.ast.NonterminalLabel label) { + super(src, node); + + this.symbol = symbol; + this.label = label; + } + + @Override + public boolean isExcept() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSymExcept(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = symbol.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + symbol.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = label.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + label.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Except)) { + return false; + } + Except tmp = (Except) o; + return true && tmp.symbol.equals(this.symbol) && tmp.label.equals(this.label) ; + } + + @Override + public int hashCode() { + return 991 + 409 * symbol.hashCode() + 907 * label.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Sym getSymbol() { + return this.symbol; + } + + @Override + public boolean hasSymbol() { + return true; + } + @Override + public org.rascalmpl.ast.NonterminalLabel getLabel() { + return this.label; + } + + @Override + public boolean hasLabel() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(symbol), clone(label)); + } + + } + public boolean isFollow() { + return false; + } + + static public class Follow extends Sym { + // Production: sig("Follow",[arg("org.rascalmpl.ast.Sym","symbol"),arg("org.rascalmpl.ast.Sym","match")],breakable=false) + + + private final org.rascalmpl.ast.Sym symbol; + private final org.rascalmpl.ast.Sym match; + + public Follow(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Sym symbol, org.rascalmpl.ast.Sym match) { + super(src, node); + + this.symbol = symbol; + this.match = match; + } + + @Override + public boolean isFollow() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSymFollow(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = symbol.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + symbol.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = match.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + match.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Follow)) { + return false; + } + Follow tmp = (Follow) o; + return true && tmp.symbol.equals(this.symbol) && tmp.match.equals(this.match) ; + } + + @Override + public int hashCode() { + return 89 + 347 * symbol.hashCode() + 509 * match.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Sym getSymbol() { + return this.symbol; + } + + @Override + public boolean hasSymbol() { + return true; + } + @Override + public org.rascalmpl.ast.Sym getMatch() { + return this.match; + } + + @Override + public boolean hasMatch() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(symbol), clone(match)); + } + + } + public boolean isIter() { + return false; + } + + static public class Iter extends Sym { + // Production: sig("Iter",[arg("org.rascalmpl.ast.Sym","symbol")],breakable=false) + + + private final org.rascalmpl.ast.Sym symbol; + + public Iter(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Sym symbol) { + super(src, node); + + this.symbol = symbol; + } + + @Override + public boolean isIter() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSymIter(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = symbol.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + symbol.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Iter)) { + return false; + } + Iter tmp = (Iter) o; + return true && tmp.symbol.equals(this.symbol) ; + } + + @Override + public int hashCode() { + return 151 + 599 * symbol.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Sym getSymbol() { + return this.symbol; + } + + @Override + public boolean hasSymbol() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(symbol)); + } + + } + public boolean isIterSep() { + return false; + } + + static public class IterSep extends Sym { + // Production: sig("IterSep",[arg("org.rascalmpl.ast.Sym","symbol"),arg("org.rascalmpl.ast.Sym","sep")],breakable=false) + + + private final org.rascalmpl.ast.Sym symbol; + private final org.rascalmpl.ast.Sym sep; + + public IterSep(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Sym symbol, org.rascalmpl.ast.Sym sep) { + super(src, node); + + this.symbol = symbol; + this.sep = sep; + } + + @Override + public boolean isIterSep() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSymIterSep(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = symbol.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + symbol.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = sep.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + sep.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof IterSep)) { + return false; + } + IterSep tmp = (IterSep) o; + return true && tmp.symbol.equals(this.symbol) && tmp.sep.equals(this.sep) ; + } + + @Override + public int hashCode() { + return 29 + 941 * symbol.hashCode() + 103 * sep.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Sym getSymbol() { + return this.symbol; + } + + @Override + public boolean hasSymbol() { + return true; + } + @Override + public org.rascalmpl.ast.Sym getSep() { + return this.sep; + } + + @Override + public boolean hasSep() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(symbol), clone(sep)); + } + + } + public boolean isIterStar() { + return false; + } + + static public class IterStar extends Sym { + // Production: sig("IterStar",[arg("org.rascalmpl.ast.Sym","symbol")],breakable=false) + + + private final org.rascalmpl.ast.Sym symbol; + + public IterStar(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Sym symbol) { + super(src, node); + + this.symbol = symbol; + } + + @Override + public boolean isIterStar() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSymIterStar(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = symbol.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + symbol.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof IterStar)) { + return false; + } + IterStar tmp = (IterStar) o; + return true && tmp.symbol.equals(this.symbol) ; + } + + @Override + public int hashCode() { + return 67 + 769 * symbol.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Sym getSymbol() { + return this.symbol; + } + + @Override + public boolean hasSymbol() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(symbol)); + } + + } + public boolean isIterStarSep() { + return false; + } + + static public class IterStarSep extends Sym { + // Production: sig("IterStarSep",[arg("org.rascalmpl.ast.Sym","symbol"),arg("org.rascalmpl.ast.Sym","sep")],breakable=false) + + + private final org.rascalmpl.ast.Sym symbol; + private final org.rascalmpl.ast.Sym sep; + + public IterStarSep(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Sym symbol, org.rascalmpl.ast.Sym sep) { + super(src, node); + + this.symbol = symbol; + this.sep = sep; + } + + @Override + public boolean isIterStarSep() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSymIterStarSep(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = symbol.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + symbol.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = sep.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + sep.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof IterStarSep)) { + return false; + } + IterStarSep tmp = (IterStarSep) o; + return true && tmp.symbol.equals(this.symbol) && tmp.sep.equals(this.sep) ; + } + + @Override + public int hashCode() { + return 149 + 541 * symbol.hashCode() + 353 * sep.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Sym getSymbol() { + return this.symbol; + } + + @Override + public boolean hasSymbol() { + return true; + } + @Override + public org.rascalmpl.ast.Sym getSep() { + return this.sep; + } + + @Override + public boolean hasSep() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(symbol), clone(sep)); + } + + } + public boolean isLabeled() { + return false; + } + + static public class Labeled extends Sym { + // Production: sig("Labeled",[arg("org.rascalmpl.ast.Sym","symbol"),arg("org.rascalmpl.ast.NonterminalLabel","label")],breakable=false) + + + private final org.rascalmpl.ast.Sym symbol; + private final org.rascalmpl.ast.NonterminalLabel label; + + public Labeled(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Sym symbol, org.rascalmpl.ast.NonterminalLabel label) { + super(src, node); + + this.symbol = symbol; + this.label = label; + } + + @Override + public boolean isLabeled() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSymLabeled(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = symbol.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + symbol.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = label.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + label.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Labeled)) { + return false; + } + Labeled tmp = (Labeled) o; + return true && tmp.symbol.equals(this.symbol) && tmp.label.equals(this.label) ; + } + + @Override + public int hashCode() { + return 23 + 787 * symbol.hashCode() + 863 * label.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Sym getSymbol() { + return this.symbol; + } + + @Override + public boolean hasSymbol() { + return true; + } + @Override + public org.rascalmpl.ast.NonterminalLabel getLabel() { + return this.label; + } + + @Override + public boolean hasLabel() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(symbol), clone(label)); + } + + } + public boolean isLiteral() { + return false; + } + + static public class Literal extends Sym { + // Production: sig("Literal",[arg("org.rascalmpl.ast.StringConstant","string")],breakable=false) + + + private final org.rascalmpl.ast.StringConstant string; + + public Literal(ISourceLocation src, IConstructor node , org.rascalmpl.ast.StringConstant string) { + super(src, node); + + this.string = string; + } + + @Override + public boolean isLiteral() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSymLiteral(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = string.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + string.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Literal)) { + return false; + } + Literal tmp = (Literal) o; + return true && tmp.string.equals(this.string) ; + } + + @Override + public int hashCode() { + return 557 + 61 * string.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.StringConstant getString() { + return this.string; + } + + @Override + public boolean hasString() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(string)); + } + + } + public boolean isNonterminal() { + return false; + } + + static public class Nonterminal extends Sym { + // Production: sig("Nonterminal",[arg("org.rascalmpl.ast.Nonterminal","nonterminal")],breakable=false) + + + private final org.rascalmpl.ast.Nonterminal nonterminal; + + public Nonterminal(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Nonterminal nonterminal) { + super(src, node); + + this.nonterminal = nonterminal; + } + + @Override + public boolean isNonterminal() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSymNonterminal(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = nonterminal.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + nonterminal.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Nonterminal)) { + return false; + } + Nonterminal tmp = (Nonterminal) o; + return true && tmp.nonterminal.equals(this.nonterminal) ; + } + + @Override + public int hashCode() { + return 281 + 263 * nonterminal.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Nonterminal getNonterminal() { + return this.nonterminal; + } + + @Override + public boolean hasNonterminal() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(nonterminal)); + } + + } + public boolean isNotFollow() { + return false; + } + + static public class NotFollow extends Sym { + // Production: sig("NotFollow",[arg("org.rascalmpl.ast.Sym","symbol"),arg("org.rascalmpl.ast.Sym","match")],breakable=false) + + + private final org.rascalmpl.ast.Sym symbol; + private final org.rascalmpl.ast.Sym match; + + public NotFollow(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Sym symbol, org.rascalmpl.ast.Sym match) { + super(src, node); + + this.symbol = symbol; + this.match = match; + } + + @Override + public boolean isNotFollow() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSymNotFollow(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = symbol.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + symbol.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = match.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + match.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof NotFollow)) { + return false; + } + NotFollow tmp = (NotFollow) o; + return true && tmp.symbol.equals(this.symbol) && tmp.match.equals(this.match) ; + } + + @Override + public int hashCode() { + return 19 + 61 * symbol.hashCode() + 241 * match.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Sym getSymbol() { + return this.symbol; + } + + @Override + public boolean hasSymbol() { + return true; + } + @Override + public org.rascalmpl.ast.Sym getMatch() { + return this.match; + } + + @Override + public boolean hasMatch() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(symbol), clone(match)); + } + + } + public boolean isNotPrecede() { + return false; + } + + static public class NotPrecede extends Sym { + // Production: sig("NotPrecede",[arg("org.rascalmpl.ast.Sym","match"),arg("org.rascalmpl.ast.Sym","symbol")],breakable=false) + + + private final org.rascalmpl.ast.Sym match; + private final org.rascalmpl.ast.Sym symbol; + + public NotPrecede(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Sym match, org.rascalmpl.ast.Sym symbol) { + super(src, node); + + this.match = match; + this.symbol = symbol; + } + + @Override + public boolean isNotPrecede() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSymNotPrecede(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = match.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + match.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = symbol.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + symbol.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof NotPrecede)) { + return false; + } + NotPrecede tmp = (NotPrecede) o; + return true && tmp.match.equals(this.match) && tmp.symbol.equals(this.symbol) ; + } + + @Override + public int hashCode() { + return 409 + 443 * match.hashCode() + 11 * symbol.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Sym getMatch() { + return this.match; + } + + @Override + public boolean hasMatch() { + return true; + } + @Override + public org.rascalmpl.ast.Sym getSymbol() { + return this.symbol; + } + + @Override + public boolean hasSymbol() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(match), clone(symbol)); + } + + } + public boolean isOptional() { + return false; + } + + static public class Optional extends Sym { + // Production: sig("Optional",[arg("org.rascalmpl.ast.Sym","symbol")],breakable=false) + + + private final org.rascalmpl.ast.Sym symbol; + + public Optional(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Sym symbol) { + super(src, node); + + this.symbol = symbol; + } + + @Override + public boolean isOptional() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSymOptional(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = symbol.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + symbol.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Optional)) { + return false; + } + Optional tmp = (Optional) o; + return true && tmp.symbol.equals(this.symbol) ; + } + + @Override + public int hashCode() { + return 389 + 229 * symbol.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Sym getSymbol() { + return this.symbol; + } + + @Override + public boolean hasSymbol() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(symbol)); + } + + } + public boolean isParameter() { + return false; + } + + static public class Parameter extends Sym { + // Production: sig("Parameter",[arg("org.rascalmpl.ast.Nonterminal","nonterminal")],breakable=false) + + + private final org.rascalmpl.ast.Nonterminal nonterminal; + + public Parameter(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Nonterminal nonterminal) { + super(src, node); + + this.nonterminal = nonterminal; + } + + @Override + public boolean isParameter() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSymParameter(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = nonterminal.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + nonterminal.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Parameter)) { + return false; + } + Parameter tmp = (Parameter) o; + return true && tmp.nonterminal.equals(this.nonterminal) ; + } + + @Override + public int hashCode() { + return 193 + 617 * nonterminal.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Nonterminal getNonterminal() { + return this.nonterminal; + } + + @Override + public boolean hasNonterminal() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(nonterminal)); + } + + } + public boolean isParametrized() { + return false; + } + + static public class Parametrized extends Sym { + // Production: sig("Parametrized",[arg("org.rascalmpl.ast.Nonterminal","nonterminal"),arg("java.util.List\","parameters")],breakable=false) + + + private final org.rascalmpl.ast.Nonterminal nonterminal; + private final java.util.List parameters; + + public Parametrized(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Nonterminal nonterminal, java.util.List parameters) { + super(src, node); + + this.nonterminal = nonterminal; + this.parameters = parameters; + } + + @Override + public boolean isParametrized() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSymParametrized(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = nonterminal.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + nonterminal.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : parameters) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Parametrized)) { + return false; + } + Parametrized tmp = (Parametrized) o; + return true && tmp.nonterminal.equals(this.nonterminal) && tmp.parameters.equals(this.parameters) ; + } + + @Override + public int hashCode() { + return 521 + 269 * nonterminal.hashCode() + 839 * parameters.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Nonterminal getNonterminal() { + return this.nonterminal; + } + + @Override + public boolean hasNonterminal() { + return true; + } + @Override + public java.util.List getParameters() { + return this.parameters; + } + + @Override + public boolean hasParameters() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(nonterminal), clone(parameters)); + } + + } + public boolean isPrecede() { + return false; + } + + static public class Precede extends Sym { + // Production: sig("Precede",[arg("org.rascalmpl.ast.Sym","match"),arg("org.rascalmpl.ast.Sym","symbol")],breakable=false) + + + private final org.rascalmpl.ast.Sym match; + private final org.rascalmpl.ast.Sym symbol; + + public Precede(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Sym match, org.rascalmpl.ast.Sym symbol) { + super(src, node); + + this.match = match; + this.symbol = symbol; + } + + @Override + public boolean isPrecede() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSymPrecede(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = match.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + match.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = symbol.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + symbol.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Precede)) { + return false; + } + Precede tmp = (Precede) o; + return true && tmp.match.equals(this.match) && tmp.symbol.equals(this.symbol) ; + } + + @Override + public int hashCode() { + return 743 + 751 * match.hashCode() + 241 * symbol.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Sym getMatch() { + return this.match; + } + + @Override + public boolean hasMatch() { + return true; + } + @Override + public org.rascalmpl.ast.Sym getSymbol() { + return this.symbol; + } + + @Override + public boolean hasSymbol() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(match), clone(symbol)); + } + + } + public boolean isSequence() { + return false; + } + + static public class Sequence extends Sym { + // Production: sig("Sequence",[arg("org.rascalmpl.ast.Sym","first"),arg("java.util.List\","sequence")],breakable=false) + + + private final org.rascalmpl.ast.Sym first; + private final java.util.List sequence; + + public Sequence(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Sym first, java.util.List sequence) { + super(src, node); + + this.first = first; + this.sequence = sequence; + } + + @Override + public boolean isSequence() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSymSequence(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = first.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + first.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : sequence) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Sequence)) { + return false; + } + Sequence tmp = (Sequence) o; + return true && tmp.first.equals(this.first) && tmp.sequence.equals(this.sequence) ; + } + + @Override + public int hashCode() { + return 911 + 827 * first.hashCode() + 29 * sequence.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Sym getFirst() { + return this.first; + } + + @Override + public boolean hasFirst() { + return true; + } + @Override + public java.util.List getSequence() { + return this.sequence; + } + + @Override + public boolean hasSequence() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(first), clone(sequence)); + } + + } + public boolean isStart() { + return false; + } + + static public class Start extends Sym { + // Production: sig("Start",[arg("org.rascalmpl.ast.Nonterminal","nonterminal")],breakable=false) + + + private final org.rascalmpl.ast.Nonterminal nonterminal; + + public Start(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Nonterminal nonterminal) { + super(src, node); + + this.nonterminal = nonterminal; + } + + @Override + public boolean isStart() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSymStart(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = nonterminal.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + nonterminal.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Start)) { + return false; + } + Start tmp = (Start) o; + return true && tmp.nonterminal.equals(this.nonterminal) ; + } + + @Override + public int hashCode() { + return 947 + 883 * nonterminal.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Nonterminal getNonterminal() { + return this.nonterminal; + } + + @Override + public boolean hasNonterminal() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(nonterminal)); + } + + } + public boolean isStartOfLine() { + return false; + } + + static public class StartOfLine extends Sym { + // Production: sig("StartOfLine",[arg("org.rascalmpl.ast.Sym","symbol")],breakable=false) + + + private final org.rascalmpl.ast.Sym symbol; + + public StartOfLine(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Sym symbol) { + super(src, node); + + this.symbol = symbol; + } + + @Override + public boolean isStartOfLine() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSymStartOfLine(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = symbol.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + symbol.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof StartOfLine)) { + return false; + } + StartOfLine tmp = (StartOfLine) o; + return true && tmp.symbol.equals(this.symbol) ; + } + + @Override + public int hashCode() { + return 743 + 313 * symbol.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Sym getSymbol() { + return this.symbol; + } + + @Override + public boolean hasSymbol() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(symbol)); + } + + } + public boolean isUnequal() { + return false; + } + + static public class Unequal extends Sym { + // Production: sig("Unequal",[arg("org.rascalmpl.ast.Sym","symbol"),arg("org.rascalmpl.ast.Sym","match")],breakable=false) + + + private final org.rascalmpl.ast.Sym symbol; + private final org.rascalmpl.ast.Sym match; + + public Unequal(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Sym symbol, org.rascalmpl.ast.Sym match) { + super(src, node); + + this.symbol = symbol; + this.match = match; + } + + @Override + public boolean isUnequal() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSymUnequal(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = symbol.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + symbol.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = match.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + match.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Unequal)) { + return false; + } + Unequal tmp = (Unequal) o; + return true && tmp.symbol.equals(this.symbol) && tmp.match.equals(this.match) ; + } + + @Override + public int hashCode() { + return 607 + 727 * symbol.hashCode() + 883 * match.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Sym getSymbol() { + return this.symbol; + } + + @Override + public boolean hasSymbol() { + return true; + } + @Override + public org.rascalmpl.ast.Sym getMatch() { + return this.match; + } + + @Override + public boolean hasMatch() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(symbol), clone(match)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/SyntaxDefinition.java b/src/org/rascalmpl/ast/SyntaxDefinition.java new file mode 100644 index 00000000000..e5a16c10b5f --- /dev/null +++ b/src/org/rascalmpl/ast/SyntaxDefinition.java @@ -0,0 +1,471 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class SyntaxDefinition extends AbstractAST { + public SyntaxDefinition(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasProduction() { + return false; + } + + public org.rascalmpl.ast.Prod getProduction() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasStart() { + return false; + } + + public org.rascalmpl.ast.Start getStart() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasDefined() { + return false; + } + + public org.rascalmpl.ast.Sym getDefined() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasVis() { + return false; + } + + public org.rascalmpl.ast.Visibility getVis() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isKeyword() { + return false; + } + + static public class Keyword extends SyntaxDefinition { + // Production: sig("Keyword",[arg("org.rascalmpl.ast.Sym","defined"),arg("org.rascalmpl.ast.Prod","production")],breakable=false) + + + private final org.rascalmpl.ast.Sym defined; + private final org.rascalmpl.ast.Prod production; + + public Keyword(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Sym defined, org.rascalmpl.ast.Prod production) { + super(src, node); + + this.defined = defined; + this.production = production; + } + + @Override + public boolean isKeyword() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSyntaxDefinitionKeyword(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = defined.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + defined.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = production.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + production.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Keyword)) { + return false; + } + Keyword tmp = (Keyword) o; + return true && tmp.defined.equals(this.defined) && tmp.production.equals(this.production) ; + } + + @Override + public int hashCode() { + return 617 + 233 * defined.hashCode() + 263 * production.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Sym getDefined() { + return this.defined; + } + + @Override + public boolean hasDefined() { + return true; + } + @Override + public org.rascalmpl.ast.Prod getProduction() { + return this.production; + } + + @Override + public boolean hasProduction() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(defined), clone(production)); + } + + } + public boolean isLanguage() { + return false; + } + + static public class Language extends SyntaxDefinition { + // Production: sig("Language",[arg("org.rascalmpl.ast.Start","start"),arg("org.rascalmpl.ast.Sym","defined"),arg("org.rascalmpl.ast.Prod","production")],breakable=false) + + + private final org.rascalmpl.ast.Start start; + private final org.rascalmpl.ast.Sym defined; + private final org.rascalmpl.ast.Prod production; + + public Language(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Start start, org.rascalmpl.ast.Sym defined, org.rascalmpl.ast.Prod production) { + super(src, node); + + this.start = start; + this.defined = defined; + this.production = production; + } + + @Override + public boolean isLanguage() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSyntaxDefinitionLanguage(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = start.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + start.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = defined.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + defined.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = production.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + production.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Language)) { + return false; + } + Language tmp = (Language) o; + return true && tmp.start.equals(this.start) && tmp.defined.equals(this.defined) && tmp.production.equals(this.production) ; + } + + @Override + public int hashCode() { + return 163 + 683 * start.hashCode() + 661 * defined.hashCode() + 499 * production.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Start getStart() { + return this.start; + } + + @Override + public boolean hasStart() { + return true; + } + @Override + public org.rascalmpl.ast.Sym getDefined() { + return this.defined; + } + + @Override + public boolean hasDefined() { + return true; + } + @Override + public org.rascalmpl.ast.Prod getProduction() { + return this.production; + } + + @Override + public boolean hasProduction() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(start), clone(defined), clone(production)); + } + + } + public boolean isLayout() { + return false; + } + + static public class Layout extends SyntaxDefinition { + // Production: sig("Layout",[arg("org.rascalmpl.ast.Visibility","vis"),arg("org.rascalmpl.ast.Sym","defined"),arg("org.rascalmpl.ast.Prod","production")],breakable=false) + + + private final org.rascalmpl.ast.Visibility vis; + private final org.rascalmpl.ast.Sym defined; + private final org.rascalmpl.ast.Prod production; + + public Layout(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Visibility vis, org.rascalmpl.ast.Sym defined, org.rascalmpl.ast.Prod production) { + super(src, node); + + this.vis = vis; + this.defined = defined; + this.production = production; + } + + @Override + public boolean isLayout() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSyntaxDefinitionLayout(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = vis.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + vis.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = defined.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + defined.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = production.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + production.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Layout)) { + return false; + } + Layout tmp = (Layout) o; + return true && tmp.vis.equals(this.vis) && tmp.defined.equals(this.defined) && tmp.production.equals(this.production) ; + } + + @Override + public int hashCode() { + return 769 + 163 * vis.hashCode() + 641 * defined.hashCode() + 313 * production.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Visibility getVis() { + return this.vis; + } + + @Override + public boolean hasVis() { + return true; + } + @Override + public org.rascalmpl.ast.Sym getDefined() { + return this.defined; + } + + @Override + public boolean hasDefined() { + return true; + } + @Override + public org.rascalmpl.ast.Prod getProduction() { + return this.production; + } + + @Override + public boolean hasProduction() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(vis), clone(defined), clone(production)); + } + + } + public boolean isLexical() { + return false; + } + + static public class Lexical extends SyntaxDefinition { + // Production: sig("Lexical",[arg("org.rascalmpl.ast.Sym","defined"),arg("org.rascalmpl.ast.Prod","production")],breakable=false) + + + private final org.rascalmpl.ast.Sym defined; + private final org.rascalmpl.ast.Prod production; + + public Lexical(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Sym defined, org.rascalmpl.ast.Prod production) { + super(src, node); + + this.defined = defined; + this.production = production; + } + + @Override + public boolean isLexical() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitSyntaxDefinitionLexical(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = defined.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + defined.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = production.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + production.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Lexical)) { + return false; + } + Lexical tmp = (Lexical) o; + return true && tmp.defined.equals(this.defined) && tmp.production.equals(this.production) ; + } + + @Override + public int hashCode() { + return 509 + 563 * defined.hashCode() + 149 * production.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Sym getDefined() { + return this.defined; + } + + @Override + public boolean hasDefined() { + return true; + } + @Override + public org.rascalmpl.ast.Prod getProduction() { + return this.production; + } + + @Override + public boolean hasProduction() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(defined), clone(production)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Tag.java b/src/org/rascalmpl/ast/Tag.java new file mode 100644 index 00000000000..b658316cc1e --- /dev/null +++ b/src/org/rascalmpl/ast/Tag.java @@ -0,0 +1,314 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Tag extends AbstractAST { + public Tag(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasExpression() { + return false; + } + + public org.rascalmpl.ast.Expression getExpression() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasName() { + return false; + } + + public org.rascalmpl.ast.Name getName() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasContents() { + return false; + } + + public org.rascalmpl.ast.TagString getContents() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDefault() { + return false; + } + + static public class Default extends Tag { + // Production: sig("Default",[arg("org.rascalmpl.ast.Name","name"),arg("org.rascalmpl.ast.TagString","contents")],breakable=false) + + + private final org.rascalmpl.ast.Name name; + private final org.rascalmpl.ast.TagString contents; + + public Default(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Name name, org.rascalmpl.ast.TagString contents) { + super(src, node); + + this.name = name; + this.contents = contents; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitTagDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = contents.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + contents.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.name.equals(this.name) && tmp.contents.equals(this.contents) ; + } + + @Override + public int hashCode() { + return 431 + 67 * name.hashCode() + 19 * contents.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Name getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + @Override + public org.rascalmpl.ast.TagString getContents() { + return this.contents; + } + + @Override + public boolean hasContents() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(name), clone(contents)); + } + + } + public boolean isEmpty() { + return false; + } + + static public class Empty extends Tag { + // Production: sig("Empty",[arg("org.rascalmpl.ast.Name","name")],breakable=false) + + + private final org.rascalmpl.ast.Name name; + + public Empty(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Name name) { + super(src, node); + + this.name = name; + } + + @Override + public boolean isEmpty() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitTagEmpty(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Empty)) { + return false; + } + Empty tmp = (Empty) o; + return true && tmp.name.equals(this.name) ; + } + + @Override + public int hashCode() { + return 181 + 599 * name.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Name getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(name)); + } + + } + public boolean isExpression() { + return false; + } + + static public class Expression extends Tag { + // Production: sig("Expression",[arg("org.rascalmpl.ast.Name","name"),arg("org.rascalmpl.ast.Expression","expression")],breakable=false) + + + private final org.rascalmpl.ast.Name name; + private final org.rascalmpl.ast.Expression expression; + + public Expression(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Name name, org.rascalmpl.ast.Expression expression) { + super(src, node); + + this.name = name; + this.expression = expression; + } + + @Override + public boolean isExpression() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitTagExpression(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = expression.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + expression.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Expression)) { + return false; + } + Expression tmp = (Expression) o; + return true && tmp.name.equals(this.name) && tmp.expression.equals(this.expression) ; + } + + @Override + public int hashCode() { + return 101 + 421 * name.hashCode() + 277 * expression.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Name getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getExpression() { + return this.expression; + } + + @Override + public boolean hasExpression() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(name), clone(expression)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/TagString.java b/src/org/rascalmpl/ast/TagString.java new file mode 100644 index 00000000000..ef1899a6a21 --- /dev/null +++ b/src/org/rascalmpl/ast/TagString.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class TagString extends AbstractAST { + public TagString(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends TagString { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitTagStringLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Tags.java b/src/org/rascalmpl/ast/Tags.java new file mode 100644 index 00000000000..7ee4dacb2a9 --- /dev/null +++ b/src/org/rascalmpl/ast/Tags.java @@ -0,0 +1,116 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Tags extends AbstractAST { + public Tags(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasTags() { + return false; + } + + public java.util.List getTags() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDefault() { + return false; + } + + static public class Default extends Tags { + // Production: sig("Default",[arg("java.util.List\","tags")],breakable=false) + + + private final java.util.List tags; + + public Default(ISourceLocation src, IConstructor node , java.util.List tags) { + super(src, node); + + this.tags = tags; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitTagsDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + for (AbstractAST $elem : tags) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.tags.equals(this.tags) ; + } + + @Override + public int hashCode() { + return 487 + 797 * tags.hashCode() ; + } + + + @Override + public java.util.List getTags() { + return this.tags; + } + + @Override + public boolean hasTags() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(tags)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Target.java b/src/org/rascalmpl/ast/Target.java new file mode 100644 index 00000000000..a84492f3059 --- /dev/null +++ b/src/org/rascalmpl/ast/Target.java @@ -0,0 +1,169 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Target extends AbstractAST { + public Target(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasName() { + return false; + } + + public org.rascalmpl.ast.Name getName() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isEmpty() { + return false; + } + + static public class Empty extends Target { + // Production: sig("Empty",[],breakable=false) + + + + public Empty(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isEmpty() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitTargetEmpty(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Empty)) { + return false; + } + Empty tmp = (Empty) o; + return true ; + } + + @Override + public int hashCode() { + return 787 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isLabeled() { + return false; + } + + static public class Labeled extends Target { + // Production: sig("Labeled",[arg("org.rascalmpl.ast.Name","name")],breakable=false) + + + private final org.rascalmpl.ast.Name name; + + public Labeled(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Name name) { + super(src, node); + + this.name = name; + } + + @Override + public boolean isLabeled() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitTargetLabeled(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Labeled)) { + return false; + } + Labeled tmp = (Labeled) o; + return true && tmp.name.equals(this.name) ; + } + + @Override + public int hashCode() { + return 397 + 191 * name.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Name getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(name)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/TimePartNoTZ.java b/src/org/rascalmpl/ast/TimePartNoTZ.java new file mode 100644 index 00000000000..18e43c9bbf5 --- /dev/null +++ b/src/org/rascalmpl/ast/TimePartNoTZ.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class TimePartNoTZ extends AbstractAST { + public TimePartNoTZ(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends TimePartNoTZ { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitTimePartNoTZLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/TimeZonePart.java b/src/org/rascalmpl/ast/TimeZonePart.java new file mode 100644 index 00000000000..814c39ce8c7 --- /dev/null +++ b/src/org/rascalmpl/ast/TimeZonePart.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class TimeZonePart extends AbstractAST { + public TimeZonePart(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends TimeZonePart { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitTimeZonePartLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Toplevel.java b/src/org/rascalmpl/ast/Toplevel.java new file mode 100644 index 00000000000..80e0db16d93 --- /dev/null +++ b/src/org/rascalmpl/ast/Toplevel.java @@ -0,0 +1,114 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Toplevel extends AbstractAST { + public Toplevel(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasDeclaration() { + return false; + } + + public org.rascalmpl.ast.Declaration getDeclaration() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isGivenVisibility() { + return false; + } + + static public class GivenVisibility extends Toplevel { + // Production: sig("GivenVisibility",[arg("org.rascalmpl.ast.Declaration","declaration")],breakable=false) + + + private final org.rascalmpl.ast.Declaration declaration; + + public GivenVisibility(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Declaration declaration) { + super(src, node); + + this.declaration = declaration; + } + + @Override + public boolean isGivenVisibility() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitToplevelGivenVisibility(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = declaration.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + declaration.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof GivenVisibility)) { + return false; + } + GivenVisibility tmp = (GivenVisibility) o; + return true && tmp.declaration.equals(this.declaration) ; + } + + @Override + public int hashCode() { + return 977 + 173 * declaration.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Declaration getDeclaration() { + return this.declaration; + } + + @Override + public boolean hasDeclaration() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(declaration)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Type.java b/src/org/rascalmpl/ast/Type.java new file mode 100644 index 00000000000..c7719d2047b --- /dev/null +++ b/src/org/rascalmpl/ast/Type.java @@ -0,0 +1,681 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Type extends AbstractAST { + public Type(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasBasic() { + return false; + } + + public org.rascalmpl.ast.BasicType getBasic() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasSelector() { + return false; + } + + public org.rascalmpl.ast.DataTypeSelector getSelector() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasFunction() { + return false; + } + + public org.rascalmpl.ast.FunctionType getFunction() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasStructured() { + return false; + } + + public org.rascalmpl.ast.StructuredType getStructured() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasSymbol() { + return false; + } + + public org.rascalmpl.ast.Sym getSymbol() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasType() { + return false; + } + + public org.rascalmpl.ast.Type getType() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasTypeVar() { + return false; + } + + public org.rascalmpl.ast.TypeVar getTypeVar() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasUser() { + return false; + } + + public org.rascalmpl.ast.UserType getUser() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isBasic() { + return false; + } + + static public class Basic extends Type { + // Production: sig("Basic",[arg("org.rascalmpl.ast.BasicType","basic")],breakable=false) + + + private final org.rascalmpl.ast.BasicType basic; + + public Basic(ISourceLocation src, IConstructor node , org.rascalmpl.ast.BasicType basic) { + super(src, node); + + this.basic = basic; + } + + @Override + public boolean isBasic() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitTypeBasic(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = basic.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + basic.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Basic)) { + return false; + } + Basic tmp = (Basic) o; + return true && tmp.basic.equals(this.basic) ; + } + + @Override + public int hashCode() { + return 541 + 491 * basic.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.BasicType getBasic() { + return this.basic; + } + + @Override + public boolean hasBasic() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(basic)); + } + + } + public boolean isBracket() { + return false; + } + + static public class Bracket extends Type { + // Production: sig("Bracket",[arg("org.rascalmpl.ast.Type","type")],breakable=false) + + + private final org.rascalmpl.ast.Type type; + + public Bracket(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Type type) { + super(src, node); + + this.type = type; + } + + @Override + public boolean isBracket() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitTypeBracket(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = type.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + type.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Bracket)) { + return false; + } + Bracket tmp = (Bracket) o; + return true && tmp.type.equals(this.type) ; + } + + @Override + public int hashCode() { + return 331 + 167 * type.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Type getType() { + return this.type; + } + + @Override + public boolean hasType() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(type)); + } + + } + public boolean isFunction() { + return false; + } + + static public class Function extends Type { + // Production: sig("Function",[arg("org.rascalmpl.ast.FunctionType","function")],breakable=false) + + + private final org.rascalmpl.ast.FunctionType function; + + public Function(ISourceLocation src, IConstructor node , org.rascalmpl.ast.FunctionType function) { + super(src, node); + + this.function = function; + } + + @Override + public boolean isFunction() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitTypeFunction(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = function.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + function.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Function)) { + return false; + } + Function tmp = (Function) o; + return true && tmp.function.equals(this.function) ; + } + + @Override + public int hashCode() { + return 809 + 109 * function.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.FunctionType getFunction() { + return this.function; + } + + @Override + public boolean hasFunction() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(function)); + } + + } + public boolean isSelector() { + return false; + } + + static public class Selector extends Type { + // Production: sig("Selector",[arg("org.rascalmpl.ast.DataTypeSelector","selector")],breakable=false) + + + private final org.rascalmpl.ast.DataTypeSelector selector; + + public Selector(ISourceLocation src, IConstructor node , org.rascalmpl.ast.DataTypeSelector selector) { + super(src, node); + + this.selector = selector; + } + + @Override + public boolean isSelector() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitTypeSelector(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = selector.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + selector.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Selector)) { + return false; + } + Selector tmp = (Selector) o; + return true && tmp.selector.equals(this.selector) ; + } + + @Override + public int hashCode() { + return 373 + 449 * selector.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.DataTypeSelector getSelector() { + return this.selector; + } + + @Override + public boolean hasSelector() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(selector)); + } + + } + public boolean isStructured() { + return false; + } + + static public class Structured extends Type { + // Production: sig("Structured",[arg("org.rascalmpl.ast.StructuredType","structured")],breakable=false) + + + private final org.rascalmpl.ast.StructuredType structured; + + public Structured(ISourceLocation src, IConstructor node , org.rascalmpl.ast.StructuredType structured) { + super(src, node); + + this.structured = structured; + } + + @Override + public boolean isStructured() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitTypeStructured(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = structured.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + structured.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Structured)) { + return false; + } + Structured tmp = (Structured) o; + return true && tmp.structured.equals(this.structured) ; + } + + @Override + public int hashCode() { + return 571 + 467 * structured.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.StructuredType getStructured() { + return this.structured; + } + + @Override + public boolean hasStructured() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(structured)); + } + + } + public boolean isSymbol() { + return false; + } + + static public class Symbol extends Type { + // Production: sig("Symbol",[arg("org.rascalmpl.ast.Sym","symbol")],breakable=false) + + + private final org.rascalmpl.ast.Sym symbol; + + public Symbol(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Sym symbol) { + super(src, node); + + this.symbol = symbol; + } + + @Override + public boolean isSymbol() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitTypeSymbol(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = symbol.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + symbol.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Symbol)) { + return false; + } + Symbol tmp = (Symbol) o; + return true && tmp.symbol.equals(this.symbol) ; + } + + @Override + public int hashCode() { + return 691 + 701 * symbol.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Sym getSymbol() { + return this.symbol; + } + + @Override + public boolean hasSymbol() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(symbol)); + } + + } + public boolean isUser() { + return false; + } + + static public class User extends Type { + // Production: sig("User",[arg("org.rascalmpl.ast.UserType","user")],breakable=false) + + + private final org.rascalmpl.ast.UserType user; + + public User(ISourceLocation src, IConstructor node , org.rascalmpl.ast.UserType user) { + super(src, node); + + this.user = user; + } + + @Override + public boolean isUser() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitTypeUser(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = user.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + user.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof User)) { + return false; + } + User tmp = (User) o; + return true && tmp.user.equals(this.user) ; + } + + @Override + public int hashCode() { + return 19 + 137 * user.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.UserType getUser() { + return this.user; + } + + @Override + public boolean hasUser() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(user)); + } + + } + public boolean isVariable() { + return false; + } + + static public class Variable extends Type { + // Production: sig("Variable",[arg("org.rascalmpl.ast.TypeVar","typeVar")],breakable=false) + + + private final org.rascalmpl.ast.TypeVar typeVar; + + public Variable(ISourceLocation src, IConstructor node , org.rascalmpl.ast.TypeVar typeVar) { + super(src, node); + + this.typeVar = typeVar; + } + + @Override + public boolean isVariable() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitTypeVariable(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = typeVar.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + typeVar.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Variable)) { + return false; + } + Variable tmp = (Variable) o; + return true && tmp.typeVar.equals(this.typeVar) ; + } + + @Override + public int hashCode() { + return 907 + 41 * typeVar.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.TypeVar getTypeVar() { + return this.typeVar; + } + + @Override + public boolean hasTypeVar() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(typeVar)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/TypeArg.java b/src/org/rascalmpl/ast/TypeArg.java new file mode 100644 index 00000000000..7e7739e6839 --- /dev/null +++ b/src/org/rascalmpl/ast/TypeArg.java @@ -0,0 +1,214 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class TypeArg extends AbstractAST { + public TypeArg(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasName() { + return false; + } + + public org.rascalmpl.ast.Name getName() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasType() { + return false; + } + + public org.rascalmpl.ast.Type getType() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDefault() { + return false; + } + + static public class Default extends TypeArg { + // Production: sig("Default",[arg("org.rascalmpl.ast.Type","type")],breakable=false) + + + private final org.rascalmpl.ast.Type type; + + public Default(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Type type) { + super(src, node); + + this.type = type; + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitTypeArgDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = type.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + type.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true && tmp.type.equals(this.type) ; + } + + @Override + public int hashCode() { + return 59 + 823 * type.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Type getType() { + return this.type; + } + + @Override + public boolean hasType() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(type)); + } + + } + public boolean isNamed() { + return false; + } + + static public class Named extends TypeArg { + // Production: sig("Named",[arg("org.rascalmpl.ast.Type","type"),arg("org.rascalmpl.ast.Name","name")],breakable=false) + + + private final org.rascalmpl.ast.Type type; + private final org.rascalmpl.ast.Name name; + + public Named(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Type type, org.rascalmpl.ast.Name name) { + super(src, node); + + this.type = type; + this.name = name; + } + + @Override + public boolean isNamed() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitTypeArgNamed(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = type.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + type.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Named)) { + return false; + } + Named tmp = (Named) o; + return true && tmp.type.equals(this.type) && tmp.name.equals(this.name) ; + } + + @Override + public int hashCode() { + return 139 + 293 * type.hashCode() + 773 * name.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Type getType() { + return this.type; + } + + @Override + public boolean hasType() { + return true; + } + @Override + public org.rascalmpl.ast.Name getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(type), clone(name)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/TypeVar.java b/src/org/rascalmpl/ast/TypeVar.java new file mode 100644 index 00000000000..fe9ddcbbe12 --- /dev/null +++ b/src/org/rascalmpl/ast/TypeVar.java @@ -0,0 +1,214 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class TypeVar extends AbstractAST { + public TypeVar(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasName() { + return false; + } + + public org.rascalmpl.ast.Name getName() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasBound() { + return false; + } + + public org.rascalmpl.ast.Type getBound() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isBounded() { + return false; + } + + static public class Bounded extends TypeVar { + // Production: sig("Bounded",[arg("org.rascalmpl.ast.Name","name"),arg("org.rascalmpl.ast.Type","bound")],breakable=false) + + + private final org.rascalmpl.ast.Name name; + private final org.rascalmpl.ast.Type bound; + + public Bounded(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Name name, org.rascalmpl.ast.Type bound) { + super(src, node); + + this.name = name; + this.bound = bound; + } + + @Override + public boolean isBounded() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitTypeVarBounded(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = bound.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + bound.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Bounded)) { + return false; + } + Bounded tmp = (Bounded) o; + return true && tmp.name.equals(this.name) && tmp.bound.equals(this.bound) ; + } + + @Override + public int hashCode() { + return 293 + 421 * name.hashCode() + 467 * bound.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Name getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + @Override + public org.rascalmpl.ast.Type getBound() { + return this.bound; + } + + @Override + public boolean hasBound() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(name), clone(bound)); + } + + } + public boolean isFree() { + return false; + } + + static public class Free extends TypeVar { + // Production: sig("Free",[arg("org.rascalmpl.ast.Name","name")],breakable=false) + + + private final org.rascalmpl.ast.Name name; + + public Free(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Name name) { + super(src, node); + + this.name = name; + } + + @Override + public boolean isFree() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitTypeVarFree(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Free)) { + return false; + } + Free tmp = (Free) o; + return true && tmp.name.equals(this.name) ; + } + + @Override + public int hashCode() { + return 181 + 383 * name.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Name getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(name)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/URLChars.java b/src/org/rascalmpl/ast/URLChars.java new file mode 100644 index 00000000000..ab016bf9a01 --- /dev/null +++ b/src/org/rascalmpl/ast/URLChars.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class URLChars extends AbstractAST { + public URLChars(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends URLChars { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitURLCharsLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/UnicodeEscape.java b/src/org/rascalmpl/ast/UnicodeEscape.java new file mode 100644 index 00000000000..21170244124 --- /dev/null +++ b/src/org/rascalmpl/ast/UnicodeEscape.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class UnicodeEscape extends AbstractAST { + public UnicodeEscape(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + static public class Lexical extends UnicodeEscape { + private final java.lang.String string; + public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) { + super(src, node); + this.string = string; + } + public java.lang.String getString() { + return string; + } + + @Override + public int hashCode() { + return string.hashCode(); + } + + @Override + public boolean equals(Object o) { + return o instanceof Lexical && ((Lexical) o).string.equals(string); + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null, string); + } + + @Override + public AbstractAST findNode(int offset) { + if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) { + return this; + } + return null; + } + + public java.lang.String toString() { + return string; + } + public T accept(IASTVisitor v) { + return v.visitUnicodeEscapeLexical(this); + } +} + + +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/UserType.java b/src/org/rascalmpl/ast/UserType.java new file mode 100644 index 00000000000..4412e457c6d --- /dev/null +++ b/src/org/rascalmpl/ast/UserType.java @@ -0,0 +1,216 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class UserType extends AbstractAST { + public UserType(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasParameters() { + return false; + } + + public java.util.List getParameters() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasName() { + return false; + } + + public org.rascalmpl.ast.QualifiedName getName() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isName() { + return false; + } + + static public class Name extends UserType { + // Production: sig("Name",[arg("org.rascalmpl.ast.QualifiedName","name")],breakable=false) + + + private final org.rascalmpl.ast.QualifiedName name; + + public Name(ISourceLocation src, IConstructor node , org.rascalmpl.ast.QualifiedName name) { + super(src, node); + + this.name = name; + } + + @Override + public boolean isName() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitUserTypeName(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Name)) { + return false; + } + Name tmp = (Name) o; + return true && tmp.name.equals(this.name) ; + } + + @Override + public int hashCode() { + return 263 + 463 * name.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.QualifiedName getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(name)); + } + + } + public boolean isParametric() { + return false; + } + + static public class Parametric extends UserType { + // Production: sig("Parametric",[arg("org.rascalmpl.ast.QualifiedName","name"),arg("java.util.List\","parameters")],breakable=false) + + + private final org.rascalmpl.ast.QualifiedName name; + private final java.util.List parameters; + + public Parametric(ISourceLocation src, IConstructor node , org.rascalmpl.ast.QualifiedName name, java.util.List parameters) { + super(src, node); + + this.name = name; + this.parameters = parameters; + } + + @Override + public boolean isParametric() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitUserTypeParametric(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : parameters) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Parametric)) { + return false; + } + Parametric tmp = (Parametric) o; + return true && tmp.name.equals(this.name) && tmp.parameters.equals(this.parameters) ; + } + + @Override + public int hashCode() { + return 223 + 139 * name.hashCode() + 347 * parameters.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.QualifiedName getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + @Override + public java.util.List getParameters() { + return this.parameters; + } + + @Override + public boolean hasParameters() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(name), clone(parameters)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Variable.java b/src/org/rascalmpl/ast/Variable.java new file mode 100644 index 00000000000..cd729995ec5 --- /dev/null +++ b/src/org/rascalmpl/ast/Variable.java @@ -0,0 +1,214 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Variable extends AbstractAST { + public Variable(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasInitial() { + return false; + } + + public org.rascalmpl.ast.Expression getInitial() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasName() { + return false; + } + + public org.rascalmpl.ast.Name getName() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isInitialized() { + return false; + } + + static public class Initialized extends Variable { + // Production: sig("Initialized",[arg("org.rascalmpl.ast.Name","name"),arg("org.rascalmpl.ast.Expression","initial")],breakable=false) + + + private final org.rascalmpl.ast.Name name; + private final org.rascalmpl.ast.Expression initial; + + public Initialized(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Name name, org.rascalmpl.ast.Expression initial) { + super(src, node); + + this.name = name; + this.initial = initial; + } + + @Override + public boolean isInitialized() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitVariableInitialized(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = initial.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + initial.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Initialized)) { + return false; + } + Initialized tmp = (Initialized) o; + return true && tmp.name.equals(this.name) && tmp.initial.equals(this.initial) ; + } + + @Override + public int hashCode() { + return 557 + 131 * name.hashCode() + 797 * initial.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Name getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getInitial() { + return this.initial; + } + + @Override + public boolean hasInitial() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(name), clone(initial)); + } + + } + public boolean isUnInitialized() { + return false; + } + + static public class UnInitialized extends Variable { + // Production: sig("UnInitialized",[arg("org.rascalmpl.ast.Name","name")],breakable=false) + + + private final org.rascalmpl.ast.Name name; + + public UnInitialized(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Name name) { + super(src, node); + + this.name = name; + } + + @Override + public boolean isUnInitialized() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitVariableUnInitialized(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof UnInitialized)) { + return false; + } + UnInitialized tmp = (UnInitialized) o; + return true && tmp.name.equals(this.name) ; + } + + @Override + public int hashCode() { + return 149 + 877 * name.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Name getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(name)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Variant.java b/src/org/rascalmpl/ast/Variant.java new file mode 100644 index 00000000000..81f794323ca --- /dev/null +++ b/src/org/rascalmpl/ast/Variant.java @@ -0,0 +1,168 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Variant extends AbstractAST { + public Variant(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasArguments() { + return false; + } + + public java.util.List getArguments() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasKeywordArguments() { + return false; + } + + public org.rascalmpl.ast.KeywordFormals getKeywordArguments() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasName() { + return false; + } + + public org.rascalmpl.ast.Name getName() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isNAryConstructor() { + return false; + } + + static public class NAryConstructor extends Variant { + // Production: sig("NAryConstructor",[arg("org.rascalmpl.ast.Name","name"),arg("java.util.List\","arguments"),arg("org.rascalmpl.ast.KeywordFormals","keywordArguments")],breakable=false) + + + private final org.rascalmpl.ast.Name name; + private final java.util.List arguments; + private final org.rascalmpl.ast.KeywordFormals keywordArguments; + + public NAryConstructor(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Name name, java.util.List arguments, org.rascalmpl.ast.KeywordFormals keywordArguments) { + super(src, node); + + this.name = name; + this.arguments = arguments; + this.keywordArguments = keywordArguments; + } + + @Override + public boolean isNAryConstructor() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitVariantNAryConstructor(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = name.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + name.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : arguments) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + $l = keywordArguments.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + keywordArguments.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof NAryConstructor)) { + return false; + } + NAryConstructor tmp = (NAryConstructor) o; + return true && tmp.name.equals(this.name) && tmp.arguments.equals(this.arguments) && tmp.keywordArguments.equals(this.keywordArguments) ; + } + + @Override + public int hashCode() { + return 401 + 787 * name.hashCode() + 239 * arguments.hashCode() + 997 * keywordArguments.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Name getName() { + return this.name; + } + + @Override + public boolean hasName() { + return true; + } + @Override + public java.util.List getArguments() { + return this.arguments; + } + + @Override + public boolean hasArguments() { + return true; + } + @Override + public org.rascalmpl.ast.KeywordFormals getKeywordArguments() { + return this.keywordArguments; + } + + @Override + public boolean hasKeywordArguments() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(name), clone(arguments), clone(keywordArguments)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Visibility.java b/src/org/rascalmpl/ast/Visibility.java new file mode 100644 index 00000000000..153a25a5b71 --- /dev/null +++ b/src/org/rascalmpl/ast/Visibility.java @@ -0,0 +1,198 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Visibility extends AbstractAST { + public Visibility(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + + + + + public boolean isDefault() { + return false; + } + + static public class Default extends Visibility { + // Production: sig("Default",[],breakable=false) + + + + public Default(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isDefault() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitVisibilityDefault(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Default)) { + return false; + } + Default tmp = (Default) o; + return true ; + } + + @Override + public int hashCode() { + return 641 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isPrivate() { + return false; + } + + static public class Private extends Visibility { + // Production: sig("Private",[],breakable=false) + + + + public Private(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isPrivate() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitVisibilityPrivate(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Private)) { + return false; + } + Private tmp = (Private) o; + return true ; + } + + @Override + public int hashCode() { + return 701 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } + public boolean isPublic() { + return false; + } + + static public class Public extends Visibility { + // Production: sig("Public",[],breakable=false) + + + + public Public(ISourceLocation src, IConstructor node ) { + super(src, node); + + } + + @Override + public boolean isPublic() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitVisibilityPublic(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Public)) { + return false; + } + Public tmp = (Public) o; + return true ; + } + + @Override + public int hashCode() { + return 13 ; + } + + + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null ); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/ast/Visit.java b/src/org/rascalmpl/ast/Visit.java new file mode 100644 index 00000000000..31ee6b548a6 --- /dev/null +++ b/src/org/rascalmpl/ast/Visit.java @@ -0,0 +1,263 @@ +/******************************************************************************* + * Copyright (c) 2009-2015 CWI + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI + * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl + * * Paul Klint - Paul.Klint@cwi.nl - CWI + * * Mark Hills - Mark.Hills@cwi.nl (CWI) + * * Arnold Lankamp - Arnold.Lankamp@cwi.nl + * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI + *******************************************************************************/ +package org.rascalmpl.ast; + + +import io.usethesource.vallang.IConstructor; +import io.usethesource.vallang.ISourceLocation; + +@SuppressWarnings(value = {"unused"}) +public abstract class Visit extends AbstractAST { + public Visit(ISourceLocation src, IConstructor node) { + super(src /* we forget node on purpose */); + } + + + public boolean hasCases() { + return false; + } + + public java.util.List getCases() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasSubject() { + return false; + } + + public org.rascalmpl.ast.Expression getSubject() { + throw new UnsupportedOperationException(this.src.toString()); + } + public boolean hasStrategy() { + return false; + } + + public org.rascalmpl.ast.Strategy getStrategy() { + throw new UnsupportedOperationException(this.src.toString()); + } + + + + + public boolean isDefaultStrategy() { + return false; + } + + static public class DefaultStrategy extends Visit { + // Production: sig("DefaultStrategy",[arg("org.rascalmpl.ast.Expression","subject"),arg("java.util.List\","cases")],breakable=false) + + + private final org.rascalmpl.ast.Expression subject; + private final java.util.List cases; + + public DefaultStrategy(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Expression subject, java.util.List cases) { + super(src, node); + + this.subject = subject; + this.cases = cases; + } + + @Override + public boolean isDefaultStrategy() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitVisitDefaultStrategy(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = subject.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + subject.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : cases) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof DefaultStrategy)) { + return false; + } + DefaultStrategy tmp = (DefaultStrategy) o; + return true && tmp.subject.equals(this.subject) && tmp.cases.equals(this.cases) ; + } + + @Override + public int hashCode() { + return 179 + 797 * subject.hashCode() + 101 * cases.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Expression getSubject() { + return this.subject; + } + + @Override + public boolean hasSubject() { + return true; + } + @Override + public java.util.List getCases() { + return this.cases; + } + + @Override + public boolean hasCases() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(subject), clone(cases)); + } + + } + public boolean isGivenStrategy() { + return false; + } + + static public class GivenStrategy extends Visit { + // Production: sig("GivenStrategy",[arg("org.rascalmpl.ast.Strategy","strategy"),arg("org.rascalmpl.ast.Expression","subject"),arg("java.util.List\","cases")],breakable=false) + + + private final org.rascalmpl.ast.Strategy strategy; + private final org.rascalmpl.ast.Expression subject; + private final java.util.List cases; + + public GivenStrategy(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Strategy strategy, org.rascalmpl.ast.Expression subject, java.util.List cases) { + super(src, node); + + this.strategy = strategy; + this.subject = subject; + this.cases = cases; + } + + @Override + public boolean isGivenStrategy() { + return true; + } + + @Override + public T accept(IASTVisitor visitor) { + return visitor.visitVisitGivenStrategy(this); + } + + @Override + protected void addForLineNumber(int $line, java.util.List $result) { + if (getLocation().getBeginLine() == $line) { + $result.add(this); + } + ISourceLocation $l; + + $l = strategy.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + strategy.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + $l = subject.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + subject.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + for (AbstractAST $elem : cases) { + $l = $elem.getLocation(); + if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { + $elem.addForLineNumber($line, $result); + } + if ($l.getBeginLine() > $line) { + return; + } + + } + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof GivenStrategy)) { + return false; + } + GivenStrategy tmp = (GivenStrategy) o; + return true && tmp.strategy.equals(this.strategy) && tmp.subject.equals(this.subject) && tmp.cases.equals(this.cases) ; + } + + @Override + public int hashCode() { + return 17 + 797 * strategy.hashCode() + 499 * subject.hashCode() + 347 * cases.hashCode() ; + } + + + @Override + public org.rascalmpl.ast.Strategy getStrategy() { + return this.strategy; + } + + @Override + public boolean hasStrategy() { + return true; + } + @Override + public org.rascalmpl.ast.Expression getSubject() { + return this.subject; + } + + @Override + public boolean hasSubject() { + return true; + } + @Override + public java.util.List getCases() { + return this.cases; + } + + @Override + public boolean hasCases() { + return true; + } + + @Override + public Object clone() { + return newInstance(getClass(), src, (IConstructor) null , clone(strategy), clone(subject), clone(cases)); + } + + } +} \ No newline at end of file diff --git a/src/org/rascalmpl/compiler/BreakingChanges.rsc b/src/org/rascalmpl/compiler/BreakingChanges.rsc new file mode 100644 index 00000000000..f441e4cdfea --- /dev/null +++ b/src/org/rascalmpl/compiler/BreakingChanges.rsc @@ -0,0 +1,83 @@ +module BreakingChanges + +import IO; +import Map; +import ValueIO; +import Location; +import Set; +import String; +import util::FileSystem; +import lang::rascalcore::check::RascalConfig; +import analysis::typepal::TModel; + +map[loc,loc] breakingDiffs(TModel old, TModel new){ + missing = domain(old.logical2physical) - domain(new.logical2physical); + return domainR(old.logical2physical, missing); +} + +set[loc] getTPLs(loc repo) + = find(repo, "tpl"); + +bool requireDetails(str path, set[str] details) + = !isEmpty(details) && any(d <- details, contains(path, d)); + +set[loc] similar(loc d, TModel new){ + dpath = d.path; + n = findLast(dpath, "$"); + if(n >=0){ + dpath = dpath[..n]; + } + found = {}; + for(x <- new.logical2physical){ + if(startsWith(x.path, dpath)){ + found += x; + } + } + return found; +} +void reportDiffs(map[loc,loc] diffs, TModel old, TModel new){ + for(d <- diffs){ + println("old : "); + for(s <- similar(d, new)){ + println("new : "); + } + } +} +void breaking(loc old, loc new, set[str] details = {}){ + oldTPLs = getTPLs(old); oldRelTPLs = {relativize(old, tpl) | tpl <- oldTPLs}; + newTPLs = getTPLs(new); newRelTPLs = {relativize(new, tpl) | tpl <- newTPLs}; + set[str] removed = {}; + nchanges = 0; + for(oldRelTPL <- oldRelTPLs){ + oldPath = oldRelTPL.path; + tmOld = readBinaryValueFile(#TModel, old + oldPath); + if(exists(new + oldPath)){ + tmNew = readBinaryValueFile(#TModel, new + oldPath); + b = breakingDiffs(tmOld, tmNew); + if(!isEmpty(b)){ + nchanges += size(b); + println("- changes"); + if(requireDetails(oldPath, details)){ + reportDiffs(b, tmOld, tmNew); + } + } + } else { + removed += oldPath; + println("- was removed"); + } + } + println("\nSUMMARY + ' Old: , tpls, + ' New: , tpls + ' Files in Old not in New: + ' <}> + ' New files in New: + ' <}> + ' Breaking changes: "); +} + +void main(loc old = |mvn://org.rascalmpl--rascal--0.40.17|, + loc new = |mvn://org.rascalmpl--rascal--0.41.0-RC54|, + set[str] details = {"Content"}){ + breaking(old, new, details = details); +} \ No newline at end of file diff --git a/src/org/rascalmpl/compiler/CheckTestSources.rsc b/src/org/rascalmpl/compiler/CheckTestSources.rsc new file mode 100644 index 00000000000..9fcd3de8496 --- /dev/null +++ b/src/org/rascalmpl/compiler/CheckTestSources.rsc @@ -0,0 +1,122 @@ +@license{ +Copyright (c) 2018-2025, NWO-I CWI, Swat.engineering and Paul Klint +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +} +module CheckTestSources + +import IO; +import String; +import Set; +import List; +import util::Reflective; +import lang::rascalcore::check::Checker; +import util::FileSystem; +import util::Benchmark; +import lang::rascalcore::compile::util::Names; +import lang::rascalcore::check::RascalConfig; +import lang::rascalcore::check::TestConfigs; + + +void main() = checkTestSources([]); + +// if cmdLineArgs contains "all", then all files in the rascal project are used (~400 files) +// otherwise only standard library and test files (~200 files) +void main(list[str] cmdLineArgs) = checkTestSources(cmdLineArgs); + +loc REPO = |file:///Users/paulklint/git/|; + +list[str] getRascalModules(loc rootFolder, PathConfig pcfg) + = [ getModuleName(file, pcfg) + | loc file <- find(rootFolder, "rsc") + ]; + +void checkTestSources(list[str] cmdLineArgs) { + testConfig = getRascalPathConfig(); + + println("PathConfig for type checking test sources:\n"); + iprintln(testConfig); + + genCompilerConfig = getAllSrcCompilerConfig()[logPathConfig=false]; + total = 0; + + list[str] modulesToCheck = []; + pcfg = getAllSrcREPOPathConfig(keep=true); + if("all" in cmdLineArgs){ + modulesToCheck = getRascalModules(REPO + "rascal/src/org/rascalmpl/library", pcfg); + } else { + testFolders = [ //|std:///lang/rascal/tests|, + //REPO + "/rascal-core/lang/rascalcore/check::tests", + REPO + "/typepal/src/" + ]; + modulesToCheck = [ *getRascalModules(testFolder, pcfg) + | testFolder <- testFolders + ]; + } + + ignoredModules = ["lang::rascal::tests::concrete::Patterns3" // takes too long + ]; + modulesToCheck -= ignoredModules; + + list[str] exceptions = []; + int n = size(modulesToCheck); + for (i <- index(modulesToCheck)) { + m = modulesToCheck[i]; + println("Checking test module [/]"); + = safeCheck(m, genCompilerConfig); + total += d; + if(!isEmpty(e)){ + exceptions += e; + } + } + println("Checked test modules"); + println(" failed to check: "); + if(!isEmpty(ignoredModules)) { println("Ignored: "); } + secs = total/1000000000; + println("Time: seconds"); +} + +tuple[str, int] safeCheck(str \module, RascalCompilerConfig compilerConfig) { + start_time = cpuTime(); + + try { + ModuleStatus result = rascalTModelForNames([\module], + compilerConfig, + dummy_compile1); + //iprintln(result.tmodels[\module].facts); + = getTModelForModule(\module, result); + if(found && !isEmpty(tm.messages)){ + if(/error(_,_) := tm.messages){ + println("*** ERRORS ***"); + } + iprintln(tm.messages); + } + return <"", cpuTime()-start_time>; + } + catch value exception: { + println("Something unexpected went wrong during test source generation for <\module>: + ' "); + return <\module, 0>; + } +} diff --git a/src/org/rascalmpl/compiler/CompileTestSources.rsc b/src/org/rascalmpl/compiler/CompileTestSources.rsc new file mode 100644 index 00000000000..5ee3f9e6f05 --- /dev/null +++ b/src/org/rascalmpl/compiler/CompileTestSources.rsc @@ -0,0 +1,192 @@ +@license{ +Copyright (c) 2018-2025, NWO-I CWI, Swat.engineering and Paul Klint +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +} +module CompileTestSources + +// Compile: +// - selected standard libraries +// - all tests in the lang/rascal/tests folder +// - all type checker tests in "lang::rascalcore::check::tests (for now disabled) + +import IO; +import String; +import Set; +import List; +import util::Reflective; +import lang::rascalcore::compile::Compile; +import util::FileSystem; +import util::Benchmark; +import lang::rascalcore::compile::util::Names; +import lang::rascalcore::check::TestConfigs; + +loc GIT_REPO = |file:///Users/paulklint/git/|; + +PathConfig manualTestConfig= pathConfig(bin= GIT_REPO + "generated-sources/target/classes", + generatedSources = GIT_REPO + "generated-sources/target/generated-sources", + generatedResources = GIT_REPO + "generated-sources/target/classes" //|project://rascal-core/target/generated-test-resources| + ); +void main() = compileTestSources(manualTestConfig); + +void compileTestSources(PathConfig pcfg) { + testCompilerConfig = getAllSrcCompilerConfig()[logPathConfig=false]; + total = 0; + + println(readFile(|lib://rascal/META-INF/MANIFEST.MF|)); + + libraryModules = ["Boolean", + "DateTime", + "Exception", + "Grammar", + "IO", + "List", + "ListRelation", + "Location", + "Map", + "Message", + "Node", + "ParseTree", + "Prelude", + "Relation", + "Set", "String", + /*"Traversal",*/ + "Type", + "ValueIO", + "analysis::graphs::Graph", + "analysis::statistics::Correlation", + "analysis::statistics::Descriptive", + "analysis::statistics::Frequency", + "analysis::statistics::Inference", + "analysis::statistics::SimpleRegression", + "lang::csv::IO", + "lang::json::IO", + "lang::manifest::IO", + "lang::rascal::syntax::Rascal", + "lang::xml::DOM", + "lang::xml::IO", + "util::FileSystem", + "util::Math", + "util::Maybe", + "util::Memo", + "util::PriorityQueue", + "util::Reflective", + "util::SemVer", + "util::UUID", + + "analysis::m3::AST", + "analysis::m3::Core", + "analysis::m3::FlowGraph", + "analysis::m3::Registry", + "analysis::m3::TypeSymbol"]; + + // list[str] checkerTestModules = [ + // "lang::rascalcore::check::tests::AccumulatingTCTests", + // "lang::rascalcore::check::tests::AliasTests", + // "lang::rascalcore::check::tests::AllStaticIussues", + // "lang::rascalcore::check::tests::AllStaticIssuesUsingStdLib", + // "lang::rascalcore::check::tests::AnnotationTCTests", + // "lang::rascalcore::check::tests::AnnotationUsingStdLibTCTests", + // "lang::rascalcore::check::tests::AssignmentTCTests", + // "lang::rascalcore::check::tests::ATypeInstantiationTests", + // "lang::rascalcore::check::tests::ATypeTests", + // "lang::rascalcore::check::tests::BooleanTCTests", + // "lang::rascalcore::check::tests::BooleanUsingStdLibTCTests", + // "lang::rascalcore::check::tests::CallTCTests", + // "lang::rascalcore::check::tests::CallUsingStdLibTCTests", + // "lang::rascalcore::check::tests::ComprehensionTCTests", + // "lang::rascalcore::check::tests::DataDeclarationTCTests", + // "lang::rascalcore::check::tests::DataTypeTCTests", + // "lang::rascalcore::check::tests::DeclarationTCTests", + // "lang::rascalcore::check::tests::ImportTCTests", + // "lang::rascalcore::check::tests::InferenceTCTests", + // "lang::rascalcore::check::tests::ParameterizedTCTests", + // "lang::rascalcore::check::tests::PatternTCTests", + // "lang::rascalcore::check::tests::PatternUsingStdLibTCTests", + // "lang::rascalcore::check::tests::ProjectTCTests", + // "lang::rascalcore::check::tests::RegExpTCTests", + // "lang::rascalcore::check::tests::ScopeTCTests", + // "lang::rascalcore::check::tests::StatementTCTests", + // "lang::rascalcore::check::tests::StaticTestsingUtilsTests", + // "lang::rascalcore::check::tests::StaticTestingUsingStdLibTests", + // "lang::rascalcore::check::tests::SubscriptTCTests", + // "lang::rascalcore::check::tests::VisitTCTests" + // ]; + + + // for (m <- libraryModules) { + // = safeCompile(m, testCompilerConfig); + // total += d; + // } + + //for (m <- checkerTestModules) { + // = safeCompile(m, testConfig, testCompilerConfig); + // total += d; + //} + + testFolder = |std:///lang/rascal/|; + + testModules = [ replaceAll(file[extension=""].path[1..], "/", "::") + | loc file <- find(testFolder, "rsc") // all Rascal source files + ]; + + ignoredModules = ["lang::rascal::tests::concrete::Patterns3" // takes too long + ]; + testModules -= ignoredModules; + println("Compiling test modules:"); + println(testModules); + + list[str] exceptions = []; + int n = size(testModules); + for (i <- index(testModules)) { + m = testModules[i]; + println("Compiling test module [/]"); + = safeCompile(m, testCompilerConfig); + total += d; + if(!isEmpty(e)){ + exceptions += e; + } + } + println("Compiled test modules"); + println(" failed to compile: "); + if(!isEmpty(ignoredModules)) { println("Ignored: "); } + secs = total/1000000000; + println("Time: seconds"); +} + +tuple[str, int] safeCompile(str \module, RascalCompilerConfig compilerConfig) { + start_time = cpuTime(); + try { + msgs = compile(\module, compilerConfig); + if(!isEmpty(msgs)){ + iprintln(msgs); + } + return <"",cpuTime()-start_time>; + } + catch value exception: { + println("Something unexpected went wrong during test source generation for <\module>: + ' "); + return <\module, 0>; + } +} diff --git a/src/org/rascalmpl/compiler/GenerateTestSources.rsc b/src/org/rascalmpl/compiler/GenerateTestSources.rsc new file mode 100644 index 00000000000..dbe705d66ff --- /dev/null +++ b/src/org/rascalmpl/compiler/GenerateTestSources.rsc @@ -0,0 +1,126 @@ +@license{ +Copyright (c) 2018-2025, NWO-I CWI, Swat.engineering and Paul Klint +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +} +module GenerateTestSources + +import IO; +import String; +import Set; +import List; +import Map; +import util::Reflective; +import lang::rascalcore::compile::Compile; +import util::FileSystem; +import util::Monitor; +import util::Benchmark; +import lang::rascalcore::compile::util::Names; +import util::SystemAPI; +import lang::rascalcore::check::TestConfigs; + +// if cmdLineArgs contains "all", then all files in the rascal project are used (~400 files) +// otherwise only standard library and test files (~200 files) +void main(list[str] cmdLineArgs) = generateTestSources(cmdLineArgs); + +void main() = main([]); + +loc GIT_REPO = |file:///Users/paulklint/git/|; + +list[str] getRascalModules(loc rootFolder, PathConfig pcfg) + = [ getModuleName(file, pcfg) //replaceAll(file[extension=""].path[1..], "/", "::") + | loc file <- find(rootFolder, "rsc") + ]; + +void generateTestSources(list[str] cmdLineArgs) { + if ("rascal.generateSources.skip" in getSystemProperties()) { + println("Skipping the generation of test sources."); + return; + } + + pcfg = getAllSrcREPOPathConfig(keep=true); + genCompilerConfig = getAllSrcREPOCompilerConfig(pcfg, keep=true); + + map[str,int] durations = (); + + list[str] modulesToCompile = []; + + if("all" in cmdLineArgs){ + modulesToCompile = getRascalModules(GIT_REPO + "rascal/src/org/rascalmpl/library", pcfg); + } else { + testFolders = [ GIT_REPO + "rascal/src/org/rascalmpl/library/lang/rascal/tests" + , GIT_REPO + "rascal/src/org/rascalmpl/library/lang/rascal/grammar/tests" + , GIT_REPO + "rascal/src/org/rascalmpl/library/lang/rascalcore/agrammar/tests" + // , GIT_REPO + "rascal/src/org/rascalmpl/compiler/lang/rascalcore/check/tests" + ]; + + modulesToCompile = [ *getRascalModules(testFolder, pcfg) + | testFolder <- testFolders + ]; + } + + ignoredModules = ["lang::rascal::tests::concrete::Patterns3", + "lang::rascal::syntax::tests::ExpressionGrammars", + "lang::sdf2::util::SDF2Grammar", + "lang::sdf2::util::Importer" + ]; + modulesToCompile -= ignoredModules; + + list[str] exceptions = []; + int n = size(modulesToCompile); + for (i <- index(modulesToCompile)) { + m = modulesToCompile[i]; + println("Compiling module [/]"); + e = safeCompile(m, genCompilerConfig, void (int d) { durations[m] = d; }); + if(!isEmpty(e)){ + exceptions += e; + } + } + println("Compiled modules"); + println(" failed to compile:"); iprintln(exceptions); + if(!isEmpty(ignoredModules)) { println("Ignored: "); } + secs = isEmpty(durations) ? 0 : sum(range(durations))/1000000000; + println("Time: minutes"); + //iprintln(sort({ | m <- durations}, bool (<_,int i>, <_, int j>) { return i < j; })); +} + +str safeCompile(str \module, RascalCompilerConfig compilerConfig, void (int duration) measure) { + result = ""; + try { + measure(cpuTimeOf(() { + msgs = compile(\module, compilerConfig); + if(!isEmpty(msgs)){ + iprintln(msgs); + } + errors = [ msg | msg <- msgs, msg is error ]; + result = isEmpty(errors) ? "" : ""; + })); + return result; + } + catch value exception: { + println("Something unexpected went wrong during test source generation for <\module>: + ' "); + return \module; + } +} diff --git a/src/org/rascalmpl/compiler/MeasureParsing.rsc b/src/org/rascalmpl/compiler/MeasureParsing.rsc new file mode 100644 index 00000000000..b16703dd717 --- /dev/null +++ b/src/org/rascalmpl/compiler/MeasureParsing.rsc @@ -0,0 +1,70 @@ +@license{ +Copyright (c) 2018-2025, NWO-I CWI, Swat.engineering and Paul Klint +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +} +module MeasureParsing + +import util::Reflective; +import util::Benchmark; +import lang::rascal::\syntax::Rascal; +import IO; +import ValueIO; +import lang::rascalcore::check::ModuleLocations; + +import lang::rascalcore::check::TestConfigs; + +void main(){ + pcfg = getAllSrcPathConfig(); + start_time = cpuTime(); + parse_time = 0; + read_time = 0; + write_time = 0; + for(int _ <- [1..10]){ + for(qualifiedModuleName <- ["Boolean", "Type", "ParseTree", "List"]){ + mloc = getRascalModuleLocation(qualifiedModuleName, pcfg); + ploc = |file:///tmp/.parsetree|; + //println("*** parsing from "); + start_time = cpuTime(); + pt = parseModuleWithSpaces(mloc).top; + end_time = cpuTime(); + parse_time += end_time - start_time; + begin_time = start_time; + writeBinaryValueFile(ploc, pt); + end_time = cpuTime(); + write_time += end_time - start_time; + begin_time = start_time; + + readBinaryValueFile(#Module, ploc); + end_time = cpuTime(); + read_time += end_time - start_time; + } + } + println("parse_time: "); + println("write_time: "); + println("read_time: "); + + println("parse_time / (write_time + read_time): "); + println("Total time: <(cpuTime() - start_time)/1000000> ms"); +} \ No newline at end of file diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/CompilerPathConfig.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/CompilerPathConfig.rsc new file mode 100644 index 00000000000..2cb16ea939e --- /dev/null +++ b/src/org/rascalmpl/compiler/lang/rascalcore/CompilerPathConfig.rsc @@ -0,0 +1,10 @@ +module lang::rascalcore::CompilerPathConfig + +extend util::PathConfig; + +data PathConfig( + loc generatedSources = |unknown:///|, + loc generatedTestSources = |unknown:///|, + loc generatedResources = |unknown:///|, + loc generatedTestResources = |unknown:///| +); \ No newline at end of file diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/definition/Attributes.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/definition/Attributes.rsc new file mode 100644 index 00000000000..8a8b2e52af3 --- /dev/null +++ b/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/definition/Attributes.rsc @@ -0,0 +1,67 @@ +@license{ +Copyright (c) 2018-2025, NWO-I CWI, Swat.engineering and Paul Klint +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +} +module lang::rascalcore::agrammar::definition::Attributes + +import lang::rascal::\syntax::Rascal; +import lang::rascalcore::agrammar::definition::Literals; +import lang::rascalcore::check::ATypeBase; +import IO; +import ValueIO; +import util::Maybe; + +@doc{adds an attribute to all productions it can find} +public AProduction attribute(AProduction p, AAttr a) = p[attributes=p.attributes+{a}]; + +// TODO: the result set is always empty it seems. FixMe! +public set[AAttr] mods2attrs(ProdModifier* mods) = {mod2attr(m) | ProdModifier m <- mods}; + +public AAttr mod2attr(ProdModifier m) { + switch (m) { + case \associativity(\left()) : return \aassoc(aleft()); + case \associativity(\right()) : return \aassoc(aright()); + case \associativity(\nonAssociative()) : return \aassoc(\a-non-assoc()); + case \associativity(\associative()) : return \aassoc(\aassoc()); + case \bracket() : return \abracket(); + case \tag(\default(Name n, TagString s)) : return \atag(""("")); + case \tag(\empty(Name n)) : return \atag(""()); + case \tag(\expression(Name n, literal(string(nonInterpolated(StringConstant l))))) + : return \atag(""("")); + case \tag(\expression(Name n, literal(Literal l))) + : return \atag(""("")>")); + case \tag(\expression(Name n, Expression e)) + : return \atag(""( readTextValueString(""))); + default: { rprintln(m); throw "mod2attr, missed a case "; } + } +} + +Maybe[AAssociativity] mods2assoc(ProdModifier* mods) = (nothing() | just(x) | ProdModifier m <- mods, just(AAssociativity x) := mod2assoc(m)); + +Maybe[AAssociativity] mod2assoc(\associativity(\left())) = just(aleft()); +Maybe[AAssociativity] mod2assoc(\associativity(\right())) = just(aright()); +Maybe[AAssociativity] mod2assoc(\associativity(\associative())) = just(aleft()); +Maybe[AAssociativity] mod2assoc(\associativity(\nonAssociative())) = just(\a-non-assoc()); +default Maybe[AAssociativity] mod2assoc(ProdModifier _) = nothing(); diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/definition/Characters.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/definition/Characters.rsc new file mode 100644 index 00000000000..8e260a699cc --- /dev/null +++ b/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/definition/Characters.rsc @@ -0,0 +1,402 @@ +@license{ +Copyright (c) 2018-2025, NWO-I CWI, Swat.engineering and Paul Klint +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +} +@contributor{Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI} +@contributor{Arnold Lankamp - Arnold.Lankamp@cwi.nl} +@doc{ + In this module character classes are normalized. + + It also provides a number of convenience functions on character classes. +} +module lang::rascalcore::agrammar::definition::Characters + +import lang::rascal::\syntax::Rascal; +extend lang::rascalcore::check::ATypeBase; +import String; +import List; + +//data AType; +data ACharRange = \empty-range(); + +ACharRange \new-range(int from, int to) = from <= to ? arange(from, to) : \empty-range(); + +public AType \new-char-class(list[ACharRange] ranges) + = \achar-class(([] | union(it, [r]) | r <- ranges)); + +//test bool testFlip() = \new-char-class([range(2,2), range(1,1)]) == \achar-class([range(1,2)]); +//test bool testMerge() = \new-char-class([range(3,4), range(2,2), range(1,1)]) == \achar-class([range(1,4)]); +//test bool testEnvelop() = \new-char-class([range(10,20), range(15,20), range(20,30)]) == \achar-class([range(10,30)]); +//test bool testEnvelop2() = \new-char-class([range(10,20), range(10,19), range(20,30)]) == \achar-class([range(10,30)]); + +public AType complement(\achar-class(list[ACharRange] r1)) = + \achar-class([ r | r <- complement(r1), !(r is \empty-range)]); + +public default AType complement(AType s) { + throw "unsupported symbol for character class complement: "; +} + +public AType difference(\achar-class(list[ACharRange] r1), \achar-class(list[ACharRange] r2)){ + res = \achar-class([r | r <- difference(r1,r2), !(r is \empty-range)]); + return res; +} + +public default AType difference(AType s, AType t) { + throw "unsupported symbols for character class difference: and "; +} + +public AType union(\achar-class(list[ACharRange] r1), \achar-class(list[ACharRange] r2)) + = \achar-class([ r | r <- union(r1,r2), !(r is \empty-range)]); + +public default AType union(AType s, AType t) { + throw "unsupported symbols for union: and "; +} + +public AType intersection(\achar-class(list[ACharRange] r1), \achar-class(list[ACharRange] r2)) + = \achar-class([ r | r <- intersection(r1,r2), !(r is \empty-range)]); + +public default AType intersection(AType s, AType t) { + throw "unsupported symbols for intersection: and "; +} + +public bool lessThan(ACharRange r1, ACharRange r2) { + if (ACharRange::arange(_,e1) := r1, ACharRange::arange(s2,_) := r2) { + return e1 < s2; + } + throw "unexpected ranges and "; +} + +public ACharRange difference(ACharRange l, ACharRange r) { + if (l == \empty-range() || r == \empty-range()) return l; + + if (arange(ls,le) := l, arange(rs,re) := r) { + // left beyond right + // <-right-> -------- + // --------- <-left-> + if (ls > re) + return l; + + // left before right + // <-left-> ---------- + // -------- <-right-> + if (le < rs) + return l; + + // inclusion of left into right + // ---------<-left->----- + if (ls >= rs && le <= re) + return \empty-range(); + + // inclusion of right into left + // -------<-right->-------> + // <---------left---------> + if (rs >= ls && re <= le) + return \new-range(ls,rs-1); + + // overlap on left side of right + // <--left-------->---------- + // ---------<-----right-----> + if (le < re) + return \new-range(ls,rs-1); + + // overlap on right side of right + // -------------<---left----> + // <----right------->-------- + if (ls > rs) + return arange(re+1,le); + + } + + throw "did not expect to end up here! - "; +} + +public ACharRange intersect(ACharRange r1, ACharRange r2) { + if (r1 == \empty-range() || r2 == \empty-range()) return \empty-range(); + + if (arange(s1,e1) := r1, arange(s2,e2) := r2) { + // left beyond right + // <-right-> -------- + // --------- <-left-> + if (s1 > e2) + return \empty-range(); + + // left before right + // <-left-> ---------- + // -------- <-right-> + if (e1 < s2) + return \empty-range(); + + // inclusion of left into right + // <--------right-------> + // ---------<-left->----- + if (s1 >= s2 && e1 <= e2) + return r1; + + // inclusion of right into left + // -------<-right->-------> + // <---------left---------> + if (s2 >= s1 && e2 <= e1) + return r2; + + // overlap on left side of right + // <--left-------->---------- + // ---------<-----right-----> + if (e1 < e2) + return arange(s2,e1); + + // overlap on right side of right + // -------------<---left----> + // <----right------->-------- + if (s1 > s2) + return arange(s1,e2); + } + + throw "unexpected ranges and "; +} + +public list[ACharRange] complement(list[ACharRange] s) { + return difference([arange(1,0x10FFFF)],s); // the 0 character is excluded +} + +public list[ACharRange] intersection(list[ACharRange] l, list[ACharRange] r) { + if (l == r) return l; + if (l == [] || r == []) return []; + + = ; + = ; + + if (lhead == \empty-range()) + return intersection(ltail, r); + + if (rhead == \empty-range()) + return intersection(l, rtail); + + // left beyond right + // <-right-> -------- + // --------- <-left-> + if (lhead.begin > rhead.end) + return intersection(l,rtail); + + // left before right + // <-left-> ---------- + // -------- <-right-> + if (lhead.end < rhead.begin) + return intersection(ltail,r); + + // inclusion of left into right + // <--------right-------> + // ---------<-left->----- + if (lhead.begin >= rhead.begin && lhead.end <= rhead.end) + return lhead + intersection(ltail,r); + + // inclusion of right into left + // -------<-right->-------> + // <---------left---------> + if (rhead.begin >= lhead.begin && rhead.end <= lhead.end) + return rhead + intersection(l,rtail); + + // overlap on left side of right + // <--left-------->---------- + // ---------<-----right-----> + if (lhead.end < rhead.end) + return arange(rhead.begin,lhead.end) + intersection(ltail,r); + + // overlap on right side of right + // -------------<---left----> + // <----right------->-------- + if (lhead.begin > rhead.begin) + return arange(lhead.begin,rhead.end) + intersection(l,rtail); + + throw "did not expect to end up here! - "; + +} + +public list[ACharRange] union(list[ACharRange] l, list[ACharRange] r) { + if (l == r) return l; + if (l == []) return r; + if (r == []) return l; + + = ; + = ; + + if (lhead == \empty-range()) + return union(ltail, r); + + if (rhead == \empty-range()) + return union(l, rtail); + + // left beyond right + // <-right-> -------- + // --------- <-left-> + if (lhead.begin > rhead.end + 1) + return rhead + union(l,rtail); + + // left before right + // <-left-> ---------- + // -------- <-right-> + if (lhead.end + 1< rhead.begin) + return lhead + union(ltail,r); + + // inclusion of left into right + // <--------right-------> + // ---------<-left->----- + if (lhead.begin >= rhead.begin && lhead.end <= rhead.end) + return union(ltail,r); + + // inclusion of right into left + // -------<-right->-------> + // <---------left---------> + if (rhead.begin >= lhead.begin && rhead.end <= lhead.end) + return union(l,rtail); + + // overlap on left side of right + // <--left-------->---------- + // ---------<-----right-----> + if (lhead.end < rhead.end) + return union(arange(lhead.begin,rhead.end) + ltail, rtail); + + // overlap on right side of right + // -------------<---left----> + // <----right------->-------- + if (lhead.begin > rhead.begin) + return union(ltail,arange(rhead.begin,lhead.end) + rtail); + + throw "did not expect to end up here! - "; + +} + +// Take difference of two lists of ranges +// Precondition: both lists are ordered +// Postcondition: resulting list is ordered + +public list[ACharRange] difference(list[ACharRange] l, list[ACharRange] r) { + if (l == [] || r == []) return l; + if (l == r) return []; + + = ; + = ; + + if (lhead == \empty-range()) + return difference(ltail, r); + + if (rhead == \empty-range()) + return difference(l, rtail); + + // left beyond right + // <-right-> -------- + // --------- <-left-> + if (lhead.begin > rhead.end) + return difference(l,rtail); + + // left before right + // <-left-> ---------- + // -------- <-right-> + if (lhead.end < rhead.begin) + return lhead + difference(ltail,r); + + // inclusion of left into right + // <--------right-------> + // ---------<-left->----- + if (lhead.begin >= rhead.begin && lhead.end <= rhead.end) + return difference(ltail,r); + + // inclusion of right into left + // -------<-right->-------> + // <---------left---------> + if (rhead.begin >= lhead.begin && rhead.end <= lhead.end) + return \new-range(lhead.begin,rhead.begin-1) + + difference(\new-range(rhead.end+1,lhead.end)+ltail,rtail); + + // overlap on left side of right + // <--left-------->---------- + // ---------<-----right-----> + if (lhead.end < rhead.end) + return \new-range(lhead.begin,rhead.begin-1) + difference(ltail,r); + + // overlap on right side of right + // -------------<---left----> + // <----right------->-------- + if (lhead.begin > rhead.begin) + return difference(arange(rhead.end+1,lhead.end)+ltail, rtail); + + throw "did not expect to end up here! - "; +} + +//test bool testComp() = complement(\achar-class([])) == \achar-class([range(1,16777215)]); +//test bool testComp2() = complement(\achar-class([range(0,0)])) == \achar-class([range(1,16777215)]); +//test bool testComp3() = complement(\achar-class([range(1,1)])) == \achar-class([range(2,16777215)]); +//test bool testComp4() = complement(\achar-class([range(10,20), range(30,40)])) == \achar-class([range(1,9),range(21,29),range(41,16777215)]); +//test bool testComp5() = complement(\achar-class([range(10,35), range(30,40)])) == \achar-class([range(1,9),range(41,16777215)]); +// +//test bool testUnion1() = union(\achar-class([range(10,20)]), \achar-class([range(30, 40)])) == \achar-class([range(10,20), range(30,40)]); +//test bool testUnion2() = union(\achar-class([range(10,25)]), \achar-class([range(20, 40)])) == \achar-class([range(10,40)]); +// +//test bool testInter1() = intersection(\achar-class([range(10,20)]), \achar-class([range(30, 40)])) == \achar-class([]); +//test bool testInter2() = intersection(\achar-class([range(10,25)]), \achar-class([range(20, 40)])) == \achar-class([range(20, 25)]); +// +//test bool testDiff1() = difference(\achar-class([range(10,30)]), \achar-class([range(20,25)])) == \achar-class([range(10,19), range(26,30)]); +//test bool testDiff2() = difference(\achar-class([range(10,30), range(40,50)]), \achar-class([range(25,45)])) ==\achar-class( [range(10,24), range(46,50)]); + +public AType cc2ranges(Class cc) { + switch(cc) { + case Class::\simpleCharclass(Range* ranges) : return \new-char-class([range(r) | r <- ranges]); + case Class::\bracket(Class c): return cc2ranges(c); + case Class::\complement(Class c) : return complement(cc2ranges(c)); + case Class::\intersection(Class l, Class r) : return intersection(cc2ranges(l), cc2ranges(r)); + case Class::\union(Class l, Class r): return union(cc2ranges(l), cc2ranges(r)); + case Class::\difference(Class l, Class r): return difference(cc2ranges(l), cc2ranges(r)); + default: throw "cc2ranges, missed a case "; + } +} + +private ACharRange range(Range r) { + switch (r) { + case character(Char c) : return arange(charToInt(c),charToInt(c)); + case fromTo(Char l1, Char r1) : { + = ; + // users may flip te ranges, but after this reversed ranges will results in empty ranges + return cL <= cR ? arange(cL, cR) : arange(cR, cL); + } + default: throw "range, missed a case "; + } +} + +private int charToInt(Char c) { + switch (c) { + case [Char] /^\< ]>/ : return charAt(ch, 0); + case [Char] /^\\n/ : return charAt("\n", 0); + case [Char] /^\\t/ : return charAt("\t", 0); + case [Char] /^\\b/ : return charAt("\b", 0); + case [Char] /^\\r/ : return charAt("\r", 0); + case [Char] /^\\f/ : return charAt("\f", 0); + case [Char] /^\\\>/ : return charAt("\>", 0); + case [Char] /^\\\/ : return charAt(esc, 0); + case [Char] /^\\u/ : return toInt("0x"); + case [Char] /^\\U/ : return toInt("0x"); + case [Char] /^\\a/ : return toInt("0x"); + default: throw "charToInt, missed a case "; + } +} diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/definition/Keywords.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/definition/Keywords.rsc new file mode 100644 index 00000000000..6e927294c58 --- /dev/null +++ b/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/definition/Keywords.rsc @@ -0,0 +1,67 @@ +@license{ +Copyright (c) 2018-2025, NWO-I CWI, Swat.engineering and Paul Klint +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +} +module lang::rascalcore::agrammar::definition::Keywords + +import lang::rascalcore::check::ATypeBase; +import lang::rascalcore::check::ATypeUtils; +import lang::rascalcore::agrammar::definition::Symbols; +//import IO; +import Node; + +public AGrammar expandKeywords(AGrammar g) { + //println("expandKeywords"); iprintln(g, lineLimit=10000); + g1 = visit(g) { + case cond:AType::conditional(sym, set[ACondition] conds) => inheritLabel(cond, AType::conditional(sym, expandKeywords(g, conds))) + }; + //g1.rules = (n : g1.rules[n] | n <- g1.rules, n has syntaxRole ? (n.syntaxRole != keywordSyntax()) : true); + //println("leave expandKeywords"); + return g1; +} + +public set[ACondition] expandKeywords(AGrammar g, set[ACondition] conds) { + names = {}; + done = {}; + todo = conds; + + solve(todo) { + for (cond <- todo, !(cond in done)) { + todo -= {cond}; + + if (cond has atype, aadt(name,_,keywordSyntax()) := cond.atype) { + if (name notin names) { + names += {name}; + // println("cond = "); + todo += {cond[atype=s] | achoice(_, set[AProduction] alts) := g.rules[unset(cond.atype, "id")], prod(_,[s]) <- alts}; + } + } else { + done += cond; + } + } + } + + return done; +} diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/definition/Layout.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/definition/Layout.rsc new file mode 100644 index 00000000000..5e46e780b54 --- /dev/null +++ b/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/definition/Layout.rsc @@ -0,0 +1,73 @@ +@license{ +Copyright (c) 2018-2025, NWO-I CWI, Swat.engineering and Paul Klint +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +} +@contributor{Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI} +module lang::rascalcore::agrammar::definition::Layout + +import lang::rascalcore::check::ATypeBase; +import lang::rascalcore::check::ATypeUtils; + +@doc{intersperses layout symbols in all non-lexical productions} +public AGrammar layouts(AGrammar g, AType l, set[AType] others) { + + res = top-down-break visit (g) { + case p: prod(\start(aadt(_, list[AType] _, contextFreeSyntax())), [x]) => p[atypes=[l, x, l]] + + case p: prod(aadt(_, list[AType] _, contextFreeSyntax()), list[AType] lhs) => p[atypes=intermix(lhs, l, others)] + } + //iprintln(res); + return res; +} + +list[AType] intermix(list[AType] syms, AType l, set[AType] others) { + if (syms == []) + return syms; + + syms = [ isLayoutAType(sym) ? sym : regulars(sym, l, others) | sym <- syms ]; + others += {l}; + + // Note that if a user manually put a layouts symbol, then this code makes sure not to override it and + // not to surround it with new layout symbols + while ([*AType pre, AType sym1, AType sym2, *AType pst] := syms, !(sym1 in others || sym2 in others)) { + syms = [*pre, sym1, l, sym2, *pst]; + } + + return syms; +} +//Moved to ATypeUtils; +//private AType inheritLabel(AType x, AType y) = (x.alabel?) ? y[alabel=x.alabel] : y; + +private bool isValidSep(AType sep, set[AType] others) = !(seq([a,_,b]) := sep && (a in others || b in others)); + +public AType regulars(AType s, AType l, set[AType] others) { + return visit(s) { + case x:\iter(AType n) => inheritLabel(x, \iter-seps(n, [l])) when !isLexicalAType(x) + case x:\iter-star(AType n) => inheritLabel(x, \iter-star-seps(n, [l])) when !isLexicalAType(x) + case x:\iter-seps(AType n, [AType sep]) => inheritLabel(x, \iter-seps(n,[l,sep,l])) when !isLexicalAType(x), sep != l, sep notin others, isValidSep(sep, others) + case x:\iter-star-seps(AType n, [AType sep]) => inheritLabel(x, \iter-star-seps(n, [l, sep, l])) when !isLexicalAType(x), sep != l, sep notin others, isValidSep(sep, others) + case x:\seq(list[AType] elems) => inheritLabel(x, \seq(intermix(elems, l, others))) when !isLexicalAType(x) + } +} diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/definition/Literals.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/definition/Literals.rsc new file mode 100644 index 00000000000..9646a62fad4 --- /dev/null +++ b/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/definition/Literals.rsc @@ -0,0 +1,95 @@ +@license{ +Copyright (c) 2018-2025, NWO-I CWI, Swat.engineering and Paul Klint +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +} +@contributor{Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI} +module lang::rascalcore::agrammar::definition::Literals + +import lang::rascal::\syntax::Rascal; +import lang::rascalcore::check::ATypeBase; +import String; + +public AGrammar literals(AGrammar g) { + lts = {literal(s) | /lit(s) <- g} + {ciliteral(s) | /acilit(s) <- g}; + return compose(g, grammar({}, lts)); +} + +public AProduction literal(str s) = prod(alit(s),str2syms(s)); +public AProduction ciliteral(str s) = prod(acilit(s), cistr2syms(s)); + +public list[AType] str2syms(str x) { + if (x == "") return []; + return [\achar-class([arange(c,c)]) | i <- [0..size(x)], int c:= charAt(x,i)]; +} + +list[AType] cistr2syms(str x) { + return for (i <- [0..size(x)], int c:= charAt(x,i)) { + if (c >= 101 && c <= 132) // A-Z + append \achar-class([arange(c,c),arange(c+40,c+40)]); + else if (c >= 141 && c <= 172) // a-z + append \achar-class([arange(c,c),arange(c-40,c-40)]); + else + append \achar-class([arange(c,c)]); + } +} + +public str unescapeLiteral(CaseInsensitiveStringConstant s) = "<}>"; + +public str unescapeLiteral(StringConstant s) = "<}>"; + +public str character(StringCharacter c) { + switch (c) { + case [StringCharacter] /^\<]>/ : return ""; + case [StringCharacter] /^\\n/ : return "\n"; + case [StringCharacter] /^\\t/ : return "\t"; + case [StringCharacter] /^\\b/ : return "\b"; + case [StringCharacter] /^\\r/ : return "\r"; + case [StringCharacter] /^\\f/ : return "\f"; + case [StringCharacter] /^\\\>/ : return "\>"; + case [StringCharacter] /^\\\/ : return ""; + case [StringCharacter] /^\\u/ : return stringChar(toInt("0x")); + case [StringCharacter] /^\\U/ : return stringChar(toInt("0x")); + case [StringCharacter] /^\\a/ : return stringChar(toInt("0x")); + case [StringCharacter] /^\n[ \t]* \'/ : return "\n"; + default: throw "character, missed a case "; + } +} + +public str unescapeLiteral(str s) { + return visit (s) { + case /\\b/ => "\b" + case /\\f/ => "\f" + case /\\n/ => "\n" + case /\\t/ => "\t" + case /\\r/ => "\r" + case /\\\"/ => "\"" + case /\\\'/ => "\'" + case /\\\\/ => "\\" + case /\\\ "\<" + case /\\\>/ => "\>" + }; +} + diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/definition/Symbols.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/definition/Symbols.rsc new file mode 100644 index 00000000000..a07a75ae2e3 --- /dev/null +++ b/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/definition/Symbols.rsc @@ -0,0 +1,160 @@ +@license{ +Copyright (c) 2018-2025, NWO-I CWI, Swat.engineering and Paul Klint +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +} +module lang::rascalcore::agrammar::definition::Symbols + +import lang::rascalcore::agrammar::definition::Literals; +import lang::rascalcore::agrammar::definition::Characters; +import lang::rascal::\syntax::Rascal; +//import ParseTree; +import lang::rascalcore::check::ATypeBase; +import String; +import IO; +import Node; + + +default AType striprec(AType s_ori) = visit(s_ori) { + case AType s => strip(s) when s.alabel? + case conditional(AType s, set[ACondition] _) => strip(s) +}; +////default AType striprec(AType s) = visit(s) { case AType t => strip(t) }; + +AType strip(conditional(AType s, set[ACondition] _)) = strip(s); +default AType strip(AType s) = s.alabel? ? unset(s, "alabel") : s; + +//public bool match(AType checked, AType referenced) { +// while (checked is conditional || checked is label) +// checked = checked.symbol; +// while (referenced is conditional || referenced is label) +// referenced = referenced.symbol; +// +// return referenced == checked; +//} + +public AType delabel(AType s) = visit(s) { case AType t => unset(t, "alabel") when t.alabel? }; + +public AType sym2AType(Sym sym) { + switch (sym) { + case lang::rascal::\syntax::Rascal::nonterminal(Nonterminal n) : + return AType::aadt("", [], dataSyntax()); + case \start(Nonterminal n) : + return \start(AType::aadt("", [], dataSyntax())); + case literal(StringConstant l): + return AType::alit(unescapeLiteral(l)); + case caseInsensitiveLiteral(CaseInsensitiveStringConstant l): + return AType::acilit(unescapeLiteral(l)); + case \parametrized(Nonterminal n, {Sym ","}+ syms) : + return AType::aadt("",separgs2ATypes(syms), dataSyntax()); + case labeled(Sym s, NonterminalLabel n) : + return sym2AType(s)[alabel=""]; + case optional(Sym s) : + return AType::opt(sym2AType(s)); + case characterClass(Class cc): + return cc2ranges(cc); + case parameter(Nonterminal n) : + return AType::\aparameter("", aadt("Tree", [], contextFreeSyntax())); + case empty() : + return AType::\aempty(); + case alternative(Sym first, {Sym "|"}+ alts) : + return AType::alt({sym2AType(first)} + {sym2AType(elem) | elem <- alts}); + case iterStar(Sym s) : + return AType::\iter-star(sym2AType(s)); + case iter(Sym s) : + return AType::\iter(sym2AType(s)); + case iterStarSep(Sym s, Sym sep) : + return AType::\iter-star-seps(sym2AType(s), [sym2AType(sep)]); + case iterSep(Sym s, Sym sep) : + return AType::\iter-seps(sym2AType(s), [sym2AType(sep)]); + case sequence(Sym first, Sym+ sequence) : + return AType::seq([sym2AType(first)] + [sym2AType(elem) | elem <- sequence]); + case startOfLine(Sym s) : + return conditional(sym2AType(s), {ACondition::\a-begin-of-line()}); + case endOfLine(Sym s) : + return conditional(sym2AType(s), {ACondition::\a-end-of-line()}); + case column(Sym s, IntegerLiteral i) : + return conditional(sym2AType(s), {ACondition::\a-at-column(toInt(""))}); + case follow(Sym s, Sym r) : + return conditional(sym2AType(s), {ACondition::\follow(sym2AType(r))}); + case notFollow(Sym s, Sym r) : + return conditional(sym2AType(s), {ACondition::\not-follow(sym2AType(r))}); + case precede(Sym s, Sym r) : + return conditional(sym2AType(r), {ACondition::\precede(sym2AType(s))}); + case notPrecede(Sym s, Sym r) : + return conditional(sym2AType(r), {ACondition::\not-precede(sym2AType(s))}); + case unequal(Sym s, Sym r) : + return conditional(sym2AType(s), {ACondition::\delete(sym2AType(r))}); + case except(Sym s, NonterminalLabel n): + return conditional(sym2AType(s), {ACondition::\a-except("")}); + default: { + iprintln(sym); + throw "sym2AType, missed a case "; + } + } +} + +public AType defsym2AType(Sym sym, SyntaxRole sr) { + switch(sym){ + case lang::rascal::\syntax::Rascal::nonterminal(Nonterminal n) : + return AType::aadt("", [], sr); + + case \parametrized(Nonterminal n, {Sym ","}+ syms) : + return AType::aadt("",separgs2ATypes(syms), sr); + + case \start(Nonterminal n) : + return \start(AType::aadt("", [], sr)); + + default: { + iprintln(sym); + throw "defsym2AType, missed a case "; + } + } +} + +public list[AType] args2ATypes(Sym* args) { + return [sym2AType(s) | Sym s <- args]; +} + +public list[AType] separgs2ATypes({Sym ","}+ args) { + return [sym2AType(s) | Sym s <- args]; +} + +// flattening rules for regular expressions +//public AType seq([*AType a, AType::seq(list[AType] b), *AType c]) = AType::seq(a + b + c); + +//public AType alt({*AType a, AType::alt(set[AType] b)}) = AType::alt(a + b); + +// flattening for conditionals + +public AType \conditional(\conditional(AType s, set[ACondition] cs1), set[ACondition] cs2) + = \conditional(s, cs1 + cs2); + +public AType \conditional(AType s, set[ACondition] cs) { + // if there is a nested conditional, lift the nested conditions toplevel and make the nested AType unconditional. + if (c <- cs, c has atype, c.atype is conditional) { + return \conditional(s, {c[atype=c.atype.atype], *c.atype.conditions, *(cs - {c})}); //SPLICING + } + else fail; +} diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/tests/CharactersTests.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/tests/CharactersTests.rsc new file mode 100644 index 00000000000..f8f4cfe63d0 --- /dev/null +++ b/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/tests/CharactersTests.rsc @@ -0,0 +1,52 @@ +@license{ +Copyright (c) 2018-2025, NWO-I CWI, Swat.engineering and Paul Klint +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +} +module lang::rascalcore::agrammar::tests::CharactersTests + +import lang::rascalcore::agrammar::definition::Characters; +import lang::rascalcore::check::AType; + +test bool testFlip() = \new-char-class([arange(2,2), arange(1,1)]) == \achar-class([arange(1,2)]); +test bool testMerge() = \new-char-class([arange(3,4), arange(2,2), arange(1,1)]) == \achar-class([arange(1,4)]); +test bool testEnvelop() = \new-char-class([arange(10,20), arange(15,20), arange(20,30)]) == \achar-class([arange(10,30)]); +test bool testEnvelop2() = \new-char-class([arange(10,20), arange(10,19), arange(20,30)]) == \achar-class([arange(10,30)]); + +test bool testComp() = complement(\achar-class([])) == \achar-class([arange(1,1114111)]); +test bool testComp2() = complement(\achar-class([arange(0,0)])) == \achar-class([arange(1,1114111)]); +test bool testComp3() = complement(\achar-class([arange(1,1)])) == \achar-class([arange(2,1114111)]); +test bool testComp4() = complement(\achar-class([arange(10,20), arange(30,40)])) == \achar-class([arange(1,9),arange(21,29),arange(41,1114111)]); +test bool testComp5() = complement(\achar-class([arange(10,35), arange(30,40)])) == \achar-class([arange(1,9),arange(41,1114111)]); + +test bool testUnion1() = union(\achar-class([arange(10,20)]), \achar-class([arange(30, 40)])) == \achar-class([arange(10,20), arange(30,40)]); +test bool testUnion2() = union(\achar-class([arange(10,25)]), \achar-class([arange(20, 40)])) == \achar-class([arange(10,40)]); + +test bool testInter1() = intersection(\achar-class([arange(10,20)]), \achar-class([arange(30, 40)])) == \achar-class([]); +test bool testInter2() = intersection(\achar-class([arange(10,25)]), \achar-class([arange(20, 40)])) == \achar-class([arange(20, 25)]); + +test bool testDiff1() = difference(\achar-class([arange(10,30)]), \achar-class([arange(20,25)])) == \achar-class([arange(10,19), arange(26,30)]); +test bool testDiff2() = difference(\achar-class([arange(10,30), arange(40,50)]), \achar-class([arange(25,45)])) ==\achar-class( [arange(10,24), arange(46,50)]); + + diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/tests/LayoutTests.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/tests/LayoutTests.rsc new file mode 100644 index 00000000000..850f4645698 --- /dev/null +++ b/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/tests/LayoutTests.rsc @@ -0,0 +1,148 @@ +@license{ +Copyright (c) 2018-2025, NWO-I CWI, Swat.engineering and Paul Klint +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +} +module lang::rascalcore::agrammar::tests::LayoutTests + +//import lang::rascalcore::agrammar::definition::Grammar; +import lang::rascalcore::check::AType; +import lang::rascalcore::agrammar::definition::Layout; + +import lang::rascalcore::agrammar::tests::TestGrammars; + +test bool intermix1() = + intermix([alit("a")], layouts("$default$"), {}) == [alit("a")]; + +test bool intermix2() = + intermix([alit("a"), alit("b")], layouts("$default$"), {}) == + [alit("a"),layouts("$default$"),alit("b")]; + +test bool intermix3() = + intermix([alit("a"), alit("b"), alit("c")], layouts("$default$"), {}) == + [alit("a"),layouts("$default$"),alit("b"),layouts("$default$"),alit("c")]; + +test bool intermix4() = + intermix([alit("a"), \iter(sort("Exp")), alit("c")], layouts("$default$"), {}) + == + [ alit("a"), + layouts("$default$"), + \iter-seps( + sort("Exp"), + [layouts("$default$")]), + layouts("$default$"), + alit("c") + ]; + +test bool intermix5() = + intermix([alit("a"), \iter-star(sort("Exp")), alit("c")], layouts("$default$"), {}) + == + [ alit("a"), + layouts("$default$"), + \iter-star-seps( + sort("Exp"), + [layouts("$default$")]), + layouts("$default$"), + alit("c") + ]; + +test bool intermix6() = + intermix([alit("a"), \iter-seps(sort("Exp"), [alit("b")]), alit("c")], layouts("$default$"), {}) + == + [ alit("a"), + layouts("$default$"), + \iter-seps( + sort("Exp"), + [ layouts("$default$"), + alit("b"), + layouts("$default$") + ]), + layouts("$default$"), + alit("c") + ]; + + test bool layouts1() = + layouts(GEXP, layouts("$default$"), {}) + == + grammar( + {sort("E")}, + ( + alit("+"):achoice( + alit("+"), + {prod( + alit("+"), + [\achar-class([arange(43,43)])])}), + alit("*"):achoice( + alit("*"), + {prod( + alit("*"), + [\achar-class([arange(42,42)])])}), + sort("B"):achoice( + sort("B"), + { + prod( + sort("B"), + [alit("0")]), + prod( + sort("B"), + [alit("1")]) + }), + alit("0"):achoice( + alit("0"), + {prod( + alit("0"), + [\achar-class([arange(48,48)])])}), + sort("E"):achoice( + sort("E"), + { + prod( + sort("E"), + [sort("B")]), + prod( + sort("E"), + [ + sort("E"), + layouts("$default$"), + alit("+"), + layouts("$default$"), + sort("B") + ]), + prod( + sort("E"), + [ + sort("E"), + layouts("$default$"), + alit("*"), + layouts("$default$"), + sort("B") + ]) + }), + alit("1"):achoice( + alit("1"), + {prod( + alit("1"), + [\achar-class([arange(49,49)])])}) + )); +//value main() = +// layouts(GEXPPRIO, layouts("$default$"), {}); \ No newline at end of file diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/tests/LiteralsTests.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/tests/LiteralsTests.rsc new file mode 100644 index 00000000000..cbbc0c05593 --- /dev/null +++ b/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/tests/LiteralsTests.rsc @@ -0,0 +1,73 @@ +@license{ +Copyright (c) 2018-2025, NWO-I CWI, Swat.engineering and Paul Klint +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +} +module lang::rascalcore::agrammar::tests::LiteralsTests + +import lang::rascal::\syntax::Rascal; +import lang::rascalcore::agrammar::definition::Literals; +import lang::rascalcore::check::AType; + +test bool tstLiteral1() = literal("") == prod(alit(""),[]); +test bool tstLiteral2() = literal("a") == prod(alit("a"),[\achar-class([arange(97,97)])]); +test bool tstLiteral3() = literal("ab") == + prod(alit("ab"),[\achar-class([arange(97,97)]),\achar-class([arange(98,98)])]); + +test bool tstCiLiteral1() = ciliteral("") == prod(acilit(""),[]); +test bool tstCiLiteral2() = ciliteral("a") == prod(acilit("a"),[\achar-class([arange(97,97)])]); +test bool tstCiLiteral3() = ciliteral("ab") == + prod(acilit("ab"),[\achar-class([arange(97,97)]),\achar-class([arange(98,98)])]); + +test bool tstStr2Syms1() = str2syms("") == []; +test bool tstStr2Syms2() = str2syms("a") == [\achar-class([arange(97,97)])]; +test bool tstStr2Syms3() = str2syms("ab") == [\achar-class([arange(97,97)]),\achar-class([arange(98,98)])]; + +test bool tsCistr2syms1() = cistr2syms("") == []; +test bool tsCistr2syms2() = cistr2syms("a") == [\achar-class([arange(97,97)])]; +test bool tsCistr2syms3() = cistr2syms("A") == [\achar-class([arange(65,65)])]; + +test bool tstUnescapeSC1() = unescapeLiteral((StringConstant) `"a"`) == "a"; +test bool tstUnescapeSC2() = unescapeLiteral((StringConstant) `"\\t"`) == "\t"; +test bool tstUnescapeSC3() = unescapeLiteral((StringConstant) `"a\\tb"`) == "a\tb"; +test bool tstUnescapeSC4() = unescapeLiteral((StringConstant) `"\\'"`) == "\'"; +test bool tstUnescapeSC5() = unescapeLiteral((StringConstant) `"a\\tb\\'c"`) == "a\tb\'c"; + +test bool tstUnescapeCI1() = unescapeLiteral((CaseInsensitiveStringConstant) `'a'`) == "a"; +test bool tstUnescapeCI2() = unescapeLiteral((CaseInsensitiveStringConstant) `'\\t'`) == "\t"; +test bool tstUnescapeCI3() = unescapeLiteral((CaseInsensitiveStringConstant) `'a\\tb'`) == "a\tb"; +test bool tstUnescapeCI4() = unescapeLiteral((CaseInsensitiveStringConstant) `'\\''`) == "\'"; +test bool tstUnescapeCI5() = unescapeLiteral((CaseInsensitiveStringConstant) `'a\\tb\\'c'`) == "a\tb\'c"; + +test bool tstUnescape1() = unescapeLiteral("a") == "a"; +test bool tstUnescape2() = unescapeLiteral("\\t") == "\t"; +test bool tstUnescape3() = unescapeLiteral("a\\tb") == "a\tb"; +test bool tstUnescape4() = unescapeLiteral("\\\'") == "\'"; +test bool tstUnescape5() = unescapeLiteral("a\\tb\\\'c") == "a\tb\'c"; + +test bool tstCharacter1() = character((StringCharacter) `a`) == "a"; +test bool tstCharacter2() = character((StringCharacter) `\\t`) == "\t"; +test bool tstCharacter3() = character((StringCharacter) `\\\<`) == "\<"; +test bool tstCharacter4() = character((StringCharacter) `\\'`) == "\'"; + diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/tests/TestGrammars.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/tests/TestGrammars.rsc new file mode 100644 index 00000000000..b628ac0a141 --- /dev/null +++ b/src/org/rascalmpl/compiler/lang/rascalcore/agrammar/tests/TestGrammars.rsc @@ -0,0 +1,86 @@ +@license{ +Copyright (c) 2018-2025, NWO-I CWI, Swat.engineering and Paul Klint +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +} +module lang::rascalcore::agrammar::tests::TestGrammars + +//import lang::rascalcore::agrammar::definition::Grammar; +import lang::rascalcore::check::AType; + +public AGrammar GEMPTY = grammar({sort("S")}, ()); + +AType \sort(str sname) = aadt(sname, [], contextFreeSyntax()); + +private AProduction pr(AType rhs, list[AType] lhs) { + return prod(rhs,lhs); +} + +public AGrammar G0 = grammar({sort("S")}, ( + sort("S"): achoice(sort("S"), { pr(sort("S"), [ alit("0") ]) }), + alit("0"): achoice(alit("0"), { pr(alit("0"),[\achar-class([arange(48,48)])]) }) +)); + +public map[AType sort, AProduction def] Lit1 = ( + alit("*"): achoice(alit("*"), { pr(alit("*"),[\achar-class([arange(42,42)])]) }), + alit("+"): achoice(alit("+"), { pr(alit("+"),[\achar-class([arange(43,43)])]) }), + alit("0"): achoice(alit("0"), { pr(alit("0"),[\achar-class([arange(48,48)])]) }), + alit("1"): achoice(alit("1"), { pr(alit("1"),[\achar-class([arange(49,49)])]) }) +); + +public AGrammar GEXP = grammar({sort("E")}, ( + sort("E"): achoice(sort("E"), { pr(sort("E"), [sort("E"), alit("*"), sort("B")]), + pr(sort("E"), [sort("E"), alit("+"), sort("B")]), + pr(sort("E"), [sort("B")]) + }), + sort("B"): achoice(sort("B"), { pr(sort("B"), [alit("0")]), + pr(sort("B"), [alit("1")]) + }) +) + Lit1); + +public AGrammar GEXPPRIO = grammar( {sort("E")}, +( + sort("E"): achoice(sort("E"), { pr(sort("E"), [sort("T"), sort("E1")])}), + sort("E1"): achoice(sort("E1"),{ pr(sort("E1"), [alit("+"), sort("T"), sort("E1")]), + pr(sort("E1"), []) + }), + + + sort("T"): achoice(sort("T"), { pr(sort("T"), [sort("F"), sort("T1")]) }), + + sort("T1"): achoice(sort("T1"),{ pr(sort("F"), [alit("*"), sort("F"), sort("T1")]), + pr(sort("T1"), []) }), + + sort("F"): achoice(sort("F"), { pr(sort("F"), [alit("("), sort("E"), alit(")")]), + pr(sort("F"), [alit("id")]) + }), + + alit("+"): achoice(alit("+"), { pr(alit("+"),[\achar-class([arange(43,43)])]) }), + alit("*"): achoice(alit("*"), { pr(alit("*"),[\achar-class([arange(42,42)])]) }), + + alit("("): achoice(alit("("), { pr(alit("("), [\achar-class([arange(40,40)])]) }), + alit(")"): achoice(alit(")"), { pr(alit(")"), [\achar-class([arange(41,41)])]) }), + + alit("id"): achoice(alit("id"), { pr(alit("id"), [\achar-class([arange(105,105)]),\achar-class([arange(100,100)])]) }) +)); \ No newline at end of file diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/ADTandGrammar.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/ADTandGrammar.rsc new file mode 100644 index 00000000000..1f2f3564282 --- /dev/null +++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/ADTandGrammar.rsc @@ -0,0 +1,384 @@ +@license{ +Copyright (c) 2018-2025, NWO-I CWI, Swat.engineering and Paul Klint +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +} +@bootstrapParser +module lang::rascalcore::check::ADTandGrammar + +/* + Based on the facts in a given TModel, the functions in this module compute and store ADTs in the store using the key key_ADTs + as well as a grammar using the key key_grammar. While doing so it also performs some consistency checks. +*/ + + +import lang::rascalcore::check::ModuleLocations; + +import lang::rascalcore::agrammar::definition::Layout; +import lang::rascalcore::agrammar::definition::Keywords; + +import IO; +import Node; +import Set; +import ListRelation; +import Location; +import Relation; +import Message; +import Map; +import util::Reflective; + +extend lang::rascalcore::check::CheckerCommon; + +void addADTsAndCommonKeywordFields(Solver s){ + addADTs(s); + addCommonKeywordFields(s); +} + +bool commonTypeParameter(list[AType] params1, list[AType] params2){ + n1 = size(params1); + n2 = size(params2); + if(n1 == 0 || n2 == 0) return false; + return n1 == n2 && all(i <- [0..n1], params1[i] == params2[i] || isTypeParameter(params1[i]) && isTypeParameter(params2[i])); +} + +list[AType] removeLabels(list[AType] params) = [ unset(p, "alabel") | p <- params ]; + +void addADTs(Solver s){ + facts = s.getFacts(); + defines = s.getAllDefines(); + definedADTs = { unset(t, "alabel") | def <- defines, /AType t:aadt(str _, list[AType] _, _) := def }; + usedADTs = { unset(t, "alabel") | loc k <- facts, /AType t:aadt(str _, list[AType] parameters, _) := facts[k], !isEmpty(parameters), any(p <- parameters, !isTypeParameter(p)) }; + ADTs = { a[parameters=removeLabels(a.parameters)] | a <- definedADTs + usedADTs }; + + // remove versions with type parameter on same position. + + //solve(ADTs){ + // if(any(AType a1 <- ADTs, AType a2 <- ADTs, a1 != a2, a1.adtName == a2.adtName, commonTypeParameter(a1.parameters, a2.parameters))){ + // ADTs -= a2; + // } + //} + s.push(key_ADTs, ADTs); +} + +void addCommonKeywordFields(Solver s){ + set[Define] definitions = s.getAllDefines(); + lrel[AType adtType, Keyword defaultType] commonKeywordFields = []; + //lrel[AType adtType, AType defaultType] commonKeywordFields = []; + //lrel[AType, KeywordFormal] commonKeywordFields = []; + + // Collect common keywords and check double declarations + + //rel[AType,str,AType] commonKeywordFieldNames = {}; + //rel[AType,str,KeywordFormal] commonKeywordFieldNames = {}; + + for(Define def <- definitions, def.idRole == dataId()){ + try { + adtType = s.getType(def); + //commonKeywordNames = commonKeywordFieldNames[adtType]<0>; + for(kwf <- def.defInfo.commonKeywordFields){ + fieldName = ""; + fieldType = s.getType(kwf); + fieldType.alabel = fieldName; + moduleName = getRascalModuleName(kwf.expression@\loc, s.getConfig().typepalPathConfig); + commonKeywordFields += ; + //commonKeywordFieldNames += ; + // TODO: reconsider this + //if(fieldName in commonKeywordNames){ + // msgs = [ Message::error("Double declaration of common keyword Field `` for data type ``", getLoc(kwf2)) + // | kwf2 <- commonKeywordFieldNames[adtType]<1>, "" == fieldName + // ]; + // s.addMessages(msgs); + //} + } + } catch TypeUnavailable(): + ;//s.addMessages([ Message::error("Unavailable type in declaration of ``", def.defined) ]); + } + //println("commonKeywordFields"); + //for( <- commonKeywordFields) println(", "); + s.push(key_common_keyword_fields, commonKeywordFields); + + // Warn for overlapping declarations of common keyword fields and ordinary fields + + map[AType, map[str, AType]] adt_common_keyword_fields_name_and_kwf = ( adtType : ( kwf.fieldName : kwf.fieldType | kwf <- commonKeywordFields[adtType] ? []) | adtType <- toSet(commonKeywordFields<0>) ); + + //map[AType, map[str, KeywordFormal]] adt_common_keyword_fields_name_and_kwf = ( adtType : ( "" : kwf | kwf <- commonKeywordFields[adtType] ? []) | adtType <- domain(commonKeywordFields) ); + // + for(Define def <- definitions, def.idRole == constructorId()){ + try { + consType = s.getType(def); + set[str] commonFieldNames = domain(adt_common_keyword_fields_name_and_kwf[consType.adt] ? ()); + for(fld <- consType.fields){ + if(fld.alabel in commonFieldNames){ + kwf = adt_common_keyword_fields_name_and_kwf[consType.adt][fld.alabel]; + msgs = [ Message::warning("Common keyword field `` of data type `` overlaps with field of constructor ``", |unknown:///|), + Message::warning ("Field `` of constructor `` overlaps with common keyword field of data type ``", def.defined) + ]; + s.addMessages(msgs); + } + } + } catch TypeUnavailable(): + ;//s.addMessages([ Message::error("Unavailable type in declaration of ``", def.defined) ]); + + } + + lrel[AType,AType,Define] adt_constructors = []; + for(Define def <- definitions, def.idRole == constructorId()){ + try { + consType = s.getType(def); + if(consType.alabel == "type") continue; // TODO: where is the duplicate? + conses_so_far = adt_constructors[consType.adt]; + //for( <- conses_so_far, c.alabel == consType.alabel, cdef.defined != def.defined, comparable(c.fields, consType.fields)){ + // msgs = [ Message::error("Duplicate/comparable constructor `` of data type ``", def.defined), + // Message::error("Duplicate/comparable constructor `` of data type ``", cdef.defined) + // ]; + // s.addMessages(msgs); + //} + adt_constructors += ; + } catch TypeUnavailable(): + ;//s.addMessages([ Message::error("Unavailable type in declaration of ``", def.defined) ]); + + } +} + +list[&T <: node ] unsetRec(list[&T <: node] args) = [unsetRec(a) | a <- args]; + +bool isManualLayout(AProduction p) = (p has attributes && atag("manual"()) in p.attributes); + +tuple[bool, TModel, ModuleStatus] addGrammar(MODID moduleId, set[MODID] imports, set[MODID] extends, map[MODID,TModel] transient_tms, ModuleStatus ms){ + try { + rel[AType,AProduction] definedProductions = {}; + allStarts = {}; + qualifiedModuleName = moduleId2moduleName(moduleId); + for(m <- {moduleId, *imports, *extends}){ + TModel tm1; + if(transient_tms[m]?){ + tm1 = transient_tms[m]; + } else { + = getTModelForModule(m, ms); + if(!found) { + msg = error("Cannot add grammar or tmodel since `` is not found", ms.moduleLocs[moduleId] ? |unknown:///|); + //println(msg); // TODO: Just to record this event; this should probably go to a log file + ms.messages[moduleId] ? {} += { msg }; + tm1 = tmodel(modelName=qualifiedModuleName, messages=[msg]); + return ; + } + } + facts = tm1.facts; + prodLocs1 = { k | loc k <- facts, aprod(_) := facts[k] }; + + // filter out productions contained in priority/associativity declarations + prodLocs2 = { k | k <- prodLocs1, !any(l <- prodLocs1, k != l, isStrictlyContainedIn(k, l)) }; + + definedProductions += { | loc k <- prodLocs2, aprod(p) := facts[k] }; + + allStarts += { t | loc k <- facts, \start(t) := facts[k] }; + } + allStarts = uncloseTypeParams(allStarts); + rel[AType,AProduction] allProductions = uncloseTypeParams(definedProductions); + + allProductions = visit(allProductions){ + case p:prod(\start(a:aadt(_,_,_)),defs) => p[def=a] + case \start(a:aadt(_,_,_)) => a + } + + set[AType] allLayouts = {}; + set[AType] allManualLayouts = {}; + map[AType,AProduction] syntaxDefinitions = (); + + for(AType adtType <- domain(allProductions)){ + if(\start(adtType2) := adtType){ + adtType = adtType2; + } + productions = allProductions[adtType]; + syntaxDefinitions[adtType] = achoice(adtType, productions); + //println("syntaxDefinitions, for add "); + + if(adtType.syntaxRole == layoutSyntax()){ + if(any(p <- productions, isManualLayout(p))){ + allManualLayouts += adtType; + } else { + allLayouts = {*allLayouts, adtType}; + } + } + } + + // Check keyword rules + + tm = checkKeywords(allProductions, transient_tms[moduleId]); + + // Check layout + + if(size(allLayouts) > 1) { // Warn for multiple layout definitions + allLayoutNames = {ladt.adtName | AType ladt <- allLayouts}; + for(AType ladt <- allLayouts){ + otherLayoutNames = {"``" | str lname <- (allLayoutNames - ladt.adtName)}; + for(p <- syntaxDefinitions[ladt].alternatives){ + tm.messages += [warning(interpolate("Multiple layout definitions: layout %q can interfere with layout %v", AType(Tree t) { return tm.facts[getLoc(t)]; }, [ladt.adtName, otherLayoutNames]), + p.src)]; + } + } + } + + definedLayout = aadt("$default$", [], layoutSyntax()); + if(isEmpty(allLayouts) || !isEmpty(allStarts)){ + syntaxDefinitions += (layouts("$default$"): achoice(layouts("$default$"), {prod(layouts("$default$"), [])})); + } + + if(size(allLayouts) >= 1){ + definedLayout = getOneFrom(allLayouts); + } + + // Add start symbols + + for(AType adtType <- allStarts){ + syntaxDefinitions[\start(adtType)] = achoice(\start(adtType), { prod(\start(adtType), [definedLayout, adtType[alabel="top"], definedLayout]) }); + } + + // Add auxiliary rules for instantiated syntactic ADTs outside the grammar rules + facts = tm.facts; + allADTs = uncloseTypeParams({ unset(adt, "alabel") | loc k <- facts, /AType adt:aadt(str _, list[AType] _, _) := facts[k] }); + //println("ADTandGrammar, allADTs:"); iprintln(allADTs); + + instantiated_in_grammar = + { unset(adt, "alabel") + | /adt:aadt(str _, list[AType] parameters, SyntaxRole _) := syntaxDefinitions, + !isEmpty(parameters), + all(p <- parameters, !isTypeParameter(p)) + }; + //println("ADTandGrammar, instantiated_in_grammar:"); iprintln(instantiated_in_grammar); + + instantiated = + { unset(adt, "alabel") + | AType adt <- allADTs, + !isEmpty(adt.parameters), + all(p <- adt.parameters, !isTypeParameter(p)) + }; + //println("ADTandGrammar, instantiated:"); iprintln(instantiated); + instantiated_outside = instantiated - instantiated_in_grammar; + //println("ADTandGrammar, instantiated_outside:"); iprintln(instantiated_outside); + parameterized_uninstantiated_ADTs = + { unset(adt, "alabel")[parameters = uncloseTypeParams(params)] + | adt <- allADTs, + adt.syntaxRole != dataSyntax(), + params := getADTTypeParameters(adt), + !isEmpty(params), + all(p <- params, isTypeParameter(p)) + }; + //println("ADTandGrammar, parameterized_uninstantiated_ADTs:"); iprintln(parameterized_uninstantiated_ADTs); + + AType uninstantiate(AType t){ + iparams = getADTTypeParameters(t); + for(uadt <- parameterized_uninstantiated_ADTs){ + uadtParams = getADTTypeParameters(uadt); + if(t.adtName == uadt.adtName && size(iparams) == size(uadtParams)){ + return uadt; + } + } + return t; + } + + if(!isEmpty(instantiated_outside)){ + for(adt <- instantiated_outside, adt.syntaxRole != dataSyntax()){ + iparams = getADTTypeParameters(adt); + uadt = uninstantiate(adt); + auxNT = aadt("$_<}>", [], adt.syntaxRole); + rule = achoice(auxNT, {prod(auxNT, [adt]) }); + syntaxDefinitions += (auxNT : rule); + } + } + + // Construct the grammar + + g = grammar(allStarts, syntaxDefinitions); + g = layouts(g, definedLayout, allManualLayouts); + //println("ADTandGrammar:"); iprintln(g, lineLimit=10000); + //g = expandKeywords(g); + g.rules += (aempty():achoice(aempty(), {prod(aempty(),[])})); + tm = tmlayouts(tm, definedLayout, allManualLayouts); + //println("ADTandGrammar:"); iprintln(g, lineLimit=10000); + tm.store[key_grammar] = [g]; + return ; + } catch TypeUnavailable(): { + // protect against undefined entities in the grammar that have not yet been reported. + return ; + } +} + +@doc{intersperses layout symbols in all non-lexical productions} +public TModel tmlayouts(TModel t, AType l, set[AType] others) { + + res = top-down-break visit (t) { + case AType atype => regulars(atype , l, others) + } + return res; +} + +// A keyword production may only contain: +// - literals or ciliterals +// - other nonterminals that satisfy this rule. + +bool isValidKeywordProd(AType sym, set[AType] allLiteral){ + if( alit(_) := sym + || acilit(_) := sym + || aprod(prod(aadt(_,[],_),[alit(_)])) := sym + || aprod(prod(aadt(_,[],_),[acilit(_)])) := sym + ){ + return true; + } + if(aprod(prod(a:aadt(_,[],_),_)) := sym && a in allLiteral){ + return true; + } + return false; +} + +TModel checkKeywords(rel[AType, AProduction] allProductions, TModel tm){ + allLiteral = {}; + solve(allLiteral){ + forADT: + for(AType adtType <- domain(allProductions), adtType notin allLiteral){ + for(prod(AType _, list[AType] asymbols) <- allProductions[adtType]){ + for(sym <- asymbols){ + if(!isValidKeywordProd(sym, allLiteral)){ + continue forADT; + } + } + allLiteral += adtType; + } + } + } + for(AType adtType <- domain(allProductions), ((\start(t) := adtType) ? t.syntaxRole : adtType.syntaxRole) == keywordSyntax()){ + for(p:prod(AType _, list[AType] asymbols) <- allProductions[adtType]){ + if(size(asymbols) != 1){ + tm.messages += [warning(size(asymbols) == 0 ? "One symbol needed in keyword declaration, found none" : "Keyword declaration should consist of one symbol", p.src)]; + } + for(sym <- asymbols){ + if(alit(_) := sym || acilit(_) := sym) continue; + if(!isADTAType(sym) || isADTAType(sym) && sym notin allLiteral){ + tm.messages += [warning(interpolate("Only literals allowed in keyword declaration, found %t", AType(Tree t) { return tm.facts[getLoc(t)]; }, [sym]), p.src) ]; + } + } + } + } + return tm; +} \ No newline at end of file diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/AType.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/AType.rsc new file mode 100644 index 00000000000..8a7ce513151 --- /dev/null +++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/AType.rsc @@ -0,0 +1,852 @@ +@license{ +Copyright (c) 2018-2025, NWO-I CWI, Swat.engineering and Paul Klint +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +} +@bootstrapParser +module lang::rascalcore::check::AType + +/* + Every needed to operate on ATypes, including asubtype, alub, +*/ + +extend lang::rascalcore::check::ATypeBase; +extend lang::rascalcore::agrammar::definition::Characters; + +import lang::rascalcore::check::ATypeParamBase; + +import IO; +import Node; +import Set; +import String; +import List; + +// ---- asubtype -------------------------------------------------------------- + +@doc{ +.Synopsis +Subtype on types. +} +//bool asubtype(type[&T] t, type[&U] u) { throw "asubtype not yet implemented on and "; } //asubtype(t.symbol, u.symbol); + +@doc{ +.Synopsis +This function documents and implements the subtype relation of Rascal's type system. +} + +bool asubtype(tvar(s), AType r) { + throw TypeUnavailable(); +} +default bool asubtype(AType l, AType r){ + switch(r){ + case l: + return true; + case tvar(_): + throw TypeUnavailable(); + case overloadedAType(overloads): + //TODO: Alternative: return asubtype(l, (\avoid() | alub(it, tp) | <_, _, tp> <- overloads)); + return isEmpty(overloads) ? asubtype(l, avoid()) : any(<_, _, tp> <- overloads, asubtype(l, tp)); + case avalue(): + return true; + case anum(): + return l is aint || l is areal || l is arat || l is anum; + case aalias(str _, list[AType] _, AType aliased): + return asubtype(l, aliased); + case \start(AType t): + return asubtype(l, t); + case aprod(p): + return asubtype(l, p.def); + case \iter(AType t): + return asubtype(l, t); + case \iter-star(AType t): + return asubtype(l, t); + case \iter-seps(AType t, list[AType] _): + return asubtype(l,t);// && isEmpty(removeLayout(seps)); + case \iter-star-seps(AType t, list[AType] _): + return asubtype(l,t);// && isEmpty(removeLayout(seps)); + case conditional(AType t, _): + return asubtype(l, t); + case \seq(list[AType] rl): + return \seq(list[AType] ll) := l && asubtypeList(ll, rl); + case p:aparameter(str _, AType _): + return asubtypeRightTypeParam(l, p); + case areified(AType t): + return asubtype(l, t); + } + if(l.alabel? || r.alabel?) + return asubtype(unset(l, "alabel") , unset(r, "alabel")); + else + return l == r; +} + +bool occursTypeParameter(str nm, AType t){ + unm = deUnique(nm); + visit(t){ + case p:aparameter(_,_): + if(unm == deUnique(p.pname)) return true; + } + return false; +} + +// From "Exploring Type Parameters: +// [S1] asubtype(aparameter(n1, b1,closed=false), aparameter(n2, b2, closed=false)) = true; +// [S2] asubtype(aparameter(n1, b1,closed=true), aparameter(n2, b2,closed=true)) = n1 == n2 +// [S3] asubtype(p1:aparameter(n1, b1,closed=false), aparameter(n2, b2,closed=true)) = asubtype(p1, b2); // let op parameters in bounds +// [S4] asubtype(aparameter(n1, b1,closed=true), p2:aparameter(n2, b2,closed=false)) = asubtype(b1, p2); + +// [S5a] asubtype(aparameter(n, b, closed=false), r) = asubtype(b, r) when !(r is aparameter), !occursTypeParameter(n, r) +// [S5b] asubtype(aparameter(n, b, closed=false), r) = true when occursTypeParameter(n, r) +// [S6a] asubtype(l, aparameter(n, b,closed=false)) = asubtype(l, b) when !(l is aparameter), !occursTypeParameter(n, l) +// [S6b] asubtype(l, aparameter(n, b,closed=false)) = false when occursTypeParameter(n, l) +// [S7a] asubtype(aparameter(n, b,closed=true), r) = true when occursTypeParameter(n, r) +// [S7b] asubtype(aparameter(n, b,closed=true), r) = asubtype(b, r) when !(r is aparameter), !occursTypeParameter(n, r) +// [S8a] asubtype(l, aparameter(n, b,closed=true)) = l is avoid +// [S8b] asubtype(l, aparameter(n, b,closed=true)) = false when occursTypeParameter(n, l) +// [S8c] asubtype(l, aparameter(n, b,closed=true)) = equivalent(l,b) when !(l is parameter), !occursTypeParameter(n, l) + +bool asubtypeRightTypeParam(AType l, r:aparameter(str rnm, AType bnd)){ + res = false; + if(l is aparameter){ + res = asubtypeLeftTypeParam(l, r); + } else { + if(occursTypeParameter(rnm, l)){ + res = false; + } else { + res = r.closed ? (equivalent(l, bnd) || l is avoid) : asubtype(l, bnd); // [S6, S8] + } + } + //println("asubtypeRightTypeParam(, ) =\> "); + return res; +} + +bool asubtype(p1:aparameter(str n1, AType b1), AType r) + = asubtypeLeftTypeParam(p1, r); + +// aparameter, open +bool asubtypeLeftTypeParam(p1:aparameter(str n1, AType b1, closed=false), AType r) { + res = false; + if(aparameter(str _, AType _, closed=false) := r){ // [S1] + res = true; + } else if(aparameter(str _, AType b2, closed=true) := r){ // [S3] + res = asubtype(p1, b2); + } else if(occursTypeParameter(n1, r)){ + res = true; + } else { // [S5] + res = asubtype(b1, r); + } + // println("asubtypeLeftTypeParam(, ) =\> "); + return res; + } + +// aparameter, closed +bool asubtypeLeftTypeParam(p1:aparameter(str n1, AType b1, closed=true), AType r) { + res = false; + if(aparameter(str n2, AType _, closed=true) := r ){ // [S2] + res = n1 == n2; + } else if(occursTypeParameter(n1, r)){ + res = true; + } else if(p2:aparameter(str _, AType _,closed=false) := r){// [S4] + res = asubtype(b1, p2); + } else { // [S7] + res = asubtype(b1, r); + } + // println("asubtypeLeftTypeParam(, ) =\> "); + return res; +} + +bool asubtype(overloadedAType(overloads), AType r) + //TODO: Alternative: = asubtype((\avoid() | alub(it, tp) | <_, _, tp> <- overloads), r); + = isEmpty(overloads) ? asubtype(avoid(), r) : any(<_, _, tp> <- overloads, asubtype(tp, r)); + +bool asubtype(avoid(), AType _) = true; +default bool asubtype(AType _, avalue()) = true; + +bool asubtype(ac:acons(AType a, list[AType] ap, list[Keyword] _), AType b){ + switch(b){ + case acons(a,list[AType] bp, list[Keyword] _): + return comparableList(ap, bp); + case adt: aadt(str _, list[AType] _, _): + return asubtype(a,adt); + case anode(_): + return true; + case afunc(AType b, list[AType] bp, list[Keyword] _): + return asubtype(a, b) && comparableList(ap, bp); + case \start(AType t): + return asubtype(ac, t); + case avalue(): + return true; + } + fail; +} + +bool asubtype(ap: aprod(AProduction p), AType b){ + switch(b){ + case aprod(AProduction q): + return asubtype(p.def, q.def); + case \start(AType t): + return asubtype(ap, t); + case conditional(AType t, _): + return asubtype(ap, t); + case AType t: + return asubtype(p.def, t); + case avalue(): + return true; + } + fail; +} + +bool asubtype(adt:aadt(str n, list[AType] l, SyntaxRole sr), AType b){ + switch(b){ + case anode(_): + return true; + ////////// + case acons(AType a, list[AType] _, list[Keyword] _): + if(isConcreteSyntaxRole(sr)) return asubtype(adt, a); + ///////// + case aadt(n, list[AType] r, _): + return asubtypeList(l, r); + case aadt("Tree", _, _): + if(isConcreteSyntaxRole(sr)) return true; + case \start(AType t): + if(isConcreteSyntaxRole(sr)) return asubtype(adt, t); + case avalue(): + return true; + case p:aparameter(_, _): + return asubtypeRightTypeParam(adt, p); + } + fail; +} + +bool asubtype(\start(AType a), AType b) = asubtype(a, b); + +bool asubtype(i:\iter(AType s), AType b){ + switch(b){ + case aadt("Tree", [], dataSyntax()): + return true; + case anode(_): + return true; + case iter(AType t): + return asubtype(s, t); + case \iter-star(AType t): + return asubtype(s, t); + case \iter-seps(AType t, list[AType] seps): + return asubtype(s,t) && isEmpty(removeLayout(seps)); + case \iter-star-seps(AType t, list[AType] seps): + return asubtype(s,t) && isEmpty(removeLayout(seps)); + case \start(AType t): + return asubtype(i, t); + case avalue(): + return true; + } + fail; +} + +bool asubtype(i:\iter-seps(AType s, list[AType] seps), AType b){ + switch(b){ + case aadt("Tree", [], dataSyntax()): + return true; + case anode(_): + return true; + case \iter-seps(AType t, list[AType] seps2): + return asubtype(s,t) && asubtypeList(removeLayout(seps), removeLayout(seps2)); + case \iter(AType t): + return asubtype(s,t) && isEmpty(removeLayout(seps)); + case \iter-star(AType t): + return asubtype(s,t) && isEmpty(removeLayout(seps)); + case \iter-star-seps(AType t, list[AType] seps2): + return asubtype(s,t) && asubtypeList(removeLayout(seps), removeLayout(seps2)); + case \start(AType t): + return asubtype(i, t); + case avalue(): + return true; + } + fail; +} + +bool asubtype(i:\iter-star(AType s), AType b){ + switch(b){ + case aadt("Tree", [], dataSyntax()): + return true; + case anode(_): + return true; + case \iter-star(AType t): + return asubtype(s, t); + case \iter-star-seps(AType t, list[AType] seps): + return asubtype(s,t) && isEmpty(removeLayout(seps)); + case \start(AType t): + return asubtype(i, t); + case avalue(): + return true; + } + fail; +} + +bool asubtype(i:\iter-star-seps(AType s, list[AType] seps), AType b){ + switch(b){ + case aadt("Tree", [], dataSyntax()): + return true; + case anode(_): + return true; + case \iter-star-seps(AType t, list[AType] seps2): + return asubtype(s,t) && asubtypeList(removeLayout(seps), removeLayout(seps2)); + case \start(AType t): + return asubtype(i, t); + case avalue(): + return true; + } + fail; +} + +bool asubtype(\opt(AType _),aadt(n, [], dataSyntax())) = n == "Tree"; +bool asubtype(\alt(set[AType] _),aadt(n, [], dataSyntax())) = n == "Tree"; +bool asubtype(\seq(list[AType] _),aadt(n, [], dataSyntax())) = n == "Tree"; + +bool asubtype(\seq(list[AType] ll),\seq(list[AType] rl)) { + return asubtypeList(ll, rl); +} + +bool asubtype(alit(_), aadt(n, [], _)) = n == "Tree"; +bool asubtype(acilit(_), aadt(n, [], _)) = n == "Tree"; + +bool asubtype(conditional(AType s, _), AType r /*conditional(AType t, _)*/) { + if(conditional(AType t, _) := r) + return asubtype(s, t); + else + return asubtype(s, r); +} + +// TODO: add subtype for elements under optional and alternative, but that would also require auto-wrapping/unwrapping in the run-time +// bool asubtype(AType s, \opt(AType t)) = subtype(s,t); +// bool asubtype(AType s, \alt({AType t, *_}) = true when subtype(s, t); // backtracks over the alternatives + +//bool asubtype(aint(), anum()) = true; +//bool asubtype(arat(), anum()) = true; +//bool asubtype(areal(), anum()) = true; + +bool asubtype(atuple(AType l), atuple(AType r)) = asubtype(l, r); + +// list and lrel +bool asubtype(alist(AType a), AType b){ + switch(b){ + case alist(AType t): + return asubtype(a, t); + case alrel(AType t): + return asubtype(a, atuple(t)); + case avalue(): + return true; + } + fail; +} + +bool asubtype(alrel(AType a), AType b){ + switch(b){ + case alrel(AType t): + return asubtype(a, t); + case alist(AType t): + return asubtype(atuple(a), t); + case avalue(): + return true; + } + fail; +} + +// set and rel + +bool asubtype(aset(AType a), AType b){ + switch(b){ + case aset(AType t): + return asubtype(a, t); + case arel(AType t): + return asubtype(a, atuple(t)); + case avalue(): + return true; + } + fail; +} + +bool asubtype(arel(AType a), AType b){ + switch(b){ + case arel(AType t): + return asubtype(a,t); + case aset(AType t): + return asubtype(atuple(a), t); + case avalue(): + return true; + } + fail; +} + +bool asubtype(abag(AType s), abag(AType t)) = asubtype(s, t); + +bool asubtype(amap(AType from1, AType to1), amap(AType from2, AType to2)) + = asubtype(from1, from2) && asubtype(to1, to2); + +bool asubtype(AType l:afunc(AType a, list[AType] ap, list[Keyword] _), AType r){ + switch(r){ + case acons(b,list[AType] bp, list[Keyword] _): + return asubtype(a, b) && comparableList(ap, bp); + case afunc(AType b, list[AType] bp, list[Keyword] _): { + // note that comparability is enough for function argument sub-typing due to pattern matching semantics + ares = asubtype(a,b); + bres = comparableList(ap, bp); + //println("asubtype(, ) =\> , "); + return ares && bres; + } + case avalue(): + return true; + } + fail; +} + +// areified +bool asubtype(areified(AType s), AType b){ + switch(b){ + case areified(AType t): + return asubtype(s,t); + case anode(_): + return true; + case avalue(): + return true; + case p: aparameter(_, _): + return asubtypeRightTypeParam(s, p); + } + fail; +} + +bool asubtype(a:anode(list[AType] l), AType b){ + switch(b){ + case anode(_): + return true; + case anode(list[AType] r): + return l <= r; + case \start(t): + return asubtype(a, t); + case avalue(): + return true; + } + fail; +} + +bool asubtype(AType a:aalias(str _, list[AType] _, AType aliased), AType r) = asubtype(aliased, r); +bool asubtype(AType l, aalias(str _, list[AType] _, AType aliased)) = asubtype(l, aliased); + +// Character classes and char + +bool asubtype(l:\achar-class(_), AType r){ + switch(r){ + case \achar-class(_): { + if(l.ranges == r.ranges) + return true; + if(difference(r, l) == \achar-class([])) + return false; + return true; + } + case aadt("Tree", _, _): + return true; // characters are Tree instances + case \start(t): + return asubtype(l, t); + case avalue(): + return true; + } + fail; +} + +bool asubtype(atypeList(list[AType] l), atypeList(list[AType] r)) = asubtypeList(l, r); + +// asubtype on lists of atypes + +bool asubtypeList(list[AType] l, list[AType] r){ + if(size(l) == 0){ + return size(r) == 0; + } + return size(l) == size(r) && all(i <- index(l), asubtype(l[i], r[i])); +} + +list[AType] removeLayout(list[AType] seps) = [ s | s <- seps, !isLayoutAType(s) ]; + +// This is a clone from ATypeUtils to solve circularity; +@doc{Synopsis: Determine if the given type is a layout type.} +bool isLayoutAType(aparameter(_,AType tvb)) = isLayoutAType(tvb); + +bool isLayoutAType(\conditional(AType ss,_)) = isLayoutAType(ss); +bool isLayoutAType(t:aadt(adtName,_,SyntaxRole sr)) = sr == layoutSyntax(); +bool isLayoutAType(\start(AType ss)) = isLayoutAType(ss); +bool isLayoutAType(\iter(AType s)) = isLayoutAType(s); +bool isLayoutAType(\iter-star(AType s)) = isLayoutAType(s); +bool isLayoutAType(\iter-seps(AType s,_)) = isLayoutAType(s); +bool isLayoutAType(\iter-star-seps(AType s,_)) = isLayoutAType(s); + +bool isLayoutAType(\opt(AType s)) = isLayoutAType(s); +bool isLayoutAType(\alt(set[AType] alts)) = any(a <- alts, isLayoutAType(a)); +bool isLayoutAType(\seq(list[AType] symbols)) = all(s <- symbols, isLayoutAType(s)); +default bool isLayoutAType(AType _) = false; + +@doc{ +.Synopsis +Check if two types are comparable, i.e., have a common supertype. +} +bool comparable(AType s, AType t){ + return s == t || asubtype(s,t) || asubtype(t,s); +} + +bool comparableList(list[AType] l, list[AType] r) { + if(size(l) == 0){ + return size(r) == 0; + } + return size(l) == size(r) && all(i <- index(l), comparable(l[i], r[i])); +} + +@doc{ +.Synopsis +Check if two types are equivalent. +} +bool equivalent(AType s, AType t) = asubtype(s,t) && asubtype(t,s); + + +@doc{ +.Synopsis +Structural equality between values. + +.Description +The difference is that no implicit coercions are done between values of incomparable types, such as == does for +int, real and rat. + +.Examples + +[source,rascal-shell] +---- +import Type; +1 == 1.0 +eq(1,1.0) +---- +} +@javaClass{org.rascalmpl.library.Type} +public java bool eq(value x, value y); + +// ---- alub: least-upper-bound ------------------------------------------------ + +//int size(atypeList(list[AType] l)) = size(l); + +@doc{ +.Synopsis +The least-upperbound (lub) between two types. + +.Description +This function documents and implements the lub operation in Rascal's type system. +} +AType alub(tvar(s), AType r) { + throw TypeUnavailable(); +} +AType alub(AType l, tvar(s)) { + throw TypeUnavailable(); +} + +AType alub(AType s, s) = s; +default AType alub(AType s, AType t) + = (s.alabel? || t.alabel?) ? ((s.alabel == t.alabel) ? alub(unset(s, "alabel") , unset(t, "alabel"))[alabel=s.alabel] + : alub(unset(s, "alabel"), unset(t, "alabel"))) + : avalue(); + +AType alub(atypeList(ts1), atypeList(ts2)) = atypeList(alubList(ts1, ts2)); + +AType alub(overloadedAType(overloads), AType t2) + // TODO:Alternative: alub((\avoid() | alub(it, tp) | <_, _, tp> <- overloads), t2); + = isEmpty(overloads) ? t2 : alub((avalue() | aglb(it, tp) | <_, _, tp> <- overloads), t2); + +AType alub(AType t1, overloadedAType(overloads)) + //TODO: Alternative: = alub(t1, (\avoid() | alub(it, tp) | <_, _, tp> <- overloads)); + = isEmpty(overloads) ? t1 : alub(t1, (avalue() | aglb(it, tp) | <_, _, tp> <- overloads)); + +AType alub(avalue(), AType t) = avalue(); +AType alub(AType s, avalue()) = avalue(); +AType alub(avoid(), AType t) = t; +AType alub(AType s, avoid()) = s; +AType alub(aint(), anum()) = anum(); +AType alub(aint(), areal()) = anum(); +AType alub(aint(), arat()) = anum(); +AType alub(arat(), anum()) = anum(); +AType alub(arat(), areal()) = anum(); +AType alub(arat(), aint()) = anum(); +AType alub(areal(), anum()) = anum(); +AType alub(areal(), aint()) = anum(); +AType alub(areal(), arat()) = anum(); +AType alub(anum(), aint()) = anum(); +AType alub(anum(), areal()) = anum(); +AType alub(anum(), arat()) = anum(); + +AType alub(aset(AType s), aset(AType t)) = aset(alub(s, t)); + +AType alub(aset(AType s), arel(AType t)) = aset(alub(s,atuple(t))); +AType alub(arel(AType s), aset(AType t)) = aset(alub(atuple(s), t)); + +AType alub(arel(atypeList(list[AType] l)), arel(atypeList(list[AType] r))) = size(l) == size(r) ? arel(atypeList(alubList(l, r))) : aset(avalue()); + +AType alub(alist(AType s), alist(AType t)) = alist(alub(s, t)); +AType alub(alist(AType s), alrel(AType t)) = alist(alub(s,atuple(t))); +AType alub(alrel(AType s), alist(AType t)) = alist(alub(atuple(s),t)); + +AType alub(alrel(atypeList(list[AType] l)), alrel(atypeList(list[AType] r))) = size(l) == size(r) ? alrel(atypeList(alubList(l, r))) : alist(avalue()); + +AType alub(atuple(atypeList(list[AType] l)), atuple(atypeList(list[AType] r))) = size(l) == size(r) ? atuple(atypeList(alubList(l, r))) : avalue(); + +AType alub(amap(ld, lr), amap(rd, rr)) = amap(alub(ld, rd), alub(lr, rr)); + +AType alub(abag(AType s), abag(AType t)) = abag(alub(s, t)); + +AType alub(aadt(str n, list[AType] _, SyntaxRole_), anode(_)) = anode([]); +AType alub(anode(_), aadt(str n, list[AType] _, SyntaxRole _)) = anode([]); + +AType alub(a1:aadt(str n, list[AType] lp, SyntaxRole lsr), a2:aadt(n, list[AType] rp, SyntaxRole rsr)) + = addADTLabel(a1, a2, aadt(n, alubList(lp,rp), sr)) + when size(lp) == size(rp) && getTypeParamNames(lp) == getTypeParamNames(rp) && size(getTypeParamNames(lp)) > 0 && + sr := overloadSyntaxRole({lsr, rsr}) && sr != illegalSyntax(); + +AType alub(a1:aadt(str n, list[AType] lp, SyntaxRole lsr), a2:aadt(n, list[AType] rp, SyntaxRole rsr)) + = addADTLabel(a1, a2, aadt(n, alubList(lp,rp), sr)) + when size(lp) == size(rp) && size(getTypeParamNames(lp)) == 0 && sr := overloadSyntaxRole({lsr, rsr}) && sr != illegalSyntax(); + +AType alub(aadt(str n, list[AType] lp, SyntaxRole lr), aadt(str m, list[AType] rp,SyntaxRole rr)) + = n != m && (n == "Tree" && rr != dataSyntax() || m == "Tree" && lr != dataSyntax()) + ? aadt("Tree", [], dataSyntax()) + : anode([]); +//AType alub(a1: aadt(str ln, list[AType] lp,SyntaxRole _), acons(AType b, _, _)) = alub(a1,b); + +AType addADTLabel(AType a1, AType a2, AType adt){ + if(a1.alabel? && a1.alabel == a2.alabel) adt = adt[alabel=a1.alabel]; + return adt; +} + +//AType alub(acons(AType la, list[AType] _, list[Keyword] _), acons(AType ra, list[AType] _, list[Keyword] _)) = alub(la,ra); +AType alub(acons(AType lr, list[AType] lp, list[Keyword] lkw), acons(AType rr, list[AType] rp, list[Keyword] rkw)) { + if(size(lp) == size(rp)){ + return acons(alub(lr,rr), alubList(lp, rp), lkw + (rkw - lkw)); // TODO do we want to propagate the keyword parameters? + } else + return avalue(); +} + +AType alub(acons(AType lr, list[AType] lp, list[Keyword] lkw), afunc(AType rr, list[AType] rp, list[Keyword] rkw)) { + if(size(lp) == size(rp)){ + return afunc(alub(lr,rr), alubList(lp, rp), lkw + (rkw - lkw)); // TODO do we want to propagate the keyword parameters? + } else + return avalue(); +} + +AType alub(afunc(AType lr, list[AType] lp, list[Keyword] lkw), acons(AType rr, list[AType] rp, list[Keyword] rkw)) { + if(size(lp) == size(rp)){ + return afunc(alub(lr,rr), alubList(lp, rp), lkw + (rkw - lkw)); // TODO how do we want to propagate the keyword parameters? + } else + return avalue(); +} + +//AType alub(acons(AType a, list[AType] lp, list[Keyword] _), a2:aadt(str n, list[AType] rp, SyntaxRole _)) = alub(a,a2); +AType alub(acons(AType _, list[AType] _, list[Keyword] _), anode(_)) = anode([]); + +AType alub(anode(list[AType] l), anode(list[AType] r)) = anode(l & r); + +AType alub(aalias(str _, list[AType] _, AType aliased), AType r) = alub(aliased, r); +AType alub(AType l, aalias(str _, list[AType] _, AType aliased)) = alub(l, aliased); + +// From "Exploring Type Parameters (adapted to keep aparameter as long as possible) +AType alub(p1:aparameter(n1, b1,closed=false), aparameter(n2, b2,closed=false)) = n1 == n2 && b1 == gl ? p1 : gl when gl := aglb(b1, b2); +AType alub(p:aparameter(n1, b1,closed=true), aparameter(n2, b2, closed=true)) = n1 == n2 ? aparameter(n1, aglb(b1, b2),closed=true) + : lb == b1 ? p : lb when lb := alub(b1, b2); + +AType alub(p1:aparameter(n1, b1,closed=false), p2:aparameter(n2, b2,closed=true)) = n1 == n2 && lb == b1 ? p1 : lb when lb := alub(b1, p2); +AType alub(p1:aparameter(n1, b1, closed=true), p2:aparameter(n2, b2, closed=false)) = n1 == n2 && lb == b2 ? p2 : lb when lb := alub(p1, b2); + +AType alub(p:aparameter(n, b, closed=false), AType r) = lb == b ? p : lb when !(r is aparameter), lb := alub(b, r); +AType alub(AType l, p:aparameter(n, b,closed=false)) = lb == b ? p : lb when !(l is aparameter), lb := alub(l, b); +AType alub(p:aparameter(n, b, closed=true), AType r) = lb == b ? p : lb when !(r is aparameter), lb := alub(b, r); +AType alub(AType l, p:aparameter(n, b, closed=true)) = lb == b ? p : lb when !(l is aparameter), lb := alub(l, b); + +AType alub(areified(AType l), areified(AType r)) = areified(alub(l,r)); +AType alub(areified(AType l), anode(_)) = anode([]); + +AType alub(l:\achar-class(_), r:\achar-class(_)) = union(l, r); + +AType alub(\iter(AType l), \iter(AType r)) = aadt("Tree", [], dataSyntax()) when l != r; +AType alub(\iter(AType l), \iter-star(AType r)) = aadt("Tree", [], dataSyntax()); + +AType alub(\iter-star(AType l), \iter-star(AType r)) = aadt("Tree", [], dataSyntax()) when l != r; +AType alub(\iter-star(AType l), \iter(AType r)) = aadt("Tree", [], dataSyntax()); + +AType alub(\iter-seps(AType l, _), \iter-seps(AType r,_)) = aadt("Tree", [], dataSyntax()) when l != r; +AType alub(\iter-seps(AType l,_), \iter-star-seps(AType r,_)) = aadt("Tree", [], dataSyntax()) when l != r; + +AType alub(\iter-star-seps(AType l, _), \iter-star-seps(AType r, _)) = aadt("Tree", [], dataSyntax()) when l != r; +AType alub(\iter-star-seps(AType l, _), \iter-seps(AType r, _)) = aadt("Tree", [], dataSyntax()) when l != r; + +AType alub(l:aadt("Tree", _, _), AType r) = l + when r is \achar-class || r is seq || r is opt || r is alt || r is iter || r is \iter-star || r is \iter-seps || r is \iter-star-seps; +AType alub(AType l, r:aadt("Tree", _, _)) = r + when l is \achar-class || l is seq || l is opt || l is alt || l is iter || l is \iter-star || l is \iter-seps || l is \iter-star-seps; + +AType alub(\start(AType l) , AType r) = alub(l, r); +AType alub(AType l, \start(AType r)) = alub(l, r); + +AType alub(conditional(AType l, _), AType r) = alub(l, r); +AType alub(AType l, conditional(AType r, _)) = alub(l, r); + +AType alub(\seq(list[AType] ll),\seq(list[AType] rl)) += \seq(alubList(ll, rl)); + +// because functions _match_ their parameters, parameter types may be comparable (co- and contra-variant) and not +// only contra-variant. We choose the lub here over aglb (both would be correct), to +// indicate to the programmer the intuition that rather _more_ than fewer functions are substitutable. +AType alub(afunc(AType lr, list[AType] lp, list[Keyword] lkw), afunc(AType rr, list[AType] rp, list[Keyword] rkw)) { + if(size(lp) == size(rp)){ + return afunc(alub(lr,rr), alubList(lp, rp), lkw + (rkw - lkw)); // TODO how do we want to propagate the keyword parameters? + } else + return avalue(); +} + +public list[AType] alubList(list[AType] l, list[AType] r) = [alub(l[idx],r[idx]) | idx <- index(l)] when size(l) == size(r); +default list[AType] alubList(list[AType] l, list[AType] r) = [avalue()]; + +private list[str] getTypeParamNames(list[AType] l) = [ s | li <- l, aparameter(s,_) := li]; + +@doc{Calculate the lub of a list of types.} +public AType lubList(list[AType] ts) { + AType theLub = avoid(); + for (t <- ts) theLub = alub(theLub,t); + return theLub; +} + +//public set[AType] numericTypes = { aint(), areal(), arat(), anum() }; + +public bool comparableOrNum(AType l, AType r) { + leftAsNum = visit(l) { + case aint() => anum() + case areal() => anum() + case arat() => anum() + }; + + rightAsNum = visit(r) { + case aint() => anum() + case areal() => anum() + case arat() => anum() + }; + + return comparable(l, r) || comparable(leftAsNum,rightAsNum); +} + +// aglb + +public AType aglb(AType s, s) = s; + +public default AType aglb(AType s, AType t) + = (s.alabel? || t.alabel?) ? ((s.alabel == t.alabel) ? aglb(unset(s, "alabel") , unset(t, "alabel"))[alabel=s.alabel] + : aglb(unset(s, "alabel"), unset(t, "alabel"))) + : avoid(); + +public AType aglb(avoid(), AType t) = avoid(); +public AType aglb(AType s, avoid()) = avoid(); +public AType aglb(avalue(), AType t) = t; +public AType aglb(AType s, avalue()) = s; + +public AType aglb(aint(), anum()) = aint(); +public AType aglb(anum(), aint()) = aint(); +public AType aglb(arat(),anum()) = arat(); +public AType aglb(anum(), arat()) = arat(); +public AType aglb(areal(), anum()) = areal(); +public AType aglb(anum(), areal()) = areal(); + +public AType aglb(aset(AType s), aset(AType t)) = aset(aglb(s, t)); +public AType aglb(aset(AType s), arel(AType t)) = aset(aglb(s,atuple(t))); +public AType aglb(arel(AType s), aset(AType t)) = aset(aglb(atuple(s), t)); + +AType aglb(arel(atypeList(list[AType] l)), arel(atypeList(list[AType] r))) = size(l) == size(r) ? arel(atypeList(aglbList(l, r))) : aset(avalue()); + +AType aglb(overloadedAType(overloads), AType t2) + //TODO: Alternative: = aglb((\avoid() | alub(it, tp) | <_, _, tp> <- overloads), t2); + = isEmpty(overloads) ? t2 : aglb((avoid() | alub(it, tp) | <_, _, tp> <- overloads), t2); + +AType aglb(AType t1, overloadedAType(overloads)) + //TODO: Alternative: = aglb(t1, (\avoid() | alub(it, tp) | <_, _, tp> <- overloads)); + = isEmpty(overloads) ? t1 : aglb(t1, (avoid() | alub(it, tp) | <_, _, tp> <- overloads)); + +public AType aglb(alist(AType s), alist(AType t)) = alist(aglb(s, t)); +public AType aglb(alist(AType s), alrel(AType t)) = alist(aglb(s,atuple(t))); +public AType aglb(alrel(AType s), alist(AType t)) = alist(aglb(atuple(s), t)); + +AType aglb(alrel(atypeList(list[AType] l)), alrel(atypeList(list[AType] r))) = size(l) == size(r) ? alrel(atypeList(aglbList(l, r))) : alist(avalue()); + +AType aglb(atuple(atypeList(list[AType] l)), atuple(atypeList(list[AType] r))) = size(l) == size(r) ? atuple(atypeList(aglbList(l, r))) : avalue(); + +AType aglb(amap(ld, lr), amap(rd, rr)) = amap(aglb(ld, rd), aglb(lr, rr)); + +public AType aglb(abag(AType s), abag(AType t)) = abag(aglb(s, t)); + +public AType aglb(anode(list[AType] l), aadt(str _, list[AType] _, SyntaxRole _), SyntaxRole _) = anode(l); +public AType aglb(aadt(str _, list[AType] _, SyntaxRole _), anode(list[AType] r)) = anode(r); + +AType aglb(a1:aadt(str n, list[AType] lp, SyntaxRole lsr), a2:aadt(n, list[AType] rp, SyntaxRole rsr)) + = addADTLabel(a1, a2, aadt(n, aglbList(lp,rp), sr)) + when size(lp) == size(rp) && getTypeParamNames(lp) == getTypeParamNames(rp) && size(getTypeParamNames(lp)) > 0 && + sr := overloadSyntaxRole({lsr, rsr}) && sr != illegalSyntax(); + +AType aglb(a1:aadt(str n, list[AType] lp, SyntaxRole lsr), a2:aadt(n, list[AType] rp, SyntaxRole rsr)) + = addADTLabel(a1, a2, aadt(n, aglbList(lp,rp), sr)) + when size(lp) == size(rp) && size(getTypeParamNames(lp)) == 0 && + sr := overloadSyntaxRole({lsr, rsr}) && sr != illegalSyntax(); + +AType aglb(aadt(str n, list[AType] lp, SyntaxRole _), aadt(str m, list[AType] rp,SyntaxRole _)) = anode([]) when n != m; +AType aglb(a1: aadt(str ln, list[AType] lp,SyntaxRole _), acons(AType b, _, _)) = aglb(a1,b); + +public AType aglb(acons(AType la, list[AType] _, list[Keyword] _), acons(AType ra, list[AType] _, list[Keyword] _)) = aglb(la,ra); +//public AType aglb(acons(AType a, list[AType] lp, list[Keyword] _), aadt(str n, list[AType] rp, SyntaxRole sr)) = aglb(a,aadt(n,rp,sr)); +public AType aglb(acons(AType _, list[AType] _, list[Keyword] _), anode(list[AType] r)) = anode(r); + +public AType aglb(aalias(str _, list[AType] _, AType aliased), AType r) = aglb(aliased, r); +public AType aglb(AType l, aalias(str _, list[AType] _, AType aliased)) = aglb(l, aliased); + +// From "Exploring Type Parameters (adapted to keep aparamater as long as possible) + +AType aglb(p1:aparameter(n1, b1,closed=false), aparameter(n2, b2,closed=false)) = n1 == n2 && b1 == gl ? p1 : gl when gl := aglb(b1, b2); +AType aglb(aparameter(n1, b1,closed=true), aparameter(n2, b2,closed=true)) = n1 == n2 ? aparameter(n1,aglb(b1, b2),closed=true) + : avoid(); + +AType aglb(p1:aparameter(n1, b1,closed=false), p2:aparameter(n2, b2,closed=true)) = n1 == n2 && b1 == gl ? p1 : gl when gl := aglb(b1, p2); +AType aglb(p1:aparameter(n1, b1,closed=true), p2:aparameter(n2, b2,closed=false)) = n1 == n2 && b2 == gl ? p2 : gl when gl := aglb(p1, b2); + +AType aglb(p:aparameter(n, b,closed=false), AType r) = b == gl ? p : gl when !(r is aparameter), gl := aglb(b, r); +AType aglb(AType l, p:aparameter(n, b,closed=false)) = b == gl ? p : gl when !(l is aparameter), gl := aglb(l, b); + +AType aglb(aparameter(n, b, closed=true), AType r) = avoid() when !(r is aparameter);// upperbound!=lowerbound +AType aglb(AType l, aparameter(n, b,closed=true)) = avoid() when !(l is aparameter); + +public AType aglb(areified(AType l), areified(AType r)) = areified(aglb(l,r)); +public AType aglb(areified(AType l), anode(list[AType] r)) = anode(r); + +public AType aglb(afunc(AType lr, list[AType] lp, list[Keyword] kwl), afunc(AType rr, list[AType] rp, list[Keyword] kwr)) { + aglbReturn = aglb(lr,rr); + aglbParams = alub(atuple(atypeList(lp)),atuple(atypeList(rp))); + if (atuple(_) := aglbParams) + return afunc(aglbReturn, aglbParams.formals, kwl == kwr ? kwl : []); + else + return avalue(); +} + +public list[AType] aglbList(list[AType] l, list[AType] r) = [aglb(l[idx],r[idx]) | idx <- index(l)] when size(l) == size(r); +public default list[AType] aglbList(list[AType] l, list[AType] r) = [avalue()]; diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/ATypeBase.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/ATypeBase.rsc new file mode 100644 index 00000000000..bd754637dec --- /dev/null +++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/ATypeBase.rsc @@ -0,0 +1,483 @@ +@license{ +Copyright (c) 2018-2025, NWO-I CWI, Swat.engineering and Paul Klint +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +} +@bootstrapParser +module lang::rascalcore::check::ATypeBase + +/* + Basic declarations for the ATypes used in the checker. They extend the datat type AType introduced in TypePal. + */ + +extend analysis::typepal::TypePal; + +extend lang::rascal::\syntax::Rascal; + +//import IO; +import List; +import Set; +//import Node; +import String; + +data Keyword + = kwField(AType fieldType, str fieldName, str definingModule, Expression defaultExp) // Only used during compilation of the current module + | kwField(AType fieldType, str fieldName, str definingModule) // When compilation is complete, this reduced version is saved in the TModel + ; + +data AType (str alabel = "") + = + avoid() + | abool() + | aint() + | areal() + | arat() + | anum() + | astr() + | aloc() + | adatetime() + | alist(AType elmType) + | abag(AType elmType) + | aset(AType elmType) + | arel(AType elemType) + | alrel(AType elemType) + + | atuple(AType elemType) + | amap(AType keyType, AType valType) + + | afunc(AType ret, list[AType] formals, list[Keyword] kwFormals, + bool varArgs=false, + str deprecationMessage="", // Only used during compilation of the current module + bool isConcreteArg=false, // Only used during compilation of the current module + bool isDefault=false, // Only used during compilation of the current module + bool isTest=false, // Only used during compilation of the current module + bool returnsViaAllPath = false,// Only used during compilation of the current module + int abstractFingerprint=0, // Only used during compilation of the current module + int concreteFingerprint=0) // Only used during compilation of the current module + | aalias(str aname, list[AType] parameters, AType aliased) + | aanno(str aname, AType onType, AType annoType) + + | anode(list[AType] fields) + | aadt(str adtName, list[AType] parameters, SyntaxRole syntaxRole) + | acons(AType adt, list[AType] fields, list[Keyword] kwFields) + | aprod(AProduction production) + + | amodule(str mname, str deprecationMessage="") + | aparameter(str pname, AType bound, bool closed=false) + | areified(AType atype) + | avalue() + ; + +@memo{expireAfter(minutes=5),maximumSize(1000)} +AType overloadedAType(rel[loc, IdRole, AType] overloads){ + if(all( <- overloads, aadt(_, _, _) := t)){ + str adtName = ""; + list[AType] adtParams = []; + synRoles = {}; + nformals = -1; + for( <- overloads, aadt(adtName1, params1, syntaxRole1) := t){ + if(!isEmpty(adtName) && adtName != adtName1) fail overloadedAType; // overloading of different ADTs. + if(nformals >= 0 && size(params1) != nformals) fail overloadedAType; else nformals = size(params1); // different type parameter arities + + adtName = adtName1; + adtParams = params1; // TODO take care of different parameter names + synRoles += syntaxRole1; + } + syntaxRole = overloadSyntaxRole(synRoles); + if(syntaxRole == illegalSyntax()) fail overloadedAType; + + + return aadt(adtName, adtParams, syntaxRole); + } else { + otypes = overloads<2>; + if({AType tp} := otypes) return tp; + } + fail; +} + +data AProduction + = \achoice(AType def, set[AProduction] alternatives) + ; + +@doc{ +.Synopsis +Attributes register additional semantics annotations of a definition. +} +data AAttr + = atag(value \tag) + ; + +@doc{ +.Synopsis +Normalize the choice between alternative productions. + +.Description +Nested achoice is flattened. +} +public AProduction achoice(AType s, set[AProduction] achoices){ + if(any(achoice(AType _, set[AProduction] _) <- achoices)){ + // TODO: this does not work in interpreter and typechecker crashes on it (both related to the splicing) + //return choice(s, { *(choice(Symbol t, set[AProduction] b) := ch ? b : {ch}) | ch <- choices }); + bool changed = false; + new_achoices = {}; + for(ch <- achoices){ + if(achoice(AType _, set[AProduction] b) := ch){ + changed = true; + new_achoices += b; + } else { + new_achoices += ch; + } + } + if(changed){ + return achoice(s, new_achoices); + } + } + fail; +} + + + +public /*const*/ AType treeType = aadt("Tree", [], dataSyntax()); + +public bool isTreeType(AType t) = treeType := t; + +data SyntaxRole + = dataSyntax() + | contextFreeSyntax() + | lexicalSyntax() + | keywordSyntax() + | layoutSyntax() + | illegalSyntax() + ; + +SyntaxRole overloadSyntaxRole(set[SyntaxRole] syntaxRoles) { + if({SyntaxRole sr} := syntaxRoles) return sr; + if({SyntaxRole sr, dataSyntax()} := syntaxRoles) return sr; + return illegalSyntax(); +} + +bool isConcreteSyntaxRole(SyntaxRole sr) = sr in {lexicalSyntax(), contextFreeSyntax(), layoutSyntax(), keywordSyntax()}; + +bool isLayoutSyntax(aadt(name, parameters, layoutSyntax())) = true; +default bool isLayoutSyntax(AType t) = false; + +@doc{ +.Synopsis +Production in ParseTrees + +.Description + +The type `Production` is introduced in <>, see <>. Here we extend it with the symbols +that can occur in a ParseTree. We also extend productions with basic combinators allowing to +construct ordered and un-ordered compositions, and associativity groups. + +<1> A `prod` is a rule of a grammar, with a defined non-terminal, a list + of terminal and/or non-terminal symbols and a possibly empty set of attributes. + +<2> A `regular` is a regular expression, i.e. a repeated construct. + +<3> A `error` represents a parse error. + +<4> A `skipped` represents skipped input during error recovery. + +<5> `priority` means ordered choice, where alternatives are tried from left to right; +<6> `assoc` means all alternatives are acceptable, but nested on the declared side; +<7> `others` means '...', which is substituted for a choice among the other definitions; +<8> `reference` means a reference to another production rule which should be substituted there, + for extending priority chains and such. +} +data AProduction + = prod(AType def, list[AType] atypes, set[AAttr] attributes={}, loc src=|unknown:///|, str alabel = "") // <1> + | regular(AType def) // <2> + ; + +data AProduction + = \priority(AType def, list[AProduction] choices) // <5> + | \associativity(AType def, AAssociativity \assoc, set[AProduction] alternatives) // <6> + | \reference(AType def, str cons) // <7> + ; + +@doc{ +.Synopsis +Attributes in productions. + +.Description + +An `Attr` (attribute) documents additional semantics of a production rule. Neither tags nor +brackets are processed by the parser generator. Rather downstream processors are +activated by these. Associativity is a parser generator feature though. +} +data AAttr + = \aassoc(AAssociativity \assoc) + | \abracket() + ; + +@doc{ +.Synopsis +Associativity attribute. + +.Description + +Associativity defines the various kinds of associativity of a specific production. +} +data AAssociativity + = aleft() + | aright() + | aassoc() + | \a-non-assoc() + ; + +@doc{ +.Synopsis +Character ranges and character class +.Description + +* `CharRange` defines a range of characters. +* A `CharClass` consists of a list of characters ranges. +} +data ACharRange = arange(int begin, int end); + +alias ACharClass = list[ACharRange]; + +public /*const*/ int minUniCode = 1; +public /*const*/int maxUniCode = 0x10FFFF; +public /*const*/ AType anyCharType = \achar-class([arange(minUniCode, maxUniCode)]); + +@doc{ +.Synopsis +Symbols that can occur in a ParseTree + +.Description + +The type `Symbol` is introduced in <>, see <>, to represent the basic Rascal types, +e.g., `int`, `list`, and `rel`. Here we extend it with the symbols that may occur in a ParseTree. + +<1> The `start` symbol wraps any symbol to indicate that it is a start symbol of the grammar and + may occur at the root of a parse tree. +<2> Context-free non-terminal +<3> Lexical non-terminal +<4> Layout symbols +<5> Terminal symbols that are keywords +<6> Parameterized context-free non-terminal +<7> Parameterized lexical non-terminal +<8> Terminal. +<9> Case-insensitive terminal. +<10> Character class +<11> Empty symbol +<12> Optional symbol +<13> List of one or more symbols without separators +<14> List of zero or more symbols without separators +<15> List of one or more symbols with separators +<16> List of zero or more symbols with separators +<17> Alternative of symbols +<18> Sequence of symbols +<19> Conditional occurrence of a symbol. + +} + +// For convenience in transition period +//AType \sort(str sname) = aadt(sname, [], contextFreeSyntax()); +AType \layouts(str sname) = aadt(sname, [], layoutSyntax()); +AType \parameterized-sort(str sname, list[AType] parameters) + = aadt(sname, parameters, contextFreeSyntax()); +AType \parameterized-lex(str sname, list[AType] parameters) + = aadt(sname, parameters, lexicalSyntax()); + +// These are the terminal symbols (isTerminalType) +data AType + = alit(str string) // <8> + | acilit(str string) // <9> + | \achar-class(list[ACharRange] ranges) // <10> + ; + +// These are the regular expressions. +data AType + = \aempty() // <11> + | \opt(AType atype) // <12> + | \iter(AType atype, bool isLexical = false) // <13> + | \iter-star(AType atype, bool isLexical = false) // <14> + | \iter-seps(AType atype, list[AType] separators, bool isLexical = false) // <15> + | \iter-star-seps(AType atype, list[AType] separators, bool isLexical = false) // <16> + | \alt(set[AType] alternatives) // <17> + | \seq(list[AType] atypes) // <18> + | \start(AType atype) + ; + +//public AType \iter-seps(AType atype, []) = \iter(atype); +//public AType \iter-star-seps(AType atype, []) = \iter-star(atype); + +// flattening rules +public AType seq([*AType a, seq(list[AType] b), *AType c]) = AType::seq(a + b + c); + +public AType alt({*AType a, alt(set[AType] b)}) = AType::alt(a + b); + +data AType // <19> + = \conditional(AType atype, set[ACondition] conditions); + +@doc{ +.Synopsis +Datatype for declaring preconditions and postconditions on symbols + +.Description + +A `Condition` can be attached to a symbol; it restricts the applicability +of that symbol while parsing input text. For instance, `follow` requires that it +is followed by another symbol and `at-column` requires that it occurs +at a certain position in the current line of the input text. +} +data ACondition + = \follow(AType atype) + | \not-follow(AType atype) + | \precede(AType atype) + | \not-precede(AType atype) + | \delete(AType atype) + | \a-at-column(int column) + | \a-begin-of-line() + | \a-end-of-line() + | \a-except(str label) + ; + +AType \conditional(AType s, {*ACondition a, \conditional(AType _, set[ACondition] b), *ACondition c}) + = \conditional(s, a+b+c); + +AType \conditional(\conditional(AType s, set[ACondition] a), set[ACondition] b) + = \conditional(s, a+b); + +AType \follow(\conditional(AType s, set[ACondition] a)) + = \conditional(s, a + {\follow(s)}); + +AType \not-follow(\conditional(AType s, set[ACondition] a)) + = \conditional(s, a + {\not-follow(s)}); + +AType \precede(\conditional(AType s, set[ACondition] a)) + = \conditional(s, a + {precede(s)}); + +AType \not-precede(\conditional(AType s, set[ACondition] a)) + = \conditional(s, a + {\not-precede(s)}); + + + +@doc{ +.Synopsis +Nested priority is flattened. +} +public AProduction priority(AType s, [*AProduction a, priority(AType _, list[AProduction] b), *AProduction c]) + = priority(s,a+b+c); + +@doc{ +.Synopsis +Normalization of associativity. + +.Description + +* Choice (see the `choice` constructor in <>) under associativity is flattened. +* Nested (equal) associativity is flattened. +* Priority under an associativity group defaults to choice. +} +AProduction associativity(AType s, AAssociativity as, {*AProduction a, achoice(AType t, set[AProduction] b)}) + = associativity(s, as, a+b); + +AProduction associativity(AType rhs, AAssociativity a, {associativity(rhs, AAssociativity b, set[AProduction] alts), *AProduction rest}) + = associativity(rhs, a, rest + alts); // the nested associativity, even if contradictory, is lost + +AProduction associativity(AType s, AAssociativity as, {AProduction a, priority(AType t, list[AProduction] b)}) + = associativity(s, as, {a, *b}); + +// deprecated; remove after bootstrap +AProduction associativity(AType rhs, AAssociativity a, set[AProduction] rest) + = associativity(rhs, a, withAssoc + withNewAssocs) + when withoutAssoc := {p | AProduction p:prod(_,_) <- rest, !(\aassoc(_) <- p.attributes)}, + withoutAssoc != {}, + withAssoc := rest - withoutAssoc, + withNewAssocs := {p[attributes = p.attributes + {\aassoc(a)}] | AProduction p <- withoutAssoc} + ; + +// ---- end ParseTree + +// ---- Grammar + + +@doc{ +.Synopsis +The Grammar datatype + +.Description +Grammar is the internal representation (AST) of syntax definitions used in Rascal. +A grammar is a set of productions and set of start symbols. The productions are +stored in a map for efficient access. +} +data AGrammar + = \grammar(set[AType] starts, map[AType sort, AProduction def] rules) + ; + +public AGrammar grammar(set[AType] starts, set[AProduction] prods) { + map[AType sort, AProduction def]rules = (); + + for (p <- prods) { + t = /*(p.def is label) ? p.def.symbol : */ p.def; + rules[t] = t in rules ? achoice(t, {p, rules[t]}) : achoice(t, {p}); + } + return grammar(starts, rules); +} + +//AGrammar grammar(type[&T <: Tree] sym) +// = grammar({sym.symbol}, sym.definitions); + + +@doc{ +.Synopsis +An item is an index into the symbol list of a production rule. +} +data Item = item(AProduction aproduction, int index); + +@doc{ +.Synopsis +Compose two grammars. + +.Description +Compose two grammars by adding the rules of g2 to the rules of g1. +The start symbols of g1 will be the start symbols of the resulting grammar. +} +public AGrammar compose(AGrammar g1, AGrammar g2) { + for (s <- g2.rules) + if (g1.rules[s]?) + g1.rules[s] = achoice(s, {g1.rules[s], g2.rules[s]}); + else + g1.rules[s] = g2.rules[s]; + g1.starts += g2.starts; + + reduced_rules = (); + for(s <- g1.rules){ + c = g1.rules[s]; + c.alternatives -= { *choices | priority(_, choices) <- c.alternatives } + + { *alts | associativity(_, _, alts) <- c.alternatives}; + reduced_rules[s] = c; + } + + return grammar(g1.starts, reduced_rules); +} + + + + diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/ATypeExceptions.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/ATypeExceptions.rsc new file mode 100644 index 00000000000..da998f9af56 --- /dev/null +++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/ATypeExceptions.rsc @@ -0,0 +1,39 @@ +@license{ +Copyright (c) 2018-2025, NWO-I CWI, Swat.engineering and Paul Klint +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +} +module lang::rascalcore::check::ATypeExceptions + +/* + Declare the exceptions that can be generated during checking. + Note that TypePal can also generate exceptions, in particular TypeUnavailable(), that are used in the checker. +*/ +data RuntimeException + = invalidMatch(str reason) + | invalidInstantiation(str reason) + | rascalCheckerInternalError(str reason) + | rascalCheckerInternalError(loc at, str reason) + | nonConstantType() + ; \ No newline at end of file diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/ATypeInstantiation.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/ATypeInstantiation.rsc new file mode 100644 index 00000000000..07df4c713a2 --- /dev/null +++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/ATypeInstantiation.rsc @@ -0,0 +1,253 @@ +@license{ +Copyright (c) 2018-2025, NWO-I CWI, Swat.engineering and Paul Klint +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +} +@license{ + Copyright (c) 2009-2015 CWI + All rights reserved. This program and the accompanying materials + are made available under the terms of the Eclipse Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html +} +@contributor{Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI} +@contributor{Mark Hills - Mark.Hills@cwi.nl (CWI)} +@contributor{Paul Klint - Paul Klint@cwi.nl (CWI)} +@bootstrapParser +module lang::rascalcore::check::ATypeInstantiation + +/* + Implement matching and instantiation of type parameters + Note: it is assumed that the type parameters in receiver and sender AType have already been properly renamed +*/ + +extend lang::rascalcore::check::ATypeParamBase; +extend lang::rascalcore::check::NameUtils; +extend lang::rascalcore::check::ATypeUtils; + +import List; +import Map; +import Set; +import Node; +import String; + +public Bindings unifyRascalTypeParams(AType r, AType s, Bindings b){ + b2 = matchRascalTypeParams(r, s, b); + return matchRascalTypeParams(s, r, b2); +} + +public Bindings unifyRascalTypeParams(list[AType] r, list[AType] s, Bindings b){ + if(size(r) != size(s)) + throw rascalCheckerInternalError("unifyRascalTypeParams: length unequal"); + idx = index(r); + for(int i <- idx){ + b = matchRascalTypeParams(r[i], s[i], b); + b = matchRascalTypeParams(s[i], r[i], b); + } + return b; +} + +public Bindings matchRascalTypeParams(list[AType] r, list[AType] s, Bindings b){ + if(size(r) != size(s)) + throw rascalCheckerInternalError("matchRascalTypeParams: length unequal"); + idx = index(r); + for(int i <- idx){ + b = matchRascalTypeParams(r[i], s[i], b); + } + return b; +} +// TODO: Add support for bags if we ever get around to supporting them... + +public Bindings matchRascalTypeParams(AType r, AType s, Bindings b) { + if(tvar(_) := r) throw TypeUnavailable(); + if(tvar(_) := s) throw TypeUnavailable(); + if (!typeContainsRascalTypeParams(r)) return b; + if(overloadedAType(rel[loc, IdRole, AType] overloads) := r){ + lb = lubList(toList(overloads<2>)); + return matchRascalTypeParams0(lb, s, b); + } + if(overloadedAType(rel[loc, IdRole, AType] overloads) := s){ + lb = lubList(toList(overloads<2>)); + return matchRascalTypeParams0(r, lb, b); + } + + return matchRascalTypeParams0(r,s,b); +} + +public Bindings matchRascalTypeParams0(AType r, AType s, Bindings b) { + //println("ENTER matchRascalTypeParams0: , , "); + // The simple case: if the receiver is a basic type or a node + // (i.e., has no internal structure), just do a comparability + // check. The receiver obviously does not contain a parameter. + if (arity(r) == 0 && comparable(s,r)) return b; + + // Another simple case: if the receiver has no type vars, then just return the current bindings. + if (!typeContainsRascalTypeParams(r)) return b; + + if (isRascalTypeParam(r)) { + str varName = getRascalTypeParamName(r); + AType varBound = getRascalTypeParamBound(r); + if(isRascalTypeParam(s)){ + if (varName in b) { + lubbed = alub(s, b[varName]); + if (!asubtype(lubbed, varBound)) + throw invalidMatch("Type parameter `` should be less than , but is bound to "); + b[varName] = lubbed; + } else { + b[varName] = s; + } + } else { + if (varName in b) { + if(!isRascalTypeParam(b[varName])){ + b = matchRascalTypeParams0(b[varName], s, b); + r1 = instantiateRascalTypeParameters(b[varName], b); + lubbed = alub(s, r1); + if (!asubtype(lubbed, varBound)) + throw invalidMatch("Type parameter `` should be less than , but is bound to "); + b[varName] = lubbed; + } + } else { + b[varName] = s; + } + } + //println("LEAVE matchRascalTypeParams0: , =\> "); + return b; + } + + // For sets and relations, check to see if the "contents" are + // able to be matched to one another + if ( isSetAType(r) && isSetAType(s) ) { + if ( isRelAType(r) && isVoidAType(getSetElementType(s)) ) { + return matchRascalTypeParams0(getSetElementType(r), atuple(atypeList([avoid() | _ <- index(getRelFields(r))])), b); + } else { + return matchRascalTypeParams0(getSetElementType(r), getSetElementType(s), b); + } + } + + // For lists and list relations, check to see if the "contents" are + // able to be matched to one another + if ( isListAType(r) && isListAType(s) ) { + if ( isListRelAType(r) && isVoidAType(getListElementType(s)) ) { + return matchRascalTypeParams0(getListElementType(r), atuple(atypeList([avoid() | _ <- index(getListRelFields(r))])), b); + } else { + return matchRascalTypeParams0(getListElementType(r), getListElementType(s), b); + } + } + + // For maps, match the domains and ranges + if ( isMapAType(r) && isMapAType(s) ) + return matchRascalTypeParams0(getMapFieldsAsTuple(r), getMapFieldsAsTuple(s), b); + + // For reified types, match the type being reified + if ( isReifiedAType(r) && isReifiedAType(s) ) + return matchRascalTypeParams0(getReifiedType(r), getReifiedType(s), b); + + // For ADTs, try to match parameters when the ADTs are the same + if ( isADTAType(r) && isADTAType(s) && getADTName(r) == getADTName(s) && size(getADTTypeParameters(r)) == size(getADTTypeParameters(s))) { + rparams = getADTTypeParameters(r); + sparams = getADTTypeParameters(s); + for (idx <- index(rparams)) b = matchRascalTypeParams0(rparams[idx], sparams[idx], b); + return b; + } + + // For constructors, match when the constructor name, ADT name, and arity are the same, then we can check params + if ( isConstructorAType(r) && isConstructorAType(s) && getADTName(r) == getADTName(s)) { + b = matchRascalTypeParams0(getConstructorArgumentTypesAsTuple(r), getConstructorArgumentTypesAsTuple(s), b); + return matchRascalTypeParams0(getConstructorResultType(r), getConstructorResultType(s), b); + } + + if ( isConstructorAType(r) && isADTAType(s) ) { + return matchRascalTypeParams0(getConstructorResultType(r), s, b); + } + + if ( isADTAType(r) && isConstructorAType(s) ) { + return matchRascalTypeParams0(r, getConstructorResultType(s), b); + } + + // For functions, match the return types and the parameter types + // TODO: kewyword params? + if ( isFunctionAType(r) && isFunctionAType(s) ) { + b = matchRascalTypeParams0(getFunctionArgumentTypesAsTuple(r), getFunctionArgumentTypesAsTuple(s), b); + return matchRascalTypeParams0(getFunctionReturnType(r), getFunctionReturnType(s), b); + } + + // For tuples, check the arity then match the item types + if ( isTupleAType(r) && isTupleAType(s) && getTupleFieldCount(r) == getTupleFieldCount(s) ) { + rfields = getTupleFieldTypes(r); + sfields = getTupleFieldTypes(s); + for (idx <- index(rfields)) { + b = matchRascalTypeParams0(rfields[idx], sfields[idx], b); + } + return b; + } + + if(comparable(r, s)) return b; + + throw invalidMatch("Types and do not match"); +} + +AType invalidInstantiation(str pname, AType bound, AType actual){ + throw invalidInstantiation("Type parameter `&` should be less than ``, but is bound to ``"); +} + +// NOTE used during match, no bounds check is needed since that is already done during the match +AType instantiateRascalTypeParameters(AType t, Bindings bindings){ + if(isEmpty(bindings)) + return t; + else + return visit(t) { case param:aparameter(str pname, AType _bound): { + if(bindings[pname]?){ + repl = param.alabel? ? bindings[pname][alabel=param.alabel] : bindings[pname]; //TODO simplified for compiler + insert repl; + } else { + insert param; + } + } + }; +} + +@doc{Instantiate type parameters found inside one atype.} +AType instantiateRascalTypeParameters(Tree selector, AType t, Bindings bindings, Solver s){ + if(isEmpty(bindings)) + return t; + else + return visit(t) { case param:aparameter(str pname, AType bound): { + if(pname in bindings){ + ult = bindings[pname]; + if(asubtype(ult, bound)){ + insert param.alabel? ? ult[alabel=param.alabel] : ult; + } else { + s.report(error(selector, "Type parameter &%q should be less than %t, found %t", deUnique(pname), deUnique(bound), deUnique(ult))); + } + } + } + }; +} + +@doc{Instantiate type parameters found inside two atypes.} +tuple[AType left, AType right] instantiateRascalTypeParameters(Tree selector, AType ltype, AType rtype, Bindings bindings, Solver s){ + return ; +} \ No newline at end of file diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/ATypeParamBase.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/ATypeParamBase.rsc new file mode 100644 index 00000000000..fbc04550e51 --- /dev/null +++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/ATypeParamBase.rsc @@ -0,0 +1,109 @@ +module lang::rascalcore::check::ATypeParamBase + +extend lang::rascalcore::check::ATypeBase; +extend lang::rascalcore::check::ATypeExceptions; + +public alias Bindings = map[str varName, AType varType]; + +AType makeClosedTypeParams(AType t){ + return visit(t) { case par:aparameter(_, _) => par[closed=true] }; +} + +void requireClosedTypeParams(AType t){ + if(hasOpenTypeParams(t)){ + throw "requireClosedTypeParams: "; + } +} + +bool hasOpenTypeParams(AType t){ + return /aparameter(_,_,closed=false) := t; +} + +// Make all type parameters unique with given suffix +AType makeUniqueTypeParams(AType t, str suffix){ + return visit(t) { case param:aparameter(str pname, AType _bound): { + if(findLast(pname, ".") < 0){ + param.pname = param.pname + "." + suffix; + insert param; + } + } + }; +} + +// Make all type parameters unique with given suffix +list[AType] makeUniqueTypeParams(list[AType] ts, str suffix){ + return [ makeUniqueTypeParams(t, suffix) | t <- ts ]; +} + +// Reverse the makeUnique operation +str deUnique(str s) { + i = findLast(s, "."); + return i > 0 ? s[0..i] : s; +} + +AType deUnique(AType t){ + return visit(t) { case param:aparameter(str pname, AType _bound): { + param.pname = deUnique(pname); + insert param; + } + }; +} + +Bindings deUniqueTypeParams(Bindings b){ + return (deUnique(key) : deUnique(b[key]) | key <- b); +} + +@doc{ +.Synopsis +Determine if the given type is an type variable (parameter). +} +bool isRascalTypeParam(aparameter(_,_)) = true; +default bool isRascalTypeParam(AType _) = false; + +@doc{Create a type representing a type parameter (type variable).} +AType makeTypeVar(str varName) = aparameter(varName, avalue()); + +@doc{Create a type representing a type parameter (type variable) and bound.} +AType makeTypeVarWithBound(str varName, AType varBound) = aparameter(varName, varBound); + +@doc{Get the name of a Rascal type parameter.} +str getRascalTypeParamName(AType t) { + if (aparameter(tvn,_) := t) return tvn; + throw rascalCheckerInternalError("getRascalTypeParamName given unexpected type: "); +} + +@doc{Get the bound of a type parameter.} +AType getRascalTypeParamBound(AType t) { + if (aparameter(_,tvb) := t) return tvb; + throw rascalCheckerInternalError("getRascalTypeParamBound given unexpected type: "); +} + +@doc{Get all the type parameters inside a given type.} +set[AType] collectRascalTypeParams(AType t) { + + return { rt | / AType rt : aparameter(_,_) := t }; + //return { unset(rt, "alabel") | / AType rt : aparameter(_,_) := t }; // TODO: "alabel" is unset to enable subset check later, reconsider +} + +@doc{Get all the type parameters inside a given type.} +set[AType] collectAndUnlabelRascalTypeParams(AType t) { + return { unset(rt, "alabel") | / AType rt : aparameter(_,_) := t }; // TODO: "alabel" is unset to enable subset check later, reconsider +} + +@doc{Get all the type parameters inside a given set of productions.} +set[AType] collectAndUnlabelRascalTypeParams(set[AProduction] prods) { + return { unset(rt, "alabel") | / AType rt : aparameter(_,_) := prods }; // TODO: "alabel" is unset to enable subset check later, reconsider +} + +@doc{See if a type contains any type parameters.} +bool typeContainsRascalTypeParams(AType t) = size(collectRascalTypeParams(t)) > 0; + +@doc{Return the names of all type variables in the given type.} +set[str] typeParamNames(AType t) { + return { tvn | aparameter(tvn,_) <- collectRascalTypeParams(t) }; +} + +@doc{Set "closed" to its default in all type parameters occurring in a value} +&T uncloseTypeParams(&T v) + = visit(v) { case p:aparameter(_,_,closed=true) => unset(p,"closed") }; + \ No newline at end of file diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/ATypeUtils.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/ATypeUtils.rsc new file mode 100644 index 00000000000..4243ece11cc --- /dev/null +++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/ATypeUtils.rsc @@ -0,0 +1,1493 @@ +@license{ +Copyright (c) 2018-2025, NWO-I CWI, Swat.engineering and Paul Klint +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +} +@bootstrapParser +module lang::rascalcore::check::ATypeUtils + +/* + Utility functions to get information from ATypes as well as predicates on ATypes. + Also conversion functions to/from ATypes. +*/ + +extend lang::rascalcore::check::AType; +//extend lang::rascalcore::check::ATypeInstantiation; +extend lang::rascalcore::check::ATypeExceptions; +extend lang::rascalcore::check::BasicRascalConfig; + +extend ParseTree; + +import analysis::typepal::Messenger; +extend lang::rascal::\syntax::Rascal; + +import lang::rascalcore::compile::util::Names; // TODO: undesired forward reference + +import IO; +import List; +import Node; +import Set; +import String; + +str unescape(str s) = replaceAll(s, "\\", ""); + +AType removeLabels(AType t) = unsetRec(t, "alabel"); + +AType inheritLabel(AType x, AType y) = (x.alabel?) ? y[alabel=x.alabel] : y; + +// ---- print atypes ---------------------------------------------------------- + +@doc{Pretty printer for Rascal abstract types.} +str prettyAType(aint()) = "int"; +str prettyAType(abool()) = "bool"; +str prettyAType(areal()) = "real"; +str prettyAType(arat()) = "rat"; +str prettyAType(astr()) = "str"; +str prettyAType(anum()) = "num"; +str prettyAType(anode(list[AType] fields)) = isEmpty(fields) ? "node" : "node( = ..." | ft <- fields])>)"; +str prettyAType(avoid()) = "void"; +str prettyAType(avalue()) = "value"; +str prettyAType(aloc()) = "loc"; +str prettyAType(adatetime()) = "datetime"; +str prettyAType(alist(AType t)) = "list[]"; +str prettyAType(aset(AType t)) = "set[]"; +str prettyAType(atuple(AType ts)) = "tuple[]"; +str prettyAType(amap(AType d, AType r)) = "map[, ]"; +str prettyAType(arel(AType ts)) = "rel[]"; +str prettyAType(alrel(AType ts)) = "lrel[]"; + +str prettyAType(afunc(AType ret, list[AType] formals, list[Keyword] kwFormals)) + = "( =..." | Keyword kw <- kwFormals])>)"; + +str prettyAType(aalias(str aname, [], AType aliased)) = "alias = "; +str prettyAType(aalias(str aname, ps, AType aliased)) = "alias [] = " when size(ps) > 0; + +str prettyAType(aanno(str aname, AType onType, AType annoType)) = "anno @"; + +str prettyAType(aadt(str s, [], SyntaxRole _)) = s; +str prettyAType(aadt(str s, ps, SyntaxRole _)) = "[]" when size(ps) > 0; + +str prettyAType(t: acons(AType adt, /*str consName,*/ + list[AType] fields, + list[Keyword] kwFields)) + = "::(" : "">" | ft <- fields])> =..." | Keyword kw <- kwFields])>)"; + +str prettyAType(amodule(str mname)) = "module "; +str prettyAType(aparameter(str pn, AType t, closed=c)) = + ((avalue() := t) ? "&" : "& \<: "); +str prettyAType(areified(AType t)) = "type[]"; + +// utilities +str prettyAType(overloadedAType(rel[loc, IdRole, AType] overloads)) + = intercalateOr([prettyAType(t1) | t1 <- {t | <_, _, t> <- overloads} ]); + +str prettyAType(list[AType] atypes) = intercalate(", ", [prettyAType(t) | t <- atypes]); + +str prettyAType(Keyword kw: kwField(fieldType, fieldName, _,defaultExp)) = " = "; +str prettyAType(Keyword kw: kwField(fieldType,fieldName, _)) = " = ?"; + +// non-terminal symbols +str prettyAType(\prod(AType s, list[AType] fs/*, SyntaxRole _*/)) = " : ()"; //TODO others + +// terminal symbols +str prettyAType(alit(str string)) = string; +str prettyAType(acilit(str string)) = string; +str prettyAType(cc: \achar-class(list[ACharRange] ranges)) { + return cc == anyCharType ? "![]" : "[-" | r <- ranges ])>]"; +} + +str prettyAType(\start(AType symbol)) = "start[]"; + +// regular symbols +str prettyAType(\aempty()) = "()"; +str prettyAType(\opt(AType symbol)) = "?"; +str prettyAType(\iter(AType symbol)) = "+"; +str prettyAType(\iter-star(AType symbol)) = "*"; +str prettyAType(\iter-seps(AType symbol, list[AType] separators)) = "{ \"" | sep <- separators, !isLayoutAType(sep) ])>}+"; +str prettyAType(\iter-star-seps(AType symbol, list[AType] separators)) = "{ \"" | sep <- separators, !isLayoutAType(sep) ])>}*"; +str prettyAType(\alt(set[AType] alternatives)) = "( )" when size(alternatives) > 1; +str prettyAType(\seq(list[AType] sequence)) = "( )" when size(sequence) > 1; +str prettyAType(\conditional(AType symbol, set[ACondition] conditions)) = " { }"; +default str prettyAType(AType s) = ""; //""; + +private str prettyPrintCond(ACondition::\follow(AType symbol)) = "\>\> "; +private str prettyPrintCond(ACondition::\not-follow(AType symbol)) = "!\>\> "; +private str prettyPrintCond(ACondition::\precede(AType symbol)) = " \<\<"; +private str prettyPrintCond(ACondition::\not-precede(AType symbol)) = " !\<\<"; +private str prettyPrintCond(ACondition::\delete(AType symbol)) = " \\ "; +private str prettyPrintCond("a-at-column"(int column)) = "@"; +private str prettyPrintCond("a-begin-of-line"()) = "^"; +private str prettyPrintCond("a-end-of-line"()) = "$"; +private str prettyPrintCond("a-except"(str label)) = "!